@angular/build 20.3.6 → 20.3.8

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": "20.3.6",
3
+ "version": "20.3.8",
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.2003.6",
26
+ "@angular-devkit/architect": "0.2003.8",
27
27
  "@babel/core": "7.28.3",
28
28
  "@babel/helper-annotate-as-pure": "7.27.3",
29
29
  "@babel/helper-split-export-declaration": "7.24.7",
@@ -46,7 +46,7 @@
46
46
  "semver": "7.7.2",
47
47
  "source-map-support": "0.5.21",
48
48
  "tinyglobby": "0.2.14",
49
- "vite": "7.1.5",
49
+ "vite": "7.1.11",
50
50
  "watchpack": "2.4.4"
51
51
  },
52
52
  "optionalDependencies": {
@@ -60,7 +60,7 @@
60
60
  "@angular/platform-browser": "^20.0.0",
61
61
  "@angular/platform-server": "^20.0.0",
62
62
  "@angular/service-worker": "^20.0.0",
63
- "@angular/ssr": "^20.3.6",
63
+ "@angular/ssr": "^20.3.8",
64
64
  "karma": "^6.4.0",
65
65
  "less": "^4.2.0",
66
66
  "ng-packagr": "^20.0.0",
@@ -112,7 +112,7 @@
112
112
  "type": "git",
113
113
  "url": "https://github.com/angular/angular-cli.git"
114
114
  },
115
- "packageManager": "pnpm@10.18.3",
115
+ "packageManager": "pnpm@10.19.0",
116
116
  "engines": {
117
117
  "node": "^20.19.0 || ^22.12.0 || >=24.0.0",
118
118
  "npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
@@ -6,6 +6,39 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.dev/license
8
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 () {
26
+ var ownKeys = function(o) {
27
+ ownKeys = Object.getOwnPropertyNames || function (o) {
28
+ var ar = [];
29
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30
+ return ar;
31
+ };
32
+ return ownKeys(o);
33
+ };
34
+ return function (mod) {
35
+ if (mod && mod.__esModule) return mod;
36
+ var result = {};
37
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38
+ __setModuleDefault(result, mod);
39
+ return result;
40
+ };
41
+ })();
9
42
  var __importDefault = (this && this.__importDefault) || function (mod) {
10
43
  return (mod && mod.__esModule) ? mod : { "default": mod };
11
44
  };
@@ -44,6 +77,12 @@ context, extensions) {
44
77
  yield { kind: results_1.ResultKind.Failure, errors: [] };
45
78
  return;
46
79
  }
80
+ if (environment_options_1.bazelEsbuildPluginPath) {
81
+ extensions ??= {};
82
+ extensions.codePlugins ??= [];
83
+ const { default: bazelEsbuildPlugin } = await Promise.resolve(`${environment_options_1.bazelEsbuildPluginPath}`).then(s => __importStar(require(s)));
84
+ extensions.codePlugins.push(bazelEsbuildPlugin);
85
+ }
47
86
  const normalizedOptions = await (0, options_1.normalizeOptions)(context, projectName, options, extensions);
48
87
  if (!normalizedOptions.outputOptions.ignoreServer) {
49
88
  const { browser, server } = normalizedOptions.outputOptions;
@@ -667,7 +667,6 @@ async function setupServer(serverOptions, outputFiles, assets, preserveSymlinks,
667
667
  }),
668
668
  },
