@coderline/alphatab-vite 1.9.0-alpha.1861 → 1.9.0-alpha.1962

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 (46) hide show
  1. package/dist/AlphaTabVitePluginOptions.cjs +1 -1
  2. package/dist/AlphaTabVitePluginOptions.mjs +1 -1
  3. package/dist/alphaTab.vite.cjs +1 -1
  4. package/dist/alphaTab.vite.mjs +1 -1
  5. package/dist/alphaTabVitePlugin.cjs +1 -1
  6. package/dist/alphaTabVitePlugin.mjs +1 -1
  7. package/dist/bridge/asset.cjs +3 -2
  8. package/dist/bridge/asset.mjs +3 -2
  9. package/dist/bridge/build.cjs +2 -4
  10. package/dist/bridge/build.mjs +2 -4
  11. package/dist/bridge/bundler.cjs +1 -1
  12. package/dist/bridge/bundler.mjs +1 -1
  13. package/dist/bridge/config.cjs +1 -1
  14. package/dist/bridge/config.mjs +1 -1
  15. package/dist/bridge/constants.cjs +1 -1
  16. package/dist/bridge/constants.mjs +1 -1
  17. package/dist/bridge/fsUtils.cjs +1 -1
  18. package/dist/bridge/fsUtils.mjs +1 -1
  19. package/dist/bridge/index.cjs +1 -1
  20. package/dist/bridge/index.mjs +1 -1
  21. package/dist/bridge/optimizer.cjs +5 -2
  22. package/dist/bridge/optimizer.mjs +5 -2
  23. package/dist/bridge/plugins.cjs +1 -1
  24. package/dist/bridge/plugins.mjs +1 -1
  25. package/dist/bridge/resolve.cjs +1 -1
  26. package/dist/bridge/resolve.mjs +1 -1
  27. package/dist/bridge/typeUtils.cjs +1 -1
  28. package/dist/bridge/typeUtils.mjs +1 -1
  29. package/dist/bridge/utils.cjs +1 -1
  30. package/dist/bridge/utils.mjs +1 -1
  31. package/dist/bridge/worker.cjs +3 -2
  32. package/dist/bridge/worker.mjs +3 -2
  33. package/dist/copyAssetsPlugin.cjs +1 -1
  34. package/dist/copyAssetsPlugin.mjs +1 -1
  35. package/dist/detectionGlobalPlugin.cjs +1 -1
  36. package/dist/detectionGlobalPlugin.mjs +1 -1
  37. package/dist/dist.cjs +1264 -868
  38. package/dist/dist.mjs +1263 -868
  39. package/dist/importMetaPlugin.cjs +2 -4
  40. package/dist/importMetaPlugin.mjs +2 -4
  41. package/dist/{prompt-B1Yc1NPt.cjs → prompt-CH6TK0bC.cjs} +63 -25
  42. package/dist/{prompt-B1Yc1NPt.mjs → prompt-CH6TK0bC.mjs} +63 -25
  43. package/dist/rolldown-runtime.cjs +2 -2
  44. package/dist/workerPlugin.cjs +6 -6
  45. package/dist/workerPlugin.mjs +6 -6
  46. package/package.json +10 -10
package/dist/dist.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * alphaTab Vite Plugin v1.9.0-alpha.1861 (develop, build 1861)
2
+ * alphaTab Vite Plugin v1.9.0-alpha.1962 (develop, build 1962)
3
3
  *
4
4
  * Copyright © 2026, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -34,8 +34,11 @@
34
34
  * @license
35
35
  */
36
36
  const require_rolldown_runtime = require("./rolldown-runtime.cjs");
37
+ let node_fs = require("node:fs");
38
+ node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
37
39
  let node_path = require("node:path");
38
40
  node_path = require_rolldown_runtime.__toESM(node_path, 1);
41
+ let node_url = require("node:url");
39
42
  let node_module = require("node:module");
40
43
  let node_fs_promises = require("node:fs/promises");
41
44
  node_fs_promises = require_rolldown_runtime.__toESM(node_fs_promises, 1);
@@ -47,7 +50,7 @@ let node_tty = require("node:tty");
47
50
  node_tty = require_rolldown_runtime.__toESM(node_tty, 1);
48
51
  let node_os = require("node:os");
49
52
  node_os = require_rolldown_runtime.__toESM(node_os, 1);
50
- //#region ../../node_modules/rolldown/dist/shared/binding-Dh6LYCIB.mjs
53
+ //#region ../../node_modules/rolldown/dist/shared/binding-DH95uVkp.mjs
51
54
  var __create = Object.create;
52
55
  var __defProp = Object.defineProperty;
53
56
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -65,7 +68,7 @@ var __copyProps = (to, from, except, desc) => {
65
68
  }
66
69
  return to;
67
70
  };
68
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
71
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
69
72
  value: mod,
70
73
  enumerable: true
71
74
  }) : target, mod));
@@ -138,94 +141,97 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
138
141
  } catch (err) {
139
142
  loadErrors.push(err);
140
143
  }
