@angular-devkit/build-angular 12.2.0 → 12.2.4

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,16 +1,16 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "12.2.0",
3
+ "version": "12.2.4",
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": "1.0.1",
10
- "@angular-devkit/architect": "0.1202.0",
11
- "@angular-devkit/build-optimizer": "0.1202.0",
12
- "@angular-devkit/build-webpack": "0.1202.0",
13
- "@angular-devkit/core": "12.2.0",
10
+ "@angular-devkit/architect": "0.1202.4",
11
+ "@angular-devkit/build-optimizer": "0.1202.4",
12
+ "@angular-devkit/build-webpack": "0.1202.4",
13
+ "@angular-devkit/core": "12.2.4",
14
14
  "@babel/core": "7.14.8",
15
15
  "@babel/generator": "7.14.8",
16
16
  "@babel/helper-annotate-as-pure": "7.14.5",
@@ -22,7 +22,7 @@
22
22
  "@babel/template": "7.14.5",
23
23
  "@discoveryjs/json-ext": "0.5.3",
24
24
  "@jsdevtools/coverage-istanbul-loader": "3.0.5",
25
- "@ngtools/webpack": "12.2.0",
25
+ "@ngtools/webpack": "12.2.4",
26
26
  "ansi-colors": "4.1.1",
27
27
  "babel-loader": "8.2.2",
28
28
  "browserslist": "^4.9.1",
@@ -34,7 +34,7 @@
34
34
  "critters": "0.0.10",
35
35
  "css-loader": "6.2.0",
36
36
  "css-minimizer-webpack-plugin": "3.0.2",
37
- "esbuild": "0.12.17",
37
+ "esbuild": "0.12.24",
38
38
  "find-cache-dir": "3.3.1",
39
39
  "glob": "7.1.7",
40
40
  "https-proxy-agent": "5.0.0",
@@ -44,7 +44,7 @@
44
44
  "less-loader": "10.0.1",
45
45
  "license-webpack-plugin": "2.3.20",
46
46
  "loader-utils": "2.0.0",
47
- "mini-css-extract-plugin": "2.1.0",
47
+ "mini-css-extract-plugin": "2.2.1",
48
48
  "minimatch": "3.0.4",
49
49
  "open": "8.2.1",
50
50
  "ora": "5.4.1",
@@ -70,18 +70,18 @@
70
70
  "text-table": "0.2.0",
71
71
  "tree-kill": "1.2.2",
72
72
  "tslib": "2.3.0",
73
- "webpack": "5.47.1",
73
+ "webpack": "5.50.0",
74
74
  "webpack-dev-middleware": "5.0.0",
75
75
  "webpack-dev-server": "3.11.2",
76
76
  "webpack-merge": "5.8.0",
77
77
  "webpack-subresource-integrity": "1.5.2"
78
78
  },
