@oxc-parser/binding-wasm32-wasi 0.61.2 → 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.
@@ -5,7 +5,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
5
5
  throw Error('Dynamic require of "' + x + '" is not supported');
6
6
  });
7
7
 
8
- // ../../node_modules/.pnpm/@napi-rs+wasm-runtime@0.2.7/node_modules/@napi-rs/wasm-runtime/dist/runtime.js
8
+ // ../../node_modules/.pnpm/@napi-rs+wasm-runtime@0.2.8/node_modules/@napi-rs/wasm-runtime/dist/runtime.js
9
9
  var _WebAssembly$2 = typeof WebAssembly !== "undefined" ? WebAssembly : typeof WXWebAssembly !== "undefined" ? WXWebAssembly : void 0;
10
10
  var ENVIRONMENT_IS_NODE = false;
11
11
  function getPostMessage(options) {
@@ -1458,7 +1458,7 @@ function createNapiModule(options) {
1458
1458
  );
1459
1459
  if (!envObject.canCallIntoJs())
1460
1460
  return envObject.setLastError(
1461
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
1461
+ envObject.moduleApiVersion >= 10 ? 23 : 10
1462
1462
  /* napi_status.napi_pending_exception */
1463
1463
  );
1464
1464
  envObject.clearLastError();
@@ -3133,7 +3133,7 @@ function createNapiModule(options) {
3133
3133
  );
3134
3134
  if (!envObject.canCallIntoJs())
3135
3135
  return envObject.setLastError(
3136
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
3136
+ envObject.moduleApiVersion >= 10 ? 23 : 10
3137
3137
  /* napi_status.napi_pending_exception */
3138
3138
  );
3139
3139
  envObject.clearLastError();
@@ -3206,7 +3206,7 @@ function createNapiModule(options) {
3206
3206
  );
3207
3207
  if (!envObject.canCallIntoJs())
3208
3208
  return envObject.setLastError(
3209
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
3209
+ envObject.moduleApiVersion >= 10 ? 23 : 10
3210
3210
  /* napi_status.napi_pending_exception */
3211
3211
  );
3212
3212
  envObject.clearLastError();
@@ -3390,7 +3390,7 @@ function createNapiModule(options) {
3390
3390
  );
3391
3391
  if (!envObject.canCallIntoJs())
3392
3392
  return envObject.setLastError(
3393
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
3393
+ envObject.moduleApiVersion >= 10 ? 23 : 10
3394
3394
  /* napi_status.napi_pending_exception */
3395
3395
  );
3396
3396
  envObject.clearLastError();
@@ -3667,7 +3667,7 @@ function createNapiModule(options) {
3667
3667
  /* napi_status.napi_invalid_arg */
3668
3668
  );
3669
3669
  }
3670
- var p = handle.data(envObject);
3670
+ var p = handle.data();
3671
3671
  var HEAP_DATA_VIEW = new DataView(wasmMemory.buffer);
3672
3672
  HEAP_DATA_VIEW.setInt32(result, p, true);
3673
3673
  return envObject.clearLastError();
@@ -4076,7 +4076,7 @@ function createNapiModule(options) {
4076
4076
  );
4077
4077
  if (!envObject.canCallIntoJs())
4078
4078
  return envObject.setLastError(
4079
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
4079
+ envObject.moduleApiVersion >= 10 ? 23 : 10
4080
4080
  /* napi_status.napi_pending_exception */
4081
4081
  );
4082
4082
  envObject.clearLastError();
