@angular/build 19.0.5 → 19.0.7

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2010-2024 Google LLC. https://angular.dev/license
3
+ Copyright (c) 2010-2025 Google LLC. https://angular.dev/license
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/index.d.ts ADDED
@@ -0,0 +1,8 @@
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
+ export * from './src/index';
package/index.js ADDED
@@ -0,0 +1,24 @@
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
+ 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 __exportStar = (this && this.__exportStar) || function(m, exports) {
21
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ __exportStar(require("./src/index"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/build",
3
- "version": "19.0.5",
3
+ "version": "19.0.7",
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.1900.5",
26
+ "@angular-devkit/architect": "0.1900.7",
27
27
  "@babel/core": "7.26.0",
28
28
  "@babel/helper-annotate-as-pure": "7.25.9",
29
29
  "@babel/helper-split-export-declaration": "7.24.7",
@@ -57,7 +57,7 @@
57
57
  "@angular/localize": "^19.0.0",
58
58
  "@angular/platform-server": "^19.0.0",
59
59
  "@angular/service-worker": "^19.0.0",
60
- "@angular/ssr": "^19.0.5",
60
+ "@angular/ssr": "^19.0.7",
61
61
  "less": "^4.2.0",
62
62
  "postcss": "^8.4.0",
63
63
  "tailwindcss": "^2.0.0 || ^3.0.0",
@@ -86,7 +86,6 @@
86
86
  "optional": true
87
87
  }
88
88
  },
89
- "packageManager": "yarn@4.5.0",
90
89
  "repository": {
91
90
  "type": "git",
92
91
  "url": "https://github.com/angular/angular-cli.git"
@@ -109,5 +108,8 @@
109
108
  "puppeteer": {
110
109
  "built": true
111
110
  }
111
+ },
112
+ "pnpm": {
113
+ "onlyBuiltDependencies": []
112
114
  }
113
115
  }