141
- else if (process.platform === "android") if (process.arch === "arm64") {
142
- try {
143
- return __require("./rolldown-binding.android-arm64.node");
144
- } catch (e) {
145
- loadErrors.push(e);
146
- }
147
- try {
148
- const binding = __require("@rolldown/binding-android-arm64");
149
- const bindingPackageVersion = __require("@rolldown/binding-android-arm64/package.json").version;
150
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
151
- return binding;
152
- } catch (e) {
153
- loadErrors.push(e);
154
- }
155
- } else if (process.arch === "arm") {
156
- try {
157
- return __require("./rolldown-binding.android-arm-eabi.node");
158
- } catch (e) {
159
- loadErrors.push(e);
160
- }
161
- try {
162
- const binding = __require("@rolldown/binding-android-arm-eabi");
163
- const bindingPackageVersion = __require("@rolldown/binding-android-arm-eabi/package.json").version;
164
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
165
- return binding;
166
- } catch (e) {
167
- loadErrors.push(e);
168
- }
169
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Android ${process.arch}`));
170
- else if (process.platform === "win32") if (process.arch === "x64") if (process.config && process.config.variables && process.config.variables.shlib_suffix === "dll.a" || process.config && process.config.variables && process.config.variables.node_target_type === "shared_library") {
171
- try {
172
- return __require("./rolldown-binding.win32-x64-gnu.node");
173
- } catch (e) {
174
- loadErrors.push(e);
175
- }
176
- try {
177
- const binding = __require("@rolldown/binding-win32-x64-gnu");
178
- const bindingPackageVersion = __require("@rolldown/binding-win32-x64-gnu/package.json").version;
179
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
180
- return binding;
181
- } catch (e) {
182
- loadErrors.push(e);
183
- }
184
- } else {
185
- try {
186
- return __require("./rolldown-binding.win32-x64-msvc.node");
187
- } catch (e) {
188
- loadErrors.push(e);
189
- }
190
- try {
191
- const binding = __require("@rolldown/binding-win32-x64-msvc");
192
- const bindingPackageVersion = __require("@rolldown/binding-win32-x64-msvc/package.json").version;
193
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
194
- return binding;
195
- } catch (e) {
196
- loadErrors.push(e);
197
- }
198
- }
199
- else if (process.arch === "ia32") {
200
- try {
201
- return __require("./rolldown-binding.win32-ia32-msvc.node");
202
- } catch (e) {
203
- loadErrors.push(e);
204
- }
205
- try {
206
- const binding = __require("@rolldown/binding-win32-ia32-msvc");
207
- const bindingPackageVersion = __require("@rolldown/binding-win32-ia32-msvc/package.json").version;
208
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
209
- return binding;
210
- } catch (e) {
211
- loadErrors.push(e);
212
- }
213
- } else if (process.arch === "arm64") {
214
- try {
215
- return __require("./rolldown-binding.win32-arm64-msvc.node");
216
- } catch (e) {
217
- loadErrors.push(e);
218
- }
219
- try {
220
- const binding = __require("@rolldown/binding-win32-arm64-msvc");
221
- const bindingPackageVersion = __require("@rolldown/binding-win32-arm64-msvc/package.json").version;
222
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
223
- return binding;
224
- } catch (e) {
225
- loadErrors.push(e);
226
- }
227
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Windows: ${process.arch}`));
228
- else if (process.platform === "darwin") {
144
+ else if (process.platform === "android") {
145
+ if (process.arch === "arm64") {
146
+ try {
147
+ return __require("./rolldown-binding.android-arm64.node");
148
+ } catch (e) {
149
+ loadErrors.push(e);
150
+ }
151
+ try {
152
+ const binding = __require("@rolldown/binding-android-arm64");
153
+ const bindingPackageVersion = __require("@rolldown/binding-android-arm64/package.json").version;
154
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
155
+ return binding;
156
+ } catch (e) {
157
+ loadErrors.push(e);
158
+ }
159
+ } else if (process.arch === "arm") {
160
+ try {
161
+ return __require("./rolldown-binding.android-arm-eabi.node");
162
+ } catch (e) {
163
+ loadErrors.push(e);
164
+ }
165
+ try {
166
+ const binding = __require("@rolldown/binding-android-arm-eabi");
167
+ const bindingPackageVersion = __require("@rolldown/binding-android-arm-eabi/package.json").version;
168
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
169
+ return binding;
170
+ } catch (e) {
171
+ loadErrors.push(e);
172
+ }
173
+ } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Android ${process.arch}`));
174
+ } else if (process.platform === "win32") {
175
+ if (process.arch === "x64") {
176
+ if (process.config && process.config.variables && process.config.variables.shlib_suffix === "dll.a" || process.config && process.config.variables && process.config.variables.node_target_type === "shared_library") {
177
+ try {
178
+ return __require("./rolldown-binding.win32-x64-gnu.node");
179
+ } catch (e) {
180
+ loadErrors.push(e);
181
+ }
182
+ try {
183
+ const binding = __require("@rolldown/binding-win32-x64-gnu");
184
+ const bindingPackageVersion = __require("@rolldown/binding-win32-x64-gnu/package.json").version;
185
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
186
+ return binding;
187
+ } catch (e) {
188
+ loadErrors.push(e);
189
+ }
190
+ } else {
191
+ try {
192
+ return __require("./rolldown-binding.win32-x64-msvc.node");
193
+ } catch (e) {
194
+ loadErrors.push(e);
195
+ }
196
+ try {
197
+ const binding = __require("@rolldown/binding-win32-x64-msvc");
198
+ const bindingPackageVersion = __require("@rolldown/binding-win32-x64-msvc/package.json").version;
199
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
200
+ return binding;
201
+ } catch (e) {
202
+ loadErrors.push(e);
203
+ }
204
+ }
205
+ } else if (process.arch === "ia32") {
206
+ try {
207
+ return __require("./rolldown-binding.win32-ia32-msvc.node");
208
+ } catch (e) {
209
+ loadErrors.push(e);
210
+ }
211
+ try {
212
+ const binding = __require("@rolldown/binding-win32-ia32-msvc");
213
+ const bindingPackageVersion = __require("@rolldown/binding-win32-ia32-msvc/package.json").version;
214
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
215
+ return binding;
216
+ } catch (e) {
217
+ loadErrors.push(e);
218
+ }
219
+ } else if (process.arch === "arm64") {
220
+ try {
221
+ return __require("./rolldown-binding.win32-arm64-msvc.node");
222
+ } catch (e) {
223
+ loadErrors.push(e);
224
+ }
225
+ try {
226
+ const binding = __require("@rolldown/binding-win32-arm64-msvc");
227
+ const bindingPackageVersion = __require("@rolldown/binding-win32-arm64-msvc/package.json").version;
228
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
229
+ return binding;
230
+ } catch (e) {
231
+ loadErrors.push(e);
232
+ }
233
+ } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Windows: ${process.arch}`));
234
+ } else if (process.platform === "darwin") {
229
235
  try {
230
236
  return __require("./rolldown-binding.darwin-universal.node");
231
237
  } catch (e) {
@@ -234,7 +240,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
234
240
  try {
235
241
  const binding = __require("@rolldown/binding-darwin-universal");
236
242
  const bindingPackageVersion = __require("@rolldown/binding-darwin-universal/package.json").version;
237
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
243
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
238
244
  return binding;
239
245
  } catch (e) {
240
246
  loadErrors.push(e);
@@ -248,7 +254,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
248
254
  try {
249
255
  const binding = __require("@rolldown/binding-darwin-x64");
250
256
  const bindingPackageVersion = __require("@rolldown/binding-darwin-x64/package.json").version;
251
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
257
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
252
258
  return binding;
253
259
  } catch (e) {
254
260
  loadErrors.push(e);
@@ -262,284 +268,369 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
262
268
  try {
263
269
  const binding = __require("@rolldown/binding-darwin-arm64");
264
270
  const bindingPackageVersion = __require("@rolldown/binding-darwin-arm64/package.json").version;
265
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
271
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
266
272
  return binding;
267
273
  } catch (e) {
268
274
  loadErrors.push(e);
269
275
  }
270
276
  } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on macOS: ${process.arch}`));
271
- } else if (process.platform === "freebsd") if (process.arch === "x64") {
272
- try {
273
- return __require("./rolldown-binding.freebsd-x64.node");
274
- } catch (e) {
275
- loadErrors.push(e);
276
- }
277
- try {
278
- const binding = __require("@rolldown/binding-freebsd-x64");
279
- const bindingPackageVersion = __require("@rolldown/binding-freebsd-x64/package.json").version;
280
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
281
- return binding;
282
- } catch (e) {
283
- loadErrors.push(e);
284
- }
285
- } else if (process.arch === "arm64") {
286
- try {
287
- return __require("./rolldown-binding.freebsd-arm64.node");
288
- } catch (e) {
289
- loadErrors.push(e);
290
- }
291
- try {
292
- const binding = __require("@rolldown/binding-freebsd-arm64");
293
- const bindingPackageVersion = __require("@rolldown/binding-freebsd-arm64/package.json").version;
294
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
295
- return binding;
296
- } catch (e) {
297
- loadErrors.push(e);
298
- }
299
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
300
- else if (process.platform === "linux") if (process.arch === "x64") if (isMusl()) {
301
- try {
302
- return __require("./rolldown-binding.linux-x64-musl.node");
303
- } catch (e) {
304
- loadErrors.push(e);
305
- }
306
- try {
307
- const binding = __require("@rolldown/binding-linux-x64-musl");
308
- const bindingPackageVersion = __require("@rolldown/binding-linux-x64-musl/package.json").version;
309
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
310
- return binding;
311
- } catch (e) {
312
- loadErrors.push(e);
313
- }
314
- } else {
315
- try {
316
- return __require("../rolldown-binding.linux-x64-gnu.node");
317
- } catch (e) {
318
- loadErrors.push(e);
319
- }
320
- try {
321
- const binding = __require("@rolldown/binding-linux-x64-gnu");
322
- const bindingPackageVersion = __require("@rolldown/binding-linux-x64-gnu/package.json").version;
323
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
324
- return binding;
325
- } catch (e) {
326
- loadErrors.push(e);
327
- }
328
- }
329
- else if (process.arch === "arm64") if (isMusl()) {
330
- try {
331
- return __require("./rolldown-binding.linux-arm64-musl.node");
332
- } catch (e) {
333
- loadErrors.push(e);
334
- }
335
- try {
336
- const binding = __require("@rolldown/binding-linux-arm64-musl");
337
- const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-musl/package.json").version;
338
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
339
- return binding;
340
- } catch (e) {
341
- loadErrors.push(e);
342
- }
343
- } else {
344
- try {
345
- return __require("./rolldown-binding.linux-arm64-gnu.node");
346
- } catch (e) {
347
- loadErrors.push(e);
348
- }
349
- try {
350
- const binding = __require("@rolldown/binding-linux-arm64-gnu");
351
- const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-gnu/package.json").version;
352
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
353
- return binding;
354
- } catch (e) {
355
- loadErrors.push(e);
356
- }
357
- }
358
- else if (process.arch === "arm") if (isMusl()) {
359
- try {
360
- return __require("./rolldown-binding.linux-arm-musleabihf.node");
361
- } catch (e) {
362
- loadErrors.push(e);
363
- }
364
- try {
365
- const binding = __require("@rolldown/binding-linux-arm-musleabihf");
366
- const bindingPackageVersion = __require("@rolldown/binding-linux-arm-musleabihf/package.json").version;
367
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
368
- return binding;
369
- } catch (e) {
370
- loadErrors.push(e);
371
- }
372
- } else {
373
- try {
374
- return __require("./rolldown-binding.linux-arm-gnueabihf.node");
375
- } catch (e) {
376
- loadErrors.push(e);
377
- }
378
- try {
379
- const binding = __require("@rolldown/binding-linux-arm-gnueabihf");
380
- const bindingPackageVersion = __require("@rolldown/binding-linux-arm-gnueabihf/package.json").version;
381
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
382
- return binding;
383
- } catch (e) {
384
- loadErrors.push(e);
385
- }
386
- }
387
- else if (process.arch === "loong64") if (isMusl()) {
388
- try {
389
- return __require("./rolldown-binding.linux-loong64-musl.node");
390
- } catch (e) {
391
- loadErrors.push(e);
392
- }
393
- try {
394
- const binding = __require("@rolldown/binding-linux-loong64-musl");
395
- const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-musl/package.json").version;
396
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
397
- return binding;
398
- } catch (e) {
399
- loadErrors.push(e);
400
- }
401
- } else {
402
- try {
403
- return __require("./rolldown-binding.linux-loong64-gnu.node");
404
- } catch (e) {
405
- loadErrors.push(e);
406
- }
407
- try {
408
- const binding = __require("@rolldown/binding-linux-loong64-gnu");
409
- const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-gnu/package.json").version;
410
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
411
- return binding;
412
- } catch (e) {
413
- loadErrors.push(e);
414
- }
415
- }
416
- else if (process.arch === "riscv64") if (isMusl()) {
417
- try {
418
- return __require("./rolldown-binding.linux-riscv64-musl.node");
419
- } catch (e) {
420
- loadErrors.push(e);
421
- }
422
- try {
423
- const binding = __require("@rolldown/binding-linux-riscv64-musl");
424
- const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-musl/package.json").version;
425
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
426
- return binding;
427
- } catch (e) {
428
- loadErrors.push(e);
429
- }
430
- } else {
431
- try {
432
- return __require("./rolldown-binding.linux-riscv64-gnu.node");
433
- } catch (e) {
434
- loadErrors.push(e);
435
- }
436
- try {
437
- const binding = __require("@rolldown/binding-linux-riscv64-gnu");
438
- const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-gnu/package.json").version;
439
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
440
- return binding;
441
- } catch (e) {
442
- loadErrors.push(e);
443
- }
444
- }
445
- else if (process.arch === "ppc64") {
446
- try {
447
- return __require("./rolldown-binding.linux-ppc64-gnu.node");
448
- } catch (e) {
449
- loadErrors.push(e);
450
- }
451
- try {
452
- const binding = __require("@rolldown/binding-linux-ppc64-gnu");
453
- const bindingPackageVersion = __require("@rolldown/binding-linux-ppc64-gnu/package.json").version;
454
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
455
- return binding;
456
- } catch (e) {
457
- loadErrors.push(e);
458
- }
459
- } else if (process.arch === "s390x") {
460
- try {
461
- return __require("./rolldown-binding.linux-s390x-gnu.node");
462
- } catch (e) {
463
- loadErrors.push(e);
464
- }
465
- try {
466
- const binding = __require("@rolldown/binding-linux-s390x-gnu");
467
- const bindingPackageVersion = __require("@rolldown/binding-linux-s390x-gnu/package.json").version;
468
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
469
- return binding;
470
- } catch (e) {
471
- loadErrors.push(e);
472
- }
473
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Linux: ${process.arch}`));
474
- else if (process.platform === "openharmony") if (process.arch === "arm64") {
475
- try {
476
- return __require("./rolldown-binding.openharmony-arm64.node");
477
- } catch (e) {
478
- loadErrors.push(e);
479
- }
480
- try {
481
- const binding = __require("@rolldown/binding-openharmony-arm64");
482
- const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm64/package.json").version;
483
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
484
- return binding;
485
- } catch (e) {
486
- loadErrors.push(e);
487
- }
488
- } else if (process.arch === "x64") {
277
+ } else if (process.platform === "freebsd") {
278
+ if (process.arch === "x64") {
279
+ try {
280
+ return __require("./rolldown-binding.freebsd-x64.node");
281
+ } catch (e) {
282
+ loadErrors.push(e);
283
+ }
284
+ try {
285
+ const binding = __require("@rolldown/binding-freebsd-x64");
286
+ const bindingPackageVersion = __require("@rolldown/binding-freebsd-x64/package.json").version;
287
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
288
+ return binding;
289
+ } catch (e) {
290
+ loadErrors.push(e);
291
+ }
292
+ } else if (process.arch === "arm64") {
293
+ try {
294
+ return __require("./rolldown-binding.freebsd-arm64.node");
295
+ } catch (e) {
296
+ loadErrors.push(e);
297
+ }
298
+ try {
299
+ const binding = __require("@rolldown/binding-freebsd-arm64");
300
+ const bindingPackageVersion = __require("@rolldown/binding-freebsd-arm64/package.json").version;
301
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
302
+ return binding;
303
+ } catch (e) {
304
+ loadErrors.push(e);
305
+ }
306
+ } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
307
+ } else if (process.platform === "linux") {
308
+ if (process.arch === "x64") {
309
+ if (isMusl()) {
310
+ try {
311
+ return __require("./rolldown-binding.linux-x64-musl.node");
312
+ } catch (e) {
313
+ loadErrors.push(e);
314
+ }
315
+ try {
316
+ const binding = __require("@rolldown/binding-linux-x64-musl");
317
+ const bindingPackageVersion = __require("@rolldown/binding-linux-x64-musl/package.json").version;
318
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
319
+ return binding;
320
+ } catch (e) {
321
+ loadErrors.push(e);
322
+ }
323
+ } else {
324
+ try {
325
+ return __require("../rolldown-binding.linux-x64-gnu.node");
326
+ } catch (e) {
327
+ loadErrors.push(e);
328
+ }
329
+ try {
330
+ const binding = __require("@rolldown/binding-linux-x64-gnu");
331
+ const bindingPackageVersion = __require("@rolldown/binding-linux-x64-gnu/package.json").version;
332
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
333
+ return binding;
334
+ } catch (e) {
335
+ loadErrors.push(e);
336
+ }
337
+ }
338
+ } else if (process.arch === "arm64") {
339
+ if (isMusl()) {
340
+ try {
341
+ return __require("./rolldown-binding.linux-arm64-musl.node");
342
+ } catch (e) {
343
+ loadErrors.push(e);
344
+ }
345
+ try {
346
+ const binding = __require("@rolldown/binding-linux-arm64-musl");
347
+ const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-musl/package.json").version;
348
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
349
+ return binding;
350
+ } catch (e) {
351
+ loadErrors.push(e);
352
+ }
353
+ } else {
354
+ try {
355
+ return __require("./rolldown-binding.linux-arm64-gnu.node");
356
+ } catch (e) {
357
+ loadErrors.push(e);
358
+ }
359
+ try {
360
+ const binding = __require("@rolldown/binding-linux-arm64-gnu");
361
+ const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-gnu/package.json").version;
362
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
363
+ return binding;
364
+ } catch (e) {
365
+ loadErrors.push(e);
366
+ }
367
+ }
368
+ } else if (process.arch === "arm") {
369
+ if (isMusl()) {
370
+ try {
371
+ return __require("./rolldown-binding.linux-arm-musleabihf.node");
372
+ } catch (e) {
373
+ loadErrors.push(e);
374
+ }
375
+ try {
376
+ const binding = __require("@rolldown/binding-linux-arm-musleabihf");
377
+ const bindingPackageVersion = __require("@rolldown/binding-linux-arm-musleabihf/package.json").version;
378
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
379
+ return binding;
380
+ } catch (e) {
381
+ loadErrors.push(e);
382
+ }
383
+ } else {
384
+ try {
385
+ return __require("./rolldown-binding.linux-arm-gnueabihf.node");
386
+ } catch (e) {
387
+ loadErrors.push(e);
388
+ }
389
+ try {
390
+ const binding = __require("@rolldown/binding-linux-arm-gnueabihf");
391
+ const bindingPackageVersion = __require("@rolldown/binding-linux-arm-gnueabihf/package.json").version;
392
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
393
+ return binding;
394
+ } catch (e) {
395
+ loadErrors.push(e);
396
+ }
397
+ }
398
+ } else if (process.arch === "loong64") {
399
+ if (isMusl()) {
400
+ try {
401
+ return __require("./rolldown-binding.linux-loong64-musl.node");
402
+ } catch (e) {
403
+ loadErrors.push(e);
404
+ }
405
+ try {
406
+ const binding = __require("@rolldown/binding-linux-loong64-musl");
407
+ const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-musl/package.json").version;
408
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
409
+ return binding;
410
+ } catch (e) {
411
+ loadErrors.push(e);
412
+ }
413
+ } else {
414
+ try {
415
+ return __require("./rolldown-binding.linux-loong64-gnu.node");
416
+ } catch (e) {
417
+ loadErrors.push(e);
418
+ }
419
+ try {
420
+ const binding = __require("@rolldown/binding-linux-loong64-gnu");
421
+ const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-gnu/package.json").version;
422
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
423
+ return binding;
424
+ } catch (e) {
425
+ loadErrors.push(e);
426
+ }
427
+ }
428
+ } else if (process.arch === "riscv64") {
429
+ if (isMusl()) {
430
+ try {
431
+ return __require("./rolldown-binding.linux-riscv64-musl.node");
432
+ } catch (e) {
433
+ loadErrors.push(e);
434
+ }
435
+ try {
436
+ const binding = __require("@rolldown/binding-linux-riscv64-musl");
437
+ const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-musl/package.json").version;
438
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
439
+ return binding;
440
+ } catch (e) {
441
+ loadErrors.push(e);
442
+ }
443
+ } else {
444
+ try {
445
+ return __require("./rolldown-binding.linux-riscv64-gnu.node");
446
+ } catch (e) {
447
+ loadErrors.push(e);
448
+ }
449
+ try {
450
+ const binding = __require("@rolldown/binding-linux-riscv64-gnu");
451
+ const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-gnu/package.json").version;
452
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
453
+ return binding;
454
+ } catch (e) {
455
+ loadErrors.push(e);
456
+ }
457
+ }
458
+ } else if (process.arch === "ppc64") {
459
+ try {
460
+ return __require("./rolldown-binding.linux-ppc64-gnu.node");
461
+ } catch (e) {
462
+ loadErrors.push(e);
463
+ }
464
+ try {
465
+ const binding = __require("@rolldown/binding-linux-ppc64-gnu");
466
+ const bindingPackageVersion = __require("@rolldown/binding-linux-ppc64-gnu/package.json").version;
467
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
468
+ return binding;
469
+ } catch (e) {
470
+ loadErrors.push(e);
471
+ }
472
+ } else if (process.arch === "s390x") {
473
+ try {
474
+ return __require("./rolldown-binding.linux-s390x-gnu.node");
475
+ } catch (e) {
476
+ loadErrors.push(e);
477
+ }
478
+ try {
479
+ const binding = __require("@rolldown/binding-linux-s390x-gnu");
480
+ const bindingPackageVersion = __require("@rolldown/binding-linux-s390x-gnu/package.json").version;
481
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
482
+ return binding;
483
+ } catch (e) {
484
+ loadErrors.push(e);
485
+ }
486
+ } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Linux: ${process.arch}`));
487
+ } else if (process.platform === "openharmony") {
488
+ if (process.arch === "arm64") {
489
+ try {
490
+ return __require("./rolldown-binding.openharmony-arm64.node");
491
+ } catch (e) {
492
+ loadErrors.push(e);
493
+ }
494
+ try {
495
+ const binding = __require("@rolldown/binding-openharmony-arm64");
496
+ const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm64/package.json").version;
497
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
498
+ return binding;
499
+ } catch (e) {
500
+ loadErrors.push(e);
501
+ }
502
+ } else if (process.arch === "x64") {
503
+ try {
504
+ return __require("./rolldown-binding.openharmony-x64.node");
505
+ } catch (e) {
506
+ loadErrors.push(e);
507
+ }
508
+ try {
509
+ const binding = __require("@rolldown/binding-openharmony-x64");
510
+ const bindingPackageVersion = __require("@rolldown/binding-openharmony-x64/package.json").version;
511
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
512
+ return binding;
513
+ } catch (e) {
514
+ loadErrors.push(e);
515
+ }
516
+ } else if (process.arch === "arm") {
517
+ try {
518
+ return __require("./rolldown-binding.openharmony-arm.node");
519
+ } catch (e) {
520
+ loadErrors.push(e);
521
+ }
522
+ try {
523
+ const binding = __require("@rolldown/binding-openharmony-arm");
524
+ const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm/package.json").version;
525
+ if (bindingPackageVersion !== "1.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
526
+ return binding;
527
+ } catch (e) {
528
+ loadErrors.push(e);
529
+ }
530
+ } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
531
+ } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
532
+ }
533
+ function createLoadErrorChain(errors) {
534
+ return errors.reduce((previous, current) => {
535
+ let message;
489
536
  try {
490
- return __require("./rolldown-binding.openharmony-x64.node");
491
- } catch (e) {
492
- loadErrors.push(e);
537
+ message = current && typeof current.message === "string" ? current.message : String(current);
538
+ } catch {
539
+ message = "Unknown error";
493
540
  }
541
+ const error = new Error(message);
542
+ error.cause = previous;
543
+ return error;
544
+ }, null);
545
+ }
546
+ const __napiWasiFlavors = ["wasm32-wasi"];
547
+ const __napiWasiFlavor = process.env.NAPI_RS_WASI_FLAVOR;
548
+ const __napiWasiFlavorRequested = typeof __napiWasiFlavor === "string" && __napiWasiFlavor.length > 0;
549
+ if (__napiWasiFlavorRequested && __napiWasiFlavors.indexOf(__napiWasiFlavor) === -1) throw new Error("Unsupported WASI flavor \"" + __napiWasiFlavor + "\". Available flavors: " + __napiWasiFlavors.join(", "));
550
+ const forceWasiError = process.env.NAPI_RS_FORCE_WASI === "error";
551
+ const forceWasi = process.env.NAPI_RS_FORCE_WASI === "true" || forceWasiError || __napiWasiFlavorRequested;
552
+ if (!forceWasi) nativeBinding = requireNative();
553
+ if (!nativeBinding || forceWasi) {
554
+ let wasiBinding = null;
555
+ let wasiBindingLoaded = false;
556
+ const wasiBindingErrors = [];
557
+ const __napiWasiResolveCandidate = (specifier, isPackage, localArtifacts) => {
494
558
  try {
495
- const binding = __require("@rolldown/binding-openharmony-x64");
496
- const bindingPackageVersion = __require("@rolldown/binding-openharmony-x64/package.json").version;
497
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
498
- return binding;
499
- } catch (e) {
500
- loadErrors.push(e);
559
+ __require.resolve(specifier);
560
+ } catch (resolveError) {
561
+ if (!resolveError || resolveError.code !== "MODULE_NOT_FOUND") throw resolveError;
562
+ if (isPackage) {
563
+ try {
564
+ __require.resolve(specifier + "/package.json");
565
+ } catch (packageError) {
566
+ if (packageError && packageError.code === "MODULE_NOT_FOUND") return resolveError;
567
+ throw resolveError;
568
+ }
569
+ throw resolveError;
570
+ }
571
+ return resolveError;
501
572
  }
502
- } else if (process.arch === "arm") {
503
- try {
504
- return __require("./rolldown-binding.openharmony-arm.node");
505
- } catch (e) {
506
- loadErrors.push(e);
573
+ if (localArtifacts) {
574
+ let artifactError = null;
575
+ for (let i = 0; i < localArtifacts.length; i++) try {
576
+ __require.resolve(localArtifacts[i]);
577
+ return null;
578
+ } catch (resolveError) {
579
+ if (!resolveError || resolveError.code !== "MODULE_NOT_FOUND") throw resolveError;
580
+ artifactError = resolveError;
581
+ }
582
+ return artifactError;
507
583
  }
584
+ return null;
585
+ };
586
+ if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")) {
587
+ let candidateError = null;
588
+ let candidateFailed = false;
508
589
  try {
509
- const binding = __require("@rolldown/binding-openharmony-arm");
510
- const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm/package.json").version;
511
- if (bindingPackageVersion !== "1.1.3" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
512
- return binding;
513
- } catch (e) {
514
- loadErrors.push(e);
590
+ candidateError = __napiWasiResolveCandidate("./rolldown-binding.wasi.cjs", false, ["./rolldown-binding.wasm32-wasi.debug.wasm", "./rolldown-binding.wasm32-wasi.wasm"]);
591
+ candidateFailed = candidateError !== null;
592
+ if (!candidateFailed) {
593
+ wasiBinding = __require("../rolldown-binding.wasi.cjs");
594
+ nativeBinding = wasiBinding;
595
+ wasiBindingLoaded = true;
596
+ }
597
+ } catch (err) {
598
+ candidateError = err;
599
+ candidateFailed = true;
600
+ }
601
+ if (candidateFailed) {
602
+ wasiBindingErrors.push(candidateError);
603
+ loadErrors.push(candidateError);
515
604
  }
516
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
517
- else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
518
- }
519
- nativeBinding = requireNative();
520
- const forceWasi = process.env.NAPI_RS_FORCE_WASI === "true" || process.env.NAPI_RS_FORCE_WASI === "error";
521
- if (!nativeBinding || forceWasi) {
522
- let wasiBinding = null;
523
- let wasiBindingError = null;
524
- try {
525
- wasiBinding = __require("../rolldown-binding.wasi.cjs");
526
- nativeBinding = wasiBinding;
527
- } catch (err) {
528
- if (forceWasi) wasiBindingError = err;
529
605
  }
530
- if (!nativeBinding || forceWasi) try {
531
- wasiBinding = __require("@rolldown/binding-wasm32-wasi");
532
- nativeBinding = wasiBinding;
533
- } catch (err) {
534
- if (forceWasi) {
535
- if (!wasiBindingError) wasiBindingError = err;
536
- else wasiBindingError.cause = err;
537
- loadErrors.push(err);
606
+ if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")) {
607
+ let candidateError = null;
608
+ let candidateFailed = false;
609
+ try {
610
+ candidateError = __napiWasiResolveCandidate("@rolldown/binding-wasm32-wasi", true, void 0);
611
+ candidateFailed = candidateError !== null;
612
+ if (!candidateFailed) {
613
+ if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
614
+ const bindingPackageVersion = __require("@rolldown/binding-wasm32-wasi/package.json").version;
615
+ if (bindingPackageVersion !== "1.2.8") throw new Error(`WASI binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
616
+ }
617
+ wasiBinding = __require("@rolldown/binding-wasm32-wasi");
618
+ nativeBinding = wasiBinding;
619
+ wasiBindingLoaded = true;
620
+ }
621
+ } catch (err) {
622
+ candidateError = err;
623
+ candidateFailed = true;
624
+ }
625
+ if (candidateFailed) {
626
+ wasiBindingErrors.push(candidateError);
627
+ loadErrors.push(candidateError);
538
628
  }
539
629
  }
540
- if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
541
- const error = /* @__PURE__ */ new Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
542
- error.cause = wasiBindingError;
630
+ if (!wasiBindingLoaded && forceWasi && !forceWasiError && !__napiWasiFlavorRequested) nativeBinding = requireNative();
631
+ if ((forceWasiError || __napiWasiFlavorRequested) && !wasiBindingLoaded) {
632
+ const error = /* @__PURE__ */ new Error(__napiWasiFlavorRequested ? "WASI binding for flavor \"" + __napiWasiFlavor + "\" not found" : "WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
633
+ error.cause = createLoadErrorChain(wasiBindingErrors);
543
634
  throw error;
544
635
  }
545
636
  }
@@ -551,10 +642,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
551
642
  if (!nativeBinding) {
552
643
  if (loadErrors.length > 0) {
553
644
  const error = /* @__PURE__ */ new Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.");
554
- error.cause = loadErrors.reduce((err, cur) => {
555
- cur.cause = err;
556
- return cur;
557
- });
645
+ error.cause = createLoadErrorChain(loadErrors);
558
646
  throw error;
559
647
  }
560
648
  throw new Error(`Failed to load native binding`);
@@ -607,7 +695,6 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
607
695
  module.exports.BindingWatcherChangeData = nativeBinding.BindingWatcherChangeData;
608
696
  module.exports.BindingWatcherEvent = nativeBinding.BindingWatcherEvent;
609
697
  module.exports.ParallelJsPluginRegistry = nativeBinding.ParallelJsPluginRegistry;
610
- module.exports.ScheduledBuild = nativeBinding.ScheduledBuild;
611
698
  module.exports.TraceSubscriberGuard = nativeBinding.TraceSubscriberGuard;
612
699
  module.exports.TsconfigCache = nativeBinding.TsconfigCache;
613
700
  module.exports.BindingAttachDebugInfo = nativeBinding.BindingAttachDebugInfo;
@@ -623,14 +710,16 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
623
710
  module.exports.enhancedTransform = nativeBinding.enhancedTransform;
624
711
  module.exports.enhancedTransformSync = nativeBinding.enhancedTransformSync;
625
712
  module.exports.FilterTokenKind = nativeBinding.FilterTokenKind;
713
+ module.exports.getNativeMemoryStats = nativeBinding.getNativeMemoryStats;
626
714
  module.exports.initTraceSubscriber = nativeBinding.initTraceSubscriber;
627
715
  module.exports.registerPlugins = nativeBinding.registerPlugins;
716
+ module.exports.resetNativeMemoryStats = nativeBinding.resetNativeMemoryStats;
628
717
  module.exports.resolveTsconfig = nativeBinding.resolveTsconfig;
629
718
  module.exports.shutdownAsyncRuntime = nativeBinding.shutdownAsyncRuntime;
630
719
  module.exports.startAsyncRuntime = nativeBinding.startAsyncRuntime;
631
720
  }));
