@angular-devkit/build-angular 12.2.0-next.2 → 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 +21 -21
- package/src/app-shell/index.js +3 -5
- package/src/babel/plugins/adjust-static-class-members.js +24 -1
- package/src/babel/webpack-loader.js +5 -1
- package/src/dev-server/index.js +1 -1
- package/src/webpack/configs/common.js +13 -2
- 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,28 +1,28 @@
|
|
|
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.
|
|
14
|
-
"@babel/core": "7.14.
|
|
15
|
-
"@babel/generator": "7.14.
|
|
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
|
+
"@babel/core": "7.14.8",
|
|
15
|
+
"@babel/generator": "7.14.8",
|
|
16
16
|
"@babel/helper-annotate-as-pure": "7.14.5",
|
|
17
17
|
"@babel/plugin-proposal-async-generator-functions": "7.14.7",
|
|
18
18
|
"@babel/plugin-transform-async-to-generator": "7.14.5",
|
|
19
19
|
"@babel/plugin-transform-runtime": "7.14.5",
|
|
20
|
-
"@babel/preset-env": "7.14.
|
|
21
|
-
"@babel/runtime": "7.14.
|
|
20
|
+
"@babel/preset-env": "7.14.8",
|
|
21
|
+
"@babel/runtime": "7.14.8",
|
|
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",
|
|
@@ -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
|
-
"css-loader": "
|
|
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,19 +50,19 @@
|
|
|
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",
|
|
64
64
|
"source-map-support": "0.5.19",
|
|
65
|
-
"style-loader": "3.1
|
|
65
|
+
"style-loader": "3.2.1",
|
|
66
66
|
"stylus": "0.54.8",
|
|
67
67
|
"stylus-loader": "6.1.0",
|
|
68
68
|
"terser": "5.7.1",
|
|
@@ -70,16 +70,16 @@
|
|
|
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 || ^12.
|
|
81
|
-
"@angular/localize": "^12.0.0 || ^12.
|
|
82
|
-
"@angular/service-worker": "^12.0.0 || ^12.
|
|
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",
|
|
83
83
|
"karma": "^6.3.0",
|
|
84
84
|
"ng-packagr": "^12.0.0 || ^12.1.0-next",
|
|
85
85
|
"protractor": "^7.0.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);
|
|
@@ -57,6 +57,29 @@ function getKeywords() {
|
|
|
57
57
|
return ['class'];
|
|
58
58
|
}
|
|
59
59
|
exports.getKeywords = getKeywords;
|
|
60
|
+
/**
|
|
61
|
+
* Determines whether a property and its initializer value can be safely wrapped in a pure
|
|
62
|
+
* annotated IIFE. Values that may cause side effects are not considered safe to wrap.
|
|
63
|
+
* Wrapping such values may cause runtime errors and/or incorrect runtime behavior.
|
|
64
|
+
*
|
|
65
|
+
* @param propertyName The name of the property to analyze.
|
|
66
|
+
* @param assignmentValue The initializer value that will be assigned to the property.
|
|
67
|
+
* @returns If the property can be safely wrapped, then true; otherwise, false.
|
|
68
|
+
*/
|
|
69
|
+
function canWrapProperty(propertyName, assignmentValue) {
|
|
70
|
+
if (angularStaticsToWrap.has(propertyName)) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
const { leadingComments } = assignmentValue.node;
|
|
74
|
+
if (leadingComments === null || leadingComments === void 0 ? void 0 : leadingComments.some(
|
|
75
|
+
// `@pureOrBreakMyCode` is used by closure and is present in Angular code
|
|
76
|
+
({ value }) => value.includes('@__PURE__') ||
|
|
77
|
+
value.includes('#__PURE__') ||
|
|
78
|
+
value.includes('@pureOrBreakMyCode'))) {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
return assignmentValue.isPure();
|
|
82
|
+
}
|
|
60
83
|
/**
|
|
61
84
|
* Analyze the sibling nodes of a class to determine if any downlevel elements should be
|
|
62
85
|
* wrapped in a pure annotated IIFE. Also determines if any elements have potential side
|
|
@@ -130,7 +153,7 @@ function analyzeClassSiblings(origin, classIdentifier, allowWrappingDecorators)
|
|
|
130
153
|
nextStatement.remove();
|
|
131
154
|
--i;
|
|
132
155
|
}
|
|
133
|
-
else if (
|
|
156
|
+
else if (canWrapProperty(propertyName, assignmentValue)) {
|
|
134
157
|
wrapStatementPaths.push(nextStatement);
|
|
135
158
|
}
|
|
136
159
|
else {
|
|
@@ -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
|
}
|
package/src/dev-server/index.js
CHANGED
|
@@ -119,7 +119,7 @@ function serveWebpackBrowser(options, context, transforms = {}) {
|
|
|
119
119
|
|
|
120
120
|
Binding this server to an open connection can result in compromising your application or
|
|
121
121
|
computer. Using a different host than the one passed to the "--host" flag might result in
|
|
122
|
-
websocket connection issues. You might need to use "--
|
|
122
|
+
websocket connection issues. You might need to use "--disable-host-check" if that's the
|
|
123
123
|
case.
|
|
124
124
|
`);
|
|
125
125
|
}
|
|
@@ -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 = [];
|
|
@@ -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 };
|