@angular-devkit/build-angular 13.3.6 → 13.3.7
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.
|
|
3
|
+
"version": "13.3.7",
|
|
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": "2.2.0",
|
|
10
|
-
"@angular-devkit/architect": "0.1303.
|
|
11
|
-
"@angular-devkit/build-webpack": "0.1303.
|
|
12
|
-
"@angular-devkit/core": "13.3.
|
|
10
|
+
"@angular-devkit/architect": "0.1303.7",
|
|
11
|
+
"@angular-devkit/build-webpack": "0.1303.7",
|
|
12
|
+
"@angular-devkit/core": "13.3.7",
|
|
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.
|
|
23
|
+
"@ngtools/webpack": "13.3.7",
|
|
24
24
|
"ansi-colors": "4.1.1",
|
|
25
25
|
"babel-loader": "8.2.5",
|
|
26
26
|
"babel-plugin-istanbul": "6.1.1",
|
|
@@ -30,11 +30,13 @@ class CssOptimizerPlugin {
|
|
|
30
30
|
apply(compiler) {
|
|
31
31
|
const { OriginalSource, SourceMapSource } = compiler.webpack.sources;
|
|
32
32
|
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
33
|
+
const logger = compilation.getLogger('build-angular.CssOptimizerPlugin');
|
|
33
34
|
compilation.hooks.processAssets.tapPromise({
|
|
34
35
|
name: PLUGIN_NAME,
|
|
35
36
|
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,
|
|
36
37
|
}, async (compilationAssets) => {
|
|
37
38
|
const cache = compilation.options.cache && compilation.getCache(PLUGIN_NAME);
|
|
39
|
+
logger.time('optimize css assets');
|
|
38
40
|
for (const assetName of Object.keys(compilationAssets)) {
|
|
39
41
|
if (!/\.(?:css|scss|sass|less|styl)$/.test(assetName)) {
|
|
40
42
|
continue;
|
|
@@ -51,6 +53,7 @@ class CssOptimizerPlugin {
|
|
|
51
53
|
cacheItem = cache.getItemCache(name, eTag);
|
|
52
54
|
const cachedOutput = await cacheItem.getPromise();
|
|
53
55
|
if (cachedOutput) {
|
|
56
|
+
logger.debug(`${name} restored from cache`);
|
|
54
57
|
await this.addWarnings(compilation, cachedOutput.warnings);
|
|
55
58
|
compilation.updateAsset(name, cachedOutput.source, (assetInfo) => ({
|
|
56
59
|
...assetInfo,
|
|
@@ -61,7 +64,10 @@ class CssOptimizerPlugin {
|
|
|
61
64
|
}
|
|
62
65
|
const { source, map: inputMap } = styleAssetSource.sourceAndMap();
|
|
63
66
|
const input = typeof source === 'string' ? source : source.toString();
|
|
67
|
+
const optimizeAssetLabel = `optimize asset: ${asset.name}`;
|
|
68
|
+
logger.time(optimizeAssetLabel);
|
|
64
69
|
const { code, warnings, map } = await this.optimize(input, asset.name, inputMap, this.targets);
|
|
70
|
+
logger.timeEnd(optimizeAssetLabel);
|
|
65
71
|
await this.addWarnings(compilation, warnings);
|
|
66
72
|
const optimizedAsset = map
|
|
67
73
|
? new SourceMapSource(code, name, map)
|
|
@@ -75,6 +81,7 @@ class CssOptimizerPlugin {
|
|
|
75
81
|
warnings,
|
|
76
82
|
}));
|
|
77
83
|
}
|
|
84
|
+
logger.timeEnd('optimize css assets');
|
|
78
85
|
});
|
|
79
86
|
});
|
|
80
87
|
}
|
|
@@ -38,10 +38,12 @@ class JavaScriptOptimizerPlugin {
|
|
|
38
38
|
apply(compiler) {
|
|
39
39
|
const { OriginalSource, SourceMapSource } = compiler.webpack.sources;
|
|
40
40
|
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
41
|
+
const logger = compilation.getLogger('build-angular.JavaScriptOptimizerPlugin');
|
|
41
42
|
compilation.hooks.processAssets.tapPromise({
|
|
42
43
|
name: PLUGIN_NAME,
|
|
43
44
|
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,
|
|
44
45
|
}, async (compilationAssets) => {
|
|
46
|
+
logger.time('optimize js assets');
|
|
45
47
|
const scriptsToOptimize = [];
|
|
46
48
|
const cache = compilation.options.cache && compilation.getCache('JavaScriptOptimizerPlugin');
|
|
47
49
|
// Analyze the compilation assets for scripts that require optimization
|
|
@@ -61,6 +63,7 @@ class JavaScriptOptimizerPlugin {
|
|
|
61
63
|
cacheItem = cache.getItemCache(name, eTag);
|
|
62
64
|
const cachedOutput = await cacheItem.getPromise();
|
|
63
65
|
if (cachedOutput) {
|
|
66
|
+
logger.debug(`${name} restored from cache`);
|
|
64
67
|
compilation.updateAsset(name, cachedOutput.source, (assetInfo) => ({
|
|
65
68
|
...assetInfo,
|
|
66
69
|
minimized: true,
|
|
@@ -125,6 +128,7 @@ class JavaScriptOptimizerPlugin {
|
|
|
125
128
|
try {
|
|
126
129
|
const tasks = [];
|
|
127
130
|
for (const { name, code, map, cacheItem } of scriptsToOptimize) {
|
|
131
|
+
logger.time(`optimize asset: ${name}`);
|
|
128
132
|
tasks.push(workerPool
|
|
129
133
|
.run({
|
|
130
134
|
asset: {
|
|
@@ -142,6 +146,7 @@ class JavaScriptOptimizerPlugin {
|
|
|
142
146
|
...assetInfo,
|
|
143
147
|
minimized: true,
|
|
144
148
|
}));
|
|
149
|
+
logger.timeEnd(`optimize asset: ${name}`);
|
|
145
150
|
return cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.storePromise({
|
|
146
151
|
source: optimizedAsset,
|
|
147
152
|
});
|
|
@@ -155,6 +160,7 @@ class JavaScriptOptimizerPlugin {
|
|
|
155
160
|
finally {
|
|
156
161
|
void workerPool.destroy();
|
|
157
162
|
}
|
|
163
|
+
logger.timeEnd('optimize js assets');
|
|
158
164
|
});
|
|
159
165
|
});
|
|
160
166
|
}
|