@angular/build 20.3.7 → 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.7",
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.7",
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",
@@ -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.7",
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;
@@ -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;
@@ -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.7';
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
+ }