669
669
  plugins: [
670
- (0, plugins_1.createAngularLocaleDataPlugin)(),
671
670
  (0, plugins_1.createAngularSetupMiddlewaresPlugin)({
672
671
  outputFiles,
673
672
  assets,
@@ -184,6 +184,8 @@ function injectKarmaReporter(buildOptions, buildIterator, karmaConfig, controlle
184
184
  emitter;
185
185
  latestBuildFiles;
186
186
  static $inject = ['emitter', LATEST_BUILD_FILES_TOKEN];
187
+ // Needed for the karma reporter interface, see https://github.com/angular/angular-cli/issues/31629
188
+ adapters = [];
187
189
  constructor(emitter, latestBuildFiles) {
188
190
  this.emitter = emitter;
189
191
  this.latestBuildFiles = latestBuildFiles;
@@ -487,7 +487,7 @@ function getEsBuildCommonPolyfillsOptions(options, namespace, tryToResolvePolyfi
487
487
  needLocaleDataPlugin = true;
488
488
  }
489
489
  if (needLocaleDataPlugin) {
490
- buildOptions.plugins.push((0, i18n_locale_plugin_1.createAngularLocaleDataPlugin)());
490
+ buildOptions.plugins.unshift((0, i18n_locale_plugin_1.createAngularLocaleDataPlugin)());
491
491
  }
492
492
  if (polyfills.length === 0) {
493
493
  return;
@@ -9,6 +9,7 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.LOCALE_DATA_BASE_MODULE = exports.LOCALE_DATA_NAMESPACE = void 0;
11
11
  exports.createAngularLocaleDataPlugin = createAngularLocaleDataPlugin;
12
+ const node_module_1 = require("node:module");
12
13
  /**
13
14
  * The internal namespace used by generated locale import statements and Angular locale data plugin.
14
15
  */
@@ -26,16 +27,6 @@ function createAngularLocaleDataPlugin() {
26
27
  return {
27
28
  name: 'angular-locale-data',
28
29
  setup(build) {
29
- // If packages are configured to be external then leave the original angular locale import path.
30
- // This happens when using the development server with caching enabled to allow Vite prebundling to work.
31
- // There currently is no option on the esbuild resolve function to resolve while disabling the option. To
32
- // workaround the inability to resolve the full locale location here, the Vite dev server prebundling also
33
- // contains a plugin to allow the locales to be correctly resolved when prebundling.
34
- // NOTE: If esbuild eventually allows controlling the external package options in a build.resolve call, this
35
- // workaround can be removed.
36
- if (build.initialOptions.packages === 'external') {
37
- return;
38
- }
39
30
  build.onResolve({ filter: /^angular:locale\/data:/ }, async ({ path }) => {
40
31
  // Extract the locale from the path
41
32
  const rawLocaleTag = path.split(':', 3)[2];
@@ -57,6 +48,7 @@ function createAngularLocaleDataPlugin() {
57
48
  };
58
49
  }
59
50
  let exact = true;
51
+ let localeRequire;
60
52
  while (partialLocaleTag) {
61
53
  // Angular embeds the `en`/`en-US` locale into the framework and it does not need to be included again here.
62
54
  // The onLoad hook below for the locale data namespace has an `empty` loader that will prevent inclusion.
@@ -69,11 +61,37 @@ function createAngularLocaleDataPlugin() {
69
61
  }
70
62
  // Attempt to resolve the locale tag data within the Angular base module location
71
63
  const potentialPath = `${exports.LOCALE_DATA_BASE_MODULE}/${partialLocaleTag}`;
72
- const result = await build.resolve(potentialPath, {
73
- kind: 'import-statement',
74
- resolveDir: build.initialOptions.absWorkingDir,
75
- });
76
- if (result.path) {
64
+ // If packages are configured to be external then leave the original angular locale import path.
65
+ // This happens when using the development server with caching enabled to allow Vite prebundling to work.
66
+ // There currently is no option on the esbuild resolve function to resolve while disabling the option.
67
+ // NOTE: If esbuild eventually allows controlling the external package options in a build.resolve call, this
68
+ // workaround can be removed.
69
+ let result;
70
+ const { packages, absWorkingDir } = build.initialOptions;
71
+ if (packages === 'external' && absWorkingDir) {
72
+ localeRequire ??= (0, node_module_1.createRequire)(absWorkingDir + '/');
73
+ try {
74
+ localeRequire.resolve(potentialPath);
75
+ result = {
76
+ errors: [],
77
+ warnings: [],
78
+ external: true,
79
+ sideEffects: true,
80
+ namespace: '',
81
+ suffix: '',
82
+ pluginData: undefined,
83
+ path: potentialPath,
84
+ };
85
+ }
86
+ catch { }
87
+ }
88
+ else {
89
+ result = await build.resolve(potentialPath, {
90
+ kind: 'import-statement',
91
+ resolveDir: absWorkingDir,
92
+ });
93
+ }
94
+ if (result?.path) {
77
95
  if (exact) {
78
96
  return result;
79
97
  }
@@ -6,7 +6,6 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  export { createAngularMemoryPlugin } from './angular-memory-plugin';
9
- export { createAngularLocaleDataPlugin } from './i18n-locale-plugin';
10
9
  export { createRemoveIdPrefixPlugin } from './id-prefix-plugin';
11
10
  export { createAngularSetupMiddlewaresPlugin, ServerSsrMode } from './setup-middlewares-plugin';
12
11
  export { createAngularSsrTransformPlugin } from './ssr-transform-plugin';
@@ -7,11 +7,9 @@
7
7
  * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.createAngularSsrTransformPlugin = exports.ServerSsrMode = exports.createAngularSetupMiddlewaresPlugin = exports.createRemoveIdPrefixPlugin = exports.createAngularLocaleDataPlugin = exports.createAngularMemoryPlugin = void 0;
10
+ exports.createAngularSsrTransformPlugin = exports.ServerSsrMode = exports.createAngularSetupMiddlewaresPlugin = exports.createRemoveIdPrefixPlugin = exports.createAngularMemoryPlugin = void 0;
11
11
  var angular_memory_plugin_1 = require("./angular-memory-plugin");
12
12
  Object.defineProperty(exports, "createAngularMemoryPlugin", { enumerable: true, get: function () { return angular_memory_plugin_1.createAngularMemoryPlugin; } });
13
- var i18n_locale_plugin_1 = require("./i18n-locale-plugin");
14
- Object.defineProperty(exports, "createAngularLocaleDataPlugin", { enumerable: true, get: function () { return i18n_locale_plugin_1.createAngularLocaleDataPlugin; } });
15
13
  var id_prefix_plugin_1 = require("./id-prefix-plugin");
16
14
  Object.defineProperty(exports, "createRemoveIdPrefixPlugin", { enumerable: true, get: function () { return id_prefix_plugin_1.createRemoveIdPrefixPlugin; } });
17
15
  var setup_middlewares_plugin_1 = require("./setup-middlewares-plugin");
@@ -18,3 +18,4 @@ export declare const shouldOptimizeChunks: boolean;
18
18
  export declare const useComponentStyleHmr: boolean;
19
19
  export declare const useComponentTemplateHmr: boolean;
20
20
  export declare const usePartialSsrBuild: boolean;
21
+ export declare const bazelEsbuildPluginPath: string | undefined;
@@ -7,7 +7,7 @@
7
7
  * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.usePartialSsrBuild = exports.useComponentTemplateHmr = exports.useComponentStyleHmr = exports.shouldOptimizeChunks = exports.useJSONBuildLogs = exports.useTypeChecking = exports.shouldWatchRoot = exports.debugPerformance = exports.useParallelTs = exports.maxWorkers = exports.allowMinify = exports.shouldBeautify = exports.allowMangle = void 0;
10
+ exports.bazelEsbuildPluginPath = exports.usePartialSsrBuild = exports.useComponentTemplateHmr = exports.useComponentStyleHmr = exports.shouldOptimizeChunks = exports.useJSONBuildLogs = exports.useTypeChecking = exports.shouldWatchRoot = exports.debugPerformance = exports.useParallelTs = exports.maxWorkers = exports.allowMinify = exports.shouldBeautify = exports.allowMangle = void 0;
11
11
  const node_os_1 = require("node:os");
12
12
  function isDisabled(variable) {
13
13
  return variable === '0' || variable.toLowerCase() === 'false';
@@ -88,3 +88,8 @@ const hmrComponentTemplateVariable = process.env['NG_HMR_TEMPLATES'];
88
88
  exports.useComponentTemplateHmr = !isPresent(hmrComponentTemplateVariable) || !isDisabled(hmrComponentTemplateVariable);
89
89
  const partialSsrBuildVariable = process.env['NG_BUILD_PARTIAL_SSR'];
90
90
  exports.usePartialSsrBuild = isPresent(partialSsrBuildVariable) && isEnabled(partialSsrBuildVariable);
91
+ const bazelBinDirectory = process.env['BAZEL_BINDIR'];
92
+ const bazelExecRoot = process.env['JS_BINARY__EXECROOT'];
93
+ exports.bazelEsbuildPluginPath = bazelBinDirectory && bazelExecRoot
94
+ ? process.env['NG_INTERNAL_ESBUILD_PLUGINS_DO_NOT_USE']
95
+ : undefined;
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.normalizeCacheOptions = normalizeCacheOptions;
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 = '20.3.6';
13
+ const VERSION = '20.3.8';
14
14
  function hasCacheMetadata(value) {
15
15
  return (!!value &&
16
16
  typeof value === 'object' &&
@@ -19,6 +19,7 @@ const worker_pool_1 = require("../worker-pool");
19
19
  const utils_1 = require("./esm-in-memory-loader/utils");
20
20
  const manifest_1 = require("./manifest");
21
21
  const models_1 = require("./models");
22
+ const utils_2 = require("./utils");
22
23
  async function prerenderPages(workspaceRoot, baseHref, appShellOptions, prerenderOptions, outputFiles, assets, outputMode, sourcemap = false, maxThreads = 1) {
23
24
  const outputFilesForWorker = {};
24
25
  const serverBundlesSourceMaps = new Map();
@@ -137,7 +138,7 @@ async function renderPages(baseHref, sourcemap, serializableRouteTreeNode, maxTh
137
138
  : route;
138
139
  const outPath = node_path_1.posix.join(removeLeadingSlash(routeWithoutBaseHref), 'index.html');
139
140
  if (typeof redirectTo === 'string') {
140
- output[outPath] = { content: generateRedirectStaticPage(redirectTo), appShellRoute: false };
141
+ output[outPath] = { content: (0, utils_2.generateRedirectStaticPage)(redirectTo), appShellRoute: false };
141
142
  continue;
142
143
  }
143
144
  const render = renderWorker.run({ url: route });
@@ -241,27 +242,3 @@ function addTrailingSlash(url) {
241
242
  function removeLeadingSlash(value) {
242
243
  return value[0] === '/' ? value.slice(1) : value;
243
244
  }
244
- /**
245
- * Generates a static HTML page with a meta refresh tag to redirect the user to a specified URL.
246
- *
247
- * This function creates a simple HTML page that performs a redirect using a meta tag.
248
- * It includes a fallback link in case the meta-refresh doesn't work.
249
- *
250
- * @param url - The URL to which the page should redirect.
251
- * @returns The HTML content of the static redirect page.
252
- */
253
- function generateRedirectStaticPage(url) {
254
- return `
255
- <!DOCTYPE html>
256
- <html>
257
- <head>
258
- <meta charset="utf-8">
259
- <title>Redirecting</title>
260
- <meta http-equiv="refresh" content="0; url=${url}">
261
- </head>
262
- <body>
263
- <pre>Redirecting to <a href="${url}">${url}</a></pre>
264
- </body>
265
- </html>
266
- `.trim();
267
- }
@@ -11,6 +11,7 @@ const node_worker_threads_1 = require("node:worker_threads");
11
11
  const fetch_patch_1 = require("./fetch-patch");
12
12
  const launch_server_1 = require("./launch-server");
13
13
  const load_esm_from_memory_1 = require("./load-esm-from-memory");
14
+ const utils_1 = require("./utils");
14
15
  /**
15
16
  * This is passed as workerData when setting up the worker via the `piscina` package.
16
17
  */
@@ -25,7 +26,11 @@ async function renderPage({ url }) {
25
26
  allowStaticRouteRender: true,
26
27
  });
27
28
  const response = await angularServerApp.handle(new Request(new URL(url, serverURL), { signal: AbortSignal.timeout(30_000) }));
28
- return response ? response.text() : null;
29
+ if (!response) {
30
+ return null;
31
+ }
32
+ const location = response.headers.get('Location');
33
+ return location ? (0, utils_1.generateRedirectStaticPage)(location) : response.text();
29
34
  }
30
35
  async function initialize() {
31
36
  if (outputMode !== undefined && hasSsrEntry) {
@@ -9,3 +9,13 @@ import type { createRequestHandler } from '@angular/ssr';
9
9
  import type { createNodeRequestHandler } from '@angular/ssr/node';
10
10
  export declare function isSsrNodeRequestHandler(value: unknown): value is ReturnType<typeof createNodeRequestHandler>;
11
11
  export declare function isSsrRequestHandler(value: unknown): value is ReturnType<typeof createRequestHandler>;
12
+ /**
13
+ * Generates a static HTML page with a meta refresh tag to redirect the user to a specified URL.
14
+ *
15
+ * This function creates a simple HTML page that performs a redirect using a meta tag.
16
+ * It includes a fallback link in case the meta-refresh doesn't work.
17
+ *
18
+ * @param url - The URL to which the page should redirect.
19
+ * @returns The HTML content of the static redirect page.
20
+ */
21
+ export declare function generateRedirectStaticPage(url: string): string;
@@ -9,9 +9,34 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.isSsrNodeRequestHandler = isSsrNodeRequestHandler;
11
11
  exports.isSsrRequestHandler = isSsrRequestHandler;
12
+ exports.generateRedirectStaticPage = generateRedirectStaticPage;
12
13
  function isSsrNodeRequestHandler(value) {
13
14
  return typeof value === 'function' && '__ng_node_request_handler__' in value;
14
15
  }
15
16
  function isSsrRequestHandler(value) {
16
17
  return typeof value === 'function' && '__ng_request_handler__' in value;
17
18
  }
19
+ /**
20
+ * Generates a static HTML page with a meta refresh tag to redirect the user to a specified URL.
21
+ *
22
+ * This function creates a simple HTML page that performs a redirect using a meta tag.
23
+ * It includes a fallback link in case the meta-refresh doesn't work.
24
+ *
25
+ * @param url - The URL to which the page should redirect.
26
+ * @returns The HTML content of the static redirect page.
27
+ */
28
+ function generateRedirectStaticPage(url) {
29
+ return `
30
+ <!DOCTYPE html>
31
+ <html>
32
+ <head>
33
+ <meta charset="utf-8">
34
+ <title>Redirecting</title>
35
+ <meta http-equiv="refresh" content="0; url=${url}">
36
+ </head>
37
+ <body>
38
+ <pre>Redirecting to <a href="${url}">${url}</a></pre>
39
+ </body>
40
+ </html>
41
+ `.trim();
42
+ }
@@ -1,14 +0,0 @@
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.dev/license
7
- */
8
- import type { Plugin } from 'vite';
9
- /**
10
- * Creates a Vite plugin that resolves Angular locale data files from `@angular/common`.
11
- *
12
- * @returns A Vite plugin.
13
- */
14
- export declare function createAngularLocaleDataPlugin(): Plugin;
@@ -1,54 +0,0 @@
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.dev/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.createAngularLocaleDataPlugin = createAngularLocaleDataPlugin;
11
- /**
12
- * The base module location used to search for locale specific data.
13
- */
14
- const LOCALE_DATA_BASE_MODULE = '@angular/common/locales/global';
15
- /**
16
- * Creates a Vite plugin that resolves Angular locale data files from `@angular/common`.
17
- *
18
- * @returns A Vite plugin.
19
- */
20
- function createAngularLocaleDataPlugin() {
21
- return {
22
- name: 'angular-locale-data',
23
- enforce: 'pre',
24
- async resolveId(source) {
25
- if (!source.startsWith('angular:locale/data:')) {
26
- return;
27
- }
28
- // Extract the locale from the path
29
- const originalLocale = source.split(':', 3)[2];
30
- // Remove any private subtags since these will never match
31
- let partialLocale = originalLocale.replace(/-x(-[a-zA-Z0-9]{1,8})+$/, '');
32
- let exact = true;
33
- while (partialLocale) {
34
- const potentialPath = `${LOCALE_DATA_BASE_MODULE}/${partialLocale}`;
35
- const result = await this.resolve(potentialPath);
36
- if (result) {
37
- if (!exact) {
38
- this.warn(`Locale data for '${originalLocale}' cannot be found. Using locale data for '${partialLocale}'.`);
39
- }
40
- return result;
41
- }
42
- // Remove the last subtag and try again with a less specific locale
43
- const parts = partialLocale.split('-');
44
- partialLocale = parts.slice(0, -1).join('-');
45
- exact = false;
46
- // The locales "en" and "en-US" are considered exact to retain existing behavior
47
- if (originalLocale === 'en-US' && partialLocale === 'en') {
48
- exact = true;
49
- }
50
- }
51
- return null;
52
- },
53
- };
54
- }