@angular-devkit/build-angular 12.0.2 → 12.0.3
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 +9 -9
- package/src/browser/schema.d.ts +1 -1
- package/src/browser/schema.json +1 -1
- package/src/dev-server/index.js +37 -37
- package/src/extract-i18n/index.js +1 -1
- package/src/karma/schema.d.ts +1 -1
- package/src/karma/schema.json +1 -1
- package/src/server/schema.d.ts +1 -1
- package/src/server/schema.json +1 -1
- package/src/webpack/configs/common.js +25 -26
- package/src/webpack/configs/server.js +8 -0
- package/src/webpack/configs/stats.d.ts +4 -14
- package/src/webpack/configs/stats.js +4 -8
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-angular",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.3",
|
|
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
|
-
"@angular-devkit/architect": "0.1200.
|
|
10
|
-
"@angular-devkit/build-optimizer": "0.1200.
|
|
11
|
-
"@angular-devkit/build-webpack": "0.1200.
|
|
12
|
-
"@angular-devkit/core": "12.0.
|
|
9
|
+
"@angular-devkit/architect": "0.1200.3",
|
|
10
|
+
"@angular-devkit/build-optimizer": "0.1200.3",
|
|
11
|
+
"@angular-devkit/build-webpack": "0.1200.3",
|
|
12
|
+
"@angular-devkit/core": "12.0.3",
|
|
13
13
|
"@babel/core": "7.14.3",
|
|
14
14
|
"@babel/generator": "7.14.3",
|
|
15
15
|
"@babel/plugin-transform-async-to-generator": "7.13.0",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@babel/template": "7.12.13",
|
|
20
20
|
"@discoveryjs/json-ext": "0.5.2",
|
|
21
21
|
"@jsdevtools/coverage-istanbul-loader": "3.0.5",
|
|
22
|
-
"@ngtools/webpack": "12.0.
|
|
22
|
+
"@ngtools/webpack": "12.0.3",
|
|
23
23
|
"ansi-colors": "4.1.1",
|
|
24
24
|
"babel-loader": "8.2.2",
|
|
25
25
|
"browserslist": "^4.9.1",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"karma-source-map-support": "1.4.0",
|
|
40
40
|
"less": "4.1.1",
|
|
41
41
|
"less-loader": "8.1.1",
|
|
42
|
-
"license-webpack-plugin": "2.3.
|
|
42
|
+
"license-webpack-plugin": "2.3.19",
|
|
43
43
|
"loader-utils": "2.0.0",
|
|
44
44
|
"mini-css-extract-plugin": "1.5.1",
|
|
45
45
|
"minimatch": "3.0.4",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"terser-webpack-plugin": "5.1.2",
|
|
69
69
|
"text-table": "0.2.0",
|
|
70
70
|
"tree-kill": "1.2.2",
|
|
71
|
-
"webpack": "5.
|
|
71
|
+
"webpack": "5.38.1",
|
|
72
72
|
"webpack-dev-middleware": "4.1.0",
|
|
73
73
|
"webpack-dev-server": "3.11.2",
|
|
74
74
|
"webpack-merge": "5.7.3",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"url": "https://github.com/angular/angular-cli.git"
|
|
121
121
|
},
|
|
122
122
|
"engines": {
|
|
123
|
-
"node": "^12.14.1 ||
|
|
123
|
+
"node": "^12.14.1 || >=14.0.0",
|
|
124
124
|
"npm": "^6.11.0 || ^7.5.6",
|
|
125
125
|
"yarn": ">= 1.13.0"
|
|
126
126
|
},
|
package/src/browser/schema.d.ts
CHANGED
|
@@ -407,7 +407,7 @@ export interface SourceMapClass {
|
|
|
407
407
|
*/
|
|
408
408
|
export interface StylePreprocessorOptions {
|
|
409
409
|
/**
|
|
410
|
-
* Paths to include. Paths will be resolved to
|
|
410
|
+
* Paths to include. Paths will be resolved to workspace root.
|
|
411
411
|
*/
|
|
412
412
|
includePaths?: string[];
|
|
413
413
|
}
|
package/src/browser/schema.json
CHANGED
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"type": "object",
|
|
52
52
|
"properties": {
|
|
53
53
|
"includePaths": {
|
|
54
|
-
"description": "Paths to include. Paths will be resolved to
|
|
54
|
+
"description": "Paths to include. Paths will be resolved to workspace root.",
|
|
55
55
|
"type": "array",
|
|
56
56
|
"items": {
|
|
57
57
|
"type": "string"
|
package/src/dev-server/index.js
CHANGED
|
@@ -84,11 +84,47 @@ function serveWebpackBrowser(options, context, transforms = {}) {
|
|
|
84
84
|
overrides.outputHashing = schema_1.OutputHashing.None;
|
|
85
85
|
logger.warn(`Warning: 'outputHashing' option is disabled when using the dev-server.`);
|
|
86
86
|
}
|
|
87
|
+
if (options.hmr) {
|
|
88
|
+
logger.warn(core_1.tags.stripIndents `NOTICE: Hot Module Replacement (HMR) is enabled for the dev server.
|
|
89
|
+
See https://webpack.js.org/guides/hot-module-replacement for information on working with HMR for Webpack.`);
|
|
90
|
+
}
|
|
91
|
+
if (!options.disableHostCheck &&
|
|
92
|
+
options.host &&
|
|
93
|
+
!/^127\.\d+\.\d+\.\d+/g.test(options.host) &&
|
|
94
|
+
options.host !== 'localhost') {
|
|
95
|
+
logger.warn(core_1.tags.stripIndent `
|
|
96
|
+
Warning: This is a simple server for use in testing or debugging Angular applications
|
|
97
|
+
locally. It hasn't been reviewed for security issues.
|
|
98
|
+
|
|
99
|
+
Binding this server to an open connection can result in compromising your application or
|
|
100
|
+
computer. Using a different host than the one passed to the "--host" flag might result in
|
|
101
|
+
websocket connection issues. You might need to use "--disableHostCheck" if that's the
|
|
102
|
+
case.
|
|
103
|
+
`);
|
|
104
|
+
}
|
|
105
|
+
if (options.disableHostCheck) {
|
|
106
|
+
logger.warn(core_1.tags.oneLine `
|
|
107
|
+
Warning: Running a server with --disable-host-check is a security risk.
|
|
108
|
+
See https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
|
|
109
|
+
for more information.
|
|
110
|
+
`);
|
|
111
|
+
}
|
|
87
112
|
// Webpack's live reload functionality adds the `strip-ansi` package which is commonJS
|
|
88
113
|
(_b = rawBrowserOptions.allowedCommonJsDependencies) !== null && _b !== void 0 ? _b : (rawBrowserOptions.allowedCommonJsDependencies = []);
|
|
89
114
|
rawBrowserOptions.allowedCommonJsDependencies.push('strip-ansi');
|
|
90
115
|
const browserName = await context.getBuilderNameForTarget(browserTarget);
|
|
91
116
|
const browserOptions = (await context.validateOptions({ ...rawBrowserOptions, ...overrides }, browserName));
|
|
117
|
+
const { styles, scripts } = utils_1.normalizeOptimization(browserOptions.optimization);
|
|
118
|
+
if (scripts || styles.minify) {
|
|
119
|
+
logger.error(core_1.tags.stripIndents `
|
|
120
|
+
****************************************************************************************
|
|
121
|
+
This is a simple server for use in testing or debugging Angular applications locally.
|
|
122
|
+
It hasn't been reviewed for security issues.
|
|
123
|
+
|
|
124
|
+
DON'T USE IT FOR PRODUCTION!
|
|
125
|
+
****************************************************************************************
|
|
126
|
+
`);
|
|
127
|
+
}
|
|
92
128
|
const { config, projectRoot, i18n } = await webpack_browser_config_1.generateI18nBrowserWebpackConfigFromContext(browserOptions, context, (wco) => [
|
|
93
129
|
configs_1.getDevServerConfig(wco),
|
|
94
130
|
configs_1.getCommonConfig(wco),
|
|
@@ -129,31 +165,6 @@ function serveWebpackBrowser(options, context, transforms = {}) {
|
|
|
129
165
|
}
|
|
130
166
|
}
|
|
131
167
|
}
|
|
132
|
-
if (options.hmr) {
|
|
133
|
-
logger.warn(core_1.tags.stripIndents `NOTICE: Hot Module Replacement (HMR) is enabled for the dev server.
|
|
134
|
-
See https://webpack.js.org/guides/hot-module-replacement for information on working with HMR for Webpack.`);
|
|
135
|
-
}
|
|
136
|
-
if (!options.disableHostCheck &&
|
|
137
|
-
options.host &&
|
|
138
|
-
!/^127\.\d+\.\d+\.\d+/g.test(options.host) &&
|
|
139
|
-
options.host !== 'localhost') {
|
|
140
|
-
logger.warn(core_1.tags.stripIndent `
|
|
141
|
-
Warning: This is a simple server for use in testing or debugging Angular applications
|
|
142
|
-
locally. It hasn't been reviewed for security issues.
|
|
143
|
-
|
|
144
|
-
Binding this server to an open connection can result in compromising your application or
|
|
145
|
-
computer. Using a different host than the one passed to the "--host" flag might result in
|
|
146
|
-
websocket connection issues. You might need to use "--disableHostCheck" if that's the
|
|
147
|
-
case.
|
|
148
|
-
`);
|
|
149
|
-
}
|
|
150
|
-
if (options.disableHostCheck) {
|
|
151
|
-
logger.warn(core_1.tags.oneLine `
|
|
152
|
-
Warning: Running a server with --disable-host-check is a security risk.
|
|
153
|
-
See https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
|
|
154
|
-
for more information.
|
|
155
|
-
`);
|
|
156
|
-
}
|
|
157
168
|
let locale;
|
|
158
169
|
if (i18n.shouldInline) {
|
|
159
170
|
// Dev-server only supports one locale
|
|
@@ -186,7 +197,6 @@ function serveWebpackBrowser(options, context, transforms = {}) {
|
|
|
186
197
|
};
|
|
187
198
|
}
|
|
188
199
|
return rxjs_1.from(setup()).pipe(operators_1.switchMap(({ browserOptions, webpackConfig, projectRoot, locale }) => {
|
|
189
|
-
const normalizedOptimization = utils_1.normalizeOptimization(browserOptions.optimization);
|
|
190
200
|
if (browserOptions.index) {
|
|
191
201
|
const { scripts = [], styles = [], baseHref, tsConfig } = browserOptions;
|
|
192
202
|
const { options: compilerOptions } = read_tsconfig_1.readTsconfig(tsConfig, workspaceRoot);
|
|
@@ -207,22 +217,12 @@ function serveWebpackBrowser(options, context, transforms = {}) {
|
|
|
207
217
|
deployUrl: browserOptions.deployUrl,
|
|
208
218
|
sri: browserOptions.subresourceIntegrity,
|
|
209
219
|
postTransform: transforms.indexHtml,
|
|
210
|
-
optimization:
|
|
220
|
+
optimization: utils_1.normalizeOptimization(browserOptions.optimization),
|
|
211
221
|
WOFFSupportNeeded: !buildBrowserFeatures.isFeatureSupported('woff2'),
|
|
212
222
|
crossOrigin: browserOptions.crossOrigin,
|
|
213
223
|
lang: locale,
|
|
214
224
|
}));
|
|
215
225
|
}
|
|
216
|
-
if (normalizedOptimization.scripts || normalizedOptimization.styles.minify) {
|
|
217
|
-
logger.error(core_1.tags.stripIndents `
|
|
218
|
-
****************************************************************************************
|
|
219
|
-
This is a simple server for use in testing or debugging Angular applications locally.
|
|
220
|
-
It hasn't been reviewed for security issues.
|
|
221
|
-
|
|
222
|
-
DON'T USE IT FOR PRODUCTION!
|
|
223
|
-
****************************************************************************************
|
|
224
|
-
`);
|
|
225
|
-
}
|
|
226
226
|
return build_webpack_1.runWebpackDevServer(webpackConfig, context, {
|
|
227
227
|
logging: transforms.logging || stats_1.createWebpackLoggingCallback(!!options.verbose, logger),
|
|
228
228
|
webpackFactory: require('webpack'),
|
|
@@ -171,7 +171,7 @@ async function execute(options, context, transforms) {
|
|
|
171
171
|
partials.push({
|
|
172
172
|
plugins: [
|
|
173
173
|
new webpack.NormalModuleReplacementPlugin(/\.(css|scss|sass|styl|less)$/, path.join(__dirname, 'empty-export-default.js')),
|
|
174
|
-
new webpack.NormalModuleReplacementPlugin(/^angular-resource
|
|
174
|
+
new webpack.NormalModuleReplacementPlugin(/^angular-resource:style,/, path.join(__dirname, 'empty-export-default.js')),
|
|
175
175
|
],
|
|
176
176
|
});
|
|
177
177
|
return partials;
|
package/src/karma/schema.d.ts
CHANGED
|
@@ -167,7 +167,7 @@ export interface SourceMapClass {
|
|
|
167
167
|
*/
|
|
168
168
|
export interface StylePreprocessorOptions {
|
|
169
169
|
/**
|
|
170
|
-
* Paths to include. Paths will be resolved to
|
|
170
|
+
* Paths to include. Paths will be resolved to workspace root.
|
|
171
171
|
*/
|
|
172
172
|
includePaths?: string[];
|
|
173
173
|
}
|
package/src/karma/schema.json
CHANGED
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"type": "object",
|
|
56
56
|
"properties": {
|
|
57
57
|
"includePaths": {
|
|
58
|
-
"description": "Paths to include. Paths will be resolved to
|
|
58
|
+
"description": "Paths to include. Paths will be resolved to workspace root.",
|
|
59
59
|
"type": "array",
|
|
60
60
|
"items": {
|
|
61
61
|
"type": "string"
|
package/src/server/schema.d.ts
CHANGED
|
@@ -198,7 +198,7 @@ export interface SourceMapClass {
|
|
|
198
198
|
*/
|
|
199
199
|
export interface StylePreprocessorOptions {
|
|
200
200
|
/**
|
|
201
|
-
* Paths to include. Paths will be resolved to
|
|
201
|
+
* Paths to include. Paths will be resolved to workspace root.
|
|
202
202
|
*/
|
|
203
203
|
includePaths?: string[];
|
|
204
204
|
}
|
package/src/server/schema.json
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"type": "object",
|
|
25
25
|
"properties": {
|
|
26
26
|
"includePaths": {
|
|
27
|
-
"description": "Paths to include. Paths will be resolved to
|
|
27
|
+
"description": "Paths to include. Paths will be resolved to workspace root.",
|
|
28
28
|
"type": "array",
|
|
29
29
|
"items": {
|
|
30
30
|
"type": "string"
|
|
@@ -35,6 +35,31 @@ function getCommonConfig(wco) {
|
|
|
35
35
|
const hashFormat = helpers_1.getOutputHashFormat(buildOptions.outputHashing || 'none');
|
|
36
36
|
const buildBrowserFeatures = new utils_1.BuildBrowserFeatures(projectRoot);
|
|
37
37
|
const targetInFileName = helpers_1.getEsVersionForFileName(tsConfig.options.target, buildOptions.differentialLoadingNeeded);
|
|
38
|
+
if (buildOptions.progress) {
|
|
39
|
+
const spinner = new spinner_1.Spinner();
|
|
40
|
+
spinner.start(`Generating ${platform} application bundles (phase: setup)...`);
|
|
41
|
+
let previousPercentage;
|
|
42
|
+
extraPlugins.push(new webpack_1.ProgressPlugin({
|
|
43
|
+
handler: (percentage, message) => {
|
|
44
|
+
if (previousPercentage === 1 && percentage !== 0) {
|
|
45
|
+
// In some scenarios in Webpack 5 percentage goes from 1 back to 0.99.
|
|
46
|
+
// Ex: 0.99 -> 1 -> 0.99 -> 1
|
|
47
|
+
// This causes the "complete" message to be displayed multiple times.
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
switch (percentage) {
|
|
51
|
+
case 1:
|
|
52
|
+
spinner.succeed(`${platform.replace(/^\w/, (s) => s.toUpperCase())} application bundle generation complete.`);
|
|
53
|
+
break;
|
|
54
|
+
case 0:
|
|
55
|
+
default:
|
|
56
|
+
spinner.text = `Generating ${platform} application bundles (phase: ${message})...`;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
previousPercentage = percentage;
|
|
60
|
+
},
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
38
63
|
if (buildOptions.main) {
|
|
39
64
|
const mainPath = path.resolve(root, buildOptions.main);
|
|
40
65
|
entryPoints['main'] = [mainPath];
|
|
@@ -161,32 +186,6 @@ function getCommonConfig(wco) {
|
|
|
161
186
|
patterns: copyWebpackPluginPatterns,
|
|
162
187
|
}));
|
|
163
188
|
}
|
|
164
|
-
if (buildOptions.progress) {
|
|
165
|
-
const spinner = new spinner_1.Spinner();
|
|
166
|
-
let previousPercentage;
|
|
167
|
-
extraPlugins.push(new webpack_1.ProgressPlugin({
|
|
168
|
-
handler: (percentage, message) => {
|
|
169
|
-
if (previousPercentage === 1 && percentage !== 0) {
|
|
170
|
-
// In some scenarios in Webpack 5 percentage goes from 1 back to 0.99.
|
|
171
|
-
// Ex: 0.99 -> 1 -> 0.99 -> 1
|
|
172
|
-
// This causes the "complete" message to be displayed multiple times.
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
switch (percentage) {
|
|
176
|
-
case 0:
|
|
177
|
-
spinner.start(`Generating ${platform} application bundles...`);
|
|
178
|
-
break;
|
|
179
|
-
case 1:
|
|
180
|
-
spinner.succeed(`${platform.replace(/^\w/, (s) => s.toUpperCase())} application bundle generation complete.`);
|
|
181
|
-
break;
|
|
182
|
-
default:
|
|
183
|
-
spinner.text = `Generating ${platform} application bundles (phase: ${message})...`;
|
|
184
|
-
break;
|
|
185
|
-
}
|
|
186
|
-
previousPercentage = percentage;
|
|
187
|
-
},
|
|
188
|
-
}));
|
|
189
|
-
}
|
|
190
189
|
if (buildOptions.showCircularDependencies) {
|
|
191
190
|
const CircularDependencyPlugin = require('circular-dependency-plugin');
|
|
192
191
|
extraPlugins.push(new CircularDependencyPlugin({
|
|
@@ -34,6 +34,14 @@ function getServerConfig(wco) {
|
|
|
34
34
|
output: {
|
|
35
35
|
libraryTarget: 'commonjs',
|
|
36
36
|
},
|
|
37
|
+
module: {
|
|
38
|
+
parser: {
|
|
39
|
+
javascript: {
|
|
40
|
+
worker: false,
|
|
41
|
+
url: false,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
37
45
|
plugins: [
|
|
38
46
|
// Fixes Critical dependency: the request of a dependency is an expression
|
|
39
47
|
new webpack_1.ContextReplacementPlugin(/@?hapi(\\|\/)/),
|
|
@@ -13,16 +13,11 @@ export declare function getWebpackStatsConfig(verbose?: boolean): {
|
|
|
13
13
|
timings: boolean;
|
|
14
14
|
chunks: boolean;
|
|
15
15
|
builtAt: boolean;
|
|
16
|
-
chunkModules: boolean;
|
|
17
|
-
children: boolean;
|
|
18
|
-
modules: boolean;
|
|
19
|
-
reasons: boolean;
|
|
20
16
|
warnings: boolean;
|
|
21
17
|
errors: boolean;
|
|
22
18
|
assets: boolean;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
moduleTrace: boolean;
|
|
19
|
+
ids: boolean;
|
|
20
|
+
entrypoints: boolean;
|
|
26
21
|
};
|
|
27
22
|
export declare function getStatsConfig(wco: WebpackConfigOptions): {
|
|
28
23
|
stats: {
|
|
@@ -32,15 +27,10 @@ export declare function getStatsConfig(wco: WebpackConfigOptions): {
|
|
|
32
27
|
timings: boolean;
|
|
33
28
|
chunks: boolean;
|
|
34
29
|
builtAt: boolean;
|
|
35
|
-
chunkModules: boolean;
|
|
36
|
-
children: boolean;
|
|
37
|
-
modules: boolean;
|
|
38
|
-
reasons: boolean;
|
|
39
30
|
warnings: boolean;
|
|
40
31
|
errors: boolean;
|
|
41
32
|
assets: boolean;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
moduleTrace: boolean;
|
|
33
|
+
ids: boolean;
|
|
34
|
+
entrypoints: boolean;
|
|
45
35
|
};
|
|
46
36
|
};
|
|
@@ -15,16 +15,12 @@ const webpackOutputOptions = {
|
|
|
15
15
|
timings: true,
|
|
16
16
|
chunks: true,
|
|
17
17
|
builtAt: true,
|
|
18
|
-
chunkModules: false,
|
|
19
|
-
children: false,
|
|
20
|
-
modules: false,
|
|
21
|
-
reasons: false,
|
|
22
18
|
warnings: true,
|
|
23
19
|
errors: true,
|
|
24
20
|
assets: true,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
// Needed for markAsyncChunksNonInitial.
|
|
22
|
+
ids: true,
|
|
23
|
+
entrypoints: true,
|
|
28
24
|
};
|
|
29
25
|
const verboseWebpackOutputOptions = {
|
|
30
26
|
// The verbose output will most likely be piped to a file, so colors just mess it up.
|
|
@@ -39,8 +35,8 @@ const verboseWebpackOutputOptions = {
|
|
|
39
35
|
errorDetails: true,
|
|
40
36
|
moduleTrace: true,
|
|
41
37
|
logging: 'verbose',
|
|
38
|
+
modulesSpace: Infinity,
|
|
42
39
|
};
|
|
43
|
-
verboseWebpackOutputOptions['modulesSpace'] = Infinity;
|
|
44
40
|
function getWebpackStatsConfig(verbose = false) {
|
|
45
41
|
return verbose
|
|
46
42
|
? { ...webpackOutputOptions, ...verboseWebpackOutputOptions }
|