@angular/build 22.3.0-next.0 → 22.3.0-next.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.
Files changed (141) hide show
  1. package/package.json +13 -13
  2. package/src/builders/application/build-action.js +2 -2
  3. package/src/builders/application/build-action.js.map +1 -1
  4. package/src/builders/application/chunk-optimizer.js +2 -1
  5. package/src/builders/application/chunk-optimizer.js.map +1 -1
  6. package/src/builders/application/index.js +8 -31
  7. package/src/builders/application/index.js.map +1 -1
  8. package/src/builders/application/options.d.ts +1 -3
  9. package/src/builders/application/options.js +2 -3
  10. package/src/builders/application/options.js.map +1 -1
  11. package/src/builders/application/results.d.ts +1 -1
  12. package/src/builders/dev-server/options.js +1 -1
  13. package/src/builders/dev-server/options.js.map +1 -1
  14. package/src/builders/dev-server/vite/server.js +1 -1
  15. package/src/builders/dev-server/vite/server.js.map +1 -1
  16. package/src/builders/dev-server/vite/utils.js +1 -1
  17. package/src/builders/dev-server/vite/utils.js.map +1 -1
  18. package/src/builders/extract-i18n/application-extraction.js +2 -1
  19. package/src/builders/extract-i18n/application-extraction.js.map +1 -1
  20. package/src/builders/karma/assets-middleware.js +1 -1
  21. package/src/builders/karma/assets-middleware.js.map +1 -1
  22. package/src/builders/library/builder-state.d.ts +115 -0
  23. package/src/builders/library/builder-state.js +282 -0
  24. package/src/builders/library/builder-state.js.map +1 -0
  25. package/src/builders/library/builder.js +110 -92
  26. package/src/builders/library/builder.js.map +1 -1
  27. package/src/builders/library/execution-result.d.ts +35 -0
  28. package/src/builders/library/execution-result.js +67 -0
  29. package/src/builders/library/execution-result.js.map +1 -0
  30. package/src/builders/library/index.d.ts +1 -1
  31. package/src/builders/library/index.js.map +1 -1
  32. package/src/builders/library/options.d.ts +9 -0
  33. package/src/builders/library/options.js +29 -23
  34. package/src/builders/library/options.js.map +1 -1
  35. package/src/builders/library/pipeline/assets.d.ts +5 -16
  36. package/src/builders/library/pipeline/assets.js +16 -59
  37. package/src/builders/library/pipeline/assets.js.map +1 -1
  38. package/src/builders/library/pipeline/build-action.d.ts +21 -13
  39. package/src/builders/library/pipeline/build-action.js +76 -124
  40. package/src/builders/library/pipeline/build-action.js.map +1 -1
  41. package/src/builders/library/pipeline/bundler.d.ts +5 -3
  42. package/src/builders/library/pipeline/bundler.js +123 -43
  43. package/src/builders/library/pipeline/bundler.js.map +1 -1
  44. package/src/builders/library/pipeline/compilation.d.ts +7 -26
  45. package/src/builders/library/pipeline/compilation.js +59 -69
  46. package/src/builders/library/pipeline/compilation.js.map +1 -1
  47. package/src/builders/library/pipeline/entry-points.d.ts +26 -6
  48. package/src/builders/library/pipeline/entry-points.js +82 -21
  49. package/src/builders/library/pipeline/entry-points.js.map +1 -1
  50. package/src/builders/library/pipeline/package-manifests.d.ts +2 -1
  51. package/src/builders/library/pipeline/package-manifests.js +50 -1
  52. package/src/builders/library/pipeline/package-manifests.js.map +1 -1
  53. package/src/builders/library/pipeline/stylesheet-bundler.d.ts +4 -1
  54. package/src/builders/library/pipeline/stylesheet-bundler.js +1 -1
  55. package/src/builders/library/pipeline/stylesheet-bundler.js.map +1 -1
  56. package/src/builders/library/pipeline/utils.d.ts +19 -11
  57. package/src/builders/library/pipeline/utils.js +27 -11
  58. package/src/builders/library/pipeline/utils.js.map +1 -1
  59. package/src/builders/library/schema.json +2 -4
  60. package/src/builders/library/types.d.ts +62 -22
  61. package/src/builders/ng-packagr/builder.js +2 -2
  62. package/src/builders/ng-packagr/builder.js.map +1 -1
  63. package/src/builders/unit-test/builder.js +1 -1
  64. package/src/builders/unit-test/builder.js.map +1 -1
  65. package/src/builders/unit-test/options.js +1 -2
  66. package/src/builders/unit-test/options.js.map +1 -1
  67. package/src/builders/unit-test/runners/vitest/executor.js +0 -5
  68. package/src/builders/unit-test/runners/vitest/executor.js.map +1 -1
  69. package/src/builders/unit-test/runners/vitest/plugins.js +13 -1
  70. package/src/builders/unit-test/runners/vitest/plugins.js.map +1 -1
  71. package/src/builders/unit-test/test-discovery.js +4 -2
  72. package/src/builders/unit-test/test-discovery.js.map +1 -1
  73. package/src/private.d.ts +1 -1
  74. package/src/private.js +3 -3
  75. package/src/private.js.map +1 -1
  76. package/src/tools/angular/angular-host.d.ts +1 -1
  77. package/src/tools/angular/angular-host.js +5 -2
  78. package/src/tools/angular/angular-host.js.map +1 -1
  79. package/src/tools/angular/compilation/angular-compilation.d.ts +1 -0
  80. package/src/tools/angular/compilation/angular-compilation.js.map +1 -1
  81. package/src/tools/angular/compilation/aot-compilation.js +325 -80
  82. package/src/tools/angular/compilation/aot-compilation.js.map +1 -1
  83. package/src/tools/angular/compilation/compiler-options.js +4 -1
  84. package/src/tools/angular/compilation/compiler-options.js.map +1 -1
  85. package/src/tools/angular/compilation/jit-compilation.js +5 -4
  86. package/src/tools/angular/compilation/jit-compilation.js.map +1 -1
  87. package/src/tools/angular/compilation/parallel-worker.js +1 -0
  88. package/src/tools/angular/compilation/parallel-worker.js.map +1 -1
  89. package/src/tools/angular/compilation/typescript-compilation.d.ts +2 -0
  90. package/src/tools/angular/compilation/typescript-compilation.js +44 -5
  91. package/src/tools/angular/compilation/typescript-compilation.js.map +1 -1
  92. package/src/tools/esbuild/bundler-context.js +5 -1
  93. package/src/tools/esbuild/bundler-context.js.map +1 -1
  94. package/src/tools/esbuild/persistent-load-result-cache.js +2 -4
  95. package/src/tools/esbuild/persistent-load-result-cache.js.map +1 -1
  96. package/src/tools/esbuild/utils.d.ts +1 -2
  97. package/src/tools/esbuild/utils.js +0 -13
  98. package/src/tools/esbuild/utils.js.map +1 -1
  99. package/src/tools/sass/rebasing-importer.d.ts +1 -1
  100. package/src/tools/sass/rebasing-importer.js +6 -3
  101. package/src/tools/sass/rebasing-importer.js.map +1 -1
  102. package/src/tools/vite/middlewares/assets-middleware.js +1 -1
  103. package/src/tools/vite/middlewares/assets-middleware.js.map +1 -1
  104. package/src/utils/concurrency.d.ts +4 -0
  105. package/src/utils/concurrency.js +5 -0
  106. package/src/utils/concurrency.js.map +1 -1
  107. package/src/utils/delete-output-dir.js +3 -2
  108. package/src/utils/delete-output-dir.js.map +1 -1
  109. package/src/utils/disk-files.d.ts +30 -0
  110. package/src/utils/disk-files.js +68 -0
  111. package/src/utils/disk-files.js.map +1 -0
  112. package/src/utils/index-file/nonce.d.ts +2 -1
  113. package/src/utils/index-file/nonce.js +22 -4
  114. package/src/utils/index-file/nonce.js.map +1 -1
  115. package/src/utils/load-proxy-config.js +12 -10
  116. package/src/utils/load-proxy-config.js.map +1 -1
  117. package/src/utils/load-rolldown.d.ts +27 -0
  118. package/src/utils/load-rolldown.js +79 -0
  119. package/src/utils/load-rolldown.js.map +1 -0
  120. package/src/utils/normalize-asset-patterns.d.ts +18 -3
  121. package/src/utils/normalize-asset-patterns.js +34 -67
  122. package/src/utils/normalize-asset-patterns.js.map +1 -1
  123. package/src/utils/normalize-cache.d.ts +14 -1
  124. package/src/utils/normalize-cache.js +18 -4
  125. package/src/utils/normalize-cache.js.map +1 -1
  126. package/src/utils/postcss-configuration.d.ts +2 -2
  127. package/src/utils/postcss-configuration.js +3 -3
  128. package/src/utils/postcss-configuration.js.map +1 -1
  129. package/src/utils/resolve-assets.js +28 -9
  130. package/src/utils/resolve-assets.js.map +1 -1
  131. package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.d.ts +1 -1
  132. package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.js +3 -3
  133. package/src/utils/server-rendering/esm-in-memory-loader/loader-hooks.js.map +1 -1
  134. package/src/utils/server-rendering/esm-in-memory-loader/register-hooks.js +3 -2
  135. package/src/utils/server-rendering/esm-in-memory-loader/register-hooks.js.map +1 -1
  136. package/src/utils/test-files.js +5 -57
  137. package/src/utils/test-files.js.map +1 -1
  138. package/src/utils/watcher.d.ts +53 -0
  139. package/src/utils/watcher.js +404 -76
  140. package/src/utils/watcher.js.map +1 -1
  141. package/src/builders/library/pipeline/types.d.ts +0 -54
