@angular-devkit/build-angular 17.3.1 → 18.0.0-next.0
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 +31 -31
- package/src/builders/app-shell/index.js +1 -1
- package/src/builders/application/build-action.d.ts +2 -3
- package/src/builders/dev-server/builder.d.ts +0 -2
- package/src/builders/dev-server/vite-server.js +14 -7
- package/src/builders/dev-server/webpack-server.js +1 -1
- package/src/builders/prerender/index.d.ts +2 -3
- package/src/builders/ssr-dev-server/utils.d.ts +1 -2
- package/src/tools/babel/plugins/adjust-static-class-members.js +3 -6
- package/src/tools/esbuild/angular/compilation/parallel-worker.d.ts +0 -2
- package/src/tools/esbuild/utils.d.ts +2 -2
- package/src/tools/esbuild/utils.js +1 -1
- package/src/tools/vite/angular-memory-plugin.js +8 -8
- package/src/tools/webpack/configs/dev-server.js +20 -11
- package/src/tools/webpack/configs/styles.js +22 -53
- package/src/tools/webpack/plugins/builder-watch-plugin.js +2 -2
- package/src/tools/webpack/plugins/styles-webpack-plugin.js +1 -1
- package/src/utils/environment-options.d.ts +0 -1
- package/src/utils/environment-options.js +1 -11
- package/src/utils/i18n-options.d.ts +3 -2
- package/src/utils/i18n-options.js +39 -33
- package/src/utils/index-file/inline-fonts.d.ts +0 -2
- package/src/utils/normalize-asset-patterns.d.ts +1 -2
- package/src/utils/normalize-asset-patterns.js +1 -2
- package/src/utils/normalize-cache.d.ts +1 -2
- package/src/utils/normalize-cache.js +10 -5
- package/src/utils/normalize-file-replacements.d.ts +1 -2
- package/src/utils/normalize-file-replacements.js +1 -2
- package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.js +0 -2
- package/src/utils/server-rendering/prerender.js +11 -3
- package/src/utils/service-worker.d.ts +2 -2
- package/src/utils/supported-browsers.d.ts +3 -2
- package/src/utils/webpack-browser-config.d.ts +1 -2
- package/src/tools/sass/sass-service-legacy.d.ts +0 -51
- package/src/tools/sass/sass-service-legacy.js +0 -173
- package/src/tools/sass/worker-legacy.d.ts +0 -8
- package/src/tools/sass/worker-legacy.js +0 -43
- package/src/utils/server-rendering/esm-in-memory-loader/node-18-utils.d.ts +0 -10
- package/src/utils/server-rendering/esm-in-memory-loader/node-18-utils.js +0 -39
package/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-devkit/build-angular",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.0.0-next.0",
|
|
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.3.0",
|
|
10
|
-
"@angular-devkit/architect": "0.
|
|
11
|
-
"@angular-devkit/build-webpack": "0.
|
|
12
|
-
"@angular-devkit/core": "
|
|
13
|
-
"@babel/core": "7.24.
|
|
14
|
-
"@babel/generator": "7.
|
|
10
|
+
"@angular-devkit/architect": "0.1800.0-next.0",
|
|
11
|
+
"@angular-devkit/build-webpack": "0.1800.0-next.0",
|
|
12
|
+
"@angular-devkit/core": "18.0.0-next.0",
|
|
13
|
+
"@babel/core": "7.24.3",
|
|
14
|
+
"@babel/generator": "7.24.1",
|
|
15
15
|
"@babel/helper-annotate-as-pure": "7.22.5",
|
|
16
16
|
"@babel/helper-split-export-declaration": "7.22.6",
|
|
17
|
-
"@babel/plugin-transform-async-generator-functions": "7.
|
|
18
|
-
"@babel/plugin-transform-async-to-generator": "7.
|
|
19
|
-
"@babel/plugin-transform-runtime": "7.24.
|
|
20
|
-
"@babel/preset-env": "7.24.
|
|
21
|
-
"@babel/runtime": "7.24.
|
|
17
|
+
"@babel/plugin-transform-async-generator-functions": "7.24.3",
|
|
18
|
+
"@babel/plugin-transform-async-to-generator": "7.24.1",
|
|
19
|
+
"@babel/plugin-transform-runtime": "7.24.3",
|
|
20
|
+
"@babel/preset-env": "7.24.3",
|
|
21
|
+
"@babel/runtime": "7.24.1",
|
|
22
22
|
"@discoveryjs/json-ext": "0.5.7",
|
|
23
|
-
"@ngtools/webpack": "
|
|
23
|
+
"@ngtools/webpack": "18.0.0-next.0",
|
|
24
24
|
"@vitejs/plugin-basic-ssl": "1.1.0",
|
|
25
25
|
"ansi-colors": "4.1.3",
|
|
26
26
|
"autoprefixer": "10.4.18",
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
"copy-webpack-plugin": "11.0.0",
|
|
31
31
|
"critters": "0.0.22",
|
|
32
32
|
"css-loader": "6.10.0",
|
|
33
|
-
"esbuild-wasm": "0.20.
|
|
33
|
+
"esbuild-wasm": "0.20.2",
|
|
34
34
|
"fast-glob": "3.3.2",
|
|
35
35
|
"https-proxy-agent": "7.0.4",
|
|
36
36
|
"http-proxy-middleware": "2.0.6",
|
|
37
|
-
"inquirer": "9.2.
|
|
37
|
+
"inquirer": "9.2.16",
|
|
38
38
|
"jsonc-parser": "3.2.1",
|
|
39
39
|
"karma-source-map-support": "1.4.0",
|
|
40
40
|
"less": "4.2.0",
|
|
41
|
-
"less-loader": "
|
|
41
|
+
"less-loader": "12.2.0",
|
|
42
42
|
"license-webpack-plugin": "4.0.2",
|
|
43
43
|
"loader-utils": "3.2.1",
|
|
44
44
|
"magic-string": "0.30.8",
|
|
@@ -49,41 +49,41 @@
|
|
|
49
49
|
"parse5-html-rewriting-stream": "7.0.0",
|
|
50
50
|
"picomatch": "4.0.1",
|
|
51
51
|
"piscina": "4.4.0",
|
|
52
|
-
"postcss": "8.4.
|
|
52
|
+
"postcss": "8.4.37",
|
|
53
53
|
"postcss-loader": "8.1.1",
|
|
54
54
|
"resolve-url-loader": "5.0.0",
|
|
55
55
|
"rxjs": "7.8.1",
|
|
56
|
-
"sass": "1.
|
|
56
|
+
"sass": "1.72.0",
|
|
57
57
|
"sass-loader": "14.1.1",
|
|
58
58
|
"semver": "7.6.0",
|
|
59
59
|
"source-map-loader": "5.0.0",
|
|
60
60
|
"source-map-support": "0.5.21",
|
|
61
|
-
"terser": "5.29.
|
|
61
|
+
"terser": "5.29.2",
|
|
62
62
|
"tree-kill": "1.2.2",
|
|
63
63
|
"tslib": "2.6.2",
|
|
64
|
-
"undici": "6.
|
|
65
|
-
"vite": "5.
|
|
66
|
-
"watchpack": "2.4.
|
|
67
|
-
"webpack": "5.
|
|
68
|
-
"webpack-dev-middleware": "
|
|
69
|
-
"webpack-dev-server": "
|
|
64
|
+
"undici": "6.9.0",
|
|
65
|
+
"vite": "5.2.2",
|
|
66
|
+
"watchpack": "2.4.1",
|
|
67
|
+
"webpack": "5.91.0",
|
|
68
|
+
"webpack-dev-middleware": "7.1.1",
|
|
69
|
+
"webpack-dev-server": "5.0.4",
|
|
70
70
|
"webpack-merge": "5.10.0",
|
|
71
71
|
"webpack-subresource-integrity": "5.1.0"
|
|
72
72
|
},
|
|
73
73
|
"optionalDependencies": {
|
|
74
|
-
"esbuild": "0.20.
|
|
74
|
+
"esbuild": "0.20.2"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@angular/compiler-cli": "^
|
|
78
|
-
"@angular/localize": "^
|
|
79
|
-
"@angular/platform-server": "^
|
|
80
|
-
"@angular/service-worker": "^
|
|
77
|
+
"@angular/compiler-cli": "^18.0.0-next.0",
|
|
78
|
+
"@angular/localize": "^18.0.0-next.0",
|
|
79
|
+
"@angular/platform-server": "^18.0.0-next.0",
|
|
80
|
+
"@angular/service-worker": "^18.0.0-next.0",
|
|
81
81
|
"@web/test-runner": "^0.18.0",
|
|
82
82
|
"browser-sync": "^3.0.2",
|
|
83
83
|
"jest": "^29.5.0",
|
|
84
84
|
"jest-environment-jsdom": "^29.5.0",
|
|
85
85
|
"karma": "^6.3.0",
|
|
86
|
-
"ng-packagr": "^
|
|
86
|
+
"ng-packagr": "^18.0.0-next.0",
|
|
87
87
|
"protractor": "^7.0.0",
|
|
88
88
|
"tailwindcss": "^2.0.0 || ^3.0.0",
|
|
89
89
|
"typescript": ">=5.2 <5.5"
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"url": "https://github.com/angular/angular-cli.git"
|
|
136
136
|
},
|
|
137
137
|
"engines": {
|
|
138
|
-
"node": "^18.
|
|
138
|
+
"node": "^18.19.1 || >=20.11.1",
|
|
139
139
|
"npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
|
|
140
140
|
"yarn": ">= 1.13.0"
|
|
141
141
|
},
|
|
@@ -44,7 +44,7 @@ const spinner_1 = require("../../utils/spinner");
|
|
|
44
44
|
async function _renderUniversal(options, context, browserResult, serverResult, spinner) {
|
|
45
45
|
// Get browser target options.
|
|
46
46
|
const browserTarget = (0, architect_1.targetFromTargetString)(options.browserTarget);
|
|
47
|
-
const rawBrowserOptions =
|
|
47
|
+
const rawBrowserOptions = await context.getTargetOptions(browserTarget);
|
|
48
48
|
const browserBuilderName = await context.getBuilderNameForTarget(browserTarget);
|
|
49
49
|
const browserOptions = await context.validateOptions(rawBrowserOptions, browserBuilderName);
|
|
50
50
|
// Locate zone.js to load in the render worker
|
|
@@ -5,8 +5,7 @@
|
|
|
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
|
-
import { BuilderOutput } from '@angular-devkit/architect';
|
|
9
|
-
import type { logging } from '@angular-devkit/core';
|
|
8
|
+
import { BuilderContext, BuilderOutput } from '@angular-devkit/architect';
|
|
10
9
|
import { BuildOutputFile } from '../../tools/esbuild/bundler-context';
|
|
11
10
|
import { ExecutionResult, RebuildState } from '../../tools/esbuild/bundler-execution-result';
|
|
12
11
|
import { NormalizedCachedOptions } from '../../utils/normalize-cache';
|
|
@@ -16,7 +15,7 @@ export declare function runEsBuildBuildAction(action: (rebuildState?: RebuildSta
|
|
|
16
15
|
workspaceRoot: string;
|
|
17
16
|
projectRoot: string;
|
|
18
17
|
outputOptions: NormalizedOutputOptions;
|
|
19
|
-
logger:
|
|
18
|
+
logger: BuilderContext['logger'];
|
|
20
19
|
cacheOptions: NormalizedCachedOptions;
|
|
21
20
|
writeToFileSystem: boolean;
|
|
22
21
|
writeToFileSystemFilter: ((file: BuildOutputFile) => boolean) | undefined;
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
/// <reference types="node" />
|
|
9
|
-
/// <reference types="@types/node/http" />
|
|
10
|
-
/// <reference types="@types/node/ts4.8/http" />
|
|
11
9
|
import type { BuilderContext } from '@angular-devkit/architect';
|
|
12
10
|
import type { Plugin } from 'esbuild';
|
|
13
11
|
import type http from 'node:http';
|
|
@@ -49,18 +49,25 @@ const supported_browsers_1 = require("../../utils/supported-browsers");
|
|
|
49
49
|
const webpack_browser_config_1 = require("../../utils/webpack-browser-config");
|
|
50
50
|
const application_1 = require("../application");
|
|
51
51
|
const browser_esbuild_1 = require("../browser-esbuild");
|
|
52
|
+
/**
|
|
53
|
+
* Build options that are also present on the dev server but are only passed
|
|
54
|
+
* to the build.
|
|
55
|
+
*/
|
|
56
|
+
const CONVENIENCE_BUILD_OPTIONS = ['watch', 'poll', 'verbose'];
|
|
52
57
|
// eslint-disable-next-line max-lines-per-function
|
|
53
58
|
async function* serveWithVite(serverOptions, builderName, context, transformers, extensions) {
|
|
54
59
|
// Get the browser configuration from the target name.
|
|
55
|
-
const rawBrowserOptions =
|
|
60
|
+
const rawBrowserOptions = await context.getTargetOptions(serverOptions.buildTarget);
|
|
56
61
|
// Deploy url is not used in the dev-server.
|
|
57
62
|
delete rawBrowserOptions.deployUrl;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
// Copy convenience options to build
|
|
64
|
+
for (const optionName of CONVENIENCE_BUILD_OPTIONS) {
|
|
65
|
+
const optionValue = serverOptions[optionName];
|
|
66
|
+
if (optionValue !== undefined) {
|
|
67
|
+
rawBrowserOptions[optionName] = optionValue;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const browserOptions = await context.validateOptions(rawBrowserOptions, builderName);
|
|
64
71
|
if (browserOptions.prerender || browserOptions.ssr) {
|
|
65
72
|
// Disable prerendering if enabled and force SSR.
|
|
66
73
|
// This is so instead of prerendering all the routes for every change, the page is "prerendered" when it is requested.
|
|
@@ -68,7 +68,7 @@ function serveWebpackBrowser(options, builderName, context, transforms = {}) {
|
|
|
68
68
|
See https://webpack.js.org/guides/hot-module-replacement for information on working with HMR for Webpack.`);
|
|
69
69
|
}
|
|
70
70
|
// Get the browser configuration from the target name.
|
|
71
|
-
const rawBrowserOptions =
|
|
71
|
+
const rawBrowserOptions = await context.getTargetOptions(options.buildTarget);
|
|
72
72
|
if (rawBrowserOptions.outputHashing && rawBrowserOptions.outputHashing !== schema_1.OutputHashing.None) {
|
|
73
73
|
// Disable output hashing for dev build as this can cause memory leaks
|
|
74
74
|
// See: https://github.com/webpack/webpack-dev-server/issues/377#issuecomment-241258405
|
|
@@ -6,9 +6,8 @@
|
|
|
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 { json } from '@angular-devkit/core';
|
|
10
9
|
import { Schema } from './schema';
|
|
11
|
-
type PrerenderBuilderOptions = Schema
|
|
10
|
+
type PrerenderBuilderOptions = Schema;
|
|
12
11
|
type PrerenderBuilderOutput = BuilderOutput;
|
|
13
12
|
/**
|
|
14
13
|
* Builds the browser and server, then renders each route in options.routes
|
|
@@ -16,5 +15,5 @@ type PrerenderBuilderOutput = BuilderOutput;
|
|
|
16
15
|
* the browser result.
|
|
17
16
|
*/
|
|
18
17
|
export declare function execute(options: PrerenderBuilderOptions, context: BuilderContext): Promise<PrerenderBuilderOutput>;
|
|
19
|
-
declare const _default: import("../../../../architect/src/internal").Builder<Schema &
|
|
18
|
+
declare const _default: import("../../../../architect/src/internal").Builder<Schema & import("../../../../core/src").JsonObject>;
|
|
20
19
|
export default _default;
|
|
@@ -5,8 +5,7 @@
|
|
|
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
|
-
/// <reference types="
|
|
9
|
-
/// <reference types="@types/node/ts4.8/child_process" />
|
|
8
|
+
/// <reference types="node" />
|
|
10
9
|
import { SpawnOptions } from 'child_process';
|
|
11
10
|
import { Observable } from 'rxjs';
|
|
12
11
|
export declare function getAvailablePort(): Promise<number>;
|
|
@@ -315,10 +315,7 @@ function default_1() {
|
|
|
315
315
|
if (!wrapDecorators || visitedClasses.has(classNode)) {
|
|
316
316
|
return;
|
|
317
317
|
}
|
|
318
|
-
if (!
|
|
319
|
-
!parentPath.isVariableDeclarator() ||
|
|
320
|
-
!core_1.types.isIdentifier(parentPath.node.id) ||
|
|
321
|
-
parentPath.node.id.name !== classNode.id.name) {
|
|
318
|
+
if (!parentPath.isVariableDeclarator() || !core_1.types.isIdentifier(parentPath.node.id)) {
|
|
322
319
|
return;
|
|
323
320
|
}
|
|
324
321
|
const origin = parentPath.parentPath;
|
|
@@ -338,10 +335,10 @@ function default_1() {
|
|
|
338
335
|
// Wrap class and safe static assignments in a pure annotated IIFE
|
|
339
336
|
const container = core_1.types.arrowFunctionExpression([], core_1.types.blockStatement([
|
|
340
337
|
core_1.types.variableDeclaration('let', [
|
|
341
|
-
core_1.types.variableDeclarator(core_1.types.cloneNode(
|
|
338
|
+
core_1.types.variableDeclarator(core_1.types.cloneNode(parentPath.node.id), classNode),
|
|
342
339
|
]),
|
|
343
340
|
...wrapStatementNodes,
|
|
344
|
-
core_1.types.returnStatement(core_1.types.cloneNode(
|
|
341
|
+
core_1.types.returnStatement(core_1.types.cloneNode(parentPath.node.id)),
|
|
345
342
|
]));
|
|
346
343
|
const replacementInitializer = core_1.types.callExpression(core_1.types.parenthesizedExpression(container), []);
|
|
347
344
|
(0, helper_annotate_as_pure_1.default)(replacementInitializer);
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
/// <reference types="node" />
|
|
9
|
-
/// <reference types="@types/node/worker_threads" />
|
|
10
|
-
/// <reference types="@types/node/ts4.8/worker_threads" />
|
|
11
9
|
import type { PartialMessage } from 'esbuild';
|
|
12
10
|
import { type MessagePort } from 'node:worker_threads';
|
|
13
11
|
import type { DiagnosticModes } from './angular-compilation';
|
|
@@ -5,7 +5,7 @@
|
|
|
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
|
-
import {
|
|
8
|
+
import { BuilderContext } from '@angular-devkit/architect';
|
|
9
9
|
import { BuildOptions, Metafile, OutputFile } from 'esbuild';
|
|
10
10
|
import { NormalizedApplicationBuildOptions, NormalizedOutputOptions } from '../../builders/application/options';
|
|
11
11
|
import { BudgetCalculatorResult } from '../../utils/bundle-calculator';
|
|
@@ -38,4 +38,4 @@ export declare function transformSupportedBrowsersToTargets(supportedBrowsers: s
|
|
|
38
38
|
*/
|
|
39
39
|
export declare function getSupportedNodeTargets(): string[];
|
|
40
40
|
export declare function createJsonBuildManifest(result: ExecutionResult, normalizedOptions: NormalizedApplicationBuildOptions): Promise<string>;
|
|
41
|
-
export declare function logMessages(logger:
|
|
41
|
+
export declare function logMessages(logger: BuilderContext['logger'], executionResult: ExecutionResult, color?: boolean, jsonLogs?: boolean): Promise<void>;
|
|
@@ -331,7 +331,7 @@ function transformSupportedBrowsersToTargets(supportedBrowsers) {
|
|
|
331
331
|
return transformed;
|
|
332
332
|
}
|
|
333
333
|
exports.transformSupportedBrowsersToTargets = transformSupportedBrowsersToTargets;
|
|
334
|
-
const SUPPORTED_NODE_VERSIONS = '^18.
|
|
334
|
+
const SUPPORTED_NODE_VERSIONS = '^18.19.1 || >=20.11.1';
|
|
335
335
|
/**
|
|
336
336
|
* Transform supported Node.js versions to esbuild target.
|
|
337
337
|
* @see https://esbuild.github.io/api/#target
|
|
@@ -159,9 +159,11 @@ function createAngularMemoryPlugin(options) {
|
|
|
159
159
|
return;
|
|
160
160
|
}
|
|
161
161
|
transformIndexHtmlAndAddHeaders(req.url, rawHtml, res, next, async (html) => {
|
|
162
|
+
const resolvedUrls = server.resolvedUrls;
|
|
163
|
+
const baseUrl = resolvedUrls?.local[0] ?? resolvedUrls?.network[0];
|
|
162
164
|
const { content } = await (0, render_page_1.renderPage)({
|
|
163
165
|
document: html,
|
|
164
|
-
route: new URL(req.originalUrl ?? '/',
|
|
166
|
+
route: new URL(req.originalUrl ?? '/', baseUrl).toString(),
|
|
165
167
|
serverContext: 'ssr',
|
|
166
168
|
loadBundle: (uri) =>
|
|
167
169
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -230,13 +232,11 @@ exports.createAngularMemoryPlugin = createAngularMemoryPlugin;
|
|
|
230
232
|
*/
|
|
231
233
|
async function loadViteClientCode(file) {
|
|
232
234
|
const originalContents = await (0, promises_1.readFile)(file, 'utf-8');
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
(0, node_assert_1.default)(firstUpdate !== secondUpdate, 'Failed to update Vite client error overlay text. (2)');
|
|
239
|
-
return secondUpdate;
|
|
235
|
+
const updatedContents = originalContents.replace(`h('br'), 'You can also disable this overlay by setting ', ` +
|
|
236
|
+
`h('code', { part: 'config-option-name' }, 'server.hmr.overlay'), '` +
|
|
237
|
+
` to ', h('code', { part: 'config-option-value' }, 'false'), ' in ', h('code', { part: 'config-file-name' }, hmrConfigName), '.'`, '');
|
|
238
|
+
(0, node_assert_1.default)(originalContents !== updatedContents, 'Failed to update Vite client error overlay text.');
|
|
239
|
+
return updatedContents;
|
|
240
240
|
}
|
|
241
241
|
function pathnameWithoutBasePath(url, basePath) {
|
|
242
242
|
const parsedUrl = new URL(url, 'http://localhost');
|
|
@@ -162,12 +162,13 @@ async function addProxyConfig(root, proxyConfig) {
|
|
|
162
162
|
if (!(0, fs_1.existsSync)(proxyPath)) {
|
|
163
163
|
throw new Error(`Proxy configuration file ${proxyPath} does not exist.`);
|
|
164
164
|
}
|
|
165
|
+
let proxyConfiguration;
|
|
165
166
|
switch ((0, path_1.extname)(proxyPath)) {
|
|
166
167
|
case '.json': {
|
|
167
168
|
const content = await fs_1.promises.readFile(proxyPath, 'utf-8');
|
|
168
169
|
const { parse, printParseErrorCode } = await Promise.resolve().then(() => __importStar(require('jsonc-parser')));
|
|
169
170
|
const parseErrors = [];
|
|
170
|
-
|
|
171
|
+
proxyConfiguration = parse(content, parseErrors, { allowTrailingComma: true });
|
|
171
172
|
if (parseErrors.length > 0) {
|
|
172
173
|
let errorMessage = `Proxy configuration file ${proxyPath} contains parse errors:`;
|
|
173
174
|
for (const parseError of parseErrors) {
|
|
@@ -176,32 +177,35 @@ async function addProxyConfig(root, proxyConfig) {
|
|
|
176
177
|
}
|
|
177
178
|
throw new Error(errorMessage);
|
|
178
179
|
}
|
|
179
|
-
|
|
180
|
+
break;
|
|
180
181
|
}
|
|
181
182
|
case '.mjs':
|
|
182
183
|
// Load the ESM configuration file using the TypeScript dynamic import workaround.
|
|
183
184
|
// Once TypeScript provides support for keeping the dynamic import this workaround can be
|
|
184
185
|
// changed to a direct dynamic import.
|
|
185
|
-
|
|
186
|
+
proxyConfiguration = (await (0, load_esm_1.loadEsmModule)((0, url_1.pathToFileURL)(proxyPath))).default;
|
|
187
|
+
break;
|
|
186
188
|
case '.cjs':
|
|
187
|
-
|
|
189
|
+
proxyConfiguration = require(proxyPath);
|
|
190
|
+
break;
|
|
188
191
|
default:
|
|
189
192
|
// The file could be either CommonJS or ESM.
|
|
190
193
|
// CommonJS is tried first then ESM if loading fails.
|
|
191
194
|
try {
|
|
192
|
-
|
|
195
|
+
proxyConfiguration = require(proxyPath);
|
|
193
196
|
}
|
|
194
197
|
catch (e) {
|
|
195
198
|
(0, error_1.assertIsError)(e);
|
|
196
|
-
if (e.code
|
|
197
|
-
|
|
198
|
-
// Once TypeScript provides support for keeping the dynamic import this workaround can be
|
|
199
|
-
// changed to a direct dynamic import.
|
|
200
|
-
return (await (0, load_esm_1.loadEsmModule)((0, url_1.pathToFileURL)(proxyPath))).default;
|
|
199
|
+
if (e.code !== 'ERR_REQUIRE_ESM') {
|
|
200
|
+
throw e;
|
|
201
201
|
}
|
|
202
|
-
|
|
202
|
+
// Load the ESM configuration file using the TypeScript dynamic import workaround.
|
|
203
|
+
// Once TypeScript provides support for keeping the dynamic import this workaround can be
|
|
204
|
+
// changed to a direct dynamic import.
|
|
205
|
+
proxyConfiguration = (await (0, load_esm_1.loadEsmModule)((0, url_1.pathToFileURL)(proxyPath))).default;
|
|
203
206
|
}
|
|
204
207
|
}
|
|
208
|
+
return normalizeProxyConfiguration(proxyConfiguration);
|
|
205
209
|
}
|
|
206
210
|
/**
|
|
207
211
|
* Calculates the line and column for an error offset in the content of a JSON file.
|
|
@@ -301,3 +305,8 @@ function getPublicHostOptions(options, webSocketPath) {
|
|
|
301
305
|
}
|
|
302
306
|
return `auto://${publicHost || '0.0.0.0:0'}${webSocketPath}`;
|
|
303
307
|
}
|
|
308
|
+
function normalizeProxyConfiguration(proxy) {
|
|
309
|
+
return Array.isArray(proxy)
|
|
310
|
+
? proxy
|
|
311
|
+
: Object.entries(proxy).map(([context, value]) => ({ context: [context], ...value }));
|
|
312
|
+
}
|
|
@@ -37,10 +37,8 @@ exports.getStylesConfig = void 0;
|
|
|
37
37
|
const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
|
|
38
38
|
const path = __importStar(require("node:path"));
|
|
39
39
|
const node_url_1 = require("node:url");
|
|
40
|
-
const environment_options_1 = require("../../../utils/environment-options");
|
|
41
40
|
const tailwind_1 = require("../../../utils/tailwind");
|
|
42
41
|
const sass_service_1 = require("../../sass/sass-service");
|
|
43
|
-
const sass_service_legacy_1 = require("../../sass/sass-service-legacy");
|
|
44
42
|
const plugins_1 = require("../plugins");
|
|
45
43
|
const css_optimizer_plugin_1 = require("../plugins/css-optimizer-plugin");
|
|
46
44
|
const styles_webpack_plugin_1 = require("../plugins/styles-webpack-plugin");
|
|
@@ -68,9 +66,7 @@ async function getStylesConfig(wco) {
|
|
|
68
66
|
extraPlugins.push(new plugins_1.RemoveHashPlugin({ chunkNames: noInjectNames, hashFormat }));
|
|
69
67
|
}
|
|
70
68
|
}
|
|
71
|
-
const sassImplementation =
|
|
72
|
-
? new sass_service_legacy_1.SassLegacyWorkerImplementation()
|
|
73
|
-
: new sass_service_1.SassWorkerImplementation();
|
|
69
|
+
const sassImplementation = new sass_service_1.SassWorkerImplementation();
|
|
74
70
|
extraPlugins.push({
|
|
75
71
|
apply(compiler) {
|
|
76
72
|
compiler.hooks.shutdown.tap('sass-worker', () => {
|
|
@@ -284,54 +280,27 @@ async function getStylesConfig(wco) {
|
|
|
284
280
|
}
|
|
285
281
|
exports.getStylesConfig = getStylesConfig;
|
|
286
282
|
function getSassLoaderOptions(root, implementation, includePaths, indentedSyntax, verbose, preserveSymlinks) {
|
|
287
|
-
return
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
}
|
|
309
|
-
: {
|
|
310
|
-
sourceMap: true,
|
|
311
|
-
api: 'legacy',
|
|
312
|
-
implementation,
|
|
313
|
-
sassOptions: {
|
|
314
|
-
importer: (url, from) => {
|
|
315
|
-
if (url.charAt(0) === '~') {
|
|
316
|
-
throw new Error(`'${from}' imports '${url}' with a tilde. Usage of '~' in imports is no longer supported.`);
|
|
317
|
-
}
|
|
318
|
-
return null;
|
|
319
|
-
},
|
|
320
|
-
// Prevent use of `fibers` package as it no longer works in newer Node.js versions
|
|
321
|
-
fiber: false,
|
|
322
|
-
indentedSyntax,
|
|
323
|
-
// bootstrap-sass requires a minimum precision of 8
|
|
324
|
-
precision: 8,
|
|
325
|
-
includePaths,
|
|
326
|
-
// Use expanded as otherwise sass will remove comments that are needed for autoprefixer
|
|
327
|
-
// Ex: /* autoprefixer grid: autoplace */
|
|
328
|
-
// See: https://github.com/webpack-contrib/sass-loader/blob/45ad0be17264ceada5f0b4fb87e9357abe85c4ff/src/getSassOptions.js#L68-L70
|
|
329
|
-
outputStyle: 'expanded',
|
|
330
|
-
// Silences compiler warnings from 3rd party stylesheets
|
|
331
|
-
quietDeps: !verbose,
|
|
332
|
-
verbose,
|
|
333
|
-
},
|
|
334
|
-
};
|
|
283
|
+
return {
|
|
284
|
+
sourceMap: true,
|
|
285
|
+
api: 'modern',
|
|
286
|
+
implementation,
|
|
287
|
+
// Webpack importer is only implemented in the legacy API and we have our own custom Webpack importer.
|
|
288
|
+
// See: https://github.com/webpack-contrib/sass-loader/blob/997f3eb41d86dd00d5fa49c395a1aeb41573108c/src/utils.js#L642-L651
|
|
289
|
+
webpackImporter: false,
|
|
290
|
+
sassOptions: (loaderContext) => ({
|
|
291
|
+
importers: [getSassResolutionImporter(loaderContext, root, preserveSymlinks)],
|
|
292
|
+
loadPaths: includePaths,
|
|
293
|
+
// Use expanded as otherwise sass will remove comments that are needed for autoprefixer
|
|
294
|
+
// Ex: /* autoprefixer grid: autoplace */
|
|
295
|
+
// See: https://github.com/webpack-contrib/sass-loader/blob/45ad0be17264ceada5f0b4fb87e9357abe85c4ff/src/getSassOptions.js#L68-L70
|
|
296
|
+
style: 'expanded',
|
|
297
|
+
// Silences compiler warnings from 3rd party stylesheets
|
|
298
|
+
quietDeps: !verbose,
|
|
299
|
+
verbose,
|
|
300
|
+
syntax: indentedSyntax ? 'indented' : 'scss',
|
|
301
|
+
sourceMapIncludeSources: true,
|
|
302
|
+
}),
|
|
303
|
+
};
|
|
335
304
|
}
|
|
336
305
|
function getSassResolutionImporter(loaderContext, root, preserveSymlinks) {
|
|
337
306
|
const commonResolverOptions = {
|
|
@@ -51,7 +51,7 @@ class BuilderWatchFileSystem {
|
|
|
51
51
|
const directoryChanges = new Set();
|
|
52
52
|
const missingChanges = new Set();
|
|
53
53
|
for (const event of events) {
|
|
54
|
-
this.inputFileSystem
|
|
54
|
+
this.inputFileSystem?.purge?.(event.path);
|
|
55
55
|
if (event.type === 'deleted') {
|
|
56
56
|
timeInfo.delete(event.path);
|
|
57
57
|
removals.add(event.path);
|
|
@@ -70,7 +70,7 @@ class BuilderWatchFileSystem {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
const timeInfoMap = new Map(timeInfo);
|
|
73
|
-
callback(
|
|
73
|
+
callback(null, timeInfoMap, timeInfoMap, new Set([...fileChanges, ...directoryChanges, ...missingChanges]), removals);
|
|
74
74
|
});
|
|
75
75
|
});
|
|
76
76
|
return {
|
|
@@ -34,7 +34,7 @@ class StylesWebpackPlugin {
|
|
|
34
34
|
preferRelative: true,
|
|
35
35
|
useSyncFileSystemCalls: true,
|
|
36
36
|
symlinks: !preserveSymlinks,
|
|
37
|
-
fileSystem: compiler.inputFileSystem,
|
|
37
|
+
fileSystem: compiler.inputFileSystem ?? undefined,
|
|
38
38
|
});
|
|
39
39
|
const webpackOptions = compiler.options;
|
|
40
40
|
compiler.hooks.environment.tap(PLUGIN_NAME, () => {
|
|
@@ -10,7 +10,6 @@ export declare const shouldBeautify: boolean;
|
|
|
10
10
|
export declare const allowMinify: boolean;
|
|
11
11
|
export declare const maxWorkers: number;
|
|
12
12
|
export declare const useParallelTs: boolean;
|
|
13
|
-
export declare const useLegacySass: boolean;
|
|
14
13
|
export declare const debugPerformance: boolean;
|
|
15
14
|
export declare const shouldWatchRoot: boolean;
|
|
16
15
|
export declare const useTypeChecking: boolean;
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.useJSONBuildLogs = exports.useTypeChecking = exports.shouldWatchRoot = exports.debugPerformance = exports.
|
|
11
|
-
const color_1 = require("./color");
|
|
10
|
+
exports.useJSONBuildLogs = exports.useTypeChecking = exports.shouldWatchRoot = exports.debugPerformance = exports.useParallelTs = exports.maxWorkers = exports.allowMinify = exports.shouldBeautify = exports.allowMangle = void 0;
|
|
12
11
|
function isDisabled(variable) {
|
|
13
12
|
return variable === '0' || variable.toLowerCase() === 'false';
|
|
14
13
|
}
|
|
@@ -70,15 +69,6 @@ const maxWorkersVariable = process.env['NG_BUILD_MAX_WORKERS'];
|
|
|
70
69
|
exports.maxWorkers = isPresent(maxWorkersVariable) ? +maxWorkersVariable : 4;
|
|
71
70
|
const parallelTsVariable = process.env['NG_BUILD_PARALLEL_TS'];
|
|
72
71
|
exports.useParallelTs = !isPresent(parallelTsVariable) || !isDisabled(parallelTsVariable);
|
|
73
|
-
const legacySassVariable = process.env['NG_BUILD_LEGACY_SASS'];
|
|
74
|
-
exports.useLegacySass = (() => {
|
|
75
|
-
if (!isPresent(legacySassVariable)) {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
// eslint-disable-next-line no-console
|
|
79
|
-
console.warn(color_1.colors.yellow(`Warning: 'NG_BUILD_LEGACY_SASS' environment variable support will be removed in version 16.`));
|
|
80
|
-
return isEnabled(legacySassVariable);
|
|
81
|
-
})();
|
|
82
72
|
const debugPerfVariable = process.env['NG_BUILD_DEBUG_PERF'];
|
|
83
73
|
exports.debugPerformance = isPresent(debugPerfVariable) && isEnabled(debugPerfVariable);
|
|
84
74
|
const watchRootVariable = process.env['NG_BUILD_WATCH_ROOT'];
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { BuilderContext } from '@angular-devkit/architect';
|
|
9
|
-
import { json } from '@angular-devkit/core';
|
|
10
9
|
import { Schema as BrowserBuilderSchema, I18NTranslation } from '../builders/browser/schema';
|
|
11
10
|
import { Schema as ServerBuilderSchema } from '../builders/server/schema';
|
|
12
11
|
import { TranslationLoader } from './load-translations';
|
|
@@ -28,7 +27,9 @@ export interface I18nOptions {
|
|
|
28
27
|
readonly shouldInline: boolean;
|
|
29
28
|
hasDefinedSourceLocale?: boolean;
|
|
30
29
|
}
|
|
31
|
-
export declare function createI18nOptions(
|
|
30
|
+
export declare function createI18nOptions(projectMetadata: {
|
|
31
|
+
i18n?: unknown;
|
|
32
|
+
}, inline?: boolean | string[]): I18nOptions;
|
|
32
33
|
export declare function configureI18nBuild<T extends BrowserBuilderSchema | ServerBuilderSchema>(context: BuilderContext, options: T): Promise<{
|
|
33
34
|
buildOptions: T;
|
|
34
35
|
i18n: I18nOptions;
|