@angular-devkit/build-angular 12.1.0-next.6 → 12.1.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 +15 -14
- package/src/babel/plugins/adjust-static-class-members.js +22 -1
- package/src/babel/presets/application.js +4 -2
- package/src/browser/index.js +13 -3
- package/src/dev-server/index.js +2 -2
- package/src/extract-i18n/index.js +1 -1
- package/src/karma/index.js +1 -1
- package/src/ng-packagr/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/delete-output-dir.js +28 -2
- package/src/utils/version.d.ts +1 -2
- package/src/utils/version.js +5 -4
- package/src/webpack/configs/browser.js +0 -16
- package/src/webpack/configs/common.js +27 -3
- package/src/webpack/configs/server.js +0 -1
- package/src/webpack/configs/styles.js +9 -0
- package/src/webpack/configs/test.js +3 -3
package/package.json
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-angular",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.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.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.3",
|
|
10
|
+
"@angular-devkit/build-optimizer": "0.1201.3",
|
|
11
|
+
"@angular-devkit/build-webpack": "0.1201.3",
|
|
12
|
+
"@angular-devkit/core": "12.1.3",
|
|
13
13
|
"@babel/core": "7.14.6",
|
|
14
14
|
"@babel/generator": "7.14.5",
|
|
15
15
|
"@babel/helper-annotate-as-pure": "7.14.5",
|
|
16
|
+
"@babel/plugin-proposal-async-generator-functions": "7.14.7",
|
|
16
17
|
"@babel/plugin-transform-async-to-generator": "7.14.5",
|
|
17
18
|
"@babel/plugin-transform-runtime": "7.14.5",
|
|
18
|
-
"@babel/preset-env": "7.14.
|
|
19
|
+
"@babel/preset-env": "7.14.7",
|
|
19
20
|
"@babel/runtime": "7.14.6",
|
|
20
21
|
"@babel/template": "7.14.5",
|
|
21
22
|
"@discoveryjs/json-ext": "0.5.3",
|
|
22
23
|
"@jsdevtools/coverage-istanbul-loader": "3.0.5",
|
|
23
|
-
"@ngtools/webpack": "12.1.
|
|
24
|
+
"@ngtools/webpack": "12.1.3",
|
|
24
25
|
"ansi-colors": "4.1.1",
|
|
25
26
|
"babel-loader": "8.2.2",
|
|
26
27
|
"browserslist": "^4.9.1",
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
"caniuse-lite": "^1.0.30001032",
|
|
29
30
|
"circular-dependency-plugin": "5.2.2",
|
|
30
31
|
"copy-webpack-plugin": "9.0.0",
|
|
31
|
-
"core-js": "3.
|
|
32
|
+
"core-js": "3.15.1",
|
|
32
33
|
"critters": "0.0.10",
|
|
33
34
|
"css-loader": "5.2.6",
|
|
34
35
|
"css-minimizer-webpack-plugin": "3.0.1",
|
|
@@ -39,12 +40,12 @@
|
|
|
39
40
|
"jest-worker": "27.0.2",
|
|
40
41
|
"karma-source-map-support": "1.4.0",
|
|
41
42
|
"less": "4.1.1",
|
|
42
|
-
"less-loader": "
|
|
43
|
-
"license-webpack-plugin": "2.3.
|
|
43
|
+
"less-loader": "10.0.0",
|
|
44
|
+
"license-webpack-plugin": "2.3.20",
|
|
44
45
|
"loader-utils": "2.0.0",
|
|
45
|
-
"mini-css-extract-plugin": "1.6.
|
|
46
|
+
"mini-css-extract-plugin": "1.6.2",
|
|
46
47
|
"minimatch": "3.0.4",
|
|
47
|
-
"open": "8.2.
|
|
48
|
+
"open": "8.2.1",
|
|
48
49
|
"ora": "5.4.1",
|
|
49
50
|
"parse5-html-rewriting-stream": "6.0.1",
|
|
50
51
|
"postcss": "8.3.5",
|
|
@@ -69,7 +70,7 @@
|
|
|
69
70
|
"text-table": "0.2.0",
|
|
70
71
|
"tree-kill": "1.2.2",
|
|
71
72
|
"tslib": "2.3.0",
|
|
72
|
-
"webpack": "5.
|
|
73
|
+
"webpack": "5.44.0",
|
|
73
74
|
"webpack-dev-middleware": "5.0.0",
|
|
74
75
|
"webpack-dev-server": "3.11.2",
|
|
75
76
|
"webpack-merge": "5.8.0",
|
|
@@ -80,7 +81,7 @@
|
|
|
80
81
|
"@angular/localize": "^12.0.0 || ^12.1.0-next",
|
|
81
82
|
"@angular/service-worker": "^12.0.0 || ^12.1.0-next",
|
|
82
83
|
"karma": "^6.3.0",
|
|
83
|
-
"ng-packagr": "^12.0.0",
|
|
84
|
+
"ng-packagr": "^12.0.0 || ^12.1.0-next",
|
|
84
85
|
"protractor": "^7.0.0",
|
|
85
86
|
"tailwindcss": "^2.0.0",
|
|
86
87
|
"tslint": "^6.1.0",
|
|
@@ -57,6 +57,27 @@ 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__') || value.includes('@pureOrBreakMyCode'))) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
return assignmentValue.isPure();
|
|
80
|
+
}
|
|
60
81
|
/**
|
|
61
82
|
* Analyze the sibling nodes of a class to determine if any downlevel elements should be
|
|
62
83
|
* wrapped in a pure annotated IIFE. Also determines if any elements have potential side
|
|
@@ -130,7 +151,7 @@ function analyzeClassSiblings(origin, classIdentifier, allowWrappingDecorators)
|
|
|
130
151
|
nextStatement.remove();
|
|
131
152
|
--i;
|
|
132
153
|
}
|
|
133
|
-
else if (
|
|
154
|
+
else if (canWrapProperty(propertyName, assignmentValue)) {
|
|
134
155
|
wrapStatementPaths.push(nextStatement);
|
|
135
156
|
}
|
|
136
157
|
else {
|
|
@@ -99,9 +99,11 @@ function default_1(api, options) {
|
|
|
99
99
|
let needRuntimeTransform = false;
|
|
100
100
|
if ((_a = options.angularLinker) === null || _a === void 0 ? void 0 : _a.shouldLink) {
|
|
101
101
|
// Babel currently is synchronous so import cannot be used
|
|
102
|
-
const { createEs2015LinkerPlugin
|
|
102
|
+
const { createEs2015LinkerPlugin } = require('@angular/compiler-cli/linker/babel');
|
|
103
103
|
plugins.push(createEs2015LinkerPlugin({
|
|
104
104
|
linkerJitMode: options.angularLinker.jitMode,
|
|
105
|
+
// This is a workaround until https://github.com/angular/angular/issues/42769 is fixed.
|
|
106
|
+
sourceMapping: false,
|
|
105
107
|
logger: createNgtscLogger(options.diagnosticReporter),
|
|
106
108
|
fileSystem: {
|
|
107
109
|
resolve: path.resolve,
|
|
@@ -134,7 +136,7 @@ function default_1(api, options) {
|
|
|
134
136
|
}
|
|
135
137
|
if (options.forceAsyncTransformation) {
|
|
136
138
|
// Always transform async/await to support Zone.js
|
|
137
|
-
plugins.push(require('@babel/plugin-transform-async-to-generator').default);
|
|
139
|
+
plugins.push(require('@babel/plugin-transform-async-to-generator').default, require('@babel/plugin-proposal-async-generator-functions').default);
|
|
138
140
|
needRuntimeTransform = true;
|
|
139
141
|
}
|
|
140
142
|
if (needRuntimeTransform) {
|
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;
|
|
@@ -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
|
}
|
|
@@ -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/ng-packagr/index.js
CHANGED
|
@@ -43,7 +43,7 @@ async function initialize(options, root) {
|
|
|
43
43
|
* @experimental Direct usage of this function is considered experimental.
|
|
44
44
|
*/
|
|
45
45
|
function execute(options, context) {
|
|
46
|
-
return rxjs_1.from(initialize(options, context.workspaceRoot)).pipe(operators_1.switchMap((packager) => (options.watch ? packager.watch() : packager.build())), operators_1.mapTo({ success: true }));
|
|
46
|
+
return rxjs_1.from(initialize(options, context.workspaceRoot)).pipe(operators_1.switchMap((packager) => (options.watch ? packager.watch() : packager.build())), operators_1.mapTo({ success: true }), operators_1.catchError((err) => rxjs_1.of({ success: false, error: err.message })));
|
|
47
47
|
}
|
|
48
48
|
exports.execute = execute;
|
|
49
49
|
exports.default = architect_1.createBuilder(execute);
|
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
|
+
});
|
|
@@ -6,9 +6,28 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
9
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
29
|
exports.deleteOutputDir = void 0;
|
|
11
|
-
const
|
|
30
|
+
const fs = __importStar(require("fs"));
|
|
12
31
|
const path_1 = require("path");
|
|
13
32
|
/**
|
|
14
33
|
* Delete an output directory, but error out if it's the root of the project.
|
|
@@ -18,6 +37,13 @@ function deleteOutputDir(root, outputPath) {
|
|
|
18
37
|
if (resolvedOutputPath === root) {
|
|
19
38
|
throw new Error('Output path MUST not be project root directory!');
|
|
20
39
|
}
|
|
21
|
-
|
|
40
|
+
// The below should be removed and replace with just `rmSync` when support for Node.Js 12 is removed.
|
|
41
|
+
const { rmSync, rmdirSync } = fs;
|
|
42
|
+
if (rmSync) {
|
|
43
|
+
rmSync(resolvedOutputPath, { force: true, recursive: true, maxRetries: 3 });
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
rmdirSync(resolvedOutputPath, { recursive: true, maxRetries: 3 });
|
|
47
|
+
}
|
|
22
48
|
}
|
|
23
49
|
exports.deleteOutputDir = deleteOutputDir;
|
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
|
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.getBrowserConfig = void 0;
|
|
11
|
-
const typescript_1 = require("typescript");
|
|
12
11
|
const utils_1 = require("../../utils");
|
|
13
12
|
const plugins_1 = require("../plugins");
|
|
14
13
|
const helpers_1 = require("../utils/helpers");
|
|
@@ -23,18 +22,6 @@ function getBrowserConfig(wco) {
|
|
|
23
22
|
hashFuncNames: ['sha384'],
|
|
24
23
|
}));
|
|
25
24
|
}
|
|
26
|
-
if (extractLicenses) {
|
|
27
|
-
const LicenseWebpackPlugin = require('license-webpack-plugin').LicenseWebpackPlugin;
|
|
28
|
-
extraPlugins.push(new LicenseWebpackPlugin({
|
|
29
|
-
stats: {
|
|
30
|
-
warnings: false,
|
|
31
|
-
errors: false,
|
|
32
|
-
},
|
|
33
|
-
perChunkOutput: false,
|
|
34
|
-
outputFilename: '3rdpartylicenses.txt',
|
|
35
|
-
skipChildCompilers: true,
|
|
36
|
-
}));
|
|
37
|
-
}
|
|
38
25
|
if (scriptsSourceMap || stylesSourceMap) {
|
|
39
26
|
extraPlugins.push(helpers_1.getSourceMapDevTool(scriptsSourceMap, stylesSourceMap, buildOptions.differentialLoadingNeeded && !buildOptions.watch ? true : hiddenSourceMap, false));
|
|
40
27
|
}
|
|
@@ -51,9 +38,6 @@ function getBrowserConfig(wco) {
|
|
|
51
38
|
resolve: {
|
|
52
39
|
mainFields: ['es2015', 'browser', 'module', 'main'],
|
|
53
40
|
},
|
|
54
|
-
target: wco.tsConfig.options.target === typescript_1.ScriptTarget.ES5 || buildBrowserFeatures.isEs5SupportNeeded()
|
|
55
|
-
? ['web', 'es5']
|
|
56
|
-
: 'web',
|
|
57
41
|
output: {
|
|
58
42
|
crossOriginLoading,
|
|
59
43
|
trustedTypes: 'angular#bundler',
|
|
@@ -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) {
|
|
@@ -324,12 +336,19 @@ function getCommonConfig(wco) {
|
|
|
324
336
|
return {
|
|
325
337
|
mode: scriptsOptimization || stylesOptimization.minify ? 'production' : 'development',
|
|
326
338
|
devtool: false,
|
|
339
|
+
target: [
|
|
340
|
+
platform === 'server' ? 'node' : 'web',
|
|
341
|
+
tsConfig.options.target === typescript_1.ScriptTarget.ES5 ||
|
|
342
|
+
(platform !== 'server' && buildBrowserFeatures.isEs5SupportNeeded())
|
|
343
|
+
? 'es5'
|
|
344
|
+
: 'es2015',
|
|
345
|
+
],
|
|
327
346
|
profile: buildOptions.statsJson,
|
|
328
347
|
resolve: {
|
|
329
348
|
roots: [projectRoot],
|
|
330
349
|
extensions: ['.ts', '.tsx', '.mjs', '.js'],
|
|
331
350
|
symlinks: !buildOptions.preserveSymlinks,
|
|
332
|
-
modules: [
|
|
351
|
+
modules: [tsConfig.options.baseUrl || projectRoot, 'node_modules'],
|
|
333
352
|
},
|
|
334
353
|
resolveLoader: {
|
|
335
354
|
symlinks: !buildOptions.preserveSymlinks,
|
|
@@ -445,9 +464,14 @@ function getCacheSettings(wco, supportedBrowsers) {
|
|
|
445
464
|
.update(packageVersion)
|
|
446
465
|
.update(wco.projectRoot)
|
|
447
466
|
.update(JSON.stringify(wco.tsConfig))
|
|
448
|
-
.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
|
+
}))
|
|
449
473
|
.update(supportedBrowsers.join(''))
|
|
450
|
-
.digest('
|
|
474
|
+
.digest('hex'),
|
|
451
475
|
};
|
|
452
476
|
}
|
|
453
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
|
};
|
|
@@ -69,13 +69,13 @@ function getTestConfig(wco) {
|
|
|
69
69
|
module: {
|
|
70
70
|
rules: extraRules,
|
|
71
71
|
parser: webWorkerTsConfig === undefined
|
|
72
|
-
?
|
|
73
|
-
: {
|
|
72
|
+
? {
|
|
74
73
|
javascript: {
|
|
75
74
|
worker: false,
|
|
76
75
|
url: false,
|
|
77
76
|
},
|
|
78
|
-
}
|
|
77
|
+
}
|
|
78
|
+
: undefined,
|
|
79
79
|
},
|
|
80
80
|
plugins: extraPlugins,
|
|
81
81
|
optimization: {
|