@@ -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
  };
@@ -13,8 +46,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
46
  exports.bundleEntryPoints = bundleEntryPoints;
14
47
  const node_assert_1 = __importDefault(require("node:assert"));
15
48
  const node_path_1 = __importDefault(require("node:path"));
16
- const rolldown_1 = require("rolldown");
17
- const rolldown_plugin_dts_1 = require("rolldown-plugin-dts");
49
+ const load_rolldown_1 = require("../../../utils/load-rolldown");
18
50
  const path_1 = require("../../../utils/path");
19
51
  const utils_1 = require("./utils");
20
52
  const ESM_EXTENSIONS = ['.js', '.mjs', '/index.js', '/index.mjs'];
@@ -24,15 +56,15 @@ const DTS_EXTENSIONS = ['.d.ts', '.d.mts', '/index.d.ts', '/index.d.mts'];
24
56
  * using at most 2 Rolldown instances total (1 for all .mjs bundles, 1 for all .d.ts bundles).
25
57
  *
26
58
  * @param items The collection of entry point inputs with change statuses.
27
- * @param esmFiles Map of virtual ESM output file paths to their content.
28
- * @param dtsFiles Map of virtual TypeScript declaration file paths to their content.
29
- * @param options The normalized library builder options.
59
+ * @param esmFiles Map of virtual POSIX ESM output file paths to their content.
60
+ * @param dtsFiles Map of virtual POSIX TypeScript declaration file paths to their content.
61
+ * @param options The normalized library builder options with POSIX paths.
30
62
  * @returns A promise resolving to the bundled output files and bundle cache results.