632
721
  //#endregion
633
- //#region ../../node_modules/rolldown/dist/shared/logs-aMKUxRpj.mjs
722
+ //#region ../../node_modules/rolldown/dist/shared/logs-DmYCAKcW.mjs
634
723
  function spaces(index) {
635
724
  let result = "";
636
725
  while (index--) result += " ";
@@ -725,7 +814,12 @@ function getLocator(source, options = {}) {
725
814
  function locate(source, search, options) {
726
815
  return getLocator(source, options)(search, options && options.startIndex);
727
816
  }
728
- var INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", PARSE_ERROR = "PARSE_ERROR";
817
+ var INVALID_LOG_POSITION = "INVALID_LOG_POSITION";
818
+ var PLUGIN_ERROR = "PLUGIN_ERROR";
819
+ var INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN";
820
+ var CYCLE_LOADING = "CYCLE_LOADING";
821
+ var PARSE_ERROR = "PARSE_ERROR";
822
+ var VALIDATION_ERROR = "VALIDATION_ERROR";
729
823
  function logParseError(message, id, pos) {
730
824
  return {
731
825
  code: PARSE_ERROR,
@@ -734,6 +828,12 @@ function logParseError(message, id, pos) {
734
828
  pos
735
829
  };
736
830
  }
831
+ function logFailedValidation(message) {
832
+ return {
833
+ code: VALIDATION_ERROR,
834
+ message
835
+ };
836
+ }
737
837
  function logInvalidLogPosition(pluginName) {
738
838
  return {
739
839
  code: INVALID_LOG_POSITION,
@@ -836,7 +936,7 @@ function isReadonlyArray(input) {
836
936
  return Array.isArray(input);
837
937
  }
838
938
  //#endregion
839
- //#region ../../node_modules/rolldown/dist/shared/misc-CoQm4NHO.mjs
939
+ //#region ../../node_modules/rolldown/dist/shared/misc-DOSKtd97.mjs
840
940
  function arraify(value) {
841
941
  return Array.isArray(value) ? value : [value];
842
942
  }
@@ -852,8 +952,16 @@ function unsupported(info) {
852
952
  throw new Error(`UNSUPPORTED: ${info}`);
853
953
  }
854
954
  function noop(..._args) {}
955
+ var ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Za-z]:)?[/\\|])/;
956
+ /**
957
+ * Whether `name` is a path fragment — an absolute or relative path. Emitted file
958
+ * names, `[name]` substitutions and file-name patterns can be neither.
959
+ */
960
+ function isPathFragment(name) {
961
+ return name[0] === "/" || name[0] === "." && (name[1] === "/" || name[1] === ".") || ABSOLUTE_PATH_REGEX.test(name);
962
+ }
855
963
  //#endregion
856
- //#region ../../node_modules/rolldown/dist/shared/error-B68YLzl3.mjs
964
+ //#region ../../node_modules/rolldown/dist/shared/error-CRNyaqoL.mjs
857
965
  function bindingifySourcemap$1(map) {
858
966
  if (map == null) return;
859
967
  return { inner: typeof map === "string" ? map : {
@@ -932,8 +1040,8 @@ function joinNewLine(s1, s2) {
932
1040
  return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
933
1041
  }
934
1042
  //#endregion
935
- //#region ../../node_modules/rolldown/dist/shared/parse-CTgsjpo8.mjs
936
- var import_binding$4 = /* @__PURE__ */ __toESM(require_binding(), 1);
1043
+ //#region ../../node_modules/rolldown/dist/shared/parse-BtiCBYra.mjs
1044
+ var import_binding$5 = /* @__PURE__ */ __toESM(require_binding(), 1);
937
1045
  function wrap$1(result) {
938
1046
  let program, module, comments, errors;
939
1047
  return {
@@ -981,7 +1089,7 @@ function applyFix(program, fixPath) {
981
1089
  * @category Utilities
982
1090
  */
983
1091
  function parseSync(filename, sourceText, options) {
984
- return wrap$1((0, import_binding$4.parseSync)(filename, sourceText, options));
1092
+ return wrap$1((0, import_binding$5.parseSync)(filename, sourceText, options));
985
1093
  }
986
1094
  //#endregion
987
1095
  //#region ../../node_modules/rolldown/dist/parse-ast-index.mjs
@@ -1115,7 +1223,7 @@ function exclude(expr) {
1115
1223
  *
1116
1224
  * @category Plugin APIs
1117
1225
  */
1118
- var VERSION = "1.1.3";
1226
+ var VERSION = "1.2.8";
1119
1227
  var LOG_LEVEL_SILENT = "silent";
1120
1228
  var LOG_LEVEL_WARN = "warn";
1121
1229
  var LOG_LEVEL_INFO = "info";
@@ -1154,6 +1262,24 @@ function normalizeHook(hook) {
1154
1262
  }
1155
1263
  unreachable("Invalid hook type");
1156
1264
  }
1265
+ /**
1266
+ * Returns the `_parallel` marker of a parallel plugin, or `undefined` if the
1267
+ * given plugin is not one.
1268
+ *
1269
+ * Detection is descriptor-based instead of using the `in` operator: only an
1270
+ * own data property named `_parallel` with the expected shape counts. This
1271
+ * avoids false positives from inherited or accessor `_parallel` properties on
1272
+ * regular plugins, and guarantees that callers can safely read `fileUrl` and
1273
+ * `options` from the returned value.
1274
+ */
1275
+ function getParallelPluginInfo(plugin) {
1276
+ if (plugin === null || typeof plugin !== "object") return;
1277
+ const descriptor = Object.getOwnPropertyDescriptor(plugin, "_parallel");
1278
+ if (!descriptor || !("value" in descriptor)) return;
1279
+ const parallel = descriptor.value;
1280
+ if (parallel === null || typeof parallel !== "object" || typeof parallel.fileUrl !== "string") return;
1281
+ return parallel;
1282
+ }
1157
1283
  var MinimalPluginContextImpl = class {
1158
1284
  pluginName;
1159
1285
  hookName;
@@ -1177,7 +1303,7 @@ var MinimalPluginContextImpl = class {
1177
1303
  return error(logPluginError(normalizeLog(e), this.pluginName, { hook: this.hookName }));
1178
1304
  }
1179
1305
  };
1180
- var import_binding$3 = /* @__PURE__ */ __toESM(require_binding(), 1);
1306
+ var import_binding$4 = /* @__PURE__ */ __toESM(require_binding(), 1);
1181
1307
  var LAZY_FIELDS_KEY = Symbol("__lazy_fields__");
1182
1308
  /**
1183
1309
  * Base class for classes that use `@lazyProp` decorated properties.
@@ -1568,7 +1694,9 @@ function transformToMutableRollupOutputAsset(bindingAsset, changed) {
1568
1694
  }
1569
1695
  function transformToRollupOutput(output) {
1570
1696
  const { chunks, assets } = output;
1571
- return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk)), ...assets.map((asset) => transformToRollupOutputAsset(asset))] };
1697
+ const transformed = { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk)), ...assets.map((asset) => transformToRollupOutputAsset(asset))] };
1698
+ if (output.mangleCache !== void 0) transformed.mangleCache = output.mangleCache;
1699
+ return transformed;
1572
1700
  }
1573
1701
  function transformToMutableRollupOutput(output, changed) {
1574
1702
  const { chunks, assets } = output;
@@ -1693,6 +1821,9 @@ var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
1693
1821
  get sourcemap() {
1694
1822
  return this.inner.sourcemap;
1695
1823
  }
1824
+ get sourcemapFileNames() {
1825
+ return this.inner.sourcemapFilenames || this.outputOptions.sourcemapFileNames;
1826
+ }
1696
1827
  get sourcemapBaseUrl() {
1697
1828
  return this.inner.sourcemapBaseUrl ?? void 0;
1698
1829
  }
@@ -1814,6 +1945,7 @@ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "assetFileNames",
1814
1945
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "format", null);
1815
1946
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "exports", null);
1816
1947
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemap", null);
1948
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapFileNames", null);
1817
1949
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapBaseUrl", null);
1818
1950
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "shimMissingExports", null);
1819
1951
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "name", null);
@@ -1969,7 +2101,7 @@ var PluginContextData = class {
1969
2101
  this.loadModulePromiseMap.clear();
1970
2102
  }
1971
2103
  };
1972
- Object.defineProperty(import_binding$3.BindingMagicString.prototype, "isRolldownMagicString", {
2104
+ Object.defineProperty(import_binding$4.BindingMagicString.prototype, "isRolldownMagicString", {
1973
2105
  value: true,
1974
2106
  writable: false,
1975
2107
  configurable: false
@@ -1977,49 +2109,49 @@ Object.defineProperty(import_binding$3.BindingMagicString.prototype, "isRolldown
1977
2109
  function assertString(content, msg) {
1978
2110
  if (typeof content !== "string") throw new TypeError(msg);
1979
2111
  }
1980
- var nativeAppend = import_binding$3.BindingMagicString.prototype.append;
1981
- var nativePrepend = import_binding$3.BindingMagicString.prototype.prepend;
1982
- var nativeAppendLeft = import_binding$3.BindingMagicString.prototype.appendLeft;
1983
- var nativeAppendRight = import_binding$3.BindingMagicString.prototype.appendRight;
1984
- var nativePrependLeft = import_binding$3.BindingMagicString.prototype.prependLeft;
1985
- var nativePrependRight = import_binding$3.BindingMagicString.prototype.prependRight;
1986
- var nativeOverwrite = import_binding$3.BindingMagicString.prototype.overwrite;
1987
- var nativeUpdate = import_binding$3.BindingMagicString.prototype.update;
1988
- import_binding$3.BindingMagicString.prototype.append = function(content) {
2112
+ var nativeAppend = import_binding$4.BindingMagicString.prototype.append;
2113
+ var nativePrepend = import_binding$4.BindingMagicString.prototype.prepend;
2114
+ var nativeAppendLeft = import_binding$4.BindingMagicString.prototype.appendLeft;
2115
+ var nativeAppendRight = import_binding$4.BindingMagicString.prototype.appendRight;
2116
+ var nativePrependLeft = import_binding$4.BindingMagicString.prototype.prependLeft;
2117
+ var nativePrependRight = import_binding$4.BindingMagicString.prototype.prependRight;
2118
+ var nativeOverwrite = import_binding$4.BindingMagicString.prototype.overwrite;
2119
+ var nativeUpdate = import_binding$4.BindingMagicString.prototype.update;
2120
+ import_binding$4.BindingMagicString.prototype.append = function(content) {
1989
2121
  assertString(content, "outro content must be a string");
1990
2122
  return nativeAppend.call(this, content);
1991
2123
  };
1992
- import_binding$3.BindingMagicString.prototype.prepend = function(content) {
2124
+ import_binding$4.BindingMagicString.prototype.prepend = function(content) {
1993
2125
  assertString(content, "outro content must be a string");
1994
2126
  return nativePrepend.call(this, content);
1995
2127
  };
1996
- import_binding$3.BindingMagicString.prototype.appendLeft = function(index, content) {
2128
+ import_binding$4.BindingMagicString.prototype.appendLeft = function(index, content) {
1997
2129
  assertString(content, "inserted content must be a string");
1998
2130
  return nativeAppendLeft.call(this, index, content);
1999
2131
  };
2000
- import_binding$3.BindingMagicString.prototype.appendRight = function(index, content) {
2132
+ import_binding$4.BindingMagicString.prototype.appendRight = function(index, content) {
2001
2133
  assertString(content, "inserted content must be a string");
2002
2134
  return nativeAppendRight.call(this, index, content);
2003
2135
  };
2004
- import_binding$3.BindingMagicString.prototype.prependLeft = function(index, content) {
2136
+ import_binding$4.BindingMagicString.prototype.prependLeft = function(index, content) {
2005
2137
  assertString(content, "inserted content must be a string");
2006
2138
  return nativePrependLeft.call(this, index, content);
2007
2139
  };
2008
- import_binding$3.BindingMagicString.prototype.prependRight = function(index, content) {
2140
+ import_binding$4.BindingMagicString.prototype.prependRight = function(index, content) {
2009
2141
  assertString(content, "inserted content must be a string");
2010
2142
  return nativePrependRight.call(this, index, content);
2011
2143
  };
2012
- import_binding$3.BindingMagicString.prototype.overwrite = function(start, end, content, options) {
2144
+ import_binding$4.BindingMagicString.prototype.overwrite = function(start, end, content, options) {
2013
2145
  assertString(content, "replacement content must be a string");
2014
2146
  return nativeOverwrite.call(this, start, end, content, options);
2015
2147
  };
2016
- import_binding$3.BindingMagicString.prototype.update = function(start, end, content, options) {
2148
+ import_binding$4.BindingMagicString.prototype.update = function(start, end, content, options) {
2017
2149
  assertString(content, "replacement content must be a string");
2018
2150
  return nativeUpdate.call(this, start, end, content, options);
2019
2151
  };
2020
- var nativeReplace = import_binding$3.BindingMagicString.prototype.replace;
2021
- var nativeReplaceAll = import_binding$3.BindingMagicString.prototype.replaceAll;
2022
- import_binding$3.BindingMagicString.prototype.replace = function(searchValue, replacement) {
2152
+ var nativeReplace = import_binding$4.BindingMagicString.prototype.replace;
2153
+ var nativeReplaceAll = import_binding$4.BindingMagicString.prototype.replaceAll;
2154
+ import_binding$4.BindingMagicString.prototype.replace = function(searchValue, replacement) {
2023
2155
  if (typeof searchValue === "string") return nativeReplace.call(this, searchValue, replacement);
2024
2156
  if (searchValue.global) searchValue.lastIndex = 0;
2025
2157
  const lastMatchEnd = this.replaceRegex(searchValue, replacement);
@@ -2027,7 +2159,7 @@ import_binding$3.BindingMagicString.prototype.replace = function(searchValue, re
2027
2159
  else if (searchValue.sticky) searchValue.lastIndex = lastMatchEnd === -1 ? 0 : lastMatchEnd;
2028
2160
  return this;
2029
2161
  };
2030
- import_binding$3.BindingMagicString.prototype.replaceAll = function(searchValue, replacement) {
2162
+ import_binding$4.BindingMagicString.prototype.replaceAll = function(searchValue, replacement) {
2031
2163
  if (typeof searchValue === "string") return nativeReplaceAll.call(this, searchValue, replacement);
2032
2164
  if (!searchValue.global) throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");
2033
2165
  searchValue.lastIndex = 0;
@@ -2040,7 +2172,7 @@ import_binding$3.BindingMagicString.prototype.replaceAll = function(searchValue,
2040
2172
  *
2041
2173
  * @experimental
2042
2174
  */
2043
- var RolldownMagicString = import_binding$3.BindingMagicString;
2175
+ var RolldownMagicString = import_binding$4.BindingMagicString;
2044
2176
  function isEmptySourcemapFiled(array) {
2045
2177
  if (!array) return true;
2046
2178
  if (array.length === 0 || !array[0]) return true;
@@ -2133,6 +2265,20 @@ function containsImporterId(expr) {
2133
2265
  function assertNoImporterId(filterExprs, hookName) {
2134
2266
  if (filterExprs?.some(containsImporterId)) throw new Error(`The \`importerId\` filter can only be used with the \`resolveId\` hook, but it was used with the \`${hookName}\` hook.`);
2135
2267
  }
2268
+ function containsStringId(expr) {
2269
+ switch (expr.kind) {
2270
+ case "and":
2271
+ case "or": return expr.args.some(containsStringId);
2272
+ case "not":
2273
+ case "include":
2274
+ case "exclude": return containsStringId(expr.expr);
2275
+ case "id": return typeof expr.pattern === "string";
2276
+ default: return false;
2277
+ }
2278
+ }
2279
+ function assertNoStringId(filterExprs, hookName) {
2280
+ if (filterExprs?.some(containsStringId)) throw new Error(`A string \`id\` filter is not supported for the \`${hookName}\` hook, because its \`id\` is the import specifier rather than a resolved path. Use a RegExp instead.`);
2281
+ }
2136
2282
  function bindingifyFilterExprImpl(expr, list) {
2137
2283
  switch (expr.kind) {
2138
2284
  case "and": {
@@ -2206,8 +2352,11 @@ function bindingifyFilterExprImpl(expr, list) {
2206
2352
  }
2207
2353
  function bindingifyResolveIdFilter(filterOption) {
2208
2354
  if (!filterOption) return;
2209
- if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2210
- return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
2355
+ const filterExprs = Array.isArray(filterOption) ? filterOption : filterOption.id ? generalHookFilterMatcherToFilterExprs(filterOption.id, "id") : void 0;
2356
+ assertNoStringId(filterExprs, "resolveId");
2357
+ if (!filterExprs) return;
2358
+ const value = filterExprs.map(bindingifyFilterExpr);
2359
+ return value.length > 0 ? { value } : void 0;
2211
2360
  }
2212
2361
  function bindingifyLoadFilter(filterOption) {
2213
2362
  if (!filterOption) return;
@@ -2238,13 +2387,21 @@ function bindingifyPluginHookMeta(options) {
2238
2387
  }
2239
2388
  function bindingPluginOrder(order) {
2240
2389
  switch (order) {
2241
- case "post": return import_binding$3.BindingPluginOrder.Post;
2242
- case "pre": return import_binding$3.BindingPluginOrder.Pre;
2390
+ case "post": return import_binding$4.BindingPluginOrder.Post;
2391
+ case "pre": return import_binding$4.BindingPluginOrder.Pre;
2243
2392
  case null:
2244
2393
  case void 0: return;
2245
2394
  default: throw new Error(`Unknown plugin order: ${order}`);
2246
2395
  }
2247
2396
  }
2397
+ function bindingifyHook(hook, build) {
2398
+ if (!hook) return {};
2399
+ const normalized = normalizeHook(hook);
2400
+ return {
2401
+ ...build(normalized),
2402
+ meta: bindingifyPluginHookMeta(normalized.meta)
2403
+ };
2404
+ }
2248
2405
  var fsModule = {
2249
2406
  appendFile: node_fs_promises.default.appendFile,
2250
2407
  copyFile: node_fs_promises.default.copyFile,
@@ -2324,17 +2481,23 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2324
2481
  };
2325
2482
  }
2326
2483
  emitFile = (file) => {
2327
- if (file.type === "prebuilt-chunk") return this.context.emitPrebuiltChunk({
2328
- fileName: file.fileName,
2329
- name: file.name,
2330
- code: file.code,
2331
- exports: file.exports,
2332
- map: bindingifySourcemap$1(file.map),
2333
- sourcemapFileName: file.sourcemapFileName,
2334
- facadeModuleId: file.facadeModuleId,
2335
- isEntry: file.isEntry,
2336
- isDynamicEntry: file.isDynamicEntry
2337
- });
2484
+ if (file.type === "prebuilt-chunk") {
2485
+ if (typeof file.code !== "string") return error(logFailedValidation(`Emitted prebuilt chunks need to have a valid string code, received "${file.code}".`));
2486
+ if (typeof file.fileName !== "string" || isPathFragment(file.fileName)) return error(logFailedValidation(`The "fileName" property of emitted prebuilt chunks must be strings that are neither absolute nor relative paths, received "${file.fileName}".`));
2487
+ return this.context.emitPrebuiltChunk({
2488
+ fileName: file.fileName,
2489
+ name: file.name,
2490
+ code: file.code,
2491
+ exports: file.exports,
2492
+ map: bindingifySourcemap$1(file.map),
2493
+ sourcemapFileName: file.sourcemapFileName,
2494
+ facadeModuleId: file.facadeModuleId,
2495
+ isEntry: file.isEntry,
2496
+ isDynamicEntry: file.isDynamicEntry
2497
+ });
2498
+ }
2499
+ const validatedName = file.fileName || file.name;
2500
+ if (typeof validatedName === "string" && isPathFragment(validatedName)) return error(logFailedValidation(`The "fileName" or "name" properties of emitted chunks and assets must be strings that are neither absolute nor relative paths, received "${validatedName}".`));
2338
2501
  if (file.type === "chunk") return this.context.emitChunk({
2339
2502
  preserveEntrySignatures: bindingifyPreserveEntrySignatures(file.preserveSignature),
2340
2503
  ...file
@@ -2370,6 +2533,9 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2370
2533
  return parseAst(input, options);
2371
2534
  }
2372
2535
  };
2536
+ function createPluginContext(args, ctx) {
2537
+ return new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode);
2538
+ }
2373
2539
  var LoadPluginContextImpl = class extends PluginContextImpl {
2374
2540
  inner;
2375
2541
  constructor(outputOptions, context, plugin, data, inner, moduleId, onLog, logLevelOption, watchMode) {
@@ -2417,36 +2583,19 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
2417
2583
  this.inner.sendMagicString(s);
2418
2584
  }
2419
2585
  };
2420
- function createPluginContext(args, ctx) {
2421
- return new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode);
2422
- }
2423
2586
  function bindingifyBuildStart(args) {
2424
- const hook = args.plugin.buildStart;
2425
- if (!hook) return {};
2426
- const { handler, meta } = normalizeHook(hook);
2427
- return {
2428
- plugin: async (ctx, opts) => {
2429
- await handler.call(createPluginContext(args, ctx), args.pluginContextData.getInputOptions(opts));
2430
- },
2431
- meta: bindingifyPluginHookMeta(meta)
2432
- };
2587
+ return bindingifyHook(args.plugin.buildStart, ({ handler }) => ({ plugin: async (ctx, opts) => {
2588
+ await handler.call(createPluginContext(args, ctx), args.pluginContextData.getInputOptions(opts));
2589
+ } }));
2433
2590
  }
2434
2591
  function bindingifyBuildEnd(args) {
2435
- const hook = args.plugin.buildEnd;
2436
- if (!hook) return {};
2437
- const { handler, meta } = normalizeHook(hook);
2438
- return {
2439
- plugin: async (ctx, err) => {
2440
- await handler.call(createPluginContext(args, ctx), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
2441
- },
2442
- meta: bindingifyPluginHookMeta(meta)
2443
- };
2592
+ return bindingifyHook(args.plugin.buildEnd, ({ handler }) => ({ plugin: async (ctx, err) => {
2593
+ await handler.call(createPluginContext(args, ctx), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
2594
+ } }));
2444
2595
  }
2445
2596
  function bindingifyResolveId(args) {
2446
2597
  const hook = args.plugin.resolveId;
2447
- if (!hook) return {};
2448
- const { handler, meta, options } = normalizeHook(hook);
2449
- return {
2598
+ return bindingifyHook(hook, ({ handler, options }) => ({
2450
2599
  plugin: async (ctx, specifier, importer, extraOptions) => {
2451
2600
  const contextResolveOptions = extraOptions.custom != null ? args.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
2452
2601
  const ret = await handler.call(createPluginContext(args, ctx), specifier, importer ?? void 0, {
@@ -2476,44 +2625,34 @@ function bindingifyResolveId(args) {
2476
2625
  packageJsonPath: ret.packageJsonPath
2477
2626
  };
2478
2627
  },
2479
- meta: bindingifyPluginHookMeta(meta),
2480
2628
  filter: bindingifyResolveIdFilter(options.filter)
2481
- };
2629
+ }));
2482
2630
  }
2483
2631
  function bindingifyResolveDynamicImport(args) {
2484
- const hook = args.plugin.resolveDynamicImport;
2485
- if (!hook) return {};
2486
- const { handler, meta } = normalizeHook(hook);
2487
- return {
2488
- plugin: async (ctx, specifier, importer) => {
2489
- const ret = await handler.call(createPluginContext(args, ctx), specifier, importer ?? void 0);
2490
- if (ret == null) return;
2491
- if (ret === false) return {
2492
- id: specifier,
2493
- external: true
2494
- };
2495
- if (typeof ret === "string") return { id: ret };
2496
- const result = {
2497
- id: ret.id,
2498
- external: ret.external,
2499
- packageJsonPath: ret.packageJsonPath
2500
- };
2501
- if (ret.moduleSideEffects !== null) result.moduleSideEffects = ret.moduleSideEffects;
2502
- args.pluginContextData.updateModuleOption(ret.id, {
2503
- meta: ret.meta || {},
2504
- moduleSideEffects: ret.moduleSideEffects || null,
2505
- invalidate: false
2506
- });
2507
- return result;
2508
- },
2509
- meta: bindingifyPluginHookMeta(meta)
2510
- };
2632
+ return bindingifyHook(args.plugin.resolveDynamicImport, ({ handler }) => ({ plugin: async (ctx, specifier, importer) => {
2633
+ const ret = await handler.call(createPluginContext(args, ctx), specifier, importer ?? void 0);
2634
+ if (ret == null) return;
2635
+ if (ret === false) return {
2636
+ id: specifier,
2637
+ external: true
2638
+ };
2639
+ if (typeof ret === "string") return { id: ret };
2640
+ const result = {
2641
+ id: ret.id,
2642
+ external: ret.external,
2643
+ packageJsonPath: ret.packageJsonPath
2644
+ };
2645
+ if (ret.moduleSideEffects !== null) result.moduleSideEffects = ret.moduleSideEffects;
2646
+ args.pluginContextData.updateModuleOption(ret.id, {
2647
+ meta: ret.meta || {},
2648
+ moduleSideEffects: ret.moduleSideEffects || null,
2649
+ invalidate: false
2650
+ });
2651
+ return result;
2652
+ } }));
2511
2653
  }
2512
2654
  function bindingifyTransform(args) {
2513
- const hook = args.plugin.transform;
2514
- if (!hook) return {};
2515
- const { handler, meta, options } = normalizeHook(hook);
2516
- return {
2655
+ return bindingifyHook(args.plugin.transform, ({ handler, options }) => ({
2517
2656
  plugin: async (ctx, code, id, meta) => {
2518
2657
  let magicStringInstance, astInstance;
2519
2658
  Object.defineProperties(meta, {
@@ -2529,10 +2668,7 @@ function bindingifyTransform(args) {
2529
2668
  case "js":
2530
2669
  case "jsx":
2531
2670
  case "ts":
2532
- case "tsx":
2533
- lang = meta.moduleType;
2534
- break;
2535
- default: break;
2671
+ case "tsx": lang = meta.moduleType;
2536
2672
  }
2537
2673
  astInstance = parseAst(code, {
2538
2674
  astType: meta.moduleType.includes("ts") ? "ts" : "js",
@@ -2568,15 +2704,11 @@ function bindingifyTransform(args) {
2568
2704
  moduleType: ret.moduleType
2569
2705
  };
2570
2706
  },
2571
- meta: bindingifyPluginHookMeta(meta),
2572
2707
  filter: bindingifyTransformFilter(options.filter)
2573
- };
2708
+ }));
2574
2709
  }
2575
2710
  function bindingifyLoad(args) {
2576
- const hook = args.plugin.load;
2577
- if (!hook) return {};
2578
- const { handler, meta, options } = normalizeHook(hook);
2579
- return {
2711
+ return bindingifyHook(args.plugin.load, ({ handler, options }) => ({
2580
2712
  plugin: async (ctx, id) => {
2581
2713
  const ret = await handler.call(new LoadPluginContextImpl(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id, args.onLog, args.logLevel, args.watchMode), id);
2582
2714
  if (ret == null) return;
@@ -2594,9 +2726,8 @@ function bindingifyLoad(args) {
2594
2726
  moduleSideEffects: moduleOption.moduleSideEffects ?? void 0
2595
2727
  };
2596
2728
  },
2597
- meta: bindingifyPluginHookMeta(meta),
2598
2729
  filter: bindingifyLoadFilter(options.filter)
2599
- };
2730
+ }));
2600
2731
  }
2601
2732
  function preProcessSourceMap(ret, id) {
2602
2733
  if (!ret.map) return;
@@ -2609,32 +2740,17 @@ function preProcessSourceMap(ret, id) {
2609
2740
  return map;
2610
2741
  }
2611
2742
  function bindingifyModuleParsed(args) {
2612
- const hook = args.plugin.moduleParsed;
2613
- if (!hook) return {};
2614
- const { handler, meta } = normalizeHook(hook);
2615
- return {
2616
- plugin: async (ctx, moduleInfo) => {
2617
- await handler.call(createPluginContext(args, ctx), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
2618
- },
2619
- meta: bindingifyPluginHookMeta(meta)
2620
- };
2743
+ return bindingifyHook(args.plugin.moduleParsed, ({ handler }) => ({ plugin: async (ctx, moduleInfo) => {
2744
+ await handler.call(createPluginContext(args, ctx), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
2745
+ } }));
2621
2746
  }
2622
2747
  function bindingifyRenderStart(args) {
2623
- const hook = args.plugin.renderStart;
2624
- if (!hook) return {};
2625
- const { handler, meta } = normalizeHook(hook);
2626
- return {
2627
- plugin: async (ctx, opts) => {
2628
- handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), args.pluginContextData.getOutputOptions(opts), args.pluginContextData.getInputOptions(opts));
2629
- },
2630
- meta: bindingifyPluginHookMeta(meta)
2631
- };
2748
+ return bindingifyHook(args.plugin.renderStart, ({ handler }) => ({ plugin: async (ctx, opts) => {
2749
+ await handler.call(createPluginContext(args, ctx), args.pluginContextData.getOutputOptions(opts), args.pluginContextData.getInputOptions(opts));
2750
+ } }));
2632
2751
  }
2633
2752
  function bindingifyRenderChunk(args) {
2634
- const hook = args.plugin.renderChunk;
2635
- if (!hook) return {};
2636
- const { handler, meta, options } = normalizeHook(hook);
2637
- return {
2753
+ return bindingifyHook(args.plugin.renderChunk, ({ handler, options }) => ({
2638
2754
  plugin: async (ctx, code, chunk, opts, meta) => {
2639
2755
  if (args.pluginContextData.getRenderChunkMeta() == null) args.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
2640
2756
  const renderChunkMeta = args.pluginContextData.getRenderChunkMeta();
@@ -2647,7 +2763,7 @@ function bindingifyRenderChunk(args) {
2647
2763
  },
2648
2764
  configurable: true
2649
2765
  });
2650
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), code, transformRenderedChunk(chunk), args.pluginContextData.getOutputOptions(opts), renderChunkMeta);
2766
+ const ret = await handler.call(createPluginContext(args, ctx), code, transformRenderedChunk(chunk), args.pluginContextData.getOutputOptions(opts), renderChunkMeta);
2651
2767
  if (ret == null) return;
2652
2768
  if (ret instanceof RolldownMagicString) {
2653
2769
  const normalizedCode = ret.toString();
@@ -2698,148 +2814,79 @@ function bindingifyRenderChunk(args) {
2698
2814
  map: bindingifySourcemap$1(ret.map)
2699
2815
  };
2700
2816
  },
2701
- meta: bindingifyPluginHookMeta(meta),
2702
2817
  filter: bindingifyRenderChunkFilter(options.filter)
2703
- };
2818
+ }));
2704
2819
  }
2705
2820
  function bindingifyAugmentChunkHash(args) {
2706
- const hook = args.plugin.augmentChunkHash;
2707
- if (!hook) return {};
2708
- const { handler, meta } = normalizeHook(hook);
2709
- return {
2710
- plugin: async (ctx, chunk) => {
2711
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
2712
- },
2713
- meta: bindingifyPluginHookMeta(meta)
2714
- };
2821
+ return bindingifyHook(args.plugin.augmentChunkHash, ({ handler }) => ({ plugin: async (ctx, chunk) => {
2822
+ return handler.call(createPluginContext(args, ctx), transformRenderedChunk(chunk));
2823
+ } }));
2824
+ }
2825
+ function bindingifyResolveFileUrl(args) {
2826
+ return bindingifyHook(args.plugin.resolveFileUrl, ({ handler }) => ({ plugin: async (ctx, resolveFileUrlArgs) => {
2827
+ return handler.call(createPluginContext(args, ctx), resolveFileUrlArgs);
2828
+ } }));
2715
2829
  }
2716
2830
  function bindingifyRenderError(args) {
2717
- const hook = args.plugin.renderError;
2718
- if (!hook) return {};
2719
- const { handler, meta } = normalizeHook(hook);
2831
+ return bindingifyHook(args.plugin.renderError, ({ handler }) => ({ plugin: async (ctx, err) => {
2832
+ await handler.call(createPluginContext(args, ctx), aggregateBindingErrorsIntoJsError(err));
2833
+ } }));
2834
+ }
2835
+ function createOutputBundle(args, ctx, bundle) {
2836
+ const changed = {
2837
+ updated: /* @__PURE__ */ new Set(),
2838
+ deleted: /* @__PURE__ */ new Set()
2839
+ };
2840
+ const context = createPluginContext(args, ctx);
2720
2841
  return {
2721
- plugin: async (ctx, err) => {
2722
- handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), aggregateBindingErrorsIntoJsError(err));
2723
- },
2724
- meta: bindingifyPluginHookMeta(meta)
2842
+ changed,
2843
+ context,
2844
+ output: transformToOutputBundle(context, unwrapBindingResult(bundle), changed)
2725
2845
  };
2726
2846
  }
2727
2847
  function bindingifyGenerateBundle(args) {
2728
- const hook = args.plugin.generateBundle;
2729
- if (!hook) return {};
2730
- const { handler, meta } = normalizeHook(hook);
2731
- return {
2732
- plugin: async (ctx, bundle, isWrite, opts) => {
2733
- const changed = {
2734
- updated: /* @__PURE__ */ new Set(),
2735
- deleted: /* @__PURE__ */ new Set()
2736
- };
2737
- const context = new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode);
2738
- const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
2739
- await handler.call(context, args.pluginContextData.getOutputOptions(opts), output, isWrite);
2740
- return collectChangedBundle(changed, output);
2741
- },
2742
- meta: bindingifyPluginHookMeta(meta)
2743
- };
2848
+ return bindingifyHook(args.plugin.generateBundle, ({ handler }) => ({ plugin: async (ctx, bundle, isWrite, opts) => {
2849
+ const { changed, context, output } = createOutputBundle(args, ctx, bundle);
2850
+ await handler.call(context, args.pluginContextData.getOutputOptions(opts), output, isWrite);
2851
+ return collectChangedBundle(changed, output);
2852
+ } }));
2744
2853
  }
2745
2854
  function bindingifyWriteBundle(args) {
2746
- const hook = args.plugin.writeBundle;
2747
- if (!hook) return {};
2748
- const { handler, meta } = normalizeHook(hook);
2749
- return {
2750
- plugin: async (ctx, bundle, opts) => {
2751
- const changed = {
2752
- updated: /* @__PURE__ */ new Set(),
2753
- deleted: /* @__PURE__ */ new Set()
2754
- };
2755
- const context = new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode);
2756
- const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
2757
- await handler.call(context, args.pluginContextData.getOutputOptions(opts), output);
2758
- return collectChangedBundle(changed, output);
2759
- },
2760
- meta: bindingifyPluginHookMeta(meta)
2761
- };
2855
+ return bindingifyHook(args.plugin.writeBundle, ({ handler }) => ({ plugin: async (ctx, bundle, opts) => {
2856
+ const { changed, context, output } = createOutputBundle(args, ctx, bundle);
2857
+ await handler.call(context, args.pluginContextData.getOutputOptions(opts), output);
2858
+ return collectChangedBundle(changed, output);
2859
+ } }));
2762
2860
  }
2763
2861
  function bindingifyCloseBundle(args) {
2764
- const hook = args.plugin.closeBundle;
2765
- if (!hook) return {};
2766
- const { handler, meta } = normalizeHook(hook);
2767
- return {
2768
- plugin: async (ctx, err) => {
2769
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
2770
- },
2771
- meta: bindingifyPluginHookMeta(meta)
2772
- };
2773
- }
2774
- function bindingifyBanner(args) {
2775
- const hook = args.plugin.banner;
2776
- if (!hook) return {};
2777
- const { handler, meta } = normalizeHook(hook);
2778
- return {
2779
- plugin: async (ctx, chunk) => {
2780
- if (typeof handler === "string") return handler;
2781
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
2782
- },
2783
- meta: bindingifyPluginHookMeta(meta)
2784
- };
2785
- }
2786
- function bindingifyFooter(args) {
2787
- const hook = args.plugin.footer;
2788
- if (!hook) return {};
2789
- const { handler, meta } = normalizeHook(hook);
2790
- return {
2791
- plugin: async (ctx, chunk) => {
2792
- if (typeof handler === "string") return handler;
2793
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
2794
- },
2795
- meta: bindingifyPluginHookMeta(meta)
2796
- };
2797
- }
2798
- function bindingifyIntro(args) {
2799
- const hook = args.plugin.intro;
2800
- if (!hook) return {};
2801
- const { handler, meta } = normalizeHook(hook);
2802
- return {
2803
- plugin: async (ctx, chunk) => {
2804
- if (typeof handler === "string") return handler;
2805
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
2806
- },
2807
- meta: bindingifyPluginHookMeta(meta)
2808
- };
2809
- }
2810
- function bindingifyOutro(args) {
2811
- const hook = args.plugin.outro;
2812
- if (!hook) return {};
2813
- const { handler, meta } = normalizeHook(hook);
2814
- return {
2815
- plugin: async (ctx, chunk) => {
2816
- if (typeof handler === "string") return handler;
2817
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
2818
- },
2819
- meta: bindingifyPluginHookMeta(meta)
2820
- };
2862
+ return bindingifyHook(args.plugin.closeBundle, ({ handler }) => ({ plugin: async (ctx, err) => {
2863
+ await handler.call(createPluginContext(args, ctx), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
2864
+ } }));
2865
+ }
2866
+ function bindingifyAddonHook(args, name) {
2867
+ return bindingifyHook(args.plugin[name], ({ handler }) => ({ plugin: async (ctx, chunk) => {
2868
+ if (typeof handler === "string") return handler;
2869
+ return handler.call(createPluginContext(args, ctx), transformRenderedChunk(chunk));
2870
+ } }));
2871
+ }
2872
+ function bindingifyHotUpdate(args) {
2873
+ return bindingifyHook(args.plugin.hotUpdate, ({ handler }) => ({ plugin: async (ctx, hookArgs) => {
2874
+ return await handler.call(createPluginContext(args, ctx), {
2875
+ type: hookArgs.kind,
2876
+ file: hookArgs.file,
2877
+ modules: hookArgs.modules
2878
+ }) ?? void 0;
2879
+ } }));
2821
2880
  }
2822
2881
  function bindingifyWatchChange(args) {
2823
- const hook = args.plugin.watchChange;
2824
- if (!hook) return {};
2825
- const { handler, meta } = normalizeHook(hook);
2826
- return {
2827
- plugin: async (ctx, id, event) => {
2828
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), id, { event });
2829
- },
2830
- meta: bindingifyPluginHookMeta(meta)
2831
- };
2882
+ return bindingifyHook(args.plugin.watchChange, ({ handler }) => ({ plugin: async (ctx, id, event) => {
2883
+ await handler.call(createPluginContext(args, ctx), id, { event });
2884
+ } }));
2832
2885
  }
2833
2886
  function bindingifyCloseWatcher(args) {
2834
- const hook = args.plugin.closeWatcher;
2835
- if (!hook) return {};
2836
- const { handler, meta } = normalizeHook(hook);
2837
- return {
2838
- plugin: async (ctx) => {
2839
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode));
2840
- },
2841
- meta: bindingifyPluginHookMeta(meta)
2842
- };
2887
+ return bindingifyHook(args.plugin.closeWatcher, ({ handler }) => ({ plugin: async (ctx) => {
2888
+ await handler.call(createPluginContext(args, ctx));
2889
+ } }));
2843
2890
  }
2844
2891
  var HookUsage = class {
2845
2892
  bitflag = BigInt(0);
@@ -2873,9 +2920,222 @@ function extractHookUsage(plugin) {
2873
2920
  if (plugin.footer) hookUsage.union(262144);
2874
2921
  if (plugin.intro) hookUsage.union(524288);
2875
2922
  if (plugin.outro) hookUsage.union(1048576);
2923
+ if (plugin.resolveFileUrl) hookUsage.union(2097152);
2924
+ if (plugin.hotUpdate) hookUsage.union(4194304);
2876
2925
  return hookUsage;
2877
2926
  }
2878
- function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
2927
+ /**
2928
+ * Measure what plugin hooks cost, from inside the JavaScript callback.
2929
+ *
2930
+ * Internal to Rolldown. Nothing here is on a public entry point, and the measurement is not
2931
+ * offered as an API — the only consumer is the core, which pulls it while the build closes.
2932
+ *
2933
+ * The bundler core can only bracket *dispatch* and *completion*. For a hook it invokes
2934
+ * concurrently those two points are separated mostly by the queue the call waited in on
2935
+ * JavaScript's single thread, and the queue is deepest behind whichever callback is doing
2936
+ * the most work — so the hook blocking the thread dilutes its own credit while cheap hooks
2937
+ * collect credit for waiting. Ranking from those numbers reliably puts the *cheapest* hook
2938
+ * first.
2939
+ *
2940
+ * The missing quantity is when the callback began running, and that is known here. Starting
2941
+ * the clock inside the callback removes the dispatch queue by construction.
2942
+ *
2943
+ * ## `maxInFlight` decides whether a total means anything
2944
+ *
2945
+ * Entry-to-exit spans may be summed only if they never overlap. A synchronous callback
2946
+ * cannot overlap: it holds the thread until it returns. An `async` one can — it may suspend
2947
+ * at an `await` and let another call of the same hook begin, and then both spans cover the
2948
+ * same wall clock and the sum counts it twice.
2949
+ *
2950
+ * Overlap also changes what the span is measuring. A hook that awaits the bundler (say
2951
+ * `this.resolve`) spends most of its span waiting for Rust, so the number describes the
2952
+ * bundler rather than the plugin. Observed on a real build: one `resolveId` accumulated
2953
+ * ~47,000s of span inside a 44s module-loading window.
2954
+ *
2955
+ * So overlap is measured rather than assumed, per hook: `overlapMs` is the wall time
2956
+ * double counted in `ms` because two or more calls were in flight together. A hook is
2957
+ * reported with a number when that is a negligible share of its span, and named without one
2958
+ * when it is not.
2959
+ *
2960
+ * The test is deliberately a tolerance rather than "did this ever happen". A peak in-flight
2961
+ * count of 2 can mean one incidental overlap in twenty thousand calls, and discarding a
2962
+ * twelve-second measurement over that both throws away good data and makes the report
2963
+ * depend on scheduling luck — the same hook would appear in one run and vanish in the next.
2964
+ *
2965
+ * This keeps the rule the core followed — never present a number that cannot be defended —
2966
+ * while narrowing "cannot measure" from a property of the *call site* to a property of the
2967
+ * *callback*, which is where it actually lives. A hook dispatched concurrently but whose
2968
+ * body barely overlaps is measured to within the tolerance.
2969
+ *
2970
+ * A measured row is still wall time for that callback rather than CPU: a hook that awaits
2971
+ * I/O without overlapping another call of itself is charged for the wait. Excluding the
2972
+ * dispatch queue is what this buys; it does not distinguish running from awaiting.
2973
+ */
2974
+ /**
2975
+ * How much of a hook's span may be double counted before its total stops being reportable,
2976
+ * as a fraction of that span.
2977
+ */
2978
+ var OVERLAP_TOLERANCE = .01;
2979
+ /**
2980
+ * One recorder per build, keyed on the object that identifies it.
2981
+ *
2982
+ * Counters cannot be module-global. A plugin is free to run a nested `rolldown()` build of
2983
+ * its own, which finishes first; shared counters would let it flush the outer build's
2984
+ * half-accumulated totals and report a window belonging to neither.
2985
+ */
2986
+ var recorders = /* @__PURE__ */ new WeakMap();
2987
+ /** The recorder for one build, created on first use. */
2988
+ function pluginTimingsRecorderFor(key) {
2989
+ let recorder = recorders.get(key);
2990
+ if (recorder === void 0) {
2991
+ recorder = {
2992
+ costs: /* @__PURE__ */ new Map(),
2993
+ busyMs: 0,
2994
+ inFlight: 0,
2995
+ busyStart: 0
2996
+ };
2997
+ recorders.set(key, recorder);
2998
+ }
2999
+ return recorder;
3000
+ }
3001
+ function costFor(recorder, owner, hookName) {
3002
+ let byHook = recorder.costs.get(owner.key);
3003
+ if (byHook === void 0) {
3004
+ byHook = /* @__PURE__ */ new Map();
3005
+ recorder.costs.set(owner.key, byHook);
3006
+ }
3007
+ let cost = byHook.get(hookName);
3008
+ if (cost === void 0) {
3009
+ cost = {
3010
+ owner: owner.name,
3011
+ kind: owner.kind,
3012
+ hookName,
3013
+ calls: 0,
3014
+ ms: 0,
3015
+ inFlight: 0,
3016
+ maxInFlight: 0,
3017
+ overlapMs: 0,
3018
+ lastChange: 0
3019
+ };
3020
+ byHook.set(hookName, cost);
3021
+ }
3022
+ return cost;
3023
+ }
3024
+ /**
3025
+ * Fold the interval since the last in-flight change into `overlapMs`, then move the mark.
3026
+ * Call immediately before every increment and decrement of `cost.inFlight`.
3027
+ */
3028
+ function markInFlightChange(cost, at) {
3029
+ if (cost.inFlight > 1) cost.overlapMs += (cost.inFlight - 1) * (at - cost.lastChange);
3030
+ cost.lastChange = at;
3031
+ }
3032
+ /**
3033
+ * Close out one call. A module-level function rather than a closure per invocation: hooks
3034
+ * run hundreds of thousands of times in a large build, and the synchronous path would
3035
+ * otherwise allocate one closure per call only to invoke it immediately.
3036
+ */
3037
+ function settle(recorder, cost, started) {
3038
+ const ended = performance.now();
3039
+ markInFlightChange(cost, ended);
3040
+ cost.inFlight -= 1;
3041
+ cost.ms += ended - started;
3042
+ recorder.inFlight -= 1;
3043
+ if (recorder.inFlight === 0) recorder.busyMs += ended - recorder.busyStart;
3044
+ }
3045
+ /**
3046
+ * Wrap one callback so its execution time is recorded.
3047
+ *
3048
+ * Returns the callback untouched when there is no recorder, so a build that is not
3049
+ * measuring pays nothing beyond one branch at setup.
3050
+ */
3051
+ function measureHookCost(recorder, owner, hookName, handler) {
3052
+ if (recorder === void 0) return handler;
3053
+ const cost = costFor(recorder, owner, hookName);
3054
+ return function(...args) {
3055
+ const started = performance.now();
3056
+ markInFlightChange(cost, started);
3057
+ cost.calls += 1;
3058
+ cost.inFlight += 1;
3059
+ if (cost.inFlight > cost.maxInFlight) cost.maxInFlight = cost.inFlight;
3060
+ if (recorder.inFlight === 0) recorder.busyStart = started;
3061
+ recorder.inFlight += 1;
3062
+ let result;
3063
+ try {
3064
+ result = handler.apply(this, args);
3065
+ } catch (error) {
3066
+ settle(recorder, cost, started);
3067
+ throw error;
3068
+ }
3069
+ if (typeof result?.then === "function") return result.then((value) => {
3070
+ settle(recorder, cost, started);
3071
+ return value;
3072
+ }, (error) => {
3073
+ settle(recorder, cost, started);
3074
+ throw error;
3075
+ });
3076
+ settle(recorder, cost, started);
3077
+ return result;
3078
+ };
3079
+ }
3080
+ /**
3081
+ * The owner shown for user callbacks the core invokes directly rather than through a
3082
+ * plugin. One shared identity: they are all configured on the same options object.
3083
+ */
3084
+ var OUTPUT_OPTIONS_OWNER = {
3085
+ key: Symbol("output options"),
3086
+ name: "output options",
3087
+ kind: "outputOption"
3088
+ };
3089
+ /** As {@link OUTPUT_OPTIONS_OWNER}, for callbacks configured on the input options. */
3090
+ var INPUT_OPTIONS_OWNER = {
3091
+ key: Symbol("input options"),
3092
+ name: "input options",
3093
+ kind: "inputOption"
3094
+ };
3095
+ /**
3096
+ * Wrap `value` when the user supplied a function, and leave every other form alone.
3097
+ *
3098
+ * Most option callbacks are declared as `string | RegExp | Function | ...`, so this keeps
3099
+ * the one cast the wrapping needs in a single place.
3100
+ */
3101
+ function measureIfFunction(recorder, owner, hookName, value) {
3102
+ if (typeof value !== "function") return value;
3103
+ return measureHookCost(recorder, owner, hookName, value);
3104
+ }
3105
+ /**
3106
+ * What the build's callbacks have cost so far, leaving the recorder in place.
3107
+ *
3108
+ * Ungated on purpose: whether a build is worth reporting on is decided from the clocks Rust
3109
+ * holds, so the question is not this side's to ask.
3110
+ *
3111
+ * Rust calls this while the build is closing, so what it gets includes `closeBundle`.
3112
+ */
3113
+ function summarizePluginTimings(key) {
3114
+ const recorder = recorders.get(key);
3115
+ if (recorder === void 0) return {
3116
+ busyMs: 0,
3117
+ rows: []
3118
+ };
3119
+ const rows = [];
3120
+ for (const byHook of recorder.costs.values()) for (const cost of byHook.values()) {
3121
+ if (cost.calls === 0) continue;
3122
+ rows.push({
3123
+ owner: cost.owner,
3124
+ kind: cost.kind,
3125
+ hook: cost.hookName,
3126
+ calls: cost.calls,
3127
+ ms: cost.ms,
3128
+ maxInFlight: cost.maxInFlight,
3129
+ overlapMs: cost.overlapMs,
3130
+ rankable: cost.overlapMs <= cost.ms * OVERLAP_TOLERANCE
3131
+ });
3132
+ }
3133
+ return {
3134
+ busyMs: recorder.busyMs,
3135
+ rows
3136
+ };
3137
+ }
3138
+ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings) {
2879
3139
  const args = {
2880
3140
  plugin,
2881
3141
  options,
@@ -2895,19 +3155,21 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
2895
3155
  const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args);
2896
3156
  const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args);
2897
3157
  const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args);
3158
+ const { plugin: resolveFileUrl, meta: resolveFileUrlMeta } = bindingifyResolveFileUrl(args);
2898
3159
  const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args);
2899
3160
  const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args);
2900
3161
  const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args);
2901
3162
  const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args);
2902
3163
  const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args);
2903
- const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args);
2904
- const { plugin: footer, meta: footerMeta } = bindingifyFooter(args);
2905
- const { plugin: intro, meta: introMeta } = bindingifyIntro(args);
2906
- const { plugin: outro, meta: outroMeta } = bindingifyOutro(args);
3164
+ const { plugin: banner, meta: bannerMeta } = bindingifyAddonHook(args, "banner");
3165
+ const { plugin: footer, meta: footerMeta } = bindingifyAddonHook(args, "footer");
3166
+ const { plugin: intro, meta: introMeta } = bindingifyAddonHook(args, "intro");
3167
+ const { plugin: outro, meta: outroMeta } = bindingifyAddonHook(args, "outro");
2907
3168
  const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args);
3169
+ const { plugin: hotUpdate, meta: hotUpdateMeta } = bindingifyHotUpdate(args);
2908
3170
  const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args);
2909
3171
  let hookUsage = extractHookUsage(plugin).inner();
2910
- return wrapHandlers({
3172
+ const result = {
2911
3173
  name: plugin.name,
2912
3174
  buildStart,
2913
3175
  buildStartMeta,
@@ -2931,6 +3193,8 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
2931
3193
  renderChunkFilter,
2932
3194
  augmentChunkHash,
2933
3195
  augmentChunkHashMeta,
3196
+ resolveFileUrl,
3197
+ resolveFileUrlMeta,
2934
3198
  renderStart,
2935
3199
  renderStartMeta,
2936
3200
  renderError,
@@ -2951,12 +3215,19 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
2951
3215
  outroMeta,
2952
3216
  watchChange,
2953
3217
  watchChangeMeta,
3218
+ hotUpdate,
3219
+ hotUpdateMeta,
2954
3220
  closeWatcher,
2955
3221
  closeWatcherMeta,
2956
3222
  hookUsage
2957
- });
3223
+ };
3224
+ return wrapHandlers(result, {
3225
+ key: plugin,
3226
+ name: result.name,
3227
+ kind: "plugin"
3228
+ }, timings);
2958
3229
  }
2959
- function wrapHandlers(plugin) {
3230
+ function wrapHandlers(plugin, owner, timings) {
2960
3231
  for (const hookName of [
2961
3232
  "buildStart",
2962
3233
  "resolveId",
@@ -2967,6 +3238,7 @@ function wrapHandlers(plugin) {
2967
3238
  "load",
2968
3239
  "renderChunk",
2969
3240
  "augmentChunkHash",
3241
+ "resolveFileUrl",
2970
3242
  "renderStart",
2971
3243
  "renderError",
2972
3244
  "generateBundle",
@@ -2977,9 +3249,11 @@ function wrapHandlers(plugin) {
2977
3249
  "intro",
2978
3250
  "outro",
2979
3251
  "watchChange",
3252
+ "hotUpdate",
2980
3253
  "closeWatcher"
2981
3254
  ]) {
2982
- const handler = plugin[hookName];
3255
+ const raw = plugin[hookName];
3256
+ const handler = raw && measureHookCost(timings, owner, hookName, raw);
2983
3257
  if (handler) plugin[hookName] = async (...args) => {
2984
3258
  try {
2985
3259
  return await handler(...args);
@@ -3018,27 +3292,33 @@ function normalizeTransformOptions(inputOptions) {
3018
3292
  oxcTransformOptions
3019
3293
  };
3020
3294
  }
3021
- function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
3295
+ function getDefaultDevRuntime(host = "localhost", port = 3e3) {
3296
+ const runtimeEntry = node_fs.default.readFileSync((0, node_url.fileURLToPath)({}.resolve("#runtime")), "utf8");
3297
+ const runtimeHelperImportEnd = runtimeEntry.indexOf("\n");
3298
+ if (!runtimeEntry.startsWith("import ") || runtimeHelperImportEnd === -1) throw new Error("Expected the standalone runtime to start with a helper import");
3299
+ return `${runtimeEntry.slice(runtimeHelperImportEnd + 1)}\n${node_fs.default.readFileSync((0, node_url.fileURLToPath)({}.resolve("#default-runtime")), "utf8").replaceAll("$ADDR", `${host}:${port}`)}`;
3300
+ }
3301
+ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings) {
3022
3302
  const plugins = rawPlugins.map((plugin) => {
3023
- if ("_parallel" in plugin) return;
3303
+ if (getParallelPluginInfo(plugin)) return;
3024
3304
  if (plugin instanceof BuiltinPlugin) switch (plugin.name) {
3025
3305
  case "builtin:vite-manifest": return bindingifyManifestPlugin(plugin, pluginContextData);
3026
3306
  default: return bindingifyBuiltInPlugin(plugin);
3027
3307
  }
3028
- return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
3308
+ return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings);
3029
3309
  });
3030
3310
  const normalizedTransform = normalizeTransformOptions(inputOptions);
3031
3311
  return {
3032
3312
  input: bindingifyInput(inputOptions.input),
3033
3313
  plugins,
3034
3314
  cwd: inputOptions.cwd ?? process.cwd(),
3035
- external: bindingifyExternal(inputOptions.external),
3315
+ external: bindingifyExternal(inputOptions.external, timings),
3036
3316
  resolve: bindingifyResolve(inputOptions.resolve),
3037
3317
  platform: inputOptions.platform,
3038
3318
  shimMissingExports: inputOptions.shimMissingExports,
3039
3319
  logLevel: bindingifyLogLevel(logLevel),
3040
3320
  onLog,
3041
- treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
3321
+ treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake, timings),
3042
3322
  moduleTypes: inputOptions.moduleTypes,
3043
3323
  define: normalizedTransform.define,
3044
3324
  inject: bindingifyInject(normalizedTransform.inject),
@@ -3049,6 +3329,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, pluginC
3049
3329
  dropLabels: normalizedTransform.dropLabels,
3050
3330
  keepNames: outputOptions.keepNames,
3051
3331
  checks: inputOptions.checks,
3332
+ pluginTimings: timings ? () => summarizePluginTimings(inputOptions) : void 0,
3052
3333
  deferSyncScanData: () => {
3053
3334
  let ret = [];
3054
3335
  pluginContextData.moduleOptionMap.forEach((value, key) => {
@@ -3070,35 +3351,46 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, pluginC
3070
3351
  }
3071
3352
  function bindingifyDevMode(devMode) {
3072
3353
  if (devMode) {
3073
- if (typeof devMode === "boolean") return devMode ? {} : void 0;
3074
- return devMode;
3354
+ if (typeof devMode === "boolean") return devMode ? {
3355
+ implement: getDefaultDevRuntime(),
3356
+ skipCommonRuntimeInjection: true
3357
+ } : void 0;
3358
+ const usesDefaultRuntime = devMode.implement == null;
3359
+ return {
3360
+ ...devMode,
3361
+ implement: devMode.implement ?? getDefaultDevRuntime(devMode.host, devMode.port),
3362
+ skipCommonRuntimeInjection: usesDefaultRuntime ? true : devMode.skipCommonRuntimeInjection
3363
+ };
3075
3364
  }
3076
3365
  }
3077
3366
  function bindingifyAttachDebugInfo(attachDebugInfo) {
3078
3367
  switch (attachDebugInfo) {
3079
3368
  case void 0: return;
3080
- case "full": return import_binding$3.BindingAttachDebugInfo.Full;
3081
- case "simple": return import_binding$3.BindingAttachDebugInfo.Simple;
3082
- case "none": return import_binding$3.BindingAttachDebugInfo.None;
3369
+ case "full": return import_binding$4.BindingAttachDebugInfo.Full;
3370
+ case "simple": return import_binding$4.BindingAttachDebugInfo.Simple;
3371
+ case "none": return import_binding$4.BindingAttachDebugInfo.None;
3083
3372
  }
3084
3373
  }
3085
- function bindingifyExternal(external) {
3374
+ function bindingifyExternal(external, timings) {
3086
3375
  if (external) {
3087
- if (typeof external === "function") return (id, importer, isResolved) => {
3088
- if (id.startsWith("\0")) return false;
3089
- return external(id, importer, isResolved) ?? false;
3090
- };
3376
+ if (typeof external === "function") {
3377
+ const measured = measureHookCost(timings, INPUT_OPTIONS_OWNER, "external", external);
3378
+ return (id, importer, isResolved) => {
3379
+ if (id.startsWith("\0")) return false;
3380
+ return measured(id, importer, isResolved) ?? false;
3381
+ };
3382
+ }
3091
3383
  return arraify(external);
3092
3384
  }
3093
3385
  }
3094
3386
  function bindingifyExperimental(experimental) {
3095
- let chunkModulesOrder = import_binding$3.BindingChunkModuleOrderBy.ExecOrder;
3387
+ let chunkModulesOrder = import_binding$4.BindingChunkModuleOrderBy.ExecOrder;
3096
3388
  if (experimental?.chunkModulesOrder) switch (experimental.chunkModulesOrder) {
3097
3389
  case "exec-order":
3098
- chunkModulesOrder = import_binding$3.BindingChunkModuleOrderBy.ExecOrder;
3390
+ chunkModulesOrder = import_binding$4.BindingChunkModuleOrderBy.ExecOrder;
3099
3391
  break;
3100
3392
  case "module-id":
3101
- chunkModulesOrder = import_binding$3.BindingChunkModuleOrderBy.ModuleId;
3393
+ chunkModulesOrder = import_binding$4.BindingChunkModuleOrderBy.ModuleId;
3102
3394
  break;
3103
3395
  default: throw new Error(`Unexpected chunkModulesOrder: ${experimental.chunkModulesOrder}`);
3104
3396
  }
@@ -3158,10 +3450,10 @@ function bindingifyInject(inject) {
3158
3450
  }
3159
3451
  function bindingifyLogLevel(logLevel) {
3160
3452
  switch (logLevel) {
3161
- case "silent": return import_binding$3.BindingLogLevel.Silent;
3162
- case "debug": return import_binding$3.BindingLogLevel.Debug;
3163
- case "warn": return import_binding$3.BindingLogLevel.Warn;
3164
- case "info": return import_binding$3.BindingLogLevel.Info;
3453
+ case "silent": return import_binding$4.BindingLogLevel.Silent;
3454
+ case "debug": return import_binding$4.BindingLogLevel.Debug;
3455
+ case "warn": return import_binding$4.BindingLogLevel.Warn;
3456
+ case "info": return import_binding$4.BindingLogLevel.Info;
3165
3457
  default: throw new Error(`Unexpected log level: ${logLevel}`);
3166
3458
  }
3167
3459
  }
@@ -3178,11 +3470,7 @@ function bindingifyInput(input) {
3178
3470
  }
3179
3471
  function bindingifyWatch(watch) {
3180
3472
  if (watch) {
3181
- if (watch.notify) console.warn("The \"watch.notify\" option is deprecated. Please use \"watch.watcher\" instead.");
3182
- const watcher = {
3183
- ...watch.notify,
3184
- ...watch.watcher
3185
- };
3473
+ const watcher = watch.watcher ?? {};
3186
3474
  return {
3187
3475
  buildDelay: watch.buildDelay,
3188
3476
  skipWrite: watch.skipWrite,
@@ -3198,7 +3486,7 @@ function bindingifyWatch(watch) {
3198
3486
  };
3199
3487
  }
3200
3488
  }
3201
- function bindingifyTreeshakeOptions(config) {
3489
+ function bindingifyTreeshakeOptions(config, timings) {
3202
3490
  if (config === false) return;
3203
3491
  if (config === true || config === void 0) return { moduleSideEffects: true };
3204
3492
  let normalizedConfig = {
@@ -3211,21 +3499,15 @@ function bindingifyTreeshakeOptions(config) {
3211
3499
  };
3212
3500
  switch (config.propertyReadSideEffects) {
3213
3501
  case "always":
3214
- normalizedConfig.propertyReadSideEffects = import_binding$3.BindingPropertyReadSideEffects.Always;
3502
+ normalizedConfig.propertyReadSideEffects = import_binding$4.BindingPropertyReadSideEffects.Always;
3215
3503
  break;
3216
- case false:
3217
- normalizedConfig.propertyReadSideEffects = import_binding$3.BindingPropertyReadSideEffects.False;
3218
- break;
3219
- default:
3504
+ case false: normalizedConfig.propertyReadSideEffects = import_binding$4.BindingPropertyReadSideEffects.False;
3220
3505
  }
3221
3506
  switch (config.propertyWriteSideEffects) {
3222
3507
  case "always":
3223
- normalizedConfig.propertyWriteSideEffects = import_binding$3.BindingPropertyWriteSideEffects.Always;
3224
- break;
3225
- case false:
3226
- normalizedConfig.propertyWriteSideEffects = import_binding$3.BindingPropertyWriteSideEffects.False;
3508
+ normalizedConfig.propertyWriteSideEffects = import_binding$4.BindingPropertyWriteSideEffects.Always;
3227
3509
  break;
3228
- default:
3510
+ case false: normalizedConfig.propertyWriteSideEffects = import_binding$4.BindingPropertyWriteSideEffects.False;
3229
3511
  }
3230
3512
  if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
3231
3513
  else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
@@ -3235,7 +3517,7 @@ function bindingifyTreeshakeOptions(config) {
3235
3517
  external: false,
3236
3518
  sideEffects: true
3237
3519
  }];
3238
- else normalizedConfig.moduleSideEffects = config.moduleSideEffects;
3520
+ else normalizedConfig.moduleSideEffects = measureIfFunction(timings, INPUT_OPTIONS_OWNER, "treeshake.moduleSideEffects", config.moduleSideEffects);
3239
3521
  return normalizedConfig;
3240
3522
  }
3241
3523
  function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative) {
@@ -3257,8 +3539,7 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
3257
3539
  };
3258
3540
  }
3259
3541
  //#endregion
3260
- //#region ../../node_modules/rolldown/dist/shared/rolldown-build-DR0wzp0V.mjs
3261
- var import_binding$2 = /* @__PURE__ */ __toESM(require_binding(), 1);
3542
+ //#region ../../node_modules/rolldown/dist/shared/create-bundler-option-kXHnIt4b.mjs
3262
3543
  function getLogger(plugins, onLog, logLevel, watchMode) {
3263
3544
  const minimalPriority = logLevelPriority[logLevel];
3264
3545
  const logger = (level, log, skipped = /* @__PURE__ */ new Set()) => {
@@ -3277,7 +3558,7 @@ function getLogger(plugins, onLog, logLevel, watchMode) {
3277
3558
  info: getLogHandler("info"),
3278
3559
  meta: {
3279
3560
  rollupVersion: "4.23.0",
3280
- rolldownVersion: "1.1.3",
3561
+ rolldownVersion: "1.2.8",
3281
3562
  watchMode
3282
3563
  },
3283
3564
  warn: getLogHandler("warn"),
@@ -3351,7 +3632,8 @@ var ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES = [
3351
3632
  "renderStart",
3352
3633
  "renderError",
3353
3634
  "writeBundle",
3354
- "generateBundle"
3635
+ "generateBundle",
3636
+ "resolveFileUrl"
3355
3637
  ];
3356
3638
  var ENUMERATED_PLUGIN_HOOK_NAMES = [
3357
3639
  ...ENUMERATED_INPUT_PLUGIN_HOOK_NAMES,
@@ -3361,7 +3643,13 @@ var ENUMERATED_PLUGIN_HOOK_NAMES = [
3361
3643
  "intro",
3362
3644
  "outro"
3363
3645
  ];
3364
- ENUMERATED_PLUGIN_HOOK_NAMES[0], ENUMERATED_PLUGIN_HOOK_NAMES[0], ENUMERATED_PLUGIN_HOOK_NAMES[1], ENUMERATED_PLUGIN_HOOK_NAMES[1], ENUMERATED_PLUGIN_HOOK_NAMES[2], ENUMERATED_PLUGIN_HOOK_NAMES[2], ENUMERATED_PLUGIN_HOOK_NAMES[3], ENUMERATED_PLUGIN_HOOK_NAMES[3], ENUMERATED_PLUGIN_HOOK_NAMES[4], ENUMERATED_PLUGIN_HOOK_NAMES[4], ENUMERATED_PLUGIN_HOOK_NAMES[5], ENUMERATED_PLUGIN_HOOK_NAMES[5], ENUMERATED_PLUGIN_HOOK_NAMES[6], ENUMERATED_PLUGIN_HOOK_NAMES[6], ENUMERATED_PLUGIN_HOOK_NAMES[7], ENUMERATED_PLUGIN_HOOK_NAMES[7], ENUMERATED_PLUGIN_HOOK_NAMES[8], ENUMERATED_PLUGIN_HOOK_NAMES[8], ENUMERATED_PLUGIN_HOOK_NAMES[9], ENUMERATED_PLUGIN_HOOK_NAMES[9], ENUMERATED_PLUGIN_HOOK_NAMES[10], ENUMERATED_PLUGIN_HOOK_NAMES[10], ENUMERATED_PLUGIN_HOOK_NAMES[11], ENUMERATED_PLUGIN_HOOK_NAMES[11], ENUMERATED_PLUGIN_HOOK_NAMES[12], ENUMERATED_PLUGIN_HOOK_NAMES[12], ENUMERATED_PLUGIN_HOOK_NAMES[13], ENUMERATED_PLUGIN_HOOK_NAMES[13], ENUMERATED_PLUGIN_HOOK_NAMES[14], ENUMERATED_PLUGIN_HOOK_NAMES[14], ENUMERATED_PLUGIN_HOOK_NAMES[15], ENUMERATED_PLUGIN_HOOK_NAMES[15], ENUMERATED_PLUGIN_HOOK_NAMES[16], ENUMERATED_PLUGIN_HOOK_NAMES[16], ENUMERATED_PLUGIN_HOOK_NAMES[17], ENUMERATED_PLUGIN_HOOK_NAMES[17], ENUMERATED_PLUGIN_HOOK_NAMES[18], ENUMERATED_PLUGIN_HOOK_NAMES[18], ENUMERATED_PLUGIN_HOOK_NAMES[19], ENUMERATED_PLUGIN_HOOK_NAMES[19], ENUMERATED_PLUGIN_HOOK_NAMES[20], ENUMERATED_PLUGIN_HOOK_NAMES[20], ENUMERATED_PLUGIN_HOOK_NAMES[21], ENUMERATED_PLUGIN_HOOK_NAMES[21], ENUMERATED_PLUGIN_HOOK_NAMES[22], ENUMERATED_PLUGIN_HOOK_NAMES[22];
3646
+ ENUMERATED_PLUGIN_HOOK_NAMES[0], ENUMERATED_PLUGIN_HOOK_NAMES[0], ENUMERATED_PLUGIN_HOOK_NAMES[1], ENUMERATED_PLUGIN_HOOK_NAMES[1], ENUMERATED_PLUGIN_HOOK_NAMES[2], ENUMERATED_PLUGIN_HOOK_NAMES[2], ENUMERATED_PLUGIN_HOOK_NAMES[3], ENUMERATED_PLUGIN_HOOK_NAMES[3], ENUMERATED_PLUGIN_HOOK_NAMES[4], ENUMERATED_PLUGIN_HOOK_NAMES[4], ENUMERATED_PLUGIN_HOOK_NAMES[5], ENUMERATED_PLUGIN_HOOK_NAMES[5], ENUMERATED_PLUGIN_HOOK_NAMES[6], ENUMERATED_PLUGIN_HOOK_NAMES[6], ENUMERATED_PLUGIN_HOOK_NAMES[7], ENUMERATED_PLUGIN_HOOK_NAMES[7], ENUMERATED_PLUGIN_HOOK_NAMES[8], ENUMERATED_PLUGIN_HOOK_NAMES[8], ENUMERATED_PLUGIN_HOOK_NAMES[9], ENUMERATED_PLUGIN_HOOK_NAMES[9], ENUMERATED_PLUGIN_HOOK_NAMES[10], ENUMERATED_PLUGIN_HOOK_NAMES[10], ENUMERATED_PLUGIN_HOOK_NAMES[11], ENUMERATED_PLUGIN_HOOK_NAMES[11], ENUMERATED_PLUGIN_HOOK_NAMES[12], ENUMERATED_PLUGIN_HOOK_NAMES[12], ENUMERATED_PLUGIN_HOOK_NAMES[13], ENUMERATED_PLUGIN_HOOK_NAMES[13], ENUMERATED_PLUGIN_HOOK_NAMES[14], ENUMERATED_PLUGIN_HOOK_NAMES[14], ENUMERATED_PLUGIN_HOOK_NAMES[15], ENUMERATED_PLUGIN_HOOK_NAMES[15], ENUMERATED_PLUGIN_HOOK_NAMES[16], ENUMERATED_PLUGIN_HOOK_NAMES[16], ENUMERATED_PLUGIN_HOOK_NAMES[17], ENUMERATED_PLUGIN_HOOK_NAMES[17], ENUMERATED_PLUGIN_HOOK_NAMES[18], ENUMERATED_PLUGIN_HOOK_NAMES[18], ENUMERATED_PLUGIN_HOOK_NAMES[19], ENUMERATED_PLUGIN_HOOK_NAMES[19], ENUMERATED_PLUGIN_HOOK_NAMES[20], ENUMERATED_PLUGIN_HOOK_NAMES[20], ENUMERATED_PLUGIN_HOOK_NAMES[21], ENUMERATED_PLUGIN_HOOK_NAMES[21], ENUMERATED_PLUGIN_HOOK_NAMES[22], ENUMERATED_PLUGIN_HOOK_NAMES[22], ENUMERATED_PLUGIN_HOOK_NAMES[23], ENUMERATED_PLUGIN_HOOK_NAMES[23];
3647
+ /**
3648
+ * Names of the hidden hooks, alongside {@linkcode InternalFunctionPluginHooks}.
3649
+ * Kept separate from `ENUMERATED_INPUT_PLUGIN_HOOK_NAMES` so the names stay out
3650
+ * of the published `.d.ts` (that list's type is reachable from public types).
3651
+ */
3652
+ var INTERNAL_PLUGIN_HOOK_NAMES = ["hotUpdate"];
3365
3653
  async function asyncFlatten(array) {
3366
3654
  do
3367
3655
  array = (await Promise.all(array)).flat(Infinity);
@@ -3370,7 +3658,7 @@ async function asyncFlatten(array) {
3370
3658
  }
3371
3659
  var normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
3372
3660
  function checkOutputPluginOption(plugins, onLog) {
3373
- for (const plugin of plugins) for (const hook of ENUMERATED_INPUT_PLUGIN_HOOK_NAMES) if (hook in plugin) {
3661
+ for (const plugin of plugins) for (const hook of [...ENUMERATED_INPUT_PLUGIN_HOOK_NAMES, ...INTERNAL_PLUGIN_HOOK_NAMES]) if (hook in plugin) {
3374
3662
  delete plugin[hook];
3375
3663
  onLog(LOG_LEVEL_WARN, logInputHookInOutputPlugin(plugin.name, hook));
3376
3664
  }
@@ -3378,9 +3666,10 @@ function checkOutputPluginOption(plugins, onLog) {
3378
3666
  }
3379
3667
  function normalizePlugins(plugins, anonymousPrefix) {
3380
3668
  for (const [index, plugin] of plugins.entries()) {
3381
- if ("_parallel" in plugin) continue;
3669
+ if (getParallelPluginInfo(plugin)) continue;
3382
3670
  if (plugin instanceof BuiltinPlugin) continue;
3383
- if (!plugin.name) plugin.name = `${anonymousPrefix}${index + 1}`;
3671
+ const objectPlugin = plugin;
3672
+ if (!objectPlugin.name) objectPlugin.name = `${anonymousPrefix}${index + 1}`;
3384
3673
  }
3385
3674
  return plugins;
3386
3675
  }
@@ -3419,7 +3708,7 @@ var PluginDriver = class {
3419
3708
  function getObjectPlugins(plugins) {
3420
3709
  return plugins.filter((plugin) => {
3421
3710
  if (!plugin) return;
3422
- if ("_parallel" in plugin) return;
3711
+ if (getParallelPluginInfo(plugin)) return;
3423
3712
  if (plugin instanceof BuiltinPlugin) return;
3424
3713
  return plugin;
3425
3714
  });
@@ -4661,7 +4950,8 @@ var ChecksOptionsSchema = /* @__PURE__ */ strictObject({
4661
4950
  unsupportedTsconfigOption: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a tsconfig option or combination of options is not supported")),
4662
4951
  ineffectiveDynamicImport: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a module is dynamically imported but also statically imported, making the dynamic import ineffective for code splitting")),
4663
4952
  largeBarrelModules: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit info logs when a barrel module has a very large number of re-exports (more than 5000)")),
4664
- sourcemapBroken: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a plugin transforms code without generating a sourcemap"))
4953
+ sourcemapBroken: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a plugin transforms code without generating a sourcemap")),
4954
+ namespaceConflict: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when multiple star re-exports provide the same name from different modules"))
4665
4955
  });
4666
4956
  var MinifyOptionsSchema = /* @__PURE__ */ strictObject({
4667
4957
  compress: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
@@ -4692,8 +4982,17 @@ var MinifyOptionsSchema = /* @__PURE__ */ strictObject({
4692
4982
  function: /* @__PURE__ */ boolean(),
4693
4983
  class: /* @__PURE__ */ boolean()
4694
4984
  })])),
4985
+ reserved: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
4695
4986
  debug: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
4696
4987
  })])),
4988
+ mangleProps: /* @__PURE__ */ optional(/* @__PURE__ */ strictObject({
4989
+ include: /* @__PURE__ */ instance(RegExp),
4990
+ exclude: /* @__PURE__ */ optional(/* @__PURE__ */ instance(RegExp)),
4991
+ reserved: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
4992
+ quoted: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
4993
+ debug: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
4994
+ cache: /* @__PURE__ */ optional(/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ union([/* @__PURE__ */ string(), /* @__PURE__ */ literal(false)])))
4995
+ })),
4697
4996
  codegen: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
4698
4997
  removeWhitespace: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
4699
4998
  legalComments: /* @__PURE__ */ optional(/* @__PURE__ */ union([
@@ -4750,6 +5049,7 @@ var DevModeSchema = /* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE
4750
5049
  port: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
4751
5050
  host: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
4752
5051
  implement: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
5052
+ skipCommonRuntimeInjection: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
4753
5053
  lazy: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
4754
5054
  })]);
4755
5055
  var InputOptionsSchema = /* @__PURE__ */ strictObject({
@@ -4899,6 +5199,7 @@ var OutputOptionsSchema = /* @__PURE__ */ strictObject({
4899
5199
  /* @__PURE__ */ literal("hidden")
4900
5200
  ])), /* @__PURE__ */ description(`Generate sourcemap (\`-s inline\` for inline, or \`-s\` for \`.map\` file)`)),
4901
5201
  sourcemapBaseUrl: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Base URL used to prefix sourcemap paths")),
5202
+ sourcemapFileNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(ChunkFileNamesSchema), /* @__PURE__ */ description("Name pattern for emitted sourcemaps")),
4902
5203
  sourcemapDebugIds: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Inject sourcemap debug IDs")),
4903
5204
  sourcemapExcludeSources: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Exclude source content from sourcemaps")),
4904
5205
  sourcemapIgnoreList: /* @__PURE__ */ optional(/* @__PURE__ */ union([
@@ -4950,7 +5251,7 @@ var OutputOptionsSchema = /* @__PURE__ */ strictObject({
4950
5251
  topLevelVar: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Rewrite top-level declarations to use `var`.")),
4951
5252
  cleanDir: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Clean output directory before emitting output")),
4952
5253
  keepNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Keep function and class names after bundling")),
4953
- strictExecutionOrder: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Lets modules be executed in the order they are declared.")),
5254
+ strictExecutionOrder: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Preserve source module execution order across generated chunks.")),
4954
5255
  strict: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ literal("auto")])), /* @__PURE__ */ description("Whether to always output `\"use strict\"` directive in non-ES module outputs."))
4955
5256
  });
4956
5257
  var getAddonDescription = (placement, wrapper) => {
@@ -4972,7 +5273,7 @@ var OutputCliOverrideSchema = /* @__PURE__ */ strictObject({
4972
5273
  codeSplitting: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
4973
5274
  minSize: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum size of the chunk")),
4974
5275
  minShareCount: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum share count of the chunk"))
4975
- })])), /* @__PURE__ */ description("Code splitting options (true, false, or object)")),
5276
+ })])), /* @__PURE__ */ description("Code splitting options. Enabled by default; use `--no-codeSplitting` to disable, or `--codeSplitting.minSize` / `--codeSplitting.minShareCount` to configure")),
4976
5277
  advancedChunks: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ strictObject({
4977
5278
  minSize: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum size of the chunk")),
4978
5279
  minShareCount: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum share count of the chunk"))
@@ -5006,52 +5307,48 @@ function validateOption(key, options) {
5006
5307
  let issueMsg = issue.message;
5007
5308
  const issuePaths = issue.path.map((path) => path.key);
5008
5309
  if (issue.type === "union") {
5009
- const subIssue = issue.issues?.find((i) => !(i.type !== issue.received && i.input === issue.input));
5010
- if (subIssue) {
5011
- if (subIssue.path) issuePaths.push(subIssue.path.map((path) => path.key));
5012
- issueMsg = subIssue.message;
5013
- }
5014
- }
5015
- const stringPath = issuePaths.join(".");
5016
- const helper = key === "input" ? inputHelperMsgRecord[stringPath] : outputHelperMsgRecord[stringPath];
5017
- if (helper && helper.ignored) return "";
5018
- return `- For the "${stringPath}". ${helper?.issueMsg || issueMsg + "."} ${helper?.help ? `\n Help: ${helper.help}` : ""}`;
5019
- }).filter(Boolean);
5020
- if (errors.length) console.warn(`\x1b[33mWarning: Invalid ${key} options (${errors.length} issue${errors.length === 1 ? "" : "s"} found)\n${errors.join("\n")}\x1b[0m`);
5021
- }
5022
- }
5023
- var RolldownOutputImpl = class extends PlainObjectLike {
5024
- bindingOutputs;
5025
- constructor(bindingOutputs) {
5026
- super();
5027
- this.bindingOutputs = bindingOutputs;
5028
- }
5029
- get output() {
5030
- return transformToRollupOutput(this.bindingOutputs).output;
5031
- }
5032
- __rolldown_external_memory_handle__(keepDataAlive) {
5033
- const results = this.output.map((item) => item.__rolldown_external_memory_handle__(keepDataAlive));
5034
- if (!results.every((r) => r.freed)) {
5035
- const reasons = results.filter((r) => !r.freed).map((r) => r.reason).filter(Boolean);
5036
- return {
5037
- freed: false,
5038
- reason: `Failed to free ${reasons.length} item(s): ${reasons.join("; ")}`
5039
- };
5040
- }
5041
- return { freed: true };
5310
+ const subIssue = issue.issues?.find((i) => !(i.type !== issue.received && i.input === issue.input));
5311
+ if (subIssue) {
5312
+ if (subIssue.path) issuePaths.push(subIssue.path.map((path) => path.key));
5313
+ issueMsg = subIssue.message;
5314
+ }
5315
+ }
5316
+ const stringPath = issuePaths.join(".");
5317
+ const helper = key === "input" ? inputHelperMsgRecord[stringPath] : outputHelperMsgRecord[stringPath];
5318
+ if (helper && helper.ignored) return "";
5319
+ return `- For the "${stringPath}". ${helper?.issueMsg || issueMsg + "."} ${helper?.help ? `\n Help: ${helper.help}` : ""}`;
5320
+ }).filter(Boolean);
5321
+ if (errors.length) console.warn(`\x1b[33mWarning: Invalid ${key} options (${errors.length} issue${errors.length === 1 ? "" : "s"} found)\n${errors.join("\n")}\x1b[0m`);
5042
5322
  }
5043
- };
5044
- __decorate([lazyProp], RolldownOutputImpl.prototype, "output", null);
5323
+ }
5045
5324
  var ChunkingContextImpl = class {
5046
5325
  context;
5047
5326
  pluginContextData;
5327
+ moduleInfoCache = /* @__PURE__ */ new Map();
5048
5328
  constructor(context, pluginContextData) {
5049
5329
  this.context = context;
5050
5330
  this.pluginContextData = pluginContextData;
5051
5331
  }
5332
+ clearModuleInfoCache() {
5333
+ this.moduleInfoCache = void 0;
5334
+ }
5052
5335
  getModuleInfo(moduleId) {
5336
+ const cached = this.moduleInfoCache?.get(moduleId);
5337
+ if (cached) return cached;
5053
5338
  const bindingInfo = this.context.getModuleInfo(moduleId);
5054
- if (bindingInfo) return transformModuleInfo(bindingInfo, this.pluginContextData.getModuleOption(moduleId));
5339
+ if (bindingInfo) {
5340
+ const option = this.pluginContextData.getModuleOption(moduleId);
5341
+ const info = transformModuleInfo(bindingInfo, option);
5342
+ Object.defineProperty(info, "moduleSideEffects", {
5343
+ get: () => option.moduleSideEffects,
5344
+ set: (moduleSideEffects) => {
5345
+ option.moduleSideEffects = moduleSideEffects;
5346
+ option.invalidate = true;
5347
+ }
5348
+ });
5349
+ this.moduleInfoCache?.set(moduleId, info);
5350
+ return info;
5351
+ }
5055
5352
  return null;
5056
5353
  }
5057
5354
  };
