@voidzero-dev/vite-plus-core 0.2.7 → 0.2.8

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 (74) hide show
  1. package/LICENSE +35 -0
  2. package/dist/rolldown/cli.mjs +9 -10
  3. package/dist/rolldown/config.d.mts +1 -1
  4. package/dist/rolldown/config.mjs +2 -2
  5. package/dist/rolldown/experimental-default-runtime.mjs +116 -0
  6. package/dist/rolldown/experimental-index.d.mts +10 -4
  7. package/dist/rolldown/experimental-index.mjs +32 -16
  8. package/dist/rolldown/experimental-runtime-base.mjs +95 -0
  9. package/dist/rolldown/experimental-runtime.d.ts +177 -0
  10. package/dist/rolldown/experimental-runtime.mjs +257 -0
  11. package/dist/rolldown/filter-index.d.mts +1 -1
  12. package/dist/rolldown/filter-index.mjs +1 -3
  13. package/dist/rolldown/index.d.mts +3 -3
  14. package/dist/rolldown/index.mjs +4 -4
  15. package/dist/rolldown/parallel-plugin-worker.mjs +3 -3
  16. package/dist/rolldown/parallel-plugin.d.mts +1 -1
  17. package/dist/rolldown/parse-ast-index.d.mts +1 -1
  18. package/dist/rolldown/parse-ast-index.mjs +2 -2
  19. package/dist/rolldown/plugins-index.d.mts +3 -3
  20. package/dist/rolldown/plugins-index.mjs +2 -2
  21. package/dist/rolldown/shared/{binding-Dbbi0RbO.d.mts → binding-CVtkJvyl.d.mts} +11 -0
  22. package/dist/rolldown/shared/{binding-Dby9rwGk.mjs → binding-DwUQWZOo.mjs} +178 -104
  23. package/dist/rolldown/shared/{bindingify-input-options-DVQ4K-zY.mjs → bindingify-input-options-B03y7DfJ.mjs} +448 -268
  24. package/dist/rolldown/shared/{constructors-CSWbNgBZ.d.mts → constructors-ALilxAii.d.mts} +2 -2
  25. package/dist/rolldown/shared/{constructors-CuGa75s-.mjs → constructors-COwFYQna.mjs} +10 -6
  26. package/dist/rolldown/shared/{rolldown-build-BGXNOfvH.mjs → create-bundler-option-B-tSTZRt.mjs} +72 -179
  27. package/dist/rolldown/shared/{define-config-B-IDOhDz.d.mts → define-config-DSMNXceb.d.mts} +85 -22
  28. package/dist/rolldown/shared/{error-DFGNOCle.mjs → error-nLggAzpQ.mjs} +1 -1
  29. package/dist/rolldown/shared/{load-config-R0z2olkB.mjs → load-config-O4G7NVNA.mjs} +2 -2
  30. package/dist/rolldown/shared/{logs-ZGEh6uhb.mjs → logs-DmYCAKcW.mjs} +8 -1
  31. package/dist/rolldown/shared/{misc-CoQm4NHO.mjs → misc-DOSKtd97.mjs} +9 -1
  32. package/dist/rolldown/shared/{normalize-string-or-regex-SiXbePVH.mjs → normalize-string-or-regex-Cj-DgIV1.mjs} +2 -2
  33. package/dist/rolldown/shared/{parse-D5dkElpf.mjs → parse-CQfUbVuN.mjs} +2 -2
  34. package/dist/rolldown/shared/{prompt-pZFoa1TT.mjs → prompt-uaCPq0_A.mjs} +2 -6
  35. package/dist/rolldown/shared/{resolve-tsconfig-2TXRF_zr.mjs → resolve-tsconfig-CE3HNSOK.mjs} +2 -2
  36. package/dist/rolldown/shared/rolldown-qV_fUwyM.mjs +178 -0
  37. package/dist/rolldown/shared/{transform-Cs2bUDRH.d.mts → transform-WmU_cI8e.d.mts} +1 -1
  38. package/dist/rolldown/shared/{watch-DVucf-VG.mjs → watch-BNIsji74.mjs} +16 -13
  39. package/dist/rolldown/utils-index.d.mts +3 -3
  40. package/dist/rolldown/utils-index.mjs +5 -5
  41. package/dist/tsdown/{build-D_enfyvD-DX5mX46j.js → build-D_enfyvD-X5SFXZZc.js} +10 -11
  42. package/dist/tsdown/{debug-CKcBYQLP-GQrJ--dM.js → debug-CKcBYQLP-avlAPNcV.js} +4 -6
  43. package/dist/tsdown/{detect-DGhJGEqb-Cz6qOZuP.js → detect-DGhJGEqb-CGd2brAW.js} +1 -1
  44. package/dist/tsdown/{dist-CWolxbYK.js → dist-BZO8q3c0.js} +43 -10
  45. package/dist/tsdown/{dist-DCMiHFrJ.js → dist-CMKwGGNp.js} +1 -3
  46. package/dist/tsdown/index-types.d.ts +6 -6
  47. package/dist/tsdown/index.js +4 -4
  48. package/dist/tsdown/internal-DyaNxVWW.js +3 -0
  49. package/dist/tsdown/{main-DI8qthUB.js → main-Jz_9T-KA.js} +2 -2
  50. package/dist/tsdown/npm_entry_picomatch.cjs +1 -1
  51. package/dist/tsdown/npm_entry_tree-kill.cjs +11 -13
  52. package/dist/tsdown/{resolver-cwLsPb2o-DvUqSYux.js → resolver-cwLsPb2o-BqQjnCbF.js} +3 -3
  53. package/dist/tsdown/run.js +4 -4
  54. package/dist/tsdown/{src-CPDzmpAq.js → src-D5keKqGd.js} +5 -5
  55. package/dist/tsdown/{target-Bab3CUeB-Di6tCARH.js → target-Bab3CUeB-CERZYTwS.js} +4 -4
  56. package/dist/tsdown/{tsc-BQoNcjeB.js → tsc-DmzrnJwy.js} +4 -5
  57. package/dist/tsdown/tsdown-css.js +7 -9
  58. package/dist/tsdown/tsdown-exe.js +3 -3
  59. package/dist/vite/client/bundledDevClient.mjs +1465 -0
  60. package/dist/vite/client/client.mjs +51 -82
  61. package/dist/vite/node/chunks/build.js +47 -43
  62. package/dist/vite/node/chunks/dist.js +26 -85
  63. package/dist/vite/node/chunks/dist2.js +5 -10
  64. package/dist/vite/node/chunks/node.js +2728 -2311
  65. package/dist/vite/node/chunks/postcss-import.js +10 -10
  66. package/dist/vite/node/index.d.ts +68 -14
  67. package/dist/vite/node/module-runner.js +21 -11
  68. package/dist/vite/types/customEvent.d.ts +3 -1
  69. package/dist/vite/types/hmrPayload.d.ts +20 -6
  70. package/package.json +28 -14
  71. package/dist/rolldown/shared/rolldown-BnV7isAX.mjs +0 -40
  72. package/dist/tsdown/internal-DAh_SWnB.js +0 -3
  73. package/dist/tsdown/load-tsc-BKULZsrs-Bha6Vsu1.js +0 -18
  74. package/dist/tsdown/tsc-context-BhMGQ9Qr.js +0 -23
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
21
21
  value: mod,
