vite-plus 0.3.1 → 0.3.3

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 (63) hide show
  1. package/README.md +1 -1
  2. package/bin/vp +1 -1
  3. package/binding/index.cjs +137 -56
  4. package/binding/index.d.cts +52 -0
  5. package/dist/{agent-C5jMYVfB.js → agent-Cu6-tXIP.js} +2 -2
  6. package/dist/bin.js +6 -5
  7. package/dist/config/bin.js +2 -2
  8. package/dist/{constants-0IAVgpox.js → constants-C2dTOTe-.js} +2 -2
  9. package/dist/create/bin.js +97 -68
  10. package/dist/{define-config-DIE9de46.cjs → define-config-D0mevyb3.cjs} +1 -1
  11. package/dist/{define-config-U3_xg7i-.js → define-config-IgzmnvvV.js} +2 -2
  12. package/dist/define-config.cjs +1 -1
  13. package/dist/define-config.js +1 -1
  14. package/dist/{editor-B5-lvRaU.js → editor-4sjlHmUh.js} +154 -36
  15. package/dist/index.cjs +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/lint-plugins-dev.d.ts +3 -0
  18. package/dist/lint-plugins-dev.js +2 -0
  19. package/dist/lint-plugins.cjs +21 -0
  20. package/dist/lint-plugins.d.ts +3 -0
  21. package/dist/lint-plugins.js +2 -0
  22. package/dist/migration/bin.js +7 -7
  23. package/dist/{oxlint-plugin-config-Drdl67Xp.js → oxlint-plugin-config-BVqEe9KY.js} +1 -1
  24. package/dist/oxlint-plugin.js +93 -32
  25. package/dist/pack-bin.js +1 -1
  26. package/dist/{package-BZz2Ij68.js → package-CHH8jWan.js} +1 -1
  27. package/dist/{prompts-CtzEgFY-.js → prompts-k14KgthC.js} +1 -1
  28. package/dist/{resolve-vite-config-CGks1xR7.js → resolve-vite-config-BqvS2P98.js} +2 -2
  29. package/dist/{resolve-vite-config-Dnmc-lBc.js → resolve-vite-config-CTOTuqTi.js} +1 -1
  30. package/dist/staged/bin.js +1 -1
  31. package/dist/toolchain.js +8 -8
  32. package/dist/toolchain.json +8 -8
  33. package/dist/{tsconfig-CUggNuJR.js → tsconfig-C3h9CVTA.js} +2 -2
  34. package/dist/{tsconfig-VAbm4ZzJ.js → tsconfig-euB-GmIE.js} +1 -1
  35. package/dist/version.js +2 -2
  36. package/dist/versions.js +4 -4
  37. package/docs/config/fmt.md +4 -2
  38. package/docs/config/lint.md +4 -2
  39. package/docs/config/staged.md +1 -2
  40. package/docs/guide/ci.md +28 -31
  41. package/docs/guide/commit-hooks.md +11 -34
  42. package/docs/guide/create.md +1 -2
  43. package/docs/guide/docker.md +20 -68
  44. package/docs/guide/env.md +56 -22
  45. package/docs/guide/fmt.md +3 -1
  46. package/docs/guide/global-cli.md +426 -0
  47. package/docs/guide/ide-integration.md +1 -2
  48. package/docs/guide/implode.md +14 -1
  49. package/docs/guide/index.md +37 -34
  50. package/docs/guide/install.md +18 -19
  51. package/docs/guide/lint.md +52 -1
  52. package/docs/guide/local-cli.md +123 -0
  53. package/docs/guide/migrate-rules.md +108 -267
  54. package/docs/guide/migrate.md +6 -49
  55. package/docs/guide/monorepo.md +2 -0
  56. package/docs/guide/run.md +1 -1
  57. package/docs/guide/troubleshooting.md +17 -8
  58. package/docs/guide/upgrade-project.md +61 -0
  59. package/docs/guide/upgrade.md +17 -62
  60. package/package.json +26 -17
  61. package/templates/generator/README.md +14 -0
  62. package/templates/generator/bin/index.ts +54 -5
  63. package/docs/guide/installer-env-vars.md +0 -252
