@angular/build 18.2.7 → 18.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/build",
3
- "version": "18.2.7",
3
+ "version": "18.2.9",
4
4
  "description": "Official build system for Angular",
5
5
  "keywords": [
6
6
  "Angular CLI",
@@ -23,7 +23,7 @@
23
23
  "builders": "builders.json",
24
24
  "dependencies": {
25
25
  "@ampproject/remapping": "2.3.0",
26
- "@angular-devkit/architect": "0.1802.7",
26
+ "@angular-devkit/architect": "0.1802.9",
27
27
  "@babel/core": "7.25.2",
28
28
  "@babel/helper-annotate-as-pure": "7.24.7",
29
29
  "@babel/helper-split-export-declaration": "7.24.7",
@@ -83,10 +83,7 @@ async function optimizeChunks(original, sourcemap) {
83
83
  const result = await bundle.generate({
84
84
  compact: true,
85
85
  sourcemap,
86
- chunkFileNames(chunkInfo) {
87
- // Do not add hash to file name if already present
88
- return /-[a-zA-Z0-9]{8}$/.test(chunkInfo.name) ? '[name].js' : '[name]-[hash].js';
89
- },
86
+ chunkFileNames: (chunkInfo) => `${chunkInfo.name.replace(/-[a-zA-Z0-9]{8}$/, '')}-[hash].js`,
90
87
  });
91
88
  optimizedOutput = result.output;
92
89
  }
@@ -74,6 +74,12 @@ async function* serveWithVite(serverOptions, builderName, builderAction, context
74
74
  browserOptions.ssr = true;
75
75
  // https://nodejs.org/api/process.html#processsetsourcemapsenabledval
76
76
  process.setSourceMapsEnabled(true);
77
+ if (browserOptions.progress !== false) {
78
+ // This is a workaround for https://github.com/angular/angular-cli/issues/28336, which is caused by the interaction between `zone.js` and `listr2`.
79
+ process.once('SIGINT', () => {
80
+ process.kill(process.pid);
81
+ });
82
+ }
77
83
  }
78
84
  // Set all packages as external to support Vite's prebundle caching
79
85
  browserOptions.externalPackages = serverOptions.prebundle;
@@ -314,9 +314,22 @@ function createCompilerPlugin(pluginOptions, styleOptions) {
314
314
  // Store as the returned Uint8Array to allow caching the fully transformed code
315
315
  typeScriptFileCache.set(request, contents);
316
316
  }
317
+ let loader;
318
+ if (useTypeScriptTranspilation || isJS) {
319
+ // TypeScript has transpiled to JS or is already JS
320
+ loader = 'js';
321
+ }
322
+ else if (request.at(-1) === 'x') {
323
+ // TSX and TS have different syntax rules. Only set if input is a TSX file.
324
+ loader = 'tsx';
325
+ }
326
+ else {
327
+ // Otherwise, directly bundle TS
328
+ loader = 'ts';
329
+ }
317
330
  return {
318
331
  contents,
319
- loader: useTypeScriptTranspilation || isJS ? 'js' : 'ts',
332
+ loader,
320
333
  };
321
334
  });
322
335
  build.onLoad({ filter: /\.[cm]?js$/ }, (0, load_result_cache_1.createCachedLoad)(pluginOptions.loadResultCache, async (args) => {
@@ -40,6 +40,25 @@ async function renderSassStylesheet(request) {
40
40
  containingUrl: containingUrl ? (0, node_url_1.fileURLToPath)(containingUrl) : null,
41
41
  },
42
42
  });
43
+ // Wait for the main thread to set the signal to 1 and notify, which tells
44
+ // us that a message can be received on the port.
45
+ // If the main thread is fast, the signal will already be set to 1, and no
46
+ // sleep/notify is necessary.
47
+ // However, there can be a race condition here:
48
+ // - the main thread sets the signal to 1, but does not get to the notify instruction yet
49
+ // - the worker does not pause because the signal is set to 1
50
+ // - the worker very soon enters this method again
51
+ // - this method sets the signal to 0 and sends the message
52
+ // - the signal is 0 and so the `Atomics.wait` call blocks
53
+ // - only now the main thread runs the `notify` from the first invocation, so the
54
+ // worker continues.
55
+ // - but there is no message yet in the port, because the thread should not have been
56
+ // waken up yet.
57
+ // To combat this, wait for a non-0 value _twice_.
58
+ // Almost every time, this immediately continues with "not-equal", because
59
+ // the signal is still set to 1, except during the race condition, when the second
60
+ // wait will wait for the correct notify.
61
+ Atomics.wait(importerChannel.signal, 0, 0);
43
62
  Atomics.wait(importerChannel.signal, 0, 0);
44
63
  const result = (0, node_worker_threads_1.receiveMessageOnPort)(importerChannel.port)?.message;
45
64
  return result ? (0, node_url_1.pathToFileURL)(result) : null;
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.normalizeCacheOptions = normalizeCacheOptions;
11
11
  const node_path_1 = require("node:path");
12
12
  /** Version placeholder is replaced during the build process with actual package version */
13
- const VERSION = '18.2.7';
13
+ const VERSION = '18.2.9';
14
14
  function hasCacheMetadata(value) {
15
15
  return (!!value &&
16
16
  typeof value === 'object' &&
@@ -19,6 +19,7 @@ function getSupportedBrowsers(projectRoot, logger) {
19
19
  'last 2 Edge major versions',
20
20
  'last 2 Safari major versions',
21
21
  'last 2 iOS major versions',
22
+ 'last 2 Android major versions',
22
23
  'Firefox ESR',
23
24
  ];
24
25
  // Get browsers from config or default.