@angular/build 22.1.3 → 22.1.4

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 (44) hide show
  1. package/package.json +4 -4
  2. package/src/builders/application/chunk-optimizer.js +1 -0
  3. package/src/builders/application/chunk-optimizer.js.map +1 -1
  4. package/src/builders/application/execute-build.js +2 -1
  5. package/src/builders/application/execute-build.js.map +1 -1
  6. package/src/builders/application/setup-bundling.js +2 -2
  7. package/src/builders/application/setup-bundling.js.map +1 -1
  8. package/src/builders/dev-server/internal.d.ts +1 -1
  9. package/src/builders/dev-server/internal.js +2 -2
  10. package/src/builders/dev-server/internal.js.map +1 -1
  11. package/src/builders/dev-server/vite/server.js +4 -2
  12. package/src/builders/dev-server/vite/server.js.map +1 -1
  13. package/src/builders/unit-test/options.js +1 -1
  14. package/src/builders/unit-test/options.js.map +1 -1
  15. package/src/private.d.ts +1 -1
  16. package/src/private.js +2 -2
  17. package/src/private.js.map +1 -1
  18. package/src/tools/babel/plugins/oxc-transform.js +8 -4
  19. package/src/tools/babel/plugins/oxc-transform.js.map +1 -1
  20. package/src/tools/esbuild/angular/compiler-plugin.js +1 -1
  21. package/src/tools/esbuild/angular/compiler-plugin.js.map +1 -1
  22. package/src/tools/esbuild/i18n-inliner-worker.d.ts +8 -4
  23. package/src/tools/esbuild/i18n-inliner-worker.js +40 -7
  24. package/src/tools/esbuild/i18n-inliner-worker.js.map +1 -1
  25. package/src/tools/esbuild/i18n-inliner.js +33 -3
  26. package/src/tools/esbuild/i18n-inliner.js.map +1 -1
  27. package/src/tools/esbuild/sqlite-cache-store.js +51 -1
  28. package/src/tools/esbuild/sqlite-cache-store.js.map +1 -1
  29. package/src/tools/esbuild/target.d.ts +29 -0
  30. package/src/tools/esbuild/target.js +105 -0
  31. package/src/tools/esbuild/target.js.map +1 -0
  32. package/src/tools/esbuild/utils.d.ts +0 -10
  33. package/src/tools/esbuild/utils.js +0 -58
  34. package/src/tools/esbuild/utils.js.map +1 -1
  35. package/src/tools/vite/utils.d.ts +2 -1
  36. package/src/tools/vite/utils.js +2 -1
  37. package/src/tools/vite/utils.js.map +1 -1
  38. package/src/utils/bundle-calculator.js +12 -3
  39. package/src/utils/bundle-calculator.js.map +1 -1
  40. package/src/utils/normalize-cache.js +1 -1
  41. package/src/utils/server-rendering/manifest.js +9 -4
  42. package/src/utils/server-rendering/manifest.js.map +1 -1
  43. package/src/utils/source-map.js +23 -34
  44. package/src/utils/source-map.js.map +1 -1
@@ -19,9 +19,11 @@ interface InlineFileRequest {
19
19
  */
20
20
  locale: string;
21
21
  /**
22
- * The translation messages for the locale that should be used during the inlining process of the file.
22
+ * The serialized translation messages for the locale that should be used during the inlining
23
+ * process of the file. A Blob is used so that the messages are shared with the Worker by
24
+ * reference instead of being copied into it for every request.
23
25
  */
24
- translation?: Record<string, unknown>;
26
+ translation?: Blob;
25
27
  }
26
28
  /**
27
29
  * The options passed to the inliner for each code request
@@ -40,9 +42,11 @@ interface InlineCodeRequest {
40
42
  */
41
43
  locale: string;
42
44
  /**
43
- * The translation messages for the locale that should be used during the inlining process of the file.
45
+ * The serialized translation messages for the locale that should be used during the inlining
46
+ * process of the file. A Blob is used so that the messages are shared with the Worker by
47
+ * reference instead of being copied into it for every request.
44
48
  */
45
- translation?: Record<string, unknown>;
49
+ translation?: Blob;
46
50
  }
