@angular-devkit/build-angular 15.0.0-next.3 → 15.0.0-next.5
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 +19 -18
- package/src/builders/app-shell/index.js +39 -40
- package/src/builders/app-shell/render-worker.d.ts +36 -0
- package/src/builders/app-shell/render-worker.js +82 -0
- package/src/builders/browser/index.d.ts +2 -0
- package/src/builders/browser/index.js +38 -19
- package/src/builders/browser/schema.json +2 -2
- package/src/builders/browser-esbuild/compiler-plugin.d.ts +10 -2
- package/src/builders/browser-esbuild/compiler-plugin.js +211 -115
- package/src/builders/browser-esbuild/esbuild.d.ts +4 -3
- package/src/builders/browser-esbuild/esbuild.js +12 -6
- package/src/builders/browser-esbuild/experimental-warnings.js +0 -3
- package/src/builders/browser-esbuild/index.d.ts +3 -3
- package/src/builders/browser-esbuild/index.js +145 -87
- package/src/builders/browser-esbuild/options.d.ts +26 -4
- package/src/builders/browser-esbuild/options.js +56 -5
- package/src/builders/browser-esbuild/profiling.d.ts +11 -0
- package/src/builders/browser-esbuild/profiling.js +64 -0
- package/src/builders/browser-esbuild/sass-plugin.js +11 -5
- package/src/builders/browser-esbuild/schema.json +2 -2
- package/src/builders/browser-esbuild/watcher.d.ts +23 -0
- package/src/builders/browser-esbuild/watcher.js +93 -0
- package/src/builders/dev-server/index.d.ts +2 -0
- package/src/builders/dev-server/index.js +10 -7
- package/src/builders/karma/find-tests-plugin.js +1 -0
- package/src/builders/karma/index.d.ts +1 -1
- package/src/builders/karma/index.js +50 -9
- package/src/builders/karma/schema.d.ts +1 -1
- package/src/builders/karma/schema.json +1 -1
- package/src/builders/server/schema.json +1 -1
- package/src/utils/environment-options.d.ts +1 -0
- package/src/utils/environment-options.js +3 -1
- package/src/utils/process-bundle.js +1 -1
- package/src/utils/service-worker.d.ts +3 -0
- package/src/utils/service-worker.js +29 -2
- package/src/webpack/configs/common.js +31 -7
- package/src/webpack/configs/index.d.ts +0 -1
- package/src/webpack/configs/index.js +0 -1
- package/src/webpack/configs/styles.d.ts +1 -7
- package/src/webpack/configs/styles.js +70 -60
- package/src/webpack/plugins/occurrences-plugin.d.ts +18 -0
- package/src/webpack/plugins/occurrences-plugin.js +79 -0
- package/src/webpack/plugins/scripts-webpack-plugin.js +24 -5
- package/src/webpack/plugins/styles-webpack-plugin.d.ts +19 -0
- package/src/webpack/plugins/styles-webpack-plugin.js +71 -0
- package/src/webpack/utils/helpers.d.ts +5 -1
- package/src/webpack/utils/helpers.js +24 -14
- package/src/webpack/utils/stats.d.ts +13 -8
- package/src/webpack/utils/stats.js +57 -6
- package/src/webpack/configs/analytics.d.ts +0 -11
- package/src/webpack/configs/analytics.js +0 -27
- package/src/webpack/plugins/analytics.d.ts +0 -66
- package/src/webpack/plugins/analytics.js +0 -236
package/package.json
CHANGED
|
@@ -1,43 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-angular",
|
|
3
|
-
"version": "15.0.0-next.
|
|
3
|
+
"version": "15.0.0-next.5",
|
|
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
9
|
"@ampproject/remapping": "2.2.0",
|
|
10
|
-
"@angular-devkit/architect": "0.1500.0-next.
|
|
11
|
-
"@angular-devkit/build-webpack": "0.1500.0-next.
|
|
12
|
-
"@angular-devkit/core": "15.0.0-next.
|
|
10
|
+
"@angular-devkit/architect": "0.1500.0-next.5",
|
|
11
|
+
"@angular-devkit/build-webpack": "0.1500.0-next.5",
|
|
12
|
+
"@angular-devkit/core": "15.0.0-next.5",
|
|
13
13
|
"@babel/core": "7.19.3",
|
|
14
|
-
"@babel/generator": "7.19.
|
|
14
|
+
"@babel/generator": "7.19.5",
|
|
15
15
|
"@babel/helper-annotate-as-pure": "7.18.6",
|
|
16
16
|
"@babel/plugin-proposal-async-generator-functions": "7.19.1",
|
|
17
17
|
"@babel/plugin-transform-async-to-generator": "7.18.6",
|
|
18
18
|
"@babel/plugin-transform-runtime": "7.19.1",
|
|
19
|
-
"@babel/preset-env": "7.19.
|
|
20
|
-
"@babel/runtime": "7.19.
|
|
19
|
+
"@babel/preset-env": "7.19.4",
|
|
20
|
+
"@babel/runtime": "7.19.4",
|
|
21
21
|
"@babel/template": "7.18.10",
|
|
22
22
|
"@discoveryjs/json-ext": "0.5.7",
|
|
23
|
-
"@ngtools/webpack": "15.0.0-next.
|
|
23
|
+
"@ngtools/webpack": "15.0.0-next.5",
|
|
24
24
|
"ansi-colors": "4.1.3",
|
|
25
25
|
"autoprefixer": "10.4.12",
|
|
26
26
|
"babel-loader": "8.2.5",
|
|
27
27
|
"babel-plugin-istanbul": "6.1.1",
|
|
28
28
|
"browserslist": "^4.9.1",
|
|
29
29
|
"cacache": "16.1.3",
|
|
30
|
+
"chokidar": "3.5.3",
|
|
30
31
|
"copy-webpack-plugin": "11.0.0",
|
|
31
32
|
"critters": "0.0.16",
|
|
32
33
|
"css-loader": "6.7.1",
|
|
33
|
-
"esbuild-wasm": "0.15.
|
|
34
|
+
"esbuild-wasm": "0.15.10",
|
|
34
35
|
"glob": "8.0.3",
|
|
35
36
|
"https-proxy-agent": "5.0.1",
|
|
36
37
|
"inquirer": "8.2.4",
|
|
37
38
|
"jsonc-parser": "3.2.0",
|
|
38
39
|
"karma-source-map-support": "1.4.0",
|
|
39
40
|
"less": "4.1.3",
|
|
40
|
-
"less-loader": "11.
|
|
41
|
+
"less-loader": "11.1.0",
|
|
41
42
|
"license-webpack-plugin": "4.0.2",
|
|
42
43
|
"loader-utils": "3.2.0",
|
|
43
44
|
"mini-css-extract-plugin": "2.6.1",
|
|
@@ -46,18 +47,18 @@
|
|
|
46
47
|
"ora": "5.4.1",
|
|
47
48
|
"parse5-html-rewriting-stream": "6.0.1",
|
|
48
49
|
"piscina": "3.2.0",
|
|
49
|
-
"postcss": "8.4.
|
|
50
|
+
"postcss": "8.4.17",
|
|
50
51
|
"postcss-import": "15.0.0",
|
|
51
52
|
"postcss-loader": "7.0.1",
|
|
52
53
|
"regenerator-runtime": "0.13.9",
|
|
53
54
|
"resolve-url-loader": "5.0.0",
|
|
54
55
|
"rxjs": "6.6.7",
|
|
55
56
|
"sass": "1.55.0",
|
|
56
|
-
"sass-loader": "13.0
|
|
57
|
-
"semver": "7.3.
|
|
58
|
-
"source-map-loader": "4.0.
|
|
57
|
+
"sass-loader": "13.1.0",
|
|
58
|
+
"semver": "7.3.8",
|
|
59
|
+
"source-map-loader": "4.0.1",
|
|
59
60
|
"source-map-support": "0.5.21",
|
|
60
|
-
"terser": "5.15.
|
|
61
|
+
"terser": "5.15.1",
|
|
61
62
|
"text-table": "0.2.0",
|
|
62
63
|
"tree-kill": "1.2.2",
|
|
63
64
|
"tslib": "2.4.0",
|
|
@@ -68,7 +69,7 @@
|
|
|
68
69
|
"webpack-subresource-integrity": "5.1.0"
|
|
69
70
|
},
|
|
70
71
|
"optionalDependencies": {
|
|
71
|
-
"esbuild": "0.15.
|
|
72
|
+
"esbuild": "0.15.10"
|
|
72
73
|
},
|
|
73
74
|
"peerDependencies": {
|
|
74
75
|
"@angular/compiler-cli": "^15.0.0-next",
|
|
@@ -78,7 +79,7 @@
|
|
|
78
79
|
"ng-packagr": "^15.0.0-next",
|
|
79
80
|
"protractor": "^7.0.0",
|
|
80
81
|
"tailwindcss": "^2.0.0 || ^3.0.0",
|
|
81
|
-
"typescript": "
|
|
82
|
+
"typescript": "~4.8.2"
|
|
82
83
|
},
|
|
83
84
|
"peerDependenciesMeta": {
|
|
84
85
|
"@angular/localize": {
|
|
@@ -112,7 +113,7 @@
|
|
|
112
113
|
"url": "https://github.com/angular/angular-cli.git"
|
|
113
114
|
},
|
|
114
115
|
"engines": {
|
|
115
|
-
"node": "^14.
|
|
116
|
+
"node": "^14.20.0 || ^16.13.0 || >=18.10.0",
|
|
116
117
|
"npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
|
|
117
118
|
"yarn": ">= 1.13.0"
|
|
118
119
|
},
|
|
@@ -34,9 +34,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
34
34
|
};
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
const architect_1 = require("@angular-devkit/architect");
|
|
37
|
-
const assert_1 = __importDefault(require("assert"));
|
|
38
37
|
const fs = __importStar(require("fs"));
|
|
39
38
|
const path = __importStar(require("path"));
|
|
39
|
+
const piscina_1 = __importDefault(require("piscina"));
|
|
40
40
|
const utils_1 = require("../../utils");
|
|
41
41
|
const error_1 = require("../../utils/error");
|
|
42
42
|
const inline_critical_css_1 = require("../../utils/index-file/inline-critical-css");
|
|
@@ -49,10 +49,9 @@ async function _renderUniversal(options, context, browserResult, serverResult, s
|
|
|
49
49
|
const rawBrowserOptions = (await context.getTargetOptions(browserTarget));
|
|
50
50
|
const browserBuilderName = await context.getBuilderNameForTarget(browserTarget);
|
|
51
51
|
const browserOptions = await context.validateOptions(rawBrowserOptions, browserBuilderName);
|
|
52
|
-
//
|
|
52
|
+
// Locate zone.js to load in the render worker
|
|
53
53
|
const root = context.workspaceRoot;
|
|
54
54
|
const zonePackage = require.resolve('zone.js', { paths: [root] });
|
|
55
|
-
await Promise.resolve().then(() => __importStar(require(zonePackage)));
|
|
56
55
|
const projectName = context.target && context.target.project;
|
|
57
56
|
if (!projectName) {
|
|
58
57
|
throw new Error('The builder requires a target.');
|
|
@@ -66,46 +65,46 @@ async function _renderUniversal(options, context, browserResult, serverResult, s
|
|
|
66
65
|
deployUrl: browserOptions.deployUrl,
|
|
67
66
|
})
|
|
68
67
|
: undefined;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
provide: ɵSERVER_CONTEXT,
|
|
85
|
-
useValue: 'app-shell',
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
});
|
|
89
|
-
// Overwrite the client index file.
|
|
90
|
-
const outputIndexPath = options.outputIndexPath
|
|
91
|
-
? path.join(root, options.outputIndexPath)
|
|
92
|
-
: browserIndexOutputPath;
|
|
93
|
-
if (inlineCriticalCssProcessor) {
|
|
94
|
-
const { content, warnings, errors } = await inlineCriticalCssProcessor.process(html, {
|
|
95
|
-
outputPath,
|
|
68
|
+
const renderWorker = new piscina_1.default({
|
|
69
|
+
filename: require.resolve('./render-worker'),
|
|
70
|
+
maxThreads: 1,
|
|
71
|
+
workerData: { zonePackage },
|
|
72
|
+
});
|
|
73
|
+
try {
|
|
74
|
+
for (const { path: outputPath, baseHref } of browserResult.outputs) {
|
|
75
|
+
const localeDirectory = path.relative(browserResult.baseOutputPath, outputPath);
|
|
76
|
+
const browserIndexOutputPath = path.join(outputPath, 'index.html');
|
|
77
|
+
const indexHtml = await fs.promises.readFile(browserIndexOutputPath, 'utf8');
|
|
78
|
+
const serverBundlePath = await _getServerModuleBundlePath(options, context, serverResult, localeDirectory);
|
|
79
|
+
let html = await renderWorker.run({
|
|
80
|
+
serverBundlePath,
|
|
81
|
+
document: indexHtml,
|
|
82
|
+
url: options.route,
|
|
96
83
|
});
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
84
|
+
// Overwrite the client index file.
|
|
85
|
+
const outputIndexPath = options.outputIndexPath
|
|
86
|
+
? path.join(root, options.outputIndexPath)
|
|
87
|
+
: browserIndexOutputPath;
|
|
88
|
+
if (inlineCriticalCssProcessor) {
|
|
89
|
+
const { content, warnings, errors } = await inlineCriticalCssProcessor.process(html, {
|
|
90
|
+
outputPath,
|
|
91
|
+
});
|
|
92
|
+
html = content;
|
|
93
|
+
if (warnings.length || errors.length) {
|
|
94
|
+
spinner.stop();
|
|
95
|
+
warnings.forEach((m) => context.logger.warn(m));
|
|
96
|
+
errors.forEach((m) => context.logger.error(m));
|
|
97
|
+
spinner.start();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
await fs.promises.writeFile(outputIndexPath, html);
|
|
101
|
+
if (browserOptions.serviceWorker) {
|
|
102
|
+
await (0, service_worker_1.augmentAppWithServiceWorker)(projectRoot, root, outputPath, baseHref !== null && baseHref !== void 0 ? baseHref : '/', browserOptions.ngswConfigPath);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
105
|
+
}
|
|
106
|
+
finally {
|
|
107
|
+
await renderWorker.destroy();
|
|
109
108
|
}
|
|
110
109
|
return browserResult;
|
|
111
110
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* A request to render a Server bundle generate by the universal server builder.
|
|
10
|
+
*/
|
|
11
|
+
interface RenderRequest {
|
|
12
|
+
/**
|
|
13
|
+
* The path to the server bundle that should be loaded and rendered.
|
|
14
|
+
*/
|
|
15
|
+
serverBundlePath: string;
|
|
16
|
+
/**
|
|
17
|
+
* The existing HTML document as a string that will be augmented with the rendered application.
|
|
18
|
+
*/
|
|
19
|
+
document: string;
|
|
20
|
+
/**
|
|
21
|
+
* An optional URL path that represents the Angular route that should be rendered.
|
|
22
|
+
*/
|
|
23
|
+
url: string | undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Renders an application based on a provided server bundle path, initial document, and optional URL route.
|
|
27
|
+
* @param param0 A request to render a server bundle.
|
|
28
|
+
* @returns A promise that resolves to the render HTML document for the application.
|
|
29
|
+
*/
|
|
30
|
+
declare function render({ serverBundlePath, document, url }: RenderRequest): Promise<string>;
|
|
31
|
+
/**
|
|
32
|
+
* The default export will be the promise returned by the initialize function.
|
|
33
|
+
* This is awaited by piscina prior to using the Worker.
|
|
34
|
+
*/
|
|
35
|
+
declare const _default: Promise<typeof render>;
|
|
36
|
+
export default _default;
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
33
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
|
+
};
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
37
|
+
const node_worker_threads_1 = require("node:worker_threads");
|
|
38
|
+
/**
|
|
39
|
+
* The fully resolved path to the zone.js package that will be loaded during worker initialization.
|
|
40
|
+
* This is passed as workerData when setting up the worker via the `piscina` package.
|
|
41
|
+
*/
|
|
42
|
+
const { zonePackage } = node_worker_threads_1.workerData;
|
|
43
|
+
/**
|
|
44
|
+
* Renders an application based on a provided server bundle path, initial document, and optional URL route.
|
|
45
|
+
* @param param0 A request to render a server bundle.
|
|
46
|
+
* @returns A promise that resolves to the render HTML document for the application.
|
|
47
|
+
*/
|
|
48
|
+
async function render({ serverBundlePath, document, url }) {
|
|
49
|
+
const { AppServerModule, renderModule, ɵSERVER_CONTEXT } = (await Promise.resolve().then(() => __importStar(require(serverBundlePath))));
|
|
50
|
+
(0, node_assert_1.default)(renderModule, `renderModule was not exported from: ${serverBundlePath}.`);
|
|
51
|
+
(0, node_assert_1.default)(AppServerModule, `AppServerModule was not exported from: ${serverBundlePath}.`);
|
|
52
|
+
(0, node_assert_1.default)(ɵSERVER_CONTEXT, `ɵSERVER_CONTEXT was not exported from: ${serverBundlePath}.`);
|
|
53
|
+
// Render platform server module
|
|
54
|
+
const html = await renderModule(AppServerModule, {
|
|
55
|
+
document,
|
|
56
|
+
url,
|
|
57
|
+
extraProviders: [
|
|
58
|
+
{
|
|
59
|
+
provide: ɵSERVER_CONTEXT,
|
|
60
|
+
useValue: 'app-shell',
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
});
|
|
64
|
+
return html;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Initializes the worker when it is first created by loading the Zone.js package
|
|
68
|
+
* into the worker instance.
|
|
69
|
+
*
|
|
70
|
+
* @returns A promise resolving to the render function of the worker.
|
|
71
|
+
*/
|
|
72
|
+
async function initialize() {
|
|
73
|
+
// Setup Zone.js
|
|
74
|
+
await Promise.resolve().then(() => __importStar(require(zonePackage)));
|
|
75
|
+
// Return the render function for use
|
|
76
|
+
return render;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The default export will be the promise returned by the initialize function.
|
|
80
|
+
* This is awaited by piscina prior to using the Worker.
|
|
81
|
+
*/
|
|
82
|
+
exports.default = initialize();
|
|
@@ -11,11 +11,13 @@ import { Observable } from 'rxjs';
|
|
|
11
11
|
import webpack from 'webpack';
|
|
12
12
|
import { ExecutionTransformer } from '../../transforms';
|
|
13
13
|
import { IndexHtmlTransform } from '../../utils/index-file/index-html-generator';
|
|
14
|
+
import { BuildEventStats } from '../../webpack/utils/stats';
|
|
14
15
|
import { Schema as BrowserBuilderSchema } from './schema';
|
|
15
16
|
/**
|
|
16
17
|
* @experimental Direct usage of this type is considered experimental.
|
|
17
18
|
*/
|
|
18
19
|
export declare type BrowserBuilderOutput = BuilderOutput & {
|
|
20
|
+
stats: BuildEventStats;
|
|
19
21
|
baseOutputPath: string;
|
|
20
22
|
/**
|
|
21
23
|
* @deprecated in version 14. Use 'outputs' instead.
|
|
@@ -69,7 +69,6 @@ async function initialize(options, context, webpackConfigurationTransform) {
|
|
|
69
69
|
const { config, projectRoot, projectSourceRoot, i18n } = await (0, webpack_browser_config_1.generateI18nBrowserWebpackConfigFromContext)(adjustedOptions, context, (wco) => [
|
|
70
70
|
(0, configs_1.getCommonConfig)(wco),
|
|
71
71
|
(0, configs_1.getStylesConfig)(wco),
|
|
72
|
-
(0, configs_1.getAnalyticsConfig)(wco, context),
|
|
73
72
|
]);
|
|
74
73
|
// Validate asset option values if processed directly
|
|
75
74
|
if (((_a = options.assets) === null || _a === void 0 ? void 0 : _a.length) && !((_b = adjustedOptions.assets) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
@@ -137,7 +136,9 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
137
136
|
context.logger.info(stats.toString(config.stats));
|
|
138
137
|
}
|
|
139
138
|
}),
|
|
140
|
-
}).pipe((0, operators_1.concatMap)(
|
|
139
|
+
}).pipe((0, operators_1.concatMap)(
|
|
140
|
+
// eslint-disable-next-line max-lines-per-function
|
|
141
|
+
async (buildEvent) => {
|
|
141
142
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
142
143
|
const spinner = new spinner_1.Spinner();
|
|
143
144
|
spinner.enabled = options.progress !== false;
|
|
@@ -164,7 +165,10 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
164
165
|
if ((0, stats_1.statsHasErrors)(webpackStats)) {
|
|
165
166
|
context.logger.error((0, stats_1.statsErrorsToString)(webpackStats, { colors: true }));
|
|
166
167
|
}
|
|
167
|
-
return {
|
|
168
|
+
return {
|
|
169
|
+
webpackStats: webpackRawStats,
|
|
170
|
+
output: { success: false },
|
|
171
|
+
};
|
|
168
172
|
}
|
|
169
173
|
else {
|
|
170
174
|
outputPaths = (0, output_paths_1.ensureOutputPaths)(baseOutputPath, i18n);
|
|
@@ -172,7 +176,10 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
172
176
|
if (i18n.shouldInline) {
|
|
173
177
|
const success = await (0, i18n_inlining_1.i18nInlineEmittedFiles)(context, emittedFiles, i18n, baseOutputPath, Array.from(outputPaths.values()), scriptsEntryPointName, webpackOutputPath, options.i18nMissingTranslation);
|
|
174
178
|
if (!success) {
|
|
175
|
-
return {
|
|
179
|
+
return {
|
|
180
|
+
webpackStats: webpackRawStats,
|
|
181
|
+
output: { success: false },
|
|
182
|
+
};
|
|
176
183
|
}
|
|
177
184
|
}
|
|
178
185
|
// Check for budget errors and display them to the user.
|
|
@@ -205,7 +212,13 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
205
212
|
catch (err) {
|
|
206
213
|
spinner.fail(color_1.colors.redBright('Copying of assets failed.'));
|
|
207
214
|
(0, error_1.assertIsError)(err);
|
|
208
|
-
return {
|
|
215
|
+
return {
|
|
216
|
+
output: {
|
|
217
|
+
success: false,
|
|
218
|
+
error: 'Unable to copy assets: ' + err.message,
|
|
219
|
+
},
|
|
220
|
+
webpackStats: webpackRawStats,
|
|
221
|
+
};
|
|
209
222
|
}
|
|
210
223
|
}
|
|
211
224
|
if (options.index) {
|
|
@@ -249,12 +262,19 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
249
262
|
}
|
|
250
263
|
catch (error) {
|
|
251
264
|
spinner.fail('Index html generation failed.');
|
|
252
|
-
|
|
265
|
+
(0, error_1.assertIsError)(error);
|
|
266
|
+
return {
|
|
267
|
+
webpackStats: webpackRawStats,
|
|
268
|
+
output: { success: false, error: error.message },
|
|
269
|
+
};
|
|
253
270
|
}
|
|
254
271
|
}
|
|
255
272
|
if (hasErrors) {
|
|
256
273
|
spinner.fail('Index html generation failed.');
|
|
257
|
-
return {
|
|
274
|
+
return {
|
|
275
|
+
webpackStats: webpackRawStats,
|
|
276
|
+
output: { success: false },
|
|
277
|
+
};
|
|
258
278
|
}
|
|
259
279
|
else {
|
|
260
280
|
spinner.succeed('Index html generation complete.');
|
|
@@ -268,17 +288,25 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
268
288
|
}
|
|
269
289
|
catch (error) {
|
|
270
290
|
spinner.fail('Service worker generation failed.');
|
|
271
|
-
|
|
291
|
+
(0, error_1.assertIsError)(error);
|
|
292
|
+
return {
|
|
293
|
+
webpackStats: webpackRawStats,
|
|
294
|
+
output: { success: false, error: error.message },
|
|
295
|
+
};
|
|
272
296
|
}
|
|
273
297
|
}
|
|
274
298
|
spinner.succeed('Service worker generation complete.');
|
|
275
299
|
}
|
|
276
300
|
}
|
|
277
301
|
(0, stats_1.webpackStatsLogger)(context.logger, webpackStats, config, budgetFailures);
|
|
278
|
-
return {
|
|
302
|
+
return {
|
|
303
|
+
webpackStats: webpackRawStats,
|
|
304
|
+
output: { success: buildSuccess },
|
|
305
|
+
};
|
|
279
306
|
}
|
|
280
|
-
}), (0, operators_1.map)((event) => ({
|
|
307
|
+
}), (0, operators_1.map)(({ output: event, webpackStats }) => ({
|
|
281
308
|
...event,
|
|
309
|
+
stats: (0, stats_1.generateBuildEventStats)(webpackStats, options),
|
|
282
310
|
baseOutputPath,
|
|
283
311
|
outputPath: baseOutputPath,
|
|
284
312
|
outputPaths: (outputPaths && Array.from(outputPaths.values())) || [baseOutputPath],
|
|
@@ -305,15 +333,6 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
305
333
|
}
|
|
306
334
|
}
|
|
307
335
|
exports.buildWebpackBrowser = buildWebpackBrowser;
|
|
308
|
-
function mapErrorToMessage(error) {
|
|
309
|
-
if (error instanceof Error) {
|
|
310
|
-
return error.message;
|
|
311
|
-
}
|
|
312
|
-
if (typeof error === 'string') {
|
|
313
|
-
return error;
|
|
314
|
-
}
|
|
315
|
-
return undefined;
|
|
316
|
-
}
|
|
317
336
|
function assertNever(input) {
|
|
318
337
|
throw new Error(`Unexpected call to assertNever() with input: ${JSON.stringify(input, null /* replacer */, 4 /* tabSize */)}`);
|
|
319
338
|
}
|
|
@@ -133,8 +133,8 @@
|
|
|
133
133
|
},
|
|
134
134
|
"optimization": {
|
|
135
135
|
"description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-configuration.",
|
|
136
|
-
"x-user-analytics": 16,
|
|
137
136
|
"default": true,
|
|
137
|
+
"x-user-analytics": "ep.ng_optimization",
|
|
138
138
|
"oneOf": [
|
|
139
139
|
{
|
|
140
140
|
"type": "object",
|
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
"aot": {
|
|
217
217
|
"type": "boolean",
|
|
218
218
|
"description": "Build using Ahead of Time compilation.",
|
|
219
|
-
"x-user-analytics":
|
|
219
|
+
"x-user-analytics": "ep.ng_aot",
|
|
220
220
|
"default": true
|
|
221
221
|
},
|
|
222
222
|
"sourceMap": {
|
|
@@ -6,11 +6,19 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import type { Plugin } from 'esbuild';
|
|
9
|
+
import ts from 'typescript';
|
|
9
10
|
import { BundleStylesheetOptions } from './stylesheets';
|
|
10
|
-
export declare
|
|
11
|
+
export declare class SourceFileCache extends Map<string, ts.SourceFile> {
|
|
12
|
+
readonly modifiedFiles: Set<string>;
|
|
13
|
+
readonly babelFileCache: Map<string, string>;
|
|
14
|
+
invalidate(files: Iterable<string>): void;
|
|
15
|
+
}
|
|
16
|
+
export interface CompilerPluginOptions {
|
|
11
17
|
sourcemap: boolean;
|
|
12
18
|
tsconfig: string;
|
|
13
19
|
advancedOptimizations?: boolean;
|
|
14
20
|
thirdPartySourcemaps?: boolean;
|
|
15
21
|
fileReplacements?: Record<string, string>;
|
|
16
|
-
|
|
22
|
+
sourceFileCache?: SourceFileCache;
|
|
23
|
+
}
|
|
24
|
+
export declare function createCompilerPlugin(pluginOptions: CompilerPluginOptions, styleOptions: BundleStylesheetOptions): Plugin;
|