@angular-devkit/build-angular 14.1.0-next.1 → 14.1.0-next.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/builders.json +1 -1
- package/package.json +23 -23
- package/src/babel/webpack-loader.js +3 -3
- package/src/builders/app-shell/index.js +2 -2
- package/src/builders/browser/index.d.ts +9 -1
- package/src/builders/browser/index.js +15 -3
- package/src/builders/browser-esbuild/index.d.ts +2 -2
- package/src/builders/browser-esbuild/index.js +10 -5
- package/src/builders/browser-esbuild/schema.d.ts +428 -0
- package/src/builders/browser-esbuild/schema.js +58 -0
- package/src/builders/browser-esbuild/schema.json +542 -0
- package/src/builders/browser-esbuild/stylesheets.d.ts +1 -1
- package/src/builders/extract-i18n/index.js +3 -1
- package/src/builders/karma/find-tests.js +2 -0
- package/src/builders/karma/index.js +2 -2
- package/src/builders/server/index.d.ts +8 -1
- package/src/builders/server/index.js +7 -0
- package/src/utils/color.js +0 -1
- package/src/utils/copy-assets.js +5 -4
- package/src/utils/i18n-options.js +7 -12
- package/src/webpack/configs/dev-server.js +4 -0
- package/src/webpack/plugins/common-js-usage-warn-plugin.js +6 -1
- package/src/webpack/plugins/typescript.js +1 -5
- package/src/webpack/utils/helpers.d.ts +2 -3
- package/src/webpack/utils/helpers.js +4 -3
- package/src/webpack/utils/stats.d.ts +3 -2
- package/src/webpack/utils/stats.js +22 -5
package/builders.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"browser-esbuild": {
|
|
15
15
|
"implementation": "./src/builders/browser-esbuild",
|
|
16
|
-
"schema": "./src/builders/browser/schema.json",
|
|
16
|
+
"schema": "./src/builders/browser-esbuild/schema.json",
|
|
17
17
|
"description": "Build a browser application."
|
|
18
18
|
},
|
|
19
19
|
"dev-server": {
|
package/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-angular",
|
|
3
|
-
"version": "14.1.0-next.
|
|
3
|
+
"version": "14.1.0-next.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
9
|
"@ampproject/remapping": "2.2.0",
|
|
10
|
-
"@angular-devkit/architect": "0.1401.0-next.
|
|
11
|
-
"@angular-devkit/build-webpack": "0.1401.0-next.
|
|
12
|
-
"@angular-devkit/core": "14.1.0-next.
|
|
13
|
-
"@babel/core": "7.18.
|
|
14
|
-
"@babel/generator": "7.18.
|
|
15
|
-
"@babel/helper-annotate-as-pure": "7.
|
|
16
|
-
"@babel/plugin-proposal-async-generator-functions": "7.
|
|
17
|
-
"@babel/plugin-transform-async-to-generator": "7.
|
|
18
|
-
"@babel/plugin-transform-runtime": "7.18.
|
|
19
|
-
"@babel/preset-env": "7.18.
|
|
20
|
-
"@babel/runtime": "7.18.
|
|
21
|
-
"@babel/template": "7.
|
|
10
|
+
"@angular-devkit/architect": "0.1401.0-next.4",
|
|
11
|
+
"@angular-devkit/build-webpack": "0.1401.0-next.4",
|
|
12
|
+
"@angular-devkit/core": "14.1.0-next.4",
|
|
13
|
+
"@babel/core": "7.18.6",
|
|
14
|
+
"@babel/generator": "7.18.7",
|
|
15
|
+
"@babel/helper-annotate-as-pure": "7.18.6",
|
|
16
|
+
"@babel/plugin-proposal-async-generator-functions": "7.18.6",
|
|
17
|
+
"@babel/plugin-transform-async-to-generator": "7.18.6",
|
|
18
|
+
"@babel/plugin-transform-runtime": "7.18.6",
|
|
19
|
+
"@babel/preset-env": "7.18.6",
|
|
20
|
+
"@babel/runtime": "7.18.6",
|
|
21
|
+
"@babel/template": "7.18.6",
|
|
22
22
|
"@discoveryjs/json-ext": "0.5.7",
|
|
23
|
-
"@ngtools/webpack": "14.1.0-next.
|
|
23
|
+
"@ngtools/webpack": "14.1.0-next.4",
|
|
24
24
|
"ansi-colors": "4.1.3",
|
|
25
25
|
"babel-loader": "8.2.5",
|
|
26
26
|
"babel-plugin-istanbul": "6.1.1",
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
"copy-webpack-plugin": "11.0.0",
|
|
30
30
|
"critters": "0.0.16",
|
|
31
31
|
"css-loader": "6.7.1",
|
|
32
|
-
"esbuild-wasm": "0.14.
|
|
32
|
+
"esbuild-wasm": "0.14.48",
|
|
33
33
|
"glob": "8.0.3",
|
|
34
34
|
"https-proxy-agent": "5.0.1",
|
|
35
35
|
"inquirer": "8.2.4",
|
|
36
36
|
"jsonc-parser": "3.0.0",
|
|
37
37
|
"karma-source-map-support": "1.4.0",
|
|
38
|
-
"less": "4.1.
|
|
38
|
+
"less": "4.1.3",
|
|
39
39
|
"less-loader": "11.0.0",
|
|
40
40
|
"license-webpack-plugin": "4.0.2",
|
|
41
41
|
"loader-utils": "3.2.0",
|
|
42
|
-
"mini-css-extract-plugin": "2.6.
|
|
42
|
+
"mini-css-extract-plugin": "2.6.1",
|
|
43
43
|
"minimatch": "5.1.0",
|
|
44
44
|
"open": "8.4.0",
|
|
45
45
|
"ora": "5.4.1",
|
|
@@ -48,29 +48,29 @@
|
|
|
48
48
|
"postcss": "8.4.14",
|
|
49
49
|
"postcss-import": "14.1.0",
|
|
50
50
|
"postcss-loader": "7.0.0",
|
|
51
|
-
"postcss-preset-env": "7.7.
|
|
51
|
+
"postcss-preset-env": "7.7.2",
|
|
52
52
|
"regenerator-runtime": "0.13.9",
|
|
53
53
|
"resolve-url-loader": "5.0.0",
|
|
54
54
|
"rxjs": "6.6.7",
|
|
55
|
-
"sass": "1.
|
|
56
|
-
"sass-loader": "13.0.
|
|
55
|
+
"sass": "1.53.0",
|
|
56
|
+
"sass-loader": "13.0.2",
|
|
57
57
|
"semver": "7.3.7",
|
|
58
58
|
"source-map-loader": "4.0.0",
|
|
59
59
|
"source-map-support": "0.5.21",
|
|
60
60
|
"stylus": "0.58.1",
|
|
61
61
|
"stylus-loader": "7.0.0",
|
|
62
|
-
"terser": "5.14.
|
|
62
|
+
"terser": "5.14.1",
|
|
63
63
|
"text-table": "0.2.0",
|
|
64
64
|
"tree-kill": "1.2.2",
|
|
65
65
|
"tslib": "2.4.0",
|
|
66
66
|
"webpack": "5.73.0",
|
|
67
67
|
"webpack-dev-middleware": "5.3.3",
|
|
68
|
-
"webpack-dev-server": "4.9.
|
|
68
|
+
"webpack-dev-server": "4.9.3",
|
|
69
69
|
"webpack-merge": "5.8.0",
|
|
70
70
|
"webpack-subresource-integrity": "5.1.0"
|
|
71
71
|
},
|
|
72
72
|
"optionalDependencies": {
|
|
73
|
-
"esbuild": "0.14.
|
|
73
|
+
"esbuild": "0.14.48"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"@angular/compiler-cli": "^14.0.0 || ^14.0.0-next || ^14.1.0-next",
|
|
@@ -52,7 +52,7 @@ exports.default = (0, babel_loader_1.custom)(() => {
|
|
|
52
52
|
});
|
|
53
53
|
return {
|
|
54
54
|
async customOptions(options, { source, map }) {
|
|
55
|
-
var _a, _b;
|
|
55
|
+
var _a, _b, _c;
|
|
56
56
|
const { i18n, scriptTarget, aot, optimize, instrumentCode, supportedBrowsers, ...rawOptions } = options;
|
|
57
57
|
// Must process file if plugins are added
|
|
58
58
|
let shouldProcess = Array.isArray(rawOptions.plugins) && rawOptions.plugins.length > 0;
|
|
@@ -89,7 +89,7 @@ exports.default = (0, babel_loader_1.custom)(() => {
|
|
|
89
89
|
// Comparable behavior to tsconfig target of ES5
|
|
90
90
|
customOptions.supportedBrowsers = ['IE 9'];
|
|
91
91
|
}
|
|
92
|
-
else if (isJsFile) {
|
|
92
|
+
else if (isJsFile && ((_a = customOptions.supportedBrowsers) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
93
93
|
// Applications code ES version can be controlled using TypeScript's `target` option.
|
|
94
94
|
// However, this doesn't effect libraries and hence we use preset-env to downlevel ES fetaures
|
|
95
95
|
// based on the supported browsers in browserlist.
|
|
@@ -142,7 +142,7 @@ exports.default = (0, babel_loader_1.custom)(() => {
|
|
|
142
142
|
pureTopLevel: angularPackage,
|
|
143
143
|
// JavaScript modules that are marked as side effect free are considered to have
|
|
144
144
|
// no decorators that contain non-local effects.
|
|
145
|
-
wrapDecorators: !!((
|
|
145
|
+
wrapDecorators: !!((_c = (_b = this._module) === null || _b === void 0 ? void 0 : _b.factoryMeta) === null || _c === void 0 ? void 0 : _c.sideEffectFree),
|
|
146
146
|
};
|
|
147
147
|
shouldProcess = true;
|
|
148
148
|
}
|
|
@@ -62,7 +62,7 @@ async function _renderUniversal(options, context, browserResult, serverResult, s
|
|
|
62
62
|
deployUrl: browserOptions.deployUrl,
|
|
63
63
|
})
|
|
64
64
|
: undefined;
|
|
65
|
-
for (const outputPath of browserResult.
|
|
65
|
+
for (const { path: outputPath, baseHref } of browserResult.outputs) {
|
|
66
66
|
const localeDirectory = path.relative(browserResult.baseOutputPath, outputPath);
|
|
67
67
|
const browserIndexOutputPath = path.join(outputPath, 'index.html');
|
|
68
68
|
const indexHtml = await fs.promises.readFile(browserIndexOutputPath, 'utf8');
|
|
@@ -96,7 +96,7 @@ async function _renderUniversal(options, context, browserResult, serverResult, s
|
|
|
96
96
|
}
|
|
97
97
|
await fs.promises.writeFile(outputIndexPath, html);
|
|
98
98
|
if (browserOptions.serviceWorker) {
|
|
99
|
-
await (0, service_worker_1.augmentAppWithServiceWorker)(projectRoot, root, outputPath,
|
|
99
|
+
await (0, service_worker_1.augmentAppWithServiceWorker)(projectRoot, root, outputPath, baseHref !== null && baseHref !== void 0 ? baseHref : '/', browserOptions.ngswConfigPath);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
return browserResult;
|
|
@@ -17,11 +17,19 @@ import { Schema as BrowserBuilderSchema } from './schema';
|
|
|
17
17
|
*/
|
|
18
18
|
export declare type BrowserBuilderOutput = BuilderOutput & {
|
|
19
19
|
baseOutputPath: string;
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated in version 14. Use 'outputs' instead.
|
|
22
|
+
*/
|
|
20
23
|
outputPaths: string[];
|
|
21
24
|
/**
|
|
22
|
-
* @deprecated in version 9. Use '
|
|
25
|
+
* @deprecated in version 9. Use 'outputs' instead.
|
|
23
26
|
*/
|
|
24
27
|
outputPath: string;
|
|
28
|
+
outputs: {
|
|
29
|
+
locale?: string;
|
|
30
|
+
path: string;
|
|
31
|
+
baseHref?: string;
|
|
32
|
+
}[];
|
|
25
33
|
};
|
|
26
34
|
/**
|
|
27
35
|
* Maximum time in milliseconds for single build/rebuild
|
|
@@ -128,7 +128,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
128
128
|
}
|
|
129
129
|
}),
|
|
130
130
|
}).pipe((0, operators_1.concatMap)(async (buildEvent) => {
|
|
131
|
-
var _a, _b, _c, _d, _e;
|
|
131
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
132
132
|
const spinner = new spinner_1.Spinner();
|
|
133
133
|
spinner.enabled = options.progress !== false;
|
|
134
134
|
const { success, emittedFiles = [], outputPath: webpackOutputPath } = buildEvent;
|
|
@@ -218,7 +218,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
218
218
|
for (const [locale, outputPath] of outputPaths.entries()) {
|
|
219
219
|
try {
|
|
220
220
|
const { content, warnings, errors } = await indexHtmlGenerator.process({
|
|
221
|
-
baseHref: getLocaleBaseHref(i18n, locale)
|
|
221
|
+
baseHref: (_f = getLocaleBaseHref(i18n, locale)) !== null && _f !== void 0 ? _f : options.baseHref,
|
|
222
222
|
// i18nLocale is used when Ivy is disabled
|
|
223
223
|
lang: locale || undefined,
|
|
224
224
|
outputPath,
|
|
@@ -254,7 +254,7 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
254
254
|
spinner.start('Generating service worker...');
|
|
255
255
|
for (const [locale, outputPath] of outputPaths.entries()) {
|
|
256
256
|
try {
|
|
257
|
-
await (0, service_worker_1.augmentAppWithServiceWorker)(projectRoot, context.workspaceRoot, outputPath, getLocaleBaseHref(i18n, locale)
|
|
257
|
+
await (0, service_worker_1.augmentAppWithServiceWorker)(projectRoot, context.workspaceRoot, outputPath, (_h = (_g = getLocaleBaseHref(i18n, locale)) !== null && _g !== void 0 ? _g : options.baseHref) !== null && _h !== void 0 ? _h : '/', options.ngswConfigPath);
|
|
258
258
|
}
|
|
259
259
|
catch (error) {
|
|
260
260
|
spinner.fail('Service worker generation failed.');
|
|
@@ -272,6 +272,18 @@ function buildWebpackBrowser(options, context, transforms = {}) {
|
|
|
272
272
|
baseOutputPath,
|
|
273
273
|
outputPath: baseOutputPath,
|
|
274
274
|
outputPaths: (outputPaths && Array.from(outputPaths.values())) || [baseOutputPath],
|
|
275
|
+
outputs: (outputPaths &&
|
|
276
|
+
[...outputPaths.entries()].map(([locale, path]) => {
|
|
277
|
+
var _a;
|
|
278
|
+
return ({
|
|
279
|
+
locale,
|
|
280
|
+
path,
|
|
281
|
+
baseHref: (_a = getLocaleBaseHref(i18n, locale)) !== null && _a !== void 0 ? _a : options.baseHref,
|
|
282
|
+
});
|
|
283
|
+
})) || {
|
|
284
|
+
path: baseOutputPath,
|
|
285
|
+
baseHref: options.baseHref,
|
|
286
|
+
},
|
|
275
287
|
})));
|
|
276
288
|
}));
|
|
277
289
|
function getLocaleBaseHref(i18n, locale) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { BuilderContext, BuilderOutput } from '@angular-devkit/architect';
|
|
9
|
-
import { Schema as BrowserBuilderOptions } from '
|
|
9
|
+
import { Schema as BrowserBuilderOptions } from './schema';
|
|
10
10
|
/**
|
|
11
11
|
* Main execution function for the esbuild-based application builder.
|
|
12
12
|
* The options are compatible with the Webpack-based builder.
|
|
@@ -14,6 +14,6 @@ import { Schema as BrowserBuilderOptions } from '../browser/schema';
|
|
|
14
14
|
* @param context The Architect builder context object
|
|
15
15
|
* @returns A promise with the builder result output
|
|
16
16
|
*/
|
|
17
|
-
export declare function
|
|
17
|
+
export declare function buildEsbuildBrowser(options: BrowserBuilderOptions, context: BuilderContext): Promise<BuilderOutput>;
|
|
18
18
|
declare const _default: import("@angular-devkit/architect/src/internal").Builder<BrowserBuilderOptions & import("../../../../core/src").JsonObject>;
|
|
19
19
|
export default _default;
|
|
@@ -30,7 +30,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
30
30
|
return result;
|
|
31
31
|
};
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.
|
|
33
|
+
exports.buildEsbuildBrowser = void 0;
|
|
34
34
|
const architect_1 = require("@angular-devkit/architect");
|
|
35
35
|
const assert = __importStar(require("assert"));
|
|
36
36
|
const fs_1 = require("fs");
|
|
@@ -56,7 +56,7 @@ const stylesheets_1 = require("./stylesheets");
|
|
|
56
56
|
* @returns A promise with the builder result output
|
|
57
57
|
*/
|
|
58
58
|
// eslint-disable-next-line max-lines-per-function
|
|
59
|
-
async function
|
|
59
|
+
async function buildEsbuildBrowser(options, context) {
|
|
60
60
|
var _a, _b, _c, _d, _e, _f;
|
|
61
61
|
const startTime = Date.now();
|
|
62
62
|
// Only AOT is currently supported
|
|
@@ -217,7 +217,7 @@ async function execute(options, context) {
|
|
|
217
217
|
context.logger.info(`Complete. [${(Date.now() - startTime) / 1000} seconds]`);
|
|
218
218
|
return { success: true };
|
|
219
219
|
}
|
|
220
|
-
exports.
|
|
220
|
+
exports.buildEsbuildBrowser = buildEsbuildBrowser;
|
|
221
221
|
function createOutputFileFromText(path, text) {
|
|
222
222
|
return {
|
|
223
223
|
path,
|
|
@@ -247,6 +247,7 @@ async function bundleCode(workspaceRoot, entryPoints, outputNames, options, opti
|
|
|
247
247
|
sourcemap: sourcemapOptions.scripts && (sourcemapOptions.hidden ? 'external' : true),
|
|
248
248
|
splitting: true,
|
|
249
249
|
tsconfig,
|
|
250
|
+
external: options.externalDependencies,
|
|
250
251
|
write: false,
|
|
251
252
|
platform: 'browser',
|
|
252
253
|
preserveSymlinks: options.preserveSymlinks,
|
|
@@ -262,7 +263,11 @@ async function bundleCode(workspaceRoot, entryPoints, outputNames, options, opti
|
|
|
262
263
|
{
|
|
263
264
|
workspaceRoot,
|
|
264
265
|
optimization: !!optimizationOptions.styles.minify,
|
|
265
|
-
sourcemap:
|
|
266
|
+
sourcemap:
|
|
267
|
+
// Hidden component stylesheet sourcemaps are inaccessible which is effectively
|
|
268
|
+
// the same as being disabled. Disabling has the advantage of avoiding the overhead
|
|
269
|
+
// of sourcemap processing.
|
|
270
|
+
!!sourcemapOptions.styles && (sourcemapOptions.hidden ? false : 'inline'),
|
|
266
271
|
outputNames,
|
|
267
272
|
}),
|
|
268
273
|
],
|
|
@@ -272,4 +277,4 @@ async function bundleCode(workspaceRoot, entryPoints, outputNames, options, opti
|
|
|
272
277
|
},
|
|
273
278
|
});
|
|
274
279
|
}
|
|
275
|
-
exports.default = (0, architect_1.createBuilder)(
|
|
280
|
+
exports.default = (0, architect_1.createBuilder)(buildEsbuildBrowser);
|