22
22
  enumerable: true
23
23
  }) : target, mod));
@@ -29,9 +29,9 @@ var require_webcontainer_fallback = /* @__PURE__ */ __commonJSMin(((exports, mod
29
29
  const childProcess = __require("node:child_process");
30
30
  const version = JSON.parse(fs.readFileSync(__require.resolve("rolldown/package.json"), "utf-8")).version;
31
31
  const baseDir = `/tmp/rolldown-${version}`;
32
- const bindingEntry = `${baseDir}/node_modules/vite-plus/binding/rolldown-binding.wasi.cjs`;
32
+ const bindingEntry = `${baseDir}/node_modules/@rolldown/binding-wasm32-wasi/rolldown-binding.wasi.cjs`;
33
33
  if (!fs.existsSync(bindingEntry)) {
34
- const bindingPkg = `vite-plus/binding@${version}`;
34
+ const bindingPkg = `@rolldown/binding-wasm32-wasi@${version}`;
35
35
  fs.rmSync(baseDir, {
36
36
  recursive: true,
37
37
  force: true
@@ -101,9 +101,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
101
101
  loadErrors.push(e);
102
102
  }
103
103
  try {
104
- const binding = __require("vite-plus/binding");
105
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
106
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
104
+ const binding = __require("@rolldown/binding-android-arm64");
105
+ const bindingPackageVersion = __require("@rolldown/binding-android-arm64/package.json").version;
106
+ if (bindingPackageVersion !== "1.2.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.2.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);
@@ -115,9 +115,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
115
115
  loadErrors.push(e);
116
116
  }
117
117
  try {
118
- const binding = __require("vite-plus/binding");
119
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
120
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
118
+ const binding = __require("@rolldown/binding-android-arm-eabi");
119
+ const bindingPackageVersion = __require("@rolldown/binding-android-arm-eabi/package.json").version;
120
+ if (bindingPackageVersion !== "1.2.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.2.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
121
121
  return binding;
122
122
  } catch (e) {
123
123
  loadErrors.push(e);
@@ -130,9 +130,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
130
130
  loadErrors.push(e);
131
131
  }
132
132
  try {
133
- const binding = __require("vite-plus/binding");
134
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
135
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
133
+ const binding = __require("@rolldown/binding-win32-x64-gnu");
134
+ const bindingPackageVersion = __require("@rolldown/binding-win32-x64-gnu/package.json").version;
135
+ if (bindingPackageVersion !== "1.2.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.2.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
136
136
  return binding;
137
137
  } catch (e) {
138
138
  loadErrors.push(e);
@@ -144,9 +144,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
144
144
  loadErrors.push(e);
145
145
  }
146
146
  try {
147
- const binding = __require("vite-plus/binding");
148
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
149
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
147
+ const binding = __require("@voidzero-dev/vite-plus-win32-x64-msvc");
148
+ const bindingPackageVersion = __require("@voidzero-dev/vite-plus-win32-x64-msvc/package.json").version;
149
+ if (bindingPackageVersion !== "0.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
150
150
  return binding;
151
151
  } catch (e) {
152
152
  loadErrors.push(e);
@@ -159,9 +159,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
159
159
  loadErrors.push(e);
160
160
  }
161
161
  try {
162
- const binding = __require("vite-plus/binding");
163
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
164
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
162
+ const binding = __require("@rolldown/binding-win32-ia32-msvc");
163
+ const bindingPackageVersion = __require("@rolldown/binding-win32-ia32-msvc/package.json").version;
164
+ if (bindingPackageVersion !== "1.2.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.2.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
165
165
  return binding;
166
166
  } catch (e) {
167
167
  loadErrors.push(e);
@@ -173,9 +173,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
173
173
  loadErrors.push(e);
174
174
  }
175
175
  try {
176
- const binding = __require("vite-plus/binding");
177
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
178
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
176
+ const binding = __require("@voidzero-dev/vite-plus-win32-arm64-msvc");
177
+ const bindingPackageVersion = __require("@voidzero-dev/vite-plus-win32-arm64-msvc/package.json").version;
178
+ if (bindingPackageVersion !== "0.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
179
179
  return binding;
180
180
  } catch (e) {
181
181
  loadErrors.push(e);
@@ -188,9 +188,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
188
188
  loadErrors.push(e);
189
189
  }
190
190
  try {
191
- const binding = __require("vite-plus/binding");
192
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
193
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
191
+ const binding = __require("@rolldown/binding-darwin-universal");
192
+ const bindingPackageVersion = __require("@rolldown/binding-darwin-universal/package.json").version;
193
+ if (bindingPackageVersion !== "1.2.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.2.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
194
194
  return binding;
195
195
  } catch (e) {
196
196
  loadErrors.push(e);
@@ -202,9 +202,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
202
202
  loadErrors.push(e);
203
203
  }
204
204
  try {
205
- const binding = __require("vite-plus/binding");
206
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
207
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
205
+ const binding = __require("@voidzero-dev/vite-plus-darwin-x64");
206
+ const bindingPackageVersion = __require("@voidzero-dev/vite-plus-darwin-x64/package.json").version;
207
+ if (bindingPackageVersion !== "0.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
208
208
  return binding;
209
209
  } catch (e) {
210
210
  loadErrors.push(e);
@@ -216,9 +216,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
216
216
  loadErrors.push(e);
217
217
  }
218
218
  try {
219
- const binding = __require("vite-plus/binding");
220
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
221
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
219
+ const binding = __require("@voidzero-dev/vite-plus-darwin-arm64");
220
+ const bindingPackageVersion = __require("@voidzero-dev/vite-plus-darwin-arm64/package.json").version;
221
+ if (bindingPackageVersion !== "0.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
222
222
  return binding;
223
223
  } catch (e) {
224
224
  loadErrors.push(e);
@@ -231,9 +231,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
231
231
  loadErrors.push(e);
232
232
  }
233
233
  try {
234
- const binding = __require("vite-plus/binding");
235
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
236
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
234
+ const binding = __require("@rolldown/binding-freebsd-x64");
235
+ const bindingPackageVersion = __require("@rolldown/binding-freebsd-x64/package.json").version;
236
+ if (bindingPackageVersion !== "1.2.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.2.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
237
237
  return binding;
238
238
  } catch (e) {
239
239
  loadErrors.push(e);
@@ -245,9 +245,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
245
245
  loadErrors.push(e);
246
246
  }
247
247
  try {
248
- const binding = __require("vite-plus/binding");
249
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
250
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
248
+ const binding = __require("@rolldown/binding-freebsd-arm64");
249
+ const bindingPackageVersion = __require("@rolldown/binding-freebsd-arm64/package.json").version;
250
+ if (bindingPackageVersion !== "1.2.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.2.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
251
251
  return binding;
252
252
  } catch (e) {
253
253
  loadErrors.push(e);
@@ -260,9 +260,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
260
260
  loadErrors.push(e);
261
261
  }
262
262
  try {
263
- const binding = __require("vite-plus/binding");
264
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
265
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
263
+ const binding = __require("@voidzero-dev/vite-plus-linux-x64-musl");
264
+ const bindingPackageVersion = __require("@voidzero-dev/vite-plus-linux-x64-musl/package.json").version;
265
+ if (bindingPackageVersion !== "0.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
266
266
  return binding;
267
267
  } catch (e) {
268
268
  loadErrors.push(e);
@@ -274,9 +274,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
274
274
  loadErrors.push(e);
275
275
  }
276
276
  try {
277
- const binding = __require("vite-plus/binding");
278
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
279
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
277
+ const binding = __require("@voidzero-dev/vite-plus-linux-x64-gnu");
278
+ const bindingPackageVersion = __require("@voidzero-dev/vite-plus-linux-x64-gnu/package.json").version;
279
+ if (bindingPackageVersion !== "0.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
280
280
  return binding;
281
281
  } catch (e) {
282
282
  loadErrors.push(e);
@@ -289,9 +289,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
289
289
  loadErrors.push(e);
290
290
  }
291
291
  try {
292
- const binding = __require("vite-plus/binding");
293
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
294
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
292
+ const binding = __require("@voidzero-dev/vite-plus-linux-arm64-musl");
293
+ const bindingPackageVersion = __require("@voidzero-dev/vite-plus-linux-arm64-musl/package.json").version;
294
+ if (bindingPackageVersion !== "0.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
295
295
  return binding;
296
296
  } catch (e) {
297
297
  loadErrors.push(e);
@@ -303,9 +303,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
303
303
  loadErrors.push(e);
304
304
  }
305
305
  try {
306
- const binding = __require("vite-plus/binding");
307
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
308
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
306
+ const binding = __require("@voidzero-dev/vite-plus-linux-arm64-gnu");
307
+ const bindingPackageVersion = __require("@voidzero-dev/vite-plus-linux-arm64-gnu/package.json").version;
308
+ if (bindingPackageVersion !== "0.2.8" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
309
309
  return binding;
310
310
  } catch (e) {
311
311
  loadErrors.push(e);
@@ -318,9 +318,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
318
318
  loadErrors.push(e);
319
319
  }
320
320
  try {
321
- const binding = __require("vite-plus/binding");
322
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
323
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
321
+ const binding = __require("@rolldown/binding-linux-arm-musleabihf");
322
+ const bindingPackageVersion = __require("@rolldown/binding-linux-arm-musleabihf/package.json").version;
323
+ if (bindingPackageVersion !== "1.2.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.2.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
324
324
  return binding;
325
325
  } catch (e) {
326
326
  loadErrors.push(e);
@@ -332,9 +332,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
332
332
  loadErrors.push(e);
333
333
  }
334
334
  try {
335
- const binding = __require("vite-plus/binding");
336
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
337
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
335
+ const binding = __require("@rolldown/binding-linux-arm-gnueabihf");
336
+ const bindingPackageVersion = __require("@rolldown/binding-linux-arm-gnueabihf/package.json").version;
337
+ if (bindingPackageVersion !== "1.2.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.2.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
338
338
  return binding;
339
339
  } catch (e) {
340
340
  loadErrors.push(e);
@@ -347,9 +347,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
347
347
  loadErrors.push(e);
348
348
  }
349
349
  try {
350
- const binding = __require("vite-plus/binding");
351
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
352
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
350
+ const binding = __require("@rolldown/binding-linux-loong64-musl");
351
+ const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-musl/package.json").version;
352
+ if (bindingPackageVersion !== "1.2.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.2.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
353
353
  return binding;
354
354
  } catch (e) {
355
355
  loadErrors.push(e);
@@ -361,9 +361,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
361
361
  loadErrors.push(e);
362
362
  }
363
363
  try {
364
- const binding = __require("vite-plus/binding");
365
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
366
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
364
+ const binding = __require("@rolldown/binding-linux-loong64-gnu");
365
+ const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-gnu/package.json").version;
366
+ if (bindingPackageVersion !== "1.2.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.2.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
367
367
  return binding;
368
368
  } catch (e) {
369
369
  loadErrors.push(e);
@@ -376,9 +376,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
376
376
  loadErrors.push(e);
377
377
  }
378
378
  try {
379
- const binding = __require("vite-plus/binding");
380
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
381
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
379
+ const binding = __require("@rolldown/binding-linux-riscv64-musl");
380
+ const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-musl/package.json").version;
381
+ if (bindingPackageVersion !== "1.2.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.2.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
382
382
  return binding;
383
383
  } catch (e) {
384
384
  loadErrors.push(e);
@@ -390,9 +390,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
390
390
  loadErrors.push(e);
391
391
  }
392
392
  try {
393
- const binding = __require("vite-plus/binding");
394
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
395
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
393
+ const binding = __require("@rolldown/binding-linux-riscv64-gnu");
394
+ const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-gnu/package.json").version;
395
+ if (bindingPackageVersion !== "1.2.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.2.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
396
396
  return binding;
397
397
  } catch (e) {
398
398
  loadErrors.push(e);
@@ -405,9 +405,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
405
405
  loadErrors.push(e);
406
406
  }
407
407
  try {
408
- const binding = __require("vite-plus/binding");
409
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
410
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
408
+ const binding = __require("@rolldown/binding-linux-ppc64-gnu");
409
+ const bindingPackageVersion = __require("@rolldown/binding-linux-ppc64-gnu/package.json").version;
410
+ if (bindingPackageVersion !== "1.2.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.2.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
411
411
  return binding;
412
412
  } catch (e) {
413
413
  loadErrors.push(e);
@@ -419,9 +419,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
419
419
  loadErrors.push(e);
420
420
  }
421
421
  try {
422
- const binding = __require("vite-plus/binding");
423
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
424
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
422
+ const binding = __require("@rolldown/binding-linux-s390x-gnu");
423
+ const bindingPackageVersion = __require("@rolldown/binding-linux-s390x-gnu/package.json").version;
424
+ if (bindingPackageVersion !== "1.2.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.2.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
425
425
  return binding;
426
426
  } catch (e) {
427
427
  loadErrors.push(e);
@@ -434,9 +434,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
434
434
  loadErrors.push(e);
435
435
  }
436
436
  try {
437
- const binding = __require("vite-plus/binding");
438
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
439
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
437
+ const binding = __require("@rolldown/binding-openharmony-arm64");
438
+ const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm64/package.json").version;
439
+ if (bindingPackageVersion !== "1.2.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.2.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
440
440
  return binding;
441
441
  } catch (e) {
442
442
  loadErrors.push(e);
@@ -448,9 +448,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
448
448
  loadErrors.push(e);
449
449
  }
450
450
  try {
451
- const binding = __require("vite-plus/binding");
452
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
453
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
451
+ const binding = __require("@rolldown/binding-openharmony-x64");
452
+ const bindingPackageVersion = __require("@rolldown/binding-openharmony-x64/package.json").version;
453
+ if (bindingPackageVersion !== "1.2.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.2.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
454
454
  return binding;
455
455
  } catch (e) {
456
456
  loadErrors.push(e);
@@ -462,9 +462,9 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
462
462
  loadErrors.push(e);
463
463
  }
464
464
  try {
465
- const binding = __require("vite-plus/binding");
466
- const bindingPackageVersion = __require("vite-plus/binding/package.json").version;
467
- if (bindingPackageVersion !== "0.2.7" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 0.2.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
465
+ const binding = __require("@rolldown/binding-openharmony-arm");
466
+ const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm/package.json").version;
467
+ if (bindingPackageVersion !== "1.2.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.2.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
468
468
  return binding;
469
469
  } catch (e) {
470
470
  loadErrors.push(e);
@@ -472,30 +472,107 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
472
472
  } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
473
473
  else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
474
474
  }
475
- nativeBinding = requireNative();
476
- const forceWasi = process.env.NAPI_RS_FORCE_WASI === "true" || process.env.NAPI_RS_FORCE_WASI === "error";
475
+ function createLoadErrorChain(errors) {
476
+ return errors.reduce((previous, current) => {
477
+ let message;
478
+ try {
479
+ message = current && typeof current.message === "string" ? current.message : String(current);
480
+ } catch {
481
+ message = "Unknown error";
482
+ }
483
+ const error = new Error(message);
484
+ error.cause = previous;
485
+ return error;
486
+ }, null);
487
+ }
488
+ const __napiWasiFlavors = ["wasm32-wasi"];
489
+ const __napiWasiFlavor = process.env.NAPI_RS_WASI_FLAVOR;
490
+ const __napiWasiFlavorRequested = typeof __napiWasiFlavor === "string" && __napiWasiFlavor.length > 0;
491
+ if (__napiWasiFlavorRequested && __napiWasiFlavors.indexOf(__napiWasiFlavor) === -1) throw new Error("Unsupported WASI flavor \"" + __napiWasiFlavor + "\". Available flavors: " + __napiWasiFlavors.join(", "));
492
+ const forceWasiError = process.env.NAPI_RS_FORCE_WASI === "error";
493
+ const forceWasi = process.env.NAPI_RS_FORCE_WASI === "true" || forceWasiError || __napiWasiFlavorRequested;
494
+ if (!forceWasi) nativeBinding = requireNative();
477
495
  if (!nativeBinding || forceWasi) {
478
496
  let wasiBinding = null;
479
- let wasiBindingError = null;
480
- try {
481
- wasiBinding = __require("../rolldown-binding.wasi.cjs");
482
- nativeBinding = wasiBinding;
483
- } catch (err) {
484
- if (forceWasi) wasiBindingError = err;
497
+ let wasiBindingLoaded = false;
498
+ const wasiBindingErrors = [];
499
+ const __napiWasiResolveCandidate = (specifier, isPackage, localArtifacts) => {
500
+ try {
501
+ __require.resolve(specifier);
502
+ } catch (resolveError) {
503
+ if (!resolveError || resolveError.code !== "MODULE_NOT_FOUND") throw resolveError;
504
+ if (isPackage) {
505
+ try {
506
+ __require.resolve(specifier + "/package.json");
507
+ } catch (packageError) {
508
+ if (packageError && packageError.code === "MODULE_NOT_FOUND") return resolveError;
509
+ throw resolveError;
510
+ }
511
+ throw resolveError;
512
+ }
513
+ return resolveError;
514
+ }
515
+ if (localArtifacts) {
516
+ let artifactError = null;
517
+ for (let i = 0; i < localArtifacts.length; i++) try {
518
+ __require.resolve(localArtifacts[i]);
519
+ return null;
520
+ } catch (resolveError) {
521
+ if (!resolveError || resolveError.code !== "MODULE_NOT_FOUND") throw resolveError;
522
+ artifactError = resolveError;
523
+ }
524
+ return artifactError;
525
+ }
526
+ return null;
527
+ };
528
+ if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")) {
529
+ let candidateError = null;
530
+ let candidateFailed = false;
531
+ try {
532
+ candidateError = __napiWasiResolveCandidate("./rolldown-binding.wasi.cjs", false, ["./rolldown-binding.wasm32-wasi.debug.wasm", "./rolldown-binding.wasm32-wasi.wasm"]);
533
+ candidateFailed = candidateError !== null;
534
+ if (!candidateFailed) {
535
+ wasiBinding = __require("../rolldown-binding.wasi.cjs");
536
+ nativeBinding = wasiBinding;
537
+ wasiBindingLoaded = true;
538
+ }
539
+ } catch (err) {
540
+ candidateError = err;
541
+ candidateFailed = true;
542
+ }
543
+ if (candidateFailed) {
544
+ wasiBindingErrors.push(candidateError);
545
+ loadErrors.push(candidateError);
546
+ }
485
547
  }
486
- if (!nativeBinding || forceWasi) try {
487
- wasiBinding = __require("vite-plus/binding");
488
- nativeBinding = wasiBinding;
489
- } catch (err) {
490
- if (forceWasi) {
491
- if (!wasiBindingError) wasiBindingError = err;
492
- else wasiBindingError.cause = err;
493
- loadErrors.push(err);
548
+ if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")) {
549
+ let candidateError = null;
550
+ let candidateFailed = false;
551
+ try {
552
+ candidateError = __napiWasiResolveCandidate("@rolldown/binding-wasm32-wasi", true, void 0);
553
+ candidateFailed = candidateError !== null;
554
+ if (!candidateFailed) {
555
+ if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
556
+ const bindingPackageVersion = __require("@rolldown/binding-wasm32-wasi/package.json").version;
557
+ if (bindingPackageVersion !== "1.2.2") throw new Error(`WASI binding package version mismatch, expected 1.2.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
558
+ }
559
+ wasiBinding = __require("@rolldown/binding-wasm32-wasi");
560
+ nativeBinding = wasiBinding;
561
+ wasiBindingLoaded = true;
562
+ }
563
+ } catch (err) {
564
+ candidateError = err;
565
+ candidateFailed = true;
566
+ }
567
+ if (candidateFailed) {
568
+ wasiBindingErrors.push(candidateError);
569
+ loadErrors.push(candidateError);
494
570
  }
495
571
  }
496
- if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
497
- const error = /* @__PURE__ */ new Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
498
- error.cause = wasiBindingError;
572
+ if (!wasiBindingLoaded && forceWasi && !forceWasiError && !__napiWasiFlavorRequested) nativeBinding = requireNative();
573
+ if ((forceWasiError || __napiWasiFlavorRequested) && !wasiBindingLoaded) {
574
+ const error = /* @__PURE__ */ new Error(__napiWasiFlavorRequested ? "WASI binding for flavor \"" + __napiWasiFlavor + "\" not found" : "WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
575
+ error.cause = createLoadErrorChain(wasiBindingErrors);
499
576
  throw error;
500
577
  }
501
578
  }
@@ -507,10 +584,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
507
584
  if (!nativeBinding) {
508
585
  if (loadErrors.length > 0) {
509
586
  const error = /* @__PURE__ */ new Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.");
510
- error.cause = loadErrors.reduce((err, cur) => {
511
- cur.cause = err;
512
- return cur;
513
- });
587
+ error.cause = createLoadErrorChain(loadErrors);
514
588
  throw error;
515
589
  }
516
590
  throw new Error(`Failed to load native binding`);