@angular/build 18.0.1 → 18.0.3
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 +2 -2
- package/src/builders/application/schema.d.ts +4 -4
- package/src/builders/application/schema.json +2 -2
- package/src/builders/dev-server/schema.d.ts +1 -1
- package/src/builders/dev-server/schema.json +1 -1
- package/src/tools/esbuild/angular/compiler-plugin.js +4 -3
- package/src/tools/esbuild/stylesheets/sass-language.js +36 -3
- package/src/tools/sass/lexer.js +12 -1
- package/src/tools/sass/rebasing-importer.js +3 -22
- package/src/tools/sass/sass-service.js +3 -0
- package/src/utils/i18n-options.js +1 -1
- package/src/utils/index-file/augment-index-html.js +2 -18
- package/src/utils/index-file/valid-self-closing-tags.d.ts +9 -0
- package/src/utils/index-file/valid-self-closing-tags.js +61 -0
- package/src/utils/normalize-cache.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/build",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.0.3",
|
|
4
4
|
"description": "Official build system for Angular",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Angular CLI",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"builders": "builders.json",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@ampproject/remapping": "2.3.0",
|
|
26
|
-
"@angular-devkit/architect": "0.1800.
|
|
26
|
+
"@angular-devkit/architect": "0.1800.3",
|
|
27
27
|
"@babel/core": "7.24.5",
|
|
28
28
|
"@babel/helper-annotate-as-pure": "7.22.5",
|
|
29
29
|
"@babel/helper-split-export-declaration": "7.24.5",
|
|
@@ -110,7 +110,7 @@ export interface Schema {
|
|
|
110
110
|
* Enables optimization of the build output. Including minification of scripts and styles,
|
|
111
111
|
* tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For
|
|
112
112
|
* more information, see
|
|
113
|
-
* https://angular.
|
|
113
|
+
* https://angular.dev/reference/configs/workspace-config#optimization-configuration.
|
|
114
114
|
*/
|
|
115
115
|
optimization?: OptimizationUnion;
|
|
116
116
|
/**
|
|
@@ -158,7 +158,7 @@ export interface Schema {
|
|
|
158
158
|
serviceWorker?: ServiceWorker;
|
|
159
159
|
/**
|
|
160
160
|
* Output source maps for scripts and styles. For more information, see
|
|
161
|
-
* https://angular.
|
|
161
|
+
* https://angular.dev/reference/configs/workspace-config#source-map-configuration.
|
|
162
162
|
*/
|
|
163
163
|
sourceMap?: SourceMapUnion;
|
|
164
164
|
/**
|
|
@@ -333,7 +333,7 @@ export type Localize = string[] | boolean;
|
|
|
333
333
|
* Enables optimization of the build output. Including minification of scripts and styles,
|
|
334
334
|
* tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For
|
|
335
335
|
* more information, see
|
|
336
|
-
* https://angular.
|
|
336
|
+
* https://angular.dev/reference/configs/workspace-config#optimization-configuration.
|
|
337
337
|
*/
|
|
338
338
|
export type OptimizationUnion = boolean | OptimizationClass;
|
|
339
339
|
export interface OptimizationClass {
|
|
@@ -455,7 +455,7 @@ export interface ScriptClass {
|
|
|
455
455
|
export type ServiceWorker = boolean | string;
|
|
456
456
|
/**
|
|
457
457
|
* Output source maps for scripts and styles. For more information, see
|
|
458
|
-
* https://angular.
|
|
458
|
+
* https://angular.dev/reference/configs/workspace-config#source-map-configuration.
|
|
459
459
|
*/
|
|
460
460
|
export type SourceMapUnion = boolean | SourceMapClass;
|
|
461
461
|
export interface SourceMapClass {
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
"description": "Automatically clear the terminal screen during rebuilds."
|
|
144
144
|
},
|
|
145
145
|
"optimization": {
|
|
146
|
-
"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.
|
|
146
|
+
"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.dev/reference/configs/workspace-config#optimization-configuration.",
|
|
147
147
|
"default": true,
|
|
148
148
|
"x-user-analytics": "ep.ng_optimization",
|
|
149
149
|
"oneOf": [
|
|
@@ -279,7 +279,7 @@
|
|
|
279
279
|
"default": true
|
|
280
280
|
},
|
|
281
281
|
"sourceMap": {
|
|
282
|
-
"description": "Output source maps for scripts and styles. For more information, see https://angular.
|
|
282
|
+
"description": "Output source maps for scripts and styles. For more information, see https://angular.dev/reference/configs/workspace-config#source-map-configuration.",
|
|
283
283
|
"default": false,
|
|
284
284
|
"oneOf": [
|
|
285
285
|
{
|
|
@@ -45,7 +45,7 @@ export interface Schema {
|
|
|
45
45
|
prebundle?: PrebundleUnion;
|
|
46
46
|
/**
|
|
47
47
|
* Proxy configuration file. For more information, see
|
|
48
|
-
* https://angular.
|
|
48
|
+
* https://angular.dev/tools/cli/serve#proxying-to-a-backend-server.
|
|
49
49
|
*/
|
|
50
50
|
proxyConfig?: string;
|
|
51
51
|
/**
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"proxyConfig": {
|
|
23
23
|
"type": "string",
|
|
24
|
-
"description": "Proxy configuration file. For more information, see https://angular.
|
|
24
|
+
"description": "Proxy configuration file. For more information, see https://angular.dev/tools/cli/serve#proxying-to-a-backend-server."
|
|
25
25
|
},
|
|
26
26
|
"ssl": {
|
|
27
27
|
"type": "boolean",
|
|
@@ -53,9 +53,10 @@ function createCompilerPlugin(pluginOptions, styleOptions) {
|
|
|
53
53
|
async setup(build) {
|
|
54
54
|
let setupWarnings = [];
|
|
55
55
|
const preserveSymlinks = build.initialOptions.preserveSymlinks;
|
|
56
|
-
// Initialize a worker pool for JavaScript transformations
|
|
56
|
+
// Initialize a worker pool for JavaScript transformations.
|
|
57
|
+
// Webcontainers currently do not support this persistent cache store.
|
|
57
58
|
let cacheStore;
|
|
58
|
-
if (pluginOptions.sourceFileCache?.persistentCachePath) {
|
|
59
|
+
if (pluginOptions.sourceFileCache?.persistentCachePath && !process.versions.webcontainer) {
|
|
59
60
|
const { LmbdCacheStore } = await Promise.resolve().then(() => __importStar(require('../lmdb-cache-store')));
|
|
60
61
|
cacheStore = new LmbdCacheStore(path.join(pluginOptions.sourceFileCache.persistentCachePath, 'angular-compiler.db'));
|
|
61
62
|
}
|
|
@@ -361,7 +362,7 @@ function createCompilerOptionsTransformer(setupWarnings, pluginOptions, preserve
|
|
|
361
362
|
notes: [
|
|
362
363
|
{
|
|
363
364
|
text: 'To control ECMA version and features use the Browserslist configuration. ' +
|
|
364
|
-
'For more information, see https://angular.
|
|
365
|
+
'For more information, see https://angular.dev/tools/cli/build#configuring-browser-compatibility',
|
|
365
366
|
},
|
|
366
367
|
],
|
|
367
368
|
});
|
|
@@ -137,7 +137,14 @@ async function compileString(data, filePath, syntax, options, resolveUrl) {
|
|
|
137
137
|
},
|
|
138
138
|
],
|
|
139
139
|
logger: {
|
|
140
|
-
warn: (text, { deprecation, span }) => {
|
|
140
|
+
warn: (text, { deprecation, stack, span }) => {
|
|
141
|
+
const notes = [];
|
|
142
|
+
if (deprecation) {
|
|
143
|
+
notes.push({ text });
|
|
144
|
+
}
|
|
145
|
+
if (stack && !span) {
|
|
146
|
+
notes.push({ text: stack });
|
|
147
|
+
}
|
|
141
148
|
warnings.push({
|
|
142
149
|
text: deprecation ? 'Deprecation' : text,
|
|
143
150
|
location: span && {
|
|
@@ -147,7 +154,7 @@ async function compileString(data, filePath, syntax, options, resolveUrl) {
|
|
|
147
154
|
line: span.start.line + 1,
|
|
148
155
|
column: span.start.column,
|
|
149
156
|
},
|
|
150
|
-
notes
|
|
157
|
+
notes,
|
|
151
158
|
});
|
|
152
159
|
},
|
|
153
160
|
},
|
|
@@ -162,6 +169,10 @@ async function compileString(data, filePath, syntax, options, resolveUrl) {
|
|
|
162
169
|
catch (error) {
|
|
163
170
|
if (isSassException(error)) {
|
|
164
171
|
const fileWithError = error.span.url ? (0, node_url_1.fileURLToPath)(error.span.url) : undefined;
|
|
172
|
+
const watchFiles = [filePath, ...extractFilesFromStack(error.sassStack)];
|
|
173
|
+
if (fileWithError) {
|
|
174
|
+
watchFiles.push(fileWithError);
|
|
175
|
+
}
|
|
165
176
|
return {
|
|
166
177
|
loader: 'css',
|
|
167
178
|
errors: [
|
|
@@ -170,7 +181,7 @@ async function compileString(data, filePath, syntax, options, resolveUrl) {
|
|
|
170
181
|
},
|
|
171
182
|
],
|
|
172
183
|
warnings,
|
|
173
|
-
watchFiles
|
|
184
|
+
watchFiles,
|
|
174
185
|
};
|
|
175
186
|
}
|
|
176
187
|
throw error;
|
|
@@ -183,3 +194,25 @@ function sourceMapToUrlComment(sourceMap, root) {
|
|
|
183
194
|
const urlSourceMap = Buffer.from(JSON.stringify(sourceMap), 'utf-8').toString('base64');
|
|
184
195
|
return `/*# sourceMappingURL=data:application/json;charset=utf-8;base64,${urlSourceMap} */`;
|
|
185
196
|
}
|
|
197
|
+
function* extractFilesFromStack(stack) {
|
|
198
|
+
const lines = stack.split('\n');
|
|
199
|
+
const cwd = process.cwd();
|
|
200
|
+
// Stack line has format of "<file> <location> <identifier>"
|
|
201
|
+
for (const line of lines) {
|
|
202
|
+
const segments = line.split(' ');
|
|
203
|
+
if (segments.length < 3) {
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
// Extract path from stack line.
|
|
207
|
+
// Paths may contain spaces. All segments before location are part of the file path.
|
|
208
|
+
let path = '';
|
|
209
|
+
let index = 0;
|
|
210
|
+
while (!segments[index].match(/\d+:\d+/)) {
|
|
211
|
+
path += segments[index++];
|
|
212
|
+
}
|
|
213
|
+
if (path) {
|
|
214
|
+
// Stack paths from dart-sass are relative to the current working directory (not input file or workspace root)
|
|
215
|
+
yield (0, node_path_1.join)(cwd, path);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
package/src/tools/sass/lexer.js
CHANGED
|
@@ -45,9 +45,20 @@ function* findUrls(contents) {
|
|
|
45
45
|
};
|
|
46
46
|
// Based on https://www.w3.org/TR/css-syntax-3/#consume-ident-like-token
|
|
47
47
|
while ((pos = contents.indexOf('url(', pos)) !== -1) {
|
|
48
|
+
width = 1;
|
|
49
|
+
// Ensure whitespace, comma, or colon before `url(`
|
|
50
|
+
if (pos > 0) {
|
|
51
|
+
pos -= 2;
|
|
52
|
+
next();
|
|
53
|
+
if (!isWhitespace(current) && current !== 0x0027 && current !== 0x003a) {
|
|
54
|
+
// Skip - not a url token
|
|
55
|
+
pos += 3;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
pos += 1;
|
|
59
|
+
}
|
|
48
60
|
// Set to position of the (
|
|
49
61
|
pos += 3;
|
|
50
|
-
width = 1;
|
|
51
62
|
// Consume all leading whitespace
|
|
52
63
|
while (isWhitespace(next())) {
|
|
53
64
|
/* empty */
|
|
@@ -17,25 +17,6 @@ const node_path_1 = require("node:path");
|
|
|
17
17
|
const node_url_1 = require("node:url");
|
|
18
18
|
const error_1 = require("../../utils/error");
|
|
19
19
|
const lexer_1 = require("./lexer");
|
|
20
|
-
/**
|
|
21
|
-
* Ensures that a bare specifier URL path that is intended to be treated as
|
|
22
|
-
* a relative path has a leading `./` or `../` prefix.
|
|
23
|
-
*
|
|
24
|
-
* @param url A bare specifier URL path that should be considered relative.
|
|
25
|
-
* @returns
|
|
26
|
-
*/
|
|
27
|
-
function ensureRelative(url) {
|
|
28
|
-
// Empty
|
|
29
|
-
if (!url) {
|
|
30
|
-
return url;
|
|
31
|
-
}
|
|
32
|
-
// Already relative
|
|
33
|
-
if (url[0] === '.' && (url[1] === '/' || (url[1] === '.' && url[2] === '/'))) {
|
|
34
|
-
return url;
|
|
35
|
-
}
|
|
36
|
-
// Needs prefix
|
|
37
|
-
return './' + url;
|
|
38
|
-
}
|
|
39
20
|
/**
|
|
40
21
|
* A Sass Importer base class that provides the load logic to rebase all `url()` functions
|
|
41
22
|
* within a stylesheet. The rebasing will ensure that the URLs in the output of the Sass compiler
|
|
@@ -84,13 +65,13 @@ class UrlRebasingImporter {
|
|
|
84
65
|
}
|
|
85
66
|
// Sass variable usage either starts with a `$` or contains a namespace and a `.$`
|
|
86
67
|
const valueNormalized = value[0] === '$' || /^\w+\.\$/.test(value) ? `#{${value}}` : value;
|
|
87
|
-
const rebasedPath = (0, node_path_1.relative)(this.entryDirectory, stylesheetDirectory)
|
|
68
|
+
const rebasedPath = (0, node_path_1.relative)(this.entryDirectory, stylesheetDirectory);
|
|
88
69
|
// Normalize path separators and escape characters
|
|
89
70
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/url#syntax
|
|
90
|
-
const rebasedUrl =
|
|
71
|
+
const rebasedUrl = rebasedPath.replace(/\\/g, '/').replace(/[()\s'"]/g, '\\$&');
|
|
91
72
|
updatedContents ??= new magic_string_1.default(contents);
|
|
92
73
|
// Always quote the URL to avoid potential downstream parsing problems
|
|
93
|
-
updatedContents.update(start, end, `"${rebasedUrl}"`);
|
|
74
|
+
updatedContents.update(start, end, `"${rebasedUrl}||file:${valueNormalized}"`);
|
|
94
75
|
}
|
|
95
76
|
if (updatedContents) {
|
|
96
77
|
contents = updatedContents.toString();
|
|
@@ -87,6 +87,9 @@ class SassWorkerImplementation {
|
|
|
87
87
|
filename: require.resolve('./worker'),
|
|
88
88
|
minThreads: 1,
|
|
89
89
|
maxThreads: this.maxThreads,
|
|
90
|
+
// Web containers do not support transferable objects with receiveOnMessagePort which
|
|
91
|
+
// is used when the Atomics based wait loop is enable.
|
|
92
|
+
useAtomics: !process.versions.webcontainer,
|
|
90
93
|
// Shutdown idle threads after 1 second of inactivity
|
|
91
94
|
idleTimeout: 1000,
|
|
92
95
|
recordTiming: false,
|
|
@@ -43,7 +43,7 @@ function createI18nOptions(projectMetadata, inline) {
|
|
|
43
43
|
ensureObject(metadata, 'i18n');
|
|
44
44
|
const i18n = {
|
|
45
45
|
inlineLocales: new Set(),
|
|
46
|
-
// en-US is the default locale added to Angular applications (https://angular.
|
|
46
|
+
// en-US is the default locale added to Angular applications (https://angular.dev/guide/i18n/format-data-locale)
|
|
47
47
|
sourceLocale: 'en-US',
|
|
48
48
|
locales: {},
|
|
49
49
|
get shouldInline() {
|
|
@@ -12,23 +12,7 @@ const node_crypto_1 = require("node:crypto");
|
|
|
12
12
|
const node_path_1 = require("node:path");
|
|
13
13
|
const load_esm_1 = require("../load-esm");
|
|
14
14
|
const html_rewriting_stream_1 = require("./html-rewriting-stream");
|
|
15
|
-
|
|
16
|
-
const VALID_SELF_CLOSING_TAGS = new Set([
|
|
17
|
-
'area',
|
|
18
|
-
'base',
|
|
19
|
-
'br',
|
|
20
|
-
'col',
|
|
21
|
-
'embed',
|
|
22
|
-
'hr',
|
|
23
|
-
'img',
|
|
24
|
-
'input',
|
|
25
|
-
'link',
|
|
26
|
-
'meta',
|
|
27
|
-
'param',
|
|
28
|
-
'source',
|
|
29
|
-
'track',
|
|
30
|
-
'wbr',
|
|
31
|
-
]);
|
|
15
|
+
const valid_self_closing_tags_1 = require("./valid-self-closing-tags");
|
|
32
16
|
/*
|
|
33
17
|
* Helper function used by the IndexHtmlWebpackPlugin.
|
|
34
18
|
* Can also be directly used by builder, e. g. in order to generate an index.html
|
|
@@ -171,7 +155,7 @@ async function augmentIndexHtml(params) {
|
|
|
171
155
|
}
|
|
172
156
|
break;
|
|
173
157
|
default:
|
|
174
|
-
if (tag.selfClosing && !VALID_SELF_CLOSING_TAGS.has(tag.tagName)) {
|
|
158
|
+
if (tag.selfClosing && !valid_self_closing_tags_1.VALID_SELF_CLOSING_TAGS.has(tag.tagName)) {
|
|
175
159
|
errors.push(`Invalid self-closing element in index HTML file: '${rawTagHtml}'.`);
|
|
176
160
|
return;
|
|
177
161
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
/** A list of valid self closing HTML elements */
|
|
9
|
+
export declare const VALID_SELF_CLOSING_TAGS: Set<string>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.VALID_SELF_CLOSING_TAGS = void 0;
|
|
11
|
+
/** A list of valid self closing HTML elements */
|
|
12
|
+
exports.VALID_SELF_CLOSING_TAGS = new Set([
|
|
13
|
+
'area',
|
|
14
|
+
'base',
|
|
15
|
+
'br',
|
|
16
|
+
'col',
|
|
17
|
+
'embed',
|
|
18
|
+
'hr',
|
|
19
|
+
'img',
|
|
20
|
+
'input',
|
|
21
|
+
'link',
|
|
22
|
+
'meta',
|
|
23
|
+
'param',
|
|
24
|
+
'source',
|
|
25
|
+
'track',
|
|
26
|
+
'wbr',
|
|
27
|
+
/** SVG tags */
|
|
28
|
+
'circle',
|
|
29
|
+
'ellipse',
|
|
30
|
+
'line',
|
|
31
|
+
'path',
|
|
32
|
+
'polygon',
|
|
33
|
+
'polyline',
|
|
34
|
+
'rect',
|
|
35
|
+
'text',
|
|
36
|
+
'tspan',
|
|
37
|
+
'linearGradient',
|
|
38
|
+
'radialGradient',
|
|
39
|
+
'stop',
|
|
40
|
+
'image',
|
|
41
|
+
'pattern',
|
|
42
|
+
'defs',
|
|
43
|
+
'g',
|
|
44
|
+
'marker',
|
|
45
|
+
'mask',
|
|
46
|
+
'style',
|
|
47
|
+
'symbol',
|
|
48
|
+
'use',
|
|
49
|
+
'view',
|
|
50
|
+
/** MathML tags */
|
|
51
|
+
'mspace',
|
|
52
|
+
'mphantom',
|
|
53
|
+
'mrow',
|
|
54
|
+
'mfrac',
|
|
55
|
+
'msqrt',
|
|
56
|
+
'mroot',
|
|
57
|
+
'mstyle',
|
|
58
|
+
'merror',
|
|
59
|
+
'mpadded',
|
|
60
|
+
'mtable',
|
|
61
|
+
]);
|
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.normalizeCacheOptions = void 0;
|
|
11
11
|
const node_path_1 = require("node:path");
|
|
12
12
|
/** Version placeholder is replaced during the build process with actual package version */
|
|
13
|
-
const VERSION = '18.0.
|
|
13
|
+
const VERSION = '18.0.3';
|
|
14
14
|
function hasCacheMetadata(value) {
|
|
15
15
|
return (!!value &&
|
|
16
16
|
typeof value === 'object' &&
|