31
63
  */
32
64
  async function bundleEntryPoints(items, esmFiles, dtsFiles, options) {
33
65
  const bundleResults = new Map();
34
66
  if (items.length === 0) {
35
- return { filesToEmit: [], bundleResults };
67
+ return { filesToEmit: [], bundleResults, warnings: [] };
36
68
  }
37
69
  const esmEntryPoints = [];
38
70
  const dtsEntryPoints = [];
@@ -50,18 +82,21 @@ async function bundleEntryPoints(items, esmFiles, dtsFiles, options) {
50
82
  ]);
51
83
  for (const { entryPoint, previousBundleResult } of items) {
52
84
  const { bundleName, name } = entryPoint;
85
+ const esmModuleIds = esmOutput.moduleIdsByBundle.get(bundleName);
53
86
  bundleResults.set(name, {
54
- esmModuleIds: esmOutput.moduleIdsByBundle.get(bundleName) ??
55
- previousBundleResult?.esmModuleIds ??
56
- new Set(),
87
+ esmModuleIds: esmModuleIds ?? previousBundleResult?.esmModuleIds ?? new Set(),
57
88
  dtsModuleIds: dtsOutput.moduleIdsByBundle.get(bundleName) ??
58
89
  previousBundleResult?.dtsModuleIds ??
59
90
  new Set(),
91
+ hasTslibImport: esmModuleIds
92
+ ? esmOutput.tslibBundles.has(bundleName)
93
+ : (previousBundleResult?.hasTslibImport ?? false),
60
94
  });
61
95
  }
62
96
  return {
63
97
  filesToEmit: [...esmOutput.filesToEmit, ...dtsOutput.filesToEmit],
64
98
  bundleResults,
99
+ warnings: [...esmOutput.warnings, ...dtsOutput.warnings],
65
100
  };
66
101
  }
67
102
  /**
@@ -69,23 +104,21 @@ async function bundleEntryPoints(items, esmFiles, dtsFiles, options) {
69
104
  *
70
105
  * @param entryPoints The entry points to include in the bundle input map.
71
106
  * @param dtsMode Whether the input map is for declaration files (.d.ts) rather than ESM files (.js).
72
- * @returns A record mapping bundle names to virtual entry file paths.
107
+ * @returns A record mapping bundle names to virtual POSIX entry file paths.
73
108
  */
74
109
  function resolveEntryInputMap(entryPoints, dtsMode) {
75
110
  const input = {};
76
111
  for (const { bundleName, entryFilePath } of entryPoints) {
77
- const posixPath = (0, path_1.toPosixPath)(entryFilePath);
78
112
  input[bundleName] = dtsMode
79
- ? posixPath.replace(/\.([cm]?ts)$/, '.d.$1')
80
- : posixPath.replace(/\.([cm]?)ts$/, '.$1js');
113
+ ? entryFilePath.replace(/\.([cm]?ts)$/, '.d.$1')
114
+ : entryFilePath.replace(/\.([cm]?)ts$/, '.$1js');
81
115
  }
82
116
  return input;
83
117
  }
84
118
  /**
85
- * Creates a Rolldown plugin that loads modules from an in-memory file map
86
- * and prevents illegal cross-entry-point sibling imports.
119
+ * Creates a Rolldown plugin that resolves and loads modules from an in-memory file map.
87
120
  *
88
- * @param files Map of virtual file paths to their content.
121
+ * @param files Map of virtual POSIX file paths to their content.
89
122
  * @param extensions Candidate extensions to probe when resolving extensionless module specifiers.
90
123
  * @param includeMap Whether source map files should also be loaded from the memory map.
91
124
  * @returns A Rolldown plugin instance.
@@ -105,11 +138,7 @@ function createMemoryFileLoaderPlugin(files, extensions, includeMap) {
105
138
  if (id[0] !== '.' && !node_path_1.default.isAbsolute(id)) {
106
139
  return { id, external: true };
107
140
  }
108
- const posixId = (0, path_1.toPosixPath)(id);
109
- const importerPosix = (0, path_1.toPosixPath)(importer);
110
- const resolved = posixId[0] === '.'
111
- ? node_path_1.default.posix.join(node_path_1.default.posix.dirname(importerPosix), posixId)
112
- : posixId;
141
+ const resolved = id[0] === '.' ? node_path_1.default.posix.join(node_path_1.default.posix.dirname(importer), id) : id;
113
142
  let resolvedCandidate;
114
143
  if (files.has(resolved)) {
115
144
  resolvedCandidate = resolved;
@@ -147,12 +176,13 @@ function createMemoryFileLoaderPlugin(files, extensions, includeMap) {
147
176
  * the transitive set of module IDs belonging to each entry point bundle.
148
177
  *
149
178
  * @param output The array of output chunks and assets from Rolldown.
150
- * @param dir The destination output directory prefix.
179
+ * @param dir The destination POSIX output directory prefix.
151
180
  * @returns The processed multi-bundle output.
152
181
  */