@@ -0,0 +1,8 @@
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
+ export * from '../src/private';
@@ -0,0 +1,24 @@
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
+ 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 __exportStar = (this && this.__exportStar) || function(m, exports) {
21
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ __exportStar(require("../src/private"), exports);
@@ -6,6 +6,29 @@
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 (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
9
32
  Object.defineProperty(exports, "__esModule", { value: true });
10
33
  exports.executeBuild = executeBuild;
11
34
  const source_file_cache_1 = require("../../tools/esbuild/angular/source-file-cache");
@@ -21,7 +44,6 @@ const environment_options_1 = require("../../utils/environment-options");
21
44
  const resolve_assets_1 = require("../../utils/resolve-assets");
22
45
  const manifest_1 = require("../../utils/server-rendering/manifest");
23
46
  const supported_browsers_1 = require("../../utils/supported-browsers");
24
- const chunk_optimizer_1 = require("./chunk-optimizer");
25
47
  const execute_post_bundle_1 = require("./execute-post-bundle");
26
48
  const i18n_1 = require("./i18n");
27
49
  const setup_bundling_1 = require("./setup-bundling");
@@ -85,7 +107,8 @@ async function executeBuild(options, context, rebuildState) {
85
107
  bundlingResult = bundler_context_1.BundlerContext.mergeResults([bundlingResult, ...componentResults]);
86
108
  }
87
109
  if (options.optimizationOptions.scripts && environment_options_1.shouldOptimizeChunks) {
88
- bundlingResult = await (0, profiling_1.profileAsync)('OPTIMIZE_CHUNKS', () => (0, chunk_optimizer_1.optimizeChunks)(bundlingResult, options.sourcemapOptions.scripts ? !options.sourcemapOptions.hidden || 'hidden' : false));
110
+ const { optimizeChunks } = await Promise.resolve().then(() => __importStar(require('./chunk-optimizer')));
111
+ bundlingResult = await (0, profiling_1.profileAsync)('OPTIMIZE_CHUNKS', () => optimizeChunks(bundlingResult, options.sourcemapOptions.scripts ? !options.sourcemapOptions.hidden || 'hidden' : false));
89
112
  }
90
113
  const executionResult = new bundler_execution_result_1.ExecutionResult(bundlerContexts, componentStyleBundler, codeBundleCache, templateUpdates);
91
114
  executionResult.addWarnings(bundlingResult.warnings);
@@ -36,5 +36,5 @@ export interface ApplicationBuilderOutput extends BuilderOutput {
36
36
  * @returns The build output results of the build.
37
37
  */
38
38
  export declare function buildApplication(options: ApplicationBuilderOptions, context: BuilderContext, extensions?: ApplicationBuilderExtensions): AsyncIterable<ApplicationBuilderOutput>;
39
- declare const _default: import("../../../../../angular_devkit/architect/src/internal").Builder<ApplicationBuilderOptions & import("../../../../../angular_devkit/core/src").JsonObject>;
39
+ declare const _default: import("../../../../../angular_devkit/architect/src/internal").Builder<ApplicationBuilderOptions & import("../../../../../angular_devkit/core").JsonObject>;
40
40
  export default _default;
@@ -9,6 +9,6 @@ import { execute } from './builder';
9
9
  import type { DevServerBuilderOutput } from './output';
10
10
  import type { Schema as DevServerBuilderOptions } from './schema';
11
11
  export { type DevServerBuilderOptions, type DevServerBuilderOutput, execute as executeDevServerBuilder, };
12
- declare const _default: import("../../../../../angular_devkit/architect/src/internal").Builder<DevServerBuilderOptions & import("../../../../../angular_devkit/core/src").JsonObject>;
12
+ declare const _default: import("../../../../../angular_devkit/architect/src/internal").Builder<DevServerBuilderOptions & import("../../../../../angular_devkit/core").JsonObject>;
13
13
  export default _default;
14
14
  export { execute as executeDevServer };
@@ -34,5 +34,5 @@ export declare function serveWithVite(serverOptions: NormalizedDevServerOptions,
34
34
  middleware?: Connect.NextHandleFunction[];
35
35
  buildPlugins?: Plugin[];
36
36
  }): AsyncIterableIterator<DevServerBuilderOutput>;
37
- export declare function setupServer(serverOptions: NormalizedDevServerOptions, outputFiles: Map<string, OutputFileRecord>, assets: Map<string, string>, preserveSymlinks: boolean | undefined, externalMetadata: DevServerExternalResultMetadata, ssrMode: ServerSsrMode, prebundleTransformer: JavaScriptTransformer, target: string[], zoneless: boolean, componentStyles: Map<string, ComponentStyleRecord>, templateUpdates: Map<string, string>, prebundleLoaderExtensions: EsbuildLoaderOption | undefined, extensionMiddleware?: Connect.NextHandleFunction[], indexHtmlTransformer?: (content: string) => Promise<string>, thirdPartySourcemaps?: boolean): Promise<InlineConfig>;
37
+ export declare function setupServer(serverOptions: NormalizedDevServerOptions, outputFiles: Map<string, OutputFileRecord>, assets: Map<string, string>, preserveSymlinks: boolean | undefined, externalMetadata: DevServerExternalResultMetadata, ssrMode: ServerSsrMode, prebundleTransformer: JavaScriptTransformer, target: string[], zoneless: boolean, componentStyles: Map<string, ComponentStyleRecord>, templateUpdates: Map<string, string>, prebundleLoaderExtensions: EsbuildLoaderOption | undefined, define: ApplicationBuilderInternalOptions['define'], extensionMiddleware?: Connect.NextHandleFunction[], indexHtmlTransformer?: (content: string) => Promise<string>, thirdPartySourcemaps?: boolean): Promise<InlineConfig>;
38
38
  export {};
@@ -280,7 +280,7 @@ async function* serveWithVite(serverOptions, builderName, builderAction, context
280
280
  });
281
281
  }
282
282
  // Setup server and start listening
283
- const serverConfiguration = await setupServer(serverOptions, generatedFiles, assetFiles, browserOptions.preserveSymlinks, externalMetadata, ssrMode, prebundleTransformer, target, (0, internal_1.isZonelessApp)(polyfills), componentStyles, templateUpdates, browserOptions.loader, extensions?.middleware, transformers?.indexHtml, thirdPartySourcemaps);
283
+ const serverConfiguration = await setupServer(serverOptions, generatedFiles, assetFiles, browserOptions.preserveSymlinks, externalMetadata, ssrMode, prebundleTransformer, target, (0, internal_1.isZonelessApp)(polyfills), componentStyles, templateUpdates, browserOptions.loader, browserOptions.define, extensions?.middleware, transformers?.indexHtml, thirdPartySourcemaps);
284
284
  server = await createServer(serverConfiguration);
