@angular-devkit/build-angular 0.1100.0-rc.2 → 0.1100.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 +8 -8
- package/src/browser/index.js +6 -5
- package/src/browser/schema.json +8 -4
- package/src/server/schema.json +8 -4
- package/src/utils/index-file/inline-fonts.js +2 -2
- package/src/webpack/configs/dev-server.js +3 -0
- package/src/webpack/plugins/hmr/hmr-accept.js +4 -3
- package/src/webpack/plugins/karma.js +3 -2
- package/src/webpack/utils/stats.d.ts +4 -1
- package/src/webpack/utils/stats.js +30 -6
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-angular",
|
|
3
|
-
"version": "0.1100.
|
|
3
|
+
"version": "0.1100.2",
|
|
4
4
|
"description": "Angular Webpack Build Facade",
|
|
5
5
|
"experimental": true,
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"typings": "src/index.d.ts",
|
|
8
8
|
"builders": "builders.json",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@angular-devkit/architect": "0.1100.
|
|
11
|
-
"@angular-devkit/build-optimizer": "0.1100.
|
|
12
|
-
"@angular-devkit/build-webpack": "0.1100.
|
|
13
|
-
"@angular-devkit/core": "11.0.
|
|
10
|
+
"@angular-devkit/architect": "0.1100.2",
|
|
11
|
+
"@angular-devkit/build-optimizer": "0.1100.2",
|
|
12
|
+
"@angular-devkit/build-webpack": "0.1100.2",
|
|
13
|
+
"@angular-devkit/core": "11.0.2",
|
|
14
14
|
"@babel/core": "7.12.3",
|
|
15
15
|
"@babel/generator": "7.12.1",
|
|
16
16
|
"@babel/plugin-transform-runtime": "7.12.1",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@babel/runtime": "7.12.1",
|
|
19
19
|
"@babel/template": "7.10.4",
|
|
20
20
|
"@jsdevtools/coverage-istanbul-loader": "3.0.5",
|
|
21
|
-
"@ngtools/webpack": "11.0.
|
|
21
|
+
"@ngtools/webpack": "11.0.2",
|
|
22
22
|
"ansi-colors": "4.1.1",
|
|
23
23
|
"autoprefixer": "9.8.6",
|
|
24
24
|
"babel-loader": "8.1.0",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"circular-dependency-plugin": "5.2.0",
|
|
29
29
|
"copy-webpack-plugin": "6.2.1",
|
|
30
30
|
"core-js": "3.6.5",
|
|
31
|
-
"css-loader": "
|
|
31
|
+
"css-loader": "4.3.0",
|
|
32
32
|
"cssnano": "4.1.10",
|
|
33
33
|
"file-loader": "6.1.1",
|
|
34
34
|
"find-cache-dir": "3.3.1",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"peerDependencies": {
|
|
81
81
|
"@angular/compiler-cli": "^11.0.0 || ^11.0.0-next",
|
|
82
82
|
"@angular/localize": "^11.0.0 || ^11.0.0-next",
|
|
83
|
-
"karma": "
|
|
83
|
+
"karma": "~5.1.0",
|
|
84
84
|
"ng-packagr": "^11.0.0 || ^11.0.0-next",
|
|
85
85
|
"protractor": "^7.0.0",
|
|
86
86
|
"tslint": "^6.1.0",
|
package/src/browser/index.js
CHANGED
|
@@ -423,17 +423,17 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
423
423
|
for (const result of processResults) {
|
|
424
424
|
const chunk = (_a = webpackStats.chunks) === null || _a === void 0 ? void 0 : _a.find((chunk) => chunk.id.toString() === result.name);
|
|
425
425
|
if (result.original) {
|
|
426
|
-
bundleInfoStats.push(generateBundleInfoStats(result.original, chunk));
|
|
426
|
+
bundleInfoStats.push(generateBundleInfoStats(result.original, chunk, 'modern'));
|
|
427
427
|
}
|
|
428
428
|
if (result.downlevel) {
|
|
429
|
-
bundleInfoStats.push(generateBundleInfoStats(result.downlevel, chunk));
|
|
429
|
+
bundleInfoStats.push(generateBundleInfoStats(result.downlevel, chunk, 'legacy'));
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
432
|
const unprocessedChunks = ((_b = webpackStats.chunks) === null || _b === void 0 ? void 0 : _b.filter((chunk) => !processResults
|
|
433
433
|
.find((result) => chunk.id.toString() === result.name))) || [];
|
|
434
434
|
for (const chunk of unprocessedChunks) {
|
|
435
435
|
const asset = (_c = webpackStats.assets) === null || _c === void 0 ? void 0 : _c.find(a => a.name === chunk.files[0]);
|
|
436
|
-
bundleInfoStats.push(stats_1.generateBundleStats({ ...chunk, size: asset === null || asset === void 0 ? void 0 : asset.size }
|
|
436
|
+
bundleInfoStats.push(stats_1.generateBundleStats({ ...chunk, size: asset === null || asset === void 0 ? void 0 : asset.size }));
|
|
437
437
|
}
|
|
438
438
|
// Check for budget errors and display them to the user.
|
|
439
439
|
const budgets = options.budgets || [];
|
|
@@ -550,7 +550,7 @@ function mapErrorToMessage(error) {
|
|
|
550
550
|
function assertNever(input) {
|
|
551
551
|
throw new Error(`Unexpected call to assertNever() with input: ${JSON.stringify(input, null /* replacer */, 4 /* tabSize */)}`);
|
|
552
552
|
}
|
|
553
|
-
function generateBundleInfoStats(bundle, chunk) {
|
|
553
|
+
function generateBundleInfoStats(bundle, chunk, chunkType) {
|
|
554
554
|
return stats_1.generateBundleStats({
|
|
555
555
|
size: bundle.size,
|
|
556
556
|
files: bundle.map ? [bundle.filename, bundle.map.filename] : [bundle.filename],
|
|
@@ -558,6 +558,7 @@ function generateBundleInfoStats(bundle, chunk) {
|
|
|
558
558
|
entry: !!(chunk === null || chunk === void 0 ? void 0 : chunk.names.includes('runtime')),
|
|
559
559
|
initial: !!(chunk === null || chunk === void 0 ? void 0 : chunk.initial),
|
|
560
560
|
rendered: true,
|
|
561
|
-
|
|
561
|
+
chunkType,
|
|
562
|
+
});
|
|
562
563
|
}
|
|
563
564
|
exports.default = architect_1.createBuilder(buildWebpackBrowser);
|
package/src/browser/schema.json
CHANGED
|
@@ -428,10 +428,12 @@
|
|
|
428
428
|
"type": "object",
|
|
429
429
|
"properties": {
|
|
430
430
|
"src": {
|
|
431
|
-
"type": "string"
|
|
431
|
+
"type": "string",
|
|
432
|
+
"pattern": "\\.(([cm]?j|t)sx?|json)$"
|
|
432
433
|
},
|
|
433
434
|
"replaceWith": {
|
|
434
|
-
"type": "string"
|
|
435
|
+
"type": "string",
|
|
436
|
+
"pattern": "\\.(([cm]?j|t)sx?|json)$"
|
|
435
437
|
}
|
|
436
438
|
},
|
|
437
439
|
"additionalProperties": false,
|
|
@@ -444,10 +446,12 @@
|
|
|
444
446
|
"type": "object",
|
|
445
447
|
"properties": {
|
|
446
448
|
"replace": {
|
|
447
|
-
"type": "string"
|
|
449
|
+
"type": "string",
|
|
450
|
+
"pattern": "\\.(([cm]?j|t)sx?|json)$"
|
|
448
451
|
},
|
|
449
452
|
"with": {
|
|
450
|
-
"type": "string"
|
|
453
|
+
"type": "string",
|
|
454
|
+
"pattern": "\\.(([cm]?j|t)sx?|json)$"
|
|
451
455
|
}
|
|
452
456
|
},
|
|
453
457
|
"additionalProperties": false,
|
package/src/server/schema.json
CHANGED
|
@@ -259,10 +259,12 @@
|
|
|
259
259
|
"type": "object",
|
|
260
260
|
"properties": {
|
|
261
261
|
"src": {
|
|
262
|
-
"type": "string"
|
|
262
|
+
"type": "string",
|
|
263
|
+
"pattern": "\\.(([cm]?j|t)sx?|json)$"
|
|
263
264
|
},
|
|
264
265
|
"replaceWith": {
|
|
265
|
-
"type": "string"
|
|
266
|
+
"type": "string",
|
|
267
|
+
"pattern": "\\.(([cm]?j|t)sx?|json)$"
|
|
266
268
|
}
|
|
267
269
|
},
|
|
268
270
|
"additionalProperties": false,
|
|
@@ -275,10 +277,12 @@
|
|
|
275
277
|
"type": "object",
|
|
276
278
|
"properties": {
|
|
277
279
|
"replace": {
|
|
278
|
-
"type": "string"
|
|
280
|
+
"type": "string",
|
|
281
|
+
"pattern": "\\.(([cm]?j|t)sx?|json)$"
|
|
279
282
|
},
|
|
280
283
|
"with": {
|
|
281
|
-
"type": "string"
|
|
284
|
+
"type": "string",
|
|
285
|
+
"pattern": "\\.(([cm]?j|t)sx?|json)$"
|
|
282
286
|
}
|
|
283
287
|
},
|
|
284
288
|
"additionalProperties": false,
|
|
@@ -122,10 +122,10 @@ class InlineFontsProcessor {
|
|
|
122
122
|
cssContent += await this.getResponse(url, "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36" /* Chrome */);
|
|
123
123
|
if (this.options.minifyInlinedCSS) {
|
|
124
124
|
cssContent = cssContent
|
|
125
|
+
// Comments.
|
|
126
|
+
.replace(/\/\*([\s\S]*?)\*\//g, '')
|
|
125
127
|
// New lines.
|
|
126
128
|
.replace(/\n/g, '')
|
|
127
|
-
// Comments and new lines.
|
|
128
|
-
.replace(/\/\*\s.+\s\*\//g, '')
|
|
129
129
|
// Safe spaces.
|
|
130
130
|
.replace(/\s?[\{\:\;]\s+/g, s => s.trim());
|
|
131
131
|
}
|
|
@@ -30,6 +30,9 @@ function getDevServerConfig(wco) {
|
|
|
30
30
|
const parsedHost = url.parse(publicHost);
|
|
31
31
|
publicHost = parsedHost.host;
|
|
32
32
|
}
|
|
33
|
+
else {
|
|
34
|
+
publicHost = '0.0.0.0:0';
|
|
35
|
+
}
|
|
33
36
|
if (!watch) {
|
|
34
37
|
// There's no option to turn off file watching in webpack-dev-server, but
|
|
35
38
|
// we can override the file watcher instead.
|
|
@@ -34,7 +34,8 @@ function default_1(mod) {
|
|
|
34
34
|
if (!appRef) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
// Inputs that are hidden should be ignored
|
|
38
|
+
const oldInputs = document.querySelectorAll('input:not([type="hidden"]), textarea');
|
|
38
39
|
const oldOptions = document.querySelectorAll('option');
|
|
39
40
|
// Create new application
|
|
40
41
|
appRef.components
|
|
@@ -115,8 +116,8 @@ function dispatchEvents(element) {
|
|
|
115
116
|
element.dispatchEvent(new KeyboardEvent('keyup', { key: 'Enter' }));
|
|
116
117
|
}
|
|
117
118
|
function restoreFormValues(oldInputs, oldOptions) {
|
|
118
|
-
// Restore input
|
|
119
|
-
const newInputs = document.querySelectorAll('input, textarea');
|
|
119
|
+
// Restore input that are not hidden
|
|
120
|
+
const newInputs = document.querySelectorAll('input:not([type="hidden"]), textarea');
|
|
120
121
|
if (newInputs.length && newInputs.length === oldInputs.length) {
|
|
121
122
|
console.log('[NG HMR] Restoring input/textarea values.');
|
|
122
123
|
for (let index = 0; index < newInputs.length; index++) {
|
|
@@ -85,13 +85,14 @@ const init = (config, emitter, customFileHandlers) => {
|
|
|
85
85
|
const hasIstanbulReporter = reporters.includes('coverage-istanbul');
|
|
86
86
|
if (hasCoveragePlugin && !hasCoverageReporter) {
|
|
87
87
|
reporters.push('coverage');
|
|
88
|
+
logger.warn(`There is a known issue with Karma and karma-coverage. Tests that exceed the coverage threshold will not fail. This will be fixed in Karma 5.2.x soon.`);
|
|
88
89
|
}
|
|
89
90
|
else if (hasIstanbulPlugin && !hasIstanbulReporter) {
|
|
90
91
|
// coverage-istanbul is deprecated in favor of karma-coverage
|
|
91
92
|
reporters.push('coverage-istanbul');
|
|
92
93
|
}
|
|
93
|
-
else {
|
|
94
|
-
throw new Error('karma-coverage must be installed in order to run code coverage');
|
|
94
|
+
else if (!hasCoveragePlugin && !hasIstanbulPlugin) {
|
|
95
|
+
throw new Error('karma-coverage must be installed in order to run code coverage.');
|
|
95
96
|
}
|
|
96
97
|
if (hasIstanbulPlugin) {
|
|
97
98
|
logger.warn(`'karma-coverage-istanbul-reporter' usage has been deprecated since version 11.\n` +
|
|
@@ -10,9 +10,11 @@ import { WebpackLoggingCallback } from '@angular-devkit/build-webpack';
|
|
|
10
10
|
import { Configuration, Stats } from 'webpack';
|
|
11
11
|
export declare function formatSize(size: number): string;
|
|
12
12
|
export declare type BundleStatsData = [files: string, names: string, size: number | string];
|
|
13
|
+
export declare type ChunkType = 'modern' | 'legacy' | 'unknown';
|
|
13
14
|
export interface BundleStats {
|
|
14
15
|
initial: boolean;
|
|
15
16
|
stats: BundleStatsData;
|
|
17
|
+
chunkType: ChunkType;
|
|
16
18
|
}
|
|
17
19
|
export declare function generateBundleStats(info: {
|
|
18
20
|
size?: number;
|
|
@@ -21,7 +23,8 @@ export declare function generateBundleStats(info: {
|
|
|
21
23
|
entry: boolean;
|
|
22
24
|
initial: boolean;
|
|
23
25
|
rendered?: boolean;
|
|
24
|
-
|
|
26
|
+
chunkType?: ChunkType;
|
|
27
|
+
}): BundleStats;
|
|
25
28
|
export declare function statsWarningsToString(json: any, statsConfig: any): string;
|
|
26
29
|
export declare function statsErrorsToString(json: any, statsConfig: any): string;
|
|
27
30
|
export declare function statsHasErrors(json: any): boolean;
|
|
@@ -27,13 +27,15 @@ function formatSize(size) {
|
|
|
27
27
|
}
|
|
28
28
|
exports.formatSize = formatSize;
|
|
29
29
|
;
|
|
30
|
-
function generateBundleStats(info
|
|
30
|
+
function generateBundleStats(info) {
|
|
31
31
|
var _a;
|
|
32
32
|
const size = typeof info.size === 'number' ? info.size : '-';
|
|
33
33
|
const files = info.files.filter(f => !f.endsWith('.map')).map(f => path.basename(f)).join(', ');
|
|
34
34
|
const names = ((_a = info.names) === null || _a === void 0 ? void 0 : _a.length) ? info.names.join(', ') : '-';
|
|
35
35
|
const initial = !!(info.entry || info.initial);
|
|
36
|
+
const chunkType = info.chunkType || 'unknown';
|
|
36
37
|
return {
|
|
38
|
+
chunkType,
|
|
37
39
|
initial,
|
|
38
40
|
stats: [files, names, size],
|
|
39
41
|
};
|
|
@@ -46,8 +48,10 @@ function generateBuildStatsTable(data, colors, showTotalSize) {
|
|
|
46
48
|
const dim = (x) => colors ? color_1.colors.dim(x) : x;
|
|
47
49
|
const changedEntryChunksStats = [];
|
|
48
50
|
const changedLazyChunksStats = [];
|
|
49
|
-
let
|
|
50
|
-
|
|
51
|
+
let initialModernTotalSize = 0;
|
|
52
|
+
let initialLegacyTotalSize = 0;
|
|
53
|
+
let modernFileSuffix;
|
|
54
|
+
for (const { initial, stats, chunkType } of data) {
|
|
51
55
|
const [files, names, size] = stats;
|
|
52
56
|
const data = [
|
|
53
57
|
g(files),
|
|
@@ -57,7 +61,22 @@ function generateBuildStatsTable(data, colors, showTotalSize) {
|
|
|
57
61
|
if (initial) {
|
|
58
62
|
changedEntryChunksStats.push(data);
|
|
59
63
|
if (typeof size === 'number') {
|
|
60
|
-
|
|
64
|
+
switch (chunkType) {
|
|
65
|
+
case 'modern':
|
|
66
|
+
initialModernTotalSize += size;
|
|
67
|
+
if (!modernFileSuffix) {
|
|
68
|
+
const match = files.match(/-(es20\d{2}|esnext)/);
|
|
69
|
+
modernFileSuffix = match === null || match === void 0 ? void 0 : match[1].toString().toUpperCase();
|
|
70
|
+
}
|
|
71
|
+
break;
|
|
72
|
+
case 'legacy':
|
|
73
|
+
initialLegacyTotalSize += size;
|
|
74
|
+
break;
|
|
75
|
+
default:
|
|
76
|
+
initialModernTotalSize += size;
|
|
77
|
+
initialLegacyTotalSize += size;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
61
80
|
}
|
|
62
81
|
}
|
|
63
82
|
else {
|
|
@@ -70,7 +89,12 @@ function generateBuildStatsTable(data, colors, showTotalSize) {
|
|
|
70
89
|
bundleInfo.push(['Initial Chunk Files', 'Names', 'Size'].map(bold), ...changedEntryChunksStats);
|
|
71
90
|
if (showTotalSize) {
|
|
72
91
|
bundleInfo.push([]);
|
|
73
|
-
|
|
92
|
+
if (initialModernTotalSize === initialLegacyTotalSize) {
|
|
93
|
+
bundleInfo.push([' ', 'Initial Total', formatSize(initialModernTotalSize)].map(bold));
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
bundleInfo.push([' ', 'Initial ES5 Total', formatSize(initialLegacyTotalSize)].map(bold), [' ', `Initial ${modernFileSuffix} Total`, formatSize(initialModernTotalSize)].map(bold));
|
|
97
|
+
}
|
|
74
98
|
}
|
|
75
99
|
}
|
|
76
100
|
// Seperator
|
|
@@ -103,7 +127,7 @@ function statsToString(json, statsConfig, bundleState) {
|
|
|
103
127
|
}
|
|
104
128
|
const assets = json.assets.filter((asset) => chunk.files.includes(asset.name));
|
|
105
129
|
const summedSize = assets.filter((asset) => !asset.name.endsWith(".map")).reduce((total, asset) => { return total + asset.size; }, 0);
|
|
106
|
-
changedChunksStats.push(generateBundleStats({ ...chunk, size: summedSize }
|
|
130
|
+
changedChunksStats.push(generateBundleStats({ ...chunk, size: summedSize }));
|
|
107
131
|
}
|
|
108
132
|
unchangedChunkNumber = json.chunks.length - changedChunksStats.length;
|
|
109
133
|
}
|