@angular-devkit/build-angular 12.1.1 → 12.1.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/babel/presets/application.d.ts +0 -1
- package/src/babel/presets/application.js +2 -1
- package/src/babel/webpack-loader.js +0 -9
- package/src/browser/index.js +13 -3
- package/src/dev-server/index.js +1 -1
- package/src/extract-i18n/index.js +1 -1
- package/src/karma/index.js +1 -1
- package/src/server/index.js +1 -1
- package/src/server/tests/setup.d.ts +18 -0
- package/src/server/tests/setup.js +27 -0
- package/src/utils/version.d.ts +1 -2
- package/src/utils/version.js +5 -4
- package/src/webpack/configs/browser.js +0 -12
- package/src/webpack/configs/common.js +19 -2
- package/src/webpack/configs/styles.js +9 -0
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-angular",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.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
|
-
"@angular-devkit/architect": "0.1201.
|
|
10
|
-
"@angular-devkit/build-optimizer": "0.1201.
|
|
11
|
-
"@angular-devkit/build-webpack": "0.1201.
|
|
12
|
-
"@angular-devkit/core": "12.1.
|
|
9
|
+
"@angular-devkit/architect": "0.1201.2",
|
|
10
|
+
"@angular-devkit/build-optimizer": "0.1201.2",
|
|
11
|
+
"@angular-devkit/build-webpack": "0.1201.2",
|
|
12
|
+
"@angular-devkit/core": "12.1.2",
|
|
13
13
|
"@babel/core": "7.14.6",
|
|
14
14
|
"@babel/generator": "7.14.5",
|
|
15
15
|
"@babel/helper-annotate-as-pure": "7.14.5",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@babel/template": "7.14.5",
|
|
22
22
|
"@discoveryjs/json-ext": "0.5.3",
|
|
23
23
|
"@jsdevtools/coverage-istanbul-loader": "3.0.5",
|
|
24
|
-
"@ngtools/webpack": "12.1.
|
|
24
|
+
"@ngtools/webpack": "12.1.2",
|
|
25
25
|
"ansi-colors": "4.1.1",
|
|
26
26
|
"babel-loader": "8.2.2",
|
|
27
27
|
"browserslist": "^4.9.1",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"karma-source-map-support": "1.4.0",
|
|
42
42
|
"less": "4.1.1",
|
|
43
43
|
"less-loader": "10.0.0",
|
|
44
|
-
"license-webpack-plugin": "2.3.
|
|
44
|
+
"license-webpack-plugin": "2.3.20",
|
|
45
45
|
"loader-utils": "2.0.0",
|
|
46
46
|
"mini-css-extract-plugin": "1.6.2",
|
|
47
47
|
"minimatch": "3.0.4",
|
|
@@ -70,7 +70,7 @@
|
|
|
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.42.0",
|
|
74
74
|
"webpack-dev-middleware": "5.0.0",
|
|
75
75
|
"webpack-dev-server": "3.11.2",
|
|
76
76
|
"webpack-merge": "5.8.0",
|
|
@@ -102,7 +102,8 @@ function default_1(api, options) {
|
|
|
102
102
|
const { createEs2015LinkerPlugin } = require('@angular/compiler-cli/linker/babel');
|
|
103
103
|
plugins.push(createEs2015LinkerPlugin({
|
|
104
104
|
linkerJitMode: options.angularLinker.jitMode,
|
|
105
|
-
|
|
105
|
+
// This is a workaround until https://github.com/angular/angular/issues/42769 is fixed.
|
|
106
|
+
sourceMapping: false,
|
|
106
107
|
logger: createNgtscLogger(options.diagnosticReporter),
|
|
107
108
|
fileSystem: {
|
|
108
109
|
resolve: path.resolve,
|
|
@@ -43,7 +43,6 @@ exports.default = babel_loader_1.custom(() => {
|
|
|
43
43
|
customOptions.angularLinker = {
|
|
44
44
|
shouldLink: true,
|
|
45
45
|
jitMode: aot !== true,
|
|
46
|
-
sourcemap: false,
|
|
47
46
|
};
|
|
48
47
|
shouldProcess = true;
|
|
49
48
|
}
|
|
@@ -113,14 +112,6 @@ exports.default = babel_loader_1.custom(() => {
|
|
|
113
112
|
{ wrapDecorators: customOptions.optimize.wrapDecorators },
|
|
114
113
|
]);
|
|
115
114
|
}
|
|
116
|
-
// Only enable linker template sourcemapping if linker is enabled and Webpack provides
|
|
117
|
-
// a sourcemap. This logic allows the linker sourcemap behavior to be controlled by the
|
|
118
|
-
// Webpack sourcemap configuration. For example, if a vendor file is being processed
|
|
119
|
-
// and vendor sourcemaps are disabled, the `inputSourceMap` property will be `undefined`
|
|
120
|
-
// which will effectively disable linker sourcemapping for vendor files.
|
|
121
|
-
if (customOptions.angularLinker && configuration.options.inputSourceMap) {
|
|
122
|
-
customOptions.angularLinker.sourcemap = true;
|
|
123
|
-
}
|
|
124
115
|
return {
|
|
125
116
|
...configuration.options,
|
|
126
117
|
// Workaround for https://github.com/babel/babel-loader/pull/896 is available
|
package/src/browser/index.js
CHANGED
|
@@ -101,7 +101,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
101
101
|
const baseOutputPath = path.resolve(context.workspaceRoot, options.outputPath);
|
|
102
102
|
let outputPaths;
|
|
103
103
|
// Check Angular version.
|
|
104
|
-
version_1.assertCompatibleAngularVersion(context.workspaceRoot
|
|
104
|
+
version_1.assertCompatibleAngularVersion(context.workspaceRoot);
|
|
105
105
|
return rxjs_1.from(context.getProjectMetadata(projectName)).pipe(operators_1.switchMap(async (projectMetadata) => {
|
|
106
106
|
var _a;
|
|
107
107
|
const sysProjectRoot = core_1.getSystemPath(core_1.resolve(core_1.normalize(context.workspaceRoot), core_1.normalize((_a = projectMetadata.root) !== null && _a !== void 0 ? _a : '')));
|
|
@@ -462,6 +462,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
462
462
|
crossOrigin: options.crossOrigin,
|
|
463
463
|
postTransform: transforms.indexHtml,
|
|
464
464
|
});
|
|
465
|
+
let hasErrors = false;
|
|
465
466
|
for (const [locale, outputPath] of outputPaths.entries()) {
|
|
466
467
|
try {
|
|
467
468
|
const { content, warnings, errors } = await indexHtmlGenerator.process({
|
|
@@ -476,7 +477,10 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
476
477
|
if (warnings.length || errors.length) {
|
|
477
478
|
spinner.stop();
|
|
478
479
|
warnings.forEach((m) => context.logger.warn(m));
|
|
479
|
-
errors.forEach((m) =>
|
|
480
|
+
errors.forEach((m) => {
|
|
481
|
+
context.logger.error(m);
|
|
482
|
+
hasErrors = true;
|
|
483
|
+
});
|
|
480
484
|
spinner.start();
|
|
481
485
|
}
|
|
482
486
|
const indexOutput = path.join(outputPath, webpack_browser_config_1.getIndexOutputFile(options.index));
|
|
@@ -488,7 +492,13 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
488
492
|
return { success: false, error: mapErrorToMessage(error) };
|
|
489
493
|
}
|
|
490
494
|
}
|
|
491
|
-
|
|
495
|
+
if (hasErrors) {
|
|
496
|
+
spinner.fail('Index html generation failed.');
|
|
497
|
+
return { success: false };
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
spinner.succeed('Index html generation complete.');
|
|
501
|
+
}
|
|
492
502
|
}
|
|
493
503
|
if (options.serviceWorker) {
|
|
494
504
|
spinner.start('Generating service worker...');
|
package/src/dev-server/index.js
CHANGED
|
@@ -77,7 +77,7 @@ const devServerBuildOverriddenKeys = [
|
|
|
77
77
|
function serveWebpackBrowser(options, context, transforms = {}) {
|
|
78
78
|
// Check Angular version.
|
|
79
79
|
const { logger, workspaceRoot } = context;
|
|
80
|
-
version_1.assertCompatibleAngularVersion(workspaceRoot
|
|
80
|
+
version_1.assertCompatibleAngularVersion(workspaceRoot);
|
|
81
81
|
const browserTarget = architect_1.targetFromTargetString(options.browserTarget);
|
|
82
82
|
async function setup() {
|
|
83
83
|
var _a, _b;
|
|
@@ -122,7 +122,7 @@ class NoEmitPlugin {
|
|
|
122
122
|
async function execute(options, context, transforms) {
|
|
123
123
|
var _a;
|
|
124
124
|
// Check Angular version.
|
|
125
|
-
version_1.assertCompatibleAngularVersion(context.workspaceRoot
|
|
125
|
+
version_1.assertCompatibleAngularVersion(context.workspaceRoot);
|
|
126
126
|
const browserTarget = architect_1.targetFromTargetString(options.browserTarget);
|
|
127
127
|
const browserOptions = await context.validateOptions(await context.getTargetOptions(browserTarget), await context.getBuilderNameForTarget(browserTarget));
|
|
128
128
|
const format = normalizeFormatOption(options);
|
package/src/karma/index.js
CHANGED
|
@@ -78,7 +78,7 @@ async function initialize(options, context, webpackConfigurationTransformer) {
|
|
|
78
78
|
*/
|
|
79
79
|
function execute(options, context, transforms = {}) {
|
|
80
80
|
// Check Angular version.
|
|
81
|
-
version_1.assertCompatibleAngularVersion(context.workspaceRoot
|
|
81
|
+
version_1.assertCompatibleAngularVersion(context.workspaceRoot);
|
|
82
82
|
let singleRun;
|
|
83
83
|
if (options.watch !== undefined) {
|
|
84
84
|
singleRun = !options.watch;
|
package/src/server/index.js
CHANGED
|
@@ -48,7 +48,7 @@ const stats_1 = require("../webpack/utils/stats");
|
|
|
48
48
|
function execute(options, context, transforms = {}) {
|
|
49
49
|
const root = context.workspaceRoot;
|
|
50
50
|
// Check Angular version.
|
|
51
|
-
version_1.assertCompatibleAngularVersion(root
|
|
51
|
+
version_1.assertCompatibleAngularVersion(root);
|
|
52
52
|
const tsConfig = read_tsconfig_1.readTsconfig(options.tsConfig, root);
|
|
53
53
|
const target = tsConfig.options.target || typescript_1.ScriptTarget.ES5;
|
|
54
54
|
const baseOutputPath = path.resolve(root, options.outputPath);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import { Schema } from '../schema';
|
|
9
|
+
export { describeBuilder } from '../../testing';
|
|
10
|
+
export declare const SERVER_BUILDER_INFO: Readonly<{
|
|
11
|
+
name: string;
|
|
12
|
+
schemaPath: string;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Contains all required Server builder fields.
|
|
16
|
+
* Also disables progress reporting to minimize logging output.
|
|
17
|
+
*/
|
|
18
|
+
export declare const BASE_OPTIONS: Readonly<Schema>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.BASE_OPTIONS = exports.SERVER_BUILDER_INFO = exports.describeBuilder = void 0;
|
|
11
|
+
var testing_1 = require("../../testing");
|
|
12
|
+
Object.defineProperty(exports, "describeBuilder", { enumerable: true, get: function () { return testing_1.describeBuilder; } });
|
|
13
|
+
exports.SERVER_BUILDER_INFO = Object.freeze({
|
|
14
|
+
name: '@angular-devkit/build-angular:server',
|
|
15
|
+
schemaPath: __dirname + '/../schema.json',
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Contains all required Server builder fields.
|
|
19
|
+
* Also disables progress reporting to minimize logging output.
|
|
20
|
+
*/
|
|
21
|
+
exports.BASE_OPTIONS = Object.freeze({
|
|
22
|
+
main: 'src/main.server.ts',
|
|
23
|
+
tsConfig: 'src/tsconfig.server.json',
|
|
24
|
+
progress: false,
|
|
25
|
+
watch: false,
|
|
26
|
+
outputPath: 'dist',
|
|
27
|
+
});
|
package/src/utils/version.d.ts
CHANGED
|
@@ -5,5 +5,4 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
export declare function assertCompatibleAngularVersion(projectRoot: string, logger: logging.LoggerApi): void;
|
|
8
|
+
export declare function assertCompatibleAngularVersion(projectRoot: string): void | never;
|
package/src/utils/version.js
CHANGED
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.assertCompatibleAngularVersion = void 0;
|
|
11
|
+
/* eslint-disable no-console */
|
|
11
12
|
const core_1 = require("@angular-devkit/core");
|
|
12
13
|
const semver_1 = require("semver");
|
|
13
|
-
function assertCompatibleAngularVersion(projectRoot
|
|
14
|
+
function assertCompatibleAngularVersion(projectRoot) {
|
|
14
15
|
let angularCliPkgJson;
|
|
15
16
|
let angularPkgJson;
|
|
16
17
|
let rxjsPkgJson;
|
|
@@ -22,13 +23,13 @@ function assertCompatibleAngularVersion(projectRoot, logger) {
|
|
|
22
23
|
rxjsPkgJson = require(rxjsPackagePath);
|
|
23
24
|
}
|
|
24
25
|
catch {
|
|
25
|
-
|
|
26
|
+
console.error(core_1.tags.stripIndents `
|
|
26
27
|
You seem to not be depending on "@angular/core" and/or "rxjs". This is an error.
|
|
27
28
|
`);
|
|
28
29
|
process.exit(2);
|
|
29
30
|
}
|
|
30
31
|
if (!(angularPkgJson && angularPkgJson['version'] && rxjsPkgJson && rxjsPkgJson['version'])) {
|
|
31
|
-
|
|
32
|
+
console.error(core_1.tags.stripIndents `
|
|
32
33
|
Cannot determine versions of "@angular/core" and/or "rxjs".
|
|
33
34
|
This likely means your local installation is broken. Please reinstall your packages.
|
|
34
35
|
`);
|
|
@@ -57,7 +58,7 @@ function assertCompatibleAngularVersion(projectRoot, logger) {
|
|
|
57
58
|
// of both 8 and 9.
|
|
58
59
|
const supportedAngularSemver = `^${cliMajor}.0.0-next || >=${cliMajor}.0.0 <${cliMajor + 1}.0.0`;
|
|
59
60
|
if (!semver_1.satisfies(angularVersion, supportedAngularSemver, { includePrerelease: true })) {
|
|
60
|
-
|
|
61
|
+
console.error(core_1.tags.stripIndents `
|
|
61
62
|
This version of CLI is only compatible with Angular versions ${supportedAngularSemver},
|
|
62
63
|
but Angular version ${angularVersion} was found instead.
|
|
63
64
|
|
|
@@ -22,18 +22,6 @@ function getBrowserConfig(wco) {
|
|
|
22
22
|
hashFuncNames: ['sha384'],
|
|
23
23
|
}));
|
|
24
24
|
}
|
|
25
|
-
if (extractLicenses) {
|
|
26
|
-
const LicenseWebpackPlugin = require('license-webpack-plugin').LicenseWebpackPlugin;
|
|
27
|
-
extraPlugins.push(new LicenseWebpackPlugin({
|
|
28
|
-
stats: {
|
|
29
|
-
warnings: false,
|
|
30
|
-
errors: false,
|
|
31
|
-
},
|
|
32
|
-
perChunkOutput: false,
|
|
33
|
-
outputFilename: '3rdpartylicenses.txt',
|
|
34
|
-
skipChildCompilers: true,
|
|
35
|
-
}));
|
|
36
|
-
}
|
|
37
25
|
if (scriptsSourceMap || stylesSourceMap) {
|
|
38
26
|
extraPlugins.push(helpers_1.getSourceMapDevTool(scriptsSourceMap, stylesSourceMap, buildOptions.differentialLoadingNeeded && !buildOptions.watch ? true : hiddenSourceMap, false));
|
|
39
27
|
}
|
|
@@ -212,6 +212,18 @@ function getCommonConfig(wco) {
|
|
|
212
212
|
exclude: /[\\\/]node_modules[\\\/]/,
|
|
213
213
|
}));
|
|
214
214
|
}
|
|
215
|
+
if (buildOptions.extractLicenses) {
|
|
216
|
+
const LicenseWebpackPlugin = require('license-webpack-plugin').LicenseWebpackPlugin;
|
|
217
|
+
extraPlugins.push(new LicenseWebpackPlugin({
|
|
218
|
+
stats: {
|
|
219
|
+
warnings: false,
|
|
220
|
+
errors: false,
|
|
221
|
+
},
|
|
222
|
+
perChunkOutput: false,
|
|
223
|
+
outputFilename: '3rdpartylicenses.txt',
|
|
224
|
+
skipChildCompilers: true,
|
|
225
|
+
}));
|
|
226
|
+
}
|
|
215
227
|
if (buildOptions.statsJson) {
|
|
216
228
|
extraPlugins.push(new (class {
|
|
217
229
|
apply(compiler) {
|
|
@@ -452,9 +464,14 @@ function getCacheSettings(wco, supportedBrowsers) {
|
|
|
452
464
|
.update(packageVersion)
|
|
453
465
|
.update(wco.projectRoot)
|
|
454
466
|
.update(JSON.stringify(wco.tsConfig))
|
|
455
|
-
.update(JSON.stringify(
|
|
467
|
+
.update(JSON.stringify({
|
|
468
|
+
...wco.buildOptions,
|
|
469
|
+
// Needed because outputPath changes on every build when using i18n extraction
|
|
470
|
+
// https://github.com/angular/angular-cli/blob/736a5f89deaca85f487b78aec9ff66d4118ceb6a/packages/angular_devkit/build_angular/src/utils/i18n-options.ts#L264-L265
|
|
471
|
+
outputPath: undefined,
|
|
472
|
+
}))
|
|
456
473
|
.update(supportedBrowsers.join(''))
|
|
457
|
-
.digest('
|
|
474
|
+
.digest('hex'),
|
|
458
475
|
};
|
|
459
476
|
}
|
|
460
477
|
if (wco.buildOptions.watch && !environment_options_1.cachingDisabled) {
|
|
@@ -270,6 +270,9 @@ function getStylesConfig(wco) {
|
|
|
270
270
|
// Ex: /* autoprefixer grid: autoplace */
|
|
271
271
|
// See: https://github.com/webpack-contrib/sass-loader/blob/45ad0be17264ceada5f0b4fb87e9357abe85c4ff/src/getSassOptions.js#L68-L70
|
|
272
272
|
outputStyle: 'expanded',
|
|
273
|
+
// Silences compiler warnings from 3rd party stylesheets
|
|
274
|
+
quietDeps: !buildOptions.verbose,
|
|
275
|
+
verbose: buildOptions.verbose,
|
|
273
276
|
},
|
|
274
277
|
},
|
|
275
278
|
},
|
|
@@ -299,6 +302,9 @@ function getStylesConfig(wco) {
|
|
|
299
302
|
// Ex: /* autoprefixer grid: autoplace */
|
|
300
303
|
// See: https://github.com/webpack-contrib/sass-loader/blob/45ad0be17264ceada5f0b4fb87e9357abe85c4ff/src/getSassOptions.js#L68-L70
|
|
301
304
|
outputStyle: 'expanded',
|
|
305
|
+
// Silences compiler warnings from 3rd party stylesheets
|
|
306
|
+
quietDeps: !buildOptions.verbose,
|
|
307
|
+
verbose: buildOptions.verbose,
|
|
302
308
|
},
|
|
303
309
|
},
|
|
304
310
|
},
|
|
@@ -384,6 +390,9 @@ function getStylesConfig(wco) {
|
|
|
384
390
|
calc: false,
|
|
385
391
|
// Disable CSS rules sorted due to several issues #20693, https://github.com/ionic-team/ionic-framework/issues/23266 and https://github.com/cssnano/cssnano/issues/1054
|
|
386
392
|
cssDeclarationSorter: false,
|
|
393
|
+
// Workaround for Critters as it doesn't work when `@media all {}` is minified to `@media {}`.
|
|
394
|
+
// TODO: Remove once they move to postcss.
|
|
395
|
+
minifyParams: !buildOptions.optimization.styles.inlineCritical,
|
|
387
396
|
},
|
|
388
397
|
],
|
|
389
398
|
};
|