47
51
  /**
48
52
  * Inlines the provided locale and translation into a JavaScript file that contains `$localize` usage.
@@ -48,11 +48,40 @@ exports.inlineCode = inlineCode;
48
48
  const remapping_1 = __importDefault(require("@ampproject/remapping"));
49
49
  const magic_string_1 = require("magic-string");
50
50
  const node_assert_1 = __importDefault(require("node:assert"));
51
+ const node_v8_1 = require("node:v8");
51
52
  const node_worker_threads_1 = require("node:worker_threads");
52
53
  const oxc_parser_1 = require("oxc-parser");
53
54
  // Extract the application files and common options used for inline requests from the Worker context
54
- // TODO: Evaluate overall performance difference of passing translations here as well
55
55
  const { files, missingTranslation, shouldOptimize } = (node_worker_threads_1.workerData || {});
56
+ /**
57
+ * The translation messages deserialized for the locale most recently requested of this Worker.
58
+ * Locales are inlined one at a time, so retaining only the active locale is enough to avoid
59
+ * deserializing the messages once per file while holding at most one set of messages in memory.
60
+ */
61
+ let activeTranslation;
62
+ /**
63
+ * Deserializes the translation messages for an inline request, reusing the result for any
64
+ * subsequent request that targets the same locale.
65
+ * @param request An inline request containing the locale and its serialized messages.
66
+ * @returns The translation messages, or undefined if the locale has no translations.
67
+ */
68
+ function loadTranslation(request) {
69
+ const { locale, translation } = request;
70
+ if (!translation) {
71
+ return undefined;
72
+ }
73
+ if (activeTranslation?.locale !== locale) {
74
+ activeTranslation = {
75
+ locale,
76
+ // Deserializing within the stored promise ensures that concurrent requests for a locale
77
+ // share the one deserialization instead of each performing their own.
78
+ messages: translation
79
+ .arrayBuffer()
80
+ .then((buffer) => (0, node_v8_1.deserialize)(new Uint8Array(buffer))),
81
+ };
82
+ }
83
+ return activeTranslation.messages;
84
+ }
56
85
  /**
57
86
  * Inlines the provided locale and translation into a JavaScript file that contains `$localize` usage.
58
87
  * This function is the main entry for the Worker's action that is called by the worker pool.
@@ -65,7 +94,7 @@ async function inlineFile(request) {
65
94
  (0, node_assert_1.default)(data !== undefined, `Invalid inline request for file '${request.filename}'.`);
66
95
  const code = await data.text();
67
96
  const map = await files.get(request.filename + '.map')?.text();
68
- const result = await transformWithOxc(code, map && JSON.parse(map), request);
97
+ const result = await transformWithOxc(code, map && JSON.parse(map), request, await loadTranslation(request));
69
98
  return {
70
99
  file: request.filename,
71
100
  code: result.code,
@@ -81,7 +110,7 @@ async function inlineFile(request) {
81
110
  * @returns An object containing the inlined code.
82
111
  */
