@introspection-ai/recipes 0.61.1 → 0.63.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 (118) hide show
  1. package/dist/mcp-chunks/{auth-command-WE7QY6RH.js → auth-command-ENP2QQ5Z.js} +67 -27
  2. package/dist/mcp-chunks/call-arguments-Z5REZUAX.js +16 -0
  3. package/dist/mcp-chunks/{call-command-OOBUGVTM.js → call-command-LOWTMLJD.js} +59 -43
  4. package/dist/mcp-chunks/{chunk-32UZRZIL.js → chunk-27PQUO34.js} +1 -1
  5. package/dist/mcp-chunks/{chunk-NJR33E7V.js → chunk-2OSM5WUI.js} +4 -4
  6. package/dist/mcp-chunks/{chunk-BI6L3SYV.js → chunk-33P3PYCH.js} +28 -20
  7. package/dist/mcp-chunks/{chunk-2PTK6KBV.js → chunk-3MELXKB4.js} +12 -9
  8. package/dist/mcp-chunks/{chunk-Z5XOB522.js → chunk-3P3Z5PKQ.js} +1 -1
  9. package/dist/mcp-chunks/{chunk-ZEMVGFKG.js → chunk-3TZZPKQP.js} +2 -2
  10. package/dist/mcp-chunks/{chunk-73TMUGJL.js → chunk-3UONQ24E.js} +3 -3
  11. package/dist/mcp-chunks/{chunk-W47YAN6W.js → chunk-5AVROWKC.js} +3 -3
  12. package/dist/mcp-chunks/{chunk-SYBDN4SV.js → chunk-6HA2S26Q.js} +5 -5
  13. package/dist/mcp-chunks/{chunk-MG6EVYIM.js → chunk-6IKBK334.js} +13 -13
  14. package/dist/mcp-chunks/{chunk-7SQZWTDU.js → chunk-6VAFZAST.js} +1 -1
  15. package/dist/mcp-chunks/{chunk-2R7UGABC.js → chunk-6WTCG4OR.js} +113 -89
  16. package/dist/mcp-chunks/{chunk-ZJZ53NIB.js → chunk-7JRVQRQ4.js} +10 -7
  17. package/dist/mcp-chunks/{chunk-AIUZOMBB.js → chunk-7LKVFBEL.js} +12 -12
  18. package/dist/mcp-chunks/{chunk-44KI6DPL.js → chunk-ACSE24O5.js} +15 -18
  19. package/dist/mcp-chunks/{chunk-5ZQKSEUN.js → chunk-B6YFFSTP.js} +6 -3
  20. package/dist/mcp-chunks/{chunk-3KSDZBUJ.js → chunk-BA3QLN3P.js} +5 -5
  21. package/dist/mcp-chunks/{chunk-MSPGQEWX.js → chunk-BMOK7SQE.js} +12 -12
  22. package/dist/mcp-chunks/{chunk-H44A4G2O.js → chunk-CPAQ4API.js} +2 -2
  23. package/dist/mcp-chunks/{chunk-Y7JQJ352.js → chunk-CSUDITHP.js} +16 -16
  24. package/dist/mcp-chunks/{chunk-UY2QWZB3.js → chunk-DSBXRWGJ.js} +64 -65
  25. package/dist/mcp-chunks/{chunk-DEYGZRBD.js → chunk-EUT2CVFE.js} +8 -5
  26. package/dist/mcp-chunks/{chunk-HPFIAALB.js → chunk-F4UVQBNV.js} +16 -13
  27. package/dist/mcp-chunks/{chunk-VLJQSE6L.js → chunk-F5XGHRRC.js} +9 -9
  28. package/dist/mcp-chunks/{chunk-YFPPHEDE.js → chunk-FMLYITVD.js} +1 -1
  29. package/dist/mcp-chunks/{chunk-37VJZIFW.js → chunk-FYRRJZPO.js} +8 -8
  30. package/dist/mcp-chunks/{chunk-2R2HWX2E.js → chunk-GJKH5KNE.js} +1 -1
  31. package/dist/mcp-chunks/{chunk-HGEKP2E5.js → chunk-H4TU7J5F.js} +9 -6
  32. package/dist/mcp-chunks/{chunk-4ACA5GWL.js → chunk-IX6HNQSH.js} +1 -1
  33. package/dist/mcp-chunks/{chunk-FJNWUAGR.js → chunk-KKM3M3F7.js} +13 -10
  34. package/dist/mcp-chunks/{chunk-Z43KJRXY.js → chunk-KUP2GHFE.js} +1 -1
  35. package/dist/mcp-chunks/{chunk-CWM4RO33.js → chunk-L3BBHB3E.js} +1 -1
  36. package/dist/mcp-chunks/{chunk-XU4D5QN2.js → chunk-M4RI6BN4.js} +1 -1
  37. package/dist/mcp-chunks/{chunk-EUHXZKP2.js → chunk-N53HQB4G.js} +108 -108
  38. package/dist/mcp-chunks/{chunk-HKMH4N3Z.js → chunk-NAGTWK62.js} +1 -1
  39. package/dist/mcp-chunks/{chunk-ABPXAKP7.js → chunk-OH3HVZE7.js} +40 -32
  40. package/dist/mcp-chunks/{chunk-4SO2DY7F.js → chunk-OHAXEQ22.js} +2 -2
  41. package/dist/mcp-chunks/{chunk-OSK2JGFH.js → chunk-PBYZ5QZW.js} +1 -1
  42. package/dist/mcp-chunks/{chunk-QYR3UKJS.js → chunk-PJH2FNYO.js} +3 -3
  43. package/dist/mcp-chunks/{chunk-FDVES4CU.js → chunk-PJSLJ3YK.js} +2 -2
  44. package/dist/mcp-chunks/{chunk-MW3YO24Q.js → chunk-PPJWHK7M.js} +3 -3
  45. package/dist/mcp-chunks/{chunk-4NABHXDS.js → chunk-QA6AKKCT.js} +11 -8
  46. package/dist/mcp-chunks/{chunk-DL3GVI4M.js → chunk-QDLNI6YU.js} +2 -2
  47. package/dist/mcp-chunks/{chunk-TTVO6RCP.js → chunk-QRC4AH7I.js} +2 -2
  48. package/dist/mcp-chunks/{chunk-Y7UTXETL.js → chunk-QRD3PAVF.js} +1 -1
  49. package/dist/mcp-chunks/{chunk-G5DK4L6M.js → chunk-RAUI7O2B.js} +2 -2
  50. package/dist/mcp-chunks/{chunk-VJ45Y5IO.js → chunk-RF3HIBXO.js} +1 -1
  51. package/dist/mcp-chunks/{chunk-CIQX62WO.js → chunk-RFQCNCWI.js} +2 -2
  52. package/dist/mcp-chunks/{chunk-GQM53HF7.js → chunk-SL74CLNX.js} +1 -1
  53. package/dist/mcp-chunks/{chunk-EVEVCVYR.js → chunk-TAEXC3CS.js} +5 -5
  54. package/dist/mcp-chunks/{chunk-QHD5RXW4.js → chunk-U4NDKPOH.js} +24 -17
  55. package/dist/mcp-chunks/{chunk-CFRA424Y.js → chunk-UP3I6WR3.js} +4 -4
  56. package/dist/mcp-chunks/{chunk-VJ5VDK6D.js → chunk-UZ5WW52A.js} +1 -1
  57. package/dist/mcp-chunks/{chunk-TT3LOCMN.js → chunk-V65N6VX7.js} +2 -2
  58. package/dist/mcp-chunks/{chunk-7KOGD2JK.js → chunk-VKRJV2OQ.js} +2 -2
  59. package/dist/mcp-chunks/{chunk-YGT57XUN.js → chunk-VNQIAJ4I.js} +2 -2
  60. package/dist/mcp-chunks/{chunk-EV3SP7ME.js → chunk-W3HK334E.js} +1 -1
  61. package/dist/mcp-chunks/{chunk-KUJUYFDC.js → chunk-XCAIV2CS.js} +4 -4
  62. package/dist/mcp-chunks/{chunk-TQ5T5VO7.js → chunk-YINZMSAI.js} +2 -2
  63. package/dist/mcp-chunks/{cli-TJFAYJO4.js → cli-QNVUCDJE.js} +70 -70
  64. package/dist/mcp-chunks/client-VL2MU7HF.js +32 -0
  65. package/dist/mcp-chunks/{config-command-YGNK2VVL.js → config-command-NMIYA3HF.js} +31 -31
  66. package/dist/mcp-chunks/daemon-command-SLRKTEMY.js +36 -0
  67. package/dist/mcp-chunks/dist-GMDBFGJD.js +69 -0
  68. package/dist/mcp-chunks/{dist-IFOLXE2R.js → dist-P7P5T6YZ.js} +1362 -1231
  69. package/dist/mcp-chunks/{emit-ts-command-4EVF6CIG.js → emit-ts-command-CH34ZIJL.js} +18 -18
  70. package/dist/mcp-chunks/{generate-cli-runner-UFVSXJVK.js → generate-cli-runner-3X2GEPPY.js} +57 -55
  71. package/dist/mcp-chunks/generated-daemon-runtime-BL7IYY6T.js +32 -0
  72. package/dist/mcp-chunks/{inspect-cli-command-L3JGLLTG.js → inspect-cli-command-JCKHV5GL.js} +16 -13
  73. package/dist/mcp-chunks/{launch-LUKDWKH4.js → launch-YFY4X7YJ.js} +1 -1
  74. package/dist/mcp-chunks/{lifecycle-H57PYAZ5.js → lifecycle-UUTEE5WE.js} +1 -1
  75. package/dist/mcp-chunks/{list-command-QBO4LK5Q.js → list-command-VDZVNILR.js} +36 -36
  76. package/dist/mcp-chunks/{logger-LvdykevT-BQ5B4N5O.js → logger-CpvFcLaq-27JFRZ4G.js} +3 -3
  77. package/dist/mcp-chunks/{output-utils-MB3PEV2M.js → output-utils-SYVU3XAD.js} +3 -3
  78. package/dist/mcp-chunks/{pi-mcp-runtime-OIMIJV5A.js → pi-mcp-runtime-V2OMZAIR.js} +1 -1
  79. package/dist/mcp-chunks/{prompt-DkftHXS7-TE2LNPAM.js → prompt-DkftHXS7-6LABGWLG.js} +1 -1
  80. package/dist/mcp-chunks/{record-command-RYDP3Y2A.js → record-command-U7L3OGJZ.js} +6 -5
  81. package/dist/mcp-chunks/{replay-command-QDJCQ5JU.js → replay-command-4AZZBGXO.js} +7 -6
  82. package/dist/mcp-chunks/{resource-command-RKHHQBFP.js → resource-command-BZZBELBM.js} +14 -11
  83. package/dist/mcp-chunks/{result-utils-ZD5GFX7P.js → result-utils-XNXSDC6N.js} +3 -3
  84. package/dist/mcp-chunks/runtime-OVVVPYHO.js +39 -0
  85. package/dist/mcp-chunks/{runtime-wrapper-AV4JCNRF.js → runtime-wrapper-6BUJRMQL.js} +3 -3
  86. package/dist/mcp-chunks/{serve-command-MRPTK4XX.js → serve-command-ZY3PLYNM.js} +39 -36
  87. package/dist/mcp-chunks/server-6DQUPUFW.js +43 -0
  88. package/dist/mcp-chunks/{timeouts-2SQIDYBE.js → timeouts-EEXKP36K.js} +4 -4
  89. package/dist/mcp-chunks/{vault-command-6JVDCFWU.js → vault-command-PRTY3B4I.js} +5 -5
  90. package/dist/mcp-chunks/{webapi-CI4O7AUX.js → webapi-SSFFKLRR.js} +1 -1
  91. package/dist/mcp-daemon.js +35 -35
  92. package/dist/mcp-run-worker.js +34 -34
  93. package/dist/memory-context.d.ts +16 -0
  94. package/dist/memory-context.d.ts.map +1 -0
  95. package/dist/memory-context.js +100 -0
  96. package/dist/memory-context.js.map +1 -0
  97. package/dist/memory.d.ts +2 -0
  98. package/dist/memory.d.ts.map +1 -1
  99. package/dist/memory.js +13 -0
  100. package/dist/memory.js.map +1 -1
  101. package/dist/pi-extension.d.ts.map +1 -1
  102. package/dist/pi-extension.js +6 -0
  103. package/dist/pi-extension.js.map +1 -1
  104. package/dist/recipe/manifest.generated.d.ts +1 -1
  105. package/dist/recipe/manifest.generated.js +1 -1
  106. package/dist/session.d.ts.map +1 -1
  107. package/dist/session.js +35 -9
  108. package/dist/session.js.map +1 -1
  109. package/docs/host-api.md +26 -13
  110. package/docs/pi-extension.md +41 -10
  111. package/package.json +8 -8
  112. package/dist/mcp-chunks/call-arguments-2ABANGLE.js +0 -16
  113. package/dist/mcp-chunks/client-LDKUW5K5.js +0 -32
  114. package/dist/mcp-chunks/daemon-command-UYAYRHVD.js +0 -36
  115. package/dist/mcp-chunks/dist-5JNZD3JV.js +0 -69
  116. package/dist/mcp-chunks/generated-daemon-runtime-LTH36X2R.js +0 -32
  117. package/dist/mcp-chunks/runtime-F7PP4V25.js +0 -39
  118. package/dist/mcp-chunks/server-2WSYXDII.js +0 -43
@@ -3,10 +3,10 @@ import {
3
3
  __commonJSMin,
4
4
  __require,
5
5
  __toESM
6
- } from "./chunk-EVEVCVYR.js";
6
+ } from "./chunk-TAEXC3CS.js";
7
7
  import "./chunk-LRKZP7DJ.js";
8
8
 
9
- // node_modules/.pnpm/rolldown@1.2.16/node_modules/rolldown/dist/shared/binding-BXYS21Tf.mjs
9
+ // node_modules/.pnpm/rolldown@1.3.2/node_modules/rolldown/dist/shared/binding-CDFeuY-7.mjs
10
10
  var require_webcontainer_fallback = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11
11
  const fs = __require("node:fs");
12
12
  const childProcess = __require("node:child_process");
