@angular-devkit/build-angular 17.1.0-next.2 → 17.1.0-rc.0

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 (57) hide show
  1. package/builders.json +5 -0
  2. package/package.json +24 -20
  3. package/src/builders/app-shell/index.js +7 -0
  4. package/src/builders/application/build-action.d.ts +4 -3
  5. package/src/builders/application/build-action.js +8 -5
  6. package/src/builders/application/execute-build.js +10 -4
  7. package/src/builders/application/index.d.ts +20 -10
  8. package/src/builders/application/index.js +38 -26
  9. package/src/builders/application/options.d.ts +11 -3
  10. package/src/builders/application/options.js +42 -30
  11. package/src/builders/application/schema.d.ts +32 -2
  12. package/src/builders/application/schema.json +40 -2
  13. package/src/builders/browser-esbuild/index.js +8 -4
  14. package/src/builders/dev-server/vite-server.js +7 -13
  15. package/src/builders/jest/index.js +2 -2
  16. package/src/builders/prerender/index.js +7 -0
  17. package/src/builders/ssr-dev-server/index.js +17 -31
  18. package/src/builders/web-test-runner/builder-status-warnings.d.ts +11 -0
  19. package/src/builders/web-test-runner/builder-status-warnings.js +46 -0
  20. package/src/builders/web-test-runner/index.d.ts +10 -0
  21. package/src/builders/web-test-runner/index.js +151 -0
  22. package/src/builders/web-test-runner/jasmine_runner.js +88 -0
  23. package/src/builders/web-test-runner/options.d.ts +24 -0
  24. package/src/builders/web-test-runner/options.js +26 -0
  25. package/src/builders/web-test-runner/schema.d.ts +188 -0
  26. package/src/builders/web-test-runner/schema.js +15 -0
  27. package/src/builders/web-test-runner/schema.json +291 -0
  28. package/src/builders/web-test-runner/test_page.html +40 -0
  29. package/src/tools/esbuild/angular/angular-host.js +1 -1
  30. package/src/tools/esbuild/angular/compiler-plugin.js +10 -26
  31. package/src/tools/esbuild/angular/component-stylesheets.d.ts +3 -6
  32. package/src/tools/esbuild/angular/component-stylesheets.js +46 -60
  33. package/src/tools/esbuild/angular/jit-plugin-callbacks.js +2 -2
  34. package/src/tools/esbuild/bundler-context.d.ts +1 -1
  35. package/src/tools/esbuild/bundler-context.js +18 -2
  36. package/src/tools/esbuild/cache.d.ts +88 -0
  37. package/src/tools/esbuild/cache.js +92 -0
  38. package/src/tools/esbuild/compiler-plugin-options.js +1 -1
  39. package/src/tools/esbuild/index-html-generator.js +3 -1
  40. package/src/tools/esbuild/javascript-transformer-worker.d.ts +2 -2
  41. package/src/tools/esbuild/javascript-transformer-worker.js +12 -5
  42. package/src/tools/esbuild/javascript-transformer.d.ts +3 -1
  43. package/src/tools/esbuild/javascript-transformer.js +42 -17
  44. package/src/tools/esbuild/stylesheets/bundle-options.d.ts +1 -1
  45. package/src/tools/esbuild/stylesheets/sass-language.js +3 -12
  46. package/src/tools/esbuild/stylesheets/stylesheet-plugin-factory.js +9 -1
  47. package/src/tools/esbuild/utils.d.ts +2 -2
  48. package/src/tools/esbuild/utils.js +61 -74
  49. package/src/tools/sass/lexer.d.ts +0 -11
  50. package/src/tools/sass/lexer.js +1 -87
  51. package/src/utils/index-file/index-html-generator.js +15 -28
  52. package/src/utils/index.d.ts +1 -0
  53. package/src/utils/index.js +1 -0
  54. package/src/{builders/dev-server → utils}/load-proxy-config.js +2 -2
  55. package/src/{builders/jest → utils}/test-files.d.ts +1 -2
  56. package/src/{builders/jest → utils}/test-files.js +3 -3
  57. /package/src/{builders/dev-server → utils}/load-proxy-config.d.ts +0 -0