83
112
  async function inlineCode(request) {
84
- const result = await transformWithOxc(request.code, undefined, request);
113
+ const result = await transformWithOxc(request.code, undefined, request, await loadTranslation(request));
85
114
  return {
86
115
  output: result.code,
87
116
  messages: result.diagnostics.messages,
@@ -109,9 +138,10 @@ async function loadLocalizeTools() {
109
138
  * @param code A string containing the JavaScript code to transform.
110
139
  * @param map A sourcemap object for the provided JavaScript code.
111
140
  * @param options The inline request options to use.
141
+ * @param translation The translation messages to inline, or undefined for an untranslated locale.
112
142
  * @returns An object containing the code, map, and diagnostics from the transformation.
113
143
  */
114
- async function transformWithOxc(code, map, options) {
144
+ async function transformWithOxc(code, map, options, translation) {
115
145
  const { program } = (0, oxc_parser_1.parseSync)(options.filename, code, {
116
146
  sourceType: 'unambiguous',
117
147
  });
@@ -132,7 +162,7 @@ async function transformWithOxc(code, map, options) {
132
162
  const cooked = node.quasi.quasis.map((q) => q.value.cooked);
133
163
  const raw = node.quasi.quasis.map((q) => q.value.raw);
134
164
  const messageParts = Object.assign(cooked, { raw });
135
- const [translatedParts, translatedSubstitutions] = translate(diagnostics, options.translation || {}, messageParts, node.quasi.expressions.map((_, index) => index), options.translation === undefined ? 'ignore' : missingTranslation);
165
+ const [translatedParts, translatedSubstitutions] = translate(diagnostics, translation || {}, messageParts, node.quasi.expressions.map((_, index) => index), translation === undefined ? 'ignore' : missingTranslation);
136
166
  // Reconstruct the new template/string literal replacement
137
167
  let replacement;
138
168
  if (translatedSubstitutions.length === 0) {
@@ -164,12 +194,15 @@ async function transformWithOxc(code, map, options) {
164
194
  const outputCode = magicString.toString();
165
195
  let outputMap;
166
196
  if (map && magicString.hasChanged()) {
167
- const rawMap = magicString.generateMap({
197
+ // A decoded map is generated here rather than an encoded one because remapping decodes its
198
+ // inputs. Encoding the mappings only for remapping to immediately decode them again doubles
199
+ // the peak memory of the largest structure involved in inlining a file.
200
+ const rawMap = magicString.generateDecodedMap({
168
201
  source: options.filename,
169
202
  includeContent: true,
170
203
  hires: 'boundary',
171
204
  });
172
- outputMap = (0, remapping_1.default)([rawMap, map], () => null);
205
+ outputMap = (0, remapping_1.default)([{ ...rawMap, version: 3 }, map], () => null);
173
206
  }
174
207
  return {
175
208
  code: outputCode,
@@ -1 +1 @@
1
- {"version":3,"file":"i18n-inliner-worker.js","sourceRoot":"","sources":["i18n-inliner-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GAAG,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;4BACjE,WAAW,IAAI,IAAI,GAAG,QAAQ,GAAG,GAAG,CAAC;wBACvC,CAAC;oBACH,CAAC;oBACD,WAAW,IAAI,GAAG,CAAC;gBACrB,CAAC;gBAED,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEvB,MAAM,UAAU,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;IAC1C,IAAI,SAAS,CAAC;IACd,IAAI,GAAG,IAAI,WAAW,CAAC,UAAU,EAAE,EAAE,CAAC;QACpC,2FAA2F;QAC3F,4FAA4F;QAC5F,wEAAwE;QACxE,MAAM,MAAM,GAAG,WAAW,CAAC,kBAAkB,CAAC;YAC5C,MAAM,EAAE,OAAO,CAAC,QAAQ;YACxB,cAAc,EAAE,IAAI;YACpB,KAAK,EAAE,UAAU;SAClB,CAAC,CAAC;QACH,SAAS,GAAG,IAAA,mBAAS,EAAC,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,EAA6B,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IACjG,CAAC;IAED,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,GAAG,EAAE,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;QAC3C,WAAW;KACZ,CAAC;AACJ,CAAC"}
@@ -14,6 +14,7 @@ exports.I18nInliner = void 0;
14
14
  const node_assert_1 = __importDefault(require("node:assert"));
15
15
  const node_crypto_1 = require("node:crypto");
16
16
  const node_path_1 = require("node:path");
17
+ const node_v8_1 = require("node:v8");
17
18
  const worker_pool_1 = require("../../utils/worker-pool");
18
19
  const bundler_files_1 = require("./bundler-files");
19
20
  const cache_1 = require("./cache");
@@ -22,6 +23,19 @@ const cache_1 = require("./cache");
22
23
  * This keyword is used to avoid processing files that would not otherwise need i18n processing.
23
24
  */
24
25
  const LOCALIZE_KEYWORD = '$localize';
26
+ /**
27
+ * Serializes the translation messages for a locale for transfer to an inliner Worker.
28
+ *
29
+ * A Blob is used because cloning one shares its data by reference, whereas sending the messages
30
+ * themselves copies them into a Worker for every request that carries them. A locale can contain
31
+ * tens of thousands of messages, which makes that copy the dominant cost of inlining a locale.
32
+ *
33
+ * @param translation The translation messages for a locale, if the locale has any.
34
+ * @returns A Blob containing the serialized messages, or undefined if the locale has none.
35
+ */
36
+ function serializeTranslation(translation) {
37
+ return translation && new Blob([(0, node_v8_1.serialize)(translation)]);
38
+ }
25
39
  /**
26
40
  * A class that performs i18n translation inlining of JavaScript code.
27
41
  * A worker pool is used to distribute the transformation actions and allow
@@ -103,6 +117,8 @@ class I18nInliner {
103
117
  async inlineForLocale(locale, translation) {
104
118
  await this.initCache();
105
119
  const { shouldOptimize, missingTranslation } = this.options;
120
+ // Serialized once here and then shared by the request for every file of this locale
121
+ const translationBlob = serializeTranslation(translation);
106
122
  // Request inlining for each file that contains localize calls
107
123
  const requests = [];
108
124
  let fileCacheKeyBase;
@@ -113,7 +129,12 @@ class I18nInliner {
113
129
  }
114
130
  let cacheResultPromise = Promise.resolve(null);
115
131
  if (this.#cache) {
116
- fileCacheKeyBase ??= Buffer.from(JSON.stringify({ locale, translation, missingTranslation, shouldOptimize }), 'utf-8');
132
+ // The options are digested here so that each file's key is derived from a fixed number
133
+ // of bytes. Hashing the options directly would re-hash the full set of messages, which
134
+ // can be several megabytes, once for every file.
135
+ fileCacheKeyBase ??= (0, node_crypto_1.createHash)('sha256')
136
+ .update(JSON.stringify({ locale, translation, missingTranslation, shouldOptimize }))
137
+ .digest();
117
138
  // NOTE: If additional options are added, this may need to be updated.
118
139
  // TODO: Consider xxhash or similar instead of SHA256
119
140
  cacheKey = (0, node_crypto_1.createHash)('sha256')
@@ -128,7 +149,11 @@ class I18nInliner {
128
149
  if (cachedResult) {
129
150
  return cachedResult;
130
151
  }
131
- const result = await this.#workerPool.run({ filename, locale, translation });
152
+ const result = await this.#workerPool.run({
153
+ filename,
154
+ locale,
155
+ translation: translationBlob,
156
+ });
132
157
  if (this.#cache && cacheKey) {
133
158
  try {
134
159
  // Failure to set the value should not fail the transform
@@ -180,7 +205,12 @@ class I18nInliner {
180
205
  warnings: [],
181
206
  };
182
207
  }
183
- const { output, messages } = await this.#workerPool.run({ code: templateCode, filename: templateId, locale, translation }, { name: 'inlineCode' });
208
+ const { output, messages } = await this.#workerPool.run({
209
+ code: templateCode,
210
+ filename: templateId,
211
+ locale,
212
+ translation: serializeTranslation(translation),
213
+ }, { name: 'inlineCode' });
184
214
  const errors = [];
185
215
  const warnings = [];
186
216
  for (const message of messages) {
@@ -1 +1 @@
1
- {"version":3,"file":"i18n-inliner.js","sourceRoot":"","sources":["i18n-inliner.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;AAEH,8DAAiC;AACjC,6CAAyC;AACzC,yCAA0C;AAC1C,yDAAqD;AACrD,mDAA8F;AAC9F,mCAAgF;AAEhF;;;GAGG;AACH,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAYrC;;;;;GAKG;AACH,MAAa,WAAW;IAQH;IAPnB,gBAAgB,GAAG,KAAK,CAAC;IACzB,WAAW,CAAa;IACxB,MAAM,CAAmC;IAChC,cAAc,CAAuC;IACrD,gBAAgB,CAAyB;IAElD,YACmB,OAA2B,EAC5C,UAAmB;QADF,YAAO,GAAP,OAAO,CAAoB;QAG5C,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC;QACpE,MAAM,KAAK,GAAG,IAAI,GAAG,EAA2B,CAAC;QAEjD,MAAM,WAAW,GAAG,EAAE,CAAC;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B,CAAC;iBAAM,CAAC;gBACN,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;QAED,OAAO;YACL,IAAI,EAAE,MAAM;YACZ,MAAM;YACN,QAAQ;SACT,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,KAAK;QACT,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,SAAS;QACrB,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACzC,OAAO;QACT,CAAC;QAED,MAAM,EAAE,mBAAmB,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7C,sEAAsE;QACtE,IAAI,CAAC,mBAAmB,IAAI,OAAO,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC;YAC1D,OAAO;QACT,CAAC;QAED,0DAA0D;QAC1D,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,GAAG,MAAM,IAAA,kCAA0B,EAAC,IAAA,gBAAI,EAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC,CAAC;QAC5F,CAAC;QAAC,MAAM,CAAC;YACP,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAE7B,sCAAsC;YACtC,OAAO,CAAC,IAAI,CACV,kDAAkD;gBAChD,gFAAgF,CACnF,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AA1QD,kCA0QC"}
@@ -19,6 +19,8 @@ class SqliteCacheStore {
19
19
  #hasStmt;
20
20
  #setStmt;
21
21
  #updateAccessedStmt;
22
+ #pendingAccessedKeys = new Set();
23
+ #flushTimeout;
22
24
  constructor(cachePath, maxPayloadSize = 1024 * 1024 * 1024, ttlDays = 14) {
23
25
  this.cachePath = cachePath;
24
26
  this.maxPayloadSize = maxPayloadSize;
@@ -31,6 +33,9 @@ class SqliteCacheStore {
31
33
  this.#db.exec('PRAGMA auto_vacuum = FULL;');
32
34
  this.#db.exec('PRAGMA journal_mode = WAL;');
33
35
  this.#db.exec('PRAGMA synchronous = NORMAL;');
36
+ this.#db.exec('PRAGMA busy_timeout = 5000;');
37
+ this.#db.exec('PRAGMA temp_store = MEMORY;');
38
+ this.#db.exec('PRAGMA mmap_size = 268435456;');
34
39
  this.#db.exec('CREATE TABLE IF NOT EXISTS cache (key TEXT PRIMARY KEY, value TEXT, last_accessed INTEGER NOT NULL) WITHOUT ROWID;');
35
40
  this.#getStmt = this.#db.prepare('SELECT value FROM cache WHERE key = ?');
36
41
  this.#hasStmt = this.#db.prepare('SELECT 1 FROM cache WHERE key = ?');
@@ -39,12 +44,49 @@ class SqliteCacheStore {
39
44
  }
40
45
  return this.#db;
41
46
  }
47
+ #queueAccessUpdate(key) {
48
+ this.#pendingAccessedKeys.add(key);
49
+ if (this.#pendingAccessedKeys.size >= 100) {
50
+ this.#flushAccessUpdates();
51
+ }
52
+ else if (!this.#flushTimeout) {
53
+ this.#flushTimeout = setTimeout(() => this.#flushAccessUpdates(), 500);
54
+ this.#flushTimeout.unref?.();
55
+ }
56
+ }
57
+ #flushAccessUpdates() {
58
+ if (this.#flushTimeout) {
59
+ clearTimeout(this.#flushTimeout);
60
+ this.#flushTimeout = undefined;
61
+ }
62
+ if (!this.#db || this.#pendingAccessedKeys.size === 0 || !this.#updateAccessedStmt) {
63
+ return;
64
+ }
65
+ try {
66
+ this.#db.exec('BEGIN IMMEDIATE TRANSACTION;');
67
+ for (const key of this.#pendingAccessedKeys) {
68
+ this.#updateAccessedStmt.run(key);
69
+ }
70
+ this.#db.exec('COMMIT;');
71
+ }
72
+ catch {
73
+ try {
74
+ this.#db.exec('ROLLBACK;');
75
+ }
76
+ catch {
77
+ // Ignore rollback errors if transaction was not active
78
+ }
79
+ }
80
+ finally {
81
+ this.#pendingAccessedKeys.clear();
82
+ }
83
+ }
42
84
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
85
  async get(key) {
44
86
  this.#ensureDb();
45
87
  const row = this.#getStmt?.get(key);
46
88
  if (row) {
47
- this.#updateAccessedStmt?.run(key);
89
+ this.#queueAccessUpdate(key);
48
90
  try {
49
91
  return JSON.parse(row.value);
50
92
  }
@@ -60,6 +102,7 @@ class SqliteCacheStore {
60
102
  }
61
103
  async set(key, value) {
62
104
  this.#ensureDb();
105
+ this.#pendingAccessedKeys.delete(key);
63
106
  this.#setStmt?.run(key, JSON.stringify(value));
64
107
  return this;
65
108
  }
@@ -69,6 +112,8 @@ class SqliteCacheStore {
69
112
  close() {
70
113
  if (this.#db) {
71
114
  try {
115
+ // Flush any pending access updates in one transaction before pruning
116
+ this.#flushAccessUpdates();
72
117
  // 1. Delete items older than N days
73
118
  this.#db
74
119
  .prepare("DELETE FROM cache WHERE last_accessed < unixepoch('now', ?);")
@@ -89,6 +134,11 @@ class SqliteCacheStore {
89
134
  // Pruning errors should not block build success
90
135
  }
91
136
  finally {
137
+ if (this.#flushTimeout) {
138
+ clearTimeout(this.#flushTimeout);
139
+ this.#flushTimeout = undefined;
140
+ }
141
+ this.#pendingAccessedKeys.clear();
92
142
  this.#getStmt = undefined;
93
143
  this.#hasStmt = undefined;
94
144
  this.#setStmt = undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"sqlite-cache-store.js","sourceRoot":"","sources":["sqlite-cache-store.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,6CAA0D;AAC1D,mCAAsD;AAEtD,MAAa,gBAAgB;IAQhB;IACQ;IACA;IATnB,GAAG,CAA2B;IAC9B,QAAQ,CAA4B;IACpC,QAAQ,CAA4B;IACpC,QAAQ,CAA4B;IACpC,mBAAmB,CAA4B;IAE/C,YACW,SAAiB,EACT,iBAAiB,IAAI,GAAG,IAAI,GAAG,IAAI,EACnC,UAAU,EAAE;QAFpB,cAAS,GAAT,SAAS,CAA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H,CAAC;IACH,CAAC;CACF;AA7JD,4CA6JC"}
@@ -0,0 +1,29 @@
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
+ /**
9
+ * Transform browserlists result to esbuild target.
10
+ *
11
+ * Only the lowest version for each browser is returned to avoid issues with esbuild and rolldown
12
+ * when multiple versions of the same target engine are specified.
13
+ *
14
+ * @see https://esbuild.github.io/api/#target
15
+ * @see https://github.com/evanw/esbuild/issues/4509
16
+ * @see https://github.com/rolldown/rolldown/issues/10633
17
+ */
18
+ export declare function transformSupportedBrowsersToTargets(supportedBrowsers: string[]): string[];
19
+ /**
20
+ * Transform supported Node.js versions to esbuild target.
21
+ *
22
+ * Only the lowest Node.js version is returned to avoid issues with esbuild and rolldown
23
+ * when multiple versions of the same target engine are specified.
24
+ *
25
+ * @see https://esbuild.github.io/api/#target
26
+ * @see https://github.com/evanw/esbuild/issues/4509
27
+ * @see https://github.com/rolldown/rolldown/issues/10633
28
+ */
29
+ export declare function getSupportedNodeTargets(): string[];
@@ -0,0 +1,105 @@
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.transformSupportedBrowsersToTargets = transformSupportedBrowsersToTargets;
11
+ exports.getSupportedNodeTargets = getSupportedNodeTargets;
12
+ const semver_1 = require("semver");
13
+ /**
14
+ * Compares two target version strings.
15
+ *
16
+ * This function is used to determine the lowest version for a given browser target.
17
+ *
18
+ * @param a The first version string.
19
+ * @param b The second version string.
20
+ * @returns A negative value if `a` is lower than `b`, a positive value if `a` is higher than `b`, and 0 if they are equal.
21
+ */
22
+ function compareTargetVersions(a, b) {
23
+ const aVersion = (0, semver_1.coerce)(a);
24
+ const bVersion = (0, semver_1.coerce)(b);
25
+ if (!aVersion || !bVersion) {
26
+ return aVersion ? -1 : bVersion ? 1 : 0;
27
+ }
28
+ return (0, semver_1.compare)(aVersion, bVersion);
29
+ }
30
+ // https://esbuild.github.io/api/#target
31
+ const ESBUILD_SUPPORTED_BROWSERS = new Set([
32
+ 'chrome',
33
+ 'edge',
34
+ 'firefox',
35
+ 'ie',
36
+ 'ios',
37
+ 'node',
38
+ 'opera',
39
+ 'safari',
40
+ ]);
41
+ /**
42
+ * Transform browserlists result to esbuild target.
43
+ *
44
+ * Only the lowest version for each browser is returned to avoid issues with esbuild and rolldown
45
+ * when multiple versions of the same target engine are specified.
46
+ *
47
+ * @see https://esbuild.github.io/api/#target
48
+ * @see https://github.com/evanw/esbuild/issues/4509
49
+ * @see https://github.com/rolldown/rolldown/issues/10633
50
+ */
51
+ function transformSupportedBrowsersToTargets(supportedBrowsers) {
52
+ const browsers = new Map();
53
+ for (const browser of supportedBrowsers) {
54
+ let [browserName, version] = browser.toLowerCase().split(' ');
55
+ if (!browserName || !version) {
56
+ continue;
57
+ }
58
+ // browserslist uses the name `ios_saf` for iOS Safari whereas esbuild uses `ios`
59
+ if (browserName === 'ios_saf') {
60
+ browserName = 'ios';
61
+ }
62
+ if (!ESBUILD_SUPPORTED_BROWSERS.has(browserName)) {
63
+ continue;
64
+ }
65
+ // browserslist uses ranges `15.2-15.3` versions but only the lowest is required
66
+ // to perform minimum supported feature checks. esbuild also expects a single version.
67
+ [version] = version.split('-');
68
+ if (browserName === 'safari' && version === 'tp') {
69
+ // esbuild only supports numeric versions so `TP` is converted to a high number (999) since
70
+ // a Technology Preview (TP) of Safari is assumed to support all currently known features.
71
+ version = '999';
72
+ }
73
+ else if (!version.includes('.')) {
74
+ // A lone major version is considered by esbuild to include all minor versions. However,
75
+ // browserslist does not and is also inconsistent in its `.0` version naming. For example,
76
+ // Safari 15.0 is named `safari 15` but Safari 16.0 is named `safari 16.0`.
77
+ version += '.0';
78
+ }
79
+ const current = browsers.get(browserName);
80
+ if (!current || compareTargetVersions(version, current) < 0) {
81
+ browsers.set(browserName, version);
82
+ }
83
+ }
84
+ return Array.from(browsers, ([browserName, version]) => browserName + version);
85
+ }
86
+ const SUPPORTED_NODE_VERSIONS = '^22.22.3 || ^24.15.0 || >=26.0.0';
87
+ /**
88
+ * Transform supported Node.js versions to esbuild target.
89
+ *
90
+ * Only the lowest Node.js version is returned to avoid issues with esbuild and rolldown
91
+ * when multiple versions of the same target engine are specified.
92
+ *
93
+ * @see https://esbuild.github.io/api/#target
94
+ * @see https://github.com/evanw/esbuild/issues/4509
95
+ * @see https://github.com/rolldown/rolldown/issues/10633
96
+ */
97
+ function getSupportedNodeTargets() {
98
+ if (SUPPORTED_NODE_VERSIONS.charAt(0) === '0') {
99
+ // Unlike `pkg_npm`, `ts_library` which is used to run unit tests does not support substitutions.
100
+ return [];
101
+ }
102
+ const parsed = (0, semver_1.minVersion)(SUPPORTED_NODE_VERSIONS);
103
+ return parsed ? ['node' + parsed.version] : [];
104
+ }
105
+ //# sourceMappingURL=target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target.js","sourceRoot":"","sources":["target.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AA8CH,kFAwCC;AAcD,0DASC;AA3GD,mCAAqD;AAErD;;;;;;;;GAQG;AACH,SAAS,qBAAqB,CAAC,CAAS,EAAE,CAAS;IACjD,MAAM,QAAQ,GAAG,IAAA,eAAM,EAAC,CAAC,CAAC,CAAC;IAC3B,MAAM,QAAQ,GAAG,IAAA,eAAM,EAAC,CAAC,CAAC,CAAC;IAE3B,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC3B,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,IAAA,gBAAO,EAAC,QA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O,IAAI,qBAAqB,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5D,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,WAAW,GAAG,OAAO,CAAC,CAAC;AACjF,CAAC;AAED,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AAErD;;;;;;;;;GASG;AACH,SAAgB,uBAAuB;IACrC,IAAI,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;QAC9C,iGAAiG;QACjG,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,uBAAuB,CAAC,CAAC;IAEnD,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACjD,CAAC"}
@@ -24,16 +24,6 @@ export declare function withNoProgress<T>(text: string, action: () => T | Promis
24
24
  */
25
25
  export declare function getFeatureSupport(nativeAsyncAwait: boolean): BuildOptions['supported'];
26
26
  export declare function emitFilesToDisk<T = BuildOutputAsset | BuildOutputFile>(files: T[], writeFileCallback: (file: T) => Promise<void>): Promise<void>;
27
- /**
28
- * Transform browserlists result to esbuild target.
29
- * @see https://esbuild.github.io/api/#target
30
- */
31
- export declare function transformSupportedBrowsersToTargets(supportedBrowsers: string[]): string[];
32
- /**
33
- * Transform supported Node.js versions to esbuild target.
34
- * @see https://esbuild.github.io/api/#target
35
- */
36
- export declare function getSupportedNodeTargets(): string[];
37
27
  export declare function createJsonBuildManifest(result: ExecutionResult, normalizedOptions: NormalizedApplicationBuildOptions): Promise<string>;
38
28
  export declare function logMessages(logger: BuilderContext['logger'], executionResult: ExecutionResult, color?: boolean, jsonLogs?: boolean): Promise<void>;
39
29
  /**
@@ -14,8 +14,6 @@ exports.withSpinner = withSpinner;
14
14
  exports.withNoProgress = withNoProgress;
15
15
  exports.getFeatureSupport = getFeatureSupport;
16
16
  exports.emitFilesToDisk = emitFilesToDisk;
17
- exports.transformSupportedBrowsersToTargets = transformSupportedBrowsersToTargets;
18
- exports.getSupportedNodeTargets = getSupportedNodeTargets;
19
17
  exports.createJsonBuildManifest = createJsonBuildManifest;
20
18
  exports.logMessages = logMessages;
21
19
  exports.isZonelessApp = isZonelessApp;
@@ -25,7 +23,6 @@ const listr2_1 = require("listr2");
25
23
  const node_path_1 = require("node:path");
26
24
  const node_url_1 = require("node:url");
27
25
  const node_zlib_1 = require("node:zlib");
28
- const semver_1 = require("semver");
29
26
  const schema_1 = require("../../builders/application/schema");
30
27
  const stats_table_1 = require("../../utils/stats-table");
31
28
  const bundler_files_1 = require("./bundler-files");
@@ -178,61 +175,6 @@ async function emitFilesToDisk(files, writeFileCallback) {
178
175
  await Promise.all(actions);
179
176
  }
180
177
  }
181
- /**
182
- * Transform browserlists result to esbuild target.
183
- * @see https://esbuild.github.io/api/#target
184
- */
185
- function transformSupportedBrowsersToTargets(supportedBrowsers) {
186
- const transformed = [];
187
- // https://esbuild.github.io/api/#target
188
- const esBuildSupportedBrowsers = new Set([
189
- 'chrome',
190
- 'edge',
191
- 'firefox',
192
- 'ie',
193
- 'ios',
194
- 'node',
195
- 'opera',
196
- 'safari',
197
- ]);
198
- for (const browser of supportedBrowsers) {
199
- let [browserName, version] = browser.toLowerCase().split(' ');
200
- // browserslist uses the name `ios_saf` for iOS Safari whereas esbuild uses `ios`
201
- if (browserName === 'ios_saf') {
202
- browserName = 'ios';
203
- }
204
- // browserslist uses ranges `15.2-15.3` versions but only the lowest is required
205
- // to perform minimum supported feature checks. esbuild also expects a single version.
206
- [version] = version.split('-');
207
- if (esBuildSupportedBrowsers.has(browserName)) {
208
- if (browserName === 'safari' && version === 'tp') {
209
- // esbuild only supports numeric versions so `TP` is converted to a high number (999) since
210
- // a Technology Preview (TP) of Safari is assumed to support all currently known features.
211
- version = '999';
212
- }
213
- else if (!version.includes('.')) {
214
- // A lone major version is considered by esbuild to include all minor versions. However,
215
- // browserslist does not and is also inconsistent in its `.0` version naming. For example,
216
- // Safari 15.0 is named `safari 15` but Safari 16.0 is named `safari 16.0`.
217
- version += '.0';
218
- }
219
- transformed.push(browserName + version);
220
- }
221
- }
222
- return transformed;
223
- }
224
- const SUPPORTED_NODE_VERSIONS = '^22.22.3 || ^24.15.0 || >=26.0.0';
225
- /**
226
- * Transform supported Node.js versions to esbuild target.
227
- * @see https://esbuild.github.io/api/#target
228
- */
229
- function getSupportedNodeTargets() {
230
- if (SUPPORTED_NODE_VERSIONS.charAt(0) === '0') {
231
- // Unlike `pkg_npm`, `ts_library` which is used to run unit tests does not support substitutions.
232
- return [];
233
- }
234
- return SUPPORTED_NODE_VERSIONS.split('||').map((v) => 'node' + (0, semver_1.coerce)(v)?.version);
235
- }
236
178
  async function createJsonBuildManifest(result, normalizedOptions) {
237
179
  const { colors: color, outputOptions: { base, server, browser }, ssrOptions, outputMode, } = normalizedOptions;
238
180
  const { warnings, errors, prerenderedRoutes } = result;