153
182
  function processRolldownOutput(output, dir) {
154
183
  const filesToEmit = [];
155
184
  const moduleIdsByBundle = new Map();
185
+ const tslibBundles = new Set();
156
186
  const chunksByFileName = new Map();
157
187
  const entryChunks = [];
158
188
  for (const item of output) {
@@ -184,6 +214,9 @@ function processRolldownOutput(output, dir) {
184
214
  }
185
215
  }
186
216
  for (const depFile of [...chunk.imports, ...chunk.dynamicImports]) {
217
+ if (depFile === 'tslib') {
218
+ tslibBundles.add(entryChunk.name);
219
+ }
187
220
  const depChunk = chunksByFileName.get(depFile);
188
221
  if (depChunk && !visited.has(depChunk)) {
189
222
  queue.push(depChunk);
@@ -191,29 +224,58 @@ function processRolldownOutput(output, dir) {
191
224
  }
192
225
  }
193
226
  }
194
- return { filesToEmit, moduleIdsByBundle };
227
+ return { filesToEmit, moduleIdsByBundle, tslibBundles };
195
228
  }
229
+ /**
230
+ * Set of Rolldown warning codes that should be ignored.
231
+ */
232
+ const IGNORED_ROLLDOWN_WARNING_CODES = new Set([
233
+ 'EMPTY_BUNDLE',
234
+ 'UNUSED_EXTERNAL_IMPORT',
235
+ 'THIS_IS_UNDEFINED',
236
+ ]);
196
237
  /**
197
238
  * Executes a Rolldown bundle build across all provided entry inputs.
198
239
  *
199
- * @param input Map of bundle names to virtual entry file paths.
240
+ * @param input Map of bundle names to virtual POSIX entry file paths.
200
241
  * @param plugins Rolldown plugins to use during bundling.
201
- * @param preserveSymlinks Whether to preserve symlinks during module resolution.
202
242
  * @param extension Output file extension ('mjs' or 'd.ts').
203
- * @param sourcemap Whether to emit sourcemaps.
204
- * @param findEntryPoint Lookup function to resolve chunk entry point ownership.
243
+ * @param options The normalized library options with POSIX paths.
205
244
  * @returns A promise resolving to the multi-bundle output.
206
245
  */
