sandboxedjs 0.1.77 → 0.1.80
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/dist/index.cjs +72 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +72 -25
- package/dist/index.js.map +1 -1
- package/dist/worker-entry.js +70 -2
- package/dist/worker-entry.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19051,6 +19051,49 @@ var NOTHING = [];
|
|
|
19051
19051
|
var PROPERTY = ["property", "key"];
|
|
19052
19052
|
var LABEL = ["label"];
|
|
19053
19053
|
|
|
19054
|
+
// src/node/env.ts
|
|
19055
|
+
function parseEnv(text2) {
|
|
19056
|
+
if (typeof text2 !== "string") {
|
|
19057
|
+
throw Object.assign(new TypeError('The "content" argument must be of type string'), { code: "ERR_INVALID_ARG_TYPE" });
|
|
19058
|
+
}
|
|
19059
|
+
const out = {};
|
|
19060
|
+
const lines = text2.split(/\r?\n/);
|
|
19061
|
+
for (let index = 0; index < lines.length; index++) {
|
|
19062
|
+
const raw = lines[index];
|
|
19063
|
+
const match2 = /^[ \t]*(?:export[ \t]+)?([^=#]+?)[ \t]*=[ \t]*(.*)$/.exec(raw);
|
|
19064
|
+
if (!match2) continue;
|
|
19065
|
+
const name = match2[1];
|
|
19066
|
+
let value = match2[2];
|
|
19067
|
+
const quote3 = value[0];
|
|
19068
|
+
if (quote3 === '"' || quote3 === "'" || quote3 === "`") {
|
|
19069
|
+
const start2 = index;
|
|
19070
|
+
const original = value;
|
|
19071
|
+
value = value.slice(1);
|
|
19072
|
+
while (true) {
|
|
19073
|
+
const end = value.indexOf(quote3);
|
|
19074
|
+
if (end >= 0) {
|
|
19075
|
+
value = value.slice(0, end);
|
|
19076
|
+
break;
|
|
19077
|
+
}
|
|
19078
|
+
if (++index >= lines.length) {
|
|
19079
|
+
index = start2;
|
|
19080
|
+
value = original;
|
|
19081
|
+
break;
|
|
19082
|
+
}
|
|
19083
|
+
value += `
|
|
19084
|
+
${lines[index]}`;
|
|
19085
|
+
}
|
|
19086
|
+
if (quote3 === '"') value = value.replace(/\\n/g, "\n");
|
|
19087
|
+
} else {
|
|
19088
|
+
const comment = value.indexOf("#");
|
|
19089
|
+
if (comment >= 0) value = value.slice(0, comment);
|
|
19090
|
+
value = value.trim();
|
|
19091
|
+
}
|
|
19092
|
+
Object.defineProperty(out, name, { value, writable: true, enumerable: true, configurable: true });
|
|
19093
|
+
}
|
|
19094
|
+
return out;
|
|
19095
|
+
}
|
|
19096
|
+
|
|
19054
19097
|
// src/node/node.ts
|
|
19055
19098
|
var NODE_VERSION = "v22.12.0";
|
|
19056
19099
|
new TextEncoder();
|
|
@@ -19317,7 +19360,7 @@ The filesystem a script sees is the container's filesystem.`,
|
|
|
19317
19360
|
`);
|
|
19318
19361
|
return 9;
|
|
19319
19362
|
}
|
|
19320
|
-
Object.assign(loaded,
|
|
19363
|
+
Object.assign(loaded, parseEnv(text2));
|
|
19321
19364
|
}
|
|
19322
19365
|
env2 = { ...loaded, ...ctx.env };
|
|
19323
19366
|
}
|
|
@@ -19554,27 +19597,6 @@ var VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
|
19554
19597
|
"--report-dir",
|
|
19555
19598
|
"--report-filename"
|
|
19556
19599
|
]);
|
|
19557
|
-
function parseEnvFile(text2) {
|
|
19558
|
-
const out = {};
|
|
19559
|
-
for (const raw of text2.split(/\r?\n/)) {
|
|
19560
|
-
const line = raw.trim();
|
|
19561
|
-
if (!line || line.startsWith("#")) continue;
|
|
19562
|
-
const match2 = /^(?:export\s+)?([A-Za-z_][A-Za-z0-9_.-]*)\s*=\s*(.*)$/.exec(line);
|
|
19563
|
-
if (!match2) continue;
|
|
19564
|
-
let value = match2[2];
|
|
19565
|
-
const quote3 = value[0];
|
|
19566
|
-
if ((quote3 === '"' || quote3 === "'" || quote3 === "`") && value.length >= 2 && value.endsWith(quote3)) {
|
|
19567
|
-
value = value.slice(1, -1);
|
|
19568
|
-
if (quote3 === '"') value = value.replace(/\\n/g, "\n");
|
|
19569
|
-
} else {
|
|
19570
|
-
const comment = value.indexOf(" #");
|
|
19571
|
-
if (comment >= 0) value = value.slice(0, comment);
|
|
19572
|
-
value = value.trim();
|
|
19573
|
-
}
|
|
19574
|
-
out[match2[1]] = value;
|
|
19575
|
-
}
|
|
19576
|
-
return out;
|
|
19577
|
-
}
|
|
19578
19600
|
var AsyncFunction = Object.getPrototypeOf(async function() {
|
|
19579
19601
|
}).constructor;
|
|
19580
19602
|
function checkSyntax(ctx, script) {
|
|
@@ -20198,7 +20220,7 @@ var wheels_default = {
|
|
|
20198
20220
|
|
|
20199
20221
|
// package.json
|
|
20200
20222
|
var package_default = {
|
|
20201
|
-
version: "0.1.
|
|
20223
|
+
version: "0.1.80"};
|
|
20202
20224
|
|
|
20203
20225
|
// src/python/config.ts
|
|
20204
20226
|
function runtimeModuleUrl() {
|
|
@@ -26314,6 +26336,9 @@ function render(value, depth, seen, options) {
|
|
|
26314
26336
|
if (value instanceof Date) return Number.isNaN(value.getTime()) ? "Invalid Date" : value.toISOString();
|
|
26315
26337
|
if (value instanceof RegExp) return String(value);
|
|
26316
26338
|
if (Buffer2.isBuffer(value)) return renderBuffer(value);
|
|
26339
|
+
if (value instanceof DataView) {
|
|
26340
|
+
return `DataView { byteLength: ${value.byteLength}, byteOffset: ${value.byteOffset} }`;
|
|
26341
|
+
}
|
|
26317
26342
|
if (ArrayBuffer.isView(value)) return renderTypedArray(value);
|
|
26318
26343
|
seen.add(object);
|
|
26319
26344
|
try {
|
|
@@ -26375,7 +26400,13 @@ function renderBuffer(value) {
|
|
|
26375
26400
|
}
|
|
26376
26401
|
function renderTypedArray(value) {
|
|
26377
26402
|
const name = value.constructor?.name ?? "TypedArray";
|
|
26378
|
-
const items = [
|
|
26403
|
+
const items = [];
|
|
26404
|
+
const indexed = value;
|
|
26405
|
+
for (let i = 0; i < Math.min(value.length, MAX_ARRAY); i++) {
|
|
26406
|
+
const item = indexed[i];
|
|
26407
|
+
items.push(typeof item === "bigint" ? `${item}n` : String(item));
|
|
26408
|
+
}
|
|
26409
|
+
if (value.length > MAX_ARRAY) items.push(`... ${value.length - MAX_ARRAY} more items`);
|
|
26379
26410
|
return `${name}(${value.length}) [ ${items.join(", ")} ]`;
|
|
26380
26411
|
}
|
|
26381
26412
|
function prefixed(name, size, parts) {
|
|
@@ -26631,6 +26662,7 @@ var legacy = {
|
|
|
26631
26662
|
};
|
|
26632
26663
|
inspect.custom = customInspect;
|
|
26633
26664
|
var utilModule = {
|
|
26665
|
+
parseEnv,
|
|
26634
26666
|
format,
|
|
26635
26667
|
formatWithOptions,
|
|
26636
26668
|
inspect,
|
|
@@ -29136,6 +29168,10 @@ function createCoreModules(options) {
|
|
|
29136
29168
|
arch: "x64",
|
|
29137
29169
|
version: "v22.12.0",
|
|
29138
29170
|
versions: { ...processShim.versions, node: "22.12.0" },
|
|
29171
|
+
binding: (name) => {
|
|
29172
|
+
if (name === "constants") return { fs: { ...fs.constants } };
|
|
29173
|
+
throw new Error(`No such module: ${name}`);
|
|
29174
|
+
},
|
|
29139
29175
|
pid: 100,
|
|
29140
29176
|
ppid: 1,
|
|
29141
29177
|
title: "node",
|
|
@@ -29235,6 +29271,14 @@ function createCoreModules(options) {
|
|
|
29235
29271
|
processObject.stdin = stdin;
|
|
29236
29272
|
Reflect.deleteProperty(processObject, "browser");
|
|
29237
29273
|
const fs = createFsModule(volume, () => cwd, options.stdinPath, defer);
|
|
29274
|
+
processObject.loadEnvFile = (path2 = ".env") => {
|
|
29275
|
+
const parsed = parseEnv(fs.readFileSync(path2, "utf8"));
|
|
29276
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
29277
|
+
if (!Object.prototype.hasOwnProperty.call(processObject.env, key)) {
|
|
29278
|
+
Object.defineProperty(processObject.env, key, { value, writable: true, enumerable: true, configurable: true });
|
|
29279
|
+
}
|
|
29280
|
+
}
|
|
29281
|
+
};
|
|
29238
29282
|
const path = createPathModule(() => cwd);
|
|
29239
29283
|
const consoleObject = new Console(stdoutWrite, stderrWrite);
|
|
29240
29284
|
const os = createOsModule();
|
|
@@ -29434,7 +29478,7 @@ function createFsModule(volume, cwd, stdinPath, defer = queueMicrotask) {
|
|
|
29434
29478
|
if (stdinPath) fds.set(0, { path: stdinPath, position: 0, flags: "r" });
|
|
29435
29479
|
const abs = (value) => {
|
|
29436
29480
|
if (typeof value === "number") return requiredFd(fds, value).path;
|
|
29437
|
-
if (value instanceof URL) value = value.pathname;
|
|
29481
|
+
if (value instanceof URL) value = decodeURIComponent(value.pathname);
|
|
29438
29482
|
if (Buffer2.isBuffer(value) || value instanceof Uint8Array) value = new TextDecoder().decode(value);
|
|
29439
29483
|
if (typeof value !== "string") throw new TypeError("path must be a string, Buffer, or URL");
|
|
29440
29484
|
return value.startsWith("/") ? clean(value) : resolve(cwd(), value);
|
|
@@ -29492,6 +29536,9 @@ function createFsModule(volume, cwd, stdinPath, defer = queueMicrotask) {
|
|
|
29492
29536
|
O_EXCL: 128,
|
|
29493
29537
|
O_TRUNC: 512,
|
|
29494
29538
|
O_APPEND: 1024,
|
|
29539
|
+
O_NOCTTY: 256,
|
|
29540
|
+
O_SYNC: 1052672,
|
|
29541
|
+
O_NOFOLLOW: 131072,
|
|
29495
29542
|
COPYFILE_EXCL: 1
|
|
29496
29543
|
},
|
|
29497
29544
|
Dirent,
|