@angular/build 18.2.19 → 18.2.21

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.2.19",
3
+ "version": "18.2.21",
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.1802.19",
26
+ "@angular-devkit/architect": "0.1802.21",
27
27
  "@babel/core": "7.25.2",
28
28
  "@babel/helper-annotate-as-pure": "7.24.7",
29
29
  "@babel/helper-split-export-declaration": "7.24.7",
@@ -30,6 +30,6 @@ export declare function serveWithVite(serverOptions: NormalizedDevServerOptions,
30
30
  middleware?: Connect.NextHandleFunction[];
31
31
  buildPlugins?: Plugin[];
32
32
  }): AsyncIterableIterator<DevServerBuilderOutput>;
33
- export declare function setupServer(serverOptions: NormalizedDevServerOptions, outputFiles: Map<string, OutputFileRecord>, assets: Map<string, string>, preserveSymlinks: boolean | undefined, externalMetadata: DevServerExternalResultMetadata, ssr: boolean, prebundleTransformer: JavaScriptTransformer, target: string[], zoneless: boolean, prebundleLoaderExtensions: EsbuildLoaderOption | undefined, extensionMiddleware?: Connect.NextHandleFunction[], indexHtmlTransformer?: (content: string) => Promise<string>, thirdPartySourcemaps?: boolean): Promise<InlineConfig>;
33
+ export declare function setupServer(serverOptions: NormalizedDevServerOptions, outputFiles: Map<string, OutputFileRecord>, assets: Map<string, string>, preserveSymlinks: boolean | undefined, externalMetadata: DevServerExternalResultMetadata, ssr: boolean, prebundleTransformer: JavaScriptTransformer, target: string[], zoneless: boolean, prebundleLoaderExtensions: EsbuildLoaderOption | undefined, extensionMiddleware?: Connect.NextHandleFunction[], indexHtmlTransformer?: (content: string) => Promise<string>, thirdPartySourcemaps?: boolean, aot?: boolean): Promise<InlineConfig>;
34
34
  type EsbuildLoaderOption = Exclude<DepOptimizationConfig['esbuildOptions'], undefined>['loader'];
35
35
  export {};
@@ -242,7 +242,7 @@ async function* serveWithVite(serverOptions, builderName, builderAction, context
242
242
  ? browserOptions.polyfills
243
243
  : [browserOptions.polyfills];
244
244
  // Setup server and start listening
245
- 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);
245
+ 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, !!browserOptions.aot);
246
246
  server = await createServer(serverConfiguration);
247
247
  await server.listen();
248
248
  if (browserOptions.ssr && serverOptions.prebundle !== false) {
@@ -372,7 +372,7 @@ function analyzeResultFiles(normalizePath, htmlIndexPath, resultFiles, generated
372
372
  }
373
373
  }
374
374
  }
