@angular/build 18.0.0 → 18.0.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/build",
3
- "version": "18.0.0",
3
+ "version": "18.0.2",
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.0",
26
+ "@angular-devkit/architect": "0.1800.2",
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.io/guide/workspace-config#optimization-configuration.
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.io/guide/workspace-config#source-map-configuration.
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.io/guide/workspace-config#optimization-configuration.
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.io/guide/workspace-config#source-map-configuration.
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.io/guide/workspace-config#optimization-configuration.",
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.io/guide/workspace-config#source-map-configuration.",
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.io/guide/build#proxying-to-a-backend-server.
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.io/guide/build#proxying-to-a-backend-server."
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",
@@ -194,8 +194,12 @@ async function* serveWithVite(serverOptions, builderName, builderAction, context
194
194
  const projectRoot = (0, node_path_1.join)(context.workspaceRoot, root);
195
195
  const browsers = (0, internal_1.getSupportedBrowsers)(projectRoot, context.logger);
196
196
  const target = (0, internal_1.transformSupportedBrowsersToTargets)(browsers);
197
+ // Needed for browser-esbuild as polyfills can be a string.
198
+ const polyfills = Array.isArray((browserOptions.polyfills ??= []))
199
+ ? browserOptions.polyfills
200
+ : [browserOptions.polyfills];
197
201
  // Setup server and start listening
198
- const serverConfiguration = await setupServer(serverOptions, generatedFiles, assetFiles, browserOptions.preserveSymlinks, externalMetadata, !!browserOptions.ssr, prebundleTransformer, target, (0, internal_1.isZonelessApp)(browserOptions.polyfills), browserOptions.loader, extensions?.middleware, transformers?.indexHtml, thirdPartySourcemaps);
202
+ const serverConfiguration = await setupServer(serverOptions, generatedFiles, assetFiles, browserOptions.preserveSymlinks, externalMetadata, !!browserOptions.ssr, prebundleTransformer, target, (0, internal_1.isZonelessApp)(polyfills), browserOptions.loader, extensions?.middleware, transformers?.indexHtml, thirdPartySourcemaps);
199
203
  server = await createServer(serverConfiguration);
200
204
  await server.listen();
201
205
  if (serverConfiguration.ssr?.optimizeDeps?.disabled === false) {
@@ -38,7 +38,6 @@ const node_assert_1 = __importDefault(require("node:assert"));
38
38
  const path = __importStar(require("node:path"));
39
39
  const environment_options_1 = require("../../../utils/environment-options");
40
40
  const javascript_transformer_1 = require("../javascript-transformer");
41
- const lmdb_cache_store_1 = require("../lmdb-cache-store");
42
41
  const load_result_cache_1 = require("../load-result-cache");
43
42
  const profiling_1 = require("../profiling");
44
43
  const compilation_1 = require("./compilation");
@@ -57,7 +56,8 @@ function createCompilerPlugin(pluginOptions, styleOptions) {
57
56
  // Initialize a worker pool for JavaScript transformations
58
57
  let cacheStore;
59
58
  if (pluginOptions.sourceFileCache?.persistentCachePath) {
60
- cacheStore = new lmdb_cache_store_1.LmbdCacheStore(path.join(pluginOptions.sourceFileCache.persistentCachePath, 'angular-compiler.db'));
59
+ const { LmbdCacheStore } = await Promise.resolve().then(() => __importStar(require('../lmdb-cache-store')));
60
+ cacheStore = new LmbdCacheStore(path.join(pluginOptions.sourceFileCache.persistentCachePath, 'angular-compiler.db'));
61
61
  }
62
62
  const javascriptTransformer = new javascript_transformer_1.JavaScriptTransformer(pluginOptions, environment_options_1.maxWorkers, cacheStore?.createCache('jstransformer'));
63
63
  // Setup defines based on the values used by the Angular compiler-cli
@@ -361,7 +361,7 @@ function createCompilerOptionsTransformer(setupWarnings, pluginOptions, preserve
361
361
  notes: [
362
362
  {
363
363
  text: 'To control ECMA version and features use the Browserslist configuration. ' +
364
- 'For more information, see https://angular.io/guide/build#configuring-browser-compatibility',
364
+ 'For more information, see https://angular.dev/tools/cli/build#configuring-browser-compatibility',
365
365
  },
366
366
  ],
367
367
  });
@@ -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: deprecation ? [{ text }] : undefined,
157
+ notes,
151
158
  });
152
159
  },
153
160
  },
@@ -78,6 +78,10 @@ class UrlRebasingImporter {
78
78
  if (value[0] === '#' && value[1] !== '{') {
79
79
  continue;
80
80
  }
81
+ // Skip if value is value contains a function call
82
+ if (/#\{.+\(.+\)\}/.test(value)) {
83
+ continue;
84
+ }
81
85
  // Sass variable usage either starts with a `$` or contains a namespace and a `.$`
82
86
  const valueNormalized = value[0] === '$' || /^\w+\.\$/.test(value) ? `#{${value}}` : value;
83
87
  const rebasedPath = (0, node_path_1.relative)(this.entryDirectory, stylesheetDirectory) + '||file:' + valueNormalized;
@@ -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.io/guide/i18n#i18n-pipes)
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
- /** A list of valid self closing HTML elements */
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.0';
13
+ const VERSION = '18.0.2';
14
14
  function hasCacheMetadata(value) {
15
15
  return (!!value &&
16
16
  typeof value === 'object' &&
@@ -21,7 +21,9 @@ function hasCacheMetadata(value) {
21
21
  }
22
22
  function normalizeCacheOptions(projectMetadata, worspaceRoot) {
23
23
  const cacheMetadata = hasCacheMetadata(projectMetadata) ? projectMetadata.cli.cache : {};
24
- const { enabled = true, environment = 'local', path = '.angular/cache' } = cacheMetadata;
24
+ const {
25
+ // Webcontainers do not currently benefit from persistent disk caching and can lead to increased browser memory usage
26
+ enabled = !process.versions.webcontainer, environment = 'local', path = '.angular/cache', } = cacheMetadata;
25
27
  const isCI = process.env['CI'] === '1' || process.env['CI']?.toLowerCase() === 'true';
26
28
  let cacheEnabled = enabled;
27
29
  if (cacheEnabled) {