@@ -5464,10 +5761,11 @@ ${indent}`);
5464
5761
  return causedPrefix + message + "\n" + stack + causedError;
5465
5762
  }
5466
5763
  formatArgs(args, opts) {
5467
- return (0, node_util.formatWithOptions)(opts, ...args.map((arg) => {
5764
+ const _args = args.map((arg) => {
5468
5765
  if (arg && typeof arg.stack === "string") return this.formatError(arg, opts);
5469
5766
  return arg;
5470
- }));
5767
+ });
5768
+ return (0, node_util.formatWithOptions)(opts, ..._args);
5471
5769
  }
5472
5770
  formatDate(date, opts) {
5473
5771
  return opts.date ? date.toLocaleTimeString() : "";
@@ -5681,13 +5979,15 @@ function box(text, _opts = {}) {
5681
5979
  if (opts.style.marginBottom > 0) boxLines.push("".repeat(opts.style.marginBottom));
5682
5980
  return boxLines.join("\n");
5683
5981
  }
5684
- var r = Object.create(null), i = (e) => globalThis.process?.env || {
5982
+ var r = Object.create(null);
5983
+ var i = (e) => globalThis.process?.env || {
5685
5984
  "BASE_URL": "/",
5686
5985
  "DEV": false,
5687
5986
  "MODE": "production",
5688
5987
  "PROD": true,
5689
5988
  "SSR": false
5690
- }, o = new Proxy(r, {
5989
+ };
5990
+ var o = new Proxy(r, {
5691
5991
  get(e, s) {
5692
5992
  return i()[s] ?? r[s];
5693
5993
  },
@@ -5707,7 +6007,9 @@ var r = Object.create(null), i = (e) => globalThis.process?.env || {
5707
6007
  const e = i(true);
5708
6008
  return Object.keys(e);
5709
6009
  }
5710
- }), t = typeof process < "u" && process.env && process.env.NODE_ENV || "", f = [
6010
+ });
6011
+ var t = typeof process < "u" && process.env && process.env.NODE_ENV || "";
6012
+ var f = [
5711
6013
  ["APPVEYOR"],
5712
6014
  [
5713
6015
  "AWS_AMPLIFY",
@@ -5819,19 +6121,31 @@ l.name;
5819
6121
  function n(e) {
5820
6122
  return e ? e !== "false" : false;
5821
6123
  }
5822
- var I = globalThis.process?.platform || "", T = n(o.CI) || l.ci !== false, a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY), g = n(o.DEBUG), R = t === "test" || n(o.TEST);
6124
+ var I = globalThis.process?.platform || "";
6125
+ var T = n(o.CI) || l.ci !== false;
6126
+ var a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
6127
+ var g = n(o.DEBUG);
6128
+ var R = t === "test" || n(o.TEST);
5823
6129
  o.MINIMAL;
5824
6130
  var A = /^win/i.test(I);
5825
6131
  !n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (a || A) && o.TERM);
5826
6132
  var C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
5827
6133
  Number(C?.split(".")[0]);
5828
- var y = globalThis.process || Object.create(null), _ = { versions: {} };
6134
+ var y = globalThis.process || Object.create(null);
6135
+ var _ = { versions: {} };
5829
6136
  new Proxy(y, { get(e, s) {
5830
6137
  if (s === "env") return o;
5831
6138
  if (s in e) return e[s];
5832
6139
  if (s in _) return _[s];
5833
6140
  } });
5834
- var c = globalThis.process?.release?.name === "node", O = !!globalThis.Bun || !!globalThis.process?.versions?.bun, D = !!globalThis.Deno, L = !!globalThis.fastly, S = !!globalThis.Netlify, u = !!globalThis.EdgeRuntime, N = globalThis.navigator?.userAgent === "Cloudflare-Workers", F = [
6141
+ var c = globalThis.process?.release?.name === "node";
6142
+ var O = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
6143
+ var D = !!globalThis.Deno;
6144
+ var L = !!globalThis.fastly;
6145
+ var S = !!globalThis.Netlify;
6146
+ var u = !!globalThis.EdgeRuntime;
6147
+ var N = globalThis.navigator?.userAgent === "Cloudflare-Workers";
6148
+ var F = [
5835
6149
  [S, "netlify"],
5836
6150
  [u, "edge-light"],
5837
6151
  [N, "workerd"],
@@ -5989,7 +6303,7 @@ function createConsola(options = {}) {
5989
6303
  defaults: { level },
5990
6304
  stdout: process.stdout,
5991
6305
  stderr: process.stderr,
5992
- prompt: (...args) => Promise.resolve().then(() => require("./prompt-B1Yc1NPt.cjs")).then((m) => m.prompt(...args)),
6306
+ prompt: (...args) => Promise.resolve().then(() => require("./prompt-CH6TK0bC.cjs")).then((m) => m.prompt(...args)),
5993
6307
  reporters: options.reporters || [options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
5994
6308
  ...options
5995
6309
  });
@@ -6025,10 +6339,10 @@ function createTestingLogger() {
6025
6339
  for (const type of types) ret[type] = (...args) => console.log(...args);
6026
6340
  return ret;
6027
6341
  }
6028
- function bindingifyOutputOptions(outputOptions, pluginContextData) {
6029
- const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapExcludeSources, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, banner, footer, postBanner, postFooter, intro, outro, esModule, globals, paths, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, comments, preserveModulesRoot, manualChunks, topLevelVar, cleanDir, strictExecutionOrder } = outputOptions;
6342
+ function bindingifyOutputOptions(outputOptions, pluginContextData, timings) {
6343
+ const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapFileNames, sourcemapExcludeSources, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, banner, footer, postBanner, postFooter, intro, outro, esModule, globals, paths, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, comments, preserveModulesRoot, manualChunks, topLevelVar, cleanDir, strictExecutionOrder } = outputOptions;
6030
6344
  if (legalComments != null) logger.warn("`legalComments` option is deprecated, please use `comments.legal` instead.");
6031
- const { inlineDynamicImports, advancedChunks } = bindingifyCodeSplitting(outputOptions.codeSplitting, outputOptions.inlineDynamicImports, outputOptions.advancedChunks, manualChunks, pluginContextData);
6345
+ const { inlineDynamicImports, advancedChunks } = bindingifyCodeSplitting(outputOptions.codeSplitting, outputOptions.inlineDynamicImports, outputOptions.advancedChunks, manualChunks, pluginContextData, timings);
6032
6346
  return {
6033
6347
  dir,
6034
6348
  file: file == null ? void 0 : file,
@@ -6038,24 +6352,25 @@ function bindingifyOutputOptions(outputOptions, pluginContextData) {
6038
6352
  sourcemap: bindingifySourcemap(sourcemap),
6039
6353
  sourcemapBaseUrl,
6040
6354
  sourcemapDebugIds,
6355
+ sourcemapFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapFileNames", sourcemapFileNames),
6041
6356
  sourcemapExcludeSources,
6042
- sourcemapIgnoreList: sourcemapIgnoreList ?? /node_modules/,
6043
- sourcemapPathTransform,
6044
- banner: bindingifyAddon(banner),
6045
- footer: bindingifyAddon(footer),
6046
- postBanner: bindingifyAddon(postBanner),
6047
- postFooter: bindingifyAddon(postFooter),
6048
- intro: bindingifyAddon(intro),
6049
- outro: bindingifyAddon(outro),
6357
+ sourcemapIgnoreList: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapIgnoreList", sourcemapIgnoreList ?? /node_modules/),
6358
+ sourcemapPathTransform: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapPathTransform", sourcemapPathTransform),
6359
+ banner: bindingifyAddon(banner, "banner", timings),
6360
+ footer: bindingifyAddon(footer, "footer", timings),
6361
+ postBanner: bindingifyAddon(postBanner, "postBanner", timings),
6362
+ postFooter: bindingifyAddon(postFooter, "postFooter", timings),
6363
+ intro: bindingifyAddon(intro, "intro", timings),
6364
+ outro: bindingifyAddon(outro, "outro", timings),
6050
6365
  extend: outputOptions.extend,
6051
- globals,
6052
- paths,
6366
+ globals: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "globals", globals),
6367
+ paths: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "paths", paths),
6053
6368
  generatedCode,
6054
6369
  esModule,
6055
6370
  name,
6056
6371
  assetFileNames: bindingifyAssetFilenames(assetFileNames),
6057
- entryFileNames,
6058
- chunkFileNames,
6372
+ entryFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "entryFileNames", entryFileNames),
6373
+ chunkFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "chunkFileNames", chunkFileNames),
6059
6374
  plugins: [],
6060
6375
  minify: outputOptions.minify,
6061
6376
  externalLiveBindings: outputOptions.externalLiveBindings,
@@ -6076,9 +6391,12 @@ function bindingifyOutputOptions(outputOptions, pluginContextData) {
6076
6391
  strict: outputOptions.strict
6077
6392
  };
6078
6393
  }
6079
- function bindingifyAddon(configAddon) {
6394
+ function bindingifyAddon(configAddon, name, timings) {
6080
6395
  if (configAddon == null || configAddon === "") return;
6081
- if (typeof configAddon === "function") return async (chunk) => configAddon(transformRenderedChunk(chunk));
6396
+ if (typeof configAddon === "function") {
6397
+ const measured = measureHookCost(timings, OUTPUT_OPTIONS_OWNER, name, configAddon);
6398
+ return async (chunk) => measured(transformRenderedChunk(chunk));
6399
+ }
6082
6400
  return configAddon;
6083
6401
  }
6084
6402
  function bindingifyFormat(format) {
@@ -6122,7 +6440,7 @@ function bindingifyComments(comments) {
6122
6440
  if (typeof comments === "boolean") return comments;
6123
6441
  return comments;
6124
6442
  }
6125
- function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, advancedChunks, manualChunks, pluginContextData) {
6443
+ function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, advancedChunks, manualChunks, pluginContextData, timings) {
6126
6444
  let inlineDynamicImports;
6127
6445
  let effectiveChunksOption;
6128
6446
  if (codeSplitting === false) {
@@ -6162,13 +6480,20 @@ function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, adva
6162
6480
  let advancedChunksResult;
6163
6481
  if (effectiveChunksOption != null) {
6164
6482
  const { groups, ...restOptions } = effectiveChunksOption;
6483
+ let chunkingContext;
6484
+ const getChunkingContext = (bindingContext) => chunkingContext ??= new ChunkingContextImpl(bindingContext, pluginContextData);
6165
6485
  advancedChunksResult = {
6166
6486
  ...restOptions,
6487
+ internalInvalidateModuleInfoCache: () => {
6488
+ chunkingContext?.clearModuleInfoCache();
6489
+ chunkingContext = void 0;
6490
+ },
6167
6491
  groups: groups?.map((group) => {
6168
- const { name, ...restGroup } = group;
6492
+ const { name, test, ...restGroup } = group;
6169
6493
  return {
6170
6494
  ...restGroup,
6171
- name: typeof name === "function" ? (id, ctx) => name(id, new ChunkingContextImpl(ctx, pluginContextData)) : name
6495
+ test: typeof test === "function" ? batchTest(measureHookCost(timings, OUTPUT_OPTIONS_OWNER, "codeSplitting groups[].test", test)) : test,
6496
+ name: typeof name === "function" ? batchName(measureHookCost(timings, OUTPUT_OPTIONS_OWNER, "codeSplitting groups[].name", name), getChunkingContext) : name
6172
6497
  };
6173
6498
  })
6174
6499
  };
@@ -6178,19 +6503,57 @@ function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, adva
6178
6503
  advancedChunks: advancedChunksResult
6179
6504
  };
6180
6505
  }
6506
+ /**
6507
+ * Wraps a per-id `test` in the batched shim that the binding expects.
6508
+ *
6509
+ * The loop runs in JS so that a group makes one napi crossing, not one per module.
6510
+ *
6511
+ * The result is a `Uint8Array`, which crosses as a buffer instead of one tagged value per id.
6512
+ */
6513
+ function batchTest(test) {
6514
+ return (ids) => {
6515
+ const results = new Uint8Array(ids.length);
6516
+ for (let index = 0; index < ids.length; index++) {
6517
+ const result = test(ids[index]);
6518
+ if (result != null && typeof result !== "boolean") throw new TypeError(`\`output.codeSplitting.groups[].test\` returned ${typeof result} for module "${ids[index]}", but expected a boolean, null or undefined.`);
6519
+ results[index] = result === true ? 1 : 0;
6520
+ }
6521
+ return results;
6522
+ };
6523
+ }
6524
+ /**
6525
+ * This is the `name` equivalent of {@linkcode batchTest}. All groups in a chunking pass share
6526
+ * a context so repeated module queries reuse their JavaScript values.
6527
+ */
6528
+ function batchName(name, getChunkingContext) {
6529
+ return (ids, bindingContext) => {
6530
+ const context = getChunkingContext(bindingContext);
6531
+ const results = [];
6532
+ for (let index = 0; index < ids.length; index++) {
6533
+ const result = name(ids[index], context);
6534
+ if (result != null && typeof result !== "string") throw new TypeError(`\`output.codeSplitting.groups[].name\` returned ${typeof result} for module "${ids[index]}", but expected a string, null or undefined.`);
6535
+ results.push(result);
6536
+ }
6537
+ return results;
6538
+ };
6539
+ }
6540
+ var import_binding$3 = /* @__PURE__ */ __toESM(require_binding(), 1);
6181
6541
  async function initializeParallelPlugins(plugins) {
6182
6542
  const pluginInfos = [];
6183
- for (const [index, plugin] of plugins.entries()) if ("_parallel" in plugin) {
6184
- const { fileUrl, options } = plugin._parallel;
6185
- pluginInfos.push({
6186
- index,
6187
- fileUrl,
6188
- options
6189
- });
6543
+ for (const [index, plugin] of plugins.entries()) {
6544
+ const parallel = getParallelPluginInfo(plugin);
6545
+ if (parallel) {
6546
+ const { fileUrl, options } = parallel;
6547
+ pluginInfos.push({
6548
+ index,
6549
+ fileUrl,
6550
+ options
6551
+ });
6552
+ }
6190
6553
  }
6191
6554
  if (pluginInfos.length <= 0) return;
6192
6555
  const count = availableParallelism();
6193
- const parallelJsPluginRegistry = new import_binding$2.ParallelJsPluginRegistry(count);
6556
+ const parallelJsPluginRegistry = new import_binding$3.ParallelJsPluginRegistry(count);
6194
6557
  const registryId = parallelJsPluginRegistry.id;
6195
6558
  const workers = await initializeWorkers(registryId, count, pluginInfos);
6196
6559
  const stopWorkers = async () => {
@@ -6237,7 +6600,7 @@ var availableParallelism = () => {
6237
6600
  }
6238
6601
  return Math.min(availableParallelism, 8);
6239
6602
  };
6240
- async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
6603
+ async function createBundlerOptions(inputOptions, outputOptions, watchMode, measureTimings = false) {
6241
6604
  const inputPlugins = await normalizePluginOption(inputOptions.plugins);
6242
6605
  const outputPlugins = await normalizePluginOption(outputOptions.plugins);
6243
6606
  const logLevel = inputOptions.logLevel || "info";
@@ -6247,14 +6610,20 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
6247
6610
  const normalizedInputPlugins = normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX);
6248
6611
  const normalizedOutputPlugins = normalizePlugins(hookOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX);
6249
6612
  let plugins = [...normalizedInputPlugins, ...checkOutputPluginOption(normalizedOutputPlugins, onLog)];
6613
+ const timings = measureTimings && inputOptions.checks?.pluginTimings !== false ? pluginTimingsRecorderFor(inputOptions) : void 0;
6614
+ if (timings) outputOptions = {
6615
+ ...outputOptions,
6616
+ assetFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "assetFileNames", outputOptions.assetFileNames),
6617
+ sanitizeFileName: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sanitizeFileName", outputOptions.sanitizeFileName)
6618
+ };
6250
6619
  const parallelPluginInitResult = await initializeParallelPlugins(plugins);
6251
6620
  if (inputOptions.experimental?.strictExecutionOrder !== void 0) console.warn("`experimental.strictExecutionOrder` has been stabilized and moved to `output.strictExecutionOrder`. Please update your configuration.");
6252
6621
  try {
6253
6622
  const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedInputPlugins, normalizedOutputPlugins);
6254
6623
  return {
6255
6624
  bundlerOptions: {
6256
- inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode),
6257
- outputOptions: bindingifyOutputOptions(outputOptions, pluginContextData),
6625
+ inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings),
6626
+ outputOptions: bindingifyOutputOptions(outputOptions, pluginContextData, timings),
6258
6627
  parallelPluginsRegistry: parallelPluginInitResult?.registry
6259
6628
  },