375
- async function setupServer(serverOptions, outputFiles, assets, preserveSymlinks, externalMetadata, ssr, prebundleTransformer, target, zoneless, prebundleLoaderExtensions, extensionMiddleware, indexHtmlTransformer, thirdPartySourcemaps = false) {
375
+ async function setupServer(serverOptions, outputFiles, assets, preserveSymlinks, externalMetadata, ssr, prebundleTransformer, target, zoneless, prebundleLoaderExtensions, extensionMiddleware, indexHtmlTransformer, thirdPartySourcemaps = false, aot = false) {
376
376
  const proxy = await (0, utils_1.loadProxyConfiguration)(serverOptions.workspaceRoot, serverOptions.proxyConfig);
377
377
  // dynamically import Vite for ESM compatibility
378
378
  const { normalizePath } = await (0, load_esm_1.loadEsmModule)('vite');
@@ -448,6 +448,7 @@ async function setupServer(serverOptions, outputFiles, assets, preserveSymlinks,
448
448
  // Include all implict dependencies from the external packages internal option
449
449
  include: externalMetadata.implicitServer,
450
450
  ssr: true,
451
+ aot,
451
452
  prebundleTransformer,
452
453
  zoneless,
453
454
  target,
@@ -484,6 +485,7 @@ async function setupServer(serverOptions, outputFiles, assets, preserveSymlinks,
484
485
  zoneless,
485
486
  loader: prebundleLoaderExtensions,
486
487
  thirdPartySourcemaps,
488
+ aot,
487
489
  }),
488
490
  };
489
491
  if (serverOptions.ssl) {
@@ -504,7 +506,7 @@ async function setupServer(serverOptions, outputFiles, assets, preserveSymlinks,
504
506
  }
505
507
  return configuration;
506
508
  }
507
- function getDepOptimizationConfig({ disabled, exclude, include, target, zoneless, prebundleTransformer, ssr, loader, thirdPartySourcemaps, }) {
509
+ function getDepOptimizationConfig({ disabled, exclude, include, target, zoneless, prebundleTransformer, ssr, loader, thirdPartySourcemaps, aot, }) {
508
510
  const plugins = [
509
511
  {
510
512
  name: `angular-vite-optimize-deps${ssr ? '-ssr' : ''}${thirdPartySourcemaps ? '-vendor-sourcemap' : ''}`,
@@ -532,6 +534,9 @@ function getDepOptimizationConfig({ disabled, exclude, include, target, zoneless
532
534
  supported: (0, internal_1.getFeatureSupport)(target, zoneless),
533
535
  plugins,
534
536
  loader,
537
+ define: {
538
+ 'ngJitMode': aot ? 'false' : 'true',
539
+ },
535
540
  resolveExtensions: ['.mjs', '.js', '.cjs'],
536
541
  },
537
542
  };
@@ -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 = '18.2.19';
13
+ const VERSION = '18.2.21';
14
14
  function hasCacheMetadata(value) {
15
15
  return (!!value &&
16
16
  typeof value === 'object' &&
@@ -6,10 +6,11 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import { ApplicationRef, Type } from '@angular/core';
9
+ import { BootstrapContext } from '@angular/platform-browser';
9
10
  interface RouterResult {
10
11
  route: string;
11
12
  success: boolean;
12
13
  redirect: boolean;
13
14
  }
14
- export declare function extractRoutes(bootstrapAppFnOrModule: (() => Promise<ApplicationRef>) | Type<unknown>, document: string): AsyncIterableIterator<RouterResult>;
15
+ export declare function extractRoutes(bootstrapAppFnOrModule: ((context: BootstrapContext) => Promise<ApplicationRef>) | Type<unknown>, document: string): AsyncIterableIterator<RouterResult>;
15
16
  export {};
@@ -64,7 +64,7 @@ export async function* extractRoutes(bootstrapAppFnOrModule, document) {
64
64
  try {
65
65
  let applicationRef;
66
66
  if (isBootstrapFn(bootstrapAppFnOrModule)) {
67
- applicationRef = await bootstrapAppFnOrModule();
67
+ applicationRef = await bootstrapAppFnOrModule({ platformRef });
68
68
  }
69
69
  else {
70
70
  const moduleRef = await platformRef.bootstrapModule(bootstrapAppFnOrModule);
@@ -7,10 +7,11 @@
7
7
  */
8
8
  import type { ApplicationRef, Type, ɵConsole } from '@angular/core';
9
9
  import type { renderApplication, renderModule, ɵSERVER_CONTEXT } from '@angular/platform-server';
10
+ import type { BootstrapContext } from '@angular/platform-browser';
10
11
  import type { extractRoutes } from '../routes-extractor/extractor';
11
12
  export interface MainServerBundleExports {
12
13
  /** Standalone application bootstrapping function. */
13
- default: (() => Promise<ApplicationRef>) | Type<unknown>;
14
+ default: ((context: BootstrapContext) => Promise<ApplicationRef>) | Type<unknown>;
14
15
  }
15
16
  export interface RenderUtilsServerBundleExports {
16
17
  /** An internal token that allows providing extra information about the server context. */
@@ -1,22 +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 { Plugin } from 'esbuild';
9
- export declare const IS_BAZEL: boolean;
10
- /**
11
- * Creates an esbuild plugin that ensures module resolution stays within the Bazel sandbox.
12
- *
13
- * Under Bazel, esbuild may follow symlinks out of the sandbox when sandboxing is enabled.
14
- * This plugin uses a separate resolver to detect when resolution leaves the `execroot`
15
- * (which serves as the sandbox root when sandboxing is active), and rewrites the resolution
16
- * to remain within the sandbox.
17
- *
18
- * See: https://github.com/aspect-build/rules_esbuild/issues/58
19
- *
20
- * @returns An esbuild plugin.
21
- */
22
- export declare function bazelSandboxPlugin(): Plugin;
@@ -1,71 +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.IS_BAZEL = void 0;
11
- exports.bazelSandboxPlugin = bazelSandboxPlugin;
12
- const path_1 = require("path");
13
- const BAZEL_SANDBOX_RESOLUTION = Symbol('BAZEL_SANDBOX_RESOLUTION');
14
- const BAZEL_BIN_DIR = process.env.BAZEL_BINDIR;
15
- const BAZEL_EXECROOT = process.env.JS_BINARY__EXECROOT;
16
- exports.IS_BAZEL = !!BAZEL_BIN_DIR;
17
- /**
18
- * Creates an esbuild plugin that ensures module resolution stays within the Bazel sandbox.
19
- *
20
- * Under Bazel, esbuild may follow symlinks out of the sandbox when sandboxing is enabled.
21
- * This plugin uses a separate resolver to detect when resolution leaves the `execroot`
22
- * (which serves as the sandbox root when sandboxing is active), and rewrites the resolution
23
- * to remain within the sandbox.
24
- *
25
- * See: https://github.com/aspect-build/rules_esbuild/issues/58
26
- *
27
- * @returns An esbuild plugin.
28
- */
29
- function bazelSandboxPlugin() {
30
- return {
31
- name: 'angular-bazel-sandbox',
32
- setup(build) {
33
- if (!BAZEL_EXECROOT || !BAZEL_BIN_DIR) {
34
- return;
35
- }
36
- build.onResolve({ filter: /./ }, async (args) => {
37
- const { importer, kind, resolveDir, namespace, pluginData = {} } = args;
38
- if (pluginData[BAZEL_SANDBOX_RESOLUTION]) {
39
- return null;
40
- }
41
- pluginData[BAZEL_SANDBOX_RESOLUTION] = true;
42
- const result = await build.resolve(args.path, {
43
- importer,
44
- kind,
45
- namespace,
46
- pluginData,
47
- resolveDir,
48
- });
49
- if (result.external || result.errors.length) {
50
- return result;
51
- }
52
- if (result.path.startsWith(BAZEL_EXECROOT)) {
53
- return result;
54
- }
55
- // If esbuild attempts to leave the execroot, map the path back into the execroot.
56
- // If it tried to leave bazel-bin, error out completely.
57
- if (!result.path.includes(BAZEL_BIN_DIR)) {
58
- throw new Error(`Error: esbuild resolved a path outside of BAZEL_BINDIR (${BAZEL_BIN_DIR}): ${result.path}`);
59
- }
60
- // Otherwise remap the bindir-relative path
61
- const correctedPath = (0, path_1.join)(BAZEL_EXECROOT, result.path.slice(result.path.indexOf(BAZEL_BIN_DIR)));
62
- if (process.env.JS_BINARY__LOG_DEBUG) {
63
- // eslint-disable-next-line no-console
64
- console.error(`DEBUG: [angular-bazel-sandbox] correcting esbuild resolution ${result.path} that left the sandbox to ${correctedPath}.`);
65
- }
66
- result.path = correctedPath;
67
- return result;
68
- });
69
- },
70
- };
71
- }