@oxc-parser/binding-wasm32-wasi 0.137.0 → 0.138.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.
- package/browser-bundle.js +65 -52
- package/package.json +2 -2
- package/parser.wasm32-wasi.wasm +0 -0
package/browser-bundle.js
CHANGED
|
@@ -4027,7 +4027,7 @@ function createNapiModule(options) {
|
|
|
4027
4027
|
if (!type_tag) return envObject.setLastError(envObject.tryCatch.hasCaught() ? 10 : 1);
|
|
4028
4028
|
var binding = envObject.getObjectBinding(value.value);
|
|
4029
4029
|
if (binding.tag !== null) return envObject.setLastError(envObject.tryCatch.hasCaught() ? 10 : 1);
|
|
4030
|
-
var tag = new Uint8Array(16);
|
|
4030
|
+
var tag = /* @__PURE__ */ new Uint8Array(16);
|
|
4031
4031
|
tag.set(new Uint8Array(wasmMemory.buffer, type_tag, 16));
|
|
4032
4032
|
binding.tag = new Uint32Array(tag.buffer);
|
|
4033
4033
|
return envObject.getReturnStatus();
|
|
@@ -8239,7 +8239,7 @@ function getDefaultContext() {
|
|
|
8239
8239
|
return defaultContext;
|
|
8240
8240
|
}
|
|
8241
8241
|
//#endregion
|
|
8242
|
-
//#region ../../node_modules/.pnpm/@tybys+wasm-util@0.10.
|
|
8242
|
+
//#region ../../node_modules/.pnpm/@tybys+wasm-util@0.10.3/node_modules/@tybys/wasm-util/dist/wasm-util.esm-bundler.js
|
|
8243
8243
|
const _WebAssembly = typeof WebAssembly !== "undefined" ? WebAssembly : typeof WXWebAssembly !== "undefined" ? WXWebAssembly : void 0;
|
|
8244
8244
|
if (!_WebAssembly) throw new Error("WebAssembly is not supported in this environment");
|
|
8245
8245
|
function validateObject(value, name) {
|
|
@@ -8918,8 +8918,18 @@ function copyMemory(targets, src) {
|
|
|
8918
8918
|
const _memory = /* @__PURE__ */ new WeakMap();
|
|
8919
8919
|
const _wasi = /* @__PURE__ */ new WeakMap();
|
|
8920
8920
|
const _fs = /* @__PURE__ */ new WeakMap();
|
|
8921
|
-
function
|
|
8922
|
-
|
|
8921
|
+
function ensureMemoryFor(memory, end) {
|
|
8922
|
+
let buffer = memory.buffer;
|
|
8923
|
+
if (end > buffer.byteLength) {
|
|
8924
|
+
memory.grow(0);
|
|
8925
|
+
buffer = memory.buffer;
|
|
8926
|
+
}
|
|
8927
|
+
return buffer;
|
|
8928
|
+
}
|
|
8929
|
+
function getMemory(wasi, end = 0) {
|
|
8930
|
+
const memory = _memory.get(wasi);
|
|
8931
|
+
ensureMemoryFor(memory, end);
|
|
8932
|
+
return memory;
|
|
8923
8933
|
}
|
|
8924
8934
|
function getFs(wasi) {
|
|
8925
8935
|
const fs = _fs.get(wasi);
|
|
@@ -9004,7 +9014,7 @@ const decoder = /*#__PURE__*/ new TextDecoder();
|
|
|
9004
9014
|
const INT64_MAX = (BigInt(1) << BigInt(63)) - BigInt(1);
|
|
9005
9015
|
function readStdin() {
|
|
9006
9016
|
const value = window.prompt();
|
|
9007
|
-
if (value === null) return new Uint8Array();
|
|
9017
|
+
if (value === null) return /* @__PURE__ */ new Uint8Array();
|
|
9008
9018
|
return new TextEncoder().encode(value + "\n");
|
|
9009
9019
|
}
|
|
9010
9020
|
function validateFstFlagsOrReturn(flags) {
|
|
@@ -9016,8 +9026,9 @@ var WASI$1 = class WASI$1 {
|
|
|
9016
9026
|
argv = Number(argv);
|
|
9017
9027
|
argv_buf = Number(argv_buf);
|
|
9018
9028
|
if (argv === 0 || argv_buf === 0) return 28;
|
|
9019
|
-
const { HEAPU8, view } = getMemory(this);
|
|
9020
9029
|
const args = _wasi.get(this).args;
|
|
9030
|
+
const argsSize = encoder.encode(args.join("\0") + "\0").length;
|
|
9031
|
+
const { HEAPU8, view } = getMemory(this, Math.max(argv + args.length * 4, argv_buf + argsSize));
|
|
9021
9032
|
for (let i = 0; i < args.length; ++i) {
|
|
9022
9033
|
const arg = args[i];
|
|
9023
9034
|
view.setInt32(argv, argv_buf, true);
|
|
@@ -9032,7 +9043,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9032
9043
|
argc = Number(argc);
|
|
9033
9044
|
argv_buf_size = Number(argv_buf_size);
|
|
9034
9045
|
if (argc === 0 || argv_buf_size === 0) return 28;
|
|
9035
|
-
const { view } = getMemory(this);
|
|
9046
|
+
const { view } = getMemory(this, Math.max(argc + 4, argv_buf_size + 4));
|
|
9036
9047
|
const args = _wasi.get(this).args;
|
|
9037
9048
|
view.setUint32(argc, args.length, true);
|
|
9038
9049
|
view.setUint32(argv_buf_size, encoder.encode(args.join("\0") + "\0").length, true);
|
|
@@ -9042,8 +9053,9 @@ var WASI$1 = class WASI$1 {
|
|
|
9042
9053
|
environ = Number(environ);
|
|
9043
9054
|
environ_buf = Number(environ_buf);
|
|
9044
9055
|
if (environ === 0 || environ_buf === 0) return 28;
|
|
9045
|
-
const { HEAPU8, view } = getMemory(this);
|
|
9046
9056
|
const env = _wasi.get(this).env;
|
|
9057
|
+
const envSize = encoder.encode(env.join("\0") + "\0").length;
|
|
9058
|
+
const { HEAPU8, view } = getMemory(this, Math.max(environ + env.length * 4, environ_buf + envSize));
|
|
9047
9059
|
for (let i = 0; i < env.length; ++i) {
|
|
9048
9060
|
const pair = env[i];
|
|
9049
9061
|
view.setInt32(environ, environ_buf, true);
|
|
@@ -9058,7 +9070,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9058
9070
|
len = Number(len);
|
|
9059
9071
|
buflen = Number(buflen);
|
|
9060
9072
|
if (len === 0 || buflen === 0) return 28;
|
|
9061
|
-
const { view } = getMemory(this);
|
|
9073
|
+
const { view } = getMemory(this, Math.max(len + 4, buflen + 4));
|
|
9062
9074
|
const wasi = _wasi.get(this);
|
|
9063
9075
|
view.setUint32(len, wasi.env.length, true);
|
|
9064
9076
|
view.setUint32(buflen, encoder.encode(wasi.env.join("\0") + "\0").length, true);
|
|
@@ -9067,7 +9079,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9067
9079
|
this.clock_res_get = syscallWrap(this, "clock_res_get", function(id, resolution) {
|
|
9068
9080
|
resolution = Number(resolution);
|
|
9069
9081
|
if (resolution === 0) return 28;
|
|
9070
|
-
const { view } = getMemory(this);
|
|
9082
|
+
const { view } = getMemory(this, resolution + 8);
|
|
9071
9083
|
switch (id) {
|
|
9072
9084
|
case 0:
|
|
9073
9085
|
view.setBigUint64(resolution, BigInt(1e6), true);
|
|
@@ -9083,7 +9095,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9083
9095
|
this.clock_time_get = syscallWrap(this, "clock_time_get", function(id, _percision, time) {
|
|
9084
9096
|
time = Number(time);
|
|
9085
9097
|
if (time === 0) return 28;
|
|
9086
|
-
const { view } = getMemory(this);
|
|
9098
|
+
const { view } = getMemory(this, time + 8);
|
|
9087
9099
|
switch (id) {
|
|
9088
9100
|
case 0:
|
|
9089
9101
|
view.setBigUint64(time, BigInt(Date.now()) * BigInt(1e6), true);
|
|
@@ -9108,7 +9120,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9108
9120
|
fdstat = Number(fdstat);
|
|
9109
9121
|
if (fdstat === 0) return 28;
|
|
9110
9122
|
const fileDescriptor = _wasi.get(this).fds.get(fd, BigInt(0), BigInt(0));
|
|
9111
|
-
const { view } = getMemory(this);
|
|
9123
|
+
const { view } = getMemory(this, fdstat + 24);
|
|
9112
9124
|
view.setUint16(fdstat, fileDescriptor.type, true);
|
|
9113
9125
|
view.setUint16(fdstat + 2, 0, true);
|
|
9114
9126
|
view.setBigUint64(fdstat + 8, fileDescriptor.rightsBase, true);
|
|
@@ -9138,7 +9150,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9138
9150
|
throw err;
|
|
9139
9151
|
}
|
|
9140
9152
|
if (fileDescriptor.preopen !== 1) return 28;
|
|
9141
|
-
const { view } = getMemory(this);
|
|
9153
|
+
const { view } = getMemory(this, prestat + 8);
|
|
9142
9154
|
view.setUint32(prestat, 0, true);
|
|
9143
9155
|
view.setUint32(prestat + 4, encoder.encode(fileDescriptor.path).length, true);
|
|
9144
9156
|
return 0;
|
|
@@ -9150,8 +9162,9 @@ var WASI$1 = class WASI$1 {
|
|
|
9150
9162
|
const fileDescriptor = _wasi.get(this).fds.get(fd, BigInt(0), BigInt(0));
|
|
9151
9163
|
if (fileDescriptor.preopen !== 1) return 8;
|
|
9152
9164
|
const buffer = encoder.encode(fileDescriptor.path);
|
|
9153
|
-
|
|
9154
|
-
|
|
9165
|
+
const size = buffer.length;
|
|
9166
|
+
if (size > path_len) return 42;
|
|
9167
|
+
const { HEAPU8 } = getMemory(this, path + size);
|
|
9155
9168
|
HEAPU8.set(buffer, path);
|
|
9156
9169
|
return 0;
|
|
9157
9170
|
});
|
|
@@ -9160,14 +9173,14 @@ var WASI$1 = class WASI$1 {
|
|
|
9160
9173
|
if (newOffset === 0) return 28;
|
|
9161
9174
|
if (fd === 0 || fd === 1 || fd === 2) return 0;
|
|
9162
9175
|
const r = _wasi.get(this).fds.get(fd, WasiRights.FD_SEEK, BigInt(0)).seek(offset, whence);
|
|
9163
|
-
const { view } = getMemory(this);
|
|
9176
|
+
const { view } = getMemory(this, newOffset + 8);
|
|
9164
9177
|
view.setBigUint64(newOffset, r, true);
|
|
9165
9178
|
return 0;
|
|
9166
9179
|
});
|
|
9167
9180
|
this.fd_tell = syscallWrap(this, "fd_tell", function(fd, offset) {
|
|
9168
9181
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.FD_TELL, BigInt(0));
|
|
9169
9182
|
const pos = BigInt(fileDescriptor.pos);
|
|
9170
|
-
const { view } = getMemory(this);
|
|
9183
|
+
const { view } = getMemory(this, Number(offset) + 8);
|
|
9171
9184
|
view.setBigUint64(Number(offset), pos, true);
|
|
9172
9185
|
return 0;
|
|
9173
9186
|
});
|
|
@@ -9178,7 +9191,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9178
9191
|
nsubscriptions = Number(nsubscriptions);
|
|
9179
9192
|
nsubscriptions = nsubscriptions >>> 0;
|
|
9180
9193
|
if (in_ptr === 0 || out_ptr === 0 || nsubscriptions === 0 || nevents === 0) return 28;
|
|
9181
|
-
const { view } = getMemory(this);
|
|
9194
|
+
const { view } = getMemory(this, Math.max(in_ptr + nsubscriptions * 48, out_ptr + nsubscriptions * 32, nevents + 4));
|
|
9182
9195
|
view.setUint32(nevents, 0, true);
|
|
9183
9196
|
let i = 0;
|
|
9184
9197
|
let timer_userdata = BigInt(0);
|
|
@@ -9266,7 +9279,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9266
9279
|
buf = Number(buf);
|
|
9267
9280
|
if (buf === 0) return 28;
|
|
9268
9281
|
buf_len = Number(buf_len);
|
|
9269
|
-
const { HEAPU8, view } = getMemory(this);
|
|
9282
|
+
const { HEAPU8, view } = getMemory(this, buf + buf_len);
|
|
9270
9283
|
if (typeof SharedArrayBuffer === "function" && HEAPU8.buffer instanceof SharedArrayBuffer || Object.prototype.toString.call(HEAPU8.buffer) === "[object SharedArrayBuffer]") {
|
|
9271
9284
|
for (let i = buf; i < buf + buf_len; ++i) view.setUint8(i, Math.floor(Math.random() * 256));
|
|
9272
9285
|
return 0;
|
|
@@ -9280,7 +9293,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9280
9293
|
buf = Number(buf);
|
|
9281
9294
|
if (buf === 0) return 28;
|
|
9282
9295
|
buf_len = Number(buf_len);
|
|
9283
|
-
const { view } = getMemory(this);
|
|
9296
|
+
const { view } = getMemory(this, buf + buf_len);
|
|
9284
9297
|
for (let i = buf; i < buf + buf_len; ++i) view.setUint8(i, Math.floor(Math.random() * 256));
|
|
9285
9298
|
return 0;
|
|
9286
9299
|
});
|
|
@@ -9348,14 +9361,14 @@ var WASI$1 = class WASI$1 {
|
|
|
9348
9361
|
if (buf === 0) return 28;
|
|
9349
9362
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.FD_FILESTAT_GET, BigInt(0));
|
|
9350
9363
|
const stat = getFs(this).fstatSync(fileDescriptor.fd, { bigint: true });
|
|
9351
|
-
const { view } = getMemory(this);
|
|
9364
|
+
const { view } = getMemory(this, buf + 64);
|
|
9352
9365
|
toFileStat(view, buf, stat);
|
|
9353
9366
|
return 0;
|
|
9354
9367
|
}, async function fd_filestat_get(fd, buf) {
|
|
9355
9368
|
buf = Number(buf);
|
|
9356
9369
|
if (buf === 0) return 28;
|
|
9357
9370
|
const stat = await _wasi.get(this).fds.get(fd, WasiRights.FD_FILESTAT_GET, BigInt(0)).fd.stat({ bigint: true });
|
|
9358
|
-
const { view } = getMemory(this);
|
|
9371
|
+
const { view } = getMemory(this, buf + 64);
|
|
9359
9372
|
toFileStat(view, buf, stat);
|
|
9360
9373
|
return 0;
|
|
9361
9374
|
}, ["i32", "i32"], ["i32"]);
|
|
@@ -9397,7 +9410,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9397
9410
|
iovs = Number(iovs);
|
|
9398
9411
|
size = Number(size);
|
|
9399
9412
|
if (iovs === 0 && iovslen || size === 0 || offset > INT64_MAX) return 28;
|
|
9400
|
-
const { HEAPU8, view } = getMemory(this);
|
|
9413
|
+
const { HEAPU8, view } = getMemory(this, Math.max(iovs + Number(iovslen) * 8, size + 4));
|
|
9401
9414
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.FD_READ | WasiRights.FD_SEEK, BigInt(0));
|
|
9402
9415
|
if (!iovslen) {
|
|
9403
9416
|
view.setUint32(size, 0, true);
|
|
@@ -9428,7 +9441,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9428
9441
|
iovs = Number(iovs);
|
|
9429
9442
|
size = Number(size);
|
|
9430
9443
|
if (iovs === 0 && iovslen || size === 0 || offset > INT64_MAX) return 28;
|
|
9431
|
-
const { HEAPU8, view } = getMemory(this);
|
|
9444
|
+
const { HEAPU8, view } = getMemory(this, Math.max(iovs + Number(iovslen) * 8, size + 4));
|
|
9432
9445
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.FD_READ | WasiRights.FD_SEEK, BigInt(0));
|
|
9433
9446
|
if (!iovslen) {
|
|
9434
9447
|
view.setUint32(size, 0, true);
|
|
@@ -9460,7 +9473,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9460
9473
|
iovs = Number(iovs);
|
|
9461
9474
|
size = Number(size);
|
|
9462
9475
|
if (iovs === 0 && iovslen || size === 0 || offset > INT64_MAX) return 28;
|
|
9463
|
-
const { HEAPU8, view } = getMemory(this);
|
|
9476
|
+
const { HEAPU8, view } = getMemory(this, Math.max(iovs + Number(iovslen) * 8, size + 4));
|
|
9464
9477
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.FD_WRITE | WasiRights.FD_SEEK, BigInt(0));
|
|
9465
9478
|
if (!iovslen) {
|
|
9466
9479
|
view.setUint32(size, 0, true);
|
|
@@ -9479,7 +9492,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9479
9492
|
iovs = Number(iovs);
|
|
9480
9493
|
size = Number(size);
|
|
9481
9494
|
if (iovs === 0 && iovslen || size === 0 || offset > INT64_MAX) return 28;
|
|
9482
|
-
const { HEAPU8, view } = getMemory(this);
|
|
9495
|
+
const { HEAPU8, view } = getMemory(this, Math.max(iovs + Number(iovslen) * 8, size + 4));
|
|
9483
9496
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.FD_WRITE | WasiRights.FD_SEEK, BigInt(0));
|
|
9484
9497
|
if (!iovslen) {
|
|
9485
9498
|
view.setUint32(size, 0, true);
|
|
@@ -9505,7 +9518,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9505
9518
|
iovs = Number(iovs);
|
|
9506
9519
|
size = Number(size);
|
|
9507
9520
|
if (iovs === 0 && iovslen || size === 0) return 28;
|
|
9508
|
-
const { HEAPU8, view } = getMemory(this);
|
|
9521
|
+
const { HEAPU8, view } = getMemory(this, Math.max(iovs + Number(iovslen) * 8, size + 4));
|
|
9509
9522
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.FD_READ, BigInt(0));
|
|
9510
9523
|
if (!iovslen) {
|
|
9511
9524
|
view.setUint32(size, 0, true);
|
|
@@ -9544,7 +9557,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9544
9557
|
iovs = Number(iovs);
|
|
9545
9558
|
size = Number(size);
|
|
9546
9559
|
if (iovs === 0 && iovslen || size === 0) return 28;
|
|
9547
|
-
const { HEAPU8, view } = getMemory(this);
|
|
9560
|
+
const { HEAPU8, view } = getMemory(this, Math.max(iovs + Number(iovslen) * 8, size + 4));
|
|
9548
9561
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.FD_READ, BigInt(0));
|
|
9549
9562
|
if (!iovslen) {
|
|
9550
9563
|
view.setUint32(size, 0, true);
|
|
@@ -9587,7 +9600,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9587
9600
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.FD_READDIR, BigInt(0));
|
|
9588
9601
|
const fs = getFs(this);
|
|
9589
9602
|
const entries = fs.readdirSync(fileDescriptor.realPath, { withFileTypes: true });
|
|
9590
|
-
const { HEAPU8, view } = getMemory(this);
|
|
9603
|
+
const { HEAPU8, view } = getMemory(this, Math.max(buf + buf_len, bufused + 4));
|
|
9591
9604
|
let bufferUsed = 0;
|
|
9592
9605
|
for (let i = Number(cookie); i < entries.length; i++) {
|
|
9593
9606
|
const nameData = encoder.encode(entries[i].name);
|
|
@@ -9621,7 +9634,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9621
9634
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.FD_READDIR, BigInt(0));
|
|
9622
9635
|
const fs = getFs(this);
|
|
9623
9636
|
const entries = await fs.promises.readdir(fileDescriptor.realPath, { withFileTypes: true });
|
|
9624
|
-
const { HEAPU8, view } = getMemory(this);
|
|
9637
|
+
const { HEAPU8, view } = getMemory(this, Math.max(buf + buf_len, bufused + 4));
|
|
9625
9638
|
let bufferUsed = 0;
|
|
9626
9639
|
for (let i = Number(cookie); i < entries.length; i++) {
|
|
9627
9640
|
const nameData = encoder.encode(entries[i].name);
|
|
@@ -9673,7 +9686,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9673
9686
|
iovs = Number(iovs);
|
|
9674
9687
|
size = Number(size);
|
|
9675
9688
|
if (iovs === 0 && iovslen || size === 0) return 28;
|
|
9676
|
-
const { HEAPU8, view } = getMemory(this);
|
|
9689
|
+
const { HEAPU8, view } = getMemory(this, Math.max(iovs + Number(iovslen) * 8, size + 4));
|
|
9677
9690
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.FD_WRITE, BigInt(0));
|
|
9678
9691
|
if (!iovslen) {
|
|
9679
9692
|
view.setUint32(size, 0, true);
|
|
@@ -9697,7 +9710,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9697
9710
|
iovs = Number(iovs);
|
|
9698
9711
|
size = Number(size);
|
|
9699
9712
|
if (iovs === 0 && iovslen || size === 0) return 28;
|
|
9700
|
-
const { HEAPU8, view } = getMemory(this);
|
|
9713
|
+
const { HEAPU8, view } = getMemory(this, Math.max(iovs + Number(iovslen) * 8, size + 4));
|
|
9701
9714
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.FD_WRITE, BigInt(0));
|
|
9702
9715
|
if (!iovslen) {
|
|
9703
9716
|
view.setUint32(size, 0, true);
|
|
@@ -9727,7 +9740,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9727
9740
|
path = Number(path);
|
|
9728
9741
|
path_len = Number(path_len);
|
|
9729
9742
|
if (path === 0) return 28;
|
|
9730
|
-
const { HEAPU8 } = getMemory(this);
|
|
9743
|
+
const { HEAPU8 } = getMemory(this, path + path_len);
|
|
9731
9744
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.PATH_CREATE_DIRECTORY, BigInt(0));
|
|
9732
9745
|
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
|
9733
9746
|
pathString = resolve(fileDescriptor.realPath, pathString);
|
|
@@ -9737,7 +9750,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9737
9750
|
path = Number(path);
|
|
9738
9751
|
path_len = Number(path_len);
|
|
9739
9752
|
if (path === 0) return 28;
|
|
9740
|
-
const { HEAPU8 } = getMemory(this);
|
|
9753
|
+
const { HEAPU8 } = getMemory(this, path + path_len);
|
|
9741
9754
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.PATH_CREATE_DIRECTORY, BigInt(0));
|
|
9742
9755
|
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
|
9743
9756
|
pathString = resolve(fileDescriptor.realPath, pathString);
|
|
@@ -9753,7 +9766,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9753
9766
|
path_len = Number(path_len);
|
|
9754
9767
|
filestat = Number(filestat);
|
|
9755
9768
|
if (path === 0 || filestat === 0) return 28;
|
|
9756
|
-
const { HEAPU8, view } = getMemory(this);
|
|
9769
|
+
const { HEAPU8, view } = getMemory(this, Math.max(path + path_len, filestat + 64));
|
|
9757
9770
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.PATH_FILESTAT_GET, BigInt(0));
|
|
9758
9771
|
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
|
9759
9772
|
const fs = getFs(this);
|
|
@@ -9768,7 +9781,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9768
9781
|
path_len = Number(path_len);
|
|
9769
9782
|
filestat = Number(filestat);
|
|
9770
9783
|
if (path === 0 || filestat === 0) return 28;
|
|
9771
|
-
const { HEAPU8, view } = getMemory(this);
|
|
9784
|
+
const { HEAPU8, view } = getMemory(this, Math.max(path + path_len, filestat + 64));
|
|
9772
9785
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.PATH_FILESTAT_GET, BigInt(0));
|
|
9773
9786
|
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
|
9774
9787
|
const fs = getFs(this);
|
|
@@ -9789,7 +9802,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9789
9802
|
path = Number(path);
|
|
9790
9803
|
path_len = Number(path_len);
|
|
9791
9804
|
if (path === 0) return 28;
|
|
9792
|
-
const { HEAPU8 } = getMemory(this);
|
|
9805
|
+
const { HEAPU8 } = getMemory(this, path + path_len);
|
|
9793
9806
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.PATH_FILESTAT_SET_TIMES, BigInt(0));
|
|
9794
9807
|
if (validateFstFlagsOrReturn(fst_flags)) return 28;
|
|
9795
9808
|
const fs = getFs(this);
|
|
@@ -9802,7 +9815,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9802
9815
|
path = Number(path);
|
|
9803
9816
|
path_len = Number(path_len);
|
|
9804
9817
|
if (path === 0) return 28;
|
|
9805
|
-
const { HEAPU8 } = getMemory(this);
|
|
9818
|
+
const { HEAPU8 } = getMemory(this, path + path_len);
|
|
9806
9819
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.PATH_FILESTAT_SET_TIMES, BigInt(0));
|
|
9807
9820
|
if (validateFstFlagsOrReturn(fst_flags)) return 28;
|
|
9808
9821
|
const fs = getFs(this);
|
|
@@ -9834,7 +9847,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9834
9847
|
oldWrap = wasi.fds.get(old_fd, WasiRights.PATH_LINK_SOURCE, BigInt(0));
|
|
9835
9848
|
newWrap = wasi.fds.get(new_fd, WasiRights.PATH_LINK_TARGET, BigInt(0));
|
|
9836
9849
|
}
|
|
9837
|
-
const { HEAPU8 } = getMemory(this);
|
|
9850
|
+
const { HEAPU8 } = getMemory(this, Math.max(old_path + old_path_len, new_path + new_path_len));
|
|
9838
9851
|
const fs = getFs(this);
|
|
9839
9852
|
const resolvedOldPath = resolvePathSync(fs, oldWrap, decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len)), old_flags);
|
|
9840
9853
|
const resolvedNewPath = resolve(newWrap.realPath, decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len)));
|
|
@@ -9854,7 +9867,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9854
9867
|
oldWrap = wasi.fds.get(old_fd, WasiRights.PATH_LINK_SOURCE, BigInt(0));
|
|
9855
9868
|
newWrap = wasi.fds.get(new_fd, WasiRights.PATH_LINK_TARGET, BigInt(0));
|
|
9856
9869
|
}
|
|
9857
|
-
const { HEAPU8 } = getMemory(this);
|
|
9870
|
+
const { HEAPU8 } = getMemory(this, Math.max(old_path + old_path_len, new_path + new_path_len));
|
|
9858
9871
|
const fs = getFs(this);
|
|
9859
9872
|
const resolvedOldPath = await resolvePathAsync(fs, oldWrap, decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len)), old_flags);
|
|
9860
9873
|
const resolvedNewPath = resolve(newWrap.realPath, decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len)));
|
|
@@ -9913,7 +9926,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9913
9926
|
const { flags: flagsRes, needed_base: neededBase, needed_inheriting: neededInheriting } = pathOpen(o_flags, fs_rights_base, fs_rights_inheriting, fs_flags);
|
|
9914
9927
|
const wasi = _wasi.get(this);
|
|
9915
9928
|
const fileDescriptor = wasi.fds.get(dirfd, neededBase, neededInheriting);
|
|
9916
|
-
const memory = getMemory(this);
|
|
9929
|
+
const memory = getMemory(this, Math.max(path + path_len, fd + 4));
|
|
9917
9930
|
const HEAPU8 = memory.HEAPU8;
|
|
9918
9931
|
const pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
|
9919
9932
|
const fs = getFs(this);
|
|
@@ -9940,7 +9953,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9940
9953
|
const { flags: flagsRes, needed_base: neededBase, needed_inheriting: neededInheriting } = pathOpen(o_flags, fs_rights_base, fs_rights_inheriting, fs_flags);
|
|
9941
9954
|
const wasi = _wasi.get(this);
|
|
9942
9955
|
const fileDescriptor = wasi.fds.get(dirfd, neededBase, neededInheriting);
|
|
9943
|
-
const memory = getMemory(this);
|
|
9956
|
+
const memory = getMemory(this, Math.max(path + path_len, fd + 4));
|
|
9944
9957
|
const HEAPU8 = memory.HEAPU8;
|
|
9945
9958
|
const pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
|
9946
9959
|
const fs = getFs(this);
|
|
@@ -9975,7 +9988,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9975
9988
|
buf_len = Number(buf_len);
|
|
9976
9989
|
bufused = Number(bufused);
|
|
9977
9990
|
if (path === 0 || buf === 0 || bufused === 0) return 28;
|
|
9978
|
-
const { HEAPU8, view } = getMemory(this);
|
|
9991
|
+
const { HEAPU8, view } = getMemory(this, Math.max(path + path_len, buf + buf_len, bufused + 4));
|
|
9979
9992
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.PATH_READLINK, BigInt(0));
|
|
9980
9993
|
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
|
9981
9994
|
pathString = resolve(fileDescriptor.realPath, pathString);
|
|
@@ -9994,7 +10007,7 @@ var WASI$1 = class WASI$1 {
|
|
|
9994
10007
|
buf_len = Number(buf_len);
|
|
9995
10008
|
bufused = Number(bufused);
|
|
9996
10009
|
if (path === 0 || buf === 0 || bufused === 0) return 28;
|
|
9997
|
-
const { HEAPU8, view } = getMemory(this);
|
|
10010
|
+
const { HEAPU8, view } = getMemory(this, Math.max(path + path_len, buf + buf_len, bufused + 4));
|
|
9998
10011
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.PATH_READLINK, BigInt(0));
|
|
9999
10012
|
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
|
10000
10013
|
pathString = resolve(fileDescriptor.realPath, pathString);
|
|
@@ -10018,7 +10031,7 @@ var WASI$1 = class WASI$1 {
|
|
|
10018
10031
|
path = Number(path);
|
|
10019
10032
|
path_len = Number(path_len);
|
|
10020
10033
|
if (path === 0) return 28;
|
|
10021
|
-
const { HEAPU8 } = getMemory(this);
|
|
10034
|
+
const { HEAPU8 } = getMemory(this, path + path_len);
|
|
10022
10035
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.PATH_REMOVE_DIRECTORY, BigInt(0));
|
|
10023
10036
|
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
|
10024
10037
|
pathString = resolve(fileDescriptor.realPath, pathString);
|
|
@@ -10028,7 +10041,7 @@ var WASI$1 = class WASI$1 {
|
|
|
10028
10041
|
path = Number(path);
|
|
10029
10042
|
path_len = Number(path_len);
|
|
10030
10043
|
if (path === 0) return 28;
|
|
10031
|
-
const { HEAPU8 } = getMemory(this);
|
|
10044
|
+
const { HEAPU8 } = getMemory(this, path + path_len);
|
|
10032
10045
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.PATH_REMOVE_DIRECTORY, BigInt(0));
|
|
10033
10046
|
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
|
10034
10047
|
pathString = resolve(fileDescriptor.realPath, pathString);
|
|
@@ -10053,7 +10066,7 @@ var WASI$1 = class WASI$1 {
|
|
|
10053
10066
|
oldWrap = wasi.fds.get(old_fd, WasiRights.PATH_RENAME_SOURCE, BigInt(0));
|
|
10054
10067
|
newWrap = wasi.fds.get(new_fd, WasiRights.PATH_RENAME_TARGET, BigInt(0));
|
|
10055
10068
|
}
|
|
10056
|
-
const { HEAPU8 } = getMemory(this);
|
|
10069
|
+
const { HEAPU8 } = getMemory(this, Math.max(old_path + old_path_len, new_path + new_path_len));
|
|
10057
10070
|
const resolvedOldPath = resolve(oldWrap.realPath, decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len)));
|
|
10058
10071
|
const resolvedNewPath = resolve(newWrap.realPath, decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len)));
|
|
10059
10072
|
getFs(this).renameSync(resolvedOldPath, resolvedNewPath);
|
|
@@ -10072,7 +10085,7 @@ var WASI$1 = class WASI$1 {
|
|
|
10072
10085
|
oldWrap = wasi.fds.get(old_fd, WasiRights.PATH_RENAME_SOURCE, BigInt(0));
|
|
10073
10086
|
newWrap = wasi.fds.get(new_fd, WasiRights.PATH_RENAME_TARGET, BigInt(0));
|
|
10074
10087
|
}
|
|
10075
|
-
const { HEAPU8 } = getMemory(this);
|
|
10088
|
+
const { HEAPU8 } = getMemory(this, Math.max(old_path + old_path_len, new_path + new_path_len));
|
|
10076
10089
|
const resolvedOldPath = resolve(oldWrap.realPath, decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len)));
|
|
10077
10090
|
const resolvedNewPath = resolve(newWrap.realPath, decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len)));
|
|
10078
10091
|
await getFs(this).promises.rename(resolvedOldPath, resolvedNewPath);
|
|
@@ -10091,7 +10104,7 @@ var WASI$1 = class WASI$1 {
|
|
|
10091
10104
|
new_path = Number(new_path);
|
|
10092
10105
|
new_path_len = Number(new_path_len);
|
|
10093
10106
|
if (old_path === 0 || new_path === 0) return 28;
|
|
10094
|
-
const { HEAPU8 } = getMemory(this);
|
|
10107
|
+
const { HEAPU8 } = getMemory(this, Math.max(old_path + old_path_len, new_path + new_path_len));
|
|
10095
10108
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.PATH_SYMLINK, BigInt(0));
|
|
10096
10109
|
const oldPath = decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len));
|
|
10097
10110
|
if (oldPath.length > 0 && oldPath[0] === "/") return 63;
|
|
@@ -10105,7 +10118,7 @@ var WASI$1 = class WASI$1 {
|
|
|
10105
10118
|
new_path = Number(new_path);
|
|
10106
10119
|
new_path_len = Number(new_path_len);
|
|
10107
10120
|
if (old_path === 0 || new_path === 0) return 28;
|
|
10108
|
-
const { HEAPU8 } = getMemory(this);
|
|
10121
|
+
const { HEAPU8 } = getMemory(this, Math.max(old_path + old_path_len, new_path + new_path_len));
|
|
10109
10122
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.PATH_SYMLINK, BigInt(0));
|
|
10110
10123
|
const oldPath = decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len));
|
|
10111
10124
|
let newPath = decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len));
|
|
@@ -10123,7 +10136,7 @@ var WASI$1 = class WASI$1 {
|
|
|
10123
10136
|
path = Number(path);
|
|
10124
10137
|
path_len = Number(path_len);
|
|
10125
10138
|
if (path === 0) return 28;
|
|
10126
|
-
const { HEAPU8 } = getMemory(this);
|
|
10139
|
+
const { HEAPU8 } = getMemory(this, path + path_len);
|
|
10127
10140
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.PATH_UNLINK_FILE, BigInt(0));
|
|
10128
10141
|
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
|
10129
10142
|
pathString = resolve(fileDescriptor.realPath, pathString);
|
|
@@ -10133,7 +10146,7 @@ var WASI$1 = class WASI$1 {
|
|
|
10133
10146
|
path = Number(path);
|
|
10134
10147
|
path_len = Number(path_len);
|
|
10135
10148
|
if (path === 0) return 28;
|
|
10136
|
-
const { HEAPU8 } = getMemory(this);
|
|
10149
|
+
const { HEAPU8 } = getMemory(this, path + path_len);
|
|
10137
10150
|
const fileDescriptor = _wasi.get(this).fds.get(fd, WasiRights.PATH_UNLINK_FILE, BigInt(0));
|
|
10138
10151
|
let pathString = decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
|
|
10139
10152
|
pathString = resolve(fileDescriptor.realPath, pathString);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxc-parser/binding-wasm32-wasi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.138.0",
|
|
4
4
|
"cpu": [
|
|
5
5
|
"wasm32"
|
|
6
6
|
],
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"browser": "parser.wasi-browser.js",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@napi-rs/wasm-runtime": "^1.1.
|
|
43
|
+
"@napi-rs/wasm-runtime": "^1.1.6",
|
|
44
44
|
"@emnapi/core": "1.11.1",
|
|
45
45
|
"@emnapi/runtime": "1.11.1"
|
|
46
46
|
}
|
package/parser.wasm32-wasi.wasm
CHANGED
|
Binary file
|