@angular-devkit/build-angular 14.2.2 → 15.0.0-next.0

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/package.json CHANGED
@@ -1,39 +1,39 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "14.2.2",
3
+ "version": "15.0.0-next.0",
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.1402.2",
11
- "@angular-devkit/build-webpack": "0.1402.2",
12
- "@angular-devkit/core": "14.2.2",
13
- "@babel/core": "7.18.10",
14
- "@babel/generator": "7.18.12",
10
+ "@angular-devkit/architect": "0.1500.0-next.0",
11
+ "@angular-devkit/build-webpack": "0.1500.0-next.0",
12
+ "@angular-devkit/core": "15.0.0-next.0",
13
+ "@babel/core": "7.19.0",
14
+ "@babel/generator": "7.19.0",
15
15
  "@babel/helper-annotate-as-pure": "7.18.6",
16
- "@babel/plugin-proposal-async-generator-functions": "7.18.10",
16
+ "@babel/plugin-proposal-async-generator-functions": "7.19.0",
17
17
  "@babel/plugin-transform-async-to-generator": "7.18.6",
18
18
  "@babel/plugin-transform-runtime": "7.18.10",
19
- "@babel/preset-env": "7.18.10",
20
- "@babel/runtime": "7.18.9",
19
+ "@babel/preset-env": "7.19.0",
20
+ "@babel/runtime": "7.19.0",
21
21
  "@babel/template": "7.18.10",
22
22
  "@discoveryjs/json-ext": "0.5.7",
23
- "@ngtools/webpack": "14.2.2",
23
+ "@ngtools/webpack": "15.0.0-next.0",
24
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.1.2",
28
+ "cacache": "16.1.3",
29
29
  "copy-webpack-plugin": "11.0.0",
30
30
  "critters": "0.0.16",
31
31
  "css-loader": "6.7.1",
32
- "esbuild-wasm": "0.15.5",
32
+ "esbuild-wasm": "0.15.7",
33
33
  "glob": "8.0.3",
34
34
  "https-proxy-agent": "5.0.1",
35
35
  "inquirer": "8.2.4",
36
- "jsonc-parser": "3.1.0",
36
+ "jsonc-parser": "3.2.0",
37
37
  "karma-source-map-support": "1.4.0",
38
38
  "less": "4.1.3",
39
39
  "less-loader": "11.0.0",
@@ -48,18 +48,18 @@
48
48
  "postcss": "8.4.16",
49
49
  "postcss-import": "15.0.0",
50
50
  "postcss-loader": "7.0.1",
51
- "postcss-preset-env": "7.8.0",
51
+ "postcss-preset-env": "7.8.1",
52
52
  "regenerator-runtime": "0.13.9",
53
53
  "resolve-url-loader": "5.0.0",
54
54
  "rxjs": "6.6.7",
55
- "sass": "1.54.4",
55
+ "sass": "1.54.9",
56
56
  "sass-loader": "13.0.2",
57
57
  "semver": "7.3.7",
58
58
  "source-map-loader": "4.0.0",
59
59
  "source-map-support": "0.5.21",
60
60
  "stylus": "0.59.0",
61
61
  "stylus-loader": "7.0.0",
62
- "terser": "5.14.2",
62
+ "terser": "5.15.0",
63
63
  "text-table": "0.2.0",
64
64
  "tree-kill": "1.2.2",
65
65
  "tslib": "2.4.0",
@@ -70,14 +70,14 @@
70
70
  "webpack-subresource-integrity": "5.1.0"
71
71
  },
