@angular-devkit/build-angular 12.1.0-next.5 → 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 +24 -23
- package/src/app-shell/index.js +28 -8
- package/src/babel/plugins/adjust-static-class-members.js +4 -1
- package/src/babel/plugins/adjust-typescript-enums.js +4 -1
- package/src/babel/plugins/pure-toplevel-functions.js +24 -2
- package/src/babel/presets/application.js +25 -4
- package/src/browser/index.d.ts +1 -4
- package/src/browser/index.js +38 -36
- package/src/dev-server/index.d.ts +1 -1
- package/src/dev-server/index.js +31 -10
- package/src/dev-server/tests/execute-fetch.js +4 -1
- package/src/extract-i18n/index.d.ts +1 -1
- package/src/extract-i18n/index.js +34 -12
- package/src/extract-i18n/ivy-extract-loader.js +20 -1
- package/src/karma/find-tests.js +20 -1
- package/src/karma/index.js +21 -2
- package/src/ng-packagr/index.js +21 -2
- package/src/protractor/index.js +21 -2
- package/src/server/index.d.ts +1 -1
- package/src/server/index.js +21 -2
- package/src/server/tests/setup.d.ts +18 -0
- package/src/server/tests/setup.js +27 -0
- package/src/tslint/index.js +22 -3
- package/src/utils/action-cache.js +21 -2
- package/src/utils/action-executor.js +21 -2
- package/src/utils/build-browser-features.js +25 -3
- package/src/utils/cache-path.js +5 -2
- package/src/utils/check-port.js +20 -1
- package/src/utils/color.js +20 -1
- package/src/utils/copy-assets.js +26 -4
- package/src/utils/copy-file.js +20 -1
- package/src/utils/delete-output-dir.js +28 -2
- package/src/utils/environment-options.d.ts +1 -0
- package/src/utils/environment-options.js +26 -2
- package/src/utils/find-up.js +20 -1
- package/src/utils/i18n-inlining.js +21 -2
- package/src/utils/i18n-options.js +22 -3
- package/src/utils/index-file/html-rewriting-stream.js +20 -1
- package/src/utils/index-file/index-html-generator.js +20 -1
- package/src/utils/index-file/inline-critical-css.js +20 -1
- package/src/utils/index-file/inline-fonts.js +27 -5
- package/src/utils/is-directory.js +20 -1
- package/src/utils/load-translations.js +26 -7
- package/src/utils/process-bundle.js +34 -12
- package/src/utils/read-tsconfig.js +20 -1
- package/src/utils/service-worker.js +21 -2
- package/src/utils/spinner.js +5 -2
- package/src/utils/version.d.ts +1 -2
- package/src/utils/version.js +5 -4
- package/src/utils/webpack-browser-config.js +21 -2
- package/src/webpack/configs/analytics.d.ts +11 -0
- package/src/webpack/configs/analytics.js +29 -0
- package/src/webpack/configs/browser.js +0 -16
- package/src/webpack/configs/common.js +94 -16
- package/src/webpack/configs/dev-server.js +20 -1
- package/src/webpack/configs/index.d.ts +1 -0
- package/src/webpack/configs/index.js +1 -0
- package/src/webpack/configs/server.js +0 -1
- package/src/webpack/configs/styles.js +30 -2
- package/src/webpack/configs/test.js +32 -3
- package/src/webpack/configs/typescript.d.ts +2 -9
- package/src/webpack/configs/typescript.js +16 -14
- package/src/webpack/plugins/any-component-style-budget-checker.js +20 -1
- package/src/webpack/plugins/index.js +4 -1
- package/src/webpack/plugins/karma/karma.js +26 -4
- package/src/webpack/plugins/postcss-cli-resources.js +21 -2
- package/src/webpack/plugins/scripts-webpack-plugin.js +20 -1
- package/src/webpack/utils/helpers.js +20 -1
- package/src/webpack/utils/stats.d.ts +0 -1
- package/src/webpack/utils/stats.js +35 -12
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.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.
|
|
13
|
-
"@babel/core": "7.14.
|
|
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
|
+
"@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/runtime": "7.14.
|
|
19
|
+
"@babel/preset-env": "7.14.7",
|
|
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.2",
|
|
24
25
|
"ansi-colors": "4.1.1",
|
|
25
26
|
"babel-loader": "8.2.2",
|
|
26
27
|
"browserslist": "^4.9.1",
|
|
@@ -28,48 +29,48 @@
|
|
|
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",
|
|
35
36
|
"find-cache-dir": "3.3.1",
|
|
36
37
|
"glob": "7.1.7",
|
|
37
38
|
"https-proxy-agent": "5.0.0",
|
|
38
|
-
"inquirer": "8.1.
|
|
39
|
+
"inquirer": "8.1.1",
|
|
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
|
-
"postcss": "8.3.
|
|
51
|
+
"postcss": "8.3.5",
|
|
51
52
|
"postcss-import": "14.0.2",
|
|
52
|
-
"postcss-loader": "
|
|
53
|
+
"postcss-loader": "6.1.0",
|
|
53
54
|
"postcss-preset-env": "6.7.0",
|
|
54
55
|
"raw-loader": "4.0.2",
|
|
55
56
|
"regenerator-runtime": "0.13.7",
|
|
56
57
|
"resolve-url-loader": "4.0.0",
|
|
57
58
|
"rxjs": "6.6.7",
|
|
58
|
-
"sass": "1.
|
|
59
|
-
"sass-loader": "12.
|
|
59
|
+
"sass": "1.35.1",
|
|
60
|
+
"sass-loader": "12.1.0",
|
|
60
61
|
"semver": "7.3.5",
|
|
61
62
|
"source-map": "0.7.3",
|
|
62
63
|
"source-map-loader": "3.0.0",
|
|
63
64
|
"source-map-support": "0.5.19",
|
|
64
65
|
"style-loader": "2.0.0",
|
|
65
66
|
"stylus": "0.54.8",
|
|
66
|
-
"stylus-loader": "6.
|
|
67
|
+
"stylus-loader": "6.1.0",
|
|
67
68
|
"terser": "5.7.0",
|
|
68
69
|
"terser-webpack-plugin": "5.1.3",
|
|
69
70
|
"text-table": "0.2.0",
|
|
70
71
|
"tree-kill": "1.2.2",
|
|
71
|
-
"tslib": "2.
|
|
72
|
-
"webpack": "5.
|
|
72
|
+
"tslib": "2.3.0",
|
|
73
|
+
"webpack": "5.42.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",
|
package/src/app-shell/index.js
CHANGED
|
@@ -6,11 +6,30 @@
|
|
|
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
|
const architect_1 = require("@angular-devkit/architect");
|
|
11
30
|
const core_1 = require("@angular-devkit/core");
|
|
12
|
-
const fs = require("fs");
|
|
13
|
-
const path = require("path");
|
|
31
|
+
const fs = __importStar(require("fs"));
|
|
32
|
+
const path = __importStar(require("path"));
|
|
14
33
|
const utils_1 = require("../utils");
|
|
15
34
|
const inline_critical_css_1 = require("../utils/index-file/inline-critical-css");
|
|
16
35
|
const service_worker_1 = require("../utils/service-worker");
|
|
@@ -24,7 +43,7 @@ async function _renderUniversal(options, context, browserResult, serverResult, s
|
|
|
24
43
|
// Initialize zone.js
|
|
25
44
|
const root = context.workspaceRoot;
|
|
26
45
|
const zonePackage = require.resolve('zone.js', { paths: [root] });
|
|
27
|
-
await Promise.resolve().then(() => require(zonePackage));
|
|
46
|
+
await Promise.resolve().then(() => __importStar(require(zonePackage)));
|
|
28
47
|
const projectName = context.target && context.target.project;
|
|
29
48
|
if (!projectName) {
|
|
30
49
|
throw new Error('The builder requires a target.');
|
|
@@ -43,7 +62,7 @@ async function _renderUniversal(options, context, browserResult, serverResult, s
|
|
|
43
62
|
const browserIndexOutputPath = path.join(outputPath, 'index.html');
|
|
44
63
|
const indexHtml = await fs.promises.readFile(browserIndexOutputPath, 'utf8');
|
|
45
64
|
const serverBundlePath = await _getServerModuleBundlePath(options, context, serverResult, localeDirectory);
|
|
46
|
-
const { AppServerModule, renderModule } = await Promise.resolve().then(() => require(serverBundlePath));
|
|
65
|
+
const { AppServerModule, renderModule } = await Promise.resolve().then(() => __importStar(require(serverBundlePath)));
|
|
47
66
|
const renderModuleFn = renderModule;
|
|
48
67
|
if (!(renderModuleFn && AppServerModule)) {
|
|
49
68
|
throw new Error(`renderModule method and/or AppServerModule were not exported from: ${serverBundlePath}.`);
|
|
@@ -111,9 +130,10 @@ async function _appShellBuilder(options, context) {
|
|
|
111
130
|
});
|
|
112
131
|
let spinner;
|
|
113
132
|
try {
|
|
133
|
+
// Using `.result` instead of `.output` causes Webpack FS cache not to be created.
|
|
114
134
|
const [browserResult, serverResult] = await Promise.all([
|
|
115
|
-
browserTargetRun.
|
|
116
|
-
serverTargetRun.
|
|
135
|
+
browserTargetRun.output.toPromise(),
|
|
136
|
+
serverTargetRun.output.toPromise(),
|
|
117
137
|
]);
|
|
118
138
|
if (browserResult.success === false || browserResult.baseOutputPath === undefined) {
|
|
119
139
|
return browserResult;
|
|
@@ -132,8 +152,8 @@ async function _appShellBuilder(options, context) {
|
|
|
132
152
|
return { success: false, error: err.message };
|
|
133
153
|
}
|
|
134
154
|
finally {
|
|
135
|
-
//
|
|
136
|
-
|
|
155
|
+
// workaround for [tsetse] All Promises in async functions must either be awaited or used in an expression.
|
|
156
|
+
const _ = Promise.all([browserTargetRun.stop(), serverTargetRun.stop()]);
|
|
137
157
|
}
|
|
138
158
|
}
|
|
139
159
|
exports.default = architect_1.createBuilder(_appShellBuilder);
|
|
@@ -6,10 +6,13 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
9
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
13
|
exports.getKeywords = void 0;
|
|
11
14
|
const core_1 = require("@babel/core");
|
|
12
|
-
const helper_annotate_as_pure_1 = require("@babel/helper-annotate-as-pure");
|
|
15
|
+
const helper_annotate_as_pure_1 = __importDefault(require("@babel/helper-annotate-as-pure"));
|
|
13
16
|
/**
|
|
14
17
|
* The name of the Typescript decorator helper function created by the TypeScript compiler.
|
|
15
18
|
*/
|
|
@@ -6,10 +6,13 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
9
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
13
|
exports.getKeywords = void 0;
|
|
11
14
|
const core_1 = require("@babel/core");
|
|
12
|
-
const helper_annotate_as_pure_1 = require("@babel/helper-annotate-as-pure");
|
|
15
|
+
const helper_annotate_as_pure_1 = __importDefault(require("@babel/helper-annotate-as-pure"));
|
|
13
16
|
/**
|
|
14
17
|
* Provides one or more keywords that if found within the content of a source file indicate
|
|
15
18
|
* that this plugin should be used with a source file.
|
|
@@ -6,10 +6,32 @@
|
|
|
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
|
+
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
9
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
32
|
const core_1 = require("@babel/core");
|
|
11
|
-
const helper_annotate_as_pure_1 = require("@babel/helper-annotate-as-pure");
|
|
12
|
-
const tslib = require("tslib");
|
|
33
|
+
const helper_annotate_as_pure_1 = __importDefault(require("@babel/helper-annotate-as-pure"));
|
|
34
|
+
const tslib = __importStar(require("tslib"));
|
|
13
35
|
/**
|
|
14
36
|
* A cached set of TypeScript helper function names used by the helper name matcher utility function.
|
|
15
37
|
*/
|
|
@@ -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
|
-
const fs = require("fs");
|
|
11
|
-
const path = require("path");
|
|
29
|
+
const fs = __importStar(require("fs"));
|
|
30
|
+
const path = __importStar(require("path"));
|
|
12
31
|
function createI18nDiagnostics(reporter) {
|
|
13
32
|
// Babel currently is synchronous so import cannot be used
|
|
14
33
|
const diagnostics = new (require('@angular/localize/src/tools/src/diagnostics').Diagnostics)();
|
|
@@ -80,9 +99,11 @@ function default_1(api, options) {
|
|
|
80
99
|
let needRuntimeTransform = false;
|
|
81
100
|
if ((_a = options.angularLinker) === null || _a === void 0 ? void 0 : _a.shouldLink) {
|
|
82
101
|
// Babel currently is synchronous so import cannot be used
|
|
83
|
-
const { createEs2015LinkerPlugin
|
|
102
|
+
const { createEs2015LinkerPlugin } = require('@angular/compiler-cli/linker/babel');
|
|
84
103
|
plugins.push(createEs2015LinkerPlugin({
|
|
85
104
|
linkerJitMode: options.angularLinker.jitMode,
|
|
105
|
+
// This is a workaround until https://github.com/angular/angular/issues/42769 is fixed.
|
|
106
|
+
sourceMapping: false,
|
|
86
107
|
logger: createNgtscLogger(options.diagnosticReporter),
|
|
87
108
|
fileSystem: {
|
|
88
109
|
resolve: path.resolve,
|
|
@@ -115,7 +136,7 @@ function default_1(api, options) {
|
|
|
115
136
|
}
|
|
116
137
|
if (options.forceAsyncTransformation) {
|
|
117
138
|
// Always transform async/await to support Zone.js
|
|
118
|
-
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);
|
|
119
140
|
needRuntimeTransform = true;
|
|
120
141
|
}
|
|
121
142
|
if (needRuntimeTransform) {
|
package/src/browser/index.d.ts
CHANGED
|
@@ -9,9 +9,8 @@ import { BuilderContext, BuilderOutput } from '@angular-devkit/architect';
|
|
|
9
9
|
import { WebpackLoggingCallback } from '@angular-devkit/build-webpack';
|
|
10
10
|
import { json } from '@angular-devkit/core';
|
|
11
11
|
import { Observable } from 'rxjs';
|
|
12
|
-
import
|
|
12
|
+
import webpack from 'webpack';
|
|
13
13
|
import { ExecutionTransformer } from '../transforms';
|
|
14
|
-
import { WebpackConfigOptions } from '../utils/build-options';
|
|
15
14
|
import { IndexHtmlTransform } from '../utils/index-file/index-html-generator';
|
|
16
15
|
import { Schema as BrowserBuilderSchema } from './schema';
|
|
17
16
|
/**
|
|
@@ -25,8 +24,6 @@ export declare type BrowserBuilderOutput = json.JsonObject & BuilderOutput & {
|
|
|
25
24
|
*/
|
|
26
25
|
outputPath: string;
|
|
27
26
|
};
|
|
28
|
-
export declare function getAnalyticsConfig(wco: WebpackConfigOptions, context: BuilderContext): webpack.Configuration;
|
|
29
|
-
export declare function getCompilerConfig(wco: WebpackConfigOptions): webpack.Configuration;
|
|
30
27
|
/**
|
|
31
28
|
* @experimental Direct usage of this function is considered experimental.
|
|
32
29
|
*/
|
package/src/browser/index.js
CHANGED
|
@@ -6,13 +6,32 @@
|
|
|
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
|
-
exports.buildWebpackBrowser =
|
|
29
|
+
exports.buildWebpackBrowser = void 0;
|
|
11
30
|
const architect_1 = require("@angular-devkit/architect");
|
|
12
31
|
const build_webpack_1 = require("@angular-devkit/build-webpack");
|
|
13
32
|
const core_1 = require("@angular-devkit/core");
|
|
14
|
-
const fs = require("fs");
|
|
15
|
-
const path = require("path");
|
|
33
|
+
const fs = __importStar(require("fs"));
|
|
34
|
+
const path = __importStar(require("path"));
|
|
16
35
|
const rxjs_1 = require("rxjs");
|
|
17
36
|
const operators_1 = require("rxjs/operators");
|
|
18
37
|
const typescript_1 = require("typescript");
|
|
@@ -33,37 +52,10 @@ const spinner_1 = require("../utils/spinner");
|
|
|
33
52
|
const version_1 = require("../utils/version");
|
|
34
53
|
const webpack_browser_config_1 = require("../utils/webpack-browser-config");
|
|
35
54
|
const configs_1 = require("../webpack/configs");
|
|
36
|
-
const analytics_1 = require("../webpack/plugins/analytics");
|
|
37
55
|
const async_chunks_1 = require("../webpack/utils/async-chunks");
|
|
38
56
|
const helpers_1 = require("../webpack/utils/helpers");
|
|
39
57
|
const stats_1 = require("../webpack/utils/stats");
|
|
40
58
|
const cacheDownlevelPath = environment_options_1.cachingDisabled ? undefined : cache_path_1.findCachePath('angular-build-dl');
|
|
41
|
-
function getAnalyticsConfig(wco, context) {
|
|
42
|
-
if (context.analytics) {
|
|
43
|
-
// If there's analytics, add our plugin. Otherwise no need to slow down the build.
|
|
44
|
-
let category = 'build';
|
|
45
|
-
if (context.builder) {
|
|
46
|
-
// We already vetted that this is a "safe" package, otherwise the analytics would be noop.
|
|
47
|
-
category =
|
|
48
|
-
context.builder.builderName.split(':')[1] || context.builder.builderName || 'build';
|
|
49
|
-
}
|
|
50
|
-
// The category is the builder name if it's an angular builder.
|
|
51
|
-
return {
|
|
52
|
-
plugins: [
|
|
53
|
-
new analytics_1.NgBuildAnalyticsPlugin(wco.projectRoot, context.analytics, category, !!wco.tsConfig.options.enableIvy),
|
|
54
|
-
],
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
return {};
|
|
58
|
-
}
|
|
59
|
-
exports.getAnalyticsConfig = getAnalyticsConfig;
|
|
60
|
-
function getCompilerConfig(wco) {
|
|
61
|
-
if (wco.buildOptions.main || wco.buildOptions.polyfills) {
|
|
62
|
-
return configs_1.getTypeScriptConfig(wco);
|
|
63
|
-
}
|
|
64
|
-
return {};
|
|
65
|
-
}
|
|
66
|
-
exports.getCompilerConfig = getCompilerConfig;
|
|
67
59
|
async function initialize(options, context, differentialLoadingNeeded, webpackConfigurationTransform) {
|
|
68
60
|
var _a, _b;
|
|
69
61
|
const originalOutputPath = options.outputPath;
|
|
@@ -74,8 +66,8 @@ async function initialize(options, context, differentialLoadingNeeded, webpackCo
|
|
|
74
66
|
configs_1.getBrowserConfig(wco),
|
|
75
67
|
configs_1.getStylesConfig(wco),
|
|
76
68
|
configs_1.getStatsConfig(wco),
|
|
77
|
-
getAnalyticsConfig(wco, context),
|
|
78
|
-
|
|
69
|
+
configs_1.getAnalyticsConfig(wco, context),
|
|
70
|
+
configs_1.getTypeScriptConfig(wco),
|
|
79
71
|
wco.buildOptions.webWorkerTsConfig ? configs_1.getWorkerConfig(wco) : {},
|
|
80
72
|
], { differentialLoadingNeeded });
|
|
81
73
|
// Validate asset option values if processed directly
|
|
@@ -109,7 +101,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
109
101
|
const baseOutputPath = path.resolve(context.workspaceRoot, options.outputPath);
|
|
110
102
|
let outputPaths;
|
|
111
103
|
// Check Angular version.
|
|
112
|
-
version_1.assertCompatibleAngularVersion(context.workspaceRoot
|
|
104
|
+
version_1.assertCompatibleAngularVersion(context.workspaceRoot);
|
|
113
105
|
return rxjs_1.from(context.getProjectMetadata(projectName)).pipe(operators_1.switchMap(async (projectMetadata) => {
|
|
114
106
|
var _a;
|
|
115
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 : '')));
|
|
@@ -310,7 +302,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
310
302
|
runtimeData: processResults,
|
|
311
303
|
supportedBrowsers: buildBrowserFeatures.supportedBrowsers,
|
|
312
304
|
};
|
|
313
|
-
processResults.push(await Promise.resolve().then(() => require('../utils/process-bundle')).then((m) => m.process(runtimeOptions)));
|
|
305
|
+
processResults.push(await Promise.resolve().then(() => __importStar(require('../utils/process-bundle'))).then((m) => m.process(runtimeOptions)));
|
|
314
306
|
}
|
|
315
307
|
spinner.succeed('ES5 bundle generation complete.');
|
|
316
308
|
if (i18n.shouldInline) {
|
|
@@ -470,6 +462,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
470
462
|
crossOrigin: options.crossOrigin,
|
|
471
463
|
postTransform: transforms.indexHtml,
|
|
472
464
|
});
|
|
465
|
+
let hasErrors = false;
|
|
473
466
|
for (const [locale, outputPath] of outputPaths.entries()) {
|
|
474
467
|
try {
|
|
475
468
|
const { content, warnings, errors } = await indexHtmlGenerator.process({
|
|
@@ -484,7 +477,10 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
484
477
|
if (warnings.length || errors.length) {
|
|
485
478
|
spinner.stop();
|
|
486
479
|
warnings.forEach((m) => context.logger.warn(m));
|
|
487
|
-
errors.forEach((m) =>
|
|
480
|
+
errors.forEach((m) => {
|
|
481
|
+
context.logger.error(m);
|
|
482
|
+
hasErrors = true;
|
|
483
|
+
});
|
|
488
484
|
spinner.start();
|
|
489
485
|
}
|
|
490
486
|
const indexOutput = path.join(outputPath, webpack_browser_config_1.getIndexOutputFile(options.index));
|
|
@@ -496,7 +492,13 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
496
492
|
return { success: false, error: mapErrorToMessage(error) };
|
|
497
493
|
}
|
|
498
494
|
}
|
|
499
|
-
|
|
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
|
+
}
|
|
500
502
|
}
|
|
501
503
|
if (options.serviceWorker) {
|
|
502
504
|
spinner.start('Generating service worker...');
|
|
@@ -9,7 +9,7 @@ import { BuilderContext } from '@angular-devkit/architect';
|
|
|
9
9
|
import { DevServerBuildOutput, WebpackLoggingCallback } from '@angular-devkit/build-webpack';
|
|
10
10
|
import { json } from '@angular-devkit/core';
|
|
11
11
|
import { Observable } from 'rxjs';
|
|
12
|
-
import
|
|
12
|
+
import webpack from 'webpack';
|
|
13
13
|
import { ExecutionTransformer } from '../transforms';
|
|
14
14
|
import { IndexHtmlTransform } from '../utils/index-file/index-html-generator';
|
|
15
15
|
import { Schema } from './schema';
|
package/src/dev-server/index.js
CHANGED
|
@@ -6,18 +6,39 @@
|
|
|
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
|
+
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
9
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
32
|
exports.serveWebpackBrowser = void 0;
|
|
11
33
|
const architect_1 = require("@angular-devkit/architect");
|
|
12
34
|
const build_webpack_1 = require("@angular-devkit/build-webpack");
|
|
13
35
|
const core_1 = require("@angular-devkit/core");
|
|
14
|
-
const path = require("path");
|
|
36
|
+
const path = __importStar(require("path"));
|
|
15
37
|
const rxjs_1 = require("rxjs");
|
|
16
38
|
const operators_1 = require("rxjs/operators");
|
|
17
|
-
const ts = require("typescript");
|
|
18
|
-
const url = require("url");
|
|
19
|
-
const
|
|
20
|
-
const browser_1 = require("../browser");
|
|
39
|
+
const ts = __importStar(require("typescript"));
|
|
40
|
+
const url = __importStar(require("url"));
|
|
41
|
+
const webpack_dev_server_1 = __importDefault(require("webpack-dev-server"));
|
|
21
42
|
const schema_1 = require("../browser/schema");
|
|
22
43
|
const utils_1 = require("../utils");
|
|
23
44
|
const cache_path_1 = require("../utils/cache-path");
|
|
@@ -56,7 +77,7 @@ const devServerBuildOverriddenKeys = [
|
|
|
56
77
|
function serveWebpackBrowser(options, context, transforms = {}) {
|
|
57
78
|
// Check Angular version.
|
|
58
79
|
const { logger, workspaceRoot } = context;
|
|
59
|
-
version_1.assertCompatibleAngularVersion(workspaceRoot
|
|
80
|
+
version_1.assertCompatibleAngularVersion(workspaceRoot);
|
|
60
81
|
const browserTarget = architect_1.targetFromTargetString(options.browserTarget);
|
|
61
82
|
async function setup() {
|
|
62
83
|
var _a, _b;
|
|
@@ -131,8 +152,8 @@ function serveWebpackBrowser(options, context, transforms = {}) {
|
|
|
131
152
|
configs_1.getBrowserConfig(wco),
|
|
132
153
|
configs_1.getStylesConfig(wco),
|
|
133
154
|
configs_1.getStatsConfig(wco),
|
|
134
|
-
|
|
135
|
-
|
|
155
|
+
configs_1.getAnalyticsConfig(wco, context),
|
|
156
|
+
configs_1.getTypeScriptConfig(wco),
|
|
136
157
|
browserOptions.webWorkerTsConfig ? configs_1.getWorkerConfig(wco) : {},
|
|
137
158
|
], devServerOptions);
|
|
138
159
|
if (!config.devServer) {
|
|
@@ -142,7 +163,7 @@ function serveWebpackBrowser(options, context, transforms = {}) {
|
|
|
142
163
|
// This is needed because we cannot use the inline option directly in the config
|
|
143
164
|
// because of the SuppressExtractedTextChunksWebpackPlugin
|
|
144
165
|
// Consider not using SuppressExtractedTextChunksWebpackPlugin when liveReload is enable.
|
|
145
|
-
|
|
166
|
+
webpack_dev_server_1.default.addDevServerEntrypoints(config, {
|
|
146
167
|
...config.devServer,
|
|
147
168
|
inline: true,
|
|
148
169
|
});
|
|
@@ -246,7 +267,7 @@ function serveWebpackBrowser(options, context, transforms = {}) {
|
|
|
246
267
|
` +
|
|
247
268
|
'\n');
|
|
248
269
|
if (options.open) {
|
|
249
|
-
const open = await Promise.resolve().then(() => require('open'));
|
|
270
|
+
const open = (await Promise.resolve().then(() => __importStar(require('open')))).default;
|
|
250
271
|
await open(serverAddress);
|
|
251
272
|
}
|
|
252
273
|
}
|
|
@@ -6,9 +6,12 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
9
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
13
|
exports.executeOnceAndFetch = void 0;
|
|
11
|
-
const node_fetch_1 = require("node-fetch"); // eslint-disable-line import/no-extraneous-dependencies
|
|
14
|
+
const node_fetch_1 = __importDefault(require("node-fetch")); // eslint-disable-line import/no-extraneous-dependencies
|
|
12
15
|
const operators_1 = require("rxjs/operators");
|
|
13
16
|
const url_1 = require("url");
|
|
14
17
|
async function executeOnceAndFetch(harness, url, options) {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { BuilderContext } from '@angular-devkit/architect';
|
|
9
9
|
import { BuildResult } from '@angular-devkit/build-webpack';
|
|
10
10
|
import { JsonObject } from '@angular-devkit/core';
|
|
11
|
-
import
|
|
11
|
+
import webpack from 'webpack';
|
|
12
12
|
import { ExecutionTransformer } from '../transforms';
|
|
13
13
|
import { Schema } from './schema';
|
|
14
14
|
export declare type ExtractI18nBuilderOptions = Schema & JsonObject;
|