@introspection-ai/recipes 0.18.1 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/inspect.d.ts +1 -0
  2. package/dist/inspect.d.ts.map +1 -1
  3. package/dist/inspect.js +3 -0
  4. package/dist/inspect.js.map +1 -1
  5. package/dist/mcp-chunks/{auth-command-ZLGYIEUY.js → auth-command-3K7V3VCW.js} +31 -35
  6. package/dist/mcp-chunks/call-arguments-TX3F2TEE.js +15 -0
  7. package/dist/mcp-chunks/{call-command-LKTKSYTH.js → call-command-OFPHPFM5.js} +36 -34
  8. package/dist/mcp-chunks/chunk-2FSDGCHW.js +3299 -0
  9. package/dist/mcp-chunks/{chunk-BV56DXPW.js → chunk-2JHHONW4.js} +1 -1
  10. package/dist/mcp-chunks/chunk-2MEHGB7D.js +63 -0
  11. package/dist/mcp-chunks/chunk-3IZQW4H4.js +929 -0
  12. package/dist/mcp-chunks/{chunk-MZ2NARG7.js → chunk-54EWGONA.js} +5 -5
  13. package/dist/mcp-chunks/{chunk-LQQEYD76.js → chunk-55JIHDU3.js} +1 -1
  14. package/dist/mcp-chunks/chunk-64EP2BVO.js +39 -0
  15. package/dist/mcp-chunks/{chunk-LS7PMWSR.js → chunk-6D6KPSXN.js} +1 -1
  16. package/dist/mcp-chunks/{chunk-2XL7MG7R.js → chunk-7A63PAGP.js} +15 -9
  17. package/dist/mcp-chunks/chunk-7DH57OKF.js +28 -0
  18. package/dist/mcp-chunks/{chunk-BTLAWHTA.js → chunk-7RDLPFIO.js} +2 -2
  19. package/dist/mcp-chunks/chunk-C2PQFLWS.js +422 -0
  20. package/dist/mcp-chunks/chunk-CA5WFJZA.js +197 -0
  21. package/dist/mcp-chunks/{chunk-LNH5LAJD.js → chunk-CNDY7WB4.js} +2 -2
  22. package/dist/mcp-chunks/{chunk-UKYNQGNE.js → chunk-DEUU7WSN.js} +34 -8
  23. package/dist/mcp-chunks/{chunk-LKIBAYKU.js → chunk-DXPHJFSA.js} +25 -35
  24. package/dist/mcp-chunks/{chunk-J6LYIZXN.js → chunk-E6RVTWJY.js} +1 -1
  25. package/dist/mcp-chunks/{chunk-7FHEBT5G.js → chunk-E6T37ED6.js} +18 -13
  26. package/dist/mcp-chunks/chunk-ETWN4IIA.js +57 -0
  27. package/dist/mcp-chunks/{chunk-YVZKMV5H.js → chunk-F3LL4EBL.js} +1 -1
  28. package/dist/mcp-chunks/chunk-FWP4RACK.js +42 -0
  29. package/dist/mcp-chunks/{chunk-6W5QFASN.js → chunk-GFYTST6N.js} +1 -1
  30. package/dist/mcp-chunks/{chunk-TEUKFFQL.js → chunk-GIF7LOYU.js} +2 -2
  31. package/dist/mcp-chunks/{chunk-QXJUA3ND.js → chunk-GSZOK5TS.js} +828 -7
  32. package/dist/mcp-chunks/chunk-H7F5RZXS.js +26 -0
  33. package/dist/mcp-chunks/{chunk-ECIVB7P4.js → chunk-HAO6PL7Z.js} +2 -37
  34. package/dist/mcp-chunks/{chunk-WQJZMCJN.js → chunk-HTZ2URXW.js} +5 -3
  35. package/dist/mcp-chunks/{chunk-BWHIA4PC.js → chunk-JAKI24KR.js} +1 -1
  36. package/dist/mcp-chunks/{chunk-PWYFKGKG.js → chunk-KSGYBW3F.js} +180 -89
  37. package/dist/mcp-chunks/{chunk-SJCCBNZ4.js → chunk-KSMY7PXI.js} +1 -1
  38. package/dist/mcp-chunks/{chunk-2U4BSDC4.js → chunk-L4VKBFYI.js} +48 -29
  39. package/dist/mcp-chunks/{chunk-LEZSACDE.js → chunk-LICH4Q7A.js} +4 -4
  40. package/dist/mcp-chunks/{chunk-PIIYJR44.js → chunk-LNSUME65.js} +29 -33
  41. package/dist/mcp-chunks/{chunk-D3MRAZ6H.js → chunk-LWVFSQYX.js} +13974 -15562
  42. package/dist/mcp-chunks/{chunk-7KA2VJVZ.js → chunk-NCXEJ35U.js} +10 -5
  43. package/dist/mcp-chunks/{chunk-5QOSCSQB.js → chunk-NZOIX6XW.js} +2 -2
  44. package/dist/mcp-chunks/{chunk-XANPGTLI.js → chunk-P3RN22HQ.js} +11 -4
  45. package/dist/mcp-chunks/{chunk-IABRYROW.js → chunk-PKOJCYNA.js} +3 -3
  46. package/dist/mcp-chunks/{chunk-BNV3TPE4.js → chunk-QJACOI2W.js} +5 -13
  47. package/dist/mcp-chunks/{chunk-UNKB4SBV.js → chunk-RBVYCKCD.js} +2 -2
  48. package/dist/mcp-chunks/{chunk-DHBE7UBH.js → chunk-SB2UUURE.js} +12 -42
  49. package/dist/mcp-chunks/{chunk-4SQKWYFF.js → chunk-SFREPU3D.js} +1 -1
  50. package/dist/mcp-chunks/{chunk-BZIQOWE6.js → chunk-SRZZQ6TL.js} +35 -36
  51. package/dist/mcp-chunks/{chunk-M3TPODXI.js → chunk-UENXT3NE.js} +1 -1
  52. package/dist/mcp-chunks/chunk-UHOKCTZT.js +37 -0
  53. package/dist/mcp-chunks/{chunk-E22DYOW5.js → chunk-WWO5WGH5.js} +5 -5
  54. package/dist/mcp-chunks/{chunk-6XCZGU3G.js → chunk-WXBPMFSN.js} +149 -192
  55. package/dist/mcp-chunks/{chunk-XQK2JSW4.js → chunk-XRGLP3Z2.js} +14 -2
  56. package/dist/mcp-chunks/{chunk-L7NTQVYN.js → chunk-XTL4MHFH.js} +28 -10
  57. package/dist/mcp-chunks/{chunk-N46NEFAF.js → chunk-XUF6KARU.js} +1 -1
  58. package/dist/mcp-chunks/{chunk-WD6BOD24.js → chunk-YCYSQA5V.js} +23 -4
  59. package/dist/mcp-chunks/chunk-YPJ5EHXR.js +17394 -0
  60. package/dist/mcp-chunks/{chunk-NRAJX5E4.js → chunk-YSPT6F7K.js} +3 -3
  61. package/dist/mcp-chunks/{chunk-7UDVSOOF.js → chunk-YTKRAHO6.js} +54 -46
  62. package/dist/mcp-chunks/chunk-ZBFZ5UFE.js +67 -0
  63. package/dist/mcp-chunks/{cli-UV4QJZZM.js → cli-E4P6SZLQ.js} +89 -76
  64. package/dist/mcp-chunks/client-2EJC4PLL.js +18 -0
  65. package/dist/mcp-chunks/{config-command-NLAGKID5.js → config-command-MWF3RHPQ.js} +38 -59
  66. package/dist/mcp-chunks/daemon-command-6CJ26MKI.js +33 -0
  67. package/dist/mcp-chunks/{dist-LK3SHAMX.js → dist-ZIPUENTM.js} +527 -469
  68. package/dist/mcp-chunks/{emit-ts-command-VBXVXO6V.js → emit-ts-command-GOVJJ64A.js} +16 -13
  69. package/dist/mcp-chunks/{generate-cli-runner-6CAZZA3P.js → generate-cli-runner-L5OQIMEY.js} +242 -247
  70. package/dist/mcp-chunks/{inspect-cli-command-3ZORTOR7.js → inspect-cli-command-7OMMREPE.js} +10 -9
  71. package/dist/mcp-chunks/{launch-YKRXHXJI.js → launch-BWXPLPB7.js} +1 -1
  72. package/dist/mcp-chunks/{lifecycle-XVKRHPH3.js → lifecycle-B5UC65PT.js} +1 -1
  73. package/dist/mcp-chunks/{list-command-2MEGGNFQ.js → list-command-ZO4HVFQK.js} +74 -43
  74. package/dist/mcp-chunks/{output-utils-NKESLAJ6.js → output-utils-M3TJ2N4M.js} +3 -3
  75. package/dist/mcp-chunks/{prompt-B1Yc1NPt-VGOTWJMN.js → prompt-CH6TK0bC-C7OTKGRD.js} +1 -3
  76. package/dist/mcp-chunks/{record-command-YXHTTTT5.js → record-command-VD3HUQIC.js} +5 -4
  77. package/dist/mcp-chunks/replay-command-AX6IN7YD.js +42 -0
  78. package/dist/mcp-chunks/{resource-command-OO4NYF5C.js → resource-command-JEZ2DW2G.js} +10 -10
  79. package/dist/mcp-chunks/{result-utils-MOHHLNM7.js → result-utils-3YHYGS45.js} +4 -4
  80. package/dist/mcp-chunks/runtime-HSYVOME7.js +37 -0
  81. package/dist/mcp-chunks/{runtime-wrapper-RPWDIDBF.js → runtime-wrapper-UREU7GC3.js} +7 -3
  82. package/dist/mcp-chunks/serve-command-M47YZ6JN.js +16018 -0
  83. package/dist/mcp-chunks/{timeouts-W2XWCCXR.js → timeouts-THZRYP4B.js} +3 -1
  84. package/dist/mcp-chunks/{vault-command-PIYIUEZL.js → vault-command-53P7MLCB.js} +7 -6
  85. package/dist/mcp-chunks/webapi-PHEQZQKH.js +3316 -0
  86. package/dist/mcp-client.js +11 -1
  87. package/dist/mcp-client.js.map +1 -1
  88. package/dist/mcp-daemon-client.d.ts.map +1 -1
  89. package/dist/mcp-daemon-client.js +3 -0
  90. package/dist/mcp-daemon-client.js.map +1 -1
  91. package/dist/mcp-daemon-protocol.d.ts +6 -0
  92. package/dist/mcp-daemon-protocol.d.ts.map +1 -1
  93. package/dist/mcp-daemon-protocol.js.map +1 -1
  94. package/dist/mcp-daemon.js +43 -22
  95. package/dist/mcp-daemon.js.map +1 -1
  96. package/dist/mcp-run-worker.js +29 -22
  97. package/dist/mcp-trace-context.d.ts +6 -0
  98. package/dist/mcp-trace-context.d.ts.map +1 -0
  99. package/dist/mcp-trace-context.js +31 -0
  100. package/dist/mcp-trace-context.js.map +1 -0
  101. package/dist/model-binding.d.ts.map +1 -1
  102. package/dist/model-binding.js +8 -4
  103. package/dist/model-binding.js.map +1 -1
  104. package/dist/pi-extension.d.ts.map +1 -1
  105. package/dist/pi-extension.js +12 -0
  106. package/dist/pi-extension.js.map +1 -1
  107. package/dist/recipe/resolve.d.ts +2 -0
  108. package/dist/recipe/resolve.d.ts.map +1 -1
  109. package/dist/recipe/resolve.js +2 -1
  110. package/dist/recipe/resolve.js.map +1 -1
  111. package/dist/recipe-agent.d.ts +5 -2
  112. package/dist/recipe-agent.d.ts.map +1 -1
  113. package/dist/recipe-agent.js +20 -4
  114. package/dist/recipe-agent.js.map +1 -1
  115. package/dist/recipe-model.d.ts +7 -1
  116. package/dist/recipe-model.d.ts.map +1 -1
  117. package/dist/recipe-model.js +89 -20
  118. package/dist/recipe-model.js.map +1 -1
  119. package/dist/recipe-session.d.ts +14 -0
  120. package/dist/recipe-session.d.ts.map +1 -0
  121. package/dist/recipe-session.js +181 -0
  122. package/dist/recipe-session.js.map +1 -0
  123. package/dist/session.d.ts.map +1 -1
  124. package/dist/session.js +23 -1
  125. package/dist/session.js.map +1 -1
  126. package/docs/agent-composition.md +46 -22
  127. package/docs/pi-extension.md +9 -3
  128. package/docs/recipe-format.md +41 -5
  129. package/package.json +6 -6
  130. package/vendor/introspection-recipe-check/darwin-arm64/introspection-recipe-check +0 -0
  131. package/vendor/introspection-recipe-check/darwin-x64/introspection-recipe-check +0 -0
  132. package/vendor/introspection-recipe-check/linux-arm64/introspection-recipe-check +0 -0
  133. package/vendor/introspection-recipe-check/linux-x64/introspection-recipe-check +0 -0
  134. package/vendor/introspection-recipe-check/linux-x64-musl/introspection-recipe-check +0 -0
  135. package/vendor/introspection-recipe-check/win32-x64/introspection-recipe-check.exe +0 -0
  136. package/dist/mcp-chunks/call-arguments-LU3W6D3K.js +0 -13
  137. package/dist/mcp-chunks/chunk-HKRJ6O36.js +0 -1076
  138. package/dist/mcp-chunks/chunk-NNOEGEUZ.js +0 -17273
  139. package/dist/mcp-chunks/chunk-P3PSC54P.js +0 -869
  140. package/dist/mcp-chunks/chunk-TATVT5IT.js +0 -194
  141. package/dist/mcp-chunks/chunk-YHQUTU6L.js +0 -571
  142. package/dist/mcp-chunks/client-S7RQUG5U.js +0 -13
  143. package/dist/mcp-chunks/daemon-command-U242Z6VY.js +0 -26
  144. package/dist/mcp-chunks/replay-command-25HJ6AQU.js +0 -85
  145. package/dist/mcp-chunks/runtime-5WJ3G25Y.js +0 -33
  146. package/dist/mcp-chunks/serve-command-DHXJZMMN.js +0 -3302
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import "./chunk-LRKZP7DJ.js";
3
3
 