72
72
  "optionalDependencies": {
73
- "esbuild": "0.15.5"
73
+ "esbuild": "0.15.7"
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": "^15.0.0-next",
77
+ "@angular/localize": "^15.0.0-next",
78
+ "@angular/service-worker": "^15.0.0-next",
79
79
  "karma": "^6.3.0",
80
- "ng-packagr": "^14.0.0",
80
+ "ng-packagr": "^15.0.0-next",
81
81
  "protractor": "^7.0.0",
82
82
  "tailwindcss": "^2.0.0 || ^3.0.0",
83
83
  "typescript": ">=4.6.2 <4.9"
@@ -134,7 +134,6 @@ function createCompilerPlugin(pluginOptions, styleOptions) {
134
134
  // The tsconfig is loaded in setup instead of in start to allow the esbuild target build option to be modified.
135
135
  // esbuild build options can only be modified in setup prior to starting the build.
136
136
  const { options: compilerOptions, rootNames, errors: configurationDiagnostics, } = compilerCli.readConfiguration(pluginOptions.tsconfig, {
137
- enableIvy: true,
138
137
  noEmitOnError: false,
139
138
  suppressOutputPathCheck: true,
140
139
  outDir: undefined,
@@ -270,7 +269,7 @@ function createCompilerPlugin(pluginOptions, styleOptions) {
270
269
  };
271
270
  }
272
271
  const data = (_a = typescriptResult.content) !== null && _a !== void 0 ? _a : '';
273
- const forceAsyncTransformation = /for\s+await\s*\(|async\s+function\s*\*/.test(data);
272
+ const forceAsyncTransformation = /async\s+function\s*\*/.test(data);
274
273
  const useInputSourcemap = pluginOptions.sourcemap &&
275
274
  (!!pluginOptions.thirdPartySourcemaps || !/[\\/]node_modules[\\/]/.test(args.path));
276
275
  // If no additional transformations are needed, return the TypeScript output directly
@@ -310,8 +309,7 @@ function createCompilerPlugin(pluginOptions, styleOptions) {
310
309
  build.onLoad({ filter: /\.[cm]?js$/ }, async (args) => {
311
310
  var _a;
312
311
  const data = await fs_1.promises.readFile(args.path, 'utf-8');
313
- const forceAsyncTransformation = !/[\\/][_f]?esm2015[\\/]/.test(args.path) &&
314
- /for\s+await\s*\(|async\s+function\s*\*/.test(data);
312
+ const forceAsyncTransformation = !/[\\/][_f]?esm2015[\\/]/.test(args.path) && /async\s+function\s*\*/.test(data);
315
313
  const shouldLink = await (0, webpack_loader_1.requiresLinking)(args.path, data);
316
314
  const useInputSourcemap = pluginOptions.sourcemap &&
317
315
  (!!pluginOptions.thirdPartySourcemaps || !/[\\/]node_modules[\\/]/.test(args.path));
@@ -72,20 +72,20 @@ async function buildEsbuildBrowser(options, context) {
72
72
  context.logger.error(`The 'browser-esbuild' builder requires a target to be specified.`);
73
73
  return { success: false };
74
74
  }
75
- const { projectRoot, workspaceRoot, mainEntryPoint, polyfillsEntryPoint, optimizationOptions, outputPath, sourcemapOptions, tsconfig, assets, outputNames, } = await (0, options_1.normalizeOptions)(context, projectName, options);
75
+ const { projectRoot, workspaceRoot, entryPoints, entryPointNameLookup, optimizationOptions, outputPath, sourcemapOptions, tsconfig, assets, outputNames, } = await (0, options_1.normalizeOptions)(context, projectName, options);
76
76
  // Clean output path if enabled
77
77
  if (options.deleteOutputPath) {
78
78
  (0, utils_1.deleteOutputDir)(workspaceRoot, options.outputPath);
79
79
  }
80
- // Setup bundler entry points
81
- const entryPoints = {
82
- main: mainEntryPoint,
83
- };
84
- if (polyfillsEntryPoint) {
85
- entryPoints['polyfills'] = polyfillsEntryPoint;
80
+ // Create output directory if needed
81
+ try {
82
+ await fs_1.promises.mkdir(outputPath, { recursive: true });
83
+ }
84
+ catch (e) {
85
+ (0, error_1.assertIsError)(e);
86
+ context.logger.error('Unable to create output directory: ' + e.message);
87
+ return { success: false };
86
88
  }
87
- // Create reverse lookup used during index HTML generation
88
- const entryPointNameLookup = new Map(Object.entries(entryPoints).map(([name, filePath]) => [path.relative(workspaceRoot, filePath), name]));
89
89
  const [codeResults, styleResults] = await Promise.all([
90
90
  // Execute esbuild to bundle the application code
91
91
  bundleCode(workspaceRoot, entryPoints, outputNames, options, optimizationOptions, sourcemapOptions, tsconfig),
@@ -126,15 +126,6 @@ async function buildEsbuildBrowser(options, context) {
126
126
  if (styleResults.errors.length) {
127
127
  return { success: false };
128
128
  }
129
- // Create output directory if needed
130
- try {
131
- await fs_1.promises.mkdir(outputPath, { recursive: true });
132
- }
133
- catch (e) {
134
- (0, error_1.assertIsError)(e);
135
- context.logger.error('Unable to create output directory: ' + e.message);
136
- return { success: false };
137
- }
138
129
  // Generate index HTML file
139
130
  if (options.index) {
140
131
  const entrypoints = (0, package_chunk_sort_1.generateEntryPoints)({
@@ -216,15 +207,11 @@ async function bundleCode(workspaceRoot, entryPoints, outputNames, options, opti
216
207
  target: 'es2020',
217
208
  supported: {
218
209
  // Native async/await is not supported with Zone.js. Disabling support here will cause
219
- // esbuild to downlevel async/await to a Zone.js supported form.
210
+ // esbuild to downlevel async/await and for await...of to a Zone.js supported form. However, esbuild
211
+ // does not currently support downleveling async generators. Instead babel is used within the JS/TS
212
+ // loader to perform the downlevel transformation.
213
+ // NOTE: If esbuild adds support in the future, the babel support for async generators can be disabled.
220
214
  'async-await': false,
221
- // Zone.js also does not support async generators or async iterators. However, esbuild does
222
- // not currently support downleveling either of them. Instead babel is used within the JS/TS
223
- // loader to perform the downlevel transformation. They are both disabled here to allow
224
- // esbuild to handle them in the future if support is ever added.
225
- // NOTE: If esbuild adds support in the future, the babel support for these can be disabled.
226
- 'async-generator': false,
227
- 'for-await': false,
228
215
  },
229
216
  mainFields: ['es2020', 'browser', 'module', 'main'],
230
217
  conditions: ['es2020', 'es2015', 'module'],
@@ -19,8 +19,8 @@ import { Schema as BrowserBuilderOptions } from '../browser/schema';
19
19
  */
20
20
  export declare function normalizeOptions(context: BuilderContext, projectName: string, options: BrowserBuilderOptions): Promise<{
21
21
  workspaceRoot: string;
22
- mainEntryPoint: string;
23
- polyfillsEntryPoint: string | undefined;
22
+ entryPoints: Record<string, string>;
23
+ entryPointNameLookup: ReadonlyMap<string, string>;
24
24
  optimizationOptions: import("../../utils").NormalizedOptimizationOptions;
25
25
  outputPath: string;
26
26
  sourcemapOptions: import("../browser/schema").SourceMapClass;
@@ -71,10 +71,19 @@ async function normalizeOptions(context, projectName, options) {
71
71
  if (options.resourcesOutputPath) {
72
72
  outputNames.media = path.join(options.resourcesOutputPath, outputNames.media);
73
73
  }
74
+ // Setup bundler entry points
75
+ const entryPoints = {
76
+ main: mainEntryPoint,
77
+ };
78
+ if (polyfillsEntryPoint) {
79
+ entryPoints['polyfills'] = polyfillsEntryPoint;
80
+ }
81
+ // Create reverse lookup used during index HTML generation
82
+ const entryPointNameLookup = new Map(Object.entries(entryPoints).map(([name, filePath]) => [path.relative(workspaceRoot, filePath), name]));
74
83
  return {
75
84
  workspaceRoot,
76
- mainEntryPoint,
77
- polyfillsEntryPoint,
85
+ entryPoints,
86
+ entryPointNameLookup,
78
87
  optimizationOptions,
79
88
  outputPath,
80
89
  sourcemapOptions,
@@ -40,8 +40,10 @@ async function createTranslationLoader() {
40
40
  const content = fs.readFileSync(path, 'utf8');
41
41
  const unusedParsers = new Map();
42
42
  for (const [format, parser] of Object.entries(parsers)) {
43
- const analysis = analyze(parser, path, content);
43
+ const analysis = parser.analyze(path, content);
44
44
  if (analysis.canParse) {
45
+ // Types don't overlap here so we need to use any.
46
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
47
  const { locale, translations } = parser.parse(path, content, analysis.hint);
46
48
  const integrity = 'sha256-' + (0, crypto_1.createHash)('sha256').update(content).digest('base64');
47
49
  return { format, locale, translations, diagnostics, integrity };
@@ -57,17 +59,6 @@ async function createTranslationLoader() {
57
59
  throw new Error(`Unsupported translation file format in ${path}. The following parsers were tried:\n` +
58
60
  messages.join('\n'));
59
61
  };
60
- // TODO: `parser.canParse()` is deprecated; remove this polyfill once we are sure all parsers provide the `parser.analyze()` method.
61
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
62
- function analyze(parser, path, content) {
63
- if (parser.analyze !== undefined) {
64
- return parser.analyze(path, content);
65
- }
66
- else {
67
- const hint = parser.canParse(path, content);
68
- return { canParse: hint !== false, hint, diagnostics };
69
- }
70
- }
71
62
  }
72
63
  exports.createTranslationLoader = createTranslationLoader;
73
64
  async function importParsers() {
@@ -10,20 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.createIvyPlugin = void 0;
11
11
  const webpack_1 = require("@ngtools/webpack");
12
12
  const typescript_1 = require("typescript");
13
- function ensureIvy(wco) {
14
- if (wco.tsConfig.options.enableIvy !== false) {
15
- return;
16
- }
17
- wco.logger.warn('Project is attempting to disable the Ivy compiler. ' +
18
- 'Angular versions 12 and higher do not support the deprecated View Engine compiler for applications. ' +
19
- 'The Ivy compiler will be used to build this project. ' +
20
- '\nFor additional information or if the build fails, please see https://angular.io/guide/ivy');
21
- wco.tsConfig.options.enableIvy = true;
22
- }
23
13
  function createIvyPlugin(wco, aot, tsconfig) {
24
- if (aot) {
25
- ensureIvy(wco);
26
- }
27
14
  const { buildOptions } = wco;
28
15
  const optimize = buildOptions.optimization.scripts;
29
16
  const compilerOptions = {