@angular-devkit/build-angular 13.3.0 → 13.3.3

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,15 +1,15 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "13.3.0",
3
+ "version": "13.3.3",
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.1.1",
10
- "@angular-devkit/architect": "0.1303.0",
11
- "@angular-devkit/build-webpack": "0.1303.0",
12
- "@angular-devkit/core": "13.3.0",
10
+ "@angular-devkit/architect": "0.1303.3",
11
+ "@angular-devkit/build-webpack": "0.1303.3",
12
+ "@angular-devkit/core": "13.3.3",
13
13
  "@babel/core": "7.16.12",
14
14
  "@babel/generator": "7.16.8",
15
15
  "@babel/helper-annotate-as-pure": "7.16.7",
@@ -20,7 +20,7 @@
20
20
  "@babel/runtime": "7.16.7",
21
21
  "@babel/template": "7.16.7",
22
22
  "@discoveryjs/json-ext": "0.5.6",
23
- "@ngtools/webpack": "13.3.0",
23
+ "@ngtools/webpack": "13.3.3",
24
24
  "ansi-colors": "4.1.1",
25
25
  "babel-loader": "8.2.3",
26
26
  "babel-plugin-istanbul": "6.1.1",
@@ -42,7 +42,7 @@
42
42
  "license-webpack-plugin": "4.0.2",
43
43
  "loader-utils": "3.2.0",
44
44
  "mini-css-extract-plugin": "2.5.3",
45
- "minimatch": "3.0.4",
45
+ "minimatch": "3.0.5",
46
46
  "open": "8.4.0",
47
47
  "ora": "5.4.1",
48
48
  "parse5-html-rewriting-stream": "6.0.1",
@@ -54,7 +54,7 @@
54
54
  "regenerator-runtime": "0.13.9",
55
55
  "resolve-url-loader": "5.0.0",
56
56
  "rxjs": "6.6.7",
57
- "sass": "1.49.0",
57
+ "sass": "1.49.9",
58
58
  "sass-loader": "12.4.0",
59
59
  "semver": "7.3.5",
60
60
  "source-map-loader": "3.0.1",
package/src/typings.d.ts CHANGED
@@ -6,10 +6,6 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
 
9
- declare module '@discoveryjs/json-ext' {
10
- export function stringifyStream(value: unknown): import('stream').Readable;
11
- }
12
-
13
9
  declare module '@babel/helper-annotate-as-pure' {
14
10
  export default function annotateAsPure(
15
11
  pathOrNode: import('@babel/types').Node | { node: import('@babel/types').Node },
@@ -10,7 +10,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.getAnalyticsConfig = void 0;
11
11
  const analytics_1 = require("../plugins/analytics");
12
12
  function getAnalyticsConfig(wco, context) {
13
- var _a;
14
13
  if (!context.analytics) {
15
14
  return {};
16
15
  }
@@ -22,9 +21,7 @@ function getAnalyticsConfig(wco, context) {
22
21
  }
23
22
  // The category is the builder name if it's an angular builder.
24
23
  return {
25
- plugins: [
26
- new analytics_1.NgBuildAnalyticsPlugin(wco.projectRoot, context.analytics, category, (_a = wco.buildOptions.aot) !== null && _a !== void 0 ? _a : false),
27
- ],
24
+ plugins: [new analytics_1.NgBuildAnalyticsPlugin(wco.projectRoot, context.analytics, category)],
28
25
  };
29
26
  }
30
27
  exports.getAnalyticsConfig = getAnalyticsConfig;
@@ -189,7 +189,9 @@ async function getCommonConfig(wco) {
189
189
  test: tsConfig.options.allowJs ? /\.[cm]?[tj]sx?$/ : /\.[cm]?tsx?$/,
190
190
  loader: webpack_1.AngularWebpackLoaderPath,
191
191
  // The below are known paths that are not part of the TypeScript compilation even when allowJs is enabled.
192
- exclude: [/[/\\](?:css-loader|mini-css-extract-plugin|webpack-dev-server|webpack)[/\\]/],
192
+ exclude: [
193
+ /[\\/]node_modules[/\\](?:css-loader|mini-css-extract-plugin|webpack-dev-server|webpack)[/\\]/,
194
+ ],
193
195
  });
194
196
  extraPlugins.push((0, typescript_2.createIvyPlugin)(wco, aot, tsConfigPath));
195
197
  }