6260
6629
  inputOptions,
@@ -6266,113 +6635,8 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
6266
6635
  throw e;
6267
6636
  }
6268
6637
  }
6269
- Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
6270
- /**
6271
- * The bundle object returned by {@linkcode rolldown} function.
6272
- *
6273
- * @category Programmatic APIs
6274
- */
6275
- var RolldownBuild = class RolldownBuild {
6276
- #inputOptions;
6277
- #bundler;
6278
- #stopWorkers;
6279
- /** @internal */
6280
- static asyncRuntimeShutdown = false;
6281
- /** @hidden should not be used directly */
6282
- constructor(inputOptions) {
6283
- this.#inputOptions = inputOptions;
6284
- this.#bundler = new import_binding$2.BindingBundler();
6285
- }
6286
- /**
6287
- * Whether the bundle has been closed.
6288
- *
6289
- * If the bundle is closed, calling other methods will throw an error.
6290
- */
6291
- get closed() {
6292
- return this.#bundler.closed;
6293
- }
6294
- /**
6295
- * Generate bundles in-memory.
6296
- *
6297
- * If you directly want to write bundles to disk, use the {@linkcode write} method instead.
6298
- *
6299
- * @param outputOptions The output options.
6300
- * @returns The generated bundle.
6301
- * @throws {@linkcode BundleError} When an error occurs during the build.
6302
- */
6303
- async generate(outputOptions = {}) {
6304
- return this.#build(false, outputOptions);
6305
- }
6306
- /**
6307
- * Generate and write bundles to disk.
6308
- *
6309
- * If you want to generate bundles in-memory, use the {@linkcode generate} method instead.
6310
- *
6311
- * @param outputOptions The output options.
6312
- * @returns The generated bundle.
6313
- * @throws {@linkcode BundleError} When an error occurs during the build.
6314
- */
6315
- async write(outputOptions = {}) {
6316
- return this.#build(true, outputOptions);
6317
- }
6318
- /**
6319
- * Close the bundle and free resources.
6320
- *
6321
- * This method should be called even if the {@linkcode generate} method
6322
- * or the {@linkcode write} method threw an error. It should be called
6323
- * even if neither of the methods are called.
6324
- *
6325
- * This method is called automatically when using `using` syntax.
6326
- *
6327
- * @example
6328
- * ```js
6329
- * import { rolldown } from 'rolldown';
6330
- *
6331
- * {
6332
- * using bundle = await rolldown({ input: 'src/main.js' });
6333
- * const output = await bundle.generate({ format: 'esm' });
6334
- * console.log(output);
6335
- * // bundle.close() is called automatically here
6336
- * }
6337
- * ```
6338
- */
6339
- async close() {
6340
- await this.#stopWorkers?.();
6341
- await this.#bundler.close();
6342
- (0, import_binding$2.shutdownAsyncRuntime)();
6343
- RolldownBuild.asyncRuntimeShutdown = true;
6344
- this.#stopWorkers = void 0;
6345
- }
6346
- /** @hidden documented in close method */
6347
- async [Symbol.asyncDispose]() {
6348
- await this.close();
6349
- }
6350
- /**
6351
- * @experimental
6352
- * @hidden not ready for public usage yet
6353
- */
6354
- get watchFiles() {
6355
- return Promise.resolve(this.#bundler.getWatchFiles());
6356
- }
6357
- async #build(isWrite, outputOptions) {
6358
- validateOption("output", outputOptions);
6359
- await this.#stopWorkers?.();
6360
- const option = await createBundlerOptions(this.#inputOptions, outputOptions, false);
6361
- if (RolldownBuild.asyncRuntimeShutdown) (0, import_binding$2.startAsyncRuntime)();
6362
- try {
6363
- this.#stopWorkers = option.stopWorkers;
6364
- let output;
6365
- if (isWrite) output = await this.#bundler.write(option.bundlerOptions);
6366
- else output = await this.#bundler.generate(option.bundlerOptions);
6367
- return new RolldownOutputImpl(unwrapBindingResult(output));
6368
- } catch (e) {
6369
- await option.stopWorkers?.();
6370
- throw e;
6371
- }
6372
- }
6373
- };
6374
6638
  //#endregion
6375
- //#region ../../node_modules/rolldown/dist/shared/watch-FrHSqg24.mjs
6639
+ //#region ../../node_modules/rolldown/dist/shared/watch-dKH5b9eq.mjs
6376
6640
  /**
6377
6641
  * This is not the set of all possible signals.
6378
6642
  *
@@ -6579,7 +6843,139 @@ function onExit(...args) {
6579
6843
  }
6580
6844
  require_binding();
6581
6845
  //#endregion
6582
- //#region ../../node_modules/rolldown/dist/shared/rolldown-Brph2NSU.mjs
6846
+ //#region ../../node_modules/rolldown/dist/shared/rolldown-B-jRyK4b.mjs
6847
+ var import_binding$1 = /* @__PURE__ */ __toESM(require_binding(), 1);
6848
+ var RolldownOutputImpl = class extends PlainObjectLike {
6849
+ bindingOutputs;
6850
+ constructor(bindingOutputs) {
6851
+ super();
6852
+ this.bindingOutputs = bindingOutputs;
6853
+ if (bindingOutputs.mangleCache !== void 0) this.mangleCache = bindingOutputs.mangleCache;
6854
+ }
6855
+ get output() {
6856
+ return transformToRollupOutput(this.bindingOutputs).output;
6857
+ }
6858
+ __rolldown_external_memory_handle__(keepDataAlive) {
6859
+ const results = this.output.map((item) => item.__rolldown_external_memory_handle__(keepDataAlive));
6860
+ if (!results.every((r) => r.freed)) {
6861
+ const reasons = results.filter((r) => !r.freed).map((r) => r.reason).filter(Boolean);
6862
+ return {
6863
+ freed: false,
6864
+ reason: `Failed to free ${reasons.length} item(s): ${reasons.join("; ")}`
6865
+ };
6866
+ }
6867
+ return { freed: true };
6868
+ }
6869
+ };
6870
+ __decorate([lazyProp], RolldownOutputImpl.prototype, "output", null);
6871
+ Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
6872
+ /**
6873
+ * The bundle object returned by {@linkcode rolldown} function.
6874
+ *
6875
+ * @category Programmatic APIs
6876
+ */
6877
+ var RolldownBuild = class {
6878
+ #inputOptions;
6879
+ #bundler;
6880
+ #stopWorkers;
6881
+ #asyncRuntimeReleased = false;
6882
+ /** @hidden should not be used directly */
6883
+ constructor(inputOptions) {
6884
+ this.#inputOptions = inputOptions;
6885
+ this.#bundler = new import_binding$1.BindingBundler();
6886
+ (0, import_binding$1.startAsyncRuntime)();
6887
+ }
6888
+ /**
6889
+ * Whether the bundle has been closed.
6890
+ *
6891
+ * If the bundle is closed, calling other methods will throw an error.
6892
+ */
6893
+ get closed() {
6894
+ return this.#bundler.closed;
6895
+ }
6896
+ /**
6897
+ * Generate bundles in-memory.
6898
+ *
6899
+ * If you directly want to write bundles to disk, use the {@linkcode write} method instead.
6900
+ *
6901
+ * @param outputOptions The output options.
6902
+ * @returns The generated bundle.
6903
+ * @throws {@linkcode BundleError} When an error occurs during the build.
6904
+ */
6905
+ async generate(outputOptions = {}) {
6906
+ return this.#build(false, outputOptions);
6907
+ }
6908
+ /**
6909
+ * Generate and write bundles to disk.
6910
+ *
6911
+ * If you want to generate bundles in-memory, use the {@linkcode generate} method instead.
6912
+ *
6913
+ * @param outputOptions The output options.
6914
+ * @returns The generated bundle.
6915
+ * @throws {@linkcode BundleError} When an error occurs during the build.
6916
+ */
6917
+ async write(outputOptions = {}) {
6918
+ return this.#build(true, outputOptions);
6919
+ }
6920
+ /**
6921
+ * Close the bundle and free resources.
6922
+ *
6923
+ * This method should be called even if the {@linkcode generate} method
6924
+ * or the {@linkcode write} method threw an error. It should be called
6925
+ * even if neither of the methods are called.
6926
+ *
6927
+ * This method is called automatically when using `using` syntax.
6928
+ *
6929
+ * @example
6930
+ * ```js
6931
+ * import { rolldown } from 'rolldown';
6932
+ *
6933
+ * {
6934
+ * using bundle = await rolldown({ input: 'src/main.js' });
6935
+ * const output = await bundle.generate({ format: 'esm' });
6936
+ * console.log(output);
6937
+ * // bundle.close() is called automatically here
6938
+ * }
6939
+ * ```
6940
+ */
6941
+ async close() {
6942
+ const shouldRelease = !this.#asyncRuntimeReleased;
6943
+ this.#asyncRuntimeReleased = true;
6944
+ try {
6945
+ await this.#stopWorkers?.();
6946
+ await this.#bundler.close();
6947
+ this.#stopWorkers = void 0;
6948
+ } finally {
6949
+ if (shouldRelease) (0, import_binding$1.shutdownAsyncRuntime)();
6950
+ }
6951
+ }
6952
+ /** @hidden documented in close method */
6953
+ async [Symbol.asyncDispose]() {
6954
+ await this.close();
6955
+ }
6956
+ /**
6957
+ * @experimental
6958
+ * @hidden not ready for public usage yet
6959
+ */
6960
+ get watchFiles() {
6961
+ return Promise.resolve(this.#bundler.getWatchFiles());
6962
+ }
6963
+ async #build(isWrite, outputOptions) {
6964
+ validateOption("output", outputOptions);
6965
+ await this.#stopWorkers?.();
6966
+ const option = await createBundlerOptions(this.#inputOptions, outputOptions, false, true);
6967
+ try {
6968
+ this.#stopWorkers = option.stopWorkers;
6969
+ let output;
6970
+ if (isWrite) output = await this.#bundler.write(option.bundlerOptions);
6971
+ else output = await this.#bundler.generate(option.bundlerOptions);
6972
+ return new RolldownOutputImpl(unwrapBindingResult(output));
6973
+ } catch (e) {
6974
+ await option.stopWorkers?.();
6975
+ throw e;
6976
+ }
6977
+ }
6978
+ };
6583
6979
  /**
6584
6980
  * The API compatible with Rollup's `rollup` function.
6585
6981
  *