@oxc-parser/binding-wasm32-wasi 0.77.0 → 0.77.2

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.11/node_modules/@napi-rs/wasm-runtime/dist/runtime.js
8
+ // ../../node_modules/.pnpm/@napi-rs+wasm-runtime@0.2.12/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) {
@@ -628,7 +628,7 @@ var WASIThreads = /* @__PURE__ */ function() {
628
628
  } catch (_) {
629
629
  }
630
630
  } else {
631
- setupInstance$1(wasi, instance);
631
+ setupInstance(wasi, instance);
632
632
  }
633
633
  } else {
634
634
  wasi.initialize(instance);
@@ -701,7 +701,7 @@ function getWasiSymbol(wasi, description) {
701
701
  }
702
702
  return symbols.filter(selectDescription(description))[0];
703
703
  }
704
- function setupInstance$1(wasi, instance) {
704
+ function setupInstance(wasi, instance) {
705
705
  var _a = getWasiSymbol(wasi, ["kInstance", "kSetMemory"]), kInstance2 = _a[0], kSetMemory2 = _a[1];
706
706
  wasi[kInstance2] = instance;
707
707
  wasi[kSetMemory2](instance.exports.memory);
@@ -11036,7 +11036,7 @@ var WASI$1 = class _WASI$1 {
11036
11036
  case 1:
11037
11037
  case 2:
11038
11038
  case 3: {
11039
- const t = performance.now();
11039
+ const t = performance.now() / 1e3;
11040
11040
  const s = Math.trunc(t);
11041
11041
  const ms = Math.floor((t - s) * 1e3);
11042
11042
  const result = BigInt(s) * BigInt(1e9) + BigInt(ms) * BigInt(1e6);
@@ -11999,7 +11999,7 @@ var WASI$1 = class _WASI$1 {
11999
11999
  const resolved_path = resolvePathSync(fs2, fileDescriptor, pathString, dirflags);
12000
12000
  const r = fs2.openSync(resolved_path, flagsRes, 438);
12001
12001
  const filetype = wasi.fds.getFileTypeByFd(r);
12002
- if ((o_flags & 2) !== 0 && filetype !== 3) {
12002
+ if (filetype !== 3 && ((o_flags & 2) !== 0 || resolved_path.endsWith("/"))) {
12003
12003
  return 54;
12004
12004
  }
12005
12005
  const { base: max_base, inheriting: max_inheriting } = getRights(wasi.fds.stdio, r, flagsRes, filetype);
@@ -12186,6 +12186,9 @@ var WASI$1 = class _WASI$1 {
12186
12186
  const wasi = _wasi.get(this);
12187
12187
  const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_SYMLINK, BigInt(0));
12188
12188
  const oldPath = decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len));
12189
+ if (oldPath.length > 0 && oldPath[0] === "/") {
12190
+ return 63;
12191
+ }
12189
12192
  let newPath = decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len));
12190
12193
  newPath = resolve(fileDescriptor.realPath, newPath);
12191
12194
  const fs2 = getFs(this);
@@ -12292,12 +12295,6 @@ var kSetMemory = Symbol("kSetMemory");
12292
12295
  var kStarted = Symbol("kStarted");
12293
12296
  var kInstance = Symbol("kInstance");
12294
12297
  var kBindingName = Symbol("kBindingName");
12295
- function setupInstance(self2, instance) {
12296
- validateObject(instance, "instance");
12297
- validateObject(instance.exports, "instance.exports");
12298
- self2[kInstance] = instance;
12299
- self2[kSetMemory](instance.exports.memory);
12300
- }
12301
12298
  function validateOptions(options) {
12302
12299
  var _a;
12303
12300
  validateObject(options, "options");
@@ -12382,13 +12379,21 @@ var WASI = class {
12382
12379
  wrap2.proc_exit = wasiReturnOnProcExit.bind(this);
12383
12380
  }
12384
12381
  }
12385
- // Must not export _initialize, must export _start
12386
- start(instance) {
12382
+ finalizeBindings(instance, _a) {
12383
+ var _b;
12384
+ var { memory = (_b = instance === null || instance === void 0 ? void 0 : instance.exports) === null || _b === void 0 ? void 0 : _b.memory } = _a === void 0 ? {} : _a;
12387
12385
  if (this[kStarted]) {
12388
12386
  throw new Error("WASI instance has already started");
12389
12387
  }
12388
+ validateObject(instance, "instance");
12389
+ validateObject(instance.exports, "instance.exports");
12390
+ this[kSetMemory](memory);
12391
+ this[kInstance] = instance;
12390
12392
  this[kStarted] = true;
12391
- setupInstance(this, instance);
12393
+ }
12394
+ // Must not export _initialize, must export _start
12395
+ start(instance) {
12396
+ this.finalizeBindings(instance);
12392
12397
  const { _start, _initialize } = this[kInstance].exports;
12393
12398
  validateFunction(_start, "instance.exports._start");
12394
12399
  validateUndefined(_initialize, "instance.exports._initialize");
@@ -12412,11 +12417,7 @@ var WASI = class {
12412
12417
  }
12413
12418
  // Must not export _start, may optionally export _initialize
12414
12419
  initialize(instance) {
12415
- if (this[kStarted]) {
12416
- throw new Error("WASI instance has already started");
12417
- }
12418
- this[kStarted] = true;
12419
- setupInstance(this, instance);
12420
+ this.finalizeBindings(instance);
12420
12421
  const { _start, _initialize } = this[kInstance].exports;
12421
12422
  validateUndefined(_start, "instance.exports._start");
12422
12423
  if (_initialize !== void 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxc-parser/binding-wasm32-wasi",
3
- "version": "0.77.0",
3
+ "version": "0.77.2",
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.12"
39
+ "@napi-rs/wasm-runtime": "^1.0.0"
40
40
  }
41
41
  }
Binary file