@angular-devkit/build-angular 14.2.3 → 15.0.0-next.1

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,40 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "14.2.3",
3
+ "version": "15.0.0-next.1",
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.3",
11
- "@angular-devkit/build-webpack": "0.1402.3",
12
- "@angular-devkit/core": "14.2.3",
13
- "@babel/core": "7.18.10",
14
- "@babel/generator": "7.18.12",
10
+ "@angular-devkit/architect": "0.1500.0-next.1",
11
+ "@angular-devkit/build-webpack": "0.1500.0-next.1",
12
+ "@angular-devkit/core": "15.0.0-next.1",
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.3",
23
+ "@ngtools/webpack": "15.0.0-next.1",
24
24
  "ansi-colors": "4.1.3",
25
+ "autoprefixer": "10.4.10",
25
26
  "babel-loader": "8.2.5",
26
27
  "babel-plugin-istanbul": "6.1.1",
27
28
  "browserslist": "^4.9.1",
28
- "cacache": "16.1.2",
29
+ "cacache": "16.1.3",
29
30
  "copy-webpack-plugin": "11.0.0",
30
31
  "critters": "0.0.16",
31
32
  "css-loader": "6.7.1",
32
- "esbuild-wasm": "0.15.5",
33
+ "esbuild-wasm": "0.15.7",
33
34
  "glob": "8.0.3",
34
35
  "https-proxy-agent": "5.0.1",
35
36
  "inquirer": "8.2.4",
36
- "jsonc-parser": "3.1.0",
37
+ "jsonc-parser": "3.2.0",
37
38
  "karma-source-map-support": "1.4.0",
38
39
  "less": "4.1.3",
39
40
  "less-loader": "11.0.0",
@@ -48,18 +49,17 @@
48
49
  "postcss": "8.4.16",
49
50
  "postcss-import": "15.0.0",
50
51
  "postcss-loader": "7.0.1",
51
- "postcss-preset-env": "7.8.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.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,
@@ -33,7 +33,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
33
33
  exports.execute = void 0;
34
34
  const architect_1 = require("@angular-devkit/architect");
35
35
  const build_webpack_1 = require("@angular-devkit/build-webpack");
36
- const core_1 = require("@angular-devkit/core");
37
36
  const path = __importStar(require("path"));
38
37
  const rxjs_1 = require("rxjs");
39
38
  const operators_1 = require("rxjs/operators");