4
- // node_modules/.pnpm/rolldown@1.1.3/node_modules/rolldown/dist/shared/binding-Dh6LYCIB.mjs
4
+ // node_modules/.pnpm/rolldown@1.2.1/node_modules/rolldown/dist/shared/binding-Cv62mM1i.mjs
5
5
  import { createRequire } from "node:module";
6
6
  var __create = Object.create;
7
7
  var __defProp = Object.defineProperty;
@@ -20,24 +20,24 @@ var __copyProps = (to, from, except, desc) => {
20
20
  }
21
21
  return to;
22
22
  };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
24
24
  value: mod,
25
25
  enumerable: true
26
26
  }) : target, mod));
27
27
  var __require = /* @__PURE__ */ (() => createRequire(import.meta.url))();
28
28
  var require_webcontainer_fallback = /* @__PURE__ */ __commonJSMin(((exports, module) => {
29
- const fs = __require("node:fs");
29
+ const fs2 = __require("node:fs");
30
30
  const childProcess = __require("node:child_process");
31
- const version2 = JSON.parse(fs.readFileSync(__require.resolve("rolldown/package.json"), "utf-8")).version;
31
+ const version2 = JSON.parse(fs2.readFileSync(__require.resolve("rolldown/package.json"), "utf-8")).version;
32
32
  const baseDir = `/tmp/rolldown-${version2}`;
33
33
  const bindingEntry = `${baseDir}/node_modules/@rolldown/binding-wasm32-wasi/rolldown-binding.wasi.cjs`;
34
- if (!fs.existsSync(bindingEntry)) {
34
+ if (!fs2.existsSync(bindingEntry)) {
35
35
  const bindingPkg = `@rolldown/binding-wasm32-wasi@${version2}`;
36
- fs.rmSync(baseDir, {
36
+ fs2.rmSync(baseDir, {
37
37
  recursive: true,
38
38
  force: true
39
39
  });
40
- fs.mkdirSync(baseDir, { recursive: true });
40
+ fs2.mkdirSync(baseDir, { recursive: true });
41
41
  console.log(`[rolldown] Downloading ${bindingPkg} on WebContainer...`);
42
42
  childProcess.execFileSync("pnpm", ["i", bindingPkg], {
43
43
  cwd: baseDir,
@@ -102,7 +102,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
102
102
  try {
103
103
  const binding = __require("@rolldown/binding-android-arm64");
104
104
  const bindingPackageVersion = __require("@rolldown/binding-android-arm64/package.json").version;
105
- 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.`);
105
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
106
106
  return binding;
107
107
  } catch (e2) {
108
108
  loadErrors.push(e2);
@@ -116,7 +116,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
116
116
  try {
117
117
  const binding = __require("@rolldown/binding-android-arm-eabi");
118
118
  const bindingPackageVersion = __require("@rolldown/binding-android-arm-eabi/package.json").version;
119
- 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.`);
119
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
120
120
  return binding;
121
121
  } catch (e2) {
122
122
  loadErrors.push(e2);
@@ -131,7 +131,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
131
131
  try {
132
132
  const binding = __require("@rolldown/binding-win32-x64-gnu");
133
133
  const bindingPackageVersion = __require("@rolldown/binding-win32-x64-gnu/package.json").version;
134
- 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.`);
134
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
135
135
  return binding;
136
136
  } catch (e2) {
137
137
  loadErrors.push(e2);
@@ -145,7 +145,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
145
145
  try {
146
146
  const binding = __require("@rolldown/binding-win32-x64-msvc");
147
147
  const bindingPackageVersion = __require("@rolldown/binding-win32-x64-msvc/package.json").version;
148
- 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.`);
148
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
149
149
  return binding;
150
150
  } catch (e2) {
151
151
  loadErrors.push(e2);
@@ -160,7 +160,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
160
160
  try {
161
161
  const binding = __require("@rolldown/binding-win32-ia32-msvc");
162
162
  const bindingPackageVersion = __require("@rolldown/binding-win32-ia32-msvc/package.json").version;
163
- 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.`);
163
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
164
164
  return binding;
165
165
  } catch (e2) {
166
166
  loadErrors.push(e2);
@@ -174,7 +174,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
174
174
  try {
175
175
  const binding = __require("@rolldown/binding-win32-arm64-msvc");
176
176
  const bindingPackageVersion = __require("@rolldown/binding-win32-arm64-msvc/package.json").version;
177
- 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.`);
177
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
178
178
  return binding;
179
179
  } catch (e2) {
180
180
  loadErrors.push(e2);
@@ -189,7 +189,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
189
189
  try {
190
190
  const binding = __require("@rolldown/binding-darwin-universal");
191
191
  const bindingPackageVersion = __require("@rolldown/binding-darwin-universal/package.json").version;
192
- 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.`);
192
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
193
193
  return binding;
194
194
  } catch (e2) {
195
195
  loadErrors.push(e2);
@@ -203,7 +203,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
203
203
  try {
204
204
  const binding = __require("@rolldown/binding-darwin-x64");
205
205
  const bindingPackageVersion = __require("@rolldown/binding-darwin-x64/package.json").version;
206
- 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.`);
206
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
207
207
  return binding;
208
208
  } catch (e2) {
209
209
  loadErrors.push(e2);
@@ -217,7 +217,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
217
217
  try {
218
218
  const binding = __require("@rolldown/binding-darwin-arm64");
219
219
  const bindingPackageVersion = __require("@rolldown/binding-darwin-arm64/package.json").version;
220
- 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.`);
220
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
221
221
  return binding;
222
222
  } catch (e2) {
223
223
  loadErrors.push(e2);
@@ -232,7 +232,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
232
232
  try {
233
233
  const binding = __require("@rolldown/binding-freebsd-x64");
234
234
  const bindingPackageVersion = __require("@rolldown/binding-freebsd-x64/package.json").version;
235
- 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.`);
235
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
236
236
  return binding;
237
237
  } catch (e2) {
238
238
  loadErrors.push(e2);
@@ -246,7 +246,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
246
246
  try {
247
247
  const binding = __require("@rolldown/binding-freebsd-arm64");
248
248
  const bindingPackageVersion = __require("@rolldown/binding-freebsd-arm64/package.json").version;
249
- 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.`);
249
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
250
250
  return binding;
251
251
  } catch (e2) {
252
252
  loadErrors.push(e2);
@@ -261,7 +261,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
261
261
  try {
262
262
  const binding = __require("@rolldown/binding-linux-x64-musl");
263
263
  const bindingPackageVersion = __require("@rolldown/binding-linux-x64-musl/package.json").version;
264
- 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.`);
264
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
265
265
  return binding;
266
266
  } catch (e2) {
267
267
  loadErrors.push(e2);
@@ -275,7 +275,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
275
275
  try {
276
276
  const binding = __require("@rolldown/binding-linux-x64-gnu");
277
277
  const bindingPackageVersion = __require("@rolldown/binding-linux-x64-gnu/package.json").version;
278
- 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.`);
278
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
279
279
  return binding;
280
280
  } catch (e2) {
281
281
  loadErrors.push(e2);
@@ -290,7 +290,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
290
290
  try {
291
291
  const binding = __require("@rolldown/binding-linux-arm64-musl");
292
292
  const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-musl/package.json").version;
293
- 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.`);
293
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
294
294
  return binding;
295
295
  } catch (e2) {
296
296
  loadErrors.push(e2);
@@ -304,7 +304,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
304
304
  try {
305
305
  const binding = __require("@rolldown/binding-linux-arm64-gnu");
306
306
  const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-gnu/package.json").version;
307
- 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.`);
307
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
308
308
  return binding;
309
309
  } catch (e2) {
310
310
  loadErrors.push(e2);
@@ -319,7 +319,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
319
319
  try {
320
320
  const binding = __require("@rolldown/binding-linux-arm-musleabihf");
321
321
  const bindingPackageVersion = __require("@rolldown/binding-linux-arm-musleabihf/package.json").version;
322
- 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.`);
322
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
323
323
  return binding;
324
324
  } catch (e2) {
325
325
  loadErrors.push(e2);
@@ -333,7 +333,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
333
333
  try {
334
334
  const binding = __require("@rolldown/binding-linux-arm-gnueabihf");
335
335
  const bindingPackageVersion = __require("@rolldown/binding-linux-arm-gnueabihf/package.json").version;
336
- 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.`);
336
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
337
337
  return binding;
338
338
  } catch (e2) {
339
339
  loadErrors.push(e2);
@@ -348,7 +348,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
348
348
  try {
349
349
  const binding = __require("@rolldown/binding-linux-loong64-musl");
350
350
  const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-musl/package.json").version;
351
- 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.`);
351
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
352
352
  return binding;
353
353
  } catch (e2) {
354
354
  loadErrors.push(e2);
@@ -362,7 +362,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
362
362
  try {
363
363
  const binding = __require("@rolldown/binding-linux-loong64-gnu");
364
364
  const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-gnu/package.json").version;
365
- 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.`);
365
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
366
366
  return binding;
367
367
  } catch (e2) {
368
368
  loadErrors.push(e2);
@@ -377,7 +377,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
377
377
  try {
378
378
  const binding = __require("@rolldown/binding-linux-riscv64-musl");
379
379
  const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-musl/package.json").version;
380
- 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.`);
380
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
381
381
  return binding;
382
382
  } catch (e2) {
383
383
  loadErrors.push(e2);
@@ -391,7 +391,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
391
391
  try {
392
392
  const binding = __require("@rolldown/binding-linux-riscv64-gnu");
393
393
  const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-gnu/package.json").version;
394
- 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.`);
394
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
395
395
  return binding;
396
396
  } catch (e2) {
397
397
  loadErrors.push(e2);
@@ -406,7 +406,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
406
406
  try {
407
407
  const binding = __require("@rolldown/binding-linux-ppc64-gnu");
408
408
  const bindingPackageVersion = __require("@rolldown/binding-linux-ppc64-gnu/package.json").version;
409
- 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.`);
409
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
410
410
  return binding;
411
411
  } catch (e2) {
412
412
  loadErrors.push(e2);
@@ -420,7 +420,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
420
420
  try {
421
421
  const binding = __require("@rolldown/binding-linux-s390x-gnu");
422
422
  const bindingPackageVersion = __require("@rolldown/binding-linux-s390x-gnu/package.json").version;
423
- 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.`);
423
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
424
424
  return binding;
425
425
  } catch (e2) {
426
426
  loadErrors.push(e2);
@@ -435,7 +435,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
435
435
  try {
436
436
  const binding = __require("@rolldown/binding-openharmony-arm64");
437
437
  const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm64/package.json").version;
438
- 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.`);
438
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
439
439
  return binding;
440
440
  } catch (e2) {
441
441
  loadErrors.push(e2);
@@ -449,7 +449,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
449
449
  try {
450
450
  const binding = __require("@rolldown/binding-openharmony-x64");
451
451
  const bindingPackageVersion = __require("@rolldown/binding-openharmony-x64/package.json").version;
452
- 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.`);
452
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
453
453
  return binding;
454
454
  } catch (e2) {
455
455
  loadErrors.push(e2);
@@ -463,7 +463,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
463
463
  try {
464
464
  const binding = __require("@rolldown/binding-openharmony-arm");
465
465
  const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm/package.json").version;
466
- 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.`);
466
+ if (bindingPackageVersion !== "1.2.1" && 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.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
467
467
  return binding;
468
468
  } catch (e2) {
469
469
  loadErrors.push(e2);
@@ -471,30 +471,107 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
471
471
  } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
472
472
  else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
473
473
  }
474
- nativeBinding = requireNative();
475
- const forceWasi = process.env.NAPI_RS_FORCE_WASI === "true" || process.env.NAPI_RS_FORCE_WASI === "error";
474
+ function createLoadErrorChain(errors) {
475
+ return errors.reduce((previous, current) => {
476
+ let message;
477
+ try {
478
+ message = current && typeof current.message === "string" ? current.message : String(current);
479
+ } catch {
480
+ message = "Unknown error";
481
+ }
482
+ const error2 = new Error(message);
483
+ error2.cause = previous;
484
+ return error2;
485
+ }, null);
486
+ }
487
+ const __napiWasiFlavors = ["wasm32-wasi"];
488
+ const __napiWasiFlavor = process.env.NAPI_RS_WASI_FLAVOR;
489
+ const __napiWasiFlavorRequested = typeof __napiWasiFlavor === "string" && __napiWasiFlavor.length > 0;
490
+ if (__napiWasiFlavorRequested && __napiWasiFlavors.indexOf(__napiWasiFlavor) === -1) throw new Error('Unsupported WASI flavor "' + __napiWasiFlavor + '". Available flavors: ' + __napiWasiFlavors.join(", "));
491
+ const forceWasiError = process.env.NAPI_RS_FORCE_WASI === "error";
492
+ const forceWasi = process.env.NAPI_RS_FORCE_WASI === "true" || forceWasiError || __napiWasiFlavorRequested;
493
+ if (!forceWasi) nativeBinding = requireNative();
476
494
  if (!nativeBinding || forceWasi) {
477
495
  let wasiBinding = null;
478
- let wasiBindingError = null;
479
- try {
480
- wasiBinding = __require("../rolldown-binding.wasi.cjs");
481
- nativeBinding = wasiBinding;
482
- } catch (err) {
483
- if (forceWasi) wasiBindingError = err;
496
+ let wasiBindingLoaded = false;
497
+ const wasiBindingErrors = [];
498
+ const __napiWasiResolveCandidate = (specifier, isPackage, localArtifacts) => {
499
+ try {
500
+ __require.resolve(specifier);
501
+ } catch (resolveError) {
502
+ if (!resolveError || resolveError.code !== "MODULE_NOT_FOUND") throw resolveError;
503
+ if (isPackage) {
504
+ try {
505
+ __require.resolve(specifier + "/package.json");
506
+ } catch (packageError) {
507
+ if (packageError && packageError.code === "MODULE_NOT_FOUND") return resolveError;
508
+ throw resolveError;
509
+ }
510
+ throw resolveError;
511
+ }
512
+ return resolveError;
513
+ }
514
+ if (localArtifacts) {
515
+ let artifactError = null;
516
+ for (let i2 = 0; i2 < localArtifacts.length; i2++) try {
517
+ __require.resolve(localArtifacts[i2]);
518
+ return null;
519
+ } catch (resolveError) {
520
+ if (!resolveError || resolveError.code !== "MODULE_NOT_FOUND") throw resolveError;
521
+ artifactError = resolveError;
522
+ }
523
+ return artifactError;
524
+ }
525
+ return null;
526
+ };
527
+ if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")) {
528
+ let candidateError = null;
529
+ let candidateFailed = false;
530
+ try {
531
+ candidateError = __napiWasiResolveCandidate("./rolldown-binding.wasi.cjs", false, ["./rolldown-binding.wasm32-wasi.debug.wasm", "./rolldown-binding.wasm32-wasi.wasm"]);
532
+ candidateFailed = candidateError !== null;
533
+ if (!candidateFailed) {
534
+ wasiBinding = __require("../rolldown-binding.wasi.cjs");
535
+ nativeBinding = wasiBinding;
536
+ wasiBindingLoaded = true;
537
+ }
538
+ } catch (err) {
539
+ candidateError = err;
540
+ candidateFailed = true;
541
+ }
542
+ if (candidateFailed) {
543
+ wasiBindingErrors.push(candidateError);
544
+ loadErrors.push(candidateError);
545
+ }
484
546
  }
485
- if (!nativeBinding || forceWasi) try {
486
- wasiBinding = __require("@rolldown/binding-wasm32-wasi");
487
- nativeBinding = wasiBinding;
488
- } catch (err) {
489
- if (forceWasi) {
490
- if (!wasiBindingError) wasiBindingError = err;
491
- else wasiBindingError.cause = err;
492
- loadErrors.push(err);
547
+ if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")) {
548
+ let candidateError = null;
549
+ let candidateFailed = false;
550
+ try {
551
+ candidateError = __napiWasiResolveCandidate("@rolldown/binding-wasm32-wasi", true, void 0);
552
+ candidateFailed = candidateError !== null;
553
+ if (!candidateFailed) {
554
+ if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
555
+ const bindingPackageVersion = __require("@rolldown/binding-wasm32-wasi/package.json").version;
556
+ if (bindingPackageVersion !== "1.2.1") throw new Error(`WASI binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
557
+ }
558
+ wasiBinding = __require("@rolldown/binding-wasm32-wasi");
559
+ nativeBinding = wasiBinding;
560
+ wasiBindingLoaded = true;
561
+ }
562
+ } catch (err) {
563
+ candidateError = err;
564
+ candidateFailed = true;
565
+ }
566
+ if (candidateFailed) {
567
+ wasiBindingErrors.push(candidateError);
568
+ loadErrors.push(candidateError);
493
569
  }
494
570
  }
495
- if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
496
- const error2 = /* @__PURE__ */ new Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
497
- error2.cause = wasiBindingError;
571
+ if (!wasiBindingLoaded && forceWasi && !forceWasiError && !__napiWasiFlavorRequested) nativeBinding = requireNative();
572
+ if ((forceWasiError || __napiWasiFlavorRequested) && !wasiBindingLoaded) {
573
+ const error2 = /* @__PURE__ */ new Error(__napiWasiFlavorRequested ? 'WASI binding for flavor "' + __napiWasiFlavor + '" not found' : "WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
574
+ error2.cause = createLoadErrorChain(wasiBindingErrors);
498
575
  throw error2;
499
576
  }
500
577
  }
@@ -506,10 +583,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
506
583
  if (!nativeBinding) {
507
584
  if (loadErrors.length > 0) {
508
585
  const error2 = /* @__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.");
509
- error2.cause = loadErrors.reduce((err, cur) => {
510
- cur.cause = err;
511
- return cur;
512
- });
586
+ error2.cause = createLoadErrorChain(loadErrors);
513
587
  throw error2;
514
588
  }
515
589
  throw new Error(`Failed to load native binding`);
@@ -562,7 +636,6 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
562
636
  module.exports.BindingWatcherChangeData = nativeBinding.BindingWatcherChangeData;
563
637
  module.exports.BindingWatcherEvent = nativeBinding.BindingWatcherEvent;
564
638
  module.exports.ParallelJsPluginRegistry = nativeBinding.ParallelJsPluginRegistry;
565
- module.exports.ScheduledBuild = nativeBinding.ScheduledBuild;
566
639
  module.exports.TraceSubscriberGuard = nativeBinding.TraceSubscriberGuard;
567
640
  module.exports.TsconfigCache = nativeBinding.TsconfigCache;
568
641
  module.exports.BindingAttachDebugInfo = nativeBinding.BindingAttachDebugInfo;
@@ -585,7 +658,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
585
658
  module.exports.startAsyncRuntime = nativeBinding.startAsyncRuntime;
586
659
  }));
587
660
 
588
- // node_modules/.pnpm/rolldown@1.1.3/node_modules/rolldown/dist/shared/logs-aMKUxRpj.mjs
661
+ // node_modules/.pnpm/rolldown@1.2.1/node_modules/rolldown/dist/shared/logs-DmYCAKcW.mjs
589
662
  function spaces(index) {
590
663
  let result = "";
591
664
  while (index--) result += " ";
@@ -666,6 +739,7 @@ var INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN";
666
739
  var CYCLE_LOADING = "CYCLE_LOADING";
667
740
  var MULTIPLE_WATCHER_OPTION = "MULTIPLE_WATCHER_OPTION";
668
741
  var PARSE_ERROR = "PARSE_ERROR";
742
+ var VALIDATION_ERROR = "VALIDATION_ERROR";
669
743
  function logParseError(message, id2, pos) {
670
744
  return {
671
745
  code: PARSE_ERROR,
@@ -674,6 +748,12 @@ function logParseError(message, id2, pos) {
674
748
  pos
675
749
  };
676
750
  }
751
+ function logFailedValidation(message) {
752
+ return {
753
+ code: VALIDATION_ERROR,
754
+ message
755
+ };
756
+ }
677
757
  function logInvalidLogPosition(pluginName) {
678
758
  return {
679
759
  code: INVALID_LOG_POSITION,
@@ -746,7 +826,7 @@ function augmentCodeLocation(properties, pos, source, id2) {
746
826
  }
747
827
  }
748
828
 
749
- // node_modules/.pnpm/rolldown@1.1.3/node_modules/rolldown/dist/shared/normalize-string-or-regex-BpXHYeN4.mjs
829
+ // node_modules/.pnpm/rolldown@1.2.1/node_modules/rolldown/dist/shared/normalize-string-or-regex-BVNGzRe4.mjs
750
830
  var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
751
831
  var BuiltinPlugin = class {
752
832
  name;
@@ -785,7 +865,7 @@ function isReadonlyArray(input) {
785
865
  return Array.isArray(input);
786
866
  }
787
867
 
788
- // node_modules/.pnpm/rolldown@1.1.3/node_modules/rolldown/dist/shared/misc-CoQm4NHO.mjs
868
+ // node_modules/.pnpm/rolldown@1.2.1/node_modules/rolldown/dist/shared/misc-DOSKtd97.mjs
789
869
  function arraify(value) {
790
870
  return Array.isArray(value) ? value : [value];
791
871
  }
@@ -802,8 +882,12 @@ function unsupported(info) {
802
882
  }
803
883
  function noop(..._args) {
804
884
  }
885
+ var ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Za-z]:)?[/\\|])/;
886
+ function isPathFragment(name) {
887
+ return name[0] === "/" || name[0] === "." && (name[1] === "/" || name[1] === ".") || ABSOLUTE_PATH_REGEX.test(name);
888
+ }
805
889
 
806
- // node_modules/.pnpm/rolldown@1.1.3/node_modules/rolldown/dist/shared/error-B68YLzl3.mjs
890
+ // node_modules/.pnpm/rolldown@1.2.1/node_modules/rolldown/dist/shared/error-BgfXq0Tb.mjs
807
891
  function bindingifySourcemap(map) {
808
892
  if (map == null) return;
809
893
  return { inner: typeof map === "string" ? map : {
@@ -883,7 +967,7 @@ function joinNewLine(s1, s2) {
883
967
  return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
884
968
  }
885
969
 
886
- // node_modules/.pnpm/rolldown@1.1.3/node_modules/rolldown/dist/shared/parse-CTgsjpo8.mjs
970
+ // node_modules/.pnpm/rolldown@1.2.1/node_modules/rolldown/dist/shared/parse-DQIYJwT4.mjs
887
971
  var import_binding2 = /* @__PURE__ */ __toESM(require_binding(), 1);
888
972
  function wrap(result) {
889
973
  let program, module, comments, errors;
@@ -924,7 +1008,7 @@ function parseSync(filename, sourceText, options) {
924
1008
  return wrap((0, import_binding2.parseSync)(filename, sourceText, options));
925
1009
  }
926
1010
 
927
- // node_modules/.pnpm/rolldown@1.1.3/node_modules/rolldown/dist/parse-ast-index.mjs
1011
+ // node_modules/.pnpm/rolldown@1.2.1/node_modules/rolldown/dist/parse-ast-index.mjs
928
1012
  function wrap2(result, filename, sourceText) {
929
1013
  if (result.errors.length > 0) return normalizeParseError(filename, sourceText, result.errors);
930
1014
  return result.program;
@@ -960,7 +1044,8 @@ function parseAst(sourceText, options, filename) {
960
1044
  }), filename, sourceText);
961
1045
  }
962
1046
 
963
- // node_modules/.pnpm/rolldown@1.1.3/node_modules/rolldown/dist/shared/bindingify-input-options-CzVhGygm.mjs
1047
+ // node_modules/.pnpm/rolldown@1.2.1/node_modules/rolldown/dist/shared/bindingify-input-options-EnUlEF0T.mjs
1048
+ import fs from "node:fs";
964
1049
  import path from "node:path";
965
1050
 
966
1051
  // node_modules/.pnpm/@rolldown+pluginutils@1.0.1/node_modules/@rolldown/pluginutils/dist/filter-B_mD-HGz.mjs
@@ -1046,11 +1131,11 @@ function exclude(expr) {
1046
1131
  return new Exclude(expr);
1047
1132
  }
1048
1133
 
1049
- // node_modules/.pnpm/rolldown@1.1.3/node_modules/rolldown/dist/shared/bindingify-input-options-CzVhGygm.mjs
1134
+ // node_modules/.pnpm/rolldown@1.2.1/node_modules/rolldown/dist/shared/bindingify-input-options-EnUlEF0T.mjs
1050
1135
  import fsp from "node:fs/promises";
1051
- var version = "1.1.3";
1136
+ import { fileURLToPath } from "node:url";
1137
+ var version = "1.2.1";
1052
1138
  var VERSION = version;
1053
- var RUNTIME_MODULE_ID = "\0rolldown/runtime.js";
1054
1139
  var LOG_LEVEL_SILENT = "silent";
1055
1140
  var LOG_LEVEL_WARN = "warn";
1056
1141
  var LOG_LEVEL_INFO = "info";
@@ -1089,6 +1174,14 @@ function normalizeHook(hook) {
1089
1174
  }
1090
1175
  unreachable("Invalid hook type");
1091
1176
  }
1177
+ function getParallelPluginInfo(plugin) {
1178
+ if (plugin === null || typeof plugin !== "object") return;
1179
+ const descriptor = Object.getOwnPropertyDescriptor(plugin, "_parallel");
1180
+ if (!descriptor || !("value" in descriptor)) return;
1181
+ const parallel = descriptor.value;
1182
+ if (parallel === null || typeof parallel !== "object" || typeof parallel.fileUrl !== "string") return;
1183
+ return parallel;
1184
+ }
1092
1185
  var MinimalPluginContextImpl = class {
1093
1186
  pluginName;
1094
1187
  hookName;
@@ -1555,6 +1648,9 @@ var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
1555
1648
  get sourcemap() {
1556
1649
  return this.inner.sourcemap;
1557
1650
  }
1651
+ get sourcemapFileNames() {
1652
+ return this.inner.sourcemapFilenames || this.outputOptions.sourcemapFileNames;
1653
+ }
1558
1654
  get sourcemapBaseUrl() {
1559
1655
  return this.inner.sourcemapBaseUrl ?? void 0;
1560
1656
  }
@@ -1676,6 +1772,7 @@ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "assetFileNames",
1676
1772
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "format", null);
1677
1773
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "exports", null);
1678
1774
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemap", null);
1775
+ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapFileNames", null);
1679
1776
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapBaseUrl", null);
1680
1777
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "shimMissingExports", null);
1681
1778
  __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "name", null);
@@ -1994,6 +2091,24 @@ function containsImporterId(expr) {
1994
2091
  function assertNoImporterId(filterExprs, hookName) {
1995
2092
  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.`);
1996
2093
  }
2094
+ function containsStringId(expr) {
2095
+ switch (expr.kind) {
2096
+ case "and":
2097
+ case "or":
2098
+ return expr.args.some(containsStringId);
2099
+ case "not":
2100
+ case "include":
2101
+ case "exclude":
2102
+ return containsStringId(expr.expr);
2103
+ case "id":
2104
+ return typeof expr.pattern === "string";
2105
+ default:
2106
+ return false;
2107
+ }
2108
+ }
2109
+ function assertNoStringId(filterExprs, hookName) {
2110
+ 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.`);
2111
+ }
1997
2112
  function bindingifyFilterExprImpl(expr, list) {
1998
2113
  switch (expr.kind) {
1999
2114
  case "and": {
@@ -2068,8 +2183,11 @@ function bindingifyFilterExprImpl(expr, list) {
2068
2183
  }
2069
2184
  function bindingifyResolveIdFilter(filterOption) {
2070
2185
  if (!filterOption) return;
2071
- if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
2072
- return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
2186
+ const filterExprs = Array.isArray(filterOption) ? filterOption : filterOption.id ? generalHookFilterMatcherToFilterExprs(filterOption.id, "id") : void 0;
2187
+ assertNoStringId(filterExprs, "resolveId");
2188
+ if (!filterExprs) return;
2189
+ const value = filterExprs.map(bindingifyFilterExpr);
2190
+ return value.length > 0 ? { value } : void 0;
2073
2191
  }
2074
2192
  function bindingifyLoadFilter(filterOption) {
2075
2193
  if (!filterOption) return;
@@ -2111,6 +2229,14 @@ function bindingPluginOrder(order) {
2111
2229
  throw new Error(`Unknown plugin order: ${order}`);
2112
2230
  }
2113
2231
  }
2232
+ function bindingifyHook(hook, build2) {
2233
+ if (!hook) return {};
2234
+ const normalized = normalizeHook(hook);
2235
+ return {
2236
+ ...build2(normalized),
2237
+ meta: bindingifyPluginHookMeta(normalized.meta)
2238
+ };
2239
+ }
2114
2240
  var fsModule = {
2115
2241
  appendFile: fsp.appendFile,
2116
2242
  copyFile: fsp.copyFile,
@@ -2190,17 +2316,23 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2190
2316
  };
2191
2317
  }
2192
2318
  emitFile = (file) => {
2193
- if (file.type === "prebuilt-chunk") return this.context.emitPrebuiltChunk({
2194
- fileName: file.fileName,
2195
- name: file.name,
2196
- code: file.code,
2197
- exports: file.exports,
2198
- map: bindingifySourcemap(file.map),
2199
- sourcemapFileName: file.sourcemapFileName,
2200
- facadeModuleId: file.facadeModuleId,
2201
- isEntry: file.isEntry,
2202
- isDynamicEntry: file.isDynamicEntry
2203
- });
2319
+ if (file.type === "prebuilt-chunk") {
2320
+ if (typeof file.code !== "string") return error(logFailedValidation(`Emitted prebuilt chunks need to have a valid string code, received "${file.code}".`));
2321
+ 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}".`));
2322
+ return this.context.emitPrebuiltChunk({
2323
+ fileName: file.fileName,
2324
+ name: file.name,
2325
+ code: file.code,
2326
+ exports: file.exports,
2327
+ map: bindingifySourcemap(file.map),
2328
+ sourcemapFileName: file.sourcemapFileName,
2329
+ facadeModuleId: file.facadeModuleId,
2330
+ isEntry: file.isEntry,
2331
+ isDynamicEntry: file.isDynamicEntry
2332
+ });
2333
+ }
2334
+ const validatedName = file.fileName || file.name;
2335
+ 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}".`));
2204
2336
  if (file.type === "chunk") return this.context.emitChunk({
2205
2337
  preserveEntrySignatures: bindingifyPreserveEntrySignatures(file.preserveSignature),
2206
2338
  ...file
@@ -2236,6 +2368,9 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2236
2368
  return parseAst(input, options);
2237
2369
  }
2238
2370
  };
2371
+ function createPluginContext(args2, ctx) {
2372
+ return new PluginContextImpl(args2.outputOptions, ctx, args2.plugin, args2.pluginContextData, args2.onLog, args2.logLevel, args2.watchMode);
2373
+ }
2239
2374
  var LoadPluginContextImpl = class extends PluginContextImpl {
2240
2375
  inner;
2241
2376
  constructor(outputOptions, context, plugin, data, inner, moduleId, onLog, logLevelOption, watchMode) {
@@ -2283,36 +2418,19 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
2283
2418
  this.inner.sendMagicString(s2);
2284
2419
  }
2285
2420
  };
2286
- function createPluginContext(args2, ctx) {
2287
- return new PluginContextImpl(args2.outputOptions, ctx, args2.plugin, args2.pluginContextData, args2.onLog, args2.logLevel, args2.watchMode);
2288
- }
2289
2421
  function bindingifyBuildStart(args2) {
2290
- const hook = args2.plugin.buildStart;
2291
- if (!hook) return {};
2292
- const { handler, meta } = normalizeHook(hook);
2293
- return {
2294
- plugin: async (ctx, opts) => {
2295
- await handler.call(createPluginContext(args2, ctx), args2.pluginContextData.getInputOptions(opts));
2296
- },
2297
- meta: bindingifyPluginHookMeta(meta)
2298
- };
2422
+ return bindingifyHook(args2.plugin.buildStart, ({ handler }) => ({ plugin: async (ctx, opts) => {
2423
+ await handler.call(createPluginContext(args2, ctx), args2.pluginContextData.getInputOptions(opts));
2424
+ } }));
2299
2425
  }
2300
2426
  function bindingifyBuildEnd(args2) {
2301
- const hook = args2.plugin.buildEnd;
2302
- if (!hook) return {};
2303
- const { handler, meta } = normalizeHook(hook);
2304
- return {
2305
- plugin: async (ctx, err) => {
2306
- await handler.call(createPluginContext(args2, ctx), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
2307
- },
2308
- meta: bindingifyPluginHookMeta(meta)
2309
- };
2427
+ return bindingifyHook(args2.plugin.buildEnd, ({ handler }) => ({ plugin: async (ctx, err) => {
2428
+ await handler.call(createPluginContext(args2, ctx), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
2429
+ } }));
2310
2430
  }
2311
2431
  function bindingifyResolveId(args2) {
2312
2432
  const hook = args2.plugin.resolveId;
2313
- if (!hook) return {};
2314
- const { handler, meta, options } = normalizeHook(hook);
2315
- return {
2433
+ return bindingifyHook(hook, ({ handler, options }) => ({
2316
2434
  plugin: async (ctx, specifier, importer, extraOptions) => {
2317
2435
  const contextResolveOptions = extraOptions.custom != null ? args2.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
2318
2436
  const ret = await handler.call(createPluginContext(args2, ctx), specifier, importer ?? void 0, {
@@ -2342,47 +2460,37 @@ function bindingifyResolveId(args2) {
2342
2460
  packageJsonPath: ret.packageJsonPath
2343
2461
  };
2344
2462
  },
2345
- meta: bindingifyPluginHookMeta(meta),
2346
2463
  filter: bindingifyResolveIdFilter(options.filter)
2347
- };
2464
+ }));
2348
2465
  }
2349
2466
  function bindingifyResolveDynamicImport(args2) {
2350
- const hook = args2.plugin.resolveDynamicImport;
2351
- if (!hook) return {};
2352
- const { handler, meta } = normalizeHook(hook);
2353
- return {
2354
- plugin: async (ctx, specifier, importer) => {
2355
- const ret = await handler.call(createPluginContext(args2, ctx), specifier, importer ?? void 0);
2356
- if (ret == null) return;
2357
- if (ret === false) return {
2358
- id: specifier,
2359
- external: true
2360
- };
2361
- if (typeof ret === "string") return { id: ret };
2362
- const result = {
2363
- id: ret.id,
2364
- external: ret.external,
2365
- packageJsonPath: ret.packageJsonPath
2366
- };
2367
- if (ret.moduleSideEffects !== null) result.moduleSideEffects = ret.moduleSideEffects;
2368
- args2.pluginContextData.updateModuleOption(ret.id, {
2369
- meta: ret.meta || {},
2370
- moduleSideEffects: ret.moduleSideEffects || null,
2371
- invalidate: false
2372
- });
2373
- return result;
2374
- },
2375
- meta: bindingifyPluginHookMeta(meta)
2376
- };
2467
+ return bindingifyHook(args2.plugin.resolveDynamicImport, ({ handler }) => ({ plugin: async (ctx, specifier, importer) => {
2468
+ const ret = await handler.call(createPluginContext(args2, ctx), specifier, importer ?? void 0);
2469
+ if (ret == null) return;
2470
+ if (ret === false) return {
2471
+ id: specifier,
2472
+ external: true
2473
+ };
2474
+ if (typeof ret === "string") return { id: ret };
2475
+ const result = {
2476
+ id: ret.id,
2477
+ external: ret.external,
2478
+ packageJsonPath: ret.packageJsonPath
2479
+ };
2480
+ if (ret.moduleSideEffects !== null) result.moduleSideEffects = ret.moduleSideEffects;
2481
+ args2.pluginContextData.updateModuleOption(ret.id, {
2482
+ meta: ret.meta || {},
2483
+ moduleSideEffects: ret.moduleSideEffects || null,
2484
+ invalidate: false
2485
+ });
2486
+ return result;
2487
+ } }));
2377
2488
  }
2378
2489
  function bindingifyTransform(args2) {
2379
- const hook = args2.plugin.transform;
2380
- if (!hook) return {};
2381
- const { handler, meta, options } = normalizeHook(hook);
2382
- return {
2383
- plugin: async (ctx, code2, id2, meta2) => {
2490
+ return bindingifyHook(args2.plugin.transform, ({ handler, options }) => ({
2491
+ plugin: async (ctx, code2, id2, meta) => {
2384
2492
  let magicStringInstance, astInstance;
2385
- Object.defineProperties(meta2, {
2493
+ Object.defineProperties(meta, {
2386
2494
  magicString: { get() {
2387
2495
  if (magicStringInstance) return magicStringInstance;
2388
2496
  magicStringInstance = new RolldownMagicString(code2);
@@ -2391,25 +2499,22 @@ function bindingifyTransform(args2) {
2391
2499
  ast: { get() {
2392
2500
  if (astInstance) return astInstance;
2393
2501
  let lang = "js";
2394
- switch (meta2.moduleType) {
2502
+ switch (meta.moduleType) {
2395
2503
  case "js":
2396
2504
  case "jsx":
2397
2505
  case "ts":
2398
2506
  case "tsx":
2399
- lang = meta2.moduleType;
2400
- break;
2401
- default:
2402
- break;
2507
+ lang = meta.moduleType;
2403
2508
  }
2404
2509
  astInstance = parseAst(code2, {
2405
- astType: meta2.moduleType.includes("ts") ? "ts" : "js",
2510
+ astType: meta.moduleType.includes("ts") ? "ts" : "js",
2406
2511
  lang
2407
2512
  });
2408
2513
  return astInstance;
2409
2514
  } }
2410
2515
  });
2411
2516
  const transformCtx = new TransformPluginContextImpl(args2.outputOptions, ctx.inner(), args2.plugin, args2.pluginContextData, ctx, id2, code2, args2.onLog, args2.logLevel, args2.watchMode);
2412
- const ret = await handler.call(transformCtx, code2, id2, meta2);
2517
+ const ret = await handler.call(transformCtx, code2, id2, meta);
2413
2518
  if (ret == null) return;
2414
2519
  if (typeof ret === "string") return { code: ret };
2415
2520
  let moduleOption = args2.pluginContextData.updateModuleOption(id2, {
@@ -2435,15 +2540,11 @@ function bindingifyTransform(args2) {
2435
2540
  moduleType: ret.moduleType
2436
2541
  };
2437
2542
  },
2438
- meta: bindingifyPluginHookMeta(meta),
2439
2543
  filter: bindingifyTransformFilter(options.filter)
2440
- };
2544
+ }));
2441
2545
  }
2442
2546
  function bindingifyLoad(args2) {
2443
- const hook = args2.plugin.load;
2444
- if (!hook) return {};
2445
- const { handler, meta, options } = normalizeHook(hook);
2446
- return {
2547
+ return bindingifyHook(args2.plugin.load, ({ handler, options }) => ({
2447
2548
  plugin: async (ctx, id2) => {
2448
2549
  const ret = await handler.call(new LoadPluginContextImpl(args2.outputOptions, ctx.inner(), args2.plugin, args2.pluginContextData, ctx, id2, args2.onLog, args2.logLevel, args2.watchMode), id2);
2449
2550
  if (ret == null) return;
@@ -2461,9 +2562,8 @@ function bindingifyLoad(args2) {
2461
2562
  moduleSideEffects: moduleOption.moduleSideEffects ?? void 0
2462
2563
  };
2463
2564
  },
2464
- meta: bindingifyPluginHookMeta(meta),
2465
2565
  filter: bindingifyLoadFilter(options.filter)
2466
- };
2566
+ }));
2467
2567
  }
2468
2568
  function preProcessSourceMap(ret, id2) {
2469
2569
  if (!ret.map) return;
@@ -2476,34 +2576,19 @@ function preProcessSourceMap(ret, id2) {
2476
2576
  return map;
2477
2577
  }
2478
2578
  function bindingifyModuleParsed(args2) {
2479
- const hook = args2.plugin.moduleParsed;
2480
- if (!hook) return {};
2481
- const { handler, meta } = normalizeHook(hook);
2482
- return {
2483
- plugin: async (ctx, moduleInfo) => {
2484
- await handler.call(createPluginContext(args2, ctx), transformModuleInfo(moduleInfo, args2.pluginContextData.getModuleOption(moduleInfo.id)));
2485
- },
2486
- meta: bindingifyPluginHookMeta(meta)
2487
- };
2579
+ return bindingifyHook(args2.plugin.moduleParsed, ({ handler }) => ({ plugin: async (ctx, moduleInfo) => {
2580
+ await handler.call(createPluginContext(args2, ctx), transformModuleInfo(moduleInfo, args2.pluginContextData.getModuleOption(moduleInfo.id)));
2581
+ } }));
2488
2582
  }
2489
2583
  function bindingifyRenderStart(args2) {
2490
- const hook = args2.plugin.renderStart;
2491
- if (!hook) return {};
2492
- const { handler, meta } = normalizeHook(hook);
2493
- return {
2494
- plugin: async (ctx, opts) => {
2495
- handler.call(new PluginContextImpl(args2.outputOptions, ctx, args2.plugin, args2.pluginContextData, args2.onLog, args2.logLevel, args2.watchMode), args2.pluginContextData.getOutputOptions(opts), args2.pluginContextData.getInputOptions(opts));
2496
- },
2497
- meta: bindingifyPluginHookMeta(meta)
2498
- };
2584
+ return bindingifyHook(args2.plugin.renderStart, ({ handler }) => ({ plugin: async (ctx, opts) => {
2585
+ await handler.call(createPluginContext(args2, ctx), args2.pluginContextData.getOutputOptions(opts), args2.pluginContextData.getInputOptions(opts));
2586
+ } }));
2499
2587
  }
2500
2588
  function bindingifyRenderChunk(args2) {
2501
- const hook = args2.plugin.renderChunk;
2502
- if (!hook) return {};
2503
- const { handler, meta, options } = normalizeHook(hook);
2504
- return {
2505
- plugin: async (ctx, code2, chunk, opts, meta2) => {
2506
- if (args2.pluginContextData.getRenderChunkMeta() == null) args2.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta2.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
2589
+ return bindingifyHook(args2.plugin.renderChunk, ({ handler, options }) => ({
2590
+ plugin: async (ctx, code2, chunk, opts, meta) => {
2591
+ if (args2.pluginContextData.getRenderChunkMeta() == null) args2.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
2507
2592
  const renderChunkMeta = args2.pluginContextData.getRenderChunkMeta();
2508
2593
  let magicStringInstance;
2509
2594
  if (args2.options.experimental?.nativeMagicString) Object.defineProperty(renderChunkMeta, "magicString", {
@@ -2514,7 +2599,7 @@ function bindingifyRenderChunk(args2) {
2514
2599
  },
2515
2600
  configurable: true
2516
2601
  });
2517
- const ret = await handler.call(new PluginContextImpl(args2.outputOptions, ctx, args2.plugin, args2.pluginContextData, args2.onLog, args2.logLevel, args2.watchMode), code2, transformRenderedChunk(chunk), args2.pluginContextData.getOutputOptions(opts), renderChunkMeta);
2602
+ const ret = await handler.call(createPluginContext(args2, ctx), code2, transformRenderedChunk(chunk), args2.pluginContextData.getOutputOptions(opts), renderChunkMeta);
2518
2603
  if (ret == null) return;
2519
2604
  if (ret instanceof RolldownMagicString) {
2520
2605
  const normalizedCode = ret.toString();
@@ -2565,148 +2650,79 @@ function bindingifyRenderChunk(args2) {
2565
2650
  map: bindingifySourcemap(ret.map)
2566
2651
  };
2567
2652
  },
2568
- meta: bindingifyPluginHookMeta(meta),
2569
2653
  filter: bindingifyRenderChunkFilter(options.filter)
2570
- };
2654
+ }));
2571
2655
  }
2572
2656
  function bindingifyAugmentChunkHash(args2) {
2573
- const hook = args2.plugin.augmentChunkHash;
2574
- if (!hook) return {};
2575
- const { handler, meta } = normalizeHook(hook);
2576
- return {
2577
- plugin: async (ctx, chunk) => {
2578
- return handler.call(new PluginContextImpl(args2.outputOptions, ctx, args2.plugin, args2.pluginContextData, args2.onLog, args2.logLevel, args2.watchMode), transformRenderedChunk(chunk));
2579
- },
2580
- meta: bindingifyPluginHookMeta(meta)
2581
- };
2657
+ return bindingifyHook(args2.plugin.augmentChunkHash, ({ handler }) => ({ plugin: async (ctx, chunk) => {
2658
+ return handler.call(createPluginContext(args2, ctx), transformRenderedChunk(chunk));
2659
+ } }));
2660
+ }
2661
+ function bindingifyResolveFileUrl(args2) {
2662
+ return bindingifyHook(args2.plugin.resolveFileUrl, ({ handler }) => ({ plugin: async (ctx, resolveFileUrlArgs) => {
2663
+ return handler.call(createPluginContext(args2, ctx), resolveFileUrlArgs);
2664
+ } }));
2582
2665
  }
2583
2666
  function bindingifyRenderError(args2) {
2584
- const hook = args2.plugin.renderError;
2585
- if (!hook) return {};
2586
- const { handler, meta } = normalizeHook(hook);
2667
+ return bindingifyHook(args2.plugin.renderError, ({ handler }) => ({ plugin: async (ctx, err) => {
2668
+ await handler.call(createPluginContext(args2, ctx), aggregateBindingErrorsIntoJsError(err));
2669
+ } }));
2670
+ }
2671
+ function createOutputBundle(args2, ctx, bundle) {
2672
+ const changed = {
2673
+ updated: /* @__PURE__ */ new Set(),
2674
+ deleted: /* @__PURE__ */ new Set()
2675
+ };
2676
+ const context = createPluginContext(args2, ctx);
2587
2677
  return {
2588
- plugin: async (ctx, err) => {
2589
- handler.call(new PluginContextImpl(args2.outputOptions, ctx, args2.plugin, args2.pluginContextData, args2.onLog, args2.logLevel, args2.watchMode), aggregateBindingErrorsIntoJsError(err));
2590
- },
2591
- meta: bindingifyPluginHookMeta(meta)
2678
+ changed,
2679
+ context,
2680
+ output: transformToOutputBundle(context, unwrapBindingResult(bundle), changed)
2592
2681
  };
2593
2682
  }
2594
2683
  function bindingifyGenerateBundle(args2) {
2595
- const hook = args2.plugin.generateBundle;
2596
- if (!hook) return {};
2597
- const { handler, meta } = normalizeHook(hook);
2598
- return {
2599
- plugin: async (ctx, bundle, isWrite, opts) => {
2600
- const changed = {
2601
- updated: /* @__PURE__ */ new Set(),
2602
- deleted: /* @__PURE__ */ new Set()
2603
- };
2604
- const context = new PluginContextImpl(args2.outputOptions, ctx, args2.plugin, args2.pluginContextData, args2.onLog, args2.logLevel, args2.watchMode);
2605
- const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
2606
- await handler.call(context, args2.pluginContextData.getOutputOptions(opts), output, isWrite);
2607
- return collectChangedBundle(changed, output);
2608
- },
2609
- meta: bindingifyPluginHookMeta(meta)
2610
- };
2684
+ return bindingifyHook(args2.plugin.generateBundle, ({ handler }) => ({ plugin: async (ctx, bundle, isWrite, opts) => {
2685
+ const { changed, context, output } = createOutputBundle(args2, ctx, bundle);
2686
+ await handler.call(context, args2.pluginContextData.getOutputOptions(opts), output, isWrite);
2687
+ return collectChangedBundle(changed, output);
2688
+ } }));
2611
2689
  }
2612
2690
  function bindingifyWriteBundle(args2) {
2613
- const hook = args2.plugin.writeBundle;
2614
- if (!hook) return {};
2615
- const { handler, meta } = normalizeHook(hook);
2616
- return {
2617
- plugin: async (ctx, bundle, opts) => {
2618
- const changed = {
2619
- updated: /* @__PURE__ */ new Set(),
2620
- deleted: /* @__PURE__ */ new Set()
2621
- };
2622
- const context = new PluginContextImpl(args2.outputOptions, ctx, args2.plugin, args2.pluginContextData, args2.onLog, args2.logLevel, args2.watchMode);
2623
- const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
2624
- await handler.call(context, args2.pluginContextData.getOutputOptions(opts), output);
2625
- return collectChangedBundle(changed, output);
2626
- },
2627
- meta: bindingifyPluginHookMeta(meta)
2628
- };
2691
+ return bindingifyHook(args2.plugin.writeBundle, ({ handler }) => ({ plugin: async (ctx, bundle, opts) => {
2692
+ const { changed, context, output } = createOutputBundle(args2, ctx, bundle);
2693
+ await handler.call(context, args2.pluginContextData.getOutputOptions(opts), output);
2694
+ return collectChangedBundle(changed, output);
2695
+ } }));
2629
2696
  }
2630
2697
  function bindingifyCloseBundle(args2) {
2631
- const hook = args2.plugin.closeBundle;
2632
- if (!hook) return {};
2633
- const { handler, meta } = normalizeHook(hook);
2634
- return {
2635
- plugin: async (ctx, err) => {
2636
- await handler.call(new PluginContextImpl(args2.outputOptions, ctx, args2.plugin, args2.pluginContextData, args2.onLog, args2.logLevel, args2.watchMode), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
2637
- },
2638
- meta: bindingifyPluginHookMeta(meta)
2639
- };
2640
- }
2641
- function bindingifyBanner(args2) {
2642
- const hook = args2.plugin.banner;
2643
- if (!hook) return {};
2644
- const { handler, meta } = normalizeHook(hook);
2645
- return {
2646
- plugin: async (ctx, chunk) => {
2647
- if (typeof handler === "string") return handler;
2648
- return handler.call(new PluginContextImpl(args2.outputOptions, ctx, args2.plugin, args2.pluginContextData, args2.onLog, args2.logLevel, args2.watchMode), transformRenderedChunk(chunk));
2649
- },
2650
- meta: bindingifyPluginHookMeta(meta)
2651
- };
2652
- }
2653
- function bindingifyFooter(args2) {
2654
- const hook = args2.plugin.footer;
2655
- if (!hook) return {};
2656
- const { handler, meta } = normalizeHook(hook);
2657
- return {
2658
- plugin: async (ctx, chunk) => {
2659
- if (typeof handler === "string") return handler;
2660
- return handler.call(new PluginContextImpl(args2.outputOptions, ctx, args2.plugin, args2.pluginContextData, args2.onLog, args2.logLevel, args2.watchMode), transformRenderedChunk(chunk));
2661
- },
2662
- meta: bindingifyPluginHookMeta(meta)
2663
- };
2664
- }
2665
- function bindingifyIntro(args2) {
2666
- const hook = args2.plugin.intro;
2667
- if (!hook) return {};
2668
- const { handler, meta } = normalizeHook(hook);
2669
- return {
2670
- plugin: async (ctx, chunk) => {
2671
- if (typeof handler === "string") return handler;
2672
- return handler.call(new PluginContextImpl(args2.outputOptions, ctx, args2.plugin, args2.pluginContextData, args2.onLog, args2.logLevel, args2.watchMode), transformRenderedChunk(chunk));
2673
- },
2674
- meta: bindingifyPluginHookMeta(meta)
2675
- };
2676
- }
2677
- function bindingifyOutro(args2) {
2678
- const hook = args2.plugin.outro;
2679
- if (!hook) return {};
2680
- const { handler, meta } = normalizeHook(hook);
2681
- return {
2682
- plugin: async (ctx, chunk) => {
2683
- if (typeof handler === "string") return handler;
2684
- return handler.call(new PluginContextImpl(args2.outputOptions, ctx, args2.plugin, args2.pluginContextData, args2.onLog, args2.logLevel, args2.watchMode), transformRenderedChunk(chunk));
2685
- },
2686
- meta: bindingifyPluginHookMeta(meta)
2687
- };
2698
+ return bindingifyHook(args2.plugin.closeBundle, ({ handler }) => ({ plugin: async (ctx, err) => {
2699
+ await handler.call(createPluginContext(args2, ctx), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
2700
+ } }));
2701
+ }
2702
+ function bindingifyAddonHook(args2, name) {
2703
+ return bindingifyHook(args2.plugin[name], ({ handler }) => ({ plugin: async (ctx, chunk) => {
2704
+ if (typeof handler === "string") return handler;
2705
+ return handler.call(createPluginContext(args2, ctx), transformRenderedChunk(chunk));
2706
+ } }));
2707
+ }
2708
+ function bindingifyHotUpdate(args2) {
2709
+ return bindingifyHook(args2.plugin.hotUpdate, ({ handler }) => ({ plugin: async (ctx, hookArgs) => {
2710
+ return await handler.call(createPluginContext(args2, ctx), {
2711
+ type: hookArgs.kind,
2712
+ file: hookArgs.file,
2713
+ modules: hookArgs.modules
2714
+ }) ?? void 0;
2715
+ } }));
2688
2716
  }
2689
2717
  function bindingifyWatchChange(args2) {
2690
- const hook = args2.plugin.watchChange;
2691
- if (!hook) return {};
2692
- const { handler, meta } = normalizeHook(hook);
2693
- return {
2694
- plugin: async (ctx, id2, event) => {
2695
- await handler.call(new PluginContextImpl(args2.outputOptions, ctx, args2.plugin, args2.pluginContextData, args2.onLog, args2.logLevel, args2.watchMode), id2, { event });
2696
- },
2697
- meta: bindingifyPluginHookMeta(meta)
2698
- };
2718
+ return bindingifyHook(args2.plugin.watchChange, ({ handler }) => ({ plugin: async (ctx, id2, event) => {
2719
+ await handler.call(createPluginContext(args2, ctx), id2, { event });
2720
+ } }));
2699
2721
  }
2700
2722
  function bindingifyCloseWatcher(args2) {
2701
- const hook = args2.plugin.closeWatcher;
2702
- if (!hook) return {};
2703
- const { handler, meta } = normalizeHook(hook);
2704
- return {
2705
- plugin: async (ctx) => {
2706
- await handler.call(new PluginContextImpl(args2.outputOptions, ctx, args2.plugin, args2.pluginContextData, args2.onLog, args2.logLevel, args2.watchMode));
2707
- },
2708
- meta: bindingifyPluginHookMeta(meta)
2709
- };
2723
+ return bindingifyHook(args2.plugin.closeWatcher, ({ handler }) => ({ plugin: async (ctx) => {
2724
+ await handler.call(createPluginContext(args2, ctx));
2725
+ } }));
2710
2726
  }
2711
2727
  var HookUsage = class {
2712
2728
  bitflag = BigInt(0);
@@ -2741,6 +2757,8 @@ function extractHookUsage(plugin) {
2741
2757
  if (plugin.footer) hookUsage.union(262144);
2742
2758
  if (plugin.intro) hookUsage.union(524288);
2743
2759
  if (plugin.outro) hookUsage.union(1048576);
2760
+ if (plugin.resolveFileUrl) hookUsage.union(2097152);
2761
+ if (plugin.hotUpdate) hookUsage.union(4194304);
2744
2762
  return hookUsage;
2745
2763
  }
2746
2764
  function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
@@ -2763,16 +2781,18 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
2763
2781
  const { plugin: load2, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args2);
2764
2782
  const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args2);
2765
2783
  const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args2);
2784
+ const { plugin: resolveFileUrl, meta: resolveFileUrlMeta } = bindingifyResolveFileUrl(args2);
2766
2785
  const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args2);
2767
2786
  const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args2);
2768
2787
  const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args2);
2769
2788
  const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args2);
2770
2789
  const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args2);
2771
- const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args2);
2772
- const { plugin: footer, meta: footerMeta } = bindingifyFooter(args2);
2773
- const { plugin: intro, meta: introMeta } = bindingifyIntro(args2);
2774
- const { plugin: outro, meta: outroMeta } = bindingifyOutro(args2);
2790
+ const { plugin: banner, meta: bannerMeta } = bindingifyAddonHook(args2, "banner");
2791
+ const { plugin: footer, meta: footerMeta } = bindingifyAddonHook(args2, "footer");
2792
+ const { plugin: intro, meta: introMeta } = bindingifyAddonHook(args2, "intro");
2793
+ const { plugin: outro, meta: outroMeta } = bindingifyAddonHook(args2, "outro");
2775
2794
  const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args2);
2795
+ const { plugin: hotUpdate, meta: hotUpdateMeta } = bindingifyHotUpdate(args2);
2776
2796
  const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args2);
2777
2797
  let hookUsage = extractHookUsage(plugin).inner();
2778
2798
  return wrapHandlers({
@@ -2799,6 +2819,8 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
2799
2819
  renderChunkFilter,
2800
2820
  augmentChunkHash,
2801
2821
  augmentChunkHashMeta,
2822
+ resolveFileUrl,
2823
+ resolveFileUrlMeta,
2802
2824
  renderStart,
2803
2825
  renderStartMeta,
2804
2826
  renderError,
@@ -2819,6 +2841,8 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
2819
2841
  outroMeta,
2820
2842
  watchChange,
2821
2843
  watchChangeMeta,
2844
+ hotUpdate,
2845
+ hotUpdateMeta,
2822
2846
  closeWatcher,
2823
2847
  closeWatcherMeta,
2824
2848
  hookUsage
@@ -2835,6 +2859,7 @@ function wrapHandlers(plugin) {
2835
2859
  "load",
2836
2860
  "renderChunk",
2837
2861
  "augmentChunkHash",
2862
+ "resolveFileUrl",
2838
2863
  "renderStart",
2839
2864
  "renderError",
2840
2865
  "generateBundle",
@@ -2845,6 +2870,7 @@ function wrapHandlers(plugin) {
2845
2870
  "intro",
2846
2871
  "outro",
2847
2872
  "watchChange",
2873
+ "hotUpdate",
2848
2874
  "closeWatcher"
2849
2875
  ]) {
2850
2876
  const handler = plugin[hookName];
@@ -2881,9 +2907,16 @@ function normalizeTransformOptions(inputOptions) {
2881
2907
  oxcTransformOptions
2882
2908
  };
2883
2909
  }
2910
+ function getDefaultDevRuntime(host = "localhost", port = 3e3) {
2911
+ const runtimeEntry = fs.readFileSync(fileURLToPath(import.meta.resolve("rolldown/experimental/runtime")), "utf8");
2912
+ const runtimeHelperImportEnd = runtimeEntry.indexOf("\n");
2913
+ if (!runtimeEntry.startsWith("import ") || runtimeHelperImportEnd === -1) throw new Error("Expected the standalone runtime to start with a helper import");
2914
+ return `${runtimeEntry.slice(runtimeHelperImportEnd + 1)}
2915
+ ${fs.readFileSync(fileURLToPath(import.meta.resolve("#default-runtime")), "utf8").replaceAll("$ADDR", `${host}:${port}`)}`;
2916
+ }
2884
2917
  function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
2885
2918
  const plugins = rawPlugins.map((plugin) => {
2886
- if ("_parallel" in plugin) return;
2919
+ if (getParallelPluginInfo(plugin)) return;
2887
2920
  if (plugin instanceof BuiltinPlugin) switch (plugin.name) {
2888
2921
  case "builtin:vite-manifest":
2889
2922
  return bindingifyManifestPlugin(plugin, pluginContextData);
@@ -2935,8 +2968,16 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, pluginC
2935
2968
  }
2936
2969
  function bindingifyDevMode(devMode) {
2937
2970
  if (devMode) {
2938
- if (typeof devMode === "boolean") return devMode ? {} : void 0;
2939
- return devMode;
2971
+ if (typeof devMode === "boolean") return devMode ? {
2972
+ implement: getDefaultDevRuntime(),
2973
+ skipCommonRuntimeInjection: true
2974
+ } : void 0;
2975
+ const usesDefaultRuntime = devMode.implement == null;
2976
+ return {
2977
+ ...devMode,
2978
+ implement: devMode.implement ?? getDefaultDevRuntime(devMode.host, devMode.port),
2979
+ skipCommonRuntimeInjection: usesDefaultRuntime ? true : devMode.skipCommonRuntimeInjection
2980
+ };
2940
2981
  }
2941
2982
  }
2942
2983
  function bindingifyAttachDebugInfo(attachDebugInfo) {
@@ -3090,8 +3131,6 @@ function bindingifyTreeshakeOptions(config) {
3090
3131
  break;
3091
3132
  case false:
3092
3133
  normalizedConfig.propertyReadSideEffects = import_binding3.BindingPropertyReadSideEffects.False;
3093
- break;
3094
- default:
3095
3134
  }
3096
3135
  switch (config.propertyWriteSideEffects) {
3097
3136
  case "always":
@@ -3099,8 +3138,6 @@ function bindingifyTreeshakeOptions(config) {
3099
3138
  break;
3100
3139
  case false:
3101
3140
  normalizedConfig.propertyWriteSideEffects = import_binding3.BindingPropertyWriteSideEffects.False;
3102
- break;
3103
- default:
3104
3141
  }
3105
3142
  if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
3106
3143
  else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
@@ -3132,14 +3169,13 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
3132
3169
  };
3133
3170
  }
3134
3171
 
3135
- // node_modules/.pnpm/rolldown@1.1.3/node_modules/rolldown/dist/shared/rolldown-build-DR0wzp0V.mjs
3172
+ // node_modules/.pnpm/rolldown@1.2.1/node_modules/rolldown/dist/shared/create-bundler-option-4QtiLLuz.mjs
3136
3173
  import { Worker } from "node:worker_threads";
3137
3174
  import path2, { sep } from "node:path";
3138
3175
  import { formatWithOptions, styleText } from "node:util";
3139
3176
  import g$1 from "node:process";
3140
3177
  import * as tty from "node:tty";
3141
3178
  import os from "node:os";
3142
- var import_binding4 = /* @__PURE__ */ __toESM(require_binding(), 1);
3143
3179
  function getLogger(plugins, onLog, logLevel, watchMode) {
3144
3180
  const minimalPriority = logLevelPriority[logLevel];
3145
3181
  const logger2 = (level, log, skipped = /* @__PURE__ */ new Set()) => {
@@ -3236,7 +3272,8 @@ var ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES = [
3236
3272
  "renderStart",
3237
3273
  "renderError",
3238
3274
  "writeBundle",
3239
- "generateBundle"
3275
+ "generateBundle",
3276
+ "resolveFileUrl"
3240
3277
  ];
3241
3278
  var ENUMERATED_PLUGIN_HOOK_NAMES = [
3242
3279
  ...ENUMERATED_INPUT_PLUGIN_HOOK_NAMES,
@@ -3246,7 +3283,8 @@ var ENUMERATED_PLUGIN_HOOK_NAMES = [
3246
3283
  "intro",
3247
3284
  "outro"
3248
3285
  ];
3249
- 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];
3286
+ 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];
3287
+ var INTERNAL_PLUGIN_HOOK_NAMES = ["hotUpdate"];
3250
3288
  async function asyncFlatten(array2) {
3251
3289
  do
3252
3290
  array2 = (await Promise.all(array2)).flat(Infinity);
@@ -3255,7 +3293,7 @@ async function asyncFlatten(array2) {
3255
3293
  }
3256
3294
  var normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
3257
3295
  function checkOutputPluginOption(plugins, onLog) {
3258
- for (const plugin of plugins) for (const hook of ENUMERATED_INPUT_PLUGIN_HOOK_NAMES) if (hook in plugin) {
3296
+ for (const plugin of plugins) for (const hook of [...ENUMERATED_INPUT_PLUGIN_HOOK_NAMES, ...INTERNAL_PLUGIN_HOOK_NAMES]) if (hook in plugin) {
3259
3297
  delete plugin[hook];
3260
3298
  onLog(LOG_LEVEL_WARN, logInputHookInOutputPlugin(plugin.name, hook));
3261
3299
  }
@@ -3263,9 +3301,10 @@ function checkOutputPluginOption(plugins, onLog) {
3263
3301
  }
3264
3302
  function normalizePlugins(plugins, anonymousPrefix) {
3265
3303
  for (const [index, plugin] of plugins.entries()) {
3266
- if ("_parallel" in plugin) continue;
3304
+ if (getParallelPluginInfo(plugin)) continue;
3267
3305
  if (plugin instanceof BuiltinPlugin) continue;
3268
- if (!plugin.name) plugin.name = `${anonymousPrefix}${index + 1}`;
3306
+ const objectPlugin = plugin;
3307
+ if (!objectPlugin.name) objectPlugin.name = `${anonymousPrefix}${index + 1}`;
3269
3308
  }
3270
3309
  return plugins;
3271
3310
  }
@@ -3304,7 +3343,7 @@ var PluginDriver = class {
3304
3343
  function getObjectPlugins(plugins) {
3305
3344
  return plugins.filter((plugin) => {
3306
3345
  if (!plugin) return;
3307
- if ("_parallel" in plugin) return;
3346
+ if (getParallelPluginInfo(plugin)) return;
3308
3347
  if (plugin instanceof BuiltinPlugin) return;
3309
3348
  return plugin;
3310
3349
  });
@@ -4439,6 +4478,7 @@ var MinifyOptionsSchema = /* @__PURE__ */ strictObject({
4439
4478
  function: /* @__PURE__ */ boolean(),
4440
4479
  class: /* @__PURE__ */ boolean()
4441
4480
  })])),
4481
+ reserved: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
4442
4482
  debug: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
4443
4483
  })])),
4444
4484
  codegen: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
@@ -4497,6 +4537,7 @@ var DevModeSchema = /* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE
4497
4537
  port: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
4498
4538
  host: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
4499
4539
  implement: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
4540
+ skipCommonRuntimeInjection: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
4500
4541
  lazy: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
4501
4542
  })]);
4502
4543
  var InputOptionsSchema = /* @__PURE__ */ strictObject({
@@ -4646,6 +4687,7 @@ var OutputOptionsSchema = /* @__PURE__ */ strictObject({
4646
4687
  /* @__PURE__ */ literal("hidden")
4647
4688
  ])), /* @__PURE__ */ description(`Generate sourcemap (\`-s inline\` for inline, or \`-s\` for \`.map\` file)`)),
4648
4689
  sourcemapBaseUrl: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Base URL used to prefix sourcemap paths")),
4690
+ sourcemapFileNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(ChunkFileNamesSchema), /* @__PURE__ */ description("Name pattern for emitted sourcemaps")),
4649
4691
  sourcemapDebugIds: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Inject sourcemap debug IDs")),
4650
4692
  sourcemapExcludeSources: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Exclude source content from sourcemaps")),
4651
4693
  sourcemapIgnoreList: /* @__PURE__ */ optional(/* @__PURE__ */ union([
@@ -4697,7 +4739,7 @@ var OutputOptionsSchema = /* @__PURE__ */ strictObject({
4697
4739
  topLevelVar: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Rewrite top-level declarations to use `var`.")),
4698
4740
  cleanDir: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Clean output directory before emitting output")),
4699
4741
  keepNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Keep function and class names after bundling")),
4700
- strictExecutionOrder: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Lets modules be executed in the order they are declared.")),
4742
+ strictExecutionOrder: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Preserve source module execution order across generated chunks.")),
4701
4743
  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.'))
4702
4744
  });
4703
4745
  var getAddonDescription = (placement, wrapper) => {
@@ -4719,7 +4761,7 @@ var OutputCliOverrideSchema = /* @__PURE__ */ strictObject({
4719
4761
  codeSplitting: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
4720
4762
  minSize: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum size of the chunk")),
4721
4763
  minShareCount: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum share count of the chunk"))
4722
- })])), /* @__PURE__ */ description("Code splitting options (true, false, or object)")),
4764
+ })])), /* @__PURE__ */ description("Code splitting options. Enabled by default; use `--no-codeSplitting` to disable, or `--codeSplitting.minSize` / `--codeSplitting.minShareCount` to configure")),
4723
4765
  advancedChunks: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ strictObject({
4724
4766
  minSize: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum size of the chunk")),
4725
4767
  minShareCount: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum share count of the chunk"))
@@ -4741,6 +4783,7 @@ var CliOptionsSchema = /* @__PURE__ */ strictObject({
4741
4783
  environment: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ string(), /* @__PURE__ */ array(/* @__PURE__ */ string())])), /* @__PURE__ */ description("Pass additional settings to the config file via process.ENV.")),
4742
4784
  version: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Show version number")),
4743
4785
  watch: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Watch files in bundle and rebuild on changes")),
4786
+ configLoader: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ literal("bundle"), /* @__PURE__ */ literal("native")])), /* @__PURE__ */ description("How to load the config file (bundle, native)")),
4744
4787
  ...InputCliOptionsSchema.entries,
4745
4788
  ...OutputCliOptionsSchema.entries
4746
4789
  });
@@ -4774,28 +4817,6 @@ function validateOption(key, options) {
4774
4817
  ${errors.join("\n")}\x1B[0m`);
4775
4818
  }
4776
4819
  }
4777
- var RolldownOutputImpl = class extends PlainObjectLike {
4778
- bindingOutputs;
4779
- constructor(bindingOutputs) {
4780
- super();
4781
- this.bindingOutputs = bindingOutputs;
4782
- }
4783
- get output() {
4784
- return transformToRollupOutput(this.bindingOutputs).output;
4785
- }
4786
- __rolldown_external_memory_handle__(keepDataAlive) {
4787
- const results = this.output.map((item) => item.__rolldown_external_memory_handle__(keepDataAlive));
4788
- if (!results.every((r2) => r2.freed)) {
4789
- const reasons = results.filter((r2) => !r2.freed).map((r2) => r2.reason).filter(Boolean);
4790
- return {
4791
- freed: false,
4792
- reason: `Failed to free ${reasons.length} item(s): ${reasons.join("; ")}`
4793
- };
4794
- }
4795
- return { freed: true };
4796
- }
4797
- };
4798
- __decorate([lazyProp], RolldownOutputImpl.prototype, "output", null);
4799
4820
  var ChunkingContextImpl = class {
4800
4821
  context;
4801
4822
  pluginContextData;
@@ -5219,10 +5240,11 @@ ${indent}`);
5219
5240
  return causedPrefix + message + "\n" + stack + causedError;
5220
5241
  }
5221
5242
  formatArgs(args2, opts) {
5222
- return formatWithOptions(opts, ...args2.map((arg) => {
5243
+ const _args = args2.map((arg) => {
5223
5244
  if (arg && typeof arg.stack === "string") return this.formatError(arg, opts);
5224
5245
  return arg;
5225
- }));
5246
+ });
5247
+ return formatWithOptions(opts, ..._args);
5226
5248
  }
5227
5249
  formatDate(date, opts) {
5228
5250
  return opts.date ? date.toLocaleTimeString() : "";
@@ -5754,7 +5776,7 @@ function createConsola(options = {}) {
5754
5776
  defaults: { level },
5755
5777
  stdout: process.stdout,
5756
5778
  stderr: process.stderr,
5757
- prompt: (...args2) => import("./prompt-B1Yc1NPt-VGOTWJMN.js").then((m) => m.prompt(...args2)),
5779
+ prompt: (...args2) => import("./prompt-CH6TK0bC-C7OTKGRD.js").then((m) => m.prompt(...args2)),
5758
5780
  reporters: options.reporters || [options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
5759
5781
  ...options
5760
5782
  });
@@ -5788,7 +5810,7 @@ function createTestingLogger() {
5788
5810
  return ret;
5789
5811
  }
5790
5812
  function bindingifyOutputOptions(outputOptions, pluginContextData) {
5791
- 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;
5813
+ 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;
5792
5814
  if (legalComments != null) logger.warn("`legalComments` option is deprecated, please use `comments.legal` instead.");
5793
5815
  const { inlineDynamicImports, advancedChunks } = bindingifyCodeSplitting(outputOptions.codeSplitting, outputOptions.inlineDynamicImports, outputOptions.advancedChunks, manualChunks, pluginContextData);
5794
5816
  return {
@@ -5800,6 +5822,7 @@ function bindingifyOutputOptions(outputOptions, pluginContextData) {
5800
5822
  sourcemap: bindingifySourcemap2(sourcemap),
5801
5823
  sourcemapBaseUrl,
5802
5824
  sourcemapDebugIds,
5825
+ sourcemapFileNames,
5803
5826
  sourcemapExcludeSources,
5804
5827
  sourcemapIgnoreList: sourcemapIgnoreList ?? /node_modules/,
5805
5828
  sourcemapPathTransform,
@@ -5950,15 +5973,19 @@ function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, adva
5950
5973
  advancedChunks: advancedChunksResult
5951
5974
  };
5952
5975
  }
5976
+ var import_binding4 = /* @__PURE__ */ __toESM(require_binding(), 1);
5953
5977
  async function initializeParallelPlugins(plugins) {
5954
5978
  const pluginInfos = [];
5955
- for (const [index, plugin] of plugins.entries()) if ("_parallel" in plugin) {
5956
- const { fileUrl, options } = plugin._parallel;
5957
- pluginInfos.push({
5958
- index,
5959
- fileUrl,
5960
- options
5961
- });
5979
+ for (const [index, plugin] of plugins.entries()) {
5980
+ const parallel = getParallelPluginInfo(plugin);
5981
+ if (parallel) {
5982
+ const { fileUrl, options } = parallel;
5983
+ pluginInfos.push({
5984
+ index,
5985
+ fileUrl,
5986
+ options
5987
+ });
5988
+ }
5962
5989
  }
5963
5990
  if (pluginInfos.length <= 0) return;
5964
5991
  const count = availableParallelism();
@@ -6038,108 +6065,8 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
6038
6065
  throw e2;
6039
6066
  }
6040
6067
  }
6041
- Symbol.asyncDispose ??= /* @__PURE__ */ Symbol("Symbol.asyncDispose");
6042
- var RolldownBuild = class RolldownBuild2 {
6043
- #inputOptions;
6044
- #bundler;
6045
- #stopWorkers;
6046
- /** @internal */
6047
- static asyncRuntimeShutdown = false;
6048
- /** @hidden should not be used directly */
6049
- constructor(inputOptions) {
6050
- this.#inputOptions = inputOptions;
6051
- this.#bundler = new import_binding4.BindingBundler();
6052
- }
6053
- /**
6054
- * Whether the bundle has been closed.
6055
- *
6056
- * If the bundle is closed, calling other methods will throw an error.
6057
- */
6058
- get closed() {
6059
- return this.#bundler.closed;
6060
- }
6061
- /**
6062
- * Generate bundles in-memory.
6063
- *
6064
- * If you directly want to write bundles to disk, use the {@linkcode write} method instead.
6065
- *
6066
- * @param outputOptions The output options.
6067
- * @returns The generated bundle.
6068
- * @throws {@linkcode BundleError} When an error occurs during the build.
6069
- */
6070
- async generate(outputOptions = {}) {
6071
- return this.#build(false, outputOptions);
6072
- }
6073
- /**
6074
- * Generate and write bundles to disk.
6075
- *
6076
- * If you want to generate bundles in-memory, use the {@linkcode generate} method instead.
6077
- *
6078
- * @param outputOptions The output options.
6079
- * @returns The generated bundle.
6080
- * @throws {@linkcode BundleError} When an error occurs during the build.
6081
- */
6082
- async write(outputOptions = {}) {
6083
- return this.#build(true, outputOptions);
6084
- }
6085
- /**
6086
- * Close the bundle and free resources.
6087
- *
6088
- * This method should be called even if the {@linkcode generate} method
6089
- * or the {@linkcode write} method threw an error. It should be called
6090
- * even if neither of the methods are called.
6091
- *
6092
- * This method is called automatically when using `using` syntax.
6093
- *
6094
- * @example
6095
- * ```js
6096
- * import { rolldown } from 'rolldown';
6097
- *
6098
- * {
6099
- * using bundle = await rolldown({ input: 'src/main.js' });
6100
- * const output = await bundle.generate({ format: 'esm' });
6101
- * console.log(output);
6102
- * // bundle.close() is called automatically here
6103
- * }
6104
- * ```
6105
- */
6106
- async close() {
6107
- await this.#stopWorkers?.();
6108
- await this.#bundler.close();
6109
- (0, import_binding4.shutdownAsyncRuntime)();
6110
- RolldownBuild2.asyncRuntimeShutdown = true;
6111
- this.#stopWorkers = void 0;
6112
- }
6113
- /** @hidden documented in close method */
6114
- async [Symbol.asyncDispose]() {
6115
- await this.close();
6116
- }
6117
- /**
6118
- * @experimental
6119
- * @hidden not ready for public usage yet
6120
- */
6121
- get watchFiles() {
6122
- return Promise.resolve(this.#bundler.getWatchFiles());
6123
- }
6124
- async #build(isWrite, outputOptions) {
6125
- validateOption("output", outputOptions);
6126
- await this.#stopWorkers?.();
6127
- const option = await createBundlerOptions(this.#inputOptions, outputOptions, false);
6128
- if (RolldownBuild2.asyncRuntimeShutdown) (0, import_binding4.startAsyncRuntime)();
6129
- try {
6130
- this.#stopWorkers = option.stopWorkers;
6131
- let output;
6132
- if (isWrite) output = await this.#bundler.write(option.bundlerOptions);
6133
- else output = await this.#bundler.generate(option.bundlerOptions);
6134
- return new RolldownOutputImpl(unwrapBindingResult(output));
6135
- } catch (e2) {
6136
- await option.stopWorkers?.();
6137
- throw e2;
6138
- }
6139
- }
6140
- };
6141
6068
 
6142
- // node_modules/.pnpm/rolldown@1.1.3/node_modules/rolldown/dist/shared/watch-FrHSqg24.mjs
6069
+ // node_modules/.pnpm/rolldown@1.2.1/node_modules/rolldown/dist/shared/watch-Cwq-cFUy.mjs
6143
6070
  var signals = [];
6144
6071
  signals.push("SIGHUP", "SIGINT", "SIGTERM");
6145
6072
  if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
@@ -6372,7 +6299,6 @@ function createEventCallback(emitter) {
6372
6299
  break;
6373
6300
  case "close":
6374
6301
  await emitter.emit("close");
6375
- break;
6376
6302
  }
6377
6303
  };
6378
6304
  }
@@ -6385,6 +6311,7 @@ var Watcher = class {
6385
6311
  this.closed = false;
6386
6312
  this.inner = inner;
6387
6313
  this.emitter = emitter;
6314
+ (0, import_binding5.startAsyncRuntime)();
6388
6315
  const originClose = emitter.close.bind(emitter);
6389
6316
  emitter.close = async () => {
6390
6317
  await this.close();
@@ -6396,9 +6323,12 @@ var Watcher = class {
6396
6323
  async close() {
6397
6324
  if (this.closed) return;
6398
6325
  this.closed = true;
6399
- for (const stop of this.stopWorkers) await stop?.();
6400
- await this.inner.close();
6401
- (0, import_binding5.shutdownAsyncRuntime)();
6326
+ try {
6327
+ for (const stop of this.stopWorkers) await stop?.();
6328
+ await this.inner.close();
6329
+ } finally {
6330
+ (0, import_binding5.shutdownAsyncRuntime)();
6331
+ }
6402
6332
  }
6403
6333
  async run() {
6404
6334
  await this.inner.run();
@@ -6408,7 +6338,8 @@ var Watcher = class {
6408
6338
  async function createWatcher(emitter, input) {
6409
6339
  const options = arraify(input);
6410
6340
  const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
6411
- return createBundlerOptions(await PluginDriver.callOptionsHook(option, true), output, true);
6341
+ const inputOptions = await PluginDriver.callOptionsHook(option, true);
6342
+ return createBundlerOptions(inputOptions, output, true);
6412
6343
  })).flat());
6413
6344
  warnMultiplePollingOptions(bundlerOptions);
6414
6345
  const callback = createEventCallback(emitter);
@@ -6434,26 +6365,153 @@ function watch(input) {
6434
6365
  return emitter;
6435
6366
  }
6436
6367
 
6437
- // node_modules/.pnpm/rolldown@1.1.3/node_modules/rolldown/dist/shared/rolldown-Brph2NSU.mjs
6368
+ // node_modules/.pnpm/rolldown@1.2.1/node_modules/rolldown/dist/shared/rolldown-DP_p9pd3.mjs
6369
+ var import_binding6 = /* @__PURE__ */ __toESM(require_binding(), 1);
6370
+ var RolldownOutputImpl = class extends PlainObjectLike {
6371
+ bindingOutputs;
6372
+ constructor(bindingOutputs) {
6373
+ super();
6374
+ this.bindingOutputs = bindingOutputs;
6375
+ }
6376
+ get output() {
6377
+ return transformToRollupOutput(this.bindingOutputs).output;
6378
+ }
6379
+ __rolldown_external_memory_handle__(keepDataAlive) {
6380
+ const results = this.output.map((item) => item.__rolldown_external_memory_handle__(keepDataAlive));
6381
+ if (!results.every((r2) => r2.freed)) {
6382
+ const reasons = results.filter((r2) => !r2.freed).map((r2) => r2.reason).filter(Boolean);
6383
+ return {
6384
+ freed: false,
6385
+ reason: `Failed to free ${reasons.length} item(s): ${reasons.join("; ")}`
6386
+ };
6387
+ }
6388
+ return { freed: true };
6389
+ }
6390
+ };
6391
+ __decorate([lazyProp], RolldownOutputImpl.prototype, "output", null);
6392
+ Symbol.asyncDispose ??= /* @__PURE__ */ Symbol("Symbol.asyncDispose");
6393
+ var RolldownBuild = class {
6394
+ #inputOptions;
6395
+ #bundler;
6396
+ #stopWorkers;
6397
+ #asyncRuntimeReleased = false;
6398
+ /** @hidden should not be used directly */
6399
+ constructor(inputOptions) {
6400
+ this.#inputOptions = inputOptions;
6401
+ this.#bundler = new import_binding6.BindingBundler();
6402
+ (0, import_binding6.startAsyncRuntime)();
6403
+ }
6404
+ /**
6405
+ * Whether the bundle has been closed.
6406
+ *
6407
+ * If the bundle is closed, calling other methods will throw an error.
6408
+ */
6409
+ get closed() {
6410
+ return this.#bundler.closed;
6411
+ }
6412
+ /**
6413
+ * Generate bundles in-memory.
6414
+ *
6415
+ * If you directly want to write bundles to disk, use the {@linkcode write} method instead.
6416
+ *
6417
+ * @param outputOptions The output options.
6418
+ * @returns The generated bundle.
6419
+ * @throws {@linkcode BundleError} When an error occurs during the build.
6420
+ */
6421
+ async generate(outputOptions = {}) {
6422
+ return this.#build(false, outputOptions);
6423
+ }
6424
+ /**
6425
+ * Generate and write bundles to disk.
6426
+ *
6427
+ * If you want to generate bundles in-memory, use the {@linkcode generate} method instead.
6428
+ *
6429
+ * @param outputOptions The output options.
6430
+ * @returns The generated bundle.
6431
+ * @throws {@linkcode BundleError} When an error occurs during the build.
6432
+ */
6433
+ async write(outputOptions = {}) {
6434
+ return this.#build(true, outputOptions);
6435
+ }
6436
+ /**
6437
+ * Close the bundle and free resources.
6438
+ *
6439
+ * This method should be called even if the {@linkcode generate} method
6440
+ * or the {@linkcode write} method threw an error. It should be called
6441
+ * even if neither of the methods are called.
6442
+ *
6443
+ * This method is called automatically when using `using` syntax.
6444
+ *
6445
+ * @example
6446
+ * ```js
6447
+ * import { rolldown } from 'rolldown';
6448
+ *
6449
+ * {
6450
+ * using bundle = await rolldown({ input: 'src/main.js' });
6451
+ * const output = await bundle.generate({ format: 'esm' });
6452
+ * console.log(output);
6453
+ * // bundle.close() is called automatically here
6454
+ * }
6455
+ * ```
6456
+ */
6457
+ async close() {
6458
+ const shouldRelease = !this.#asyncRuntimeReleased;
6459
+ this.#asyncRuntimeReleased = true;
6460
+ try {
6461
+ await this.#stopWorkers?.();
6462
+ await this.#bundler.close();
6463
+ this.#stopWorkers = void 0;
6464
+ } finally {
6465
+ if (shouldRelease) (0, import_binding6.shutdownAsyncRuntime)();
6466
+ }
6467
+ }
6468
+ /** @hidden documented in close method */
6469
+ async [Symbol.asyncDispose]() {
6470
+ await this.close();
6471
+ }
6472
+ /**
6473
+ * @experimental
6474
+ * @hidden not ready for public usage yet
6475
+ */
6476
+ get watchFiles() {
6477
+ return Promise.resolve(this.#bundler.getWatchFiles());
6478
+ }
6479
+ async #build(isWrite, outputOptions) {
6480
+ validateOption("output", outputOptions);
6481
+ await this.#stopWorkers?.();
6482
+ const option = await createBundlerOptions(this.#inputOptions, outputOptions, false);
6483
+ try {
6484
+ this.#stopWorkers = option.stopWorkers;
6485
+ let output;
6486
+ if (isWrite) output = await this.#bundler.write(option.bundlerOptions);
6487
+ else output = await this.#bundler.generate(option.bundlerOptions);
6488
+ return new RolldownOutputImpl(unwrapBindingResult(output));
6489
+ } catch (e2) {
6490
+ await option.stopWorkers?.();
6491
+ throw e2;
6492
+ }
6493
+ }
6494
+ };
6438
6495
  var rolldown = async (input) => {
6439
6496
  validateOption("input", input);
6440
6497
  return new RolldownBuild(await PluginDriver.callOptionsHook(input));
6441
6498
  };
6442
6499
 
6443
- // node_modules/.pnpm/rolldown@1.1.3/node_modules/rolldown/dist/shared/define-config-Demdg3_4.mjs
6500
+ // node_modules/.pnpm/rolldown@1.2.1/node_modules/rolldown/dist/shared/define-config-Demdg3_4.mjs
6444
6501
  function defineConfig(config) {
6445
6502
  return config;
6446
6503
  }
6447
6504
 
6448
- // node_modules/.pnpm/rolldown@1.1.3/node_modules/rolldown/dist/index.mjs
6505
+ // node_modules/.pnpm/rolldown@1.2.1/node_modules/rolldown/dist/index.mjs
6449
6506
  import { isMainThread } from "node:worker_threads";
6450
- var import_binding6 = /* @__PURE__ */ __toESM(require_binding(), 1);
6507
+ var import_binding7 = /* @__PURE__ */ __toESM(require_binding(), 1);
6451
6508
  if (isMainThread) {
6452
- const subscriberGuard = (0, import_binding6.initTraceSubscriber)();
6509
+ const subscriberGuard = (0, import_binding7.initTraceSubscriber)();
6453
6510
  onExit(() => {
6454
6511
  subscriberGuard?.close();
6455
6512
  });
6456
6513
  }
6514
+ var RUNTIME_MODULE_ID = "\0rolldown/runtime.js";
6457
6515
  async function build(options) {
6458
6516
  if (Array.isArray(options)) return Promise.all(options.map((opts) => build(opts)));
6459
6517
  else {