@angular-devkit/build-angular 12.2.0 → 12.2.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 +7 -7
- package/src/babel/plugins/adjust-static-class-members.js +3 -1
- package/src/babel/webpack-loader.js +5 -1
- package/src/webpack/configs/common.js +11 -1
- package/src/webpack/plugins/javascript-optimizer-plugin.js +22 -20
- package/src/webpack/plugins/javascript-optimizer-worker.js +3 -1
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-angular",
|
|
3
|
-
"version": "12.2.
|
|
3
|
+
"version": "12.2.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": "1.0.1",
|
|
10
|
-
"@angular-devkit/architect": "0.1202.
|
|
11
|
-
"@angular-devkit/build-optimizer": "0.1202.
|
|
12
|
-
"@angular-devkit/build-webpack": "0.1202.
|
|
13
|
-
"@angular-devkit/core": "12.2.
|
|
10
|
+
"@angular-devkit/architect": "0.1202.1",
|
|
11
|
+
"@angular-devkit/build-optimizer": "0.1202.1",
|
|
12
|
+
"@angular-devkit/build-webpack": "0.1202.1",
|
|
13
|
+
"@angular-devkit/core": "12.2.1",
|
|
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.
|
|
25
|
+
"@ngtools/webpack": "12.2.1",
|
|
26
26
|
"ansi-colors": "4.1.1",
|
|
27
27
|
"babel-loader": "8.2.2",
|
|
28
28
|
"browserslist": "^4.9.1",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"text-table": "0.2.0",
|
|
71
71
|
"tree-kill": "1.2.2",
|
|
72
72
|
"tslib": "2.3.0",
|
|
73
|
-
"webpack": "5.
|
|
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",
|
|
@@ -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('
|
|
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 = [];
|
|
@@ -49,28 +49,30 @@ class JavaScriptOptimizerPlugin {
|
|
|
49
49
|
continue;
|
|
50
50
|
}
|
|
51
51
|
const scriptAsset = compilation.getAsset(assetName);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
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 };
|