@angular-devkit/build-angular 12.1.0 → 12.1.4
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 +10 -9
- package/src/app-shell/index.js +3 -5
- package/src/babel/plugins/adjust-static-class-members.js +22 -1
- package/src/babel/presets/application.d.ts +0 -1
- package/src/babel/presets/application.js +3 -2
- package/src/babel/webpack-loader.js +0 -9
- 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/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 +29 -4
- package/src/webpack/configs/server.js +0 -1
- package/src/webpack/configs/styles.js +9 -0
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-angular",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.4",
|
|
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.4",
|
|
10
|
+
"@angular-devkit/build-optimizer": "0.1201.4",
|
|
11
|
+
"@angular-devkit/build-webpack": "0.1201.4",
|
|
12
|
+
"@angular-devkit/core": "12.1.4",
|
|
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
19
|
"@babel/preset-env": "7.14.7",
|
|
@@ -20,7 +21,7 @@
|
|
|
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.4",
|
|
24
25
|
"ansi-colors": "4.1.1",
|
|
25
26
|
"babel-loader": "8.2.2",
|
|
26
27
|
"browserslist": "^4.9.1",
|
|
@@ -40,9 +41,9 @@
|
|
|
40
41
|
"karma-source-map-support": "1.4.0",
|
|
41
42
|
"less": "4.1.1",
|
|
42
43
|
"less-loader": "10.0.0",
|
|
43
|
-
"license-webpack-plugin": "2.3.
|
|
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
48
|
"open": "8.2.1",
|
|
48
49
|
"ora": "5.4.1",
|
|
@@ -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",
|
package/src/app-shell/index.js
CHANGED
|
@@ -130,10 +130,9 @@ async function _appShellBuilder(options, context) {
|
|
|
130
130
|
});
|
|
131
131
|
let spinner;
|
|
132
132
|
try {
|
|
133
|
-
// Using `.result` instead of `.output` causes Webpack FS cache not to be created.
|
|
134
133
|
const [browserResult, serverResult] = await Promise.all([
|
|
135
|
-
browserTargetRun.
|
|
136
|
-
serverTargetRun.
|
|
134
|
+
browserTargetRun.result,
|
|
135
|
+
serverTargetRun.result,
|
|
137
136
|
]);
|
|
138
137
|
if (browserResult.success === false || browserResult.baseOutputPath === undefined) {
|
|
139
138
|
return browserResult;
|
|
@@ -152,8 +151,7 @@ async function _appShellBuilder(options, context) {
|
|
|
152
151
|
return { success: false, error: err.message };
|
|
153
152
|
}
|
|
154
153
|
finally {
|
|
155
|
-
|
|
156
|
-
const _ = Promise.all([browserTargetRun.stop(), serverTargetRun.stop()]);
|
|
154
|
+
await Promise.all([browserTargetRun.stop(), serverTargetRun.stop()]);
|
|
157
155
|
}
|
|
158
156
|
}
|
|
159
157
|
exports.default = architect_1.createBuilder(_appShellBuilder);
|
|
@@ -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 {
|
|
@@ -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,
|
|
@@ -135,7 +136,7 @@ function default_1(api, options) {
|
|
|
135
136
|
}
|
|
136
137
|
if (options.forceAsyncTransformation) {
|
|
137
138
|
// Always transform async/await to support Zone.js
|
|
138
|
-
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);
|
|
139
140
|
needRuntimeTransform = true;
|
|
140
141
|
}
|
|
141
142
|
if (needRuntimeTransform) {
|
|
@@ -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;
|
|
@@ -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/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',
|
|
@@ -170,7 +170,7 @@ function getCommonConfig(wco) {
|
|
|
170
170
|
}
|
|
171
171
|
// process asset entries
|
|
172
172
|
if (buildOptions.assets.length) {
|
|
173
|
-
const copyWebpackPluginPatterns = buildOptions.assets.map((asset) => {
|
|
173
|
+
const copyWebpackPluginPatterns = buildOptions.assets.map((asset, index) => {
|
|
174
174
|
// Resolve input paths relative to workspace root and add slash at the end.
|
|
175
175
|
// eslint-disable-next-line prefer-const
|
|
176
176
|
let { input, output, ignore = [], glob } = asset;
|
|
@@ -200,6 +200,7 @@ function getCommonConfig(wco) {
|
|
|
200
200
|
...ignore,
|
|
201
201
|
].map((i) => path.posix.join(input, i)),
|
|
202
202
|
},
|
|
203
|
+
priority: index,
|
|
203
204
|
};
|
|
204
205
|
});
|
|
205
206
|
extraPlugins.push(new copy_webpack_plugin_1.default({
|
|
@@ -212,6 +213,18 @@ function getCommonConfig(wco) {
|
|
|
212
213
|
exclude: /[\\\/]node_modules[\\\/]/,
|
|
213
214
|
}));
|
|
214
215
|
}
|
|
216
|
+
if (buildOptions.extractLicenses) {
|
|
217
|
+
const LicenseWebpackPlugin = require('license-webpack-plugin').LicenseWebpackPlugin;
|
|
218
|
+
extraPlugins.push(new LicenseWebpackPlugin({
|
|
219
|
+
stats: {
|
|
220
|
+
warnings: false,
|
|
221
|
+
errors: false,
|
|
222
|
+
},
|
|
223
|
+
perChunkOutput: false,
|
|
224
|
+
outputFilename: '3rdpartylicenses.txt',
|
|
225
|
+
skipChildCompilers: true,
|
|
226
|
+
}));
|
|
227
|
+
}
|
|
215
228
|
if (buildOptions.statsJson) {
|
|
216
229
|
extraPlugins.push(new (class {
|
|
217
230
|
apply(compiler) {
|
|
@@ -324,12 +337,19 @@ function getCommonConfig(wco) {
|
|
|
324
337
|
return {
|
|
325
338
|
mode: scriptsOptimization || stylesOptimization.minify ? 'production' : 'development',
|
|
326
339
|
devtool: false,
|
|
340
|
+
target: [
|
|
341
|
+
platform === 'server' ? 'node' : 'web',
|
|
342
|
+
tsConfig.options.target === typescript_1.ScriptTarget.ES5 ||
|
|
343
|
+
(platform !== 'server' && buildBrowserFeatures.isEs5SupportNeeded())
|
|
344
|
+
? 'es5'
|
|
345
|
+
: 'es2015',
|
|
346
|
+
],
|
|
327
347
|
profile: buildOptions.statsJson,
|
|
328
348
|
resolve: {
|
|
329
349
|
roots: [projectRoot],
|
|
330
350
|
extensions: ['.ts', '.tsx', '.mjs', '.js'],
|
|
331
351
|
symlinks: !buildOptions.preserveSymlinks,
|
|
332
|
-
modules: [
|
|
352
|
+
modules: [tsConfig.options.baseUrl || projectRoot, 'node_modules'],
|
|
333
353
|
},
|
|
334
354
|
resolveLoader: {
|
|
335
355
|
symlinks: !buildOptions.preserveSymlinks,
|
|
@@ -445,9 +465,14 @@ function getCacheSettings(wco, supportedBrowsers) {
|
|
|
445
465
|
.update(packageVersion)
|
|
446
466
|
.update(wco.projectRoot)
|
|
447
467
|
.update(JSON.stringify(wco.tsConfig))
|
|
448
|
-
.update(JSON.stringify(
|
|
468
|
+
.update(JSON.stringify({
|
|
469
|
+
...wco.buildOptions,
|
|
470
|
+
// Needed because outputPath changes on every build when using i18n extraction
|
|
471
|
+
// https://github.com/angular/angular-cli/blob/736a5f89deaca85f487b78aec9ff66d4118ceb6a/packages/angular_devkit/build_angular/src/utils/i18n-options.ts#L264-L265
|
|
472
|
+
outputPath: undefined,
|
|
473
|
+
}))
|
|
449
474
|
.update(supportedBrowsers.join(''))
|
|
450
|
-
.digest('
|
|
475
|
+
.digest('hex'),
|
|
451
476
|
};
|
|
452
477
|
}
|
|
453
478
|
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
|
};
|