@@ -55,23 +54,6 @@ function execute(options, context, transforms = {}) {
55
54
  (0, version_1.assertCompatibleAngularVersion)(root);
56
55
  const baseOutputPath = path.resolve(root, options.outputPath);
57
56
  let outputPaths;
58
- if (typeof options.bundleDependencies === 'string') {
59
- options.bundleDependencies = options.bundleDependencies === 'all';
60
- context.logger.warn(`Option 'bundleDependencies' string value is deprecated since version 9. Use a boolean value instead.`);
61
- }
62
- if (!options.bundleDependencies) {
63
- // eslint-disable-next-line import/no-extraneous-dependencies
64
- const { __processed_by_ivy_ngcc__, main = '' } = require('@angular/core/package.json');
65
- if (!__processed_by_ivy_ngcc__ ||
66
- !__processed_by_ivy_ngcc__.main ||
67
- main.includes('__ivy_ngcc__')) {
68
- context.logger.warn(core_1.tags.stripIndent `
69
- Warning: Turning off 'bundleDependencies' with Ivy may result in undefined behaviour
70
- unless 'node_modules' are transformed using the standalone Angular compatibility compiler (NGCC).
71
- See: https://angular.io/guide/ivy#ivy-and-universal-app-shell
72
- `);
73
- }
74
- }
75
57
  return (0, rxjs_1.from)(initialize(options, context, transforms.webpackConfiguration)).pipe((0, operators_1.concatMap)(({ config, i18n, target }) => {
76
58
  return (0, build_webpack_1.runWebpack)(config, context, {
77
59
  webpackFactory: require('webpack'),
@@ -3,7 +3,7 @@ export interface Schema {
3
3
  * Which external dependencies to bundle into the bundle. By default, all of node_modules
4
4
  * will be bundled.
5
5
  */
6
- bundleDependencies?: BundleDependenciesUnion;
6
+ bundleDependencies?: boolean;
7
7
  /**
8
8
  * Delete the output path before building.
9
9
  */
@@ -110,15 +110,6 @@ export interface Schema {
110
110
  */
111
111
  watch?: boolean;
112
112
  }
113
- /**
114
- * Which external dependencies to bundle into the bundle. By default, all of node_modules
115
- * will be bundled.
116
- */
117
- export declare type BundleDependenciesUnion = boolean | BundleDependenciesEnum;
118
- export declare enum BundleDependenciesEnum {
119
- All = "all",
120
- None = "none"
121
- }
122
113
  export interface FileReplacement {
123
114
  replace?: string;
124
115
  replaceWith?: string;
@@ -2,12 +2,7 @@
2
2
  // THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
3
3
  // CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.OutputHashing = exports.InlineStyleLanguage = exports.I18NTranslation = exports.BundleDependenciesEnum = void 0;
6
- var BundleDependenciesEnum;
7
- (function (BundleDependenciesEnum) {
8
- BundleDependenciesEnum["All"] = "all";
9
- BundleDependenciesEnum["None"] = "none";
10
- })(BundleDependenciesEnum = exports.BundleDependenciesEnum || (exports.BundleDependenciesEnum = {}));
5
+ exports.OutputHashing = exports.InlineStyleLanguage = exports.I18NTranslation = void 0;
11
6
  /**
12
7
  * How to handle duplicate translations for i18n.
13
8
  *
@@ -184,15 +184,7 @@
184
184
  "bundleDependencies": {
185
185
  "description": "Which external dependencies to bundle into the bundle. By default, all of node_modules will be bundled.",
186
186
  "default": true,
187
- "oneOf": [
188
- {
189
- "type": "boolean"
190
- },
191
- {
192
- "type": "string",
193
- "enum": ["none", "all"]
194
- }
195
- ]
187
+ "type": "boolean"
196
188
  },
197
189
  "externalDependencies": {
198
190
  "description": "Exclude the listed external dependencies from being bundled into the bundle. Instead, the created bundle relies on these dependencies to be available during runtime.",
@@ -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() {
@@ -83,8 +83,6 @@ exports.resolveGlobalStyles = resolveGlobalStyles;
83
83
  // eslint-disable-next-line max-lines-per-function
84
84
  function getStylesConfig(wco) {
85
85
  var _a, _b, _c;
86
- const postcssImports = require('postcss-import');
87
- const postcssPresetEnv = require('postcss-preset-env');
88
86
  const { root, buildOptions } = wco;
89
87
  const extraPlugins = [];
90
88
  extraPlugins.push(new plugins_1.AnyComponentStyleBudgetChecker(buildOptions.budgets));
@@ -140,11 +138,8 @@ function getStylesConfig(wco) {
140
138
  extraPostcssPlugins.push(require(tailwindPackagePath)({ config: tailwindConfigPath }));
141
139
  }
142
140
  }
143
- const postcssPresetEnvPlugin = postcssPresetEnv({
144
- browsers: buildOptions.supportedBrowsers,
145
- autoprefixer: true,
146
- stage: 3,
147
- });
141
+ const postcssImports = require('postcss-import');
142
+ const autoprefixer = require('autoprefixer');
148
143
  const postcssOptionsCreator = (inlineSourcemaps, extracted) => {
149
144
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
150
145
  const optionGenerator = (loader) => ({
@@ -180,7 +175,10 @@ function getStylesConfig(wco) {
180
175
  extracted,
181
176
  }),
182
177
  ...extraPostcssPlugins,
183
- postcssPresetEnvPlugin,
178
+ autoprefixer({
179
+ ignoreUnknownVersions: true,
180
+ overrideBrowserslist: buildOptions.supportedBrowsers,
181
+ }),
184
182
  ],
185
183
  });
186
184
  // postcss-loader fails when trying to determine configuration files for data URIs
@@ -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 = {