@angular-devkit/build-angular 12.2.0-next.3 → 12.2.2
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 +16 -16
- package/src/app-shell/index.js +3 -5
- 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 +13 -2
- package/src/webpack/configs/styles.js +14 -0
- package/src/webpack/plugins/javascript-optimizer-plugin.js +22 -20
- package/src/webpack/plugins/javascript-optimizer-worker.js +3 -1
- package/src/webpack/utils/async-chunks.js +1 -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.2",
|
|
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.2",
|
|
11
|
+
"@angular-devkit/build-optimizer": "0.1202.2",
|
|
12
|
+
"@angular-devkit/build-webpack": "0.1202.2",
|
|
13
|
+
"@angular-devkit/core": "12.2.2",
|
|
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.2",
|
|
26
26
|
"ansi-colors": "4.1.1",
|
|
27
27
|
"babel-loader": "8.2.2",
|
|
28
28
|
"browserslist": "^4.9.1",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"caniuse-lite": "^1.0.30001032",
|
|
31
31
|
"circular-dependency-plugin": "5.2.2",
|
|
32
32
|
"copy-webpack-plugin": "9.0.1",
|
|
33
|
-
"core-js": "3.
|
|
33
|
+
"core-js": "3.16.0",
|
|
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.
|
|
37
|
+
"esbuild": "0.12.17",
|
|
38
38
|
"find-cache-dir": "3.3.1",
|
|
39
39
|
"glob": "7.1.7",
|
|
40
40
|
"https-proxy-agent": "5.0.0",
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
"ora": "5.4.1",
|
|
51
51
|
"parse5-html-rewriting-stream": "6.0.1",
|
|
52
52
|
"piscina": "3.1.0",
|
|
53
|
-
"postcss": "8.3.
|
|
53
|
+
"postcss": "8.3.6",
|
|
54
54
|
"postcss-import": "14.0.2",
|
|
55
55
|
"postcss-loader": "6.1.1",
|
|
56
56
|
"postcss-preset-env": "6.7.0",
|
|
57
|
-
"regenerator-runtime": "0.13.
|
|
57
|
+
"regenerator-runtime": "0.13.9",
|
|
58
58
|
"resolve-url-loader": "4.0.0",
|
|
59
59
|
"rxjs": "6.6.7",
|
|
60
|
-
"sass": "1.
|
|
60
|
+
"sass": "1.36.0",
|
|
61
61
|
"sass-loader": "12.1.0",
|
|
62
62
|
"semver": "7.3.5",
|
|
63
63
|
"source-map-loader": "3.0.0",
|
|
@@ -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.
|
|
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
|
|
81
|
-
"@angular/localize": "^12.0.0
|
|
82
|
-
"@angular/service-worker": "^12.0.0
|
|
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
|
|
84
|
+
"ng-packagr": "^12.0.0",
|
|
85
85
|
"protractor": "^7.0.0",
|
|
86
86
|
"tailwindcss": "^2.0.0",
|
|
87
87
|
"tslint": "^6.1.0",
|
package/src/app-shell/index.js
CHANGED
|
@@ -130,10 +130,9 @@ async function _appShellBuilder(options, context) {
|
|
|
130
130
|
});
|
|
131
131
|
let spinner;
|
|
132
132
|
try {
|
|
133
|
-
// Using `.result` instead of `.output` causes Webpack FS cache not to be created.
|
|
134
133
|
const [browserResult, serverResult] = await Promise.all([
|
|
135
|
-
browserTargetRun.
|
|
136
|
-
serverTargetRun.
|
|
134
|
+
browserTargetRun.result,
|
|
135
|
+
serverTargetRun.result,
|
|
137
136
|
]);
|
|
138
137
|
if (browserResult.success === false || browserResult.baseOutputPath === undefined) {
|
|
139
138
|
return browserResult;
|
|
@@ -152,8 +151,7 @@ async function _appShellBuilder(options, context) {
|
|
|
152
151
|
return { success: false, error: err.message };
|
|
153
152
|
}
|
|
154
153
|
finally {
|
|
155
|
-
|
|
156
|
-
const _ = Promise.all([browserTargetRun.stop(), serverTargetRun.stop()]);
|
|
154
|
+
await Promise.all([browserTargetRun.stop(), serverTargetRun.stop()]);
|
|
157
155
|
}
|
|
158
156
|
}
|
|
159
157
|
exports.default = architect_1.createBuilder(_appShellBuilder);
|
|
@@ -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
|
}
|
|
@@ -171,7 +171,7 @@ function getCommonConfig(wco) {
|
|
|
171
171
|
}
|
|
172
172
|
// process asset entries
|
|
173
173
|
if (buildOptions.assets.length) {
|
|
174
|
-
const copyWebpackPluginPatterns = buildOptions.assets.map((asset) => {
|
|
174
|
+
const copyWebpackPluginPatterns = buildOptions.assets.map((asset, index) => {
|
|
175
175
|
// Resolve input paths relative to workspace root and add slash at the end.
|
|
176
176
|
// eslint-disable-next-line prefer-const
|
|
177
177
|
let { input, output, ignore = [], glob } = asset;
|
|
@@ -201,6 +201,7 @@ function getCommonConfig(wco) {
|
|
|
201
201
|
...ignore,
|
|
202
202
|
].map((i) => path.posix.join(input, i)),
|
|
203
203
|
},
|
|
204
|
+
priority: index,
|
|
204
205
|
};
|
|
205
206
|
});
|
|
206
207
|
extraPlugins.push(new copy_webpack_plugin_1.default({
|
|
@@ -249,9 +250,19 @@ function getCommonConfig(wco) {
|
|
|
249
250
|
if (scriptsSourceMap || stylesSourceMap) {
|
|
250
251
|
extraRules.push({
|
|
251
252
|
test: /\.m?js$/,
|
|
252
|
-
exclude: vendorSourceMap ? undefined : /[\\\/]node_modules[\\\/]/,
|
|
253
253
|
enforce: 'pre',
|
|
254
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
|
+
},
|
|
255
266
|
});
|
|
256
267
|
}
|
|
257
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,15 @@ 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 (esBuildSupportedBrowsers.has(browserName)) {
|
|
444
|
+
transformed.push(browserName + version);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return transformed.length ? transformed : undefined;
|
|
448
|
+
}
|
|
@@ -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 };
|
|
@@ -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) => {
|