@angular-devkit/build-angular 14.0.3 → 14.1.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/builders.json CHANGED
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "browser-esbuild": {
15
15
  "implementation": "./src/builders/browser-esbuild",
16
- "schema": "./src/builders/browser/schema.json",
16
+ "schema": "./src/builders/browser-esbuild/schema.json",
17
17
  "description": "Build a browser application."
18
18
  },
19
19
  "dev-server": {
package/package.json CHANGED
@@ -1,83 +1,83 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "14.0.3",
3
+ "version": "14.1.0-next.2",
4
4
  "description": "Angular Webpack Build Facade",
5
5
  "main": "src/index.js",
6
6
  "typings": "src/index.d.ts",
7
7
  "builders": "builders.json",
8
8
  "dependencies": {
9
9
  "@ampproject/remapping": "2.2.0",
10
- "@angular-devkit/architect": "0.1400.3",
11
- "@angular-devkit/build-webpack": "0.1400.3",
12
- "@angular-devkit/core": "14.0.3",
13
- "@babel/core": "7.17.10",
14
- "@babel/generator": "7.17.10",
10
+ "@angular-devkit/architect": "0.1401.0-next.2",
11
+ "@angular-devkit/build-webpack": "0.1401.0-next.2",
12
+ "@angular-devkit/core": "14.1.0-next.2",
13
+ "@babel/core": "7.18.2",
14
+ "@babel/generator": "7.18.2",
15
15
  "@babel/helper-annotate-as-pure": "7.16.7",
16
- "@babel/plugin-proposal-async-generator-functions": "7.16.8",
17
- "@babel/plugin-transform-async-to-generator": "7.16.8",
18
- "@babel/plugin-transform-runtime": "7.17.10",
19
- "@babel/preset-env": "7.17.10",
20
- "@babel/runtime": "7.17.9",
16
+ "@babel/plugin-proposal-async-generator-functions": "7.17.12",
17
+ "@babel/plugin-transform-async-to-generator": "7.17.12",
18
+ "@babel/plugin-transform-runtime": "7.18.2",
19
+ "@babel/preset-env": "7.18.2",
20
+ "@babel/runtime": "7.18.3",
21
21
  "@babel/template": "7.16.7",
22
22
  "@discoveryjs/json-ext": "0.5.7",
23
- "@ngtools/webpack": "14.0.3",
24
- "ansi-colors": "4.1.1",
23
+ "@ngtools/webpack": "14.1.0-next.2",
24
+ "ansi-colors": "4.1.3",
25
25
  "babel-loader": "8.2.5",
26
26
  "babel-plugin-istanbul": "6.1.1",
27
27
  "browserslist": "^4.9.1",
28
- "cacache": "16.0.7",
29
- "copy-webpack-plugin": "10.2.4",
28
+ "cacache": "16.1.1",
29
+ "copy-webpack-plugin": "11.0.0",
30
30
  "critters": "0.0.16",
31
31
  "css-loader": "6.7.1",
32
- "esbuild-wasm": "0.14.38",
33
- "glob": "8.0.1",
32
+ "esbuild-wasm": "0.14.42",
33
+ "glob": "8.0.3",
34
34
  "https-proxy-agent": "5.0.1",
35
35
  "inquirer": "8.2.4",
36
36
  "jsonc-parser": "3.0.0",
37
37
  "karma-source-map-support": "1.4.0",
38
38
  "less": "4.1.2",
39
- "less-loader": "10.2.0",
39
+ "less-loader": "11.0.0",
40
40
  "license-webpack-plugin": "4.0.2",
41
41
  "loader-utils": "3.2.0",
42
42
  "mini-css-extract-plugin": "2.6.0",
43
- "minimatch": "5.0.1",
43
+ "minimatch": "5.1.0",
44
44
  "open": "8.4.0",
45
45
  "ora": "5.4.1",
46
46
  "parse5-html-rewriting-stream": "6.0.1",
47
47
  "piscina": "3.2.0",
48
- "postcss": "8.4.13",
48
+ "postcss": "8.4.14",
49
49
  "postcss-import": "14.1.0",
50
- "postcss-loader": "6.2.1",
51
- "postcss-preset-env": "7.5.0",
50
+ "postcss-loader": "7.0.0",
51
+ "postcss-preset-env": "7.7.0",
52
52
  "regenerator-runtime": "0.13.9",
53
53
  "resolve-url-loader": "5.0.0",
54
54
  "rxjs": "6.6.7",
55
- "sass": "1.51.0",
56
- "sass-loader": "12.6.0",
55
+ "sass": "1.52.2",
56
+ "sass-loader": "13.0.0",
57
57
  "semver": "7.3.7",
58
- "source-map-loader": "3.0.1",
58
+ "source-map-loader": "4.0.0",
59
59
  "source-map-support": "0.5.21",
60
- "stylus": "0.57.0",
61
- "stylus-loader": "6.2.0",
62
- "terser": "5.13.1",
60
+ "stylus": "0.58.1",
61
+ "stylus-loader": "7.0.0",
62
+ "terser": "5.14.0",
63
63
  "text-table": "0.2.0",
64
64
  "tree-kill": "1.2.2",
65
65
  "tslib": "2.4.0",
66
- "webpack": "5.72.1",
67
- "webpack-dev-middleware": "5.3.1",
68
- "webpack-dev-server": "4.9.0",
66
+ "webpack": "5.73.0",
67
+ "webpack-dev-middleware": "5.3.3",
68
+ "webpack-dev-server": "4.9.1",
69
69
  "webpack-merge": "5.8.0",
70
70
  "webpack-subresource-integrity": "5.1.0"
71
71
  },
72
72
  "optionalDependencies": {
73
- "esbuild": "0.14.38"
73
+ "esbuild": "0.14.42"
74
74
  },
75
75
  "peerDependencies": {
76
- "@angular/compiler-cli": "^14.0.0",
77
- "@angular/localize": "^14.0.0",
78
- "@angular/service-worker": "^14.0.0",
76
+ "@angular/compiler-cli": "^14.0.0 || ^14.0.0-next || ^14.1.0-next",
77
+ "@angular/localize": "^14.0.0 || ^14.0.0-next || ^14.1.0-next",
78
+ "@angular/service-worker": "^14.0.0 || ^14.0.0-next || ^14.1.0-next",
79
79
  "karma": "^6.3.0",
80
- "ng-packagr": "^14.0.0",
80
+ "ng-packagr": "^14.0.0 || ^14.0.0-next || ^14.1.0-next",
81
81
  "protractor": "^7.0.0",
82
82
  "tailwindcss": "^2.0.0 || ^3.0.0",
83
83
  "typescript": ">=4.6.2 <4.8"
@@ -34,6 +34,7 @@ const architect_1 = require("@angular-devkit/architect");
34
34
  const fs = __importStar(require("fs"));
35
35
  const path = __importStar(require("path"));
36
36
  const utils_1 = require("../../utils");
37
+ const error_1 = require("../../utils/error");
37
38
  const inline_critical_css_1 = require("../../utils/index-file/inline-critical-css");
38
39
  const service_worker_1 = require("../../utils/service-worker");
39
40
  const spinner_1 = require("../../utils/spinner");
@@ -152,6 +153,7 @@ async function _appShellBuilder(options, context) {
152
153
  }
153
154
  catch (err) {
154
155
  spinner === null || spinner === void 0 ? void 0 : spinner.fail('Application shell generation failed.');
156
+ (0, error_1.assertIsError)(err);
155
157
  return { success: false, error: err.message };
156
158
  }
157
159
  finally {
@@ -42,6 +42,7 @@ const utils_1 = require("../../utils");
42
42
  const bundle_calculator_1 = require("../../utils/bundle-calculator");
43
43
  const color_1 = require("../../utils/color");
44
44
  const copy_assets_1 = require("../../utils/copy-assets");
45
+ const error_1 = require("../../utils/error");
45
46
  const i18n_inlining_1 = require("../../utils/i18n-inlining");
46
47
  const index_html_generator_1 = require("../../utils/index-file/index-html-generator");
47
48
  const normalize_cache_1 = require("../../utils/normalize-cache");
@@ -193,6 +194,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
193
194
  }
194
195
  catch (err) {
195
196
  spinner.fail(color_1.colors.redBright('Copying of assets failed.'));
197
+ (0, error_1.assertIsError)(err);
196
198
  return { success: false, error: 'Unable to copy assets: ' + err.message };
197
199
  }
198
200
  }
@@ -21,9 +21,6 @@ const UNSUPPORTED_OPTIONS = [
21
21
  // The following two have no effect when localize is not enabled
22
22
  // 'i18nDuplicateTranslation',
23
23
  // 'i18nMissingTranslation',
24
- // * Serviceworker support
25
- 'ngswConfigPath',
26
- 'serviceWorker',
27
24
  // * Stylesheet preprocessor support
28
25
  'inlineStyleLanguage',
29
26
  // The following option has no effect until preprocessors are supported
@@ -6,7 +6,7 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  import { BuilderContext, BuilderOutput } from '@angular-devkit/architect';
9
- import { Schema as BrowserBuilderOptions } from '../browser/schema';
9
+ import { Schema as BrowserBuilderOptions } from './schema';
10
10
  /**
11
11
  * Main execution function for the esbuild-based application builder.
12
12
  * The options are compatible with the Webpack-based builder.
@@ -14,6 +14,6 @@ import { Schema as BrowserBuilderOptions } from '../browser/schema';
14
14
  * @param context The Architect builder context object
15
15
  * @returns A promise with the builder result output
16
16
  */
17
- export declare function execute(options: BrowserBuilderOptions, context: BuilderContext): Promise<BuilderOutput>;
17
+ export declare function buildEsbuildBrowser(options: BrowserBuilderOptions, context: BuilderContext): Promise<BuilderOutput>;
18
18
  declare const _default: import("@angular-devkit/architect/src/internal").Builder<BrowserBuilderOptions & import("../../../../core/src").JsonObject>;
19
19
  export default _default;
@@ -30,15 +30,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
30
30
  return result;
31
31
  };
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.execute = void 0;
33
+ exports.buildEsbuildBrowser = void 0;
34
34
  const architect_1 = require("@angular-devkit/architect");
35
35
  const assert = __importStar(require("assert"));
36
36
  const fs_1 = require("fs");
37
37
  const path = __importStar(require("path"));
38
38
  const utils_1 = require("../../utils");
39
39
  const copy_assets_1 = require("../../utils/copy-assets");
40
+ const error_1 = require("../../utils/error");
40
41
  const index_html_generator_1 = require("../../utils/index-file/index-html-generator");
41
42
  const package_chunk_sort_1 = require("../../utils/package-chunk-sort");
43
+ const service_worker_1 = require("../../utils/service-worker");
42
44
  const webpack_browser_config_1 = require("../../utils/webpack-browser-config");
43
45
  const configs_1 = require("../../webpack/configs");
44
46
  const compiler_plugin_1 = require("./compiler-plugin");
@@ -54,7 +56,7 @@ const stylesheets_1 = require("./stylesheets");
54
56
  * @returns A promise with the builder result output
55
57
  */
56
58
  // eslint-disable-next-line max-lines-per-function
57
- async function execute(options, context) {
59
+ async function buildEsbuildBrowser(options, context) {
58
60
  var _a, _b, _c, _d, _e, _f;
59
61
  const startTime = Date.now();
60
62
  // Only AOT is currently supported
@@ -70,7 +72,7 @@ async function execute(options, context) {
70
72
  context.logger.error(`The 'browser-esbuild' builder requires a target to be specified.`);
71
73
  return { success: false };
72
74
  }
73
- const { workspaceRoot, mainEntryPoint, polyfillsEntryPoint, optimizationOptions, outputPath, sourcemapOptions, tsconfig, assets, outputNames, } = await (0, options_1.normalizeOptions)(context, projectName, options);
75
+ const { projectRoot, workspaceRoot, mainEntryPoint, polyfillsEntryPoint, optimizationOptions, outputPath, sourcemapOptions, tsconfig, assets, outputNames, } = await (0, options_1.normalizeOptions)(context, projectName, options);
74
76
  // Clean output path if enabled
75
77
  if (options.deleteOutputPath) {
76
78
  (0, utils_1.deleteOutputDir)(workspaceRoot, options.outputPath);
@@ -115,8 +117,8 @@ async function execute(options, context) {
115
117
  await fs_1.promises.mkdir(outputPath, { recursive: true });
116
118
  }
117
119
  catch (e) {
118
- const reason = 'message' in e ? e.message : 'Unknown error';
119
- context.logger.error('Unable to create output directory: ' + reason);
120
+ (0, error_1.assertIsError)(e);
121
+ context.logger.error('Unable to create output directory: ' + e.message);
120
122
  return { success: false };
121
123
  }
122
124
  // Process global stylesheets
@@ -201,10 +203,21 @@ async function execute(options, context) {
201
203
  }
202
204
  // Write output files
203
205
  await Promise.all(outputFiles.map((file) => fs_1.promises.writeFile(path.join(outputPath, file.path), file.contents)));
206
+ // Augment the application with service worker support
207
+ // TODO: This should eventually operate on the in-memory files prior to writing the output files
208
+ if (options.serviceWorker) {
209
+ try {
210
+ await (0, service_worker_1.augmentAppWithServiceWorker)(projectRoot, workspaceRoot, outputPath, options.baseHref || '/', options.ngswConfigPath);
211
+ }
212
+ catch (error) {
213
+ context.logger.error(error instanceof Error ? error.message : `${error}`);
214
+ return { success: false };
215
+ }
216
+ }
204
217
  context.logger.info(`Complete. [${(Date.now() - startTime) / 1000} seconds]`);
205
218
  return { success: true };
206
219
  }
207
- exports.execute = execute;
220
+ exports.buildEsbuildBrowser = buildEsbuildBrowser;
208
221
  function createOutputFileFromText(path, text) {
209
222
  return {
210
223
  path,
@@ -234,6 +247,7 @@ async function bundleCode(workspaceRoot, entryPoints, outputNames, options, opti
234
247
  sourcemap: sourcemapOptions.scripts && (sourcemapOptions.hidden ? 'external' : true),
235
248
  splitting: true,
236
249
  tsconfig,
250
+ external: options.externalDependencies,
237
251
  write: false,
238
252
  platform: 'browser',
239
253
  preserveSymlinks: options.preserveSymlinks,
@@ -259,4 +273,4 @@ async function bundleCode(workspaceRoot, entryPoints, outputNames, options, opti
259
273
  },
260
274
  });
261
275
  }
262
- exports.default = (0, architect_1.createBuilder)(execute);
276
+ exports.default = (0, architect_1.createBuilder)(buildEsbuildBrowser);