@@ -303,7 +305,7 @@ async function getCommonConfig(wco) {
303
305
  // The below is needed due to a bug in `@babel/runtime`. See: https://github.com/babel/babel/issues/12824
304
306
  resolve: { fullySpecified: false },
305
307
  exclude: [
306
- /[/\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill|whatwg-url)[/\\]/,
308
+ /[\\/]node_modules[/\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill|whatwg-url)[/\\]/,
307
309
  ],
308
310
  use: [
309
311
  {
@@ -332,6 +334,7 @@ async function getCommonConfig(wco) {
332
334
  asyncWebAssembly: true,
333
335
  },
334
336
  infrastructureLogging: {
337
+ debug: verbose,
335
338
  level: verbose ? 'verbose' : 'error',
336
339
  },
337
340
  stats: (0, helpers_1.getStatsOptions)(verbose),
@@ -98,16 +98,14 @@ function getStylesConfig(wco) {
98
98
  wco.logger.warn('Stylus usage is deprecated and will be removed in a future major version. ' +
99
99
  'To opt-out of the deprecated behaviour, please migrate to another stylesheet language.');
100
100
  }
101
- const sassImplementation = getSassImplementation();
102
- if (sassImplementation instanceof sass_service_1.SassWorkerImplementation) {
103
- extraPlugins.push({
104
- apply(compiler) {
105
- compiler.hooks.shutdown.tap('sass-worker', () => {
106
- sassImplementation === null || sassImplementation === void 0 ? void 0 : sassImplementation.close();
107
- });
108
- },
109
- });
110
- }
101
+ const sassImplementation = new sass_service_1.SassWorkerImplementation();
102
+ extraPlugins.push({
103
+ apply(compiler) {
104
+ compiler.hooks.shutdown.tap('sass-worker', () => {
105
+ sassImplementation.close();
106
+ });
107
+ },
108
+ });
111
109
  const assetNameTemplate = (0, helpers_1.assetNameTemplateFactory)(hashFormat);
112
110
  const extraPostcssPlugins = [];
113
111
  // Attempt to setup Tailwind CSS
@@ -374,12 +372,3 @@ function getStylesConfig(wco) {
374
372
  };
375
373
  }
376
374
  exports.getStylesConfig = getStylesConfig;
377
- function getSassImplementation() {
378
- const { webcontainer } = process.versions;
379
- // When `webcontainer` is a truthy it means that we are running in a StackBlitz webcontainer.
380
- // `SassWorkerImplementation` uses `receiveMessageOnPort` Node.js `worker_thread` API to ensure sync behavior which is ~2x faster.
381
- // However, it is non trivial to support this in a webcontainer and while slower we choose to use `dart-sass`
382
- // which in Webpack uses the slower async path.
383
- // We should periodically check with StackBlitz folks (Mark Whitfeld / Dominic Elm) to determine if this workaround is still needed.
384
- return webcontainer ? require('sass') : new sass_service_1.SassWorkerImplementation();
385
- }
@@ -40,10 +40,9 @@ export declare class NgBuildAnalyticsPlugin {
40
40
  protected _projectRoot: string;
41
41
  protected _analytics: analytics.Analytics;
42
42
  protected _category: string;
43
- private aotEnabled;
44
43
  protected _built: boolean;
45
44
  protected _stats: AnalyticsBuildStats;
46
- constructor(_projectRoot: string, _analytics: analytics.Analytics, _category: string, aotEnabled: boolean);
45
+ constructor(_projectRoot: string, _analytics: analytics.Analytics, _category: string);
47
46
  protected _reset(): void;
48
47
  protected _getMetrics(stats: Stats): (string | number)[];
49
48
  protected _getDimensions(): (string | number | boolean)[];
@@ -73,11 +73,10 @@ class AnalyticsBuildStats {
73
73
  * Analytics plugin that reports the analytics we want from the CLI.
74
74
  */
75
75
  class NgBuildAnalyticsPlugin {
76
- constructor(_projectRoot, _analytics, _category, aotEnabled) {
76
+ constructor(_projectRoot, _analytics, _category) {
77
77
  this._projectRoot = _projectRoot;
78
78
  this._analytics = _analytics;
79
79
  this._category = _category;
80
- this.aotEnabled = aotEnabled;
81
80
  this._built = false;
82
81
  this._stats = new AnalyticsBuildStats();
83
82
  }
@@ -108,7 +107,6 @@ class NgBuildAnalyticsPlugin {
108
107
  // Adding commas before and after so the regex are easier to define filters.
109
108
  dimensions[core_1.analytics.NgCliAnalyticsDimensions.BuildErrors] = `,${this._stats.errors.join()},`;
110
109
  }
111
- dimensions[core_1.analytics.NgCliAnalyticsDimensions.AotEnabled] = this.aotEnabled;
112
110
  return dimensions;
113
111
  }
114
112
  _reportBuildMetrics(stats) {
@@ -52,9 +52,10 @@ class CssOptimizerPlugin {
52
52
  const cachedOutput = await cacheItem.getPromise();
53
53
  if (cachedOutput) {
54
54
  await this.addWarnings(compilation, cachedOutput.warnings);
55
- compilation.updateAsset(name, cachedOutput.source, {
55
+ compilation.updateAsset(name, cachedOutput.source, (assetInfo) => ({
56
+ ...assetInfo,
56
57
  minimized: true,
57
- });
58
+ }));
58
59
  continue;
59
60
  }
60
61
  }
@@ -65,7 +66,10 @@ class CssOptimizerPlugin {
65
66
  const optimizedAsset = map
66
67
  ? new SourceMapSource(code, name, map)
67
68
  : new OriginalSource(code, name);
68
- compilation.updateAsset(name, optimizedAsset, { minimized: true });
69
+ compilation.updateAsset(name, optimizedAsset, (assetInfo) => ({
70
+ ...assetInfo,
71
+ minimized: true,
72
+ }));
69
73
  await (cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.storePromise({
70
74
  source: optimizedAsset,
71
75
  warnings,
@@ -61,9 +61,10 @@ class JavaScriptOptimizerPlugin {
61
61
  cacheItem = cache.getItemCache(name, eTag);
62
62
  const cachedOutput = await cacheItem.getPromise();
63
63
  if (cachedOutput) {
64
- compilation.updateAsset(name, cachedOutput.source, {
64
+ compilation.updateAsset(name, cachedOutput.source, (assetInfo) => ({
65
+ ...assetInfo,
65
66
  minimized: true,
66
- });
67
+ }));
67
68
  continue;
68
69
  }
69
70
  }
@@ -137,7 +138,10 @@ class JavaScriptOptimizerPlugin {
137
138
  const optimizedAsset = map
138
139
  ? new SourceMapSource(code, name, map)
139
140
  : new OriginalSource(code, name);
140
- compilation.updateAsset(name, optimizedAsset, { minimized: true });
141
+ compilation.updateAsset(name, optimizedAsset, (assetInfo) => ({
142
+ ...assetInfo,
143
+ minimized: true,
144
+ }));
141
145
  return cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.storePromise({
142
146
  source: optimizedAsset,
143
147
  });
@@ -31,9 +31,10 @@ class TransferSizePlugin {
31
31
  }
32
32
  actions.push(brotliCompressAsync(scriptAsset.source.source())
33
33
  .then((result) => {
34
- compilation.updateAsset(assetName, (s) => s, {
34
+ compilation.updateAsset(assetName, (s) => s, (assetInfo) => ({
35
+ ...assetInfo,
35
36
  estimatedTransferSize: result.length,
36
- });
37
+ }));
37
38
  })
38
39
  .catch((error) => {
39
40
  compilation.warnings.push(new compilation.compiler.webpack.WebpackError(`Unable to calculate estimated transfer size for '${assetName}'. Reason: ${error.message}`));