@@ -33,6 +33,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
33
33
  exports.SassStylesheetLanguage = exports.shutdownSassWorkerPool = void 0;
34
34
  const node_path_1 = require("node:path");
35
35
  const node_url_1 = require("node:url");
36
+ const cache_1 = require("../cache");
36
37
  let sassWorkerPool;
37
38
  let sassWorkerPoolPromise;
38
39
  function isSassException(error) {
@@ -81,16 +82,6 @@ function parsePackageName(url) {
81
82
  },
82
83
  };
83
84
  }
84
- class Cache extends Map {
85
- async getOrCreate(key, creator) {
86
- let value = this.get(key);
87
- if (value === undefined) {
88
- value = await creator();
89
- this.set(key, value);
90
- }
91
- return value;
92
- }
93
- }
94
85
  async function compileString(data, filePath, syntax, options, resolveUrl) {
95
86
  // Lazily load Sass when a Sass file is found
96
87
  if (sassWorkerPool === undefined) {
@@ -105,8 +96,8 @@ async function compileString(data, filePath, syntax, options, resolveUrl) {
105
96
  // A null value indicates that the cached resolution attempt failed to find a location and
106
97
  // later stage resolution should be attempted. This avoids potentially expensive repeat
107
98
  // failing resolution attempts.
108
- const resolutionCache = new Cache();
109
- const packageRootCache = new Cache();
99
+ const resolutionCache = new cache_1.MemoryCache();
100
+ const packageRootCache = new cache_1.MemoryCache();
110
101
  const warnings = [];
111
102
  try {
112
103
  const { css, sourceMap, loadedUrls } = await sassWorkerPool.compileStringAsync(data, {
@@ -49,7 +49,15 @@ let postcss;
49
49
  *
50
50
  * Based on https://tailwindcss.com/docs/functions-and-directives
51
51
  */
52
- const TAILWIND_KEYWORDS = ['@tailwind', '@layer', '@apply', '@config', 'theme(', 'screen('];
52
+ const TAILWIND_KEYWORDS = [
53
+ '@tailwind',
54
+ '@layer',
55
+ '@apply',
56
+ '@config',
57
+ 'theme(',
58
+ 'screen(',
59
+ '@screen', // Undocumented in version 3, see: https://github.com/tailwindlabs/tailwindcss/discussions/7516.
60
+ ];
53
61
  /**
54
62
  * Cached postcss instances that can be re-used between various StylesheetPluginFactory instances.
55
63
  */
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import { BuilderContext } from '@angular-devkit/architect';
9
9
  import { BuildOptions, Metafile, OutputFile, PartialMessage } from 'esbuild';
10
+ import { NormalizedOutputOptions } from '../../builders/application/options';
10
11
  import { BudgetCalculatorResult } from '../../utils/bundle-calculator';
11
12
  import { BuildOutputFile, BuildOutputFileType, InitialFileRecord } from './bundler-context';
12
13
  import { BuildOutputAsset } from './bundler-execution-result';
@@ -25,12 +26,11 @@ export declare function logMessages(context: BuilderContext, { errors, warnings
25
26
  * @returns An object that can be used with the esbuild build `supported` option.
26
27
  */
27
28
  export declare function getFeatureSupport(target: string[]): BuildOptions['supported'];
28
- export declare function writeResultFiles(outputFiles: BuildOutputFile[], assetFiles: BuildOutputAsset[] | undefined, outputPath: string): Promise<void>;
29
+ export declare function writeResultFiles(outputFiles: BuildOutputFile[], assetFiles: BuildOutputAsset[] | undefined, { base, browser, media, server }: NormalizedOutputOptions): Promise<void>;
29
30
  export declare function emitFilesToDisk<T = BuildOutputAsset | BuildOutputFile>(files: T[], writeFileCallback: (file: T) => Promise<void>): Promise<void>;
30
31
  export declare function createOutputFileFromText(path: string, text: string, type: BuildOutputFileType): BuildOutputFile;
31
32
  export declare function createOutputFileFromData(path: string, data: Uint8Array, type: BuildOutputFileType): BuildOutputFile;
32
33
  export declare function convertOutputFile(file: OutputFile, type: BuildOutputFileType): BuildOutputFile;
33
- export declare function getFullOutputPath(file: BuildOutputFile): string;
34
34
  /**
35
35
  * Transform browserlists result to esbuild target.
36
36
  * @see https://esbuild.github.io/api/#target
@@ -6,46 +6,21 @@
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.io/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
- };
32
9
  var __importDefault = (this && this.__importDefault) || function (mod) {
33
10
  return (mod && mod.__esModule) ? mod : { "default": mod };
34
11
  };
35
12
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.getSupportedNodeTargets = exports.transformSupportedBrowsersToTargets = exports.getFullOutputPath = exports.convertOutputFile = exports.createOutputFileFromData = exports.createOutputFileFromText = exports.emitFilesToDisk = exports.writeResultFiles = exports.getFeatureSupport = exports.logMessages = exports.withNoProgress = exports.withSpinner = exports.calculateEstimatedTransferSizes = exports.logBuildStats = void 0;
13
+ exports.getSupportedNodeTargets = exports.transformSupportedBrowsersToTargets = exports.convertOutputFile = exports.createOutputFileFromData = exports.createOutputFileFromText = exports.emitFilesToDisk = exports.writeResultFiles = exports.getFeatureSupport = exports.logMessages = exports.withNoProgress = exports.withSpinner = exports.calculateEstimatedTransferSizes = exports.logBuildStats = void 0;
37
14
  const esbuild_1 = require("esbuild");
38
15
  const node_crypto_1 = require("node:crypto");
39
16
  const node_fs_1 = require("node:fs");
40
17
  const promises_1 = __importDefault(require("node:fs/promises"));
41
- const node_path_1 = __importStar(require("node:path"));
42
- const node_util_1 = require("node:util");
18
+ const node_path_1 = __importDefault(require("node:path"));
43
19
  const node_zlib_1 = require("node:zlib");
44
20
  const semver_1 = require("semver");
45
21
  const spinner_1 = require("../../utils/spinner");
46
22
  const stats_1 = require("../webpack/utils/stats");
47
23
  const bundler_context_1 = require("./bundler-context");
48
- const compressAsync = (0, node_util_1.promisify)(node_zlib_1.brotliCompress);
49
24
  function logBuildStats(context, metafile, initial, budgetFailures, changedFiles, estimatedTransferSizes) {
50
25
  const stats = [];
51
26
  let unchangedCount = 0;
@@ -90,22 +65,41 @@ function logBuildStats(context, metafile, initial, budgetFailures, changedFiles,
90
65
  exports.logBuildStats = logBuildStats;
91
66
  async function calculateEstimatedTransferSizes(outputFiles) {
92
67
  const sizes = new Map();
93
- const pendingCompression = [];
94
- for (const outputFile of outputFiles) {
95
- // Only calculate JavaScript and CSS files
96
- if (!outputFile.path.endsWith('.js') && !outputFile.path.endsWith('.css')) {
97
- continue;
68
+ if (outputFiles.length <= 0) {
69
+ return sizes;
70
+ }
71
+ return new Promise((resolve, reject) => {
72
+ let completeCount = 0;
73
+ for (const outputFile of outputFiles) {
74
+ // Only calculate JavaScript and CSS files
75
+ if (!outputFile.path.endsWith('.js') && !outputFile.path.endsWith('.css')) {
76
+ ++completeCount;
77
+ continue;
78
+ }
79
+ // Skip compressing small files which may end being larger once compressed and will most likely not be
80
+ // compressed in actual transit.
81
+ if (outputFile.contents.byteLength < 1024) {
82
+ sizes.set(outputFile.path, outputFile.contents.byteLength);
83
+ ++completeCount;
84
+ continue;
85
+ }
86
+ // Directly use the async callback function to minimize the number of Promises that need to be created.
87
+ (0, node_zlib_1.brotliCompress)(outputFile.contents, (error, result) => {
88
+ if (error) {
89
+ reject(error);
90
+ return;
91
+ }
92
+ sizes.set(outputFile.path, result.byteLength);
93
+ if (++completeCount >= outputFiles.length) {
94
+ resolve(sizes);
95
+ }
96
+ });
98
97
  }
99
- // Skip compressing small files which may end being larger once compressed and will most likely not be
100
- // compressed in actual transit.
101
- if (outputFile.contents.byteLength < 1024) {
102
- sizes.set(outputFile.path, outputFile.contents.byteLength);
103
- continue;
98
+ // Covers the case where no files need to be compressed
99
+ if (completeCount >= outputFiles.length) {
100
+ resolve(sizes);
104
101
  }
105
- pendingCompression.push(compressAsync(outputFile.contents).then((result) => sizes.set(outputFile.path, result.byteLength)));
106
- }
107
- await Promise.all(pendingCompression);
108
- return sizes;
102
+ });
109
103
  }
110
104
  exports.calculateEstimatedTransferSizes = calculateEstimatedTransferSizes;
111
105
  async function withSpinner(text, action) {
@@ -182,31 +176,45 @@ function getFeatureSupport(target) {
182
176
  return supported;
183
177
  }
184
178
  exports.getFeatureSupport = getFeatureSupport;
185
- async function writeResultFiles(outputFiles, assetFiles, outputPath) {
179
+ async function writeResultFiles(outputFiles, assetFiles, { base, browser, media, server }) {
186
180
  const directoryExists = new Set();
187
- const ensureDirectoryExists = async (basePath) => {
188
- if (basePath && !directoryExists.has(basePath)) {
189
- await promises_1.default.mkdir(node_path_1.default.join(outputPath, basePath), { recursive: true });
181
+ const ensureDirectoryExists = async (destPath) => {
182
+ const basePath = node_path_1.default.dirname(destPath);
183
+ if (!directoryExists.has(basePath)) {
184
+ await promises_1.default.mkdir(node_path_1.default.join(base, basePath), { recursive: true });
190
185
  directoryExists.add(basePath);
191
186
  }
192
187
  };
193
188
  // Writes the output file to disk and ensures the containing directories are present
194
189
  await emitFilesToDisk(outputFiles, async (file) => {
195
- const fullOutputPath = file.fullOutputPath;
190
+ let outputDir;
191
+ switch (file.type) {
192
+ case bundler_context_1.BuildOutputFileType.Browser:
193
+ case bundler_context_1.BuildOutputFileType.Media:
194
+ outputDir = browser;
195
+ break;
196
+ case bundler_context_1.BuildOutputFileType.Server:
197
+ outputDir = server;
198
+ break;
199
+ case bundler_context_1.BuildOutputFileType.Root:
200
+ outputDir = '';
201
+ break;
202
+ default:
203
+ throw new Error(`Unhandled write for file "${file.path}" with type "${bundler_context_1.BuildOutputFileType[file.type]}".`);
204
+ }
205
+ const destPath = node_path_1.default.join(outputDir, file.path);
196
206
  // Ensure output subdirectories exist
197
- const basePath = node_path_1.default.dirname(fullOutputPath);
198
- await ensureDirectoryExists(basePath);
207
+ await ensureDirectoryExists(destPath);
199
208
  // Write file contents
200
- await promises_1.default.writeFile(node_path_1.default.join(outputPath, fullOutputPath), file.contents);
209
+ await promises_1.default.writeFile(node_path_1.default.join(base, destPath), file.contents);
201
210
  });
202
211
  if (assetFiles?.length) {
203
212
  await emitFilesToDisk(assetFiles, async ({ source, destination }) => {
213
+ const destPath = node_path_1.default.join(browser, destination);
204
214
  // Ensure output subdirectories exist
205
- const destPath = (0, node_path_1.join)('browser', destination);
206
- const basePath = node_path_1.default.dirname(destPath);
207
- await ensureDirectoryExists(basePath);
215
+ await ensureDirectoryExists(destPath);
208
216
  // Copy file contents
209
- await promises_1.default.copyFile(source, node_path_1.default.join(outputPath, destPath), node_fs_1.constants.COPYFILE_FICLONE);
217
+ await promises_1.default.copyFile(source, node_path_1.default.join(base, destPath), node_fs_1.constants.COPYFILE_FICLONE);
210
218
  });
211
219
  }
212
220
  }
@@ -235,9 +243,6 @@ function createOutputFileFromText(path, text, type) {
235
243
  get contents() {
236
244
  return Buffer.from(this.text, 'utf-8');
237
245
  },
238
- get fullOutputPath() {
239
- return getFullOutputPath(this);
240
- },
241
246
  clone() {
242
247
  return createOutputFileFromText(this.path, this.text, this.type);
243
248
  },
@@ -257,9 +262,6 @@ function createOutputFileFromData(path, data, type) {
257
262
  get contents() {
258
263
  return data;
259
264
  },
260
- get fullOutputPath() {
261
- return getFullOutputPath(this);
262
- },
263
265
  clone() {
264
266
  return createOutputFileFromData(this.path, this.contents, this.type);
265
267
  },
@@ -276,27 +278,12 @@ function convertOutputFile(file, type) {
276
278
  get text() {
277
279
  return Buffer.from(this.contents.buffer, this.contents.byteOffset, this.contents.byteLength).toString('utf-8');
278
280
  },
279
- get fullOutputPath() {
280
- return getFullOutputPath(this);
281
- },
282
281
  clone() {
283
282
  return convertOutputFile(this, this.type);
284
283
  },
285
284
  };
286
285
  }
287
286
  exports.convertOutputFile = convertOutputFile;
288
- function getFullOutputPath(file) {
289
- switch (file.type) {
290
- case bundler_context_1.BuildOutputFileType.Browser:
291
- case bundler_context_1.BuildOutputFileType.Media:
292
- return (0, node_path_1.join)('browser', file.path);
293
- case bundler_context_1.BuildOutputFileType.Server:
294
- return (0, node_path_1.join)('server', file.path);
295
- default:
296
- return file.path;
297
- }
298
- }
299
- exports.getFullOutputPath = getFullOutputPath;
300
287
  /**
301
288
  * Transform browserlists result to esbuild target.
302
289
  * @see https://esbuild.github.io/api/#target
@@ -16,14 +16,3 @@ export declare function findUrls(contents: string): Iterable<{
16
16
  end: number;
17
17
  value: string;
18
18
  }>;
19
- /**
20
- * Scans a CSS or Sass file and locates all valid import/use directive values as defined by the
21
- * syntax specification.
22
- * @param contents A string containing a CSS or Sass file to scan.
23
- * @returns An iterable that yields each CSS directive value found.
24
- */
25
- export declare function findImports(contents: string): Iterable<{
26
- start: number;
27
- end: number;
28
- specifier: string;
29
- }>;
@@ -7,7 +7,7 @@
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.findImports = exports.findUrls = void 0;
10
+ exports.findUrls = void 0;
11
11
  // TODO: Combine everything into a single pass lexer
12
12
  /**
13
13
  * Determines if a unicode code point is a CSS whitespace character.
@@ -159,89 +159,3 @@ function* findUrls(contents) {
159
159
  }
160
160
  }
161
161
  exports.findUrls = findUrls;
162
- /**
163
- * Scans a CSS or Sass file and locates all valid import/use directive values as defined by the
164
- * syntax specification.
165
- * @param contents A string containing a CSS or Sass file to scan.
166
- * @returns An iterable that yields each CSS directive value found.
167
- */
168
- function* findImports(contents) {
169
- yield* find(contents, '@import ');
170
- yield* find(contents, '@use ');
171
- }
172
- exports.findImports = findImports;
173
- /**
174
- * Scans a CSS or Sass file and locates all valid function/directive values as defined by the
175
- * syntax specification.
176
- * @param contents A string containing a CSS or Sass file to scan.
177
- * @param prefix The prefix to start a valid segment.
178
- * @returns An iterable that yields each CSS url function value found.
179
- */
180
- function* find(contents, prefix) {
181
- let pos = 0;
182
- let width = 1;
183
- let current = -1;
184
- const next = () => {
185
- pos += width;
186
- current = contents.codePointAt(pos) ?? -1;
187
- width = current > 0xffff ? 2 : 1;
188
- return current;
189
- };
190
- // Based on https://www.w3.org/TR/css-syntax-3/#consume-ident-like-token
191
- while ((pos = contents.indexOf(prefix, pos)) !== -1) {
192
- // Set to position of the last character in prefix
193
- pos += prefix.length - 1;
194
- width = 1;
195
- // Consume all leading whitespace
196
- while (isWhitespace(next())) {
197
- /* empty */
198
- }
199
- // Initialize URL state
200
- const url = { start: pos, end: -1, specifier: '' };
201
- let complete = false;
202
- // If " or ', then consume the value as a string
203
- if (current === 0x0022 || current === 0x0027) {
204
- const ending = current;
205
- // Based on https://www.w3.org/TR/css-syntax-3/#consume-string-token
206
- while (!complete) {
207
- switch (next()) {
208
- case -1: // EOF
209
- return;
210
- case 0x000a: // line feed
211
- case 0x000c: // form feed
212
- case 0x000d: // carriage return
213
- // Invalid
214
- complete = true;
215
- break;
216
- case 0x005c: // \ -- character escape
217
- // If not EOF or newline, add the character after the escape
218
- switch (next()) {
219
- case -1:
220
- return;
221
- case 0x000a: // line feed
222
- case 0x000c: // form feed
223
- case 0x000d: // carriage return
224
- // Skip when inside a string
225
- break;
226
- default:
227
- // TODO: Handle hex escape codes
228
- url.specifier += String.fromCodePoint(current);
229
- break;
230
- }
231
- break;
232
- case ending:
233
- // Full string position should include the quotes for replacement
234
- url.end = pos + 1;
235
- complete = true;
236
- yield url;
237
- break;
238
- default:
239
- url.specifier += String.fromCodePoint(current);
240
- break;
241
- }
242
- }
243
- next();
244
- continue;
245
- }
246
- }
247
- }
@@ -6,33 +6,10 @@
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.io/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
- };
32
9
  Object.defineProperty(exports, "__esModule", { value: true });
33
10
  exports.IndexHtmlGenerator = void 0;
34
- const fs = __importStar(require("fs"));
35
- const path_1 = require("path");
11
+ const promises_1 = require("node:fs/promises");
12
+ const node_path_1 = require("node:path");
36
13
  const strip_bom_1 = require("../strip-bom");
37
14
  const augment_index_html_1 = require("./augment-index-html");
38
15
  const inline_critical_css_1 = require("./inline-critical-css");
@@ -85,10 +62,20 @@ class IndexHtmlGenerator {
85
62
  };
86
63
  }
87
64
  async readAsset(path) {
88
- return fs.promises.readFile(path, 'utf-8');
65
+ try {
66
+ return await (0, promises_1.readFile)(path, 'utf-8');
67
+ }
68
+ catch {
69
+ throw new Error(`Failed to read asset "${path}".`);
70
+ }
89
71
  }
90
72
  async readIndex(path) {
91
- return fs.promises.readFile(path, 'utf-8');
73
+ try {
74
+ return await (0, promises_1.readFile)(path, 'utf-8');
75
+ }
76
+ catch {
77
+ throw new Error(`Failed to read index HTML file "${path}".`);
78
+ }
92
79
  }
93
80
  }
94
81
  exports.IndexHtmlGenerator = IndexHtmlGenerator;
@@ -104,7 +91,7 @@ function augmentIndexHtmlPlugin(generator) {
104
91
  sri,
105
92
  lang,
106
93
  entrypoints,
107
- loadOutputFile: (filePath) => generator.readAsset((0, path_1.join)(outputPath, filePath)),
94
+ loadOutputFile: (filePath) => generator.readAsset((0, node_path_1.join)(outputPath, filePath)),
108
95
  imageDomains,
109
96
  files,
110
97
  hints,
@@ -8,6 +8,7 @@
8
8
  export * from './default-progress';
9
9
  export * from './delete-output-dir';
10
10
  export * from './run-module-as-observable-fork';
11
+ export * from './load-proxy-config';
11
12
  export * from './normalize-file-replacements';
12
13
  export * from './normalize-asset-patterns';
13
14
  export * from './normalize-source-maps';
@@ -24,6 +24,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
24
24
  __exportStar(require("./default-progress"), exports);
25
25
  __exportStar(require("./delete-output-dir"), exports);
26
26
  __exportStar(require("./run-module-as-observable-fork"), exports);
27
+ __exportStar(require("./load-proxy-config"), exports);
27
28
  __exportStar(require("./normalize-file-replacements"), exports);
28
29
  __exportStar(require("./normalize-asset-patterns"), exports);
29
30
  __exportStar(require("./normalize-source-maps"), exports);
@@ -37,8 +37,8 @@ const promises_1 = require("node:fs/promises");
37
37
  const node_path_1 = require("node:path");
38
38
  const node_url_1 = require("node:url");
39
39
  const picomatch_1 = require("picomatch");
40
- const error_1 = require("../../utils/error");
41
- const load_esm_1 = require("../../utils/load-esm");
40
+ const error_1 = require("./error");
41
+ const load_esm_1 = require("./load-esm");
42
42
  async function loadProxyConfiguration(root, proxyConfig, normalize = false) {
43
43
  if (!proxyConfig) {
44
44
  return undefined;
@@ -6,7 +6,6 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  import fastGlob from 'fast-glob';
9
- import { JestBuilderOptions } from './options';
10
9
  /**
11
10
  * Finds all test files in the project.
12
11
  *
@@ -16,4 +15,4 @@ import { JestBuilderOptions } from './options';
16
15
  * testing purposes.
17
16
  * @returns A set of all test files in the project.
18
17
  */
19
- export declare function findTestFiles(options: JestBuilderOptions, workspaceRoot: string, glob?: typeof fastGlob): Promise<Set<string>>;
18
+ export declare function findTestFiles(include: string[], exclude: string[], workspaceRoot: string, glob?: typeof fastGlob): Promise<Set<string>>;
@@ -21,14 +21,14 @@ const fast_glob_1 = __importDefault(require("fast-glob"));
21
21
  * testing purposes.
22
22
  * @returns A set of all test files in the project.
23
23
  */
24
- async function findTestFiles(options, workspaceRoot, glob = fast_glob_1.default) {
24
+ async function findTestFiles(include, exclude, workspaceRoot, glob = fast_glob_1.default) {
25
25
  const globOptions = {
26
26
  cwd: workspaceRoot,
27
- ignore: ['node_modules/**'].concat(options.exclude),
27
+ ignore: ['node_modules/**'].concat(exclude),
28
28
  braceExpansion: false, // Do not expand `a{b,c}` to `ab,ac`.
29
29
  extglob: false, // Disable "extglob" patterns.
30
30
  };
31
- const included = await Promise.all(options.include.map((pattern) => glob(pattern, globOptions)));
31
+ const included = await Promise.all(include.map((pattern) => glob(pattern, globOptions)));
32
32
  // Flatten and deduplicate any files found in multiple include patterns.
33
33
  return new Set(included.flat());
34
34
  }