207
- async function executeMultiBundle(input, plugins, preserveSymlinks, extension, sourcemap) {
246
+ async function executeMultiBundle(input, plugins, extension, options) {
247
+ const { workspaceRoot, preserveSymlinks, declarationMap, outputPath } = options;
208
248
  const isDts = extension === 'd.ts';
209
- const dir = isDts ? utils_1.TYPES_OUTPUT_DIR : utils_1.FESM_OUTPUT_DIR;
210
- const bundle = await (0, rolldown_1.rolldown)({
249
+ let sourcemap;
250
+ let dir;
251
+ if (isDts) {
252
+ dir = utils_1.TYPES_OUTPUT_DIR;
253
+ sourcemap = !!declarationMap;
254
+ }
255
+ else {
256
+ dir = utils_1.FESM_OUTPUT_DIR;
257
+ // FESM (.mjs) sourcemaps are always enabled.
258
+ sourcemap = true;
259
+ }
260
+ const warnings = [];
261
+ const { rolldown } = await (0, load_rolldown_1.loadRolldown)();
262
+ const bundle = await rolldown({
211
263
  context: 'this',
212
264
  input,
265
+ cwd: workspaceRoot,
213
266
  plugins,
214
267
  treeshake: false,
215
268
  resolve: { symlinks: !preserveSymlinks },
216
269
  checks: { circularDependency: false },
270
+ onLog(level, log) {
271
+ // Ignore specified warning codes
272
+ if (level === 'warn') {
273
+ if (log.code && IGNORED_ROLLDOWN_WARNING_CODES.has(log.code)) {
274
+ return;
275
+ }
276
+ warnings.push(log.message);
277
+ }
278
+ },
217
279
  experimental: {
218
280
  attachDebugInfo: 'none',
219
281
  },
@@ -221,14 +283,17 @@ async function executeMultiBundle(input, plugins, preserveSymlinks, extension, s
221
283
  try {
222
284
  const { output } = await bundle.generate({
223
285
  format: 'es',
224
- dir,
286
+ dir: node_path_1.default.posix.join(outputPath, dir),
225
287
  entryFileNames: `[name].${extension}`,
226
288
  chunkFileNames: `[name]-[hash].${extension}`,
227
289
  sourcemap,
228
290
  hoistTransitiveImports: false,
229
- comments: { jsdoc: isDts, legal: true, annotation: true },
291
+ comments: { jsdoc: isDts, legal: true, annotation: !isDts },
230
292
  });
231
- return processRolldownOutput(output, dir);
293
+ return {
294
+ ...processRolldownOutput(output, dir),
295
+ warnings,
296
+ };
232
297
  }
233
298
  finally {
234
299
  await bundle.close();
@@ -238,41 +303,56 @@ async function executeMultiBundle(input, plugins, preserveSymlinks, extension, s
238
303
  * Bundles JavaScript ESM output files for all provided entry points.
239
304
  *
240
305
  * @param entryPoints The entry points to bundle.
241
- * @param esmFiles Map of virtual ESM output file paths to contents.
242
- * @param options The normalized library options.
306
+ * @param esmFiles Map of virtual POSIX ESM output file paths to contents.
307
+ * @param options The normalized library options with POSIX paths.
243
308
  * @returns A promise resolving to the multi-bundle output.
244
309
  */
245
310
  async function bundleAllEsm(entryPoints, esmFiles, options) {
246
311
  if (entryPoints.length === 0) {
247
- return { filesToEmit: [], moduleIdsByBundle: new Map() };
312
+ return {
313
+ filesToEmit: [],
314
+ moduleIdsByBundle: new Map(),
315
+ tslibBundles: new Set(),
316
+ warnings: [],
317
+ };
248
318
  }
249
- return executeMultiBundle(resolveEntryInputMap(entryPoints, false), [createMemoryFileLoaderPlugin(esmFiles, ESM_EXTENSIONS, true)], options.preserveSymlinks, 'mjs', true);
319
+ return executeMultiBundle(resolveEntryInputMap(entryPoints, false), [createMemoryFileLoaderPlugin(esmFiles, ESM_EXTENSIONS, true)], 'mjs', options);
250
320
  }
251
321
  /**
252
322
  * Bundles TypeScript declaration (.d.ts) output files for all provided entry points.
253
323
  *
254
324
  * @param entryPoints The entry points to bundle.
255
- * @param dtsFiles Map of virtual declaration output file paths to contents.
256
- * @param options The normalized library options.
325
+ * @param dtsFiles Map of virtual POSIX declaration output file paths to contents.
326
+ * @param options The normalized library options with POSIX paths.
257
327
  * @returns A promise resolving to the multi-bundle output.
258
328
  */
259
329
  async function bundleAllDts(entryPoints, dtsFiles, options) {
260
330
  if (entryPoints.length === 0) {
261
- return { filesToEmit: [], moduleIdsByBundle: new Map() };
331
+ return {
332
+ filesToEmit: [],
333
+ moduleIdsByBundle: new Map(),
334
+ tslibBundles: new Set(),
335
+ warnings: [],
336
+ };
262
337
  }
263
- const dtsSourcemap = options.declarationMap;
338
+ // Ensure Rolldown's native binding is initialized via `loadRolldown()` before evaluating
339
+ // `rolldown-plugin-dts`, which has top-level imports of `rolldown/experimental`.
340
+ await (0, load_rolldown_1.loadRolldown)();
341
+ const { dts } = (await Promise.resolve(`${'rolldown-plugin-dts'}`).then(s => __importStar(require(s))));
342
+ const dtsSourcemap = !!options.declarationMap;
264
343
  // Filter out `rolldown-plugin-dts:resolver` because all `.d.ts` files are already emitted
265
344
  // in-memory by the Angular/TypeScript compilation and resolved via `createMemoryFileLoaderPlugin`.
266
345
  // The default `rolldown-plugin-dts:resolver` plugin performs filesystem resolution (`oxc-resolver`)
267
346
  // and calls `this.load()` on on-disk `.ts` source files, which is unnecessary and causes a
268
347
  // significant performance regression across multi-entry builds.
269
- const rawDtsPlugins = (0, rolldown_plugin_dts_1.dts)({
348
+ const rawDtsPlugins = dts({
270
349
  dtsInput: true,
271
350
  tsconfig: false,
272
351
  sourcemap: dtsSourcemap,
352
+ generator: 'oxc',
273
353
  });
274
354
  const dtsPlugins = rawDtsPlugins.filter((plugin) => plugin.name !== 'rolldown-plugin-dts:resolver');
275
355
  (0, node_assert_1.default)(dtsPlugins.length < rawDtsPlugins.length, 'Expected "rolldown-plugin-dts:resolver" plugin to be present in rolldown-plugin-dts.');
276
- return executeMultiBundle(resolveEntryInputMap(entryPoints, true), [createMemoryFileLoaderPlugin(dtsFiles, DTS_EXTENSIONS, dtsSourcemap), ...dtsPlugins], options.preserveSymlinks, 'd.ts', dtsSourcemap);
356
+ return executeMultiBundle(resolveEntryInputMap(entryPoints, true), [createMemoryFileLoaderPlugin(dtsFiles, DTS_EXTENSIONS, dtsSourcemap), ...dtsPlugins], 'd.ts', options);
277
357
  }
278
358
  //# sourceMappingURL=bundler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bundler.js","sourceRoot":"","sources":["bundler.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;AAyEH,8CA8CC;AArHD,8DAAiC;AACjC,0DAA6B;AAC7B,uCAMkB;AAClB,6DAA0C;AAC1C,8CAAkD;AAElD,mCAKiB;AA8BjB,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,CAAU,CAAC;AAC3E,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,CAAU,CAAC;AAanF;;;;;;;;;GASG;AACI,KAAK,UAAU,iBAAiB,CACrC,KAAuC,EACvC,QAAqC,EACrC,QAAqC,EACrC,OAAiC;IAEjC,MAAM,aAAa,GAAG,IAAI,GAAG,EAAwB,CAAC;IACtD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC;IAC5C,CAAC;IAED,MAAM,cAAc,GAA2B,EAAE,CAAC;IAClD,MAAM,cAAc,GAA2B,EAAE,CAAC;IAElD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;YACrD,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACvC,CAAC;QACD,IAAI,IAAI,CAAC,aAAa,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;YACrD,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IAED,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,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oG;IACpG,2FAA2F;IAC3F,gEAAgE;IAChE,MAAM,aAAa,GAAG,GAAG,CAAC;QACxB,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,KAAK;QACf,SAAS,EAAE,YAAY;QACvB,SAAS,EAAE,KAAK;KACjB,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CACrC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,8BAA8B,CAC3D,CAAC;IAEF,IAAA,qBAAM,EACJ,UAAU,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,EACxC,sFAAsF,CACvF,CAAC;IAEF,OAAO,kBAAkB,CACvB,oBAAoB,CAAC,WAAW,EAAE,IAAI,CAAC,EACvC,CAAC,4BAA4B,CAAC,QAAQ,EAAE,cAAc,EAAE,YAAY,CAAC,EAAE,GAAG,UAAU,CAAC,EACrF,MAAM,EACN,OAAO,CACR,CAAC;AACJ,CAAC"}
@@ -6,34 +6,15 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import type { ComponentStylesheetBundler } from '../../../tools/esbuild/angular/component-stylesheets';
9
- import type { NormalizedEntryPoint, NormalizedLibraryOptions, SingleProgramCache } from '../types';
10
- /**
11
- * Output of the unified library compilation step.
12
- */
13
- export interface LibraryCompilationOutput {
14
- /** Read-only map of emitted JavaScript files. */
15
- readonly esmFiles: ReadonlyMap<string, string>;
16
- /** Read-only map of emitted TypeScript declaration files. */
17
- readonly dtsFiles: ReadonlyMap<string, string>;
18
- /** Set of JavaScript file paths that were modified or newly emitted in this iteration. */
19
- readonly changedEsmFiles: ReadonlySet<string>;
20
- /** Set of declaration file paths that were modified or newly emitted in this iteration. */
21
- readonly changedDtsFiles: ReadonlySet<string>;
22
- /** Set of all source and dependency file paths referenced during compilation. */
23
- readonly referencedFiles: ReadonlySet<string>;
24
- /** Cached compilation state for subsequent incremental builds. */
25
- readonly cache: SingleProgramCache;
26
- /** Promise that resolves to formatted compilation warnings or rejects on diagnostic errors. */
27
- readonly diagnosePromise: Promise<string[]>;
28
- }
9
+ import type { BuilderState } from '../builder-state';
10
+ import type { LibraryCompilationOutput, NormalizedLibraryOptions } from '../types';
29
11
  /**
30
12
  * Compiles all library entry points in a single TypeScript and Angular compilation pass.
31
13
  *
32
- * @param entryPoints The collection of normalized library entry points to compile.
33
- * @param options The normalized library builder options.
14
+ * @param options The normalized library builder options with POSIX paths.
34
15
  * @param stylesheetBundler The component stylesheet bundler instance.
35
- * @param cached Optional cached compilation state from a previous build iteration.
36
- * @param modifiedFiles Optional set of modified file paths for incremental compilation.
37
- * @returns A promise resolving to the compilation output containing emitted files and diagnostics.
16
+ * @param buildState The build state tracking compilation caches, file references, and diagnostics.
17
+ * @param modifiedFiles Optional set of modified POSIX file paths for incremental compilation.
18
+ * @returns A promise resolving to the compilation output containing emitted files and cache state.
38
19
  */
39
- export declare function compileLibrary(entryPoints: Iterable<NormalizedEntryPoint>, options: NormalizedLibraryOptions, stylesheetBundler: ComponentStylesheetBundler, cached?: SingleProgramCache, modifiedFiles?: Set<string>): Promise<LibraryCompilationOutput>;
20
+ export declare function compileLibrary(options: NormalizedLibraryOptions, stylesheetBundler: ComponentStylesheetBundler, buildState: BuilderState, modifiedFiles?: Set<string>): Promise<LibraryCompilationOutput>;
@@ -18,35 +18,36 @@ const EMITTED_EXTENSIONS = ['.js', '.mjs', '.cjs', '.d.ts', '.d.mts', '.d.cts'];
18
18
  /**
19
19
  * Compiles all library entry points in a single TypeScript and Angular compilation pass.
20
20
  *
21
- * @param entryPoints The collection of normalized library entry points to compile.
22
- * @param options The normalized library builder options.
21
+ * @param options The normalized library builder options with POSIX paths.
23
22
  * @param stylesheetBundler The component stylesheet bundler instance.
24
- * @param cached Optional cached compilation state from a previous build iteration.
25
- * @param modifiedFiles Optional set of modified file paths for incremental compilation.
26
- * @returns A promise resolving to the compilation output containing emitted files and diagnostics.
23
+ * @param buildState The build state tracking compilation caches, file references, and diagnostics.
24
+ * @param modifiedFiles Optional set of modified POSIX file paths for incremental compilation.
25
+ * @returns A promise resolving to the compilation output containing emitted files and cache state.
27
26
  */
28
- async function compileLibrary(entryPoints, options, stylesheetBundler, cached, modifiedFiles) {
29
- const { tsConfigPath, compilationMode, preserveSymlinks, colors, declarationMap } = options;
27
+ async function compileLibrary(options, stylesheetBundler, buildState, modifiedFiles) {
28
+ const { tsConfigPath, entryPoints, compilationMode, preserveSymlinks, colors, declarationMap, cacheOptions, } = options;
29
+ const cached = buildState.singleProgramCache;
30
30
  const entryPathsMap = {};
31
31
  const rootFiles = [];
32
- for (const ep of entryPoints) {
32
+ for (const ep of entryPoints.values()) {
33
33
  entryPathsMap[ep.displayName] = [ep.entryFilePath];
34
34
  rootFiles.push(ep.entryFilePath);
35
35
  }
36
36
  const compilationInstance = cached?.compilationInstance ?? (await (0, compilation_1.createAngularCompilation)('aot', false));
37
37
  try {
38
38
  let effectiveModifiedFiles = modifiedFiles;
39
- if (cached?.failedFiles?.size) {
39
+ if (cached && cached.failedFiles.size > 0) {
40
40
  stylesheetBundler.invalidate(cached.failedFiles);
41
- effectiveModifiedFiles = new Set(modifiedFiles);
41
+ const merged = new Set(modifiedFiles);
42
42
  for (const file of cached.failedFiles) {
43
- effectiveModifiedFiles.add(file);
43
+ merged.add(file);
44
44
  }
45
+ effectiveModifiedFiles = merged;
45
46
  }
46
47
  if (effectiveModifiedFiles && effectiveModifiedFiles.size > 0) {
47
48
  await compilationInstance.update?.(effectiveModifiedFiles);
49
+ buildState.clearFileReferences(effectiveModifiedFiles);
48
50
  }
49
- const allReferencedFiles = new Set();
50
51
  const stylesheetWarnings = [];
51
52
  const stylesheetErrors = [];
52
53
  const failedFiles = new Set();
@@ -56,7 +57,12 @@ async function compileLibrary(entryPoints, options, stylesheetBundler, cached, m
56
57
  const result = stylesheetFile
57
58
  ? await stylesheetBundler.bundleFile(stylesheetFile)
58
59
  : await stylesheetBundler.bundleInline(data, containingFile);
59
- result.referencedFiles?.forEach((f) => allReferencedFiles.add((0, path_1.toPosixPath)(f)));
60
+ if (result.referencedFiles) {
61
+ buildState.addFileReferences(containingFile, result.referencedFiles);
62
+ if (stylesheetFile) {
63
+ buildState.addFileReferences(stylesheetFile, result.referencedFiles);
64
+ }
65
+ }
60
66
  if (result.warnings.length > 0) {
61
67
  stylesheetWarnings.push(...result.warnings);
62
68
  }
@@ -72,33 +78,30 @@ async function compileLibrary(entryPoints, options, stylesheetBundler, cached, m
72
78
  },
73
79
  processWebWorker: () => '',
74
80
  };
75
- const { referencedFiles } = await compilationInstance.initialize(tsConfigPath, hostOptions, {
81
+ const { referencedFiles, compilerOptions } = await compilationInstance.initialize(tsConfigPath, hostOptions, {
76
82
  sourcemap: true,
77
83
  preserveSymlinks,
78
84
  rootFiles,
79
85
  declarationMap,
80
86
  compilationMode,
81
87
  paths: entryPathsMap,
88
+ cachePath: cacheOptions.enabled ? cacheOptions.path : undefined,
82
89
  }, 'library');
83
- const emittedFiles = stylesheetErrors.length === 0 ? await compilationInstance.emitAffectedFiles() : [];
84
- const diagnosePromise = runDiagnosticsAndFormat(compilationInstance, stylesheetErrors, stylesheetWarnings, colors);
85
- // Prevent unhandled promise rejection if an error occurs before diagnosePromise is awaited.
86
- diagnosePromise.catch(() => { });
90
+ const hasStylesheetErrors = stylesheetErrors.length > 0;
91
+ const emittedFiles = hasStylesheetErrors ? [] : await compilationInstance.emitAffectedFiles();
92
+ const diagnosePromise = runDiagnosticsAndFormat(compilationInstance, stylesheetErrors, stylesheetWarnings, colors, buildState);
87
93
  const esmFiles = cached?.esmFiles ?? new Map();
88
94
  const dtsFiles = cached?.dtsFiles ?? new Map();
89
95
  const changedEsmFiles = new Set();
90
96
  const changedDtsFiles = new Set();
91
- for (const ref of referencedFiles) {
92
- allReferencedFiles.add((0, path_1.toPosixPath)(ref));
93
- }
94
- if (effectiveModifiedFiles) {
97
+ const posixReferencedFiles = new Set(referencedFiles.map(path_1.toPosixPath));
98
+ if (cached && effectiveModifiedFiles) {
95
99
  for (const modifiedFile of effectiveModifiedFiles) {
96
- const posixModified = (0, path_1.toPosixPath)(modifiedFile);
97
- if (allReferencedFiles.has(posixModified)) {
100
+ if (posixReferencedFiles.has(modifiedFile)) {
98
101
  continue;
99
102
  }
100
- const basePathWithoutExt = posixModified.replace(/(?:\.d\.[cm]?ts|\.[cm]?[jt]sx?)$/i, '');
101
- if (basePathWithoutExt === posixModified || (0, node_fs_1.existsSync)(posixModified)) {
103
+ const basePathWithoutExt = modifiedFile.replace(/(?:\.d\.[cm]?ts|\.[cm]?[jt]sx?)$/i, '');
104
+ if (basePathWithoutExt === modifiedFile || (0, node_fs_1.existsSync)(modifiedFile)) {
102
105
  continue;
103
106
  }
104
107
  for (const ext of EMITTED_EXTENSIONS) {
@@ -117,23 +120,12 @@ async function compileLibrary(entryPoints, options, stylesheetBundler, cached, m
117
120
  }
118
121
  for (const { filename, contents } of emittedFiles) {
119
122
  const normalized = (0, path_1.toPosixPath)(filename);
120
- if (normalized.endsWith('.map')) {
121
- const isDtsMap = (0, utils_1.isDeclarationSourceMapFile)(normalized);
122
- const targetMap = isDtsMap ? dtsFiles : esmFiles;
123
- if (targetMap.get(normalized) !== contents) {
124
- targetMap.set(normalized, contents);
125
- (isDtsMap ? changedDtsFiles : changedEsmFiles).add(normalized.slice(0, -4));
126
- }
127
- }
128
- else if ((0, utils_1.isDeclarationFile)(normalized)) {
129
- if (dtsFiles.get(normalized) !== contents) {
130
- changedDtsFiles.add(normalized);
131
- dtsFiles.set(normalized, contents);
132
- }
133
- }
134
- else if (esmFiles.get(normalized) !== contents) {
135
- changedEsmFiles.add(normalized);
136
- esmFiles.set(normalized, contents);
123
+ const isMap = normalized.endsWith('.map');
124
+ const isDts = isMap ? (0, utils_1.isDeclarationSourceMapFile)(normalized) : (0, utils_1.isDeclarationFile)(normalized);
125
+ const targetFiles = isDts ? dtsFiles : esmFiles;
126
+ if (targetFiles.get(normalized) !== contents) {
127
+ targetFiles.set(normalized, contents);
128
+ (isDts ? changedDtsFiles : changedEsmFiles).add(isMap ? normalized.slice(0, -4) : normalized);
137
129
  }
138
130
  }
139
131
  return {
@@ -141,14 +133,17 @@ async function compileLibrary(entryPoints, options, stylesheetBundler, cached, m
141
133
  dtsFiles,
142
134
  changedEsmFiles,
143
135
  changedDtsFiles,
144
- referencedFiles: allReferencedFiles,
136
+ referencedFiles: posixReferencedFiles,
145
137
  cache: {
146
138
  compilationInstance,
147
139
  esmFiles,
148
140
  dtsFiles,
149
- failedFiles: failedFiles.size > 0 ? failedFiles : undefined,
141
+ failedFiles,
150
142
  },
143
+ hasStylesheetErrors,
151
144
  diagnosePromise,
145
+ declarationMap: !!compilerOptions.declarationMap,
146
+ compilationMode: compilerOptions.compilationMode === 'full' ? 'full' : 'partial',
152
147
  };
153
148
  }
154
149
  catch (error) {
@@ -159,39 +154,34 @@ async function compileLibrary(entryPoints, options, stylesheetBundler, cached, m
159
154
  }
160
155
  }
161
156
  /**
162
- * Validates stylesheet bundling results and runs TypeScript/Angular diagnostics.
157
+ * Formats stylesheet bundling diagnostics and TypeScript/Angular diagnostics
158
+ * and records them on the build state's execution result.
163
159
  *
164
160
  * @param compilationInstance The active Angular compilation instance.
165
161
  * @param stylesheetErrors List of stylesheet bundling errors.
166
162
  * @param stylesheetWarnings List of stylesheet bundling warnings.
167
163
  * @param colors Whether diagnostic messages should be formatted with ANSI colors.
168
- * @returns A promise resolving to formatted warning messages.
169
- * @throws If stylesheet bundling errors or compilation errors occur.
164
+ * @param buildState The build state whose execution result receives the formatted diagnostics.
170
165
  */
171
- async function runDiagnosticsAndFormat(compilationInstance, stylesheetErrors, stylesheetWarnings, colors) {
172
- if (stylesheetErrors.length > 0) {
173
- const formatted = await (0, esbuild_1.formatMessages)(stylesheetErrors, { kind: 'error', color: colors });
174
- throw new Error(`Failed to bundle stylesheet:\n${formatted.join('\n')}`);
175
- }
176
- const warningsOut = [];
177
- if (environment_options_1.useTypeChecking) {
178
- const { errors, warnings } = await compilationInstance.diagnoseFiles();
179
- if (errors?.length) {
180
- const errorMessages = await (0, esbuild_1.formatMessages)(errors, { kind: 'error', color: colors });
181
- throw new Error(`Compilation failed with errors:\n${errorMessages.join('\n')}`);
166
+ async function runDiagnosticsAndFormat(compilationInstance, stylesheetErrors, stylesheetWarnings, colors, buildState) {
167
+ const { executionResult } = buildState;
168
+ const errors = [...stylesheetErrors];
169
+ const warnings = [];
170
+ if (errors.length === 0 && environment_options_1.useTypeChecking) {
171
+ const diagnostics = await compilationInstance.diagnoseFiles();
172
+ if (diagnostics.errors?.length) {
173
+ errors.push(...diagnostics.errors);
182
174
  }
183
- if (warnings?.length) {
184
- const formatted = await (0, esbuild_1.formatMessages)(warnings, { kind: 'warning', color: colors });
185
- warningsOut.push(...formatted);
175
+ if (diagnostics.warnings?.length) {
176
+ warnings.push(...diagnostics.warnings);
186
177
  }
187
178
  }
188
- if (stylesheetWarnings.length > 0) {
189
- const formattedStyleWarnings = await (0, esbuild_1.formatMessages)(stylesheetWarnings, {
190
- kind: 'warning',
191
- color: colors,
192
- });
193
- warningsOut.push(...formattedStyleWarnings);
179
+ warnings.push(...stylesheetWarnings);
180
+ if (errors.length > 0) {
181
+ executionResult.addErrors(await (0, esbuild_1.formatMessages)(errors, { kind: 'error', color: colors }));
182
+ }
183
+ if (warnings.length > 0) {
184
+ executionResult.addWarnings(await (0, esbuild_1.formatMessages)(warnings, { kind: 'warning', color: colors }));
194
185
  }
195
- return warningsOut;
196
186
  }
197
187
  //# sourceMappingURL=compilation.js.map