79
79
  "peerDependencies": {
80
- "@angular/compiler-cli": "^12.0.0 || ^12.2.0-next",
81
- "@angular/localize": "^12.0.0 || ^12.2.0-next",
82
- "@angular/service-worker": "^12.0.0 || ^12.2.0-next",
80
+ "@angular/compiler-cli": "^12.0.0",
81
+ "@angular/localize": "^12.0.0",
82
+ "@angular/service-worker": "^12.0.0",
83
83
  "karma": "^6.3.0",
84
- "ng-packagr": "^12.0.0 || ^12.1.0-next",
84
+ "ng-packagr": "^12.0.0",
85
85
  "protractor": "^7.0.0",
86
86
  "tailwindcss": "^2.0.0",
87
87
  "tslint": "^6.1.0",
@@ -73,7 +73,9 @@ function canWrapProperty(propertyName, assignmentValue) {
73
73
  const { leadingComments } = assignmentValue.node;
74
74
  if (leadingComments === null || leadingComments === void 0 ? void 0 : leadingComments.some(
75
75
  // `@pureOrBreakMyCode` is used by closure and is present in Angular code
76
- ({ value }) => value.includes('#__PURE__') || value.includes('@pureOrBreakMyCode'))) {
76
+ ({ value }) => value.includes('@__PURE__') ||
77
+ value.includes('#__PURE__') ||
78
+ value.includes('@pureOrBreakMyCode'))) {
77
79
  return true;
78
80
  }
79
81
  return assignmentValue.isPure();
@@ -53,7 +53,11 @@ exports.default = babel_loader_1.custom(() => {
53
53
  // TypeScript files will have already been downlevelled
54
54
  customOptions.forceES5 = !/\.tsx?$/.test(this.resourcePath);
55
55
  }
56
- else if (esTarget >= typescript_1.ScriptTarget.ES2017) {
56
+ else if (esTarget >= typescript_1.ScriptTarget.ES2017 || /\.[cm]?js$/.test(this.resourcePath)) {
57
+ // Application code (TS files) will only contain native async if target is ES2017+.
58
+ // However, third-party libraries can regardless of the target option.
59
+ // APF packages with code in [f]esm2015 directories is downlevelled to ES2015 and
60
+ // will not have native async.
57
61
  customOptions.forceAsyncTransformation =
58
62
  !/[\\\/][_f]?esm2015[\\\/]/.test(this.resourcePath) && source.includes('async');
59
63
  }
@@ -250,9 +250,19 @@ function getCommonConfig(wco) {
250
250
  if (scriptsSourceMap || stylesSourceMap) {
251
251
  extraRules.push({
252
252
  test: /\.m?js$/,
253
- exclude: vendorSourceMap ? undefined : /[\\\/]node_modules[\\\/]/,
254
253
  enforce: 'pre',
255
254
  loader: require.resolve('source-map-loader'),
255
+ options: {
256
+ filterSourceMappingUrl: (_mapUri, resourcePath) => {
257
+ if (vendorSourceMap) {
258
+ // Consume all sourcemaps when vendor option is enabled.
259
+ return true;
260
+ }
261
+ // Don't consume sourcemaps in node_modules when vendor is disabled.
262
+ // But, do consume local libraries sourcemaps.
263
+ return !resourcePath.includes('node_modules');
264
+ },
265
+ },
256
266
  });
257
267
  }
258
268
  let buildOptimizerUseRule = [];
@@ -261,6 +261,7 @@ function getStylesConfig(wco) {
261
261
  ],
262
262
  };
263
263
  const globalBundlesRegExp = new RegExp(`^(${Object.keys(entryPoints).join('|')})(\.[0-9a-f]{20})?.css$`);
264
+ const target = transformSupportedBrowsersToTargets(supportedBrowsers);
264
265
  extraMinimizers.push(
265
266
  // Component styles use esbuild which is faster and generates smaller files on average.
266
267
  // esbuild does not yet support style sourcemaps but component style sourcemaps are not
@@ -276,6 +277,7 @@ function getStylesConfig(wco) {
276
277
  loader: 'css',
277
278
  minify: true,
278
279
  sourcefile,
280
+ target,
279
281
  });
280
282
  return {
281
283
  code,
@@ -432,3 +434,18 @@ function getStylesConfig(wco) {
432
434
  };
433
435
  }
434
436
  exports.getStylesConfig = getStylesConfig;
437
+ function transformSupportedBrowsersToTargets(supportedBrowsers) {
438
+ const transformed = [];
439
+ // https://esbuild.github.io/api/#target
440
+ const esBuildSupportedBrowsers = new Set(['safari', 'firefox', 'edge', 'chrome', 'ios']);
441
+ for (const browser of supportedBrowsers) {
442
+ const [browserName, version] = browser.split(' ');
443
+ if (browserName === 'ie') {
444
+ transformed.push('edge12');
445
+ }
446
+ else if (esBuildSupportedBrowsers.has(browserName)) {
447
+ transformed.push(browserName + version);
448
+ }
449
+ }
450
+ return transformed.length ? transformed : undefined;
451
+ }
@@ -49,28 +49,30 @@ class JavaScriptOptimizerPlugin {
49
49
  continue;
50
50
  }
51
51
  const scriptAsset = compilation.getAsset(assetName);
52
- if (scriptAsset && !scriptAsset.info.minimized) {
53
- const { source: scriptAssetSource, name } = scriptAsset;
54
- let cacheItem;
55
- if (cache) {
56
- const eTag = cache.getLazyHashedEtag(scriptAssetSource);
57
- cacheItem = cache.getItemCache(name, eTag);
58
- const cachedOutput = await cacheItem.getPromise();
59
- if (cachedOutput) {
60
- compilation.updateAsset(name, cachedOutput.source, {
61
- minimized: true,
62
- });
63
- continue;
64
- }
52
+ // Skip assets that have already been optimized or are verbatim copies (project assets)
53
+ if (!scriptAsset || scriptAsset.info.minimized || scriptAsset.info.copied) {
54
+ continue;
55
+ }
56
+ const { source: scriptAssetSource, name } = scriptAsset;
57
+ let cacheItem;
58
+ if (cache) {
59
+ const eTag = cache.getLazyHashedEtag(scriptAssetSource);
60
+ cacheItem = cache.getItemCache(name, eTag);
61
+ const cachedOutput = await cacheItem.getPromise();
62
+ if (cachedOutput) {
63
+ compilation.updateAsset(name, cachedOutput.source, {
64
+ minimized: true,
65
+ });
66
+ continue;
65
67
  }
66
- const { source, map } = scriptAssetSource.sourceAndMap();
67
- scriptsToOptimize.push({
68
- name: scriptAsset.name,
69
- code: typeof source === 'string' ? source : source.toString(),
70
- map,
71
- cacheItem,
72
- });
73
68
  }
69
+ const { source, map } = scriptAssetSource.sourceAndMap();
70
+ scriptsToOptimize.push({
71
+ name: scriptAsset.name,
72
+ code: typeof source === 'string' ? source : source.toString(),
73
+ map,
74
+ cacheItem,
75
+ });
74
76
  }
75
77
  if (scriptsToOptimize.length === 0) {
76
78
  return;
@@ -40,7 +40,9 @@ async function default_1({ asset, options }) {
40
40
  if (terserResult.map) {
41
41
  partialSourcemaps.unshift(terserResult.map);
42
42
  }
43
- partialSourcemaps.push(asset.map);
43
+ if (asset.map) {
44
+ partialSourcemaps.push(asset.map);
45
+ }
44
46
  fullSourcemap = remapping_1.default(partialSourcemaps, () => null);
45
47
  }
46
48
  return { name: asset.name, code: terserResult.code, map: fullSourcemap };
@@ -21,7 +21,7 @@ function markAsyncChunksNonInitial(webpackStats, extraEntryPoints) {
21
21
  // depended upon in Webpack, thus any extra entry point with `inject: false`,
22
22
  // **cannot** be loaded in main bundle.
23
23
  const asyncChunkIds = extraEntryPoints
24
- .filter((entryPoint) => !entryPoint.inject)
24
+ .filter((entryPoint) => !entryPoint.inject && entryPoints[entryPoint.bundleName])
25
25
  .flatMap((entryPoint) => { var _a; return (_a = entryPoints[entryPoint.bundleName].chunks) === null || _a === void 0 ? void 0 : _a.filter((n) => n !== 'runtime'); });
26
26
  // Find chunks for each ID.
27
27
  const asyncChunks = asyncChunkIds.map((chunkId) => {