285
285
  await server.listen();
286
286
  const urls = server.resolvedUrls;
@@ -459,7 +459,7 @@ function analyzeResultFiles(normalizePath, htmlIndexPath, resultFiles, generated
459
459
  }
460
460
  }
461
461
  }
462
- async function setupServer(serverOptions, outputFiles, assets, preserveSymlinks, externalMetadata, ssrMode, prebundleTransformer, target, zoneless, componentStyles, templateUpdates, prebundleLoaderExtensions, extensionMiddleware, indexHtmlTransformer, thirdPartySourcemaps = false) {
462
+ async function setupServer(serverOptions, outputFiles, assets, preserveSymlinks, externalMetadata, ssrMode, prebundleTransformer, target, zoneless, componentStyles, templateUpdates, prebundleLoaderExtensions, define, extensionMiddleware, indexHtmlTransformer, thirdPartySourcemaps = false) {
463
463
  const proxy = await (0, utils_2.loadProxyConfiguration)(serverOptions.workspaceRoot, serverOptions.proxyConfig);
464
464
  // dynamically import Vite for ESM compatibility
465
465
  const { normalizePath } = await (0, load_esm_1.loadEsmModule)('vite');
@@ -504,7 +504,14 @@ async function setupServer(serverOptions, outputFiles, assets, preserveSymlinks,
504
504
  headers: serverOptions.headers,
505
505
  // Disable the websocket if live reload is disabled (false/undefined are the only valid values)
506
506
  ws: serverOptions.liveReload === false && serverOptions.hmr === false ? false : undefined,
507
- proxy,
507
+ // When server-side rendering (SSR) is enabled togather with SSL and Express is being used,
508
+ // we must configure Vite to use HTTP/1.1.
509
+ // This is necessary because Express does not support HTTP/2.
510
+ // We achieve this by defining an empty proxy.
511
+ // See: https://github.com/vitejs/vite/blob/c4b532cc900bf988073583511f57bd581755d5e3/packages/vite/src/node/http.ts#L106
512
+ proxy: serverOptions.ssl && ssrMode === plugins_1.ServerSsrMode.ExternalSsrMiddleware
513
+ ? (proxy ?? {})
514
+ : proxy,
508
515
  cors: {
509
516
  // Allow preflight requests to be proxied.
510
517
  preflightContinue: true,
@@ -544,6 +551,7 @@ async function setupServer(serverOptions, outputFiles, assets, preserveSymlinks,
544
551
  target,
545
552
  loader: prebundleLoaderExtensions,
546
553
  thirdPartySourcemaps,
554
+ define,
547
555
  }),
548
556
  },
549
557
  plugins: [
@@ -581,6 +589,7 @@ async function setupServer(serverOptions, outputFiles, assets, preserveSymlinks,
581
589
  zoneless,
582
590
  loader: prebundleLoaderExtensions,
583
591
  thirdPartySourcemaps,
592
+ define,
584
593
  }),
585
594
  };
586
595
  if (serverOptions.ssl) {
@@ -8,5 +8,5 @@
8
8
  import { execute } from './builder';
9
9
  import type { Schema as ExtractI18nBuilderOptions } from './schema';
10
10
  export { ExtractI18nBuilderOptions, execute };
11
- declare const _default: import("../../../../../angular_devkit/architect/src/internal").Builder<ExtractI18nBuilderOptions & import("../../../../../angular_devkit/core/src").JsonObject>;
11
+ declare const _default: import("../../../../../angular_devkit/architect/src/internal").Builder<ExtractI18nBuilderOptions & import("../../../../../angular_devkit/core").JsonObject>;
12
12
  export default _default;
@@ -54,6 +54,16 @@ function isTslibHelperName(name) {
54
54
  }
55
55
  return tslibHelpers.has(originalName);
56
56
  }
57
+ const babelHelpers = new Set(['_defineProperty']);
58
+ /**
59
+ * Determinates whether an identifier name matches one of the Babel helper function names.
60
+ *
61
+ * @param name The identifier name to check.
62
+ * @returns True, if the name matches a Babel helper name; otherwise, false.
63
+ */
64
+ function isBabelHelperName(name) {
65
+ return babelHelpers.has(name);
66
+ }
57
67
  /**
58
68
  * A babel plugin factory function for adding the PURE annotation to top-level new and call expressions.
59
69
  *
@@ -72,9 +82,10 @@ function default_1() {
72
82
  path.node.arguments.length !== 0) {
73
83
  return;
74
84
  }
75
- // Do not annotate TypeScript helpers emitted by the TypeScript compiler.
76
- // TypeScript helpers are intended to cause side effects.
77
- if (callee.isIdentifier() && isTslibHelperName(callee.node.name)) {
85
+ // Do not annotate TypeScript helpers emitted by the TypeScript compiler or Babel helpers.
86
+ // They are intended to cause side effects.
87
+ if (callee.isIdentifier() &&
88
+ (isTslibHelperName(callee.node.name) || isBabelHelperName(callee.node.name))) {
78
89
  return;
79
90
  }
80
91
  (0, helper_annotate_as_pure_1.default)(path);
@@ -0,0 +1,16 @@
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 'esbuild';
9
+ /**
10
+ * This plugin addresses an issue where '@angular/localize/init' is directly imported,
11
+ * potentially resulting in undefined behavior. By detecting such imports, the plugin
12
+ * issues a warning and suggests including '@angular/localize/init' as a polyfill.
13
+ *
14
+ * @returns An esbuild plugin.
15
+ */
16
+ export declare function createAngularLocalizeInitWarningPlugin(): Plugin;
@@ -0,0 +1,49 @@
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.createAngularLocalizeInitWarningPlugin = createAngularLocalizeInitWarningPlugin;
11
+ const NG_LOCALIZE_RESOLUTION = Symbol('NG_LOCALIZE_RESOLUTION');
12
+ /**
13
+ * This plugin addresses an issue where '@angular/localize/init' is directly imported,
14
+ * potentially resulting in undefined behavior. By detecting such imports, the plugin
15
+ * issues a warning and suggests including '@angular/localize/init' as a polyfill.
16
+ *
17
+ * @returns An esbuild plugin.
18
+ */
19
+ function createAngularLocalizeInitWarningPlugin() {
20
+ return {
21
+ name: 'angular-localize-init-warning',
22
+ setup(build) {
23
+ build.onResolve({ filter: /^@angular\/localize\/init/ }, async (args) => {
24
+ if (args.pluginData?.[NG_LOCALIZE_RESOLUTION]) {
25
+ return null;
26
+ }
27
+ const { importer, kind, resolveDir, namespace, pluginData = {} } = args;
28
+ pluginData[NG_LOCALIZE_RESOLUTION] = true;
29
+ const result = await build.resolve(args.path, {
30
+ importer,
31
+ kind,
32
+ namespace,
33
+ pluginData,
34
+ resolveDir,
35
+ });
36
+ return {
37
+ ...result,
38
+ warnings: [
39
+ ...result.warnings,
40
+ {
41
+ text: `Direct import of '@angular/localize/init' detected. This may lead to undefined behavior.`,
42
+ notes: [{ text: `Include '@angular/localize/init' as a polyfill instead.` }],
43
+ },
44
+ ],
45
+ };
46
+ });
47
+ },
48
+ };
49
+ }
@@ -22,6 +22,7 @@ const schema_1 = require("../../builders/application/schema");
22
22
  const environment_options_1 = require("../../utils/environment-options");
23
23
  const manifest_1 = require("../../utils/server-rendering/manifest");
24
24
  const compiler_plugin_1 = require("./angular/compiler-plugin");
25
+ const angular_localize_init_warning_plugin_1 = require("./angular-localize-init-warning-plugin");
25
26
  const compiler_plugin_options_1 = require("./compiler-plugin-options");
26
27
  const external_packages_plugin_1 = require("./external-packages-plugin");
27
28
  const i18n_locale_plugin_1 = require("./i18n-locale-plugin");
@@ -53,6 +54,7 @@ function createBrowserCodeBundleOptions(options, target, sourceFileCache, styles
53
54
  (0, loader_import_attribute_plugin_1.createLoaderImportAttributePlugin)(),
54
55
  (0, wasm_plugin_1.createWasmPlugin)({ allowAsync: zoneless, cache: loadCache }),
55
56
  (0, sourcemap_ignorelist_plugin_1.createSourcemapIgnorelistPlugin)(),
57
+ (0, angular_localize_init_warning_plugin_1.createAngularLocalizeInitWarningPlugin)(),
56
58
  (0, compiler_plugin_1.createCompilerPlugin)(
57
59
  // JS/TS options
58
60
  pluginOptions,
@@ -196,6 +198,7 @@ function createServerMainCodeBundleOptions(options, target, sourceFileCache, sty
196
198
  plugins: [
197
199
  (0, wasm_plugin_1.createWasmPlugin)({ allowAsync: zoneless, cache: loadResultCache }),
198
200
  (0, sourcemap_ignorelist_plugin_1.createSourcemapIgnorelistPlugin)(),
201
+ (0, angular_localize_init_warning_plugin_1.createAngularLocalizeInitWarningPlugin)(),
199
202
  (0, compiler_plugin_1.createCompilerPlugin)(
200
203
  // JS/TS options
201
204
  { ...pluginOptions, noopTypeScriptCompilation: true },
@@ -297,6 +300,7 @@ function createSsrEntryCodeBundleOptions(options, target, sourceFileCache, style
297
300
  supported: (0, utils_1.getFeatureSupport)(target, true),
298
301
  plugins: [
299
302
  (0, sourcemap_ignorelist_plugin_1.createSourcemapIgnorelistPlugin)(),
303
+ (0, angular_localize_init_warning_plugin_1.createAngularLocalizeInitWarningPlugin)(),
300
304
  (0, compiler_plugin_1.createCompilerPlugin)(
301
305
  // JS/TS options
302
306
  { ...pluginOptions, noopTypeScriptCompilation: true },
@@ -81,7 +81,7 @@ export declare class ExecutionResult {
81
81
  errors: (PartialMessage | Message)[];
82
82
  externalMetadata: ExternalResultMetadata | undefined;
83
83
  };
84
- get watchFiles(): string[];
84
+ get watchFiles(): Readonly<string[]>;
85
85
  createRebuildState(fileChanges: ChangedFiles): RebuildState;
86
86
  findChangedFiles(previousOutputHashes: Map<string, string>): Set<string>;
87
87
  dispose(): Promise<void>;
@@ -103,16 +103,18 @@ class ExecutionResult {
103
103
  };
104
104
  }
105
105
  get watchFiles() {
106
- // Bundler contexts internally normalize file dependencies
107
- const files = this.rebuildContexts.typescriptContexts
108
- .flatMap((context) => [...context.watchFiles])
109
- .concat(this.rebuildContexts.otherContexts.flatMap((context) => [...context.watchFiles]));
110
- if (this.codeBundleCache?.referencedFiles) {
106
+ const { typescriptContexts, otherContexts } = this.rebuildContexts;
107
+ return [
108
+ // Bundler contexts internally normalize file dependencies.
109
+ ...typescriptContexts.flatMap((context) => [...context.watchFiles]),
110
+ ...otherContexts.flatMap((context) => [...context.watchFiles]),
111
111
  // These files originate from TS/NG and can have POSIX path separators even on Windows.
112
112
  // To ensure path comparisons are valid, all these paths must be normalized.
113
- files.push(...this.codeBundleCache.referencedFiles.map(node_path_1.normalize));
114
- }
115
- return files.concat(this.extraWatchFiles);
113
+ ...(this.codeBundleCache?.referencedFiles?.map(node_path_1.normalize) ?? []),
114
+ // The assets source files.
115
+ ...this.assetFiles.map(({ source }) => source),
116
+ ...this.extraWatchFiles,
117
+ ];
116
118
  }
117
119
  createRebuildState(fileChanges) {
118
120
  return {
@@ -39,12 +39,16 @@ class JavaScriptTransformer {
39
39
  this.#fileCacheKeyBase = Buffer.from(JSON.stringify(this.#commonOptions), 'utf-8');
40
40
  }
41
41
  #ensureWorkerPool() {
42
- this.#workerPool ??= new worker_pool_1.WorkerPool({
42
+ const workerPoolOptions = {
43
43
  filename: require.resolve('./javascript-transformer-worker'),
44
44
  maxThreads: this.maxThreads,
45
- // Prevent passing `--import` (loader-hooks) from parent to child worker.
46
- execArgv: process.execArgv.filter((v) => v !== utils_1.IMPORT_EXEC_ARGV),
47
- });
45
+ };
46
+ // Prevent passing SSR `--import` (loader-hooks) from parent to child worker.
47
+ const filteredExecArgv = process.execArgv.filter((v) => v !== utils_1.IMPORT_EXEC_ARGV);
48
+ if (process.execArgv.length !== filteredExecArgv.length) {
49
+ workerPoolOptions.execArgv = filteredExecArgv;
50
+ }
51
+ this.#workerPool ??= new worker_pool_1.WorkerPool(workerPoolOptions);
48
52
  return this.#workerPool;
49
53
  }
50
54
  /**
@@ -16,6 +16,7 @@ const promises_1 = require("node:fs/promises");
16
16
  const node_path_1 = require("node:path");
17
17
  const load_esm_1 = require("../../../utils/load-esm");
18
18
  const ANGULAR_PREFIX = '/@ng/';
19
+ const VITE_FS_PREFIX = '/@fs/';
19
20
  async function createAngularMemoryPlugin(options) {
20
21
  const { virtualProjectRoot, outputFiles, external } = options;
21
22
  const { normalizePath } = await (0, load_esm_1.loadEsmModule)('vite');
@@ -24,6 +25,9 @@ async function createAngularMemoryPlugin(options) {
24
25
  // Ensures plugin hooks run before built-in Vite hooks
25
26
  enforce: 'pre',
26
27
  async resolveId(source, importer, { ssr }) {
28
+ if (source.startsWith(VITE_FS_PREFIX)) {
29
+ return;
30
+ }
27
31
  // For SSR with component HMR, pass through as a virtual module
28
32
  if (ssr && source.startsWith(ANGULAR_PREFIX)) {
29
33
  return '\0' + source;
@@ -40,6 +44,17 @@ async function createAngularMemoryPlugin(options) {
40
44
  const [importerFile] = importer.split('?', 1);
41
45
  source = '/' + (0, node_path_1.join)((0, node_path_1.dirname)((0, node_path_1.relative)(virtualProjectRoot, importerFile)), source);
42
46
  }
47
+ else if (!ssr &&
48
+ source[0] === '/' &&
49
+ importer.endsWith('index.html') &&
50
+ normalizePath(importer).startsWith(virtualProjectRoot)) {
51
+ // This is only needed when using SSR and `angularSsrMiddleware` (old style) to correctly resolve
52
+ // .js files when using lazy-loading.
53
+ // Remove query if present
54
+ const [importerFile] = importer.split('?', 1);
55
+ source =
56
+ '/' + (0, node_path_1.join)((0, node_path_1.dirname)((0, node_path_1.relative)(virtualProjectRoot, importerFile)), (0, node_path_1.basename)(source));
57
+ }
43
58
  }
44
59
  const [file] = source.split('?', 1);
45
60
  if (outputFiles.has(file)) {
@@ -15,7 +15,7 @@ export type AngularMemoryOutputFiles = Map<string, {
15
15
  export declare function pathnameWithoutBasePath(url: string, basePath: string): string;
16
16
  export declare function lookupMimeTypeFromRequest(url: string): string | undefined;
17
17
  export type EsbuildLoaderOption = Exclude<DepOptimizationConfig['esbuildOptions'], undefined>['loader'];
18
- export declare function getDepOptimizationConfig({ disabled, exclude, include, target, zoneless, prebundleTransformer, ssr, loader, thirdPartySourcemaps, }: {
18
+ export declare function getDepOptimizationConfig({ disabled, exclude, include, target, zoneless, prebundleTransformer, ssr, loader, thirdPartySourcemaps, define, }: {
19
19
  disabled: boolean;
20
20
  exclude: string[];
21
21
  include: string[];
@@ -25,4 +25,5 @@ export declare function getDepOptimizationConfig({ disabled, exclude, include, t
25
25
  zoneless: boolean;
26
26
  loader?: EsbuildLoaderOption;
27
27
  thirdPartySourcemaps: boolean;
28
+ define: Record<string, string> | undefined;
28
29
  }): DepOptimizationConfig;
@@ -28,7 +28,7 @@ function lookupMimeTypeFromRequest(url) {
28
28
  }
29
29
  return extension && (0, mrmime_1.lookup)(extension);
30
30
  }
31
- function getDepOptimizationConfig({ disabled, exclude, include, target, zoneless, prebundleTransformer, ssr, loader, thirdPartySourcemaps, }) {
31
+ function getDepOptimizationConfig({ disabled, exclude, include, target, zoneless, prebundleTransformer, ssr, loader, thirdPartySourcemaps, define = {}, }) {
32
32
  const plugins = [
33
33
  {
34
34
  name: `angular-vite-optimize-deps${ssr ? '-ssr' : ''}${thirdPartySourcemaps ? '-vendor-sourcemap' : ''}`,
@@ -57,6 +57,7 @@ function getDepOptimizationConfig({ disabled, exclude, include, target, zoneless
57
57
  plugins,
58
58
  loader,
59
59
  define: {
60
+ ...define,
60
61
  'ngServerMode': `${ssr}`,
61
62
  },
62
63
  resolveExtensions: ['.mjs', '.js', '.cjs'],
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import { Budget as BudgetEntry, Type as BudgetType } from '../builders/application/schema';
9
9
  export { type BudgetEntry, BudgetType };
10
+ export declare const BYTES_IN_KILOBYTE = 1000;
10
11
  export interface Threshold {
11
12
  limit: number;
12
13
  type: ThresholdType;
@@ -7,13 +7,14 @@
7
7
  * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.ThresholdSeverity = exports.BudgetType = void 0;
10
+ exports.ThresholdSeverity = exports.BYTES_IN_KILOBYTE = exports.BudgetType = void 0;
11
11
  exports.calculateThresholds = calculateThresholds;
12
12
  exports.checkBudgets = checkBudgets;
13
13
  exports.checkThresholds = checkThresholds;
14
14
  const schema_1 = require("../builders/application/schema");
15
15
  Object.defineProperty(exports, "BudgetType", { enumerable: true, get: function () { return schema_1.Type; } });
16
16
  const format_bytes_1 = require("./format-bytes");
17
+ exports.BYTES_IN_KILOBYTE = 1000;
17
18
  var ThresholdType;
18
19
  (function (ThresholdType) {
19
20
  ThresholdType["Max"] = "maximum";
@@ -242,13 +243,13 @@ function calculateBytes(input, baseline, factor = 1) {
242
243
  value = (baselineBytes * value) / 100;
243
244
  break;
244
245
  case 'kb':
245
- value *= 1024;
246
+ value *= exports.BYTES_IN_KILOBYTE;
246
247
  break;
247
248
  case 'mb':
248
- value *= 1024 * 1024;
249
+ value *= exports.BYTES_IN_KILOBYTE * exports.BYTES_IN_KILOBYTE;
249
250
  break;
250
251
  case 'gb':
251
- value *= 1024 * 1024 * 1024;
252
+ value *= exports.BYTES_IN_KILOBYTE * exports.BYTES_IN_KILOBYTE * exports.BYTES_IN_KILOBYTE;
252
253
  break;
253
254
  }
254
255
  if (baselineBytes === 0) {
@@ -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 = '19.0.5';
13
+ const VERSION = '19.0.7';
14
14
  function hasCacheMetadata(value) {
15
15
  return (!!value &&
16
16
  typeof value === 'object' &&
@@ -25,10 +25,10 @@ function patchFetchToLoadInMemoryAssets(baseURL) {
25
25
  url = input;
26
26
  }
27
27
  else if (typeof input === 'string') {
28
- url = new URL(input);
28
+ url = new URL(input, baseURL);
29
29
  }
30
30
  else if (typeof input === 'object' && 'url' in input) {
31
- url = new URL(input.url);
31
+ url = new URL(input.url, baseURL);
32
32
  }
33
33
  else {
34
34
  return originalFetch(input, init);