package/README.md CHANGED
@@ -73,7 +73,7 @@ export default defineConfig({
73
73
  tasks: {
74
74
  'generate:icons': {
75
75
  command: 'node scripts/generate-icons.js',
76
- envs: ['ICON_THEME'],
76
+ env: ['ICON_THEME'],
77
77
  },
78
78
  },
79
79
  },
package/bin/vp CHANGED
@@ -4,4 +4,4 @@ import module from 'node:module';
4
4
  if (module.enableCompileCache) {
5
5
  module.enableCompileCache();
6
6
  }
7
- import '../dist/bin.js';
7
+ await import('../dist/bin.js');
package/binding/index.cjs CHANGED
@@ -1,10 +1,13 @@
1
- // prettier-ignore
2
1
  /* eslint-disable */
3
2
  // @ts-nocheck
4
3
  /* auto-generated by NAPI-RS */
5
4
 
6
5
  const { readFileSync } = require('fs');
7
6
  let nativeBinding = null;
7
+ // Which artifact actually loaded. The WASI fallback chain overwrites it with
8
+ // the flavor it resolved; the late native retry below leaves it alone because
9
+ // it only runs while no WASI candidate has been loaded.
10
+ let __napiLoadedBindingTarget = 'native';
8
11
  const loadErrors = [];
9
12
 
10
13
  const isMusl = () => {
@@ -65,7 +68,16 @@ const isMuslFromChildProcess = () => {
65
68
  function requireNative() {
66
69
  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
67
70
  try {
68
- return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
71
+ const overrideBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
72
+ // The override may be a generated WASI loader, which already reports its
73
+ // own flavor. Adopt it: `module.exports` aliases this object, so claiming
74
+ // 'native' would both misreport the artifact and overwrite the loader's
75
+ // marker through the alias.
76
+ __napiLoadedBindingTarget =
77
+ overrideBinding && typeof overrideBinding.__napiBindingTarget === 'string'
78
+ ? overrideBinding.__napiBindingTarget
79
+ : 'native';
80
+ return overrideBinding;
69
81
  } catch (err) {
70
82
  loadErrors.push(err);
71
83
  }
@@ -81,12 +93,12 @@ function requireNative() {
81
93
  const bindingPackageVersion =
82
94
  require('@voidzero-dev/vite-plus-android-arm64/package.json').version;
83
95
  if (
84
- bindingPackageVersion !== '0.3.1' &&
96
+ bindingPackageVersion !== '0.3.3' &&
85
97
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
86
98
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
87
99
  ) {
88
100
  throw new Error(
89
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
101
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
90
102
  );
91
103
  }
92
104
  return binding;
@@ -104,12 +116,12 @@ function requireNative() {
104
116
  const bindingPackageVersion =
105
117
  require('@voidzero-dev/vite-plus-android-arm-eabi/package.json').version;
106
118
  if (
107
- bindingPackageVersion !== '0.3.1' &&
119
+ bindingPackageVersion !== '0.3.3' &&
108
120
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
109
121
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
110
122
  ) {
111
123
  throw new Error(
112
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
124
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
113
125
  );
114
126
  }
115
127
  return binding;
@@ -139,12 +151,12 @@ function requireNative() {
139
151
  const bindingPackageVersion =
140
152
  require('@voidzero-dev/vite-plus-win32-x64-gnu/package.json').version;
141
153
  if (
142
- bindingPackageVersion !== '0.3.1' &&
154
+ bindingPackageVersion !== '0.3.3' &&
143
155
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
144
156
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
145
157
  ) {
146
158
  throw new Error(
147
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
159
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
148
160
  );
149
161
  }
150
162
  return binding;
@@ -162,12 +174,12 @@ function requireNative() {
162
174
  const bindingPackageVersion =
163
175
  require('@voidzero-dev/vite-plus-win32-x64-msvc/package.json').version;
164
176
  if (
165
- bindingPackageVersion !== '0.3.1' &&
177
+ bindingPackageVersion !== '0.3.3' &&
166
178
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
167
179
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
168
180
  ) {
169
181
  throw new Error(
170
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
182
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
171
183
  );
172
184
  }
173
185
  return binding;
@@ -186,12 +198,12 @@ function requireNative() {
186
198
  const bindingPackageVersion =
187
199
  require('@voidzero-dev/vite-plus-win32-ia32-msvc/package.json').version;
188
200
  if (
189
- bindingPackageVersion !== '0.3.1' &&
201
+ bindingPackageVersion !== '0.3.3' &&
190
202
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
191
203
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
192
204
  ) {
193
205
  throw new Error(
194
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
206
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
195
207
  );
196
208
  }
197
209
  return binding;
@@ -209,12 +221,12 @@ function requireNative() {
209
221
  const bindingPackageVersion =
210
222
  require('@voidzero-dev/vite-plus-win32-arm64-msvc/package.json').version;
211
223
  if (
212
- bindingPackageVersion !== '0.3.1' &&
224
+ bindingPackageVersion !== '0.3.3' &&
213
225
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
214
226
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
215
227
  ) {
216
228
  throw new Error(
217
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
229
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
218
230
  );
219
231
  }
220
232
  return binding;
@@ -235,12 +247,12 @@ function requireNative() {
235
247
  const bindingPackageVersion =
236
248
  require('@voidzero-dev/vite-plus-darwin-universal/package.json').version;
237
249
  if (
238
- bindingPackageVersion !== '0.3.1' &&
250
+ bindingPackageVersion !== '0.3.3' &&
239
251
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
240
252
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
241
253
  ) {
242
254
  throw new Error(
243
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
255
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
244
256
  );
245
257
  }
246
258
  return binding;
@@ -258,12 +270,12 @@ function requireNative() {
258
270
  const bindingPackageVersion =
259
271
  require('@voidzero-dev/vite-plus-darwin-x64/package.json').version;
260
272
  if (
261
- bindingPackageVersion !== '0.3.1' &&
273
+ bindingPackageVersion !== '0.3.3' &&
262
274
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
263
275
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
264
276
  ) {
265
277
  throw new Error(
266
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
278
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
267
279
  );
268
280
  }
269
281
  return binding;
@@ -281,12 +293,12 @@ function requireNative() {
281
293
  const bindingPackageVersion =
282
294
  require('@voidzero-dev/vite-plus-darwin-arm64/package.json').version;
283
295
  if (
284
- bindingPackageVersion !== '0.3.1' &&
296
+ bindingPackageVersion !== '0.3.3' &&
285
297
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
286
298
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
287
299
  ) {
288
300
  throw new Error(
289
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
301
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
290
302
  );
291
303
  }
292
304
  return binding;
@@ -308,12 +320,12 @@ function requireNative() {
308
320
  const bindingPackageVersion =
309
321
  require('@voidzero-dev/vite-plus-freebsd-x64/package.json').version;
310
322
  if (
311
- bindingPackageVersion !== '0.3.1' &&
323
+ bindingPackageVersion !== '0.3.3' &&
312
324
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
313
325
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
314
326
  ) {
315
327
  throw new Error(
316
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
328
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
317
329
  );
318
330
  }
319
331
  return binding;
@@ -331,12 +343,12 @@ function requireNative() {
331
343
  const bindingPackageVersion =
332
344
  require('@voidzero-dev/vite-plus-freebsd-arm64/package.json').version;
333
345
  if (
334
- bindingPackageVersion !== '0.3.1' &&
346
+ bindingPackageVersion !== '0.3.3' &&
335
347
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
336
348
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
337
349
  ) {
338
350
  throw new Error(
339
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
351
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
340
352
  );
341
353
  }
342
354
  return binding;
@@ -359,12 +371,12 @@ function requireNative() {
359
371
  const bindingPackageVersion =
360
372
  require('@voidzero-dev/vite-plus-linux-x64-musl/package.json').version;
361
373
  if (
362
- bindingPackageVersion !== '0.3.1' &&
374
+ bindingPackageVersion !== '0.3.3' &&
363
375
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
364
376
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
365
377
  ) {
366
378
  throw new Error(
367
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
379
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
368
380
  );
369
381
  }
370
382
  return binding;
@@ -382,12 +394,12 @@ function requireNative() {
382
394
  const bindingPackageVersion =
383
395
  require('@voidzero-dev/vite-plus-linux-x64-gnu/package.json').version;
384
396
  if (
385
- bindingPackageVersion !== '0.3.1' &&
397
+ bindingPackageVersion !== '0.3.3' &&
386
398
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
387
399
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
388
400
  ) {
389
401
  throw new Error(
390
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
402
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
391
403
  );
392
404
  }
393
405
  return binding;
@@ -407,12 +419,12 @@ function requireNative() {
407
419
  const bindingPackageVersion =
408
420
  require('@voidzero-dev/vite-plus-linux-arm64-musl/package.json').version;
409
421
  if (
410
- bindingPackageVersion !== '0.3.1' &&
422
+ bindingPackageVersion !== '0.3.3' &&
411
423
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
412
424
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
413
425
  ) {
414
426
  throw new Error(
415
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
427
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
416
428
  );
417
429
  }
418
430
  return binding;
@@ -430,12 +442,12 @@ function requireNative() {
430
442
  const bindingPackageVersion =
431
443
  require('@voidzero-dev/vite-plus-linux-arm64-gnu/package.json').version;
432
444
  if (
433
- bindingPackageVersion !== '0.3.1' &&
445
+ bindingPackageVersion !== '0.3.3' &&
434
446
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
435
447
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
436
448
  ) {
437
449
  throw new Error(
438
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
450
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
439
451
  );
440
452
  }
441
453
  return binding;
@@ -455,12 +467,12 @@ function requireNative() {
455
467
  const bindingPackageVersion =
456
468
  require('@voidzero-dev/vite-plus-linux-arm-musleabihf/package.json').version;
457
469
  if (
458
- bindingPackageVersion !== '0.3.1' &&
470
+ bindingPackageVersion !== '0.3.3' &&
459
471
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
460
472
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
461
473
  ) {
462
474
  throw new Error(
463
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
475
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
464
476
  );
465
477
  }
466
478
  return binding;
@@ -478,12 +490,12 @@ function requireNative() {
478
490
  const bindingPackageVersion =
479
491
  require('@voidzero-dev/vite-plus-linux-arm-gnueabihf/package.json').version;
480
492
  if (
481
- bindingPackageVersion !== '0.3.1' &&
493
+ bindingPackageVersion !== '0.3.3' &&
482
494
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
483
495
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
484
496
  ) {
485
497
  throw new Error(
486
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
498
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
487
499
  );
488
500
  }
489
501
  return binding;
@@ -503,12 +515,12 @@ function requireNative() {
503
515
  const bindingPackageVersion =
504
516
  require('@voidzero-dev/vite-plus-linux-loong64-musl/package.json').version;
505
517
  if (
506
- bindingPackageVersion !== '0.3.1' &&
518
+ bindingPackageVersion !== '0.3.3' &&
507
519
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
508
520
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
509
521
  ) {
510
522
  throw new Error(
511
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
523
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
512
524
  );
513
525
  }
514
526
  return binding;
@@ -526,12 +538,12 @@ function requireNative() {
526
538
  const bindingPackageVersion =
527
539
  require('@voidzero-dev/vite-plus-linux-loong64-gnu/package.json').version;
528
540
  if (
529
- bindingPackageVersion !== '0.3.1' &&
541
+ bindingPackageVersion !== '0.3.3' &&
530
542
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
531
543
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
532
544
  ) {
533
545
  throw new Error(
534
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
546
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
535
547
  );
536
548
  }
537
549
  return binding;
@@ -551,12 +563,12 @@ function requireNative() {
551
563
  const bindingPackageVersion =
552
564
  require('@voidzero-dev/vite-plus-linux-riscv64-musl/package.json').version;
553
565
  if (
554
- bindingPackageVersion !== '0.3.1' &&
566
+ bindingPackageVersion !== '0.3.3' &&
555
567
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
556
568
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
557
569
  ) {
558
570
  throw new Error(
559
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
571
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
560
572
  );
561
573
  }
562
574
  return binding;
@@ -574,12 +586,12 @@ function requireNative() {
574
586
  const bindingPackageVersion =
575
587
  require('@voidzero-dev/vite-plus-linux-riscv64-gnu/package.json').version;
576
588
  if (
577
- bindingPackageVersion !== '0.3.1' &&
589
+ bindingPackageVersion !== '0.3.3' &&
578
590
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
579
591
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
580
592
  ) {
581
593
  throw new Error(
582
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
594
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
583
595
  );
584
596
  }
585
597
  return binding;
@@ -598,12 +610,12 @@ function requireNative() {
598
610
  const bindingPackageVersion =
599
611
  require('@voidzero-dev/vite-plus-linux-ppc64-gnu/package.json').version;
600
612
  if (
601
- bindingPackageVersion !== '0.3.1' &&
613
+ bindingPackageVersion !== '0.3.3' &&
602
614
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
603
615
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
604
616
  ) {
605
617
  throw new Error(
606
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
618
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
607
619
  );
608
620
  }
609
621
  return binding;
@@ -621,12 +633,12 @@ function requireNative() {
621
633
  const bindingPackageVersion =
622
634
  require('@voidzero-dev/vite-plus-linux-s390x-gnu/package.json').version;
623
635
  if (
624
- bindingPackageVersion !== '0.3.1' &&
636
+ bindingPackageVersion !== '0.3.3' &&
625
637
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
626
638
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
627
639
  ) {
628
640
  throw new Error(
629
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
641
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
630
642
  );
631
643
  }
632
644
  return binding;
@@ -648,12 +660,12 @@ function requireNative() {
648
660
  const bindingPackageVersion =
649
661
  require('@voidzero-dev/vite-plus-openharmony-arm64/package.json').version;
650
662
  if (
651
- bindingPackageVersion !== '0.3.1' &&
663
+ bindingPackageVersion !== '0.3.3' &&
652
664
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
653
665
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
654
666
  ) {
655
667
  throw new Error(
656
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
668
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
657
669
  );
658
670
  }
659
671
  return binding;
@@ -671,12 +683,12 @@ function requireNative() {
671
683
  const bindingPackageVersion =
672
684
  require('@voidzero-dev/vite-plus-openharmony-x64/package.json').version;
673
685
  if (
674
- bindingPackageVersion !== '0.3.1' &&
686
+ bindingPackageVersion !== '0.3.3' &&
675
687
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
676
688
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
677
689
  ) {
678
690
  throw new Error(
679
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
691
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
680
692
  );
681
693
  }
682
694
  return binding;
@@ -694,12 +706,12 @@ function requireNative() {
694
706
  const bindingPackageVersion =
695
707
  require('@voidzero-dev/vite-plus-openharmony-arm/package.json').version;
696
708
  if (
697
- bindingPackageVersion !== '0.3.1' &&
709
+ bindingPackageVersion !== '0.3.3' &&
698
710
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
699
711
  process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
700
712
  ) {
701
713
  throw new Error(
702
- `Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
714
+ `Native binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
703
715
  );
704
716
  }
705
717
  return binding;
@@ -816,6 +828,7 @@ if (!nativeBinding || forceWasi) {
816
828
  if (!candidateFailed) {
817
829
  wasiBinding = require('./vite-plus.wasi.cjs');
818
830
  nativeBinding = wasiBinding;
831
+ __napiLoadedBindingTarget = 'wasm32-wasi';
819
832
  wasiBindingLoaded = true;
820
833
  }
821
834
  } catch (err) {
@@ -844,14 +857,15 @@ if (!nativeBinding || forceWasi) {
844
857
  ) {
845
858
  const bindingPackageVersion =
846
859
  require('@voidzero-dev/vite-plus-wasm32-wasi/package.json').version;
847
- if (bindingPackageVersion !== '0.3.1') {
860
+ if (bindingPackageVersion !== '0.3.3') {
848
861
  throw new Error(
849
- `WASI binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
862
+ `WASI binding package version mismatch, expected 0.3.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
850
863
  );
851
864
  }
852
865
  }
853
866
  wasiBinding = require('@voidzero-dev/vite-plus-wasm32-wasi');
854
867
  nativeBinding = wasiBinding;
868
+ __napiLoadedBindingTarget = 'wasm32-wasi';
855
869
  wasiBindingLoaded = true;
856
870
  }
857
871
  } catch (err) {
@@ -892,6 +906,71 @@ if (!nativeBinding) {
892
906
  throw new Error(`Failed to load native binding`);
893
907
  }
894
908
 
909
+ function __napiStampBindingTarget(exportsObject, target) {
910
+ if (Object.prototype.hasOwnProperty.call(exportsObject, '__napiBindingTarget')) {
911
+ if (exportsObject.__napiBindingTarget === target) {
912
+ // Already ours: the root entry aliases the object it loaded, so a WASI
913
+ // fallback candidate — or a `NAPI_RS_NATIVE_LIBRARY_PATH` override that
914
+ // is a generated loader — arrives already stamped with this same value.
915
+ return target;
916
+ }
917
+ const error = new Error(
918
+ '`__napiBindingTarget` is reserved by the generated binding loader, but the loaded binding already exports it. Rename the export, e.g. #[napi(js_name = "...")].',
919
+ );
920
+ error.code = 'ERR_NAPI_BINDING_TARGET_CONFLICT';
921
+ throw error;
922
+ }
923
+ if (!Object.isExtensible(exportsObject)) {
924
+ // A `#[napi(module_exports)]` hook may seal or freeze this object
925
+ // (`Object::seal` / `Object::freeze`). Reporting the artifact is metadata,
926
+ // never a reason to fail an otherwise successful load, so the stamp is
927
+ // skipped. What a consumer still sees then follows the entry point: the
928
+ // browser and deferred loaders declare `__napiBindingTarget` at module
929
+ // level and go on reporting it, while the CommonJS entries hand back this
930
+ // very object as `module.exports`, so there the value is absent.
931
+ return target;
932
+ }
933
+ try {
934
+ // [[Define]], not [[Set]]: an ordinary assignment walks the prototype
935
+ // chain, so an inherited accessor could swallow the value or throw and
936
+ // fail an otherwise successful load. The descriptor is what a successful
937
+ // assignment would have produced.
938
+ Object.defineProperty(exportsObject, '__napiBindingTarget', {
939
+ configurable: true,
940
+ enumerable: true,
941
+ value: target,
942
+ writable: true,
943
+ });
944
+ } catch {
945
+ // Same rule as the non-extensible skip above: reporting the artifact is
946
+ // metadata, never a reason to fail an otherwise successful load. An exotic
947
+ // object (a Proxy whose defineProperty trap refuses) is skipped, not
948
+ // thrown over.
949
+ }
950
+ // The CommonJS loaders assign this return value so `cjs-module-lexer` — and
951
+ // therefore Node's CJS -> ESM named export detection — can see
952
+ // `__napiBindingTarget` statically.
953
+ return target;
954
+ }
955
+ // Stamp before the alias, not after. The guard only reads `nativeBinding`
956
+ // (`hasOwnProperty` plus a comparison), which is safe against any addon
957
+ // accessor; an assignment is not, because a `#[napi(module_exports)]` hook can
958
+ // expose a getter reporting this very value and a setter that throws. So the
959
+ // assignment lands on the loader's own `module.exports`, still the original
960
+ // object here, and the alias below replaces it.
961
+ //
962
+ // The assignment is what keeps the marker a statically visible CommonJS export:
963
+ // `cjs-module-lexer` is Node's CJS -> ESM named export detection, it cannot see
964
+ // a bare call, and the later `module.exports = nativeBinding` does not undo the
965
+ // detection. The assignment itself always succeeds — its target is this
966
+ // loader's own, still extensible `module.exports` — and the alias below then
967
+ // discards the value it wrote. What a consumer reads is whatever the guard put
968
+ // on `nativeBinding`, so on a frozen binding, where the guard skips, the
969
+ // linked import resolves to `undefined`.
970
+ module.exports.__napiBindingTarget = __napiStampBindingTarget(
971
+ nativeBinding,
972
+ __napiLoadedBindingTarget,
973
+ );
895
974
  module.exports = nativeBinding;
896
975
  module.exports.LegalCommentsMode = nativeBinding.LegalCommentsMode;
897
976
  module.exports.minify = nativeBinding.minify;
@@ -942,6 +1021,7 @@ module.exports.BindingWatcherEvent = nativeBinding.BindingWatcherEvent;
942
1021
  module.exports.ParallelJsPluginRegistry = nativeBinding.ParallelJsPluginRegistry;
943
1022
  module.exports.TraceSubscriberGuard = nativeBinding.TraceSubscriberGuard;
944
1023
  module.exports.TsconfigCache = nativeBinding.TsconfigCache;
1024
+ module.exports.__internalForcePanic = nativeBinding.__internalForcePanic;
945
1025
  module.exports.BindingAttachDebugInfo = nativeBinding.BindingAttachDebugInfo;
946
1026
  module.exports.BindingBuiltinPluginName = nativeBinding.BindingBuiltinPluginName;
947
1027
  module.exports.BindingChunkModuleOrderBy = nativeBinding.BindingChunkModuleOrderBy;
@@ -974,6 +1054,7 @@ module.exports.parseCreateArgs = nativeBinding.parseCreateArgs;
974
1054
  module.exports.parseHooksArgs = nativeBinding.parseHooksArgs;
975
1055
  module.exports.parseMigrateArgs = nativeBinding.parseMigrateArgs;
976
1056
  module.exports.parseStagedArgs = nativeBinding.parseStagedArgs;
1057
+ module.exports.removeConfigKey = nativeBinding.removeConfigKey;
977
1058
  module.exports.rewriteEslint = nativeBinding.rewriteEslint;
978
1059
  module.exports.rewriteImportsInDirectory = nativeBinding.rewriteImportsInDirectory;
979
1060
  module.exports.rewritePrettier = nativeBinding.rewritePrettier;