@@ -4143,39 +4143,48 @@ function createNapiModule(options) {
4143
4143
  function emnapiCreateFunction(envObject, utf8name, length, cb, data) {
4144
4144
  var functionName = !utf8name || !length ? "" : emnapiString.UTF8ToString(utf8name, length);
4145
4145
  var f;
4146
- var makeFunction = function() {
4146
+ var napiCallback = wasmTable.get(cb);
4147
+ var callback = function(envObject2) {
4148
+ return napiCallback(envObject2.id, envObject2.ctx.scopeStore.currentScope.id);
4149
+ };
4150
+ var makeFunction = function(envObject2, callback2) {
4147
4151
  return function() {
4148
- var cbinfo = emnapiCtx.cbinfoStack.push(this, data, arguments, f);
4149
- var scope = emnapiCtx.openScope(envObject);
4152
+ var scope = envObject2.ctx.openScope(envObject2);
4153
+ var callbackInfo = scope.callbackInfo;
4154
+ callbackInfo.data = data;
4155
+ callbackInfo.args = arguments;
4156
+ callbackInfo.thiz = this;
4157
+ callbackInfo.fn = f;
4150
4158
  try {
4151
- return envObject.callIntoModule(function(envObject2) {
4152
- var napiValue = wasmTable.get(cb)(envObject2.id, cbinfo);
4153
- return !napiValue ? void 0 : emnapiCtx.handleStore.get(napiValue).value;
4154
- });
4159
+ var napiValue = envObject2.callIntoModule(callback2);
4160
+ return !napiValue ? void 0 : envObject2.ctx.handleStore.get(napiValue).value;
4155
4161
  } finally {
4156
- emnapiCtx.cbinfoStack.pop();
4157
- emnapiCtx.closeScope(envObject, scope);
4162
+ callbackInfo.data = 0;
4163
+ callbackInfo.args = void 0;
4164
+ callbackInfo.thiz = void 0;
4165
+ callbackInfo.fn = void 0;
4166
+ envObject2.ctx.closeScope(envObject2, scope);
4158
4167
  }
4159
4168
  };
4160
4169
  };
4161
4170
  if (functionName === "") {
4162
- f = makeFunction();
4171
+ f = makeFunction(envObject, callback);
4163
4172
  return { status: 0, f };
4164
4173
  }
4165
4174
  if (!/^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(functionName)) {
4166
4175
  return { status: 1, f: void 0 };
4167
4176
  }
4168
4177
  if (emnapiCtx.feature.supportNewFunction) {
4169
- var _ = makeFunction();
4178
+ var _ = makeFunction(envObject, callback);
4170
4179
  try {
4171
4180
  f = new Function("_", "return function " + functionName + '(){"use strict";return _.apply(this,arguments);};')(_);
4172
4181
  } catch (_err) {
4173
- f = makeFunction();
4182
+ f = makeFunction(envObject, callback);
4174
4183
  if (emnapiCtx.feature.canSetFunctionName)
4175
4184
  Object.defineProperty(f, "name", { value: functionName });
4176
4185
  }
4177
4186
  } else {
4178
- f = makeFunction();
4187
+ f = makeFunction(envObject, callback);
4179
4188
  if (emnapiCtx.feature.canSetFunctionName)
4180
4189
  Object.defineProperty(f, "name", { value: functionName });
4181
4190
  }
@@ -4245,7 +4254,7 @@ function createNapiModule(options) {
4245
4254
  );
4246
4255
  if (!envObject.canCallIntoJs())
4247
4256
  return envObject.setLastError(
4248
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
4257
+ envObject.moduleApiVersion >= 10 ? 23 : 10
4249
4258
  /* napi_status.napi_pending_exception */
4250
4259
  );
4251
4260
  envObject.clearLastError();
@@ -4315,7 +4324,7 @@ function createNapiModule(options) {
4315
4324
  );
4316
4325
  if (!envObject.canCallIntoJs())
4317
4326
  return envObject.setLastError(
4318
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
4327
+ envObject.moduleApiVersion >= 10 ? 23 : 10
4319
4328
  /* napi_status.napi_pending_exception */
4320
4329
  );
4321
4330
  envObject.clearLastError();
@@ -4382,7 +4391,7 @@ function createNapiModule(options) {
4382
4391
  );
4383
4392
  if (!envObject.canCallIntoJs())
4384
4393
  return envObject.setLastError(
4385
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
4394
+ envObject.moduleApiVersion >= 10 ? 23 : 10
4386
4395
  /* napi_status.napi_pending_exception */
4387
4396
  );
4388
4397
  envObject.clearLastError();
@@ -4495,7 +4504,7 @@ function createNapiModule(options) {
4495
4504
  );
4496
4505
  if (!envObject.canCallIntoJs())
4497
4506
  return envObject.setLastError(
4498
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
4507
+ envObject.moduleApiVersion >= 10 ? 23 : 10
4499
4508
  /* napi_status.napi_pending_exception */
4500
4509
  );
4501
4510
  envObject.clearLastError();
@@ -4551,7 +4560,7 @@ function createNapiModule(options) {
4551
4560
  );
4552
4561
  if (!envObject.canCallIntoJs())
4553
4562
  return envObject.setLastError(
4554
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
4563
+ envObject.moduleApiVersion >= 10 ? 23 : 10
4555
4564
  /* napi_status.napi_pending_exception */
4556
4565
  );
4557
4566
  envObject.clearLastError();
@@ -4666,7 +4675,7 @@ function createNapiModule(options) {
4666
4675
  );
4667
4676
  if (!envObject.canCallIntoJs())
4668
4677
  return envObject.setLastError(
4669
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
4678
+ envObject.moduleApiVersion >= 10 ? 23 : 10
4670
4679
  /* napi_status.napi_pending_exception */
4671
4680
  );
4672
4681
  envObject.clearLastError();
@@ -4842,7 +4851,7 @@ function createNapiModule(options) {
4842
4851
  );
4843
4852
  if (!envObject.canCallIntoJs())
4844
4853
  return envObject.setLastError(
4845
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
4854
+ envObject.moduleApiVersion >= 10 ? 23 : 10
4846
4855
  /* napi_status.napi_pending_exception */
4847
4856
  );
4848
4857
  envObject.clearLastError();
@@ -4908,7 +4917,7 @@ function createNapiModule(options) {
4908
4917
  );
4909
4918
  if (!envObject.canCallIntoJs())
4910
4919
  return envObject.setLastError(
4911
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
4920
+ envObject.moduleApiVersion >= 10 ? 23 : 10
4912
4921
  /* napi_status.napi_pending_exception */
4913
4922
  );
4914
4923
  envObject.clearLastError();
@@ -5041,7 +5050,7 @@ function createNapiModule(options) {
5041
5050
  );
5042
5051
  if (!envObject.canCallIntoJs())
5043
5052
  return envObject.setLastError(
5044
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
5053
+ envObject.moduleApiVersion >= 10 ? 23 : 10
5045
5054
  /* napi_status.napi_pending_exception */
5046
5055
  );
5047
5056
  envObject.clearLastError();
@@ -5077,7 +5086,7 @@ function createNapiModule(options) {
5077
5086
  );
5078
5087
  if (!envObject.canCallIntoJs())
5079
5088
  return envObject.setLastError(
5080
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
5089
+ envObject.moduleApiVersion >= 10 ? 23 : 10
5081
5090
  /* napi_status.napi_pending_exception */
5082
5091
  );
5083
5092
  envObject.clearLastError();
@@ -5112,7 +5121,7 @@ function createNapiModule(options) {
5112
5121
  );
5113
5122
  if (!envObject.canCallIntoJs())
5114
5123
  return envObject.setLastError(
5115
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
5124
+ envObject.moduleApiVersion >= 10 ? 23 : 10
5116
5125
  /* napi_status.napi_pending_exception */
5117
5126
  );
5118
5127
  envObject.clearLastError();
@@ -5125,7 +5134,7 @@ function createNapiModule(options) {
5125
5134
  if (!emnapiCtx.feature.supportFinalizer && finalize_cb) {
5126
5135
  throw emnapiCtx.createNotSupportWeakRefError("napi_create_external", 'Parameter "finalize_cb" must be 0(NULL)');
5127
5136
  }
5128
- var externalHandle = emnapiCtx.getCurrentScope().addExternal(envObject, data);
5137
+ var externalHandle = emnapiCtx.getCurrentScope().addExternal(data);
5129
5138
  if (finalize_cb) {
5130
5139
  emnapiCtx.createReferenceWithFinalizer(envObject, externalHandle.id, 0, 0, finalize_cb, data, finalize_hint);
5131
5140
  }
@@ -5154,7 +5163,7 @@ function createNapiModule(options) {
5154
5163
  );
5155
5164
  if (!envObject.canCallIntoJs())
5156
5165
  return envObject.setLastError(
5157
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
5166
+ envObject.moduleApiVersion >= 10 ? 23 : 10
5158
5167
  /* napi_status.napi_pending_exception */
5159
5168
  );
5160
5169
  envObject.clearLastError();
@@ -5278,7 +5287,7 @@ function createNapiModule(options) {
5278
5287
  );
5279
5288
  if (!envObject.canCallIntoJs())
5280
5289
  return envObject.setLastError(
5281
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
5290
+ envObject.moduleApiVersion >= 10 ? 23 : 10
5282
5291
  /* napi_status.napi_pending_exception */
5283
5292
  );
5284
5293
  envObject.clearLastError();
@@ -5393,7 +5402,7 @@ function createNapiModule(options) {
5393
5402
  );
5394
5403
  if (!envObject.canCallIntoJs())
5395
5404
  return envObject.setLastError(
5396
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
5405
+ envObject.moduleApiVersion >= 10 ? 23 : 10
5397
5406
  /* napi_status.napi_pending_exception */
5398
5407
  );
5399
5408
  envObject.clearLastError();
@@ -5455,7 +5464,7 @@ function createNapiModule(options) {
5455
5464
  );
5456
5465
  if (!envObject.canCallIntoJs())
5457
5466
  return envObject.setLastError(
5458
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
5467
+ envObject.moduleApiVersion >= 10 ? 23 : 10
5459
5468
  /* napi_status.napi_pending_exception */
5460
5469
  );
5461
5470
  envObject.clearLastError();
@@ -5500,7 +5509,7 @@ function createNapiModule(options) {
5500
5509
  );
5501
5510
  if (!envObject.canCallIntoJs())
5502
5511
  return envObject.setLastError(
5503
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
5512
+ envObject.moduleApiVersion >= 10 ? 23 : 10
5504
5513
  /* napi_status.napi_pending_exception */
5505
5514
  );
5506
5515
  envObject.clearLastError();
@@ -5571,7 +5580,7 @@ function createNapiModule(options) {
5571
5580
  );
5572
5581
  if (!envObject.canCallIntoJs())
5573
5582
  return envObject.setLastError(
5574
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
5583
+ envObject.moduleApiVersion >= 10 ? 23 : 10
5575
5584
  /* napi_status.napi_pending_exception */
5576
5585
  );
5577
5586
  envObject.clearLastError();
@@ -5790,7 +5799,7 @@ function createNapiModule(options) {
5790
5799
  );
5791
5800
  if (!envObject.canCallIntoJs())
5792
5801
  return envObject.setLastError(
5793
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
5802
+ envObject.moduleApiVersion >= 10 ? 23 : 10
5794
5803
  /* napi_status.napi_pending_exception */
5795
5804
  );
5796
5805
  envObject.clearLastError();
@@ -5822,7 +5831,7 @@ function createNapiModule(options) {
5822
5831
  );
5823
5832
  if (!envObject.canCallIntoJs())
5824
5833
  return envObject.setLastError(
5825
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
5834
+ envObject.moduleApiVersion >= 10 ? 23 : 10
5826
5835
  /* napi_status.napi_pending_exception */
5827
5836
  );
5828
5837
  envObject.clearLastError();
@@ -5857,7 +5866,7 @@ function createNapiModule(options) {
5857
5866
  );
5858
5867
  if (!envObject.canCallIntoJs())
5859
5868
  return envObject.setLastError(
5860
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
5869
+ envObject.moduleApiVersion >= 10 ? 23 : 10
5861
5870
  /* napi_status.napi_pending_exception */
5862
5871
  );
5863
5872
  envObject.clearLastError();
@@ -5892,7 +5901,7 @@ function createNapiModule(options) {
5892
5901
  );
5893
5902
  if (!envObject.canCallIntoJs())
5894
5903
  return envObject.setLastError(
5895
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
5904
+ envObject.moduleApiVersion >= 10 ? 23 : 10
5896
5905
  /* napi_status.napi_pending_exception */
5897
5906
  );
5898
5907
  envObject.clearLastError();
@@ -5927,7 +5936,7 @@ function createNapiModule(options) {
5927
5936
  );
5928
5937
  if (!envObject.canCallIntoJs())
5929
5938
  return envObject.setLastError(
5930
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
5939
+ envObject.moduleApiVersion >= 10 ? 23 : 10
5931
5940
  /* napi_status.napi_pending_exception */
5932
5941
  );
5933
5942
  envObject.clearLastError();
@@ -6160,7 +6169,7 @@ function createNapiModule(options) {
6160
6169
  );
6161
6170
  if (!envObject.canCallIntoJs())
6162
6171
  return envObject.setLastError(
6163
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
6172
+ envObject.moduleApiVersion >= 10 ? 23 : 10
6164
6173
  /* napi_status.napi_pending_exception */
6165
6174
  );
6166
6175
  envObject.clearLastError();
@@ -6218,7 +6227,7 @@ function createNapiModule(options) {
6218
6227
  );
6219
6228
  if (!envObject.canCallIntoJs())
6220
6229
  return envObject.setLastError(
6221
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
6230
+ envObject.moduleApiVersion >= 10 ? 23 : 10
6222
6231
  /* napi_status.napi_pending_exception */
6223
6232
  );
6224
6233
  envObject.clearLastError();
@@ -6259,7 +6268,7 @@ function createNapiModule(options) {
6259
6268
  1
6260
6269
  /* napi_status.napi_invalid_arg */
6261
6270
  );
6262
- var cbinfoValue = emnapiCtx.cbinfoStack.get(cbinfo);
6271
+ var cbinfoValue = emnapiCtx.scopeStore.get(cbinfo).callbackInfo;
6263
6272
  var HEAP_DATA_VIEW = new DataView(wasmMemory.buffer);
6264
6273
  if (argv) {
6265
6274
  if (!argc)
@@ -6307,7 +6316,7 @@ function createNapiModule(options) {
6307
6316
  );
6308
6317
  if (!envObject.canCallIntoJs())
6309
6318
  return envObject.setLastError(
6310
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
6319
+ envObject.moduleApiVersion >= 10 ? 23 : 10
6311
6320
  /* napi_status.napi_pending_exception */
6312
6321
  );
6313
6322
  envObject.clearLastError();
@@ -6371,7 +6380,7 @@ function createNapiModule(options) {
6371
6380
  );
6372
6381
  if (!envObject.canCallIntoJs())
6373
6382
  return envObject.setLastError(
6374
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
6383
+ envObject.moduleApiVersion >= 10 ? 23 : 10
6375
6384
  /* napi_status.napi_pending_exception */
6376
6385
  );
6377
6386
  envObject.clearLastError();
@@ -6447,8 +6456,9 @@ function createNapiModule(options) {
6447
6456
  1
6448
6457
  /* napi_status.napi_invalid_arg */
6449
6458
  );
6450
- var cbinfoValue = emnapiCtx.cbinfoStack.get(cbinfo);
6451
- var value = cbinfoValue.getNewTarget(envObject);
6459
+ var cbinfoValue = emnapiCtx.scopeStore.get(cbinfo).callbackInfo;
6460
+ var thiz = cbinfoValue.thiz, fn = cbinfoValue.fn;
6461
+ var value = thiz == null || thiz.constructor == null ? 0 : thiz instanceof fn ? envObject.ensureHandleId(thiz.constructor) : 0;
6452
6462
  var HEAP_DATA_VIEW = new DataView(wasmMemory.buffer);
6453
6463
  HEAP_DATA_VIEW.setInt32(result, value, true);
6454
6464
  return envObject.clearLastError();
@@ -6572,7 +6582,7 @@ function createNapiModule(options) {
6572
6582
  /* napi_status.napi_invalid_arg */
6573
6583
  );
6574
6584
  var handle = emnapiCtx.handleStore.get(value);
6575
- if (envObject.moduleApiVersion !== 2147483647) {
6585
+ if (envObject.moduleApiVersion < 10) {
6576
6586
  if (!(handle.isObject() || handle.isFunction() || handle.isSymbol())) {
6577
6587
  return envObject.setLastError(
6578
6588
  1
@@ -6595,7 +6605,6 @@ function createNapiModule(options) {
6595
6605
  if (!env)
6596
6606
  return 1;
6597
6607
  var envObject = emnapiCtx.envStore.get(env);
6598
- envObject.checkGCAccess();
6599
6608
  if (!ref)
6600
6609
  return envObject.setLastError(
6601
6610
  1
@@ -6741,7 +6750,7 @@ function createNapiModule(options) {
6741
6750
  );
6742
6751
  if (!envObject.canCallIntoJs())
6743
6752
  return envObject.setLastError(
6744
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
6753
+ envObject.moduleApiVersion >= 10 ? 23 : 10
6745
6754
  /* napi_status.napi_pending_exception */
6746
6755
  );
6747
6756
  envObject.clearLastError();
@@ -6785,7 +6794,7 @@ function createNapiModule(options) {
6785
6794
  );
6786
6795
  if (!envObject.canCallIntoJs())
6787
6796
  return envObject.setLastError(
6788
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
6797
+ envObject.moduleApiVersion >= 10 ? 23 : 10
6789
6798
  /* napi_status.napi_pending_exception */
6790
6799
  );
6791
6800
  envObject.clearLastError();
@@ -6823,7 +6832,7 @@ function createNapiModule(options) {
6823
6832
  );
6824
6833
  if (!envObject.canCallIntoJs())
6825
6834
  return envObject.setLastError(
6826
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
6835
+ envObject.moduleApiVersion >= 10 ? 23 : 10
6827
6836
  /* napi_status.napi_pending_exception */
6828
6837
  );
6829
6838
  envObject.clearLastError();
@@ -6890,7 +6899,7 @@ function createNapiModule(options) {
6890
6899
  );
6891
6900
  if (!envObject.canCallIntoJs())
6892
6901
  return envObject.setLastError(
6893
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
6902
+ envObject.moduleApiVersion >= 10 ? 23 : 10
6894
6903
  /* napi_status.napi_pending_exception */
6895
6904
  );
6896
6905
  envObject.clearLastError();
@@ -7052,7 +7061,7 @@ function createNapiModule(options) {
7052
7061
  );
7053
7062
  if (!envObject.canCallIntoJs())
7054
7063
  return envObject.setLastError(
7055
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
7064
+ envObject.moduleApiVersion >= 10 ? 23 : 10
7056
7065
  /* napi_status.napi_pending_exception */
7057
7066
  );
7058
7067
  envObject.clearLastError();
@@ -7102,7 +7111,7 @@ function createNapiModule(options) {
7102
7111
  );
7103
7112
  if (!envObject.canCallIntoJs())
7104
7113
  return envObject.setLastError(
7105
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
7114
+ envObject.moduleApiVersion >= 10 ? 23 : 10
7106
7115
  /* napi_status.napi_pending_exception */
7107
7116
  );
7108
7117
  envObject.clearLastError();
@@ -7160,7 +7169,7 @@ function createNapiModule(options) {
7160
7169
  );
7161
7170
  if (!envObject.canCallIntoJs())
7162
7171
  return envObject.setLastError(
7163
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
7172
+ envObject.moduleApiVersion >= 10 ? 23 : 10
7164
7173
  /* napi_status.napi_pending_exception */
7165
7174
  );
7166
7175
  envObject.clearLastError();
@@ -7218,7 +7227,7 @@ function createNapiModule(options) {
7218
7227
  );
7219
7228
  if (!envObject.canCallIntoJs())
7220
7229
  return envObject.setLastError(
7221
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
7230
+ envObject.moduleApiVersion >= 10 ? 23 : 10
7222
7231
  /* napi_status.napi_pending_exception */
7223
7232
  );
7224
7233
  envObject.clearLastError();
@@ -7276,7 +7285,7 @@ function createNapiModule(options) {
7276
7285
  );
7277
7286
  if (!envObject.canCallIntoJs())
7278
7287
  return envObject.setLastError(
7279
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
7288
+ envObject.moduleApiVersion >= 10 ? 23 : 10
7280
7289
  /* napi_status.napi_pending_exception */
7281
7290
  );
7282
7291
  envObject.clearLastError();
@@ -7340,7 +7349,7 @@ function createNapiModule(options) {
7340
7349
  );
7341
7350
  if (!envObject.canCallIntoJs())
7342
7351
  return envObject.setLastError(
7343
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
7352
+ envObject.moduleApiVersion >= 10 ? 23 : 10
7344
7353
  /* napi_status.napi_pending_exception */
7345
7354
  );
7346
7355
  envObject.clearLastError();
@@ -7391,7 +7400,7 @@ function createNapiModule(options) {
7391
7400
  );
7392
7401
  if (!envObject.canCallIntoJs())
7393
7402
  return envObject.setLastError(
7394
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
7403
+ envObject.moduleApiVersion >= 10 ? 23 : 10
7395
7404
  /* napi_status.napi_pending_exception */
7396
7405
  );
7397
7406
  envObject.clearLastError();
@@ -7450,7 +7459,7 @@ function createNapiModule(options) {
7450
7459
  );
7451
7460
  if (!envObject.canCallIntoJs())
7452
7461
  return envObject.setLastError(
7453
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
7462
+ envObject.moduleApiVersion >= 10 ? 23 : 10
7454
7463
  /* napi_status.napi_pending_exception */
7455
7464
  );
7456
7465
  envObject.clearLastError();
@@ -7508,7 +7517,7 @@ function createNapiModule(options) {
7508
7517
  );
7509
7518
  if (!envObject.canCallIntoJs())
7510
7519
  return envObject.setLastError(
7511
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
7520
+ envObject.moduleApiVersion >= 10 ? 23 : 10
7512
7521
  /* napi_status.napi_pending_exception */
7513
7522
  );
7514
7523
  envObject.clearLastError();
@@ -7553,7 +7562,7 @@ function createNapiModule(options) {
7553
7562
  );
7554
7563
  if (!envObject.canCallIntoJs())
7555
7564
  return envObject.setLastError(
7556
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
7565
+ envObject.moduleApiVersion >= 10 ? 23 : 10
7557
7566
  /* napi_status.napi_pending_exception */
7558
7567
  );
7559
7568
  envObject.clearLastError();
@@ -7606,7 +7615,7 @@ function createNapiModule(options) {
7606
7615
  );
7607
7616
  if (!envObject.canCallIntoJs())
7608
7617
  return envObject.setLastError(
7609
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
7618
+ envObject.moduleApiVersion >= 10 ? 23 : 10
7610
7619
  /* napi_status.napi_pending_exception */
7611
7620
  );
7612
7621
  envObject.clearLastError();
@@ -7659,7 +7668,7 @@ function createNapiModule(options) {
7659
7668
  );
7660
7669
  if (!envObject.canCallIntoJs())
7661
7670
  return envObject.setLastError(
7662
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
7671
+ envObject.moduleApiVersion >= 10 ? 23 : 10
7663
7672
  /* napi_status.napi_pending_exception */
7664
7673
  );
7665
7674
  envObject.clearLastError();
@@ -7711,7 +7720,7 @@ function createNapiModule(options) {
7711
7720
  );
7712
7721
  if (!envObject.canCallIntoJs())
7713
7722
  return envObject.setLastError(
7714
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
7723
+ envObject.moduleApiVersion >= 10 ? 23 : 10
7715
7724
  /* napi_status.napi_pending_exception */
7716
7725
  );
7717
7726
  envObject.clearLastError();
@@ -7789,7 +7798,7 @@ function createNapiModule(options) {
7789
7798
  );
7790
7799
  if (!envObject.canCallIntoJs())
7791
7800
  return envObject.setLastError(
7792
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
7801
+ envObject.moduleApiVersion >= 10 ? 23 : 10
7793
7802
  /* napi_status.napi_pending_exception */
7794
7803
  );
7795
7804
  envObject.clearLastError();
@@ -7829,7 +7838,7 @@ function createNapiModule(options) {
7829
7838
  );
7830
7839
  if (!envObject.canCallIntoJs())
7831
7840
  return envObject.setLastError(
7832
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
7841
+ envObject.moduleApiVersion >= 10 ? 23 : 10
7833
7842
  /* napi_status.napi_pending_exception */
7834
7843
  );
7835
7844
  envObject.clearLastError();
@@ -7891,7 +7900,7 @@ function createNapiModule(options) {
7891
7900
  );
7892
7901
  if (!envObject.canCallIntoJs())
7893
7902
  return envObject.setLastError(
7894
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
7903
+ envObject.moduleApiVersion >= 10 ? 23 : 10
7895
7904
  /* napi_status.napi_pending_exception */
7896
7905
  );
7897
7906
  envObject.clearLastError();
@@ -7995,7 +8004,7 @@ function createNapiModule(options) {
7995
8004
  );
7996
8005
  if (!envObject.canCallIntoJs())
7997
8006
  return envObject.setLastError(
7998
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
8007
+ envObject.moduleApiVersion >= 10 ? 23 : 10
7999
8008
  /* napi_status.napi_pending_exception */
8000
8009
  );
8001
8010
  envObject.clearLastError();
@@ -8036,7 +8045,7 @@ function createNapiModule(options) {
8036
8045
  );
8037
8046
  if (!envObject.canCallIntoJs())
8038
8047
  return envObject.setLastError(
8039
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
8048
+ envObject.moduleApiVersion >= 10 ? 23 : 10
8040
8049
  /* napi_status.napi_pending_exception */
8041
8050
  );
8042
8051
  envObject.clearLastError();
@@ -8080,7 +8089,7 @@ function createNapiModule(options) {
8080
8089
  );
8081
8090
  if (!envObject.canCallIntoJs())
8082
8091
  return envObject.setLastError(
8083
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
8092
+ envObject.moduleApiVersion >= 10 ? 23 : 10
8084
8093
  /* napi_status.napi_pending_exception */
8085
8094
  );
8086
8095
  envObject.clearLastError();
@@ -8124,7 +8133,7 @@ function createNapiModule(options) {
8124
8133
  );
8125
8134
  if (!envObject.canCallIntoJs())
8126
8135
  return envObject.setLastError(
8127
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
8136
+ envObject.moduleApiVersion >= 10 ? 23 : 10
8128
8137
  /* napi_status.napi_pending_exception */
8129
8138
  );
8130
8139
  envObject.clearLastError();
@@ -8168,7 +8177,7 @@ function createNapiModule(options) {
8168
8177
  );
8169
8178
  if (!envObject.canCallIntoJs())
8170
8179
  return envObject.setLastError(
8171
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
8180
+ envObject.moduleApiVersion >= 10 ? 23 : 10
8172
8181
  /* napi_status.napi_pending_exception */
8173
8182
  );
8174
8183
  envObject.clearLastError();
@@ -8370,7 +8379,7 @@ function createNapiModule(options) {
8370
8379
  );
8371
8380
  if (!envObject.canCallIntoJs())
8372
8381
  return envObject.setLastError(
8373
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
8382
+ envObject.moduleApiVersion >= 10 ? 23 : 10
8374
8383
  /* napi_status.napi_pending_exception */
8375
8384
  );
8376
8385
  envObject.clearLastError();
@@ -8451,7 +8460,7 @@ function createNapiModule(options) {
8451
8460
  );
8452
8461
  if (!envObject.canCallIntoJs())
8453
8462
  return envObject.setLastError(
8454
- envObject.moduleApiVersion === 2147483647 ? 23 : 10
8463
+ envObject.moduleApiVersion >= 10 ? 23 : 10
8455
8464
  /* napi_status.napi_pending_exception */
8456
8465
  );
8457
8466
  envObject.clearLastError();
@@ -8514,7 +8523,7 @@ function createNapiModule(options) {
8514
8523
  1
8515
8524
  /* napi_status.napi_invalid_arg */
8516
8525
  );
8517
- var NODE_API_SUPPORTED_VERSION_MAX2 = 9;
8526
+ var NODE_API_SUPPORTED_VERSION_MAX2 = 10;
8518
8527
  var HEAP_DATA_VIEW = new DataView(wasmMemory.buffer);
8519
8528
  HEAP_DATA_VIEW.setUint32(result, NODE_API_SUPPORTED_VERSION_MAX2, true);
8520
8529
  return envObject.clearLastError();
@@ -8700,73 +8709,24 @@ function loadSyncCallback(wasmInput, importObject, callback) {
8700
8709
  function instantiateNapiModuleSync(wasmInput, options) {
8701
8710
  return loadNapiModuleImpl(loadSyncCallback, void 0, wasmInput, options);
8702
8711
  }
8703
- var EMPTY_ARGS = [];
8704
- var CallbackInfo = /* @__PURE__ */ function() {
8705
- function CallbackInfo2(id, parent, child, thiz, data, args, fn) {
8706
- this.id = id;
8707
- this.parent = parent;
8708
- this.child = child;
8709
- this.thiz = thiz;
8710
- this.data = data;
8711
- this.args = args;
8712
- this.fn = fn;
8712
+ var externalValue = /* @__PURE__ */ new WeakMap();
8713
+ function isExternal(object) {
8714
+ return externalValue.has(object);
8715
+ }
8716
+ var External = function() {
8717
+ function External2(value) {
8718
+ Object.setPrototypeOf(this, null);
8719
+ externalValue.set(this, value);
8713
8720
  }
8714
- CallbackInfo2.prototype.getNewTarget = function(envObject) {
8715
- var thiz = this.thiz;
8716
- if (thiz == null || thiz.constructor == null)
8717
- return 0;
8718
- return thiz instanceof this.fn ? envObject.ensureHandleId(thiz.constructor) : 0;
8719
- };
8720
- CallbackInfo2.prototype.dispose = function() {
8721
- if (this.thiz !== void 0)
8722
- this.thiz = void 0;
8723
- this.args = EMPTY_ARGS;
8724
- this.fn = null;
8725
- };
8726
- return CallbackInfo2;
8727
- }();
8728
- var ROOT_CBINFO = new CallbackInfo(0, null, null, null, 0, null, null);
8729
- var CallbackInfoStack = /* @__PURE__ */ function() {
8730
- function CallbackInfoStack2() {
8731
- this.current = ROOT_CBINFO;
8732
- }
8733
- CallbackInfoStack2.prototype.get = function(id) {
8734
- if (id === 1)
8735
- return ROOT_CBINFO.child;
8736
- var info = ROOT_CBINFO;
8737
- for (var i = 0; i < id; ++i) {
8738
- info = info.child;
8739
- if (info === null)
8740
- return null;
8741
- }
8742
- return info === ROOT_CBINFO ? null : info;
8743
- };
8744
- CallbackInfoStack2.prototype.pop = function() {
8745
- var current = this.current;
8746
- if (current === ROOT_CBINFO)
8747
- return;
8748
- this.current = current.parent;
8749
- current.dispose();
8750
- };
8751
- CallbackInfoStack2.prototype.push = function(thiz, data, args, fn) {
8752
- var info = this.current.child;
8753
- if (info) {
8754
- info.thiz = thiz;
8755
- info.data = data;
8756
- info.args = args;
8757
- info.fn = fn;
8758
- } else {
8759
- info = new CallbackInfo(this.current.id + 1, this.current, null, thiz, data, args, fn);
8760
- this.current.child = info;
8761
- }
8762
- this.current = info;
8763
- return info.id;
8764
- };
8765
- CallbackInfoStack2.prototype.dispose = function() {
8766
- this.current = null;
8767
- };
8768
- return CallbackInfoStack2;
8721
+ External2.prototype = null;
8722
+ return External2;
8769
8723
  }();
8724
+ function getExternalValue(external) {
8725
+ if (!isExternal(external)) {
8726
+ throw new TypeError("not external");
8727
+ }
8728
+ return externalValue.get(external);
8729
+ }
8770
8730
  var supportNewFunction = /* @__PURE__ */ function() {
8771
8731
  var f;
8772
8732
  try {
@@ -8850,9 +8810,6 @@ var supportWeakSymbol = /* @__PURE__ */ function() {
8850
8810
  return true;
8851
8811
  }();
8852
8812
  var supportBigInt = typeof BigInt !== "undefined";
8853
- function isReferenceType(v) {
8854
- return typeof v === "object" && v !== null || typeof v === "function";
8855
- }
8856
8813
  var _require = /* @__PURE__ */ function() {
8857
8814
  var nativeRequire;
8858
8815
  {
@@ -8892,8 +8849,8 @@ var _Buffer = typeof Buffer === "function" ? Buffer : /* @__PURE__ */ function()
8892
8849
  }
8893
8850
  return void 0;
8894
8851
  }();
8895
- var version = "1.3.1";
8896
- var NODE_API_SUPPORTED_VERSION_MAX = 9;
8852
+ var version = "1.4.0";
8853
+ var NODE_API_SUPPORTED_VERSION_MAX = 10;
8897
8854
  var NAPI_VERSION_EXPERIMENTAL = 2147483647;
8898
8855
  var NODE_API_DEFAULT_MODULE_API_VERSION = 8;
8899
8856
  var Handle = /* @__PURE__ */ function() {
@@ -8901,8 +8858,8 @@ var Handle = /* @__PURE__ */ function() {
8901
8858
  this.id = id;
8902
8859
  this.value = value;
8903
8860
  }
8904
- Handle2.prototype.data = function(envObject) {
8905
- return envObject.getObjectBinding(this.value).data;
8861
+ Handle2.prototype.data = function() {
8862
+ return getExternalValue(this.value);
8906
8863
  };
8907
8864
  Handle2.prototype.isNumber = function() {
8908
8865
  return typeof this.value === "number";
@@ -8917,7 +8874,7 @@ var Handle = /* @__PURE__ */ function() {
8917
8874
  return typeof this.value === "function";
8918
8875
  };
8919
8876
  Handle2.prototype.isExternal = function() {
8920
- return isReferenceType(this.value) && Object.getPrototypeOf(this.value) === null;
8877
+ return isExternal(this.value);
8921
8878
  };
8922
8879
  Handle2.prototype.isObject = function() {
8923
8880
  return typeof this.value === "object" && this.value !== null;
@@ -8972,10 +8929,6 @@ var ConstHandle = /* @__PURE__ */ function(_super) {
8972
8929
  };
8973
8930
  return ConstHandle2;
8974
8931
  }(Handle);
8975
- function External() {
8976
- Object.setPrototypeOf(this, null);
8977
- }
8978
- External.prototype = null;
8979
8932
  var HandleStore = /* @__PURE__ */ function() {
8980
8933
  function HandleStore2() {
8981
8934
  this._values = [
@@ -9046,21 +8999,24 @@ var HandleScope = /* @__PURE__ */ function() {
9046
8999
  this.start = start;
9047
9000
  this.end = end;
9048
9001
  this._escapeCalled = false;
9002
+ this.callbackInfo = {
9003
+ thiz: void 0,
9004
+ data: 0,
9005
+ args: void 0,
9006
+ fn: void 0
9007
+ };
9049
9008
  }
9050
9009
  HandleScope2.prototype.add = function(value) {
9051
9010
  var h = this.handleStore.push(value);
9052
9011
  this.end++;
9053
9012
  return h;
9054
9013
  };
9055
- HandleScope2.prototype.addExternal = function(envObject, data) {
9056
- var value = new External();
9057
- var h = envObject.ctx.handleStore.push(value);
9058
- var binding = envObject.initObjectBinding(value);
9059
- binding.data = data;
9060
- this.end++;
9061
- return h;
9014
+ HandleScope2.prototype.addExternal = function(data) {
9015
+ return this.add(new External(data));
9062
9016
  };
9063
9017
  HandleScope2.prototype.dispose = function() {
9018
+ if (this._escapeCalled)
9019
+ this._escapeCalled = false;
9064
9020
  if (this.start === this.end)
9065
9021
  return;
9066
9022
  this.handleStore.erase(this.start, this.end);
@@ -9087,26 +9043,20 @@ var ScopeStore = /* @__PURE__ */ function() {
9087
9043
  function ScopeStore2() {
9088
9044
  this._rootScope = new HandleScope(null, 0, null, 1, HandleStore.MIN_ID);
9089
9045
  this.currentScope = this._rootScope;
9046
+ this._values = [void 0];
9090
9047
  }
9091
9048
  ScopeStore2.prototype.get = function(id) {
9092
- id = Number(id);
9093
- var scope = this.currentScope;
9094
- while (scope !== this._rootScope) {
9095
- if (scope.id === id) {
9096
- return scope;
9097
- }
9098
- scope = scope.parent;
9099
- }
9100
- return void 0;
9049
+ return this._values[id];
9101
9050
  };
9102
9051
  ScopeStore2.prototype.openScope = function(envObject) {
9103
9052
  var currentScope = this.currentScope;
9104
9053
  var scope = currentScope.child;
9105
9054
  if (scope !== null) {
9106
9055
  scope.start = scope.end = currentScope.end;
9107
- scope._escapeCalled = false;
9108
9056
  } else {
9109
- scope = new HandleScope(envObject.ctx.handleStore, currentScope.id + 1, currentScope, currentScope.end);
9057
+ var id = currentScope.id + 1;
9058
+ scope = new HandleScope(envObject.ctx.handleStore, id, currentScope, currentScope.end);
9059
+ this._values[id] = scope;
9110
9060
  }
9111
9061
  this.currentScope = scope;
9112
9062
  envObject.openHandleScopes++;
@@ -9121,19 +9071,8 @@ var ScopeStore = /* @__PURE__ */ function() {
9121
9071
  envObject.openHandleScopes--;
9122
9072
  };
9123
9073
  ScopeStore2.prototype.dispose = function() {
9124
- var scope = this.currentScope;
9125
- while (scope !== null) {
9126
- scope.handleStore = null;
9127
- scope.id = 0;
9128
- scope.parent = null;
9129
- scope.start = HandleStore.MIN_ID;
9130
- scope.end = HandleStore.MIN_ID;
9131
- scope._escapeCalled = false;
9132
- var child = scope.child;
9133
- scope.child = null;
9134
- scope = child;
9135
- }
9136
- this.currentScope = null;
9074
+ this.currentScope = this._rootScope;
9075
+ this._values.length = 1;
9137
9076
  };
9138
9077
  return ScopeStore2;
9139
9078
  }();
@@ -9414,8 +9353,7 @@ var Env = /* @__PURE__ */ function() {
9414
9353
  Env2.prototype.initObjectBinding = function(value) {
9415
9354
  var binding = {
9416
9355
  wrapped: 0,
9417
- tag: null,
9418
- data: 0
9356
+ tag: null
9419
9357
  };
9420
9358
  this._bindingMap.set(value, binding);
9421
9359
  return binding;
@@ -9469,7 +9407,7 @@ var NodeEnv = /* @__PURE__ */ function(_super) {
9469
9407
  if (envObject.terminatedOrTerminating()) {
9470
9408
  return;
9471
9409
  }
9472
- if (envObject.moduleApiVersion < NAPI_VERSION_EXPERIMENTAL && true && !enforceUncaughtExceptionPolicy) {
9410
+ if (envObject.moduleApiVersion < 10 && true && !enforceUncaughtExceptionPolicy) {
9473
9411
  var warn = function(warning, type, code) {
9474
9412
  if (warning instanceof Error) {
9475
9413
  console.warn(warning.toString());
@@ -9970,7 +9908,6 @@ var Context = /* @__PURE__ */ function() {
9970
9908
  this.refStore = new Store();
9971
9909
  this.deferredStore = new Store();
9972
9910
  this.handleStore = new HandleStore();
9973
- this.cbinfoStack = new CallbackInfoStack();
9974
9911
  this.feature = {
9975
9912
  supportReflect,
9976
9913
  supportFinalizer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxc-parser/binding-wasm32-wasi",
3
- "version": "0.61.2",
3
+ "version": "0.63.0",
4
4
  "cpu": [
5
5
  "wasm32"
6
6
  ],
@@ -36,6 +36,6 @@
36
36
  "bugs": "https://github.com/oxc-project/oxc/issues",
37
37
  "browser": "parser.wasi-browser.js",
38
38
  "dependencies": {
39
- "@napi-rs/wasm-runtime": "^0.2.7"
39
+ "@napi-rs/wasm-runtime": "^0.2.8"
40
40
  }
41
41
  }
Binary file