@@ -89,7 +89,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
89
89
  try {
90
90
  const binding = __require("@rolldown/binding-android-arm64");
91
91
  const bindingPackageVersion = __require("@rolldown/binding-android-arm64/package.json").version;
92
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
92
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
93
93
  return binding;
94
94
  } catch (e) {
95
95
  loadErrors.push(e);
@@ -103,7 +103,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
103
103
  try {
104
104
  const binding = __require("@rolldown/binding-android-arm-eabi");
105
105
  const bindingPackageVersion = __require("@rolldown/binding-android-arm-eabi/package.json").version;
106
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
106
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
107
107
  return binding;
108
108
  } catch (e) {
109
109
  loadErrors.push(e);
@@ -120,7 +120,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
120
120
  try {
121
121
  const binding = __require("@rolldown/binding-win32-x64-gnu");
122
122
  const bindingPackageVersion = __require("@rolldown/binding-win32-x64-gnu/package.json").version;
123
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
123
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
124
124
  return binding;
125
125
  } catch (e) {
126
126
  loadErrors.push(e);
@@ -134,7 +134,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
134
134
  try {
135
135
  const binding = __require("@rolldown/binding-win32-x64-msvc");
136
136
  const bindingPackageVersion = __require("@rolldown/binding-win32-x64-msvc/package.json").version;
137
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
137
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
138
138
  return binding;
139
139
  } catch (e) {
140
140
  loadErrors.push(e);
@@ -149,7 +149,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
149
149
  try {
150
150
  const binding = __require("@rolldown/binding-win32-ia32-msvc");
151
151
  const bindingPackageVersion = __require("@rolldown/binding-win32-ia32-msvc/package.json").version;
152
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
152
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
153
153
  return binding;
154
154
  } catch (e) {
155
155
  loadErrors.push(e);
@@ -163,7 +163,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
163
163
  try {
164
164
  const binding = __require("@rolldown/binding-win32-arm64-msvc");
165
165
  const bindingPackageVersion = __require("@rolldown/binding-win32-arm64-msvc/package.json").version;
166
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
166
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
167
167
  return binding;
168
168
  } catch (e) {
169
169
  loadErrors.push(e);
@@ -178,7 +178,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
178
178
  try {
179
179
  const binding = __require("@rolldown/binding-darwin-universal");
180
180
  const bindingPackageVersion = __require("@rolldown/binding-darwin-universal/package.json").version;
181
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
181
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
182
182
  return binding;
183
183
  } catch (e) {
184
184
  loadErrors.push(e);
@@ -192,7 +192,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
192
192
  try {
193
193
  const binding = __require("@rolldown/binding-darwin-x64");
194
194
  const bindingPackageVersion = __require("@rolldown/binding-darwin-x64/package.json").version;
195
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
195
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
196
196
  return binding;
197
197
  } catch (e) {
198
198
  loadErrors.push(e);
@@ -206,7 +206,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
206
206
  try {
207
207
  const binding = __require("@rolldown/binding-darwin-arm64");
208
208
  const bindingPackageVersion = __require("@rolldown/binding-darwin-arm64/package.json").version;
209
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
209
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
210
210
  return binding;
211
211
  } catch (e) {
212
212
  loadErrors.push(e);
@@ -222,7 +222,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
222
222
  try {
223
223
  const binding = __require("@rolldown/binding-freebsd-x64");
224
224
  const bindingPackageVersion = __require("@rolldown/binding-freebsd-x64/package.json").version;
225
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
225
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
226
226
  return binding;
227
227
  } catch (e) {
228
228
  loadErrors.push(e);
@@ -236,7 +236,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
236
236
  try {
237
237
  const binding = __require("@rolldown/binding-freebsd-arm64");
238
238
  const bindingPackageVersion = __require("@rolldown/binding-freebsd-arm64/package.json").version;
239
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
239
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
240
240
  return binding;
241
241
  } catch (e) {
242
242
  loadErrors.push(e);
@@ -250,7 +250,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
250
250
  try {
251
251
  const binding = __require("@rolldown/binding-freebsd-ppc64");
252
252
  const bindingPackageVersion = __require("@rolldown/binding-freebsd-ppc64/package.json").version;
253
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
253
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
254
254
  return binding;
255
255
  } catch (e) {
256
256
  loadErrors.push(e);
@@ -267,7 +267,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
267
267
  try {
268
268
  const binding = __require("@rolldown/binding-linux-x64-musl");
269
269
  const bindingPackageVersion = __require("@rolldown/binding-linux-x64-musl/package.json").version;
270
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
270
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
271
271
  return binding;
272
272
  } catch (e) {
273
273
  loadErrors.push(e);
@@ -281,7 +281,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
281
281
  try {
282
282
  const binding = __require("@rolldown/binding-linux-x64-gnu");
283
283
  const bindingPackageVersion = __require("@rolldown/binding-linux-x64-gnu/package.json").version;
284
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
284
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
285
285
  return binding;
286
286
  } catch (e) {
287
287
  loadErrors.push(e);
@@ -297,7 +297,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
297
297
  try {
298
298
  const binding = __require("@rolldown/binding-linux-arm64-musl");
299
299
  const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-musl/package.json").version;
300
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
300
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
301
301
  return binding;
302
302
  } catch (e) {
303
303
  loadErrors.push(e);
@@ -311,7 +311,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
311
311
  try {
312
312
  const binding = __require("@rolldown/binding-linux-arm64-gnu");
313
313
  const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-gnu/package.json").version;
314
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
314
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
315
315
  return binding;
316
316
  } catch (e) {
317
317
  loadErrors.push(e);
@@ -327,7 +327,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
327
327
  try {
328
328
  const binding = __require("@rolldown/binding-linux-arm-musleabihf");
329
329
  const bindingPackageVersion = __require("@rolldown/binding-linux-arm-musleabihf/package.json").version;
330
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
330
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
331
331
  return binding;
332
332
  } catch (e) {
333
333
  loadErrors.push(e);
@@ -341,7 +341,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
341
341
  try {
342
342
  const binding = __require("@rolldown/binding-linux-arm-gnueabihf");
343
343
  const bindingPackageVersion = __require("@rolldown/binding-linux-arm-gnueabihf/package.json").version;
344
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
344
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
345
345
  return binding;
346
346
  } catch (e) {
347
347
  loadErrors.push(e);
@@ -357,7 +357,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
357
357
  try {
358
358
  const binding = __require("@rolldown/binding-linux-loong64-musl");
359
359
  const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-musl/package.json").version;
360
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
360
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
361
361
  return binding;
362
362
  } catch (e) {
363
363
  loadErrors.push(e);
@@ -371,7 +371,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
371
371
  try {
372
372
  const binding = __require("@rolldown/binding-linux-loong64-gnu");
373
373
  const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-gnu/package.json").version;
374
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
374
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
375
375
  return binding;
376
376
  } catch (e) {
377
377
  loadErrors.push(e);
@@ -387,7 +387,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
387
387
  try {
388
388
  const binding = __require("@rolldown/binding-linux-riscv64-musl");
389
389
  const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-musl/package.json").version;
390
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
390
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
391
391
  return binding;
392
392
  } catch (e) {
393
393
  loadErrors.push(e);
@@ -401,7 +401,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
401
401
  try {
402
402
  const binding = __require("@rolldown/binding-linux-riscv64-gnu");
403
403
  const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-gnu/package.json").version;
404
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
404
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
405
405
  return binding;
406
406
  } catch (e) {
407
407
  loadErrors.push(e);
@@ -416,7 +416,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
416
416
  try {
417
417
  const binding = __require("@rolldown/binding-linux-ppc64-gnu");
418
418
  const bindingPackageVersion = __require("@rolldown/binding-linux-ppc64-gnu/package.json").version;
419
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
419
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
420
420
  return binding;
421
421
  } catch (e) {
422
422
  loadErrors.push(e);
@@ -430,7 +430,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
430
430
  try {
431
431
  const binding = __require("@rolldown/binding-linux-s390x-gnu");
432
432
  const bindingPackageVersion = __require("@rolldown/binding-linux-s390x-gnu/package.json").version;
433
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
433
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
434
434
  return binding;
435
435
  } catch (e) {
436
436
  loadErrors.push(e);
@@ -446,7 +446,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
446
446
  try {
447
447
  const binding = __require("@rolldown/binding-openharmony-arm64");
448
448
  const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm64/package.json").version;
449
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
449
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
450
450
  return binding;
451
451
  } catch (e) {
452
452
  loadErrors.push(e);
@@ -460,7 +460,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
460
460
  try {
461
461
  const binding = __require("@rolldown/binding-openharmony-x64");
462
462
  const bindingPackageVersion = __require("@rolldown/binding-openharmony-x64/package.json").version;
463
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
463
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
464
464
  return binding;
465
465
  } catch (e) {
466
466
  loadErrors.push(e);
@@ -474,7 +474,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
474
474
  try {
475
475
  const binding = __require("@rolldown/binding-openharmony-arm");
476
476
  const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm/package.json").version;
477
- if (bindingPackageVersion !== "1.2.16" && 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.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
477
+ if (bindingPackageVersion !== "1.3.2" && 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.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
478
478
  return binding;
479
479
  } catch (e) {
480
480
  loadErrors.push(e);
@@ -568,7 +568,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
568
568
  if (!candidateFailed) {
569
569
  if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
570
570
  const bindingPackageVersion = __require("@rolldown/binding-wasm32-wasi/package.json").version;
571
- if (bindingPackageVersion !== "1.2.16") throw new Error(`WASI binding package version mismatch, expected 1.2.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
571
+ if (bindingPackageVersion !== "1.3.2") throw new Error(`WASI binding package version mismatch, expected 1.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
572
572
  }
573
573
  wasiBinding = __require("@rolldown/binding-wasm32-wasi");
574
574
  nativeBinding = wasiBinding;
@@ -703,9 +703,32 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
703
703
  module.exports.resolveTsconfig = nativeBinding.resolveTsconfig;
704
704
  module.exports.shutdownAsyncRuntime = nativeBinding.shutdownAsyncRuntime;
705
705
  module.exports.startAsyncRuntime = nativeBinding.startAsyncRuntime;
706
+ module.exports.Watcher = nativeBinding.Watcher;
706
707
  }));
707
708
 
708
- // node_modules/.pnpm/rolldown@1.2.16/node_modules/rolldown/dist/shared/logs-DyTyzzWG.mjs
709
+ // node_modules/.pnpm/rolldown@1.3.2/node_modules/rolldown/dist/shared/misc-BaVlOYH0.mjs
710
+ function arraify(value) {
711
+ return Array.isArray(value) ? value : [value];
712
+ }
713
+ function unimplemented(info) {
714
+ if (info) throw new Error(`unimplemented: ${info}`);
715
+ throw new Error("unimplemented");
716
+ }
717
+ function unreachable(info) {
718
+ if (info) throw new Error(`unreachable: ${info}`);
719
+ throw new Error("unreachable");
720
+ }
721
+ function unsupported(info) {
722
+ throw new Error(`UNSUPPORTED: ${info}`);
723
+ }
724
+ function noop(..._args) {
725
+ }
726
+ var ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Za-z]:)?[/\\|])/;
727
+ function isPathFragment(name) {
728
+ return name[0] === "/" || name[0] === "." && (name[1] === "/" || name[1] === ".") || ABSOLUTE_PATH_REGEX.test(name);
729
+ }
730
+
731
+ // node_modules/.pnpm/rolldown@1.3.2/node_modules/rolldown/dist/shared/logs-BphcrOCD.mjs
709
732
  function spaces(index) {
710
733
  let result = "";
711
734
  while (index--) result += " ";
@@ -784,7 +807,6 @@ var INVALID_LOG_POSITION = "INVALID_LOG_POSITION";
784
807
  var PLUGIN_ERROR = "PLUGIN_ERROR";
785
808
  var INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN";
786
809
  var CYCLE_LOADING = "CYCLE_LOADING";
787
- var MULTIPLE_WATCHER_OPTION = "MULTIPLE_WATCHER_OPTION";
788
810
  var MISSING_CODE_SPLITTING_GROUP_DEBUG_NAME = "MISSING_CODE_SPLITTING_GROUP_DEBUG_NAME";
789
811
  var PARSE_ERROR = "PARSE_ERROR";
790
812
  var VALIDATION_ERROR = "VALIDATION_ERROR";
@@ -820,12 +842,6 @@ function logCycleLoading(pluginName, moduleId) {
820
842
  message: `Found the module "${moduleId}" cycle loading at ${pluginName} plugin, it maybe blocking fetching modules.`
821
843
  };
822
844
  }
823
- function logMultipleWatcherOption() {
824
- return {
825
- code: MULTIPLE_WATCHER_OPTION,
826
- message: `Found multiple watcher options at watch options, using first one to start watcher.`
827
- };
828
- }
829
845
  function logMissingCodeSplittingGroupDebugName(groupPath) {
830
846
  return {
831
847
  code: MISSING_CODE_SPLITTING_GROUP_DEBUG_NAME,
@@ -880,7 +896,7 @@ function augmentCodeLocation(properties, pos, source, id2) {
880
896
  }
881
897
  }
882
898
 
883
- // node_modules/.pnpm/rolldown@1.2.16/node_modules/rolldown/dist/shared/normalize-string-or-regex-B8U5_Ikr.mjs
899
+ // node_modules/.pnpm/rolldown@1.3.2/node_modules/rolldown/dist/shared/normalize-string-or-regex-zJCHXVJD.mjs
884
900
  var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
885
901
  var BuiltinPlugin = class {
886
902
  name;
@@ -919,29 +935,10 @@ function isReadonlyArray(input) {
919
935
  return Array.isArray(input);
920
936
  }
921
937
 
922
- // node_modules/.pnpm/rolldown@1.2.16/node_modules/rolldown/dist/shared/misc-BaVlOYH0.mjs
923
- function arraify(value) {
924
- return Array.isArray(value) ? value : [value];
925
- }
926
- function unimplemented(info) {
927
- if (info) throw new Error(`unimplemented: ${info}`);
928
- throw new Error("unimplemented");
929
- }
930
- function unreachable(info) {
931
- if (info) throw new Error(`unreachable: ${info}`);
932
- throw new Error("unreachable");
933
- }
934
- function unsupported(info) {
935
- throw new Error(`UNSUPPORTED: ${info}`);
936
- }
937
- function noop(..._args) {
938
- }
939
- var ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Za-z]:)?[/\\|])/;
940
- function isPathFragment(name) {
941
- return name[0] === "/" || name[0] === "." && (name[1] === "/" || name[1] === ".") || ABSOLUTE_PATH_REGEX.test(name);
942
- }
938
+ // node_modules/.pnpm/rolldown@1.3.2/node_modules/rolldown/dist/shared/package-DZV6ws3O.mjs
939
+ var version = "1.3.2";
943
940
 
944
- // node_modules/.pnpm/rolldown@1.2.16/node_modules/rolldown/dist/shared/error-BJ9uQLIS.mjs
941
+ // node_modules/.pnpm/rolldown@1.3.2/node_modules/rolldown/dist/shared/error-C18Vb1Fe.mjs
945
942
  function bindingifySourcemap(map) {
946
943
  if (map == null) return;
947
944
  return { inner: typeof map === "string" ? map : {
@@ -956,7 +953,36 @@ function bindingifySourcemap(map) {
956
953
  debugId: "debugId" in map ? map.debugId : void 0
957
954
  } };
958
955
  }
959
- require_binding();
956
+ var ATTRIBUTES_MARKER_LENGTH = 12;
957
+ function stringifyModuleId(rawId, attributes) {
958
+ if (!attributes) return rawId;
959
+ const entries = Object.entries(attributes);
960
+ if (entries.length === 0) return rawId;
961
+ const sorted = Object.fromEntries(entries.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0));
962
+ return `${rawId}${rawId.includes("?") ? "&" : "?"}attributes=${encodeURIComponent(JSON.stringify(sorted))}`;
963
+ }
964
+ function parseModuleId(id2) {
965
+ const markerIndex = Math.max(id2.lastIndexOf("?attributes="), id2.lastIndexOf("&attributes="));
966
+ if (markerIndex !== -1) try {
967
+ const rawId = id2.slice(0, markerIndex);
968
+ const attributes = JSON.parse(decodeURIComponent(id2.slice(markerIndex + ATTRIBUTES_MARKER_LENGTH)));
969
+ if (typeof attributes === "object" && attributes !== null && Object.values(attributes).every((value) => typeof value === "string") && stringifyModuleId(rawId, attributes) === id2) return {
970
+ rawId,
971
+ attributes
972
+ };
973
+ } catch {
974
+ }
975
+ return {
976
+ rawId: id2,
977
+ attributes: {}
978
+ };
979
+ }
980
+ function normalizeUniqueModuleId(id2) {
981
+ return typeof id2 === "object" ? {
982
+ rawId: id2.rawId,
983
+ attributes: id2.attributes ?? {}
984
+ } : parseModuleId(id2);
985
+ }
960
986
  function unwrapBindingResult(container) {
961
987
  if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
962
988
  return container;
@@ -967,6 +993,8 @@ function normalizeBindingError(e) {
967
993
  kind: e.field0.kind,
968
994
  message: e.field0.message,
969
995
  id: e.field0.id,
996
+ plugin: e.field0.plugin,
997
+ frame: e.field0.frame,
970
998
  exporter: e.field0.exporter,
971
999
  loc: e.field0.loc,
972
1000
  pos: e.field0.pos,
@@ -1001,6 +1029,7 @@ function aggregateBindingErrorsIntoJsError(rawErrors) {
1001
1029
  return wrapper;
1002
1030
  }
1003
1031
  function getErrorMessage(e) {
1032
+ if (e === null || e === void 0) return `Error: ${String(e)}`;
1004
1033
  if (Object.hasOwn(e, "kind")) return e.message;
1005
1034
  let s = "";
1006
1035
  if (e.plugin) s += `[plugin ${e.plugin}]`;
@@ -1024,7 +1053,7 @@ function joinNewLine(s1, s2) {
1024
1053
  return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
1025
1054
  }
1026
1055
 
1027
- // node_modules/.pnpm/rolldown@1.2.16/node_modules/rolldown/dist/shared/parse-Bgfg7ZwM.mjs
1056
+ // node_modules/.pnpm/rolldown@1.3.2/node_modules/rolldown/dist/shared/parse-mqMVQ3Dc.mjs
1028
1057
  var import_binding2 = /* @__PURE__ */ __toESM(require_binding(), 1);
1029
1058
  function wrap(result) {
1030
1059
  let program, module, comments, errors;
@@ -1065,7 +1094,7 @@ function parseSync(filename, sourceText, options) {
1065
1094
  return wrap((0, import_binding2.parseSync)(filename, sourceText, options));
1066
1095
  }
1067
1096
 
1068
- // node_modules/.pnpm/rolldown@1.2.16/node_modules/rolldown/dist/parse-ast-index.mjs
1097
+ // node_modules/.pnpm/rolldown@1.3.2/node_modules/rolldown/dist/parse-ast-index.mjs
1069
1098
  function wrap2(result, filename, sourceText) {
1070
1099
  if (result.errors.length > 0) return normalizeParseError(filename, sourceText, result.errors);
1071
1100
  return result.program;
@@ -1101,10 +1130,10 @@ function parseAst(sourceText, options, filename) {
1101
1130
  }), filename, sourceText);
1102
1131
  }
1103
1132
 
1104
- // node_modules/.pnpm/rolldown@1.2.16/node_modules/rolldown/dist/shared/bindingify-input-options-CM8bmcLg.mjs
1133
+ // node_modules/.pnpm/rolldown@1.3.2/node_modules/rolldown/dist/shared/bindingify-input-options-Fc_YrR7y.mjs
1105
1134
  import path from "node:path";
1106
1135
 
1107
- // node_modules/.pnpm/@rolldown+pluginutils@1.1.0/node_modules/@rolldown/pluginutils/dist/filter-p20yeu4b.mjs
1136
+ // node_modules/.pnpm/@rolldown+pluginutils@1.1.1/node_modules/@rolldown/pluginutils/dist/filter-DvHMSB82.mjs
1108
1137
  var And = class {
1109
1138
  kind;
1110
1139
  args;
@@ -1187,9 +1216,8 @@ function exclude(expr) {
1187
1216
  return new Exclude(expr);
1188
1217
  }
1189
1218
 
1190
- // node_modules/.pnpm/rolldown@1.2.16/node_modules/rolldown/dist/shared/bindingify-input-options-CM8bmcLg.mjs
1219
+ // node_modules/.pnpm/rolldown@1.3.2/node_modules/rolldown/dist/shared/bindingify-input-options-Fc_YrR7y.mjs
1191
1220
  import fsp from "node:fs/promises";
1192
- var version = "1.2.16";
1193
1221
  var VERSION = version;
1194
1222
  var LOG_LEVEL_SILENT = "silent";
1195
1223
  var LOG_LEVEL_WARN = "warn";
@@ -1363,42 +1391,56 @@ function transformToRenderedModule(bindingRenderedModule) {
1363
1391
  }
1364
1392
  };
1365
1393
  }
1394
+ var RenderedChunkImpl = class extends PlainObjectLike {
1395
+ type = "chunk";
1396
+ #chunk;
1397
+ constructor(chunk) {
1398
+ super();
1399
+ this.#chunk = chunk;
1400
+ }
1401
+ get name() {
1402
+ return this.#chunk.name;
1403
+ }
1404
+ get isEntry() {
1405
+ return this.#chunk.isEntry;
1406
+ }
1407
+ get isDynamicEntry() {
1408
+ return this.#chunk.isDynamicEntry;
1409
+ }
1410
+ get facadeModuleId() {
1411
+ return this.#chunk.facadeModuleId;
1412
+ }
1413
+ get moduleIds() {
1414
+ return this.#chunk.moduleIds;
1415
+ }
1416
+ get exports() {
1417
+ return this.#chunk.exports;
1418
+ }
1419
+ get fileName() {
1420
+ return this.#chunk.fileName;
1421
+ }
1422
+ get imports() {
1423
+ return this.#chunk.imports;
1424
+ }
1425
+ get dynamicImports() {
1426
+ return this.#chunk.dynamicImports;
1427
+ }
1428
+ get modules() {
1429
+ return transformChunkModules(this.#chunk.modules);
1430
+ }
1431
+ };
1432
+ __decorate([lazyProp], RenderedChunkImpl.prototype, "name", null);
1433
+ __decorate([lazyProp], RenderedChunkImpl.prototype, "isEntry", null);
1434
+ __decorate([lazyProp], RenderedChunkImpl.prototype, "isDynamicEntry", null);
1435
+ __decorate([lazyProp], RenderedChunkImpl.prototype, "facadeModuleId", null);
1436
+ __decorate([lazyProp], RenderedChunkImpl.prototype, "moduleIds", null);
1437
+ __decorate([lazyProp], RenderedChunkImpl.prototype, "exports", null);
1438
+ __decorate([lazyProp], RenderedChunkImpl.prototype, "fileName", null);
1439
+ __decorate([lazyProp], RenderedChunkImpl.prototype, "imports", null);
1440
+ __decorate([lazyProp], RenderedChunkImpl.prototype, "dynamicImports", null);
1441
+ __decorate([lazyProp], RenderedChunkImpl.prototype, "modules", null);
1366
1442
  function transformRenderedChunk(chunk) {
1367
- let modules = null;
1368
- return {
1369
- type: "chunk",
1370
- get name() {
1371
- return chunk.name;
1372
- },
1373
- get isEntry() {
1374
- return chunk.isEntry;
1375
- },
1376
- get isDynamicEntry() {
1377
- return chunk.isDynamicEntry;
1378
- },
1379
- get facadeModuleId() {
1380
- return chunk.facadeModuleId;
1381
- },
1382
- get moduleIds() {
1383
- return chunk.moduleIds;
1384
- },
1385
- get exports() {
1386
- return chunk.exports;
1387
- },
1388
- get fileName() {
1389
- return chunk.fileName;
1390
- },
1391
- get imports() {
1392
- return chunk.imports;
1393
- },
1394
- get dynamicImports() {
1395
- return chunk.dynamicImports;
1396
- },
1397
- get modules() {
1398
- if (!modules) modules = transformChunkModules(chunk.modules);
1399
- return modules;
1400
- }
1401
- };
1443
+ return new RenderedChunkImpl(chunk);
1402
1444
  }
1403
1445
  function transformChunkModules(modules) {
1404
1446
  const result = {};
@@ -1488,7 +1530,15 @@ function transformToRollupSourceMap(map) {
1488
1530
  return JSON.stringify(obj);
1489
1531
  },
1490
1532
  toUrl() {
1491
- return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
1533
+ const json = obj.toString();
1534
+ let base64;
1535
+ if (typeof Buffer === "function") base64 = Buffer.from(json, "utf-8").toString("base64");
1536
+ else {
1537
+ const bytes = new TextEncoder().encode(json);
1538
+ base64 = "";
1539
+ for (let i = 0; i < bytes.length; i += 32766) base64 += btoa(String.fromCharCode(...bytes.subarray(i, i + 32766)));
1540
+ }
1541
+ return `data:application/json;charset=utf-8;base64,${base64}`;
1492
1542
  }
1493
1543
  };
1494
1544
  Object.defineProperty(obj, "x_google_ignoreList", {
@@ -1545,6 +1595,7 @@ function transformToMutableRollupOutputChunk(bindingChunk, changed, codeCache) {
1545
1595
  preliminaryFileName: bindingChunk.getPreliminaryFileName()
1546
1596
  };
1547
1597
  const cache = {};
1598
+ let assigned;
1548
1599
  return new Proxy(chunk, {
1549
1600
  get(target, p) {
1550
1601
  if (p in cache) return cache[p];
@@ -1554,7 +1605,12 @@ function transformToMutableRollupOutputChunk(bindingChunk, changed, codeCache) {
1554
1605
  },
1555
1606
  set(_target, p, newValue) {
1556
1607
  cache[p] = newValue;
1557
- changed.updated.add(bindingChunk.getFileName());
1608
+ if (!assigned) {
1609
+ const names = /* @__PURE__ */ new Set();
1610
+ assigned = names;
1611
+ changed.updated.set(fileName, () => collectChunkChange(bindingChunk, chunk, cache, names));
1612
+ }
1613
+ assigned.add(p);
1558
1614
  return true;
1559
1615
  },
1560
1616
  has(target, p) {
@@ -1563,6 +1619,41 @@ function transformToMutableRollupOutputChunk(bindingChunk, changed, codeCache) {
1563
1619
  }
1564
1620
  });
1565
1621
  }
1622
+ function collectChunkChange(bindingChunk, original, cache, assigned) {
1623
+ const change = {
1624
+ filename: "fileName" in cache ? cache.fileName : original.fileName,
1625
+ isEntry: "isEntry" in cache ? cache.isEntry : original.isEntry
1626
+ };
1627
+ let isChanged = change.filename !== original.fileName || change.isEntry !== original.isEntry;
1628
+ if (assigned.has("code")) {
1629
+ if (typeof cache.code !== "string") throw invalidChunkProperty(original.fileName, "code", "a string", cache.code);
1630
+ change.code = cache.code;
1631
+ isChanged = true;
1632
+ }
1633
+ if ("map" in cache) {
1634
+ change.map = cache.map == null ? null : bindingifySourcemap(cache.map);
1635
+ isChanged = true;
1636
+ }
1637
+ if ("imports" in cache && !isSameStrings(cache.imports, bindingChunk.getImports())) {
1638
+ if (!Array.isArray(cache.imports)) throw invalidChunkProperty(original.fileName, "imports", "an array", cache.imports);
1639
+ change.imports = cache.imports;
1640
+ isChanged = true;
1641
+ }
1642
+ if ("dynamicImports" in cache && !isSameStrings(cache.dynamicImports, bindingChunk.getDynamicImports())) {
1643
+ if (!Array.isArray(cache.dynamicImports)) throw invalidChunkProperty(original.fileName, "dynamicImports", "an array", cache.dynamicImports);
1644
+ change.dynamicImports = cache.dynamicImports;
1645
+ isChanged = true;
1646
+ }
1647
+ return isChanged ? change : void 0;
1648
+ }
1649
+ function invalidChunkProperty(fileName, property, expected, value) {
1650
+ return /* @__PURE__ */ new TypeError(`The \`${property}\` property of chunk "${fileName}" must be ${expected}. Received ${value === null ? "null" : typeof value}.`);
1651
+ }
1652
+ function isSameStrings(value, original) {
1653
+ if (!Array.isArray(value) || value.length !== original.length) return false;
1654
+ for (let i = 0; i < original.length; i++) if (value[i] !== original[i]) return false;
1655
+ return true;
1656
+ }
1566
1657
  function transformToRollupOutputAsset(bindingAsset) {
1567
1658
  return new OutputAssetImpl(bindingAsset);
1568
1659
  }
@@ -1588,7 +1679,7 @@ function transformToMutableRollupOutputAsset(bindingAsset, changed) {
1588
1679
  },
1589
1680
  set(_target, p, newValue) {
1590
1681
  cache[p] = newValue;
1591
- changed.updated.add(bindingAsset.getFileName());
1682
+ changed.updated.set(asset.fileName, void 0);
1592
1683
  return true;
1593
1684
  }
1594
1685
  });
@@ -1636,22 +1727,10 @@ function collectChangedBundle(changed, bundle) {
1636
1727
  source: bindingAssetSource(item.source),
1637
1728
  names: item.names
1638
1729
  };
1639
- else changes[key] = {
1640
- code: item.code,
1641
- filename: item.fileName,
1642
- name: item.name,
1643
- isEntry: item.isEntry,
1644
- exports: item.exports,
1645
- modules: {},
1646
- imports: item.imports,
1647
- dynamicImports: item.dynamicImports,
1648
- facadeModuleId: item.facadeModuleId || void 0,
1649
- isDynamicEntry: item.isDynamicEntry,
1650
- moduleIds: item.moduleIds,
1651
- map: bindingifySourcemap(item.map),
1652
- sourcemapFilename: item.sourcemapFileName || void 0,
1653
- preliminaryFilename: item.preliminaryFileName
1654
- };
1730
+ else {
1731
+ const change = changed.updated.get(key)?.();
1732
+ if (change) changes[key] = change;
1733
+ }
1655
1734
  }
1656
1735
  return {
1657
1736
  changes,
@@ -1667,6 +1746,8 @@ var NormalizedInputOptionsImpl = class extends PlainObjectLike {
1667
1746
  this.onLog = onLog;
1668
1747
  this.inputPlugins = inputPlugins;
1669
1748
  this.inner = inner;
1749
+ for (const key of getLazyFields(this)) Reflect.get(this, key);
1750
+ this.inner = null;
1670
1751
  }
1671
1752
  get shimMissingExports() {
1672
1753
  return this.inner.shimMissingExports;
@@ -1701,6 +1782,8 @@ var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
1701
1782
  this.inner = inner;
1702
1783
  this.outputOptions = outputOptions;
1703
1784
  this.normalizedOutputPlugins = normalizedOutputPlugins;
1785
+ for (const key of getLazyFields(this)) Reflect.get(this, key);
1786
+ this.inner = null;
1704
1787
  }
1705
1788
  get dir() {
1706
1789
  return this.inner.dir ?? void 0;
@@ -1920,10 +2003,14 @@ var PluginContextData = class {
1920
2003
  */
1921
2004
  outputCodeCache;
1922
2005
  resolveOptionsMap = /* @__PURE__ */ new Map();
2006
+ /** The next `this.resolve` receipt. See `saveResolveOptions`. */
2007
+ nextResolveOptionsReceipt = 0;
1923
2008
  loadModulePromiseMap = /* @__PURE__ */ new Map();
1924
2009
  renderedChunkMeta = null;
1925
2010
  normalizedInputOptions = null;
1926
2011
  normalizedOutputOptions = null;
2012
+ /** `experimental.importAttributes` */
2013
+ importAttributes = false;
1927
2014
  constructor(onLog, outputOptions, normalizedInputPlugins, normalizedOutputPlugins, cacheOutputCode = true) {
1928
2015
  this.onLog = onLog;
1929
2016
  this.outputOptions = outputOptions;
@@ -1931,7 +2018,22 @@ var PluginContextData = class {
1931
2018
  this.normalizedOutputPlugins = normalizedOutputPlugins;
1932
2019
  this.outputCodeCache = cacheOutputCode ? /* @__PURE__ */ new Map() : null;
1933
2020
  }
2021
+ /**
2022
+ * The module id of `rawId` imported with `attributes`, as JS keys it. Without
2023
+ * `experimental.importAttributes`, it is always `rawId`.
2024
+ */
2025
+ toModuleId(rawId, attributes) {
2026
+ return this.importAttributes ? stringifyModuleId(rawId, attributes) : rawId;
2027
+ }
2028
+ /**
2029
+ * Without `experimental.importAttributes`, plugins see no attributes, so the module options of
2030
+ * an external are keyed by its raw id, even though its module id has the attributes.
2031
+ */
2032
+ moduleOptionKey(id2) {
2033
+ return this.importAttributes ? id2 : parseModuleId(id2).rawId;
2034
+ }
1934
2035
  updateModuleOption(id2, option) {
2036
+ id2 = this.moduleOptionKey(id2);
1935
2037
  const existing = this.moduleOptionMap.get(id2);
1936
2038
  if (existing) {
1937
2039
  if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
@@ -1944,6 +2046,7 @@ var PluginContextData = class {
1944
2046
  return existing;
1945
2047
  }
1946
2048
  getModuleOption(id2) {
2049
+ id2 = this.moduleOptionKey(id2);
1947
2050
  const option = this.moduleOptionMap.get(id2);
1948
2051
  if (!option) {
1949
2052
  const raw = {
@@ -1983,10 +2086,19 @@ var PluginContextData = class {
1983
2086
  getModuleIds(context) {
1984
2087
  return context.getModuleIds().values();
1985
2088
  }
2089
+ /**
2090
+ * Saves the options of one `this.resolve` call and returns its receipt. The receipt goes to Rust
2091
+ * as `BindingPluginContextResolveOptions.custom` (`Option<u32>`), and `bindingifyResolveId`
2092
+ * gets it back and looks the options up when a `resolveId` hook runs. Calls can overlap, so a
2093
+ * receipt must stay unique while its call is in flight. The map size cannot be the receipt: it
2094
+ * shrinks when an earlier call finishes, and the next call would get a live receipt.
2095
+ */
1986
2096
  saveResolveOptions(options) {
1987
- const index = this.resolveOptionsMap.size;
1988
- this.resolveOptionsMap.set(index, options);
1989
- return index;
2097
+ let receipt = this.nextResolveOptionsReceipt;
2098
+ while (this.resolveOptionsMap.has(receipt)) receipt = receipt + 1 >>> 0;
2099
+ this.nextResolveOptionsReceipt = receipt + 1 >>> 0;
2100
+ this.resolveOptionsMap.set(receipt, options);
2101
+ return receipt;
1990
2102
  }
1991
2103
  getSavedResolveOptions(receipt) {
1992
2104
  return this.resolveOptionsMap.get(receipt);
@@ -2086,9 +2198,23 @@ function isEmptySourcemapFiled(array2) {
2086
2198
  if (array2.length === 0 || !array2[0]) return true;
2087
2199
  return false;
2088
2200
  }
2201
+ function copySourcemapObject(map) {
2202
+ return {
2203
+ file: map.file,
2204
+ mappings: map.mappings,
2205
+ names: map.names,
2206
+ sources: map.sources,
2207
+ sourcesContent: map.sourcesContent,
2208
+ sourceRoot: map.sourceRoot,
2209
+ version: map.version,
2210
+ ignoreList: map.ignoreList,
2211
+ x_google_ignoreList: map.x_google_ignoreList,
2212
+ debugId: map.debugId
2213
+ };
2214
+ }
2089
2215
  function normalizeTransformHookSourcemap(id2, originalCode, rawMap) {
2090
2216
  if (!rawMap) return;
2091
- let map = typeof rawMap === "object" ? rawMap : JSON.parse(rawMap);
2217
+ let map = typeof rawMap === "object" ? copySourcemapObject(rawMap) : JSON.parse(rawMap);
2092
2218
  if (isEmptySourcemapFiled(map.sourcesContent)) map.sourcesContent = [originalCode];
2093
2219
  if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id2) map.sources = [id2];
2094
2220
  return map;
@@ -2346,7 +2472,8 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2346
2472
  this.getModuleInfo = (id2) => this.data.getModuleInfo(id2, context);
2347
2473
  }
2348
2474
  async load(options) {
2349
- const id2 = options.id;
2475
+ const { rawId, attributes } = normalizeUniqueModuleId(options.id);
2476
+ const id2 = this.data.toModuleId(rawId, attributes);
2350
2477
  if (id2 === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
2351
2478
  const moduleInfo = this.data.getModuleInfo(id2, this.context);
2352
2479
  if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
@@ -2358,7 +2485,7 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2358
2485
  this.data.updateModuleOption(id2, rawOptions);
2359
2486
  let loadPromise = this.data.loadModulePromiseMap.get(id2);
2360
2487
  if (!loadPromise) {
2361
- loadPromise = this.context.load(id2, options.moduleSideEffects ?? void 0, options.packageJsonPath ?? void 0).catch(() => {
2488
+ loadPromise = this.context.load(rawId, attributes, options.moduleSideEffects ?? void 0, options.packageJsonPath ?? void 0).catch(() => {
2362
2489
  this.data.loadModulePromiseMap.delete(id2);
2363
2490
  });
2364
2491
  this.data.loadModulePromiseMap.set(id2, loadPromise);
@@ -2367,22 +2494,28 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
2367
2494
  return this.data.getModuleInfo(id2, this.context);
2368
2495
  }
2369
2496
  async resolve(source, importer, options) {
2497
+ if (typeof importer === "object" && importer !== null) importer = stringifyModuleId(importer.rawId, importer.attributes);
2370
2498
  let receipt = void 0;
2371
2499
  if (options != null) receipt = this.data.saveResolveOptions(options);
2372
2500
  const vitePluginCustom = Object.entries(options?.custom ?? {}).reduce((acc, [key, value]) => {
2373
2501
  if (key.startsWith("vite:")) (acc ??= {})[key] = value;
2374
2502
  return acc;
2375
2503
  }, void 0);
2376
- const res = await this.context.resolve(source, importer, {
2377
- importKind: options?.kind,
2378
- custom: receipt,
2379
- isEntry: options?.isEntry,
2380
- skipSelf: options?.skipSelf,
2381
- vitePluginCustom
2382
- });
2383
- if (receipt != null) this.data.removeSavedResolveOptions(receipt);
2504
+ let res;
2505
+ try {
2506
+ res = await this.context.resolve(source, importer, {
2507
+ importKind: options?.kind,
2508
+ custom: receipt,
2509
+ isEntry: options?.isEntry,
2510
+ skipSelf: options?.skipSelf,
2511
+ vitePluginCustom,
2512
+ attributes: options?.attributes
2513
+ });
2514
+ } finally {
2515
+ if (receipt != null) this.data.removeSavedResolveOptions(receipt);
2516
+ }
2384
2517
  if (res == null) return null;
2385
- const info = this.data.getModuleOption(res.id) || {};
2518
+ const info = this.data.getModuleOption(this.data.toModuleId(res.id, res.attributes)) || {};
2386
2519
  return {
2387
2520
  ...res,
2388
2521
  external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
@@ -2468,7 +2601,7 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
2468
2601
  this.moduleSource = moduleSource;
2469
2602
  const getLogHandler2 = (handler) => (log, pos) => {
2470
2603
  log = normalizeLog(log);
2471
- if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
2604
+ if (pos != null) augmentCodeLocation(log, pos, moduleSource, moduleId);
2472
2605
  log.id = moduleId;
2473
2606
  log.hook = "transform";
2474
2607
  handler(log);
@@ -2479,7 +2612,7 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
2479
2612
  }
2480
2613
  error(e, pos) {
2481
2614
  if (typeof e === "string") e = { message: e };
2482
- if (pos) augmentCodeLocation(e, pos, this.moduleSource, this.moduleId);
2615
+ if (pos != null) augmentCodeLocation(e, pos, this.moduleSource, this.moduleId);
2483
2616
  e.id = this.moduleId;
2484
2617
  e.hook = "transform";
2485
2618
  return error(logPluginError(normalizeLog(e), this.pluginName));
@@ -2511,7 +2644,10 @@ function bindingifyResolveId(args2) {
2511
2644
  const contextResolveOptions = extraOptions.custom != null ? args2.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
2512
2645
  const ret = await handler.call(createPluginContext(args2, ctx), specifier, importer ?? void 0, {
2513
2646
  ...extraOptions,
2514
- custom: contextResolveOptions?.custom
2647
+ custom: contextResolveOptions?.custom,
2648
+ attributes: extraOptions.attributes ?? {},
2649
+ importerRawId: extraOptions.importerRawId ?? importer ?? void 0,
2650
+ importerAttributes: extraOptions.importerAttributes ?? {}
2515
2651
  });
2516
2652
  if (ret == null) return;
2517
2653
  if (ret === false) return {
@@ -2523,7 +2659,7 @@ function bindingifyResolveId(args2) {
2523
2659
  id: ret,
2524
2660
  normalizeExternalId: false
2525
2661
  };
2526
- let exist = args2.pluginContextData.updateModuleOption(ret.id, {
2662
+ let exist = args2.pluginContextData.updateModuleOption(args2.pluginContextData.toModuleId(ret.id, ret.attributes ?? extraOptions.attributes), {
2527
2663
  meta: ret.meta || {},
2528
2664
  moduleSideEffects: ret.moduleSideEffects ?? null,
2529
2665
  invalidate: false
@@ -2533,15 +2669,21 @@ function bindingifyResolveId(args2) {
2533
2669
  external: ret.external,
2534
2670
  normalizeExternalId: false,
2535
2671
  moduleSideEffects: exist.moduleSideEffects ?? void 0,
2536
- packageJsonPath: ret.packageJsonPath
2672
+ packageJsonPath: ret.packageJsonPath,
2673
+ attributes: ret.attributes
2537
2674
  };
2538
2675
  },
2539
2676
  filter: bindingifyResolveIdFilter(options.filter)
2540
2677
  }));
2541
2678
  }
2542
2679
  function bindingifyResolveDynamicImport(args2) {
2543
- return bindingifyHook(args2.plugin.resolveDynamicImport, ({ handler }) => ({ plugin: async (ctx, specifier, importer) => {
2544
- const ret = await handler.call(createPluginContext(args2, ctx), specifier, importer ?? void 0);
2680
+ return bindingifyHook(args2.plugin.resolveDynamicImport, ({ handler }) => ({ plugin: async (ctx, specifier, importer, extraOptions) => {
2681
+ const attributes = extraOptions.attributes ?? {};
2682
+ const ret = await handler.call(createPluginContext(args2, ctx), specifier, importer ?? void 0, {
2683
+ attributes,
2684
+ importerRawId: extraOptions.importerRawId ?? importer ?? void 0,
2685
+ importerAttributes: extraOptions.importerAttributes ?? {}
2686
+ });
2545
2687
  if (ret == null) return;
2546
2688
  if (ret === false) return {
2547
2689
  id: specifier,
@@ -2551,10 +2693,11 @@ function bindingifyResolveDynamicImport(args2) {
2551
2693
  const result = {
2552
2694
  id: ret.id,
2553
2695
  external: ret.external,
2554
- packageJsonPath: ret.packageJsonPath
2696
+ packageJsonPath: ret.packageJsonPath,
2697
+ attributes: ret.attributes
2555
2698
  };
2556
2699
  if (ret.moduleSideEffects !== null) result.moduleSideEffects = ret.moduleSideEffects;
2557
- args2.pluginContextData.updateModuleOption(ret.id, {
2700
+ args2.pluginContextData.updateModuleOption(args2.pluginContextData.toModuleId(ret.id, ret.attributes ?? attributes), {
2558
2701
  meta: ret.meta || {},
2559
2702
  moduleSideEffects: ret.moduleSideEffects || null,
2560
2703
  invalidate: false
@@ -2564,8 +2707,13 @@ function bindingifyResolveDynamicImport(args2) {
2564
2707
  }
2565
2708
  function bindingifyTransform(args2) {
2566
2709
  return bindingifyHook(args2.plugin.transform, ({ handler, options }) => ({
2567
- plugin: async (ctx, code2, id2, meta) => {
2710
+ plugin: async (ctx, code2, id2, bindingMeta) => {
2568
2711
  let magicStringInstance, astInstance;
2712
+ const meta = {
2713
+ ...bindingMeta,
2714
+ rawId: bindingMeta.rawId ?? id2,
2715
+ attributes: bindingMeta.attributes ?? {}
2716
+ };
2569
2717
  Object.defineProperties(meta, {
2570
2718
  magicString: { get() {
2571
2719
  if (magicStringInstance) return magicStringInstance;
@@ -2605,9 +2753,11 @@ function bindingifyTransform(args2) {
2605
2753
  else if (ret.code instanceof RolldownMagicString) {
2606
2754
  let magicString = ret.code;
2607
2755
  normalizedCode = magicString.toString();
2608
- let fallbackSourcemap = ctx.sendMagicString(magicString);
2609
- if (fallbackSourcemap != void 0) map = fallbackSourcemap;
2610
- else mapHandledByNativeChannel = true;
2756
+ if (ret.map === void 0) {
2757
+ let fallbackSourcemap = ctx.sendMagicString(magicString);
2758
+ if (fallbackSourcemap != void 0) map = fallbackSourcemap;
2759
+ else mapHandledByNativeChannel = true;
2760
+ }
2611
2761
  }
2612
2762
  return {
2613
2763
  code: normalizedCode,
@@ -2621,8 +2771,12 @@ function bindingifyTransform(args2) {
2621
2771
  }
2622
2772
  function bindingifyLoad(args2) {
2623
2773
  return bindingifyHook(args2.plugin.load, ({ handler, options }) => ({
2624
- plugin: async (ctx, id2) => {
2625
- const ret = await handler.call(new LoadPluginContextImpl(args2.outputOptions, ctx.inner(), args2.plugin, args2.pluginContextData, ctx, id2, args2.onLog, args2.logLevel, args2.watchMode), id2);
2774
+ plugin: async (ctx, id2, bindingExtraOptions) => {
2775
+ const extraOptions = bindingExtraOptions ?? {
2776
+ rawId: id2,
2777
+ attributes: {}
2778
+ };
2779
+ const ret = await handler.call(new LoadPluginContextImpl(args2.outputOptions, ctx.inner(), args2.plugin, args2.pluginContextData, ctx, id2, args2.onLog, args2.logLevel, args2.watchMode), id2, extraOptions);
2626
2780
  if (ret == null) return;
2627
2781
  if (typeof ret === "string") return { code: ret };
2628
2782
  let moduleOption = args2.pluginContextData.updateModuleOption(id2, {
@@ -2630,7 +2784,7 @@ function bindingifyLoad(args2) {
2630
2784
  moduleSideEffects: ret.moduleSideEffects ?? null,
2631
2785
  invalidate: false
2632
2786
  });
2633
- let map = preProcessSourceMap(ret, id2);
2787
+ let map = preProcessSourceMap(ret, extraOptions.rawId);
2634
2788
  return {
2635
2789
  code: ret.code,
2636
2790
  map: bindingifySourcemap(map),
@@ -2643,7 +2797,7 @@ function bindingifyLoad(args2) {
2643
2797
  }
2644
2798
  function preProcessSourceMap(ret, id2) {
2645
2799
  if (!ret.map) return;
2646
- let map = typeof ret.map === "object" ? ret.map : JSON.parse(ret.map);
2800
+ let map = typeof ret.map === "object" ? copySourcemapObject(ret.map) : JSON.parse(ret.map);
2647
2801
  if (!isEmptySourcemapFiled(map.sources)) {
2648
2802
  const directory = path.dirname(id2) || ".";
2649
2803
  const sourceRoot = map.sourceRoot || ".";
@@ -2661,6 +2815,17 @@ function bindingifyRenderStart(args2) {
2661
2815
  await handler.call(createPluginContext(args2, ctx), args2.pluginContextData.getOutputOptions(opts), args2.pluginContextData.getInputOptions(opts));
2662
2816
  } }));
2663
2817
  }
2818
+ function generateSourcemap(magicString, outputOptions) {
2819
+ if (!outputOptions.sourcemap) return;
2820
+ const generatedMap = magicString.generateMap({ hires: magicString.hires ?? "boundary" });
2821
+ return bindingifySourcemap({
2822
+ file: generatedMap.file,
2823
+ mappings: generatedMap.mappings,
2824
+ names: generatedMap.names,
2825
+ sources: generatedMap.sources,
2826
+ sourcesContent: generatedMap.sourcesContent.map((s) => s ?? null)
2827
+ });
2828
+ }
2664
2829
  function bindingifyRenderChunk(args2) {
2665
2830
  return bindingifyHook(args2.plugin.renderChunk, ({ handler, options }) => ({
2666
2831
  plugin: async (ctx, code2, chunk, opts, meta) => {
@@ -2675,22 +2840,13 @@ function bindingifyRenderChunk(args2) {
2675
2840
  },
2676
2841
  configurable: true
2677
2842
  });
2678
- const ret = await handler.call(createPluginContext(args2, ctx), code2, transformRenderedChunk(chunk), args2.pluginContextData.getOutputOptions(opts), renderChunkMeta);
2843
+ const outputOptions = args2.pluginContextData.getOutputOptions(opts);
2844
+ const ret = await handler.call(createPluginContext(args2, ctx), code2, transformRenderedChunk(chunk), outputOptions, renderChunkMeta);
2679
2845
  if (ret == null) return;
2680
- if (ret instanceof RolldownMagicString) {
2681
- const normalizedCode = ret.toString();
2682
- const generatedMap = ret.generateMap();
2683
- return {
2684
- code: normalizedCode,
2685
- map: bindingifySourcemap({
2686
- file: generatedMap.file,
2687
- mappings: generatedMap.mappings,
2688
- names: generatedMap.names,
2689
- sources: generatedMap.sources,
2690
- sourcesContent: generatedMap.sourcesContent.map((s) => s ?? null)
2691
- })
2692
- };
2693
- }
2846
+ if (ret instanceof RolldownMagicString) return {
2847
+ code: ret.toString(),
2848
+ map: generateSourcemap(ret, outputOptions)
2849
+ };
2694
2850
  if (typeof ret === "string") return { code: ret };
2695
2851
  if (ret.code instanceof RolldownMagicString) {
2696
2852
  const magicString = ret.code;
@@ -2699,19 +2855,10 @@ function bindingifyRenderChunk(args2) {
2699
2855
  code: normalizedCode,
2700
2856
  map: null
2701
2857
  };
2702
- if (ret.map === void 0) {
2703
- const generatedMap = magicString.generateMap();
2704
- return {
2705
- code: normalizedCode,
2706
- map: bindingifySourcemap({
2707
- file: generatedMap.file,
2708
- mappings: generatedMap.mappings,
2709
- names: generatedMap.names,
2710
- sources: generatedMap.sources,
2711
- sourcesContent: generatedMap.sourcesContent.map((s) => s ?? null)
2712
- })
2713
- };
2714
- }
2858
+ if (ret.map === void 0) return {
2859
+ code: normalizedCode,
2860
+ map: generateSourcemap(magicString, outputOptions)
2861
+ };
2715
2862
  return {
2716
2863
  code: normalizedCode,
2717
2864
  map: bindingifySourcemap(ret.map)
@@ -2746,7 +2893,7 @@ function bindingifyRenderError(args2) {
2746
2893
  }
2747
2894
  function createOutputBundle(args2, ctx, bundle) {
2748
2895
  const changed = {
2749
- updated: /* @__PURE__ */ new Set(),
2896
+ updated: /* @__PURE__ */ new Map(),
2750
2897
  deleted: /* @__PURE__ */ new Set()
2751
2898
  };
2752
2899
  const context = createPluginContext(args2, ctx);
@@ -3109,7 +3256,7 @@ function normalizeTransformOptions(inputOptions) {
3109
3256
  };
3110
3257
  }
3111
3258
  function getDefaultDevRuntime(host = "localhost", port = 3e3) {
3112
- return "// @ts-check\n\nclass Module {\n /**\n * @type {{ exports: any }}\n */\n exportsHolder = { exports: null };\n /**\n * @type {string}\n */\n id;\n\n /**\n * @param {string} id\n */\n constructor(id) {\n this.id = id;\n }\n\n get exports() {\n return this.exportsHolder.exports;\n }\n}\n\n/**\n * Compiler-emitted module-graph delta \u2014 topology (static + dynamic edges).\n * `ids[0, localCount)` are the modules this payload carries; `ids[localCount, \u2026)` are foreign edge targets.\n * `edges[i]` / `dynamicEdges[i]` are the static / dynamic-`import()` out-edges of `ids[i]`.\n * `bindings[i][j]` are the export names `ids[i]` imports through `edges[i][j]`. `bindings` holds\n * only some rows; a missing row, or a missing or `null` entry, means the whole namespace.\n * `dynamicEdges` also holds only some rows; a missing row means no dynamic edges.\n * `stamps[i]` is the rebuild stamp of `ids[i]`; a missing row means 0.\n * `entries` lists the rows whose module is an entry.\n * @typedef {{ ids: string[], localCount: number, edges: number[][], bindings?: Record<number, (string[] | null)[]>, dynamicEdges?: Record<number, number[]>, stamps?: Record<number, number>, entries?: number[] }} ModuleGraphDelta\n * @typedef {{ createModuleHotContext(moduleId: string): any, onModuleCacheRemoval(moduleId: string): void }} DevRuntimeHooks\n */\n\nexport class MissingFactoryError extends Error {\n /**\n * @param {string} id\n */\n constructor(id) {\n super(`No factory registered for module ${id}`);\n this.id = id;\n }\n}\n\nexport class DevRuntime {\n /**\n * Client ID generated at runtime initialization, used for lazy compilation requests.\n * @type {string}\n */\n clientId;\n\n /**\n * @param {string} clientId\n */\n constructor(clientId) {\n this.clientId = clientId;\n }\n\n /**\n * Static import edges from `registerGraph` \u2014 entries persist across `removeModuleCache`\n * and change only by replacement from a newer payload (last write wins).\n * `bindings` is the payload row as sent; `getImportedBindings` resolves a missing entry.\n * @type {Map<string, { edges: string[], bindings: (string[] | null)[] | undefined }>}\n */\n staticImports = new Map();\n /**\n * Reverse index over the static imports.\n * @type {Map<string, Set<string>>}\n */\n importers = new Map();\n /**\n * Dynamic `import()` edges from `registerGraph`, keyed by importer \u2014 mirror of\n * `staticImports` for the dynamic reverse index.\n * @type {Map<string, { edges: string[] }>}\n */\n dynamicImports = new Map();\n /**\n * Reverse index over the dynamic imports.\n * @type {Map<string, Set<string>>}\n */\n dynamicImporters = new Map();\n /** @type {Set<string>} */\n entries = new Set();\n /**\n * The module cache. Membership means \"this module's side effects ran in this tab\" \u2014\n * registration is emitted ahead of every module body, and nothing un-registers on\n * unwind, so a factory that throws mid-body stays registered. A `Map` rather than a\n * plain object: HMR eviction deletes entries, and a `delete` on an object drops V8\n * into dictionary mode, taxing every later lookup on the hottest read path.\n * @type {Map<string, Module>}\n */\n moduleCache = new Map();\n /**\n * Re-runnable factories from HMR patches and lazy chunks. The initial bundle stays\n * scope-hoisted and contributes none.\n * @type {Map<string, (id: string) => void>}\n */\n factories = new Map();\n /**\n * A late payload (a slow lazy chunk after an HMR patch) must not replace newer rows or\n * factories.\n * @type {Map<string, number>}\n */\n rowStamps = new Map();\n /** @type {Map<string, number>} */\n factoryStamps = new Map();\n /**\n * Installed by the dev client at boot. The runtime is a store + executor and makes\n * no HMR decisions; accepting, disposing, and reloading live behind these hooks.\n * @type {DevRuntimeHooks | null}\n */\n hooks = null;\n\n /**\n * @param {ModuleGraphDelta} delta\n */\n registerGraph(delta) {\n for (let i = 0; i < delta.localCount; i++) {\n const id = delta.ids[i];\n if (delta.stamps) {\n const stamp = delta.stamps[i] ?? 0;\n if (stamp < (this.rowStamps.get(id) ?? 0)) continue;\n this.rowStamps.set(id, stamp);\n } else {\n // A full-build chunk has no stamps. It runs its code right away, so its row always\n // replaces the old one.\n this.rowStamps.delete(id);\n }\n const edges = delta.edges[i].map((j) => delta.ids[j]);\n for (const target of this.staticImports.get(id)?.edges ?? []) {\n this.importers.get(target)?.delete(id);\n }\n for (const target of edges) {\n let importerSet = this.importers.get(target);\n if (!importerSet) {\n importerSet = new Set();\n this.importers.set(target, importerSet);\n }\n importerSet.add(id);\n }\n this.staticImports.set(id, { edges, bindings: delta.bindings?.[i] });\n\n // Dynamic `import()` edges are maintained in a parallel reverse index with the same\n // last-write-wins bookkeeping; `getImporters` unions the two.\n const dynamicEdges = (delta.dynamicEdges?.[i] ?? []).map((j) => delta.ids[j]);\n for (const target of this.dynamicImports.get(id)?.edges ?? []) {\n this.dynamicImporters.get(target)?.delete(id);\n }\n for (const target of dynamicEdges) {\n let importerSet = this.dynamicImporters.get(target);\n if (!importerSet) {\n importerSet = new Set();\n this.dynamicImporters.set(target, importerSet);\n }\n importerSet.add(id);\n }\n this.dynamicImports.set(id, { edges: dynamicEdges });\n\n if (delta.entries?.includes(i)) {\n this.entries.add(id);\n } else {\n this.entries.delete(id);\n }\n }\n }\n\n /**\n * @param {string} id\n * @param {(id: string) => void} fn\n * @param {number} [stamp]\n */\n registerFactory(id, fn, stamp = 0) {\n if (stamp < (this.factoryStamps.get(id) ?? 0)) return;\n this.factoryStamps.set(id, stamp);\n this.factories.set(id, fn);\n }\n\n /**\n * @param {string} id\n * @param {{ exports: any }} [exportsHolder]\n */\n registerModule(id, exportsHolder = { exports: {} }) {\n const module = new Module(id);\n module.exportsHolder = exportsHolder;\n this.moduleCache.set(id, module);\n }\n\n /**\n * @param {string} id\n * @returns {string[]}\n */\n getImporters(id) {\n // Static \u222A dynamic importers \u2014 the boundary walk treats both kinds the same (parity\n // with Vite `node.importers` / webpack `module.parents`). Deduped so a module that\n // imports `id` both statically and via `import()` appears once.\n const dynamic = this.dynamicImporters.get(id);\n if (!dynamic || dynamic.size === 0) {\n return [...(this.importers.get(id) ?? [])];\n }\n return [...new Set([...(this.importers.get(id) ?? []), ...dynamic])];\n }\n\n /**\n * `\"*\"` means the whole namespace, an empty list a side-effect-only import, `undefined` no edge.\n * @param {string} importer\n * @param {string} id\n * @returns {string[] | undefined}\n */\n getImportedBindings(importer, id) {\n const record = this.staticImports.get(importer);\n const j = record ? record.edges.indexOf(id) : -1;\n const names = j === -1 ? undefined : (record?.bindings?.[j] ?? ['*']);\n if (!this.dynamicImports.get(importer)?.edges.includes(id)) {\n return names;\n }\n if (!names) return ['*'];\n return names.includes('*') ? names : [...names, '*'];\n }\n\n /**\n * @param {string} id\n */\n isEntry(id) {\n return this.entries.has(id);\n }\n\n /**\n * @param {string} id\n */\n isExecuted(id) {\n return this.moduleCache.has(id);\n }\n\n /**\n * @param {string} id\n */\n hasFactory(id) {\n return this.factories.has(id);\n }\n\n /**\n * Module-cache delete only \u2014 static imports and factories persist. Removal is what\n * re-arms a cache-gated factory for `initModule`.\n * @param {string} id\n */\n removeModuleCache(id) {\n this.moduleCache.delete(id);\n this.hooks?.onModuleCacheRemoval(id);\n }\n\n /**\n * The one re-execution gate: registered \u2192 return the live exports; otherwise run the\n * mapped factory (which registers itself first, then runs the body).\n * @param {string} id\n */\n initModule(id) {\n if (this.moduleCache.has(id)) {\n return this.loadExports(id);\n }\n const factory = this.factories.get(id);\n if (!factory) {\n throw new MissingFactoryError(id);\n }\n factory(id);\n return this.loadExports(id);\n }\n\n /**\n * @param {string} id\n */\n loadExports(id) {\n const module = this.moduleCache.get(id);\n if (module) {\n return module.exportsHolder.exports;\n } else {\n console.warn(`Module ${id} not found`);\n return {};\n }\n }\n\n /**\n * @param {string} moduleId\n */\n createModuleHotContext(moduleId) {\n if (this.hooks) {\n return this.hooks.createModuleHotContext(moduleId);\n }\n throw new Error('createModuleHotContext requires installed hooks or an override');\n }\n\n /** @internal */\n // @ts-expect-error The variable will be injected at build time.\n __toESM = __toESM;\n /** @internal */\n // @ts-expect-error The variable will be injected at build time.\n __toCommonJS = __toCommonJS;\n /** @internal */\n // @ts-expect-error The variable will be injected at build time.\n __exportAll = __exportAll;\n /**\n * @param {boolean} [isNodeMode]\n * @returns {(mod: any) => any}\n * @internal\n */\n // @ts-expect-error The variable will be injected at build time.\n __toDynamicImportESM = (isNodeMode) => (mod) => __toESM(mod.default, isNodeMode);\n /** @internal */\n // @ts-expect-error The variable will be injected at build time.\n __reExport = __reExport;\n}\n\n// @ts-check\n\n/** @import { DevRuntime } from './runtime-extra-dev-common.js' */\n\n/** @type {typeof DevRuntime} */\n// @ts-expect-error -- there's no way to declare a variable by JSDoc\nvar BaseDevRuntime = DevRuntime;\n\nclass ModuleHotContext {\n /**\n * @type {{ deps: [string], fn: (moduleExports: Record<string, any>[]) => void }[]}\n */\n acceptCallbacks = [];\n /**\n * @param {string} moduleId\n * @param {InstanceType<BaseDevRuntime>} devRuntime\n */\n constructor(moduleId, devRuntime) {\n this.moduleId = moduleId;\n this.devRuntime = devRuntime;\n }\n\n /**\n * @overload\n * @param {(mod: Record<string, any>) => void} cb\n * @returns {void}\n */\n /**\n * @param {...any} args\n * @returns {void}\n */\n accept(...args) {\n if (args.length === 1) {\n const [cb] = /** @type {[(mod: Record<string, any>) => void]} */ (args);\n const acceptingPath = this.moduleId;\n this.acceptCallbacks.push({\n deps: [acceptingPath],\n fn: cb,\n });\n } else if (args.length === 0) {}\n else {\n throw new Error('Invalid arguments for `import.meta.hot.accept`');\n }\n }\n\n invalidate() {\n socket.send(JSON.stringify({\n type: 'hmr:invalidate',\n moduleId: this.moduleId,\n }));\n }\n}\n\nclass DefaultDevRuntime extends BaseDevRuntime {\n /**\n * @type {Map<string, ModuleHotContext>}\n */\n moduleHotContexts = new Map();\n /**\n * @override\n * @param {string} moduleId\n */\n createModuleHotContext(moduleId) {\n const hotContext = new ModuleHotContext(moduleId, this);\n this.moduleHotContexts.set(moduleId, hotContext);\n return hotContext;\n }\n}\n\n/** @param {string} url */\nfunction loadScript(url) {\n var script = document.createElement('script');\n script.src = url;\n script.type = 'module';\n script.onerror = function() {\n console.error('Failed to load script: ' + url);\n };\n document.body.appendChild(script);\n}\n\nconsole.debug('HMR runtime loaded', '$ADDR');\n// Generate client ID immediately at runtime initialization\n// This ensures the client ID is available before any lazy imports\nconst clientId = crypto.randomUUID();\nconst addr = new URL('ws://$ADDR');\naddr.searchParams.set('clientId', clientId);\n\nconst socket = new WebSocket(addr);\n\n(/** @type {any} */ (globalThis)).__rolldown_runtime__ ??=\n new DefaultDevRuntime(clientId);\n\n/** @param {MessageEvent} event */\nsocket.onmessage = function(event) {\n const data = JSON.parse(event.data);\n console.debug('Received message:', data);\n if (data.type === 'connected') {\n // Server acknowledged the connection\n console.debug('[hmr]: Connection established with server');\n } else if (data.type === 'hmr:update') {\n if (typeof process === 'object') {\n import(data.path);\n console.debug(`[hmr]: Importing HMR patch: ${data.path}`);\n } else {\n console.debug(`[hmr]: Loading HMR patch: ${data.path}`);\n loadScript(data.url);\n }\n } else if (data.type === 'hmr:reload') {\n console.log('[hmr]: Full reload required, reloading page');\n if (typeof location !== 'undefined') {\n location.reload();\n } else {\n console.log('[hmr]: location is undefined, cannot reload page');\n }\n }\n};\n".replaceAll("$ADDR", `${host}:${port}`);
3259
+ return "// @ts-check\n\nclass Module {\n /**\n * @type {{ exports: any }}\n */\n exportsHolder = { exports: null };\n /**\n * @type {string}\n */\n id;\n /**\n * A CommonJS module registers its raw `module.exports`; `requestLazy` builds the `__toESM`\n * view on top. ESM registers its namespace, used as is.\n * @type {boolean}\n */\n isCommonJs = false;\n\n /**\n * @param {string} id\n */\n constructor(id) {\n this.id = id;\n }\n\n get exports() {\n return this.exportsHolder.exports;\n }\n}\n\n/**\n * Compiler-emitted module-graph delta \u2014 topology (static + dynamic edges).\n * `ids[0, localCount)` are the modules this payload carries; `ids[localCount, \u2026)` are foreign edge targets.\n * `edges[i]` / `dynamicEdges[i]` are the static / dynamic-`import()` out-edges of `ids[i]`.\n * `bindings[i][j]` are the export names `ids[i]` imports through `edges[i][j]`. `bindings` holds\n * only some rows; a missing row, or a missing or `null` entry, means the whole namespace.\n * `dynamicEdges` also holds only some rows; a missing row means no dynamic edges.\n * `stamps[i]` is the rebuild stamp of `ids[i]`; a missing row means 0.\n * `entries` lists the rows whose module is an entry.\n * @typedef {{ ids: string[], localCount: number, edges: number[][], bindings?: Record<number, (string[] | null)[]>, dynamicEdges?: Record<number, number[]>, stamps?: Record<number, number>, entries?: number[] }} ModuleGraphDelta\n * @typedef {{ createModuleHotContext(moduleId: string): any, onModuleCacheRemoval(moduleId: string): void }} DevRuntimeHooks\n */\n\nexport class MissingFactoryError extends Error {\n /**\n * @param {string} id\n */\n constructor(id) {\n super(`No factory registered for module ${id}`);\n this.id = id;\n }\n}\n\nexport class DevRuntime {\n /**\n * Client ID generated at runtime initialization, used for lazy compilation requests.\n * @type {string}\n */\n clientId;\n\n /**\n * @param {string} clientId\n */\n constructor(clientId) {\n this.clientId = clientId;\n }\n\n /**\n * Static import edges from `registerGraph` \u2014 entries persist across `removeModuleCache`\n * and change only by replacement from a newer payload (last write wins).\n * `bindings` is the payload row as sent; `getImportedBindings` resolves a missing entry.\n * @type {Map<string, { edges: string[], bindings: (string[] | null)[] | undefined }>}\n */\n staticImports = new Map();\n /**\n * Reverse index over the static imports.\n * @type {Map<string, Set<string>>}\n */\n importers = new Map();\n /**\n * Dynamic `import()` edges from `registerGraph`, keyed by importer \u2014 mirror of\n * `staticImports` for the dynamic reverse index.\n * @type {Map<string, { edges: string[] }>}\n */\n dynamicImports = new Map();\n /**\n * Reverse index over the dynamic imports.\n * @type {Map<string, Set<string>>}\n */\n dynamicImporters = new Map();\n /** @type {Set<string>} */\n entries = new Set();\n /**\n * The module cache. Membership means \"this module's side effects ran in this tab\" \u2014\n * registration is emitted ahead of every module body, and nothing un-registers on\n * unwind, so a factory that throws mid-body stays registered. A `Map` rather than a\n * plain object: HMR eviction deletes entries, and a `delete` on an object drops V8\n * into dictionary mode, taxing every later lookup on the hottest read path.\n * @type {Map<string, Module>}\n */\n moduleCache = new Map();\n /**\n * Re-runnable factories from HMR patches and lazy chunks. The initial bundle stays\n * scope-hoisted and contributes none.\n * @type {Map<string, (id: string) => void>}\n */\n factories = new Map();\n /**\n * A late payload (a slow lazy chunk after an HMR patch) must not replace newer rows or\n * factories.\n * @type {Map<string, number>}\n */\n rowStamps = new Map();\n /** @type {Map<string, number>} */\n factoryStamps = new Map();\n /**\n * Installed by the dev client at boot. The runtime is a store + executor and makes\n * no HMR decisions; accepting, disposing, and reloading live behind these hooks.\n * @type {DevRuntimeHooks | null}\n */\n hooks = null;\n\n /**\n * @param {ModuleGraphDelta} delta\n */\n registerGraph(delta) {\n for (let i = 0; i < delta.localCount; i++) {\n const id = delta.ids[i];\n if (delta.stamps) {\n const stamp = delta.stamps[i] ?? 0;\n if (stamp < (this.rowStamps.get(id) ?? 0)) continue;\n this.rowStamps.set(id, stamp);\n } else {\n // A full-build chunk has no stamps. It runs its code right away, so its row always\n // replaces the old one.\n this.rowStamps.delete(id);\n }\n const edges = delta.edges[i].map((j) => delta.ids[j]);\n for (const target of this.staticImports.get(id)?.edges ?? []) {\n this.importers.get(target)?.delete(id);\n }\n for (const target of edges) {\n let importerSet = this.importers.get(target);\n if (!importerSet) {\n importerSet = new Set();\n this.importers.set(target, importerSet);\n }\n importerSet.add(id);\n }\n this.staticImports.set(id, { edges, bindings: delta.bindings?.[i] });\n\n // Dynamic `import()` edges are maintained in a parallel reverse index with the same\n // last-write-wins bookkeeping; `getImporters` unions the two.\n const dynamicEdges = (delta.dynamicEdges?.[i] ?? []).map((j) => delta.ids[j]);\n for (const target of this.dynamicImports.get(id)?.edges ?? []) {\n this.dynamicImporters.get(target)?.delete(id);\n }\n for (const target of dynamicEdges) {\n let importerSet = this.dynamicImporters.get(target);\n if (!importerSet) {\n importerSet = new Set();\n this.dynamicImporters.set(target, importerSet);\n }\n importerSet.add(id);\n }\n this.dynamicImports.set(id, { edges: dynamicEdges });\n\n if (delta.entries?.includes(i)) {\n this.entries.add(id);\n } else {\n this.entries.delete(id);\n }\n }\n }\n\n /**\n * @param {string} id\n * @param {(id: string) => void} fn\n * @param {number} [stamp]\n */\n registerFactory(id, fn, stamp = 0) {\n if (stamp < (this.factoryStamps.get(id) ?? 0)) return;\n this.factoryStamps.set(id, stamp);\n this.factories.set(id, fn);\n }\n\n /**\n * @param {string} id\n * @param {{ exports: any }} [exportsHolder]\n * @param {boolean | 0 | 1} [isCommonJs]\n */\n registerModule(id, exportsHolder = { exports: {} }, isCommonJs = false) {\n const module = new Module(id);\n module.exportsHolder = exportsHolder;\n module.isCommonJs = !!isCommonJs;\n this.moduleCache.set(id, module);\n }\n\n /**\n * @param {string} id\n * @returns {string[]}\n */\n getImporters(id) {\n // Static \u222A dynamic importers \u2014 the boundary walk treats both kinds the same (parity\n // with Vite `node.importers` / webpack `module.parents`). Deduped so a module that\n // imports `id` both statically and via `import()` appears once.\n const dynamic = this.dynamicImporters.get(id);\n if (!dynamic || dynamic.size === 0) {\n return [...(this.importers.get(id) ?? [])];\n }\n return [...new Set([...(this.importers.get(id) ?? []), ...dynamic])];\n }\n\n /**\n * `\"*\"` means the whole namespace, an empty list a side-effect-only import, `undefined` no edge.\n * @param {string} importer\n * @param {string} id\n * @returns {string[] | undefined}\n */\n getImportedBindings(importer, id) {\n const record = this.staticImports.get(importer);\n const j = record ? record.edges.indexOf(id) : -1;\n const names = j === -1 ? undefined : (record?.bindings?.[j] ?? ['*']);\n if (!this.dynamicImports.get(importer)?.edges.includes(id)) {\n return names;\n }\n if (!names) return ['*'];\n return names.includes('*') ? names : [...names, '*'];\n }\n\n /**\n * @param {string} id\n */\n isEntry(id) {\n return this.entries.has(id);\n }\n\n /**\n * @param {string} id\n */\n isExecuted(id) {\n return this.moduleCache.has(id);\n }\n\n /**\n * @param {string} id\n */\n hasFactory(id) {\n return this.factories.has(id);\n }\n\n /**\n * Module-cache delete only \u2014 static imports and factories persist. Removal is what\n * re-arms a cache-gated factory for `initModule`.\n * @param {string} id\n */\n removeModuleCache(id) {\n this.moduleCache.delete(id);\n // `registerModule` installs a fresh namespace on every run, so a kept memo would hand a\n // later `import()` the pre-edit exports forever.\n this.lazyRequests.delete(id);\n this.hooks?.onModuleCacheRemoval(id);\n }\n\n /**\n * The one re-execution gate: registered \u2192 return the live exports; otherwise run the\n * mapped factory (which registers itself first, then runs the body).\n * @param {string} id\n */\n initModule(id) {\n if (this.moduleCache.has(id)) {\n return this.loadExports(id);\n }\n const factory = this.factories.get(id);\n if (!factory) {\n throw new MissingFactoryError(id);\n }\n factory(id);\n return this.loadExports(id);\n }\n\n /**\n * @param {string} id\n */\n loadExports(id) {\n const module = this.moduleCache.get(id);\n if (module) {\n return module.exportsHolder.exports;\n } else {\n console.warn(`Module ${id} not found`);\n return {};\n }\n }\n\n /** @type {Map<string, Promise<any>>} */\n lazyRequests = new Map();\n\n /**\n * The entry point for a lazy `import()`. `id` is the module the boundary stands for;\n * `proxyModuleId` is the boundary's own id, used only to load the chunk.\n *\n * Nothing is registered under the boundary id, deliberately. A cache entry with no factory\n * behind it reads as \"executed\" to the HMR boundary walk, and `applyUpdate` turns an\n * updated-but-factory-less module into a full page reload.\n *\n * A rejection is memoized like any other outcome, matching `import()` of a module that\n * threw. Retrying could not work anyway: a factory registers its module before running its\n * body, so re-running `initModule` would return half-initialized exports as success.\n *\n * A CommonJS module resolves to its `__toESM` view, as in a production build. The runtime\n * decides from the registration: the importer is compiled before the importee is in the\n * graph. `isNodeMode` is the importer's choice, so the view is built per call, not memoized.\n *\n * @param {string} id\n * @param {string} proxyModuleId\n * @param {boolean | 0 | 1} [isNodeMode]\n * @returns {Promise<any>}\n */\n requestLazy(id, proxyModuleId, isNodeMode) {\n let pending = this.lazyRequests.get(id);\n if (!pending) {\n // Factories outlive `removeModuleCache`, so an evicted module can be re-run without the\n // server \u2014 and must be, since the memo went with the cache entry. `Promise.resolve` keeps\n // a synchronous `initModule` throw from escaping the call site.\n pending = this.isRunnableHere(id)\n ? Promise.resolve().then(() => this.initModule(id))\n : Promise.resolve()\n .then(() => this.loadLazyChunk(proxyModuleId))\n .then(() => this.initModule(id));\n this.lazyRequests.set(id, pending);\n }\n\n return pending.then((exports) =>\n this.moduleCache.get(id)?.isCommonJs ? this.__toESM(exports, isNodeMode) : exports,\n );\n }\n\n /**\n * Whether `id` can run without the server: every module its run reaches through static\n * imports already ran or has a factory. A factory alone is not enough, because a patch\n * can ship a module without the static imports it never needed (#11028).\n * @internal\n * @param {string} id\n */\n isRunnableHere(id) {\n const seen = new Set([id]);\n const queue = [id];\n for (const current of queue) {\n if (this.moduleCache.has(current)) continue;\n if (!this.factories.has(current)) return false;\n for (const dep of this.staticImports.get(current)?.edges ?? []) {\n if (!seen.has(dep)) {\n seen.add(dep);\n queue.push(dep);\n }\n }\n }\n return true;\n }\n\n /**\n * Loads the lazy chunk behind a lazy boundary. The chunk only registers factories;\n * `requestLazy` runs the module afterwards.\n *\n * The dev server owns the lazy endpoint, so a server that serves it at another URL (for\n * example under a public base path) overrides this method.\n *\n * @param {string} proxyModuleId\n * @returns {Promise<unknown>}\n */\n loadLazyChunk(proxyModuleId) {\n return import(\n /* @vite-ignore */ `/@vite/lazy?id=${encodeURIComponent(proxyModuleId)}&clientId=${this.clientId}`\n );\n }\n\n /**\n * @param {string} moduleId\n */\n createModuleHotContext(moduleId) {\n if (this.hooks) {\n return this.hooks.createModuleHotContext(moduleId);\n }\n throw new Error('createModuleHotContext requires installed hooks or an override');\n }\n\n /** @internal */\n // @ts-expect-error The variable will be injected at build time.\n __toESM = __toESM;\n /** @internal */\n // @ts-expect-error The variable will be injected at build time.\n __toCommonJS = __toCommonJS;\n /** @internal */\n // @ts-expect-error The variable will be injected at build time.\n __exportAll = __exportAll;\n /** @internal */\n // @ts-expect-error The variable will be injected at build time.\n __reExport = __reExport;\n}\n\n// @ts-check\n\n/** @import { DevRuntime } from './runtime-extra-dev-common.js' */\n\n/** @type {typeof DevRuntime} */\n// @ts-expect-error -- there's no way to declare a variable by JSDoc\nvar BaseDevRuntime = DevRuntime;\n\nclass ModuleHotContext {\n /**\n * @type {{ deps: [string], fn: (moduleExports: Record<string, any>[]) => void }[]}\n */\n acceptCallbacks = [];\n /**\n * @param {string} moduleId\n * @param {InstanceType<BaseDevRuntime>} devRuntime\n */\n constructor(moduleId, devRuntime) {\n this.moduleId = moduleId;\n this.devRuntime = devRuntime;\n }\n\n /**\n * @overload\n * @param {(mod: Record<string, any>) => void} cb\n * @returns {void}\n */\n /**\n * @param {...any} args\n * @returns {void}\n */\n accept(...args) {\n if (args.length === 1) {\n const [cb] = /** @type {[(mod: Record<string, any>) => void]} */ (args);\n const acceptingPath = this.moduleId;\n this.acceptCallbacks.push({\n deps: [acceptingPath],\n fn: cb,\n });\n } else if (args.length === 0) {}\n else {\n throw new Error('Invalid arguments for `import.meta.hot.accept`');\n }\n }\n\n invalidate() {\n socket.send(JSON.stringify({\n type: 'hmr:invalidate',\n moduleId: this.moduleId,\n }));\n }\n}\n\nclass DefaultDevRuntime extends BaseDevRuntime {\n /**\n * @type {Map<string, ModuleHotContext>}\n */\n moduleHotContexts = new Map();\n /**\n * @override\n * @param {string} moduleId\n */\n createModuleHotContext(moduleId) {\n const hotContext = new ModuleHotContext(moduleId, this);\n this.moduleHotContexts.set(moduleId, hotContext);\n return hotContext;\n }\n}\n\n/** @param {string} url */\nfunction loadScript(url) {\n var script = document.createElement('script');\n script.src = url;\n script.type = 'module';\n script.onerror = function() {\n console.error('Failed to load script: ' + url);\n };\n document.body.appendChild(script);\n}\n\nconsole.debug('HMR runtime loaded', '$ADDR');\n// Generate client ID immediately at runtime initialization\n// This ensures the client ID is available before any lazy imports\nconst clientId = crypto.randomUUID();\nconst addr = new URL('ws://$ADDR');\naddr.searchParams.set('clientId', clientId);\n\nconst socket = new WebSocket(addr);\n\n(/** @type {any} */ (globalThis)).__rolldown_runtime__ ??=\n new DefaultDevRuntime(clientId);\n\n/** @param {MessageEvent} event */\nsocket.onmessage = function(event) {\n const data = JSON.parse(event.data);\n console.debug('Received message:', data);\n if (data.type === 'connected') {\n // Server acknowledged the connection\n console.debug('[hmr]: Connection established with server');\n } else if (data.type === 'hmr:update') {\n if (typeof process === 'object') {\n import(data.path);\n console.debug(`[hmr]: Importing HMR patch: ${data.path}`);\n } else {\n console.debug(`[hmr]: Loading HMR patch: ${data.path}`);\n loadScript(data.url);\n }\n } else if (data.type === 'hmr:reload') {\n console.log('[hmr]: Full reload required, reloading page');\n if (typeof location !== 'undefined') {\n location.reload();\n } else {\n console.log('[hmr]: location is undefined, cannot reload page');\n }\n }\n};\n".replaceAll("$ADDR", `${host}:${port}`);
3113
3260
  }
3114
3261
  function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings) {
3115
3262
  const plugins = rawPlugins.map((plugin) => {
@@ -3225,7 +3372,8 @@ function bindingifyExperimental(experimental) {
3225
3372
  incrementalBuild: experimental?.incrementalBuild,
3226
3373
  nativeMagicString: experimental?.nativeMagicString,
3227
3374
  chunkOptimization: experimental?.chunkOptimization,
3228
- lazyBarrel: experimental?.lazyBarrel
3375
+ lazyBarrel: experimental?.lazyBarrel,
3376
+ importAttributes: experimental?.importAttributes
3229
3377
  };
3230
3378
  }
3231
3379
  function bindingifyResolve(resolve) {
@@ -3294,22 +3442,14 @@ function bindingifyInput(input) {
3294
3442
  });
3295
3443
  }
3296
3444
  function bindingifyWatch(watch2) {
3297
- if (watch2) {
3298
- const watcher = watch2.watcher ?? {};
3299
- return {
3300
- buildDelay: watch2.buildDelay,
3301
- skipWrite: watch2.skipWrite,
3302
- usePolling: watcher.usePolling,
3303
- pollInterval: watcher.pollInterval,
3304
- compareContentsForPolling: watcher.compareContentsForPolling,
3305
- useDebounce: watcher.useDebounce,
3306
- debounceDelay: watcher.debounceDelay,
3307
- debounceTickRate: watcher.debounceTickRate,
3308
- include: normalizedStringOrRegex(watch2.include),
3309
- exclude: normalizedStringOrRegex(watch2.exclude),
3310
- onInvalidate: (...args2) => watch2.onInvalidate?.(...args2)
3311
- };
3312
- }
3445
+ if (watch2) return {
3446
+ buildDelay: watch2.buildDelay,
3447
+ skipWrite: watch2.skipWrite,
3448
+ watcher: watch2.watcher,
3449
+ include: normalizedStringOrRegex(watch2.include),
3450
+ exclude: normalizedStringOrRegex(watch2.exclude),
3451
+ onInvalidate: (...args2) => watch2.onInvalidate?.(...args2)
3452
+ };
3313
3453
  }
3314
3454
  function bindingifyTreeshakeOptions(config, timings) {
3315
3455
  if (config === false) return;
@@ -3366,10 +3506,9 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
3366
3506
  };
3367
3507
  }
3368
3508
 
3369
- // node_modules/.pnpm/rolldown@1.2.16/node_modules/rolldown/dist/shared/create-bundler-option-BDjYxIaE.mjs
3509
+ // node_modules/.pnpm/rolldown@1.3.2/node_modules/rolldown/dist/shared/create-bundler-option-3Cr4j1yj.mjs
3370
3510
  import { Worker } from "node:worker_threads";
3371
3511
  import path2 from "node:path";
3372
- import { styleText } from "node:util";
3373
3512
  import os from "node:os";
3374
3513
  function getLogger(plugins, onLog, logLevel, watchMode) {
3375
3514
  const minimalPriority = logLevelPriority[logLevel];
@@ -3569,401 +3708,1082 @@ function getSortedPlugins(hookName, plugins) {
3569
3708
  ...post
3570
3709
  ];
3571
3710
  }
3572
- var DEFAULT_CONFIG = {
3573
- lang: void 0,
3574
- message: void 0,
3575
- abortEarly: void 0,
3576
- abortPipeEarly: void 0
3711
+ var ChunkingContextImpl = class {
3712
+ context;
3713
+ pluginContextData;
3714
+ moduleInfoCache = /* @__PURE__ */ new Map();
3715
+ constructor(context, pluginContextData) {
3716
+ this.context = context;
3717
+ this.pluginContextData = pluginContextData;
3718
+ }
3719
+ clearModuleInfoCache() {
3720
+ this.moduleInfoCache = void 0;
3721
+ }
3722
+ getModuleInfo(moduleId) {
3723
+ const cached = this.moduleInfoCache?.get(moduleId);
3724
+ if (cached) return cached;
3725
+ const bindingInfo = this.context.getModuleInfo(moduleId);
3726
+ if (bindingInfo) {
3727
+ const option = this.pluginContextData.getModuleOption(moduleId);
3728
+ const info = transformModuleInfo(bindingInfo, option);
3729
+ Object.defineProperty(info, "moduleSideEffects", {
3730
+ get: () => option.moduleSideEffects,
3731
+ set: (moduleSideEffects) => {
3732
+ option.moduleSideEffects = moduleSideEffects;
3733
+ option.invalidate = true;
3734
+ }
3735
+ });
3736
+ this.moduleInfoCache?.set(moduleId, info);
3737
+ return info;
3738
+ }
3739
+ return null;
3740
+ }
3577
3741
  };
3578
- // @__NO_SIDE_EFFECTS__
3579
- function getGlobalConfig(config$1) {
3580
- if (!config$1 && true) return DEFAULT_CONFIG;
3742
+ async function getWarn(outputOptions) {
3743
+ if (outputOptions.legalComments == null && outputOptions.inlineDynamicImports == null && outputOptions.advancedChunks == null && outputOptions.manualChunks == null) return (message) => console.warn(message);
3744
+ const { logger } = await import("./logger-CpvFcLaq-27JFRZ4G.js").then((n) => n.n);
3745
+ return (message) => logger.warn(message);
3746
+ }
3747
+ async function bindingifyOutputOptions(outputOptions, pluginContextData, onLog, timings) {
3748
+ const { dir, charset, 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;
3749
+ const warn = await getWarn(outputOptions);
3750
+ if (legalComments != null) warn("`legalComments` option is deprecated, please use `comments.legal` instead.");
3751
+ const { inlineDynamicImports, advancedChunks } = bindingifyCodeSplitting(outputOptions.codeSplitting, outputOptions.inlineDynamicImports, outputOptions.advancedChunks, manualChunks, pluginContextData, onLog, timings, warn);
3581
3752
  return {
3582
- lang: config$1?.lang ?? void 0,
3583
- message: config$1?.message,
3584
- abortEarly: config$1?.abortEarly ?? void 0,
3585
- abortPipeEarly: config$1?.abortPipeEarly ?? void 0
3753
+ dir,
3754
+ charset,
3755
+ file: file == null ? void 0 : file,
3756
+ format: bindingifyFormat(format),
3757
+ exports,
3758
+ hashCharacters,
3759
+ sourcemap: bindingifySourcemap2(sourcemap),
3760
+ sourcemapBaseUrl,
3761
+ sourcemapDebugIds,
3762
+ sourcemapFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapFileNames", sourcemapFileNames),
3763
+ sourcemapExcludeSources,
3764
+ sourcemapIgnoreList: batchSourcemapIgnoreList(measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapIgnoreList", sourcemapIgnoreList ?? /node_modules/)),
3765
+ sourcemapPathTransform: batchSourcemapPathTransform(measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapPathTransform", sourcemapPathTransform)),
3766
+ banner: bindingifyAddon(banner, "banner", timings),
3767
+ footer: bindingifyAddon(footer, "footer", timings),
3768
+ postBanner: bindingifyAddon(postBanner, "postBanner", timings),
3769
+ postFooter: bindingifyAddon(postFooter, "postFooter", timings),
3770
+ intro: bindingifyAddon(intro, "intro", timings),
3771
+ outro: bindingifyAddon(outro, "outro", timings),
3772
+ extend: outputOptions.extend,
3773
+ globals: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "globals", globals),
3774
+ paths: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "paths", paths),
3775
+ generatedCode,
3776
+ esModule,
3777
+ name,
3778
+ assetFileNames: bindingifyAssetFilenames(assetFileNames),
3779
+ entryFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "entryFileNames", entryFileNames),
3780
+ chunkFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "chunkFileNames", chunkFileNames),
3781
+ plugins: [],
3782
+ minify: outputOptions.minify,
3783
+ externalLiveBindings: outputOptions.externalLiveBindings,
3784
+ inlineDynamicImports,
3785
+ dynamicImportInCjs: outputOptions.dynamicImportInCjs,
3786
+ manualCodeSplitting: advancedChunks,
3787
+ polyfillRequire: outputOptions.polyfillRequire,
3788
+ sanitizeFileName,
3789
+ preserveModules,
3790
+ virtualDirname,
3791
+ legalComments,
3792
+ comments: bindingifyComments(comments),
3793
+ preserveModulesRoot,
3794
+ topLevelVar,
3795
+ minifyInternalExports: outputOptions.minifyInternalExports,
3796
+ cleanDir,
3797
+ strictExecutionOrder,
3798
+ strict: outputOptions.strict
3586
3799
  };
3587
3800
  }
3588
- // @__NO_SIDE_EFFECTS__
3589
- function _stringify(input) {
3590
- const type = typeof input;
3591
- if (type === "string") return `"${input}"`;
3592
- if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
3593
- if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
3594
- return type;
3595
- }
3596
- function _addIssue(context, label, dataset, config$1, other) {
3597
- const input = other && "input" in other ? other.input : dataset.value;
3598
- const expected = other?.expected ?? context.expects ?? null;
3599
- const received = other?.received ?? /* @__PURE__ */ _stringify(input);
3600
- const issue = {
3601
- kind: context.kind,
3602
- type: context.type,
3603
- input,
3604
- expected,
3605
- received,
3606
- message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
3607
- requirement: context.requirement,
3608
- path: other?.path,
3609
- issues: other?.issues,
3610
- lang: config$1.lang,
3611
- abortEarly: config$1.abortEarly,
3612
- abortPipeEarly: config$1.abortPipeEarly
3613
- };
3614
- const isSchema = context.kind === "schema";
3615
- const message$1 = other?.message ?? context.message ?? (context.reference, issue.lang, void 0) ?? (isSchema ? (issue.lang, void 0) : null) ?? config$1.message ?? (issue.lang, void 0);
3616
- if (message$1 !== void 0) issue.message = typeof message$1 === "function" ? message$1(issue) : message$1;
3617
- if (isSchema) dataset.typed = false;
3618
- if (dataset.issues) dataset.issues.push(issue);
3619
- else dataset.issues = [issue];
3620
- }
3621
- // @__NO_SIDE_EFFECTS__
3622
- function _isSameValueZero(value1, value2) {
3623
- return value1 === value2 || Number.isNaN(value1) && Number.isNaN(value2);
3801
+ function bindingifyAddon(configAddon, name, timings) {
3802
+ if (configAddon == null || configAddon === "") return;
3803
+ if (typeof configAddon === "function") {
3804
+ const measured = measureHookCost(timings, OUTPUT_OPTIONS_OWNER, name, configAddon);
3805
+ return async (chunk) => measured(transformRenderedChunk(chunk));
3806
+ }
3807
+ return configAddon;
3624
3808
  }
3625
- // @__NO_SIDE_EFFECTS__
3626
- function _isValidObjectKey(object$1, key) {
3627
- return Object.prototype.hasOwnProperty.call(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
3809
+ function bindingifyFormat(format) {
3810
+ switch (format) {
3811
+ case void 0:
3812
+ case "es":
3813
+ case "esm":
3814
+ case "module":
3815
+ return "es";
3816
+ case "cjs":
3817
+ case "commonjs":
3818
+ return "cjs";
3819
+ case "iife":
3820
+ return "iife";
3821
+ case "umd":
3822
+ return "umd";
3823
+ default:
3824
+ unimplemented(`output.format: ${format}`);
3825
+ }
3628
3826
  }
3629
- // @__NO_SIDE_EFFECTS__
3630
- function _joinExpects(values$1, separator) {
3631
- const list = [...new Set(values$1)];
3632
- if (list.length > 1) return `(${list.join(` ${separator} `)})`;
3633
- return list[0] ?? "never";
3827
+ function bindingifySourcemap2(sourcemap) {
3828
+ switch (sourcemap) {
3829
+ case true:
3830
+ return "file";
3831
+ case "inline":
3832
+ return "inline";
3833
+ case false:
3834
+ case void 0:
3835
+ return;
3836
+ case "hidden":
3837
+ return "hidden";
3838
+ default:
3839
+ throw new Error(`unknown sourcemap: ${sourcemap}`);
3840
+ }
3634
3841
  }
3635
- function _standardSchema(schema) {
3636
- schema["~standard"] = {
3637
- version: 1,
3638
- vendor: "valibot",
3639
- validate: (value$1) => schema["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig())
3842
+ function bindingifyAssetFilenames(assetFileNames) {
3843
+ if (typeof assetFileNames === "function") return (asset) => {
3844
+ return assetFileNames({
3845
+ name: asset.name,
3846
+ names: asset.names,
3847
+ originalFileName: asset.originalFileName,
3848
+ originalFileNames: asset.originalFileNames,
3849
+ source: transformAssetSource(asset.source),
3850
+ type: "asset"
3851
+ });
3640
3852
  };
3641
- return schema;
3853
+ return assetFileNames;
3642
3854
  }
3643
- var ValiError = class extends Error {
3644
- /**
3645
- * Creates a Valibot error with useful information.
3646
- *
3647
- * @param issues The error issues.
3648
- */
3649
- constructor(issues) {
3650
- super(issues[0].message);
3651
- this.name = "ValiError";
3652
- this.issues = issues;
3855
+ function bindingifyComments(comments) {
3856
+ if (comments == null) return;
3857
+ if (typeof comments === "boolean") return comments;
3858
+ return comments;
3859
+ }
3860
+ function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, advancedChunks, manualChunks, pluginContextData, onLog, timings, warn) {
3861
+ let inlineDynamicImports;
3862
+ let effectiveChunksOption;
3863
+ let migratedManualChunksGroup;
3864
+ let chunksOptionName = "codeSplitting";
3865
+ if (codeSplitting === false) {
3866
+ if (inlineDynamicImportsOption != null) warn("`inlineDynamicImports` option is ignored because `codeSplitting: false` is set.");
3867
+ if (manualChunks != null) throw new Error('Invalid configuration: "output.manualChunks" cannot be used when "output.codeSplitting" is set to false.');
3868
+ if (advancedChunks != null) warn("`advancedChunks` option is ignored because `codeSplitting` is set to `false`.");
3869
+ return {
3870
+ inlineDynamicImports: true,
3871
+ advancedChunks: void 0
3872
+ };
3873
+ } else if (codeSplitting === true) {
3874
+ if (inlineDynamicImportsOption != null) warn("`inlineDynamicImports` option is ignored because `codeSplitting: true` is set.");
3875
+ } else if (codeSplitting == null) {
3876
+ if (inlineDynamicImportsOption != null) {
3877
+ warn("`inlineDynamicImports` option is deprecated, please use `codeSplitting: false` instead.");
3878
+ inlineDynamicImports = inlineDynamicImportsOption;
3879
+ }
3880
+ } else {
3881
+ effectiveChunksOption = codeSplitting;
3882
+ chunksOptionName = "codeSplitting";
3883
+ if (inlineDynamicImportsOption != null) warn("`inlineDynamicImports` option is ignored because the `codeSplitting` option is specified.");
3653
3884
  }
3654
- };
3655
- // @__NO_SIDE_EFFECTS__
3656
- function args(schema) {
3657
- return {
3658
- kind: "transformation",
3659
- type: "args",
3660
- reference: args,
3661
- async: false,
3662
- schema,
3663
- "~run"(dataset, config$1) {
3664
- const func = dataset.value;
3665
- dataset.value = (...args_) => {
3666
- const argsDataset = this.schema["~run"]({ value: args_ }, config$1);
3667
- if (argsDataset.issues) throw new ValiError(argsDataset.issues);
3668
- return func(...argsDataset.value);
3669
- };
3670
- return dataset;
3885
+ if (inlineDynamicImports === true && manualChunks != null) throw new Error('Invalid value "true" for option "output.inlineDynamicImports" - this option is not supported for "output.manualChunks".');
3886
+ if (effectiveChunksOption == null) {
3887
+ if (advancedChunks != null) {
3888
+ warn("`advancedChunks` option is deprecated, please use `codeSplitting` instead.");
3889
+ effectiveChunksOption = advancedChunks;
3890
+ chunksOptionName = "advancedChunks";
3671
3891
  }
3892
+ } else if (advancedChunks != null) warn("`advancedChunks` option is ignored because the `codeSplitting` option is specified.");
3893
+ if (manualChunks != null && effectiveChunksOption != null) warn("`manualChunks` option is ignored because the `codeSplitting` option is specified.");
3894
+ else if (manualChunks != null) {
3895
+ chunksOptionName = "manualChunks";
3896
+ migratedManualChunksGroup = { name(moduleId, ctx) {
3897
+ return manualChunks(moduleId, { getModuleInfo: (id2) => ctx.getModuleInfo(id2) });
3898
+ } };
3899
+ effectiveChunksOption = { groups: [migratedManualChunksGroup] };
3900
+ }
3901
+ if (inlineDynamicImports === true && effectiveChunksOption != null) {
3902
+ warn("`advancedChunks` option is ignored because `inlineDynamicImports: true` disables code splitting.");
3903
+ effectiveChunksOption = void 0;
3904
+ }
3905
+ let advancedChunksResult;
3906
+ if (effectiveChunksOption != null) {
3907
+ const { groups, experimentalInlineCommonChunks, ...restOptions } = effectiveChunksOption;
3908
+ let chunkingContext;
3909
+ const getChunkingContext = (bindingContext) => chunkingContext ??= new ChunkingContextImpl(bindingContext, pluginContextData);
3910
+ advancedChunksResult = {
3911
+ ...restOptions,
3912
+ experimentalInlineCommonChunks: experimentalInlineCommonChunks == null ? void 0 : {
3913
+ maxSize: experimentalInlineCommonChunks.maxSize,
3914
+ exclude: experimentalInlineCommonChunks.exclude == null ? void 0 : arraify(experimentalInlineCommonChunks.exclude).map((matcher) => typeof matcher === "function" ? batchTest(measureHookCost(timings, OUTPUT_OPTIONS_OWNER, "codeSplitting.experimentalInlineCommonChunks.exclude", matcher), "output.codeSplitting.experimentalInlineCommonChunks.exclude") : matcher)
3915
+ },
3916
+ internalInvalidateModuleInfoCache: () => {
3917
+ chunkingContext?.clearModuleInfoCache();
3918
+ chunkingContext = void 0;
3919
+ },
3920
+ groups: groups?.map((group, index) => {
3921
+ const { debugName, name, test, ...restGroup } = group;
3922
+ const timingKey = group === migratedManualChunksGroup ? manualChunks ?? group : group;
3923
+ const timingOwner = timings === void 0 ? OUTPUT_OPTIONS_OWNER : {
3924
+ ...OUTPUT_OPTIONS_OWNER,
3925
+ key: timingKey
3926
+ };
3927
+ const groupName = `${chunksOptionName} groups[${index}]`;
3928
+ let testTimingName = `${groupName}.test`;
3929
+ let nameTimingName = `${groupName}.name`;
3930
+ if (timings !== void 0) {
3931
+ if (chunksOptionName === "manualChunks") nameTimingName = "manualChunks";
3932
+ else {
3933
+ const label = debugName ?? (typeof name === "string" ? name : void 0);
3934
+ if (label === void 0) {
3935
+ if (typeof name === "function" && !timings.warnedMissingGroupLabels.has(timingKey)) {
3936
+ timings.warnedMissingGroupLabels.add(timingKey);
3937
+ onLog(LOG_LEVEL_WARN, logMissingCodeSplittingGroupDebugName(`output.${chunksOptionName}.groups[${index}]`));
3938
+ }
3939
+ } else {
3940
+ const labelSuffix = ` ${JSON.stringify(label)}`;
3941
+ testTimingName = `${groupName}.test${labelSuffix}`;
3942
+ nameTimingName = `${groupName}.name${labelSuffix}`;
3943
+ }
3944
+ }
3945
+ }
3946
+ return {
3947
+ ...restGroup,
3948
+ test: typeof test === "function" ? batchTest(measureHookCost(timings, timingOwner, testTimingName, test)) : test,
3949
+ name: typeof name === "function" ? batchName(measureHookCost(timings, timingOwner, nameTimingName, name), getChunkingContext) : name
3950
+ };
3951
+ })
3952
+ };
3953
+ }
3954
+ return {
3955
+ inlineDynamicImports,
3956
+ advancedChunks: advancedChunksResult
3672
3957
  };
3673
3958
  }
3674
- // @__NO_SIDE_EFFECTS__
3675
- function awaitAsync() {
3676
- return {
3677
- kind: "transformation",
3678
- type: "await",
3679
- reference: awaitAsync,
3680
- async: true,
3681
- async "~run"(dataset) {
3682
- dataset.value = await dataset.value;
3683
- return dataset;
3959
+ function batchTest(test, optionName = "output.codeSplitting.groups[].test") {
3960
+ return (ids) => {
3961
+ const results = new Uint8Array(ids.length);
3962
+ for (let index = 0; index < ids.length; index++) {
3963
+ const result = test(ids[index]);
3964
+ if (result != null && typeof result !== "boolean") throw new TypeError(`\`${optionName}\` returned ${typeof result} for module "${ids[index]}", but expected a boolean, null or undefined.`);
3965
+ results[index] = result === true ? 1 : 0;
3684
3966
  }
3967
+ return results;
3685
3968
  };
3686
3969
  }
3687
- // @__NO_SIDE_EFFECTS__
3688
- function check(requirement, message$1) {
3689
- return {
3690
- kind: "validation",
3691
- type: "check",
3692
- reference: check,
3693
- async: false,
3694
- expects: null,
3695
- requirement,
3696
- message: message$1,
3697
- "~run"(dataset, config$1) {
3698
- if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "input", dataset, config$1);
3699
- return dataset;
3970
+ function batchName(name, getChunkingContext) {
3971
+ return (ids, bindingContext) => {
3972
+ const context = getChunkingContext(bindingContext);
3973
+ const results = [];
3974
+ for (let index = 0; index < ids.length; index++) {
3975
+ const result = name(ids[index], context);
3976
+ if (result != null && typeof result !== "string") throw new TypeError(`\`output.codeSplitting.groups[].name\` returned ${typeof result} for module "${ids[index]}", but expected a string, null or undefined.`);
3977
+ results.push(result);
3700
3978
  }
3979
+ return results;
3701
3980
  };
3702
3981
  }
3703
- // @__NO_SIDE_EFFECTS__
3704
- function description(description_) {
3705
- return {
3706
- kind: "metadata",
3707
- type: "description",
3708
- reference: description,
3709
- description: description_
3982
+ function batchSourcemapIgnoreList(ignoreList) {
3983
+ if (typeof ignoreList !== "function") return ignoreList;
3984
+ return (sources, sourcemapPath) => {
3985
+ const results = new Uint8Array(sources.length);
3986
+ for (let index = 0; index < sources.length; index++) {
3987
+ const result = ignoreList(sources[index], sourcemapPath);
3988
+ if (typeof result !== "boolean") throw new TypeError(`\`output.sourcemapIgnoreList\` returned ${typeof result} for source "${sources[index]}", but expected a boolean.`);
3989
+ results[index] = result ? 1 : 0;
3990
+ }
3991
+ return results;
3710
3992
  };
3711
3993
  }
3712
- // @__NO_SIDE_EFFECTS__
3713
- function returns(schema) {
3714
- return {
3715
- kind: "transformation",
3716
- type: "returns",
3717
- reference: returns,
3718
- async: false,
3719
- schema,
3720
- "~run"(dataset, config$1) {
3721
- const func = dataset.value;
3722
- dataset.value = (...args_) => {
3723
- const returnsDataset = this.schema["~run"]({ value: func(...args_) }, config$1);
3724
- if (returnsDataset.issues) throw new ValiError(returnsDataset.issues);
3725
- return returnsDataset.value;
3726
- };
3727
- return dataset;
3994
+ function batchSourcemapPathTransform(pathTransform) {
3995
+ if (typeof pathTransform !== "function") return pathTransform;
3996
+ return (sources, sourcemapPath) => {
3997
+ const results = [];
3998
+ for (let index = 0; index < sources.length; index++) {
3999
+ const result = pathTransform(sources[index], sourcemapPath);
4000
+ if (typeof result !== "string") throw new TypeError(`\`output.sourcemapPathTransform\` returned ${typeof result} for source "${sources[index]}", but expected a string.`);
4001
+ results.push(result);
3728
4002
  }
4003
+ return results;
3729
4004
  };
3730
4005
  }
3731
- // @__NO_SIDE_EFFECTS__
3732
- function returnsAsync(schema) {
3733
- return {
3734
- kind: "transformation",
3735
- type: "returns",
3736
- reference: returnsAsync,
3737
- async: false,
3738
- schema,
3739
- "~run"(dataset, config$1) {
3740
- const func = dataset.value;
3741
- dataset.value = async (...args_) => {
3742
- const returnsDataset = await this.schema["~run"]({ value: await func(...args_) }, config$1);
3743
- if (returnsDataset.issues) throw new ValiError(returnsDataset.issues);
3744
- return returnsDataset.value;
3745
- };
3746
- return dataset;
4006
+ var import_binding4 = /* @__PURE__ */ __toESM(require_binding(), 1);
4007
+ async function initializeParallelPlugins(plugins) {
4008
+ const pluginInfos = [];
4009
+ for (const [index, plugin] of plugins.entries()) {
4010
+ const parallel = getParallelPluginInfo(plugin);
4011
+ if (parallel) {
4012
+ const { fileUrl, options } = parallel;
4013
+ pluginInfos.push({
4014
+ index,
4015
+ fileUrl,
4016
+ options
4017
+ });
3747
4018
  }
4019
+ }
4020
+ if (pluginInfos.length <= 0) return;
4021
+ const count = availableParallelism();
4022
+ const parallelJsPluginRegistry = new import_binding4.ParallelJsPluginRegistry(count);
4023
+ const registryId = parallelJsPluginRegistry.id;
4024
+ const workers = await initializeWorkers(registryId, count, pluginInfos);
4025
+ const stopWorkers = async () => {
4026
+ await Promise.all(workers.map((worker) => worker.terminate()));
4027
+ };
4028
+ return {
4029
+ registry: parallelJsPluginRegistry,
4030
+ stopWorkers
3748
4031
  };
3749
4032
  }
3750
- var ABORT_EARLY_CONFIG = { abortEarly: true };
3751
- // @__NO_SIDE_EFFECTS__
3752
- function getFallback(schema, dataset, config$1) {
3753
- return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
4033
+ function initializeWorkers(registryId, count, pluginInfos) {
4034
+ return Promise.all(Array.from({ length: count }, (_, i) => initializeWorker(registryId, pluginInfos, i)));
3754
4035
  }
3755
- // @__NO_SIDE_EFFECTS__
3756
- function getDefault(schema, dataset, config$1) {
3757
- return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
4036
+ async function initializeWorker(registryId, pluginInfos, threadNumber) {
4037
+ const urlString = import.meta.resolve("#parallel-plugin-worker");
4038
+ const workerData = {
4039
+ registryId,
4040
+ pluginInfos,
4041
+ threadNumber
4042
+ };
4043
+ let worker;
4044
+ try {
4045
+ worker = new Worker(new URL(urlString), { workerData });
4046
+ worker.unref();
4047
+ await new Promise((resolve, reject) => {
4048
+ worker.once("message", async (message) => {
4049
+ if (message.type === "error") reject(message.error);
4050
+ else resolve();
4051
+ });
4052
+ });
4053
+ return worker;
4054
+ } catch (e) {
4055
+ worker?.terminate();
4056
+ throw e;
4057
+ }
3758
4058
  }
3759
- // @__NO_SIDE_EFFECTS__
3760
- function is(schema, input) {
3761
- return !schema["~run"]({ value: input }, ABORT_EARLY_CONFIG).issues;
4059
+ var availableParallelism = () => {
4060
+ let availableParallelism2 = 1;
4061
+ try {
4062
+ availableParallelism2 = os.availableParallelism();
4063
+ } catch {
4064
+ const cpus = os.cpus();
4065
+ if (Array.isArray(cpus) && cpus.length > 0) availableParallelism2 = cpus.length;
4066
+ }
4067
+ return Math.min(availableParallelism2, 8);
4068
+ };
4069
+ async function createBundlerOptions(inputOptions, outputOptions, watchMode, measureTimings = false) {
4070
+ const inputPlugins = await normalizePluginOption(inputOptions.plugins);
4071
+ const outputPlugins = await normalizePluginOption(outputOptions.plugins);
4072
+ const logLevel = inputOptions.logLevel || "info";
4073
+ const onLog = getLogger(getObjectPlugins(inputPlugins), getOnLog(inputOptions, logLevel), logLevel, watchMode);
4074
+ outputOptions = PluginDriver.callOutputOptionsHook([...inputPlugins, ...outputPlugins], outputOptions, onLog, logLevel, watchMode);
4075
+ const hookOutputPlugins = await normalizePluginOption(outputOptions.plugins);
4076
+ const normalizedInputPlugins = normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX);
4077
+ const normalizedOutputPlugins = normalizePlugins(hookOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX);
4078
+ let plugins = [...normalizedInputPlugins, ...checkOutputPluginOption(normalizedOutputPlugins, onLog)];
4079
+ const timings = measureTimings && (inputOptions.checks?.bundlerTimings ?? inputOptions.checks?.pluginTimings ?? true) ? pluginTimingsRecorderFor(inputOptions) : void 0;
4080
+ if (timings) outputOptions = {
4081
+ ...outputOptions,
4082
+ assetFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "assetFileNames", outputOptions.assetFileNames),
4083
+ sanitizeFileName: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sanitizeFileName", outputOptions.sanitizeFileName)
4084
+ };
4085
+ const parallelPluginInitResult = await initializeParallelPlugins(plugins);
4086
+ if (inputOptions.experimental?.strictExecutionOrder !== void 0) console.warn("`experimental.strictExecutionOrder` has been stabilized and moved to `output.strictExecutionOrder`. Please update your configuration.");
4087
+ try {
4088
+ const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedInputPlugins, normalizedOutputPlugins);
4089
+ pluginContextData.importAttributes = inputOptions.experimental?.importAttributes ?? false;
4090
+ return {
4091
+ bundlerOptions: {
4092
+ inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings),
4093
+ outputOptions: await bindingifyOutputOptions(outputOptions, pluginContextData, onLog, timings),
4094
+ parallelPluginsRegistry: parallelPluginInitResult?.registry
4095
+ },
4096
+ inputOptions,
4097
+ onLog,
4098
+ stopWorkers: parallelPluginInitResult?.stopWorkers
4099
+ };
4100
+ } catch (e) {
4101
+ await parallelPluginInitResult?.stopWorkers();
4102
+ throw e;
4103
+ }
3762
4104
  }
3763
- // @__NO_SIDE_EFFECTS__
3764
- function any() {
3765
- return _standardSchema({
3766
- kind: "schema",
3767
- type: "any",
3768
- reference: any,
3769
- expects: "any",
3770
- async: false,
3771
- "~run"(dataset) {
3772
- dataset.typed = true;
3773
- return dataset;
4105
+
4106
+ // node_modules/.pnpm/rolldown@1.3.2/node_modules/rolldown/dist/shared/watch-BTydJGPk.mjs
4107
+ var signals = [];
4108
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
4109
+ if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
4110
+ if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
4111
+ var processOk = (process2) => !!process2 && typeof process2 === "object" && typeof process2.removeListener === "function" && typeof process2.emit === "function" && typeof process2.reallyExit === "function" && typeof process2.listeners === "function" && typeof process2.kill === "function" && typeof process2.pid === "number" && typeof process2.on === "function";
4112
+ var kExitEmitter = /* @__PURE__ */ Symbol.for("signal-exit emitter");
4113
+ var global = globalThis;
4114
+ var ObjectDefineProperty = Object.defineProperty.bind(Object);
4115
+ var Emitter = class {
4116
+ emitted = {
4117
+ afterExit: false,
4118
+ exit: false
4119
+ };
4120
+ listeners = {
4121
+ afterExit: [],
4122
+ exit: []
4123
+ };
4124
+ count = 0;
4125
+ id = Math.random();
4126
+ constructor() {
4127
+ if (global[kExitEmitter]) return global[kExitEmitter];
4128
+ ObjectDefineProperty(global, kExitEmitter, {
4129
+ value: this,
4130
+ writable: false,
4131
+ enumerable: false,
4132
+ configurable: false
4133
+ });
4134
+ }
4135
+ on(ev, fn) {
4136
+ this.listeners[ev].push(fn);
4137
+ }
4138
+ removeListener(ev, fn) {
4139
+ const list = this.listeners[ev];
4140
+ const i = list.indexOf(fn);
4141
+ if (i === -1) return;
4142
+ if (i === 0 && list.length === 1) list.length = 0;
4143
+ else list.splice(i, 1);
4144
+ }
4145
+ emit(ev, code2, signal) {
4146
+ if (this.emitted[ev]) return false;
4147
+ this.emitted[ev] = true;
4148
+ let ret = false;
4149
+ for (const fn of this.listeners[ev]) ret = fn(code2, signal) === true || ret;
4150
+ if (ev === "exit") ret = this.emit("afterExit", code2, signal) || ret;
4151
+ return ret;
4152
+ }
4153
+ };
4154
+ var SignalExitBase = class {
4155
+ };
4156
+ var signalExitWrap = (handler) => {
4157
+ return {
4158
+ onExit(cb, opts) {
4159
+ return handler.onExit(cb, opts);
4160
+ },
4161
+ load() {
4162
+ return handler.load();
4163
+ },
4164
+ unload() {
4165
+ return handler.unload();
3774
4166
  }
3775
- });
3776
- }
3777
- // @__NO_SIDE_EFFECTS__
3778
- function array(item, message$1) {
3779
- return _standardSchema({
3780
- kind: "schema",
3781
- type: "array",
3782
- reference: array,
3783
- expects: "Array",
3784
- async: false,
3785
- item,
3786
- message: message$1,
3787
- "~run"(dataset, config$1) {
3788
- const input = dataset.value;
3789
- if (Array.isArray(input)) {
3790
- dataset.typed = true;
3791
- dataset.value = [];
3792
- for (let key = 0; key < input.length; key++) {
3793
- const value$1 = input[key];
3794
- const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
3795
- if (itemDataset.issues) {
3796
- const pathItem = {
3797
- type: "array",
3798
- origin: "value",
3799
- input,
3800
- key,
3801
- value: value$1
3802
- };
3803
- for (const issue of itemDataset.issues) {
3804
- if (issue.path) issue.path.unshift(pathItem);
3805
- else issue.path = [pathItem];
3806
- dataset.issues?.push(issue);
3807
- }
3808
- if (!dataset.issues) dataset.issues = itemDataset.issues;
3809
- if (config$1.abortEarly) {
3810
- dataset.typed = false;
3811
- break;
3812
- }
3813
- }
3814
- if (!itemDataset.typed) dataset.typed = false;
3815
- dataset.value.push(itemDataset.value);
3816
- }
3817
- } else _addIssue(this, "type", dataset, config$1);
3818
- return dataset;
4167
+ };
4168
+ };
4169
+ var SignalExitFallback = class extends SignalExitBase {
4170
+ onExit() {
4171
+ return () => {
4172
+ };
4173
+ }
4174
+ load() {
4175
+ }
4176
+ unload() {
4177
+ }
4178
+ };
4179
+ var SignalExit = class extends SignalExitBase {
4180
+ /* c8 ignore start */
4181
+ #hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
4182
+ /* c8 ignore stop */
4183
+ #emitter = new Emitter();
4184
+ #process;
4185
+ #originalProcessEmit;
4186
+ #originalProcessReallyExit;
4187
+ #sigListeners = {};
4188
+ #loaded = false;
4189
+ constructor(process2) {
4190
+ super();
4191
+ this.#process = process2;
4192
+ this.#sigListeners = {};
4193
+ for (const sig of signals) this.#sigListeners[sig] = () => {
4194
+ const listeners = this.#process.listeners(sig);
4195
+ let { count } = this.#emitter;
4196
+ const p = process2;
4197
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
4198
+ if (listeners.length === count) {
4199
+ this.unload();
4200
+ const ret = this.#emitter.emit("exit", null, sig);
4201
+ const s = sig === "SIGHUP" ? this.#hupSig : sig;
4202
+ if (!ret) process2.kill(process2.pid, s);
4203
+ }
4204
+ };
4205
+ this.#originalProcessReallyExit = process2.reallyExit;
4206
+ this.#originalProcessEmit = process2.emit;
4207
+ }
4208
+ onExit(cb, opts) {
4209
+ if (!processOk(this.#process)) return () => {
4210
+ };
4211
+ if (this.#loaded === false) this.load();
4212
+ const ev = opts?.alwaysLast ? "afterExit" : "exit";
4213
+ this.#emitter.on(ev, cb);
4214
+ return () => {
4215
+ this.#emitter.removeListener(ev, cb);
4216
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
4217
+ };
4218
+ }
4219
+ load() {
4220
+ if (this.#loaded) return;
4221
+ this.#loaded = true;
4222
+ this.#emitter.count += 1;
4223
+ for (const sig of signals) try {
4224
+ const fn = this.#sigListeners[sig];
4225
+ if (fn) this.#process.on(sig, fn);
4226
+ } catch (_) {
3819
4227
  }
3820
- });
4228
+ this.#process.emit = (ev, ...a) => {
4229
+ return this.#processEmit(ev, ...a);
4230
+ };
4231
+ this.#process.reallyExit = (code2) => {
4232
+ return this.#processReallyExit(code2);
4233
+ };
4234
+ }
4235
+ unload() {
4236
+ if (!this.#loaded) return;
4237
+ this.#loaded = false;
4238
+ signals.forEach((sig) => {
4239
+ const listener = this.#sigListeners[sig];
4240
+ if (!listener) throw new Error("Listener not defined for signal: " + sig);
4241
+ try {
4242
+ this.#process.removeListener(sig, listener);
4243
+ } catch (_) {
4244
+ }
4245
+ });
4246
+ this.#process.emit = this.#originalProcessEmit;
4247
+ this.#process.reallyExit = this.#originalProcessReallyExit;
4248
+ this.#emitter.count -= 1;
4249
+ }
4250
+ #processReallyExit(code2) {
4251
+ if (!processOk(this.#process)) return 0;
4252
+ this.#process.exitCode = code2 || 0;
4253
+ this.#emitter.emit("exit", this.#process.exitCode, null);
4254
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
4255
+ }
4256
+ #processEmit(ev, ...args2) {
4257
+ const og = this.#originalProcessEmit;
4258
+ if (ev === "exit" && processOk(this.#process)) {
4259
+ if (typeof args2[0] === "number") this.#process.exitCode = args2[0];
4260
+ const ret = og.call(this.#process, ev, ...args2);
4261
+ this.#emitter.emit("exit", this.#process.exitCode, null);
4262
+ return ret;
4263
+ } else return og.call(this.#process, ev, ...args2);
4264
+ }
4265
+ };
4266
+ var process$1 = globalThis.process;
4267
+ var { onExit: onExit$1, load, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
4268
+ function onExit(...args2) {
4269
+ if (typeof process === "object" && process.versions.webcontainer) {
4270
+ process.on("exit", (code2) => {
4271
+ args2[0](code2, null);
4272
+ });
4273
+ return;
4274
+ }
4275
+ onExit$1(...args2);
3821
4276
  }
3822
- // @__NO_SIDE_EFFECTS__
3823
- function boolean(message$1) {
3824
- return _standardSchema({
3825
- kind: "schema",
3826
- type: "boolean",
3827
- reference: boolean,
3828
- expects: "boolean",
3829
- async: false,
3830
- message: message$1,
3831
- "~run"(dataset, config$1) {
3832
- if (typeof dataset.value === "boolean") dataset.typed = true;
3833
- else _addIssue(this, "type", dataset, config$1);
3834
- return dataset;
4277
+ var WatcherEmitter = class {
4278
+ listeners = /* @__PURE__ */ new Map();
4279
+ on(event, listener) {
4280
+ const listeners = this.listeners.get(event);
4281
+ if (listeners) listeners.push(listener);
4282
+ else this.listeners.set(event, [listener]);
4283
+ return this;
4284
+ }
4285
+ off(event, listener) {
4286
+ const listeners = this.listeners.get(event);
4287
+ if (listeners) {
4288
+ const index = listeners.indexOf(listener);
4289
+ if (index !== -1) listeners.splice(index, 1);
3835
4290
  }
3836
- });
3837
- }
3838
- // @__NO_SIDE_EFFECTS__
3839
- function custom(check$1, message$1) {
3840
- return _standardSchema({
3841
- kind: "schema",
3842
- type: "custom",
3843
- reference: custom,
3844
- expects: "unknown",
3845
- async: false,
3846
- check: check$1,
3847
- message: message$1,
3848
- "~run"(dataset, config$1) {
3849
- if (this.check(dataset.value)) dataset.typed = true;
3850
- else _addIssue(this, "type", dataset, config$1);
3851
- return dataset;
4291
+ return this;
4292
+ }
4293
+ clear(event) {
4294
+ this.listeners.delete(event);
4295
+ }
4296
+ /** Async emit — sequential dispatch so side effects from earlier handlers
4297
+ * (e.g. `event.result.close()` triggering `closeBundle`) are visible to later handlers. */
4298
+ async emit(event, ...args2) {
4299
+ const handlers = this.listeners.get(event);
4300
+ if (handlers?.length) for (const h of handlers) await h(...args2);
4301
+ }
4302
+ async close() {
4303
+ }
4304
+ };
4305
+ var import_binding5 = /* @__PURE__ */ __toESM(require_binding(), 1);
4306
+ function createEventCallback(emitter) {
4307
+ return async (event) => {
4308
+ switch (event.eventKind()) {
4309
+ case "event": {
4310
+ const code2 = event.bundleEventKind();
4311
+ if (code2 === "BUNDLE_END") {
4312
+ const { duration, output, result } = event.bundleEndData();
4313
+ await emitter.emit("event", {
4314
+ code: "BUNDLE_END",
4315
+ duration,
4316
+ output: [output],
4317
+ result
4318
+ });
4319
+ } else if (code2 === "ERROR") {
4320
+ const data = event.bundleErrorData();
4321
+ await emitter.emit("event", {
4322
+ code: "ERROR",
4323
+ error: aggregateBindingErrorsIntoJsError(data.error),
4324
+ result: data.result
4325
+ });
4326
+ } else await emitter.emit("event", { code: code2 });
4327
+ break;
4328
+ }
4329
+ case "change": {
4330
+ const { path: path3, kind } = event.watchChangeData();
4331
+ await emitter.emit("change", path3, { event: kind });
4332
+ break;
4333
+ }
4334
+ case "restart":
4335
+ await emitter.emit("restart");
4336
+ break;
4337
+ case "close":
4338
+ await emitter.emit("close");
3852
4339
  }
3853
- });
4340
+ };
3854
4341
  }
3855
- // @__NO_SIDE_EFFECTS__
3856
- function function_(message$1) {
3857
- return _standardSchema({
3858
- kind: "schema",
3859
- type: "function",
3860
- reference: function_,
3861
- expects: "Function",
3862
- async: false,
3863
- message: message$1,
3864
- "~run"(dataset, config$1) {
3865
- if (typeof dataset.value === "function") dataset.typed = true;
3866
- else _addIssue(this, "type", dataset, config$1);
3867
- return dataset;
4342
+ var Watcher = class {
4343
+ closed;
4344
+ inner;
4345
+ emitter;
4346
+ stopWorkers;
4347
+ constructor(emitter, inner, stopWorkers) {
4348
+ this.closed = false;
4349
+ this.inner = inner;
4350
+ this.emitter = emitter;
4351
+ (0, import_binding5.startAsyncRuntime)();
4352
+ const originClose = emitter.close.bind(emitter);
4353
+ emitter.close = async () => {
4354
+ await this.close();
4355
+ originClose();
4356
+ };
4357
+ this.stopWorkers = stopWorkers;
4358
+ process.nextTick(() => this.run());
4359
+ }
4360
+ async close() {
4361
+ if (this.closed) return;
4362
+ this.closed = true;
4363
+ try {
4364
+ for (const stop of this.stopWorkers) await stop?.();
4365
+ await this.inner.close();
4366
+ } finally {
4367
+ (0, import_binding5.shutdownAsyncRuntime)();
3868
4368
  }
3869
- });
4369
+ }
4370
+ async run() {
4371
+ await this.inner.run();
4372
+ this.inner.waitForClose();
4373
+ }
4374
+ };
4375
+ async function createWatcher(emitter, input) {
4376
+ const options = arraify(input);
4377
+ const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
4378
+ const inputOptions = await PluginDriver.callOptionsHook(option, true);
4379
+ return createBundlerOptions(inputOptions, output, true);
4380
+ })).flat());
4381
+ const callback = createEventCallback(emitter);
4382
+ new Watcher(emitter, new import_binding5.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), callback), bundlerOptions.map((option) => option.stopWorkers));
4383
+ }
4384
+ function watch(input) {
4385
+ const emitter = new WatcherEmitter();
4386
+ createWatcher(emitter, input);
4387
+ return emitter;
3870
4388
  }
4389
+
4390
+ // node_modules/.pnpm/rolldown@1.3.2/node_modules/rolldown/dist/shared/validator-BujYoC8g.mjs
4391
+ import { styleText as styleText$1 } from "node:util";
4392
+ var DEFAULT_CONFIG = {
4393
+ lang: void 0,
4394
+ message: void 0,
4395
+ abortEarly: void 0,
4396
+ abortPipeEarly: void 0
4397
+ };
3871
4398
  // @__NO_SIDE_EFFECTS__
3872
- function instance(class_, message$1) {
3873
- return _standardSchema({
3874
- kind: "schema",
3875
- type: "instance",
3876
- reference: instance,
3877
- expects: class_.name,
4399
+ function getGlobalConfig(config$1) {
4400
+ if (!config$1 && true) return DEFAULT_CONFIG;
4401
+ return {
4402
+ lang: config$1?.lang ?? void 0,
4403
+ message: config$1?.message,
4404
+ abortEarly: config$1?.abortEarly ?? void 0,
4405
+ abortPipeEarly: config$1?.abortPipeEarly ?? void 0
4406
+ };
4407
+ }
4408
+ // @__NO_SIDE_EFFECTS__
4409
+ function _stringify(input) {
4410
+ const type = typeof input;
4411
+ if (type === "string") return `"${input}"`;
4412
+ if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
4413
+ if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
4414
+ return type;
4415
+ }
4416
+ function _addIssue(context, label, dataset, config$1, other) {
4417
+ const input = other && "input" in other ? other.input : dataset.value;
4418
+ const expected = other?.expected ?? context.expects ?? null;
4419
+ const received = other?.received ?? /* @__PURE__ */ _stringify(input);
4420
+ const issue = {
4421
+ kind: context.kind,
4422
+ type: context.type,
4423
+ input,
4424
+ expected,
4425
+ received,
4426
+ message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
4427
+ requirement: context.requirement,
4428
+ path: other?.path,
4429
+ issues: other?.issues,
4430
+ lang: config$1.lang,
4431
+ abortEarly: config$1.abortEarly,
4432
+ abortPipeEarly: config$1.abortPipeEarly
4433
+ };
4434
+ const isSchema = context.kind === "schema";
4435
+ const message$1 = other?.message ?? context.message ?? (context.reference, issue.lang, void 0) ?? (isSchema ? (issue.lang, void 0) : null) ?? config$1.message ?? (issue.lang, void 0);
4436
+ if (message$1 !== void 0) issue.message = typeof message$1 === "function" ? message$1(issue) : message$1;
4437
+ if (isSchema) dataset.typed = false;
4438
+ if (dataset.issues) dataset.issues.push(issue);
4439
+ else dataset.issues = [issue];
4440
+ }
4441
+ // @__NO_SIDE_EFFECTS__
4442
+ function _isSameValueZero(value1, value2) {
4443
+ return value1 === value2 || Number.isNaN(value1) && Number.isNaN(value2);
4444
+ }
4445
+ // @__NO_SIDE_EFFECTS__
4446
+ function _isValidObjectKey(object$1, key) {
4447
+ return Object.prototype.hasOwnProperty.call(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
4448
+ }
4449
+ // @__NO_SIDE_EFFECTS__
4450
+ function _joinExpects(values$1, separator) {
4451
+ const list = [...new Set(values$1)];
4452
+ if (list.length > 1) return `(${list.join(` ${separator} `)})`;
4453
+ return list[0] ?? "never";
4454
+ }
4455
+ function _standardSchema(schema) {
4456
+ schema["~standard"] = {
4457
+ version: 1,
4458
+ vendor: "valibot",
4459
+ validate: (value$1) => schema["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig())
4460
+ };
4461
+ return schema;
4462
+ }
4463
+ var ValiError = class extends Error {
4464
+ /**
4465
+ * Creates a Valibot error with useful information.
4466
+ *
4467
+ * @param issues The error issues.
4468
+ */
4469
+ constructor(issues) {
4470
+ super(issues[0].message);
4471
+ this.name = "ValiError";
4472
+ this.issues = issues;
4473
+ }
4474
+ };
4475
+ // @__NO_SIDE_EFFECTS__
4476
+ function args(schema) {
4477
+ return {
4478
+ kind: "transformation",
4479
+ type: "args",
4480
+ reference: args,
3878
4481
  async: false,
3879
- class: class_,
3880
- message: message$1,
4482
+ schema,
3881
4483
  "~run"(dataset, config$1) {
3882
- if (dataset.value instanceof this.class) dataset.typed = true;
3883
- else _addIssue(this, "type", dataset, config$1);
4484
+ const func = dataset.value;
4485
+ dataset.value = (...args_) => {
4486
+ const argsDataset = this.schema["~run"]({ value: args_ }, config$1);
4487
+ if (argsDataset.issues) throw new ValiError(argsDataset.issues);
4488
+ return func(...argsDataset.value);
4489
+ };
3884
4490
  return dataset;
3885
4491
  }
3886
- });
4492
+ };
3887
4493
  }
3888
4494
  // @__NO_SIDE_EFFECTS__
3889
- function literal(literal_, message$1) {
3890
- return _standardSchema({
3891
- kind: "schema",
3892
- type: "literal",
3893
- reference: literal,
3894
- expects: /* @__PURE__ */ _stringify(literal_),
4495
+ function awaitAsync() {
4496
+ return {
4497
+ kind: "transformation",
4498
+ type: "await",
4499
+ reference: awaitAsync,
4500
+ async: true,
4501
+ async "~run"(dataset) {
4502
+ dataset.value = await dataset.value;
4503
+ return dataset;
4504
+ }
4505
+ };
4506
+ }
4507
+ // @__NO_SIDE_EFFECTS__
4508
+ function check(requirement, message$1) {
4509
+ return {
4510
+ kind: "validation",
4511
+ type: "check",
4512
+ reference: check,
3895
4513
  async: false,
3896
- literal: literal_,
4514
+ expects: null,
4515
+ requirement,
3897
4516
  message: message$1,
3898
4517
  "~run"(dataset, config$1) {
3899
- if (/* @__PURE__ */ _isSameValueZero(dataset.value, this.literal)) dataset.typed = true;
3900
- else _addIssue(this, "type", dataset, config$1);
4518
+ if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "input", dataset, config$1);
3901
4519
  return dataset;
3902
4520
  }
3903
- });
4521
+ };
3904
4522
  }
3905
4523
  // @__NO_SIDE_EFFECTS__
3906
- function never(message$1) {
3907
- return _standardSchema({
3908
- kind: "schema",
3909
- type: "never",
3910
- reference: never,
3911
- expects: "never",
4524
+ function description(description_) {
4525
+ return {
4526
+ kind: "metadata",
4527
+ type: "description",
4528
+ reference: description,
4529
+ description: description_
4530
+ };
4531
+ }
4532
+ // @__NO_SIDE_EFFECTS__
4533
+ function returns(schema) {
4534
+ return {
4535
+ kind: "transformation",
4536
+ type: "returns",
4537
+ reference: returns,
3912
4538
  async: false,
3913
- message: message$1,
4539
+ schema,
3914
4540
  "~run"(dataset, config$1) {
3915
- _addIssue(this, "type", dataset, config$1);
4541
+ const func = dataset.value;
4542
+ dataset.value = (...args_) => {
4543
+ const returnsDataset = this.schema["~run"]({ value: func(...args_) }, config$1);
4544
+ if (returnsDataset.issues) throw new ValiError(returnsDataset.issues);
4545
+ return returnsDataset.value;
4546
+ };
3916
4547
  return dataset;
3917
4548
  }
3918
- });
4549
+ };
3919
4550
  }
3920
4551
  // @__NO_SIDE_EFFECTS__
3921
- function nullish(wrapped, default_) {
3922
- return _standardSchema({
3923
- kind: "schema",
3924
- type: "nullish",
3925
- reference: nullish,
3926
- expects: `(${wrapped.expects} | null | undefined)`,
4552
+ function returnsAsync(schema) {
4553
+ return {
4554
+ kind: "transformation",
4555
+ type: "returns",
4556
+ reference: returnsAsync,
3927
4557
  async: false,
3928
- wrapped,
3929
- default: default_,
4558
+ schema,
3930
4559
  "~run"(dataset, config$1) {
3931
- if (dataset.value === null || dataset.value === void 0) {
3932
- if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
3933
- if (dataset.value === null || dataset.value === void 0) {
3934
- dataset.typed = true;
3935
- return dataset;
3936
- }
3937
- }
3938
- return this.wrapped["~run"](dataset, config$1);
4560
+ const func = dataset.value;
4561
+ dataset.value = async (...args_) => {
4562
+ const returnsDataset = await this.schema["~run"]({ value: await func(...args_) }, config$1);
4563
+ if (returnsDataset.issues) throw new ValiError(returnsDataset.issues);
4564
+ return returnsDataset.value;
4565
+ };
4566
+ return dataset;
3939
4567
  }
3940
- });
4568
+ };
3941
4569
  }
4570
+ var ABORT_EARLY_CONFIG = { abortEarly: true };
3942
4571
  // @__NO_SIDE_EFFECTS__
3943
- function number(message$1) {
4572
+ function getFallback(schema, dataset, config$1) {
4573
+ return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
4574
+ }
4575
+ // @__NO_SIDE_EFFECTS__
4576
+ function getDefault(schema, dataset, config$1) {
4577
+ return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
4578
+ }
4579
+ // @__NO_SIDE_EFFECTS__
4580
+ function is(schema, input) {
4581
+ return !schema["~run"]({ value: input }, ABORT_EARLY_CONFIG).issues;
4582
+ }
4583
+ // @__NO_SIDE_EFFECTS__
4584
+ function any() {
3944
4585
  return _standardSchema({
3945
4586
  kind: "schema",
3946
- type: "number",
3947
- reference: number,
3948
- expects: "number",
4587
+ type: "any",
4588
+ reference: any,
4589
+ expects: "any",
3949
4590
  async: false,
3950
- message: message$1,
3951
- "~run"(dataset, config$1) {
3952
- if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
3953
- else _addIssue(this, "type", dataset, config$1);
4591
+ "~run"(dataset) {
4592
+ dataset.typed = true;
3954
4593
  return dataset;
3955
4594
  }
3956
4595
  });
3957
4596
  }
3958
4597
  // @__NO_SIDE_EFFECTS__
3959
- function object(entries$1, message$1) {
4598
+ function array(item, message$1) {
3960
4599
  return _standardSchema({
3961
4600
  kind: "schema",
3962
- type: "object",
3963
- reference: object,
3964
- expects: "Object",
3965
- async: false,
3966
- entries: entries$1,
4601
+ type: "array",
4602
+ reference: array,
4603
+ expects: "Array",
4604
+ async: false,
4605
+ item,
4606
+ message: message$1,
4607
+ "~run"(dataset, config$1) {
4608
+ const input = dataset.value;
4609
+ if (Array.isArray(input)) {
4610
+ dataset.typed = true;
4611
+ dataset.value = [];
4612
+ for (let key = 0; key < input.length; key++) {
4613
+ const value$1 = input[key];
4614
+ const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
4615
+ if (itemDataset.issues) {
4616
+ const pathItem = {
4617
+ type: "array",
4618
+ origin: "value",
4619
+ input,
4620
+ key,
4621
+ value: value$1
4622
+ };
4623
+ for (const issue of itemDataset.issues) {
4624
+ if (issue.path) issue.path.unshift(pathItem);
4625
+ else issue.path = [pathItem];
4626
+ dataset.issues?.push(issue);
4627
+ }
4628
+ if (!dataset.issues) dataset.issues = itemDataset.issues;
4629
+ if (config$1.abortEarly) {
4630
+ dataset.typed = false;
4631
+ break;
4632
+ }
4633
+ }
4634
+ if (!itemDataset.typed) dataset.typed = false;
4635
+ dataset.value.push(itemDataset.value);
4636
+ }
4637
+ } else _addIssue(this, "type", dataset, config$1);
4638
+ return dataset;
4639
+ }
4640
+ });
4641
+ }
4642
+ // @__NO_SIDE_EFFECTS__
4643
+ function boolean(message$1) {
4644
+ return _standardSchema({
4645
+ kind: "schema",
4646
+ type: "boolean",
4647
+ reference: boolean,
4648
+ expects: "boolean",
4649
+ async: false,
4650
+ message: message$1,
4651
+ "~run"(dataset, config$1) {
4652
+ if (typeof dataset.value === "boolean") dataset.typed = true;
4653
+ else _addIssue(this, "type", dataset, config$1);
4654
+ return dataset;
4655
+ }
4656
+ });
4657
+ }
4658
+ // @__NO_SIDE_EFFECTS__
4659
+ function custom(check$1, message$1) {
4660
+ return _standardSchema({
4661
+ kind: "schema",
4662
+ type: "custom",
4663
+ reference: custom,
4664
+ expects: "unknown",
4665
+ async: false,
4666
+ check: check$1,
4667
+ message: message$1,
4668
+ "~run"(dataset, config$1) {
4669
+ if (this.check(dataset.value)) dataset.typed = true;
4670
+ else _addIssue(this, "type", dataset, config$1);
4671
+ return dataset;
4672
+ }
4673
+ });
4674
+ }
4675
+ // @__NO_SIDE_EFFECTS__
4676
+ function function_(message$1) {
4677
+ return _standardSchema({
4678
+ kind: "schema",
4679
+ type: "function",
4680
+ reference: function_,
4681
+ expects: "Function",
4682
+ async: false,
4683
+ message: message$1,
4684
+ "~run"(dataset, config$1) {
4685
+ if (typeof dataset.value === "function") dataset.typed = true;
4686
+ else _addIssue(this, "type", dataset, config$1);
4687
+ return dataset;
4688
+ }
4689
+ });
4690
+ }
4691
+ // @__NO_SIDE_EFFECTS__
4692
+ function instance(class_, message$1) {
4693
+ return _standardSchema({
4694
+ kind: "schema",
4695
+ type: "instance",
4696
+ reference: instance,
4697
+ expects: class_.name,
4698
+ async: false,
4699
+ class: class_,
4700
+ message: message$1,
4701
+ "~run"(dataset, config$1) {
4702
+ if (dataset.value instanceof this.class) dataset.typed = true;
4703
+ else _addIssue(this, "type", dataset, config$1);
4704
+ return dataset;
4705
+ }
4706
+ });
4707
+ }
4708
+ // @__NO_SIDE_EFFECTS__
4709
+ function literal(literal_, message$1) {
4710
+ return _standardSchema({
4711
+ kind: "schema",
4712
+ type: "literal",
4713
+ reference: literal,
4714
+ expects: /* @__PURE__ */ _stringify(literal_),
4715
+ async: false,
4716
+ literal: literal_,
4717
+ message: message$1,
4718
+ "~run"(dataset, config$1) {
4719
+ if (/* @__PURE__ */ _isSameValueZero(dataset.value, this.literal)) dataset.typed = true;
4720
+ else _addIssue(this, "type", dataset, config$1);
4721
+ return dataset;
4722
+ }
4723
+ });
4724
+ }
4725
+ // @__NO_SIDE_EFFECTS__
4726
+ function never(message$1) {
4727
+ return _standardSchema({
4728
+ kind: "schema",
4729
+ type: "never",
4730
+ reference: never,
4731
+ expects: "never",
4732
+ async: false,
4733
+ message: message$1,
4734
+ "~run"(dataset, config$1) {
4735
+ _addIssue(this, "type", dataset, config$1);
4736
+ return dataset;
4737
+ }
4738
+ });
4739
+ }
4740
+ // @__NO_SIDE_EFFECTS__
4741
+ function nullish(wrapped, default_) {
4742
+ return _standardSchema({
4743
+ kind: "schema",
4744
+ type: "nullish",
4745
+ reference: nullish,
4746
+ expects: `(${wrapped.expects} | null | undefined)`,
4747
+ async: false,
4748
+ wrapped,
4749
+ default: default_,
4750
+ "~run"(dataset, config$1) {
4751
+ if (dataset.value === null || dataset.value === void 0) {
4752
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
4753
+ if (dataset.value === null || dataset.value === void 0) {
4754
+ dataset.typed = true;
4755
+ return dataset;
4756
+ }
4757
+ }
4758
+ return this.wrapped["~run"](dataset, config$1);
4759
+ }
4760
+ });
4761
+ }
4762
+ // @__NO_SIDE_EFFECTS__
4763
+ function number(message$1) {
4764
+ return _standardSchema({
4765
+ kind: "schema",
4766
+ type: "number",
4767
+ reference: number,
4768
+ expects: "number",
4769
+ async: false,
4770
+ message: message$1,
4771
+ "~run"(dataset, config$1) {
4772
+ if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
4773
+ else _addIssue(this, "type", dataset, config$1);
4774
+ return dataset;
4775
+ }
4776
+ });
4777
+ }
4778
+ // @__NO_SIDE_EFFECTS__
4779
+ function object(entries$1, message$1) {
4780
+ return _standardSchema({
4781
+ kind: "schema",
4782
+ type: "object",
4783
+ reference: object,
4784
+ expects: "Object",
4785
+ async: false,
4786
+ entries: entries$1,
3967
4787
  message: message$1,
3968
4788
  "~run"(dataset, config$1) {
3969
4789
  const input = dataset.value;
@@ -4433,8 +5253,8 @@ function safeParse(schema, input, config$1) {
4433
5253
  issues: dataset.issues
4434
5254
  };
4435
5255
  }
4436
- function styleText$1(...args2) {
4437
- return styleText(...args2);
5256
+ function styleText(...args2) {
5257
+ return styleText$1(...args2);
4438
5258
  }
4439
5259
  var StringOrRegExpSchema = /* @__PURE__ */ union([/* @__PURE__ */ string(), /* @__PURE__ */ instance(RegExp)]);
4440
5260
  function vFunction() {
@@ -4583,7 +5403,9 @@ var ChecksOptionsSchema = /* @__PURE__ */ strictObject({
4583
5403
  largeBarrelModules: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit info logs when a barrel module has a very large number of re-exports (more than 5000)")),
4584
5404
  sourcemapBroken: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a plugin transforms code without generating a sourcemap")),
4585
5405
  namespaceConflict: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when multiple star re-exports provide the same name from different modules")),
4586
- shimmedExport: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a missing export is replaced with an undefined binding"))
5406
+ shimmedExport: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a missing export is replaced with an undefined binding")),
5407
+ deprecatedImportAssertion: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when an import uses the legacy `assert` keyword instead of `with`")),
5408
+ invalidImportAttribute: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when the options of a dynamic import are not statically analyzable while `experimental.importAttributes` is on"))
4587
5409
  });
4588
5410
  var MinifyOptionsSchema = /* @__PURE__ */ strictObject({
4589
5411
  compress: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
@@ -4697,11 +5519,11 @@ var InputOptionsSchema = /* @__PURE__ */ strictObject({
4697
5519
  /* @__PURE__ */ literal("browser"),
4698
5520
  /* @__PURE__ */ literal("neutral"),
4699
5521
  /* @__PURE__ */ literal("node")
4700
- ])), /* @__PURE__ */ description(`Platform for which the code should be generated (node, ${styleText$1("underline", "browser")}, neutral)`)),
5522
+ ])), /* @__PURE__ */ description(`Platform for which the code should be generated (node, ${styleText("underline", "browser")}, neutral)`)),
4701
5523
  shimMissingExports: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Create shim variables for missing exports")),
4702
5524
  treeshake: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), TreeshakingOptionsSchema])),
4703
5525
  optimization: /* @__PURE__ */ optional(OptimizationOptionsSchema),
4704
- logLevel: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(LogLevelOptionSchema), /* @__PURE__ */ description(`Log level (${styleText$1("dim", "silent")}, ${styleText$1(["underline", "gray"], "info")}, debug, ${styleText$1("yellow", "warn")})`)),
5526
+ logLevel: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(LogLevelOptionSchema), /* @__PURE__ */ description(`Log level (${styleText("dim", "silent")}, ${styleText(["underline", "gray"], "info")}, debug, ${styleText("yellow", "warn")})`)),
4705
5527
  onLog: /* @__PURE__ */ optional(OnLogSchema),
4706
5528
  onwarn: /* @__PURE__ */ optional(OnwarnSchema),
4707
5529
  moduleTypes: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(ModuleTypesSchema), /* @__PURE__ */ description("Module types for customized extensions")),
@@ -4726,14 +5548,15 @@ var InputOptionsSchema = /* @__PURE__ */ strictObject({
4726
5548
  mergeCommonChunks: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
4727
5549
  avoidRedundantChunkLoads: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
4728
5550
  })])),
4729
- lazyBarrel: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
5551
+ lazyBarrel: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
5552
+ importAttributes: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
4730
5553
  })),
4731
5554
  transform: /* @__PURE__ */ optional(TransformOptionsSchema),
4732
5555
  watch: /* @__PURE__ */ optional(/* @__PURE__ */ union([WatcherOptionsSchema, /* @__PURE__ */ literal(false)])),
4733
5556
  checks: /* @__PURE__ */ optional(ChecksOptionsSchema),
4734
5557
  devtools: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ object({
4735
- sessionId: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ pipe(/* @__PURE__ */ string(), /* @__PURE__ */ check((id2) => id2 !== "" && id2 !== "." && id2 !== ".." && !/[/\\\0]/.test(id2), 'Expected one path segment: not empty, not "." or "..", and without "/", "\\" or NUL'), /* @__PURE__ */ check((id2) => id2.toLowerCase().toUpperCase() !== "UNKNOWN-SESSION", '"unknown-session" is reserved for devtools events without a session context'))), /* @__PURE__ */ description("Used to name the build.")),
4736
- mode: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ literal("full"), /* @__PURE__ */ literal("report")])), /* @__PURE__ */ description("'full' (default): write JSON-lines devtools logs. 'report': aggregate the same event stream in-memory and emit an agent-readable report (metrics.json + markdown views) instead."))
5558
+ sessionId: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ pipe(/* @__PURE__ */ string(), /* @__PURE__ */ check((id2) => id2 !== "" && id2 !== "." && id2 !== ".." && !/[/\\\0]/.test(id2), 'Expected one path segment: not empty, not "." or "..", and without "/", "\\" or NUL'), /* @__PURE__ */ check((id2) => id2.toLowerCase().toUpperCase() !== "UNKNOWN-SESSION", '"unknown-session" is reserved for devtools events without a session context'))), /* @__PURE__ */ description("Name of the 'full' mode log folder, node_modules/.rolldown/<sessionId>/.")),
5559
+ mode: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ literal("full"), /* @__PURE__ */ literal("report")])), /* @__PURE__ */ description("'full' (default): write JSON-lines devtools logs. 'report': write a small build report to node_modules/.rolldown/report/ instead."))
4737
5560
  })), /* @__PURE__ */ description("Enable debug mode. Emit debug information to disk. This might slow down the build process significantly.")),
4738
5561
  preserveEntrySignatures: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([
4739
5562
  /* @__PURE__ */ literal("strict"),
@@ -4830,13 +5653,13 @@ var OutputOptionsSchema = /* @__PURE__ */ strictObject({
4830
5653
  /* @__PURE__ */ literal("named"),
4831
5654
  /* @__PURE__ */ literal("default"),
4832
5655
  /* @__PURE__ */ literal("none")
4833
- ])), /* @__PURE__ */ description(`Specify a export mode (${styleText$1("underline", "auto")}, named, default, none)`)),
5656
+ ])), /* @__PURE__ */ description(`Specify a export mode (${styleText("underline", "auto")}, named, default, none)`)),
4834
5657
  hashCharacters: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([
4835
5658
  /* @__PURE__ */ literal("base64"),
4836
5659
  /* @__PURE__ */ literal("base36"),
4837
5660
  /* @__PURE__ */ literal("hex")
4838
5661
  ])), /* @__PURE__ */ description("Use the specified character set for file hashes")),
4839
- format: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(ModuleFormatSchema), /* @__PURE__ */ description(`Output format of the generated bundle (supports ${styleText$1("underline", "esm")}, cjs, and iife)`)),
5662
+ format: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(ModuleFormatSchema), /* @__PURE__ */ description(`Output format of the generated bundle (supports ${styleText("underline", "esm")}, cjs, and iife)`)),
4840
5663
  sourcemap: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([
4841
5664
  /* @__PURE__ */ boolean(),
4842
5665
  /* @__PURE__ */ literal("inline"),
@@ -4899,7 +5722,7 @@ var OutputOptionsSchema = /* @__PURE__ */ strictObject({
4899
5722
  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.'))
4900
5723
  });
4901
5724
  var getAddonDescription = (placement, wrapper) => {
4902
- return `Code to insert the ${styleText$1("bold", placement)} of the bundled file (${styleText$1("bold", wrapper)} the wrapper function)`;
5725
+ return `Code to insert the ${styleText("bold", placement)} of the bundled file (${styleText("bold", wrapper)} the wrapper function)`;
4903
5726
  };
4904
5727
  var OutputCliOverrideSchema = /* @__PURE__ */ strictObject({
4905
5728
  assetFileNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Name pattern for asset files")),
@@ -4973,700 +5796,8 @@ function validateOption(key, options) {
4973
5796
  ${errors.join("\n")}\x1B[0m`);
4974
5797
  }
4975
5798
  }
4976
- var ChunkingContextImpl = class {
4977
- context;
4978
- pluginContextData;
4979
- moduleInfoCache = /* @__PURE__ */ new Map();
4980
- constructor(context, pluginContextData) {
4981
- this.context = context;
4982
- this.pluginContextData = pluginContextData;
4983
- }
4984
- clearModuleInfoCache() {
4985
- this.moduleInfoCache = void 0;
4986
- }
4987
- getModuleInfo(moduleId) {
4988
- const cached = this.moduleInfoCache?.get(moduleId);
4989
- if (cached) return cached;
4990
- const bindingInfo = this.context.getModuleInfo(moduleId);
4991
- if (bindingInfo) {
4992
- const option = this.pluginContextData.getModuleOption(moduleId);
4993
- const info = transformModuleInfo(bindingInfo, option);
4994
- Object.defineProperty(info, "moduleSideEffects", {
4995
- get: () => option.moduleSideEffects,
4996
- set: (moduleSideEffects) => {
4997
- option.moduleSideEffects = moduleSideEffects;
4998
- option.invalidate = true;
4999
- }
5000
- });
5001
- this.moduleInfoCache?.set(moduleId, info);
5002
- return info;
5003
- }
5004
- return null;
5005
- }
5006
- };
5007
- async function getWarn(outputOptions) {
5008
- if (outputOptions.legalComments == null && outputOptions.inlineDynamicImports == null && outputOptions.advancedChunks == null && outputOptions.manualChunks == null) return (message) => console.warn(message);
5009
- const { logger } = await import("./logger-LvdykevT-BQ5B4N5O.js").then((n) => n.n);
5010
- return (message) => logger.warn(message);
5011
- }
5012
- async function bindingifyOutputOptions(outputOptions, pluginContextData, onLog, timings) {
5013
- const { dir, charset, 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;
5014
- const warn = await getWarn(outputOptions);
5015
- if (legalComments != null) warn("`legalComments` option is deprecated, please use `comments.legal` instead.");
5016
- const { inlineDynamicImports, advancedChunks } = bindingifyCodeSplitting(outputOptions.codeSplitting, outputOptions.inlineDynamicImports, outputOptions.advancedChunks, manualChunks, pluginContextData, onLog, timings, warn);
5017
- return {
5018
- dir,
5019
- charset,
5020
- file: file == null ? void 0 : file,
5021
- format: bindingifyFormat(format),
5022
- exports,
5023
- hashCharacters,
5024
- sourcemap: bindingifySourcemap2(sourcemap),
5025
- sourcemapBaseUrl,
5026
- sourcemapDebugIds,
5027
- sourcemapFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapFileNames", sourcemapFileNames),
5028
- sourcemapExcludeSources,
5029
- sourcemapIgnoreList: batchSourcemapIgnoreList(measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapIgnoreList", sourcemapIgnoreList ?? /node_modules/)),
5030
- sourcemapPathTransform: batchSourcemapPathTransform(measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapPathTransform", sourcemapPathTransform)),
5031
- banner: bindingifyAddon(banner, "banner", timings),
5032
- footer: bindingifyAddon(footer, "footer", timings),
5033
- postBanner: bindingifyAddon(postBanner, "postBanner", timings),
5034
- postFooter: bindingifyAddon(postFooter, "postFooter", timings),
5035
- intro: bindingifyAddon(intro, "intro", timings),
5036
- outro: bindingifyAddon(outro, "outro", timings),
5037
- extend: outputOptions.extend,
5038
- globals: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "globals", globals),
5039
- paths: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "paths", paths),
5040
- generatedCode,
5041
- esModule,
5042
- name,
5043
- assetFileNames: bindingifyAssetFilenames(assetFileNames),
5044
- entryFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "entryFileNames", entryFileNames),
5045
- chunkFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "chunkFileNames", chunkFileNames),
5046
- plugins: [],
5047
- minify: outputOptions.minify,
5048
- externalLiveBindings: outputOptions.externalLiveBindings,
5049
- inlineDynamicImports,
5050
- dynamicImportInCjs: outputOptions.dynamicImportInCjs,
5051
- manualCodeSplitting: advancedChunks,
5052
- polyfillRequire: outputOptions.polyfillRequire,
5053
- sanitizeFileName,
5054
- preserveModules,
5055
- virtualDirname,
5056
- legalComments,
5057
- comments: bindingifyComments(comments),
5058
- preserveModulesRoot,
5059
- topLevelVar,
5060
- minifyInternalExports: outputOptions.minifyInternalExports,
5061
- cleanDir,
5062
- strictExecutionOrder,
5063
- strict: outputOptions.strict
5064
- };
5065
- }
5066
- function bindingifyAddon(configAddon, name, timings) {
5067
- if (configAddon == null || configAddon === "") return;
5068
- if (typeof configAddon === "function") {
5069
- const measured = measureHookCost(timings, OUTPUT_OPTIONS_OWNER, name, configAddon);
5070
- return async (chunk) => measured(transformRenderedChunk(chunk));
5071
- }
5072
- return configAddon;
5073
- }
5074
- function bindingifyFormat(format) {
5075
- switch (format) {
5076
- case void 0:
5077
- case "es":
5078
- case "esm":
5079
- case "module":
5080
- return "es";
5081
- case "cjs":
5082
- case "commonjs":
5083
- return "cjs";
5084
- case "iife":
5085
- return "iife";
5086
- case "umd":
5087
- return "umd";
5088
- default:
5089
- unimplemented(`output.format: ${format}`);
5090
- }
5091
- }
5092
- function bindingifySourcemap2(sourcemap) {
5093
- switch (sourcemap) {
5094
- case true:
5095
- return "file";
5096
- case "inline":
5097
- return "inline";
5098
- case false:
5099
- case void 0:
5100
- return;
5101
- case "hidden":
5102
- return "hidden";
5103
- default:
5104
- throw new Error(`unknown sourcemap: ${sourcemap}`);
5105
- }
5106
- }
5107
- function bindingifyAssetFilenames(assetFileNames) {
5108
- if (typeof assetFileNames === "function") return (asset) => {
5109
- return assetFileNames({
5110
- name: asset.name,
5111
- names: asset.names,
5112
- originalFileName: asset.originalFileName,
5113
- originalFileNames: asset.originalFileNames,
5114
- source: transformAssetSource(asset.source),
5115
- type: "asset"
5116
- });
5117
- };
5118
- return assetFileNames;
5119
- }
5120
- function bindingifyComments(comments) {
5121
- if (comments == null) return;
5122
- if (typeof comments === "boolean") return comments;
5123
- return comments;
5124
- }
5125
- function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, advancedChunks, manualChunks, pluginContextData, onLog, timings, warn) {
5126
- let inlineDynamicImports;
5127
- let effectiveChunksOption;
5128
- let migratedManualChunksGroup;
5129
- let chunksOptionName = "codeSplitting";
5130
- if (codeSplitting === false) {
5131
- if (inlineDynamicImportsOption != null) warn("`inlineDynamicImports` option is ignored because `codeSplitting: false` is set.");
5132
- if (manualChunks != null) throw new Error('Invalid configuration: "output.manualChunks" cannot be used when "output.codeSplitting" is set to false.');
5133
- if (advancedChunks != null) warn("`advancedChunks` option is ignored because `codeSplitting` is set to `false`.");
5134
- return {
5135
- inlineDynamicImports: true,
5136
- advancedChunks: void 0
5137
- };
5138
- } else if (codeSplitting === true) {
5139
- if (inlineDynamicImportsOption != null) warn("`inlineDynamicImports` option is ignored because `codeSplitting: true` is set.");
5140
- } else if (codeSplitting == null) {
5141
- if (inlineDynamicImportsOption != null) {
5142
- warn("`inlineDynamicImports` option is deprecated, please use `codeSplitting: false` instead.");
5143
- inlineDynamicImports = inlineDynamicImportsOption;
5144
- }
5145
- } else {
5146
- effectiveChunksOption = codeSplitting;
5147
- chunksOptionName = "codeSplitting";
5148
- if (inlineDynamicImportsOption != null) warn("`inlineDynamicImports` option is ignored because the `codeSplitting` option is specified.");
5149
- }
5150
- if (inlineDynamicImports === true && manualChunks != null) throw new Error('Invalid value "true" for option "output.inlineDynamicImports" - this option is not supported for "output.manualChunks".');
5151
- if (effectiveChunksOption == null) {
5152
- if (advancedChunks != null) {
5153
- warn("`advancedChunks` option is deprecated, please use `codeSplitting` instead.");
5154
- effectiveChunksOption = advancedChunks;
5155
- chunksOptionName = "advancedChunks";
5156
- }
5157
- } else if (advancedChunks != null) warn("`advancedChunks` option is ignored because the `codeSplitting` option is specified.");
5158
- if (manualChunks != null && effectiveChunksOption != null) warn("`manualChunks` option is ignored because the `codeSplitting` option is specified.");
5159
- else if (manualChunks != null) {
5160
- chunksOptionName = "manualChunks";
5161
- migratedManualChunksGroup = { name(moduleId, ctx) {
5162
- return manualChunks(moduleId, { getModuleInfo: (id2) => ctx.getModuleInfo(id2) });
5163
- } };
5164
- effectiveChunksOption = { groups: [migratedManualChunksGroup] };
5165
- }
5166
- if (inlineDynamicImports === true && effectiveChunksOption != null) {
5167
- warn("`advancedChunks` option is ignored because `inlineDynamicImports: true` disables code splitting.");
5168
- effectiveChunksOption = void 0;
5169
- }
5170
- let advancedChunksResult;
5171
- if (effectiveChunksOption != null) {
5172
- const { groups, experimentalInlineCommonChunks, ...restOptions } = effectiveChunksOption;
5173
- let chunkingContext;
5174
- const getChunkingContext = (bindingContext) => chunkingContext ??= new ChunkingContextImpl(bindingContext, pluginContextData);
5175
- advancedChunksResult = {
5176
- ...restOptions,
5177
- experimentalInlineCommonChunks: experimentalInlineCommonChunks == null ? void 0 : {
5178
- maxSize: experimentalInlineCommonChunks.maxSize,
5179
- exclude: experimentalInlineCommonChunks.exclude == null ? void 0 : arraify(experimentalInlineCommonChunks.exclude).map((matcher) => typeof matcher === "function" ? batchTest(measureHookCost(timings, OUTPUT_OPTIONS_OWNER, "codeSplitting.experimentalInlineCommonChunks.exclude", matcher), "output.codeSplitting.experimentalInlineCommonChunks.exclude") : matcher)
5180
- },
5181
- internalInvalidateModuleInfoCache: () => {
5182
- chunkingContext?.clearModuleInfoCache();
5183
- chunkingContext = void 0;
5184
- },
5185
- groups: groups?.map((group, index) => {
5186
- const { debugName, name, test, ...restGroup } = group;
5187
- const timingKey = group === migratedManualChunksGroup ? manualChunks ?? group : group;
5188
- const timingOwner = timings === void 0 ? OUTPUT_OPTIONS_OWNER : {
5189
- ...OUTPUT_OPTIONS_OWNER,
5190
- key: timingKey
5191
- };
5192
- const groupName = `${chunksOptionName} groups[${index}]`;
5193
- let testTimingName = `${groupName}.test`;
5194
- let nameTimingName = `${groupName}.name`;
5195
- if (timings !== void 0) {
5196
- if (chunksOptionName === "manualChunks") nameTimingName = "manualChunks";
5197
- else {
5198
- const label = debugName ?? (typeof name === "string" ? name : void 0);
5199
- if (label === void 0) {
5200
- if (typeof name === "function" && !timings.warnedMissingGroupLabels.has(timingKey)) {
5201
- timings.warnedMissingGroupLabels.add(timingKey);
5202
- onLog(LOG_LEVEL_WARN, logMissingCodeSplittingGroupDebugName(`output.${chunksOptionName}.groups[${index}]`));
5203
- }
5204
- } else {
5205
- const labelSuffix = ` ${JSON.stringify(label)}`;
5206
- testTimingName = `${groupName}.test${labelSuffix}`;
5207
- nameTimingName = `${groupName}.name${labelSuffix}`;
5208
- }
5209
- }
5210
- }
5211
- return {
5212
- ...restGroup,
5213
- test: typeof test === "function" ? batchTest(measureHookCost(timings, timingOwner, testTimingName, test)) : test,
5214
- name: typeof name === "function" ? batchName(measureHookCost(timings, timingOwner, nameTimingName, name), getChunkingContext) : name
5215
- };
5216
- })
5217
- };
5218
- }
5219
- return {
5220
- inlineDynamicImports,
5221
- advancedChunks: advancedChunksResult
5222
- };
5223
- }
5224
- function batchTest(test, optionName = "output.codeSplitting.groups[].test") {
5225
- return (ids) => {
5226
- const results = new Uint8Array(ids.length);
5227
- for (let index = 0; index < ids.length; index++) {
5228
- const result = test(ids[index]);
5229
- if (result != null && typeof result !== "boolean") throw new TypeError(`\`${optionName}\` returned ${typeof result} for module "${ids[index]}", but expected a boolean, null or undefined.`);
5230
- results[index] = result === true ? 1 : 0;
5231
- }
5232
- return results;
5233
- };
5234
- }
5235
- function batchName(name, getChunkingContext) {
5236
- return (ids, bindingContext) => {
5237
- const context = getChunkingContext(bindingContext);
5238
- const results = [];
5239
- for (let index = 0; index < ids.length; index++) {
5240
- const result = name(ids[index], context);
5241
- if (result != null && typeof result !== "string") throw new TypeError(`\`output.codeSplitting.groups[].name\` returned ${typeof result} for module "${ids[index]}", but expected a string, null or undefined.`);
5242
- results.push(result);
5243
- }
5244
- return results;
5245
- };
5246
- }
5247
- function batchSourcemapIgnoreList(ignoreList) {
5248
- if (typeof ignoreList !== "function") return ignoreList;
5249
- return (sources, sourcemapPath) => {
5250
- const results = new Uint8Array(sources.length);
5251
- for (let index = 0; index < sources.length; index++) {
5252
- const result = ignoreList(sources[index], sourcemapPath);
5253
- if (typeof result !== "boolean") throw new TypeError(`\`output.sourcemapIgnoreList\` returned ${typeof result} for source "${sources[index]}", but expected a boolean.`);
5254
- results[index] = result ? 1 : 0;
5255
- }
5256
- return results;
5257
- };
5258
- }
5259
- function batchSourcemapPathTransform(pathTransform) {
5260
- if (typeof pathTransform !== "function") return pathTransform;
5261
- return (sources, sourcemapPath) => {
5262
- const results = [];
5263
- for (let index = 0; index < sources.length; index++) {
5264
- const result = pathTransform(sources[index], sourcemapPath);
5265
- if (typeof result !== "string") throw new TypeError(`\`output.sourcemapPathTransform\` returned ${typeof result} for source "${sources[index]}", but expected a string.`);
5266
- results.push(result);
5267
- }
5268
- return results;
5269
- };
5270
- }
5271
- var import_binding4 = /* @__PURE__ */ __toESM(require_binding(), 1);
5272
- async function initializeParallelPlugins(plugins) {
5273
- const pluginInfos = [];
5274
- for (const [index, plugin] of plugins.entries()) {
5275
- const parallel = getParallelPluginInfo(plugin);
5276
- if (parallel) {
5277
- const { fileUrl, options } = parallel;
5278
- pluginInfos.push({
5279
- index,
5280
- fileUrl,
5281
- options
5282
- });
5283
- }
5284
- }
5285
- if (pluginInfos.length <= 0) return;
5286
- const count = availableParallelism();
5287
- const parallelJsPluginRegistry = new import_binding4.ParallelJsPluginRegistry(count);
5288
- const registryId = parallelJsPluginRegistry.id;
5289
- const workers = await initializeWorkers(registryId, count, pluginInfos);
5290
- const stopWorkers = async () => {
5291
- await Promise.all(workers.map((worker) => worker.terminate()));
5292
- };
5293
- return {
5294
- registry: parallelJsPluginRegistry,
5295
- stopWorkers
5296
- };
5297
- }
5298
- function initializeWorkers(registryId, count, pluginInfos) {
5299
- return Promise.all(Array.from({ length: count }, (_, i) => initializeWorker(registryId, pluginInfos, i)));
5300
- }
5301
- async function initializeWorker(registryId, pluginInfos, threadNumber) {
5302
- const urlString = import.meta.resolve("#parallel-plugin-worker");
5303
- const workerData = {
5304
- registryId,
5305
- pluginInfos,
5306
- threadNumber
5307
- };
5308
- let worker;
5309
- try {
5310
- worker = new Worker(new URL(urlString), { workerData });
5311
- worker.unref();
5312
- await new Promise((resolve, reject) => {
5313
- worker.once("message", async (message) => {
5314
- if (message.type === "error") reject(message.error);
5315
- else resolve();
5316
- });
5317
- });
5318
- return worker;
5319
- } catch (e) {
5320
- worker?.terminate();
5321
- throw e;
5322
- }
5323
- }
5324
- var availableParallelism = () => {
5325
- let availableParallelism2 = 1;
5326
- try {
5327
- availableParallelism2 = os.availableParallelism();
5328
- } catch {
5329
- const cpus = os.cpus();
5330
- if (Array.isArray(cpus) && cpus.length > 0) availableParallelism2 = cpus.length;
5331
- }
5332
- return Math.min(availableParallelism2, 8);
5333
- };
5334
- async function createBundlerOptions(inputOptions, outputOptions, watchMode, measureTimings = false) {
5335
- const inputPlugins = await normalizePluginOption(inputOptions.plugins);
5336
- const outputPlugins = await normalizePluginOption(outputOptions.plugins);
5337
- const logLevel = inputOptions.logLevel || "info";
5338
- const onLog = getLogger(getObjectPlugins(inputPlugins), getOnLog(inputOptions, logLevel), logLevel, watchMode);
5339
- outputOptions = PluginDriver.callOutputOptionsHook([...inputPlugins, ...outputPlugins], outputOptions, onLog, logLevel, watchMode);
5340
- const hookOutputPlugins = await normalizePluginOption(outputOptions.plugins);
5341
- const normalizedInputPlugins = normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX);
5342
- const normalizedOutputPlugins = normalizePlugins(hookOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX);
5343
- let plugins = [...normalizedInputPlugins, ...checkOutputPluginOption(normalizedOutputPlugins, onLog)];
5344
- const timings = measureTimings && (inputOptions.checks?.bundlerTimings ?? inputOptions.checks?.pluginTimings ?? true) ? pluginTimingsRecorderFor(inputOptions) : void 0;
5345
- if (timings) outputOptions = {
5346
- ...outputOptions,
5347
- assetFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "assetFileNames", outputOptions.assetFileNames),
5348
- sanitizeFileName: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sanitizeFileName", outputOptions.sanitizeFileName)
5349
- };
5350
- const parallelPluginInitResult = await initializeParallelPlugins(plugins);
5351
- if (inputOptions.experimental?.strictExecutionOrder !== void 0) console.warn("`experimental.strictExecutionOrder` has been stabilized and moved to `output.strictExecutionOrder`. Please update your configuration.");
5352
- try {
5353
- const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedInputPlugins, normalizedOutputPlugins);
5354
- return {
5355
- bundlerOptions: {
5356
- inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings),
5357
- outputOptions: await bindingifyOutputOptions(outputOptions, pluginContextData, onLog, timings),
5358
- parallelPluginsRegistry: parallelPluginInitResult?.registry
5359
- },
5360
- inputOptions,
5361
- onLog,
5362
- stopWorkers: parallelPluginInitResult?.stopWorkers
5363
- };
5364
- } catch (e) {
5365
- await parallelPluginInitResult?.stopWorkers();
5366
- throw e;
5367
- }
5368
- }
5369
-
5370
- // node_modules/.pnpm/rolldown@1.2.16/node_modules/rolldown/dist/shared/watch-DVnOWncA.mjs
5371
- var signals = [];
5372
- signals.push("SIGHUP", "SIGINT", "SIGTERM");
5373
- if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
5374
- if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
5375
- var processOk = (process2) => !!process2 && typeof process2 === "object" && typeof process2.removeListener === "function" && typeof process2.emit === "function" && typeof process2.reallyExit === "function" && typeof process2.listeners === "function" && typeof process2.kill === "function" && typeof process2.pid === "number" && typeof process2.on === "function";
5376
- var kExitEmitter = /* @__PURE__ */ Symbol.for("signal-exit emitter");
5377
- var global = globalThis;
5378
- var ObjectDefineProperty = Object.defineProperty.bind(Object);
5379
- var Emitter = class {
5380
- emitted = {
5381
- afterExit: false,
5382
- exit: false
5383
- };
5384
- listeners = {
5385
- afterExit: [],
5386
- exit: []
5387
- };
5388
- count = 0;
5389
- id = Math.random();
5390
- constructor() {
5391
- if (global[kExitEmitter]) return global[kExitEmitter];
5392
- ObjectDefineProperty(global, kExitEmitter, {
5393
- value: this,
5394
- writable: false,
5395
- enumerable: false,
5396
- configurable: false
5397
- });
5398
- }
5399
- on(ev, fn) {
5400
- this.listeners[ev].push(fn);
5401
- }
5402
- removeListener(ev, fn) {
5403
- const list = this.listeners[ev];
5404
- const i = list.indexOf(fn);
5405
- if (i === -1) return;
5406
- if (i === 0 && list.length === 1) list.length = 0;
5407
- else list.splice(i, 1);
5408
- }
5409
- emit(ev, code2, signal) {
5410
- if (this.emitted[ev]) return false;
5411
- this.emitted[ev] = true;
5412
- let ret = false;
5413
- for (const fn of this.listeners[ev]) ret = fn(code2, signal) === true || ret;
5414
- if (ev === "exit") ret = this.emit("afterExit", code2, signal) || ret;
5415
- return ret;
5416
- }
5417
- };
5418
- var SignalExitBase = class {
5419
- };
5420
- var signalExitWrap = (handler) => {
5421
- return {
5422
- onExit(cb, opts) {
5423
- return handler.onExit(cb, opts);
5424
- },
5425
- load() {
5426
- return handler.load();
5427
- },
5428
- unload() {
5429
- return handler.unload();
5430
- }
5431
- };
5432
- };
5433
- var SignalExitFallback = class extends SignalExitBase {
5434
- onExit() {
5435
- return () => {
5436
- };
5437
- }
5438
- load() {
5439
- }
5440
- unload() {
5441
- }
5442
- };
5443
- var SignalExit = class extends SignalExitBase {
5444
- /* c8 ignore start */
5445
- #hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
5446
- /* c8 ignore stop */
5447
- #emitter = new Emitter();
5448
- #process;
5449
- #originalProcessEmit;
5450
- #originalProcessReallyExit;
5451
- #sigListeners = {};
5452
- #loaded = false;
5453
- constructor(process2) {
5454
- super();
5455
- this.#process = process2;
5456
- this.#sigListeners = {};
5457
- for (const sig of signals) this.#sigListeners[sig] = () => {
5458
- const listeners = this.#process.listeners(sig);
5459
- let { count } = this.#emitter;
5460
- const p = process2;
5461
- if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
5462
- if (listeners.length === count) {
5463
- this.unload();
5464
- const ret = this.#emitter.emit("exit", null, sig);
5465
- const s = sig === "SIGHUP" ? this.#hupSig : sig;
5466
- if (!ret) process2.kill(process2.pid, s);
5467
- }
5468
- };
5469
- this.#originalProcessReallyExit = process2.reallyExit;
5470
- this.#originalProcessEmit = process2.emit;
5471
- }
5472
- onExit(cb, opts) {
5473
- if (!processOk(this.#process)) return () => {
5474
- };
5475
- if (this.#loaded === false) this.load();
5476
- const ev = opts?.alwaysLast ? "afterExit" : "exit";
5477
- this.#emitter.on(ev, cb);
5478
- return () => {
5479
- this.#emitter.removeListener(ev, cb);
5480
- if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
5481
- };
5482
- }
5483
- load() {
5484
- if (this.#loaded) return;
5485
- this.#loaded = true;
5486
- this.#emitter.count += 1;
5487
- for (const sig of signals) try {
5488
- const fn = this.#sigListeners[sig];
5489
- if (fn) this.#process.on(sig, fn);
5490
- } catch (_) {
5491
- }
5492
- this.#process.emit = (ev, ...a) => {
5493
- return this.#processEmit(ev, ...a);
5494
- };
5495
- this.#process.reallyExit = (code2) => {
5496
- return this.#processReallyExit(code2);
5497
- };
5498
- }
5499
- unload() {
5500
- if (!this.#loaded) return;
5501
- this.#loaded = false;
5502
- signals.forEach((sig) => {
5503
- const listener = this.#sigListeners[sig];
5504
- if (!listener) throw new Error("Listener not defined for signal: " + sig);
5505
- try {
5506
- this.#process.removeListener(sig, listener);
5507
- } catch (_) {
5508
- }
5509
- });
5510
- this.#process.emit = this.#originalProcessEmit;
5511
- this.#process.reallyExit = this.#originalProcessReallyExit;
5512
- this.#emitter.count -= 1;
5513
- }
5514
- #processReallyExit(code2) {
5515
- if (!processOk(this.#process)) return 0;
5516
- this.#process.exitCode = code2 || 0;
5517
- this.#emitter.emit("exit", this.#process.exitCode, null);
5518
- return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
5519
- }
5520
- #processEmit(ev, ...args2) {
5521
- const og = this.#originalProcessEmit;
5522
- if (ev === "exit" && processOk(this.#process)) {
5523
- if (typeof args2[0] === "number") this.#process.exitCode = args2[0];
5524
- const ret = og.call(this.#process, ev, ...args2);
5525
- this.#emitter.emit("exit", this.#process.exitCode, null);
5526
- return ret;
5527
- } else return og.call(this.#process, ev, ...args2);
5528
- }
5529
- };
5530
- var process$1 = globalThis.process;
5531
- var { onExit: onExit$1, load, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
5532
- function onExit(...args2) {
5533
- if (typeof process === "object" && process.versions.webcontainer) {
5534
- process.on("exit", (code2) => {
5535
- args2[0](code2, null);
5536
- });
5537
- return;
5538
- }
5539
- onExit$1(...args2);
5540
- }
5541
- var WatcherEmitter = class {
5542
- listeners = /* @__PURE__ */ new Map();
5543
- on(event, listener) {
5544
- const listeners = this.listeners.get(event);
5545
- if (listeners) listeners.push(listener);
5546
- else this.listeners.set(event, [listener]);
5547
- return this;
5548
- }
5549
- off(event, listener) {
5550
- const listeners = this.listeners.get(event);
5551
- if (listeners) {
5552
- const index = listeners.indexOf(listener);
5553
- if (index !== -1) listeners.splice(index, 1);
5554
- }
5555
- return this;
5556
- }
5557
- clear(event) {
5558
- this.listeners.delete(event);
5559
- }
5560
- /** Async emit — sequential dispatch so side effects from earlier handlers
5561
- * (e.g. `event.result.close()` triggering `closeBundle`) are visible to later handlers. */
5562
- async emit(event, ...args2) {
5563
- const handlers = this.listeners.get(event);
5564
- if (handlers?.length) for (const h of handlers) await h(...args2);
5565
- }
5566
- async close() {
5567
- }
5568
- };
5569
- var import_binding5 = /* @__PURE__ */ __toESM(require_binding(), 1);
5570
- function createEventCallback(emitter) {
5571
- return async (event) => {
5572
- switch (event.eventKind()) {
5573
- case "event": {
5574
- const code2 = event.bundleEventKind();
5575
- if (code2 === "BUNDLE_END") {
5576
- const { duration, output, result } = event.bundleEndData();
5577
- await emitter.emit("event", {
5578
- code: "BUNDLE_END",
5579
- duration,
5580
- output: [output],
5581
- result
5582
- });
5583
- } else if (code2 === "ERROR") {
5584
- const data = event.bundleErrorData();
5585
- await emitter.emit("event", {
5586
- code: "ERROR",
5587
- error: aggregateBindingErrorsIntoJsError(data.error),
5588
- result: data.result
5589
- });
5590
- } else await emitter.emit("event", { code: code2 });
5591
- break;
5592
- }
5593
- case "change": {
5594
- const { path: path3, kind } = event.watchChangeData();
5595
- await emitter.emit("change", path3, { event: kind });
5596
- break;
5597
- }
5598
- case "restart":
5599
- await emitter.emit("restart");
5600
- break;
5601
- case "close":
5602
- await emitter.emit("close");
5603
- }
5604
- };
5605
- }
5606
- var Watcher = class {
5607
- closed;
5608
- inner;
5609
- emitter;
5610
- stopWorkers;
5611
- constructor(emitter, inner, stopWorkers) {
5612
- this.closed = false;
5613
- this.inner = inner;
5614
- this.emitter = emitter;
5615
- (0, import_binding5.startAsyncRuntime)();
5616
- const originClose = emitter.close.bind(emitter);
5617
- emitter.close = async () => {
5618
- await this.close();
5619
- originClose();
5620
- };
5621
- this.stopWorkers = stopWorkers;
5622
- process.nextTick(() => this.run());
5623
- }
5624
- async close() {
5625
- if (this.closed) return;
5626
- this.closed = true;
5627
- try {
5628
- for (const stop of this.stopWorkers) await stop?.();
5629
- await this.inner.close();
5630
- } finally {
5631
- (0, import_binding5.shutdownAsyncRuntime)();
5632
- }
5633
- }
5634
- async run() {
5635
- await this.inner.run();
5636
- this.inner.waitForClose();
5637
- }
5638
- };
5639
- async function createWatcher(emitter, input) {
5640
- const options = arraify(input);
5641
- const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
5642
- const inputOptions = await PluginDriver.callOptionsHook(option, true);
5643
- return createBundlerOptions(inputOptions, output, true);
5644
- })).flat());
5645
- warnMultiplePollingOptions(bundlerOptions);
5646
- const callback = createEventCallback(emitter);
5647
- new Watcher(emitter, new import_binding5.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), callback), bundlerOptions.map((option) => option.stopWorkers));
5648
- }
5649
- function warnMultiplePollingOptions(bundlerOptions) {
5650
- let found = false;
5651
- for (const option of bundlerOptions) {
5652
- const watch2 = option.inputOptions.watch;
5653
- const watcher = watch2 && typeof watch2 === "object" ? watch2.watcher : void 0;
5654
- if (watcher && (watcher.usePolling != null || watcher.pollInterval != null)) {
5655
- if (found) {
5656
- option.onLog(LOG_LEVEL_WARN, logMultipleWatcherOption());
5657
- return;
5658
- }
5659
- found = true;
5660
- }
5661
- }
5662
- }
5663
- function watch(input) {
5664
- const emitter = new WatcherEmitter();
5665
- createWatcher(emitter, input);
5666
- return emitter;
5667
- }
5668
5799
 
5669
- // node_modules/.pnpm/rolldown@1.2.16/node_modules/rolldown/dist/shared/rolldown-DWd2aEL4.mjs
5800
+ // node_modules/.pnpm/rolldown@1.3.2/node_modules/rolldown/dist/shared/rolldown-D1DJCGXB.mjs
5670
5801
  var import_binding6 = /* @__PURE__ */ __toESM(require_binding(), 1);
5671
5802
  var RolldownOutputImpl = class extends PlainObjectLike {
5672
5803
  bindingOutputs;
@@ -5811,12 +5942,12 @@ var rolldown = async (input) => {
5811
5942
  return new RolldownBuild(await PluginDriver.callOptionsHook(input));
5812
5943
  };
5813
5944
 
5814
- // node_modules/.pnpm/rolldown@1.2.16/node_modules/rolldown/dist/shared/define-config-BQBrxnNZ.mjs
5945
+ // node_modules/.pnpm/rolldown@1.3.2/node_modules/rolldown/dist/shared/define-config-BQBrxnNZ.mjs
5815
5946
  function defineConfig(config) {
5816
5947
  return config;
5817
5948
  }
5818
5949
 
5819
- // node_modules/.pnpm/rolldown@1.2.16/node_modules/rolldown/dist/index.mjs
5950
+ // node_modules/.pnpm/rolldown@1.3.2/node_modules/rolldown/dist/index.mjs
5820
5951
  import { isMainThread } from "node:worker_threads";
5821
5952
  var import_binding7 = /* @__PURE__ */ __toESM(require_binding(), 1);
5822
5953
  if (isMainThread) {