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.cjs
CHANGED
|
@@ -19068,6 +19068,49 @@ var NOTHING = [];
|
|
|
19068
19068
|
var PROPERTY = ["property", "key"];
|
|
19069
19069
|
var LABEL = ["label"];
|
|
19070
19070
|
|
|
19071
|
+
// src/node/env.ts
|
|
19072
|
+
function parseEnv(text2) {
|
|
19073
|
+
if (typeof text2 !== "string") {
|
|
19074
|
+
throw Object.assign(new TypeError('The "content" argument must be of type string'), { code: "ERR_INVALID_ARG_TYPE" });
|
|
19075
|
+
}
|
|
19076
|
+
const out = {};
|
|
19077
|
+
const lines = text2.split(/\r?\n/);
|
|
19078
|
+
for (let index = 0; index < lines.length; index++) {
|
|
19079
|
+
const raw = lines[index];
|
|
19080
|
+
const match2 = /^[ \t]*(?:export[ \t]+)?([^=#]+?)[ \t]*=[ \t]*(.*)$/.exec(raw);
|
|
19081
|
+
if (!match2) continue;
|
|
19082
|
+
const name = match2[1];
|
|
19083
|
+
let value = match2[2];
|
|
19084
|
+
const quote3 = value[0];
|
|
19085
|
+
if (quote3 === '"' || quote3 === "'" || quote3 === "`") {
|
|
19086
|
+
const start2 = index;
|
|
19087
|
+
const original = value;
|
|
19088
|
+
value = value.slice(1);
|
|
19089
|
+
while (true) {
|
|
19090
|
+
const end = value.indexOf(quote3);
|
|
19091
|
+
if (end >= 0) {
|
|
19092
|
+
value = value.slice(0, end);
|
|
19093
|
+
break;
|
|
19094
|
+
}
|
|
19095
|
+
if (++index >= lines.length) {
|
|
19096
|
+
index = start2;
|
|
19097
|
+
value = original;
|
|
19098
|
+
break;
|
|
19099
|
+
}
|
|
19100
|
+
value += `
|
|
19101
|
+
${lines[index]}`;
|
|
19102
|
+
}
|
|
19103
|
+
if (quote3 === '"') value = value.replace(/\\n/g, "\n");
|
|
19104
|
+
} else {
|
|
19105
|
+
const comment = value.indexOf("#");
|
|
19106
|
+
if (comment >= 0) value = value.slice(0, comment);
|
|
19107
|
+
value = value.trim();
|
|
19108
|
+
}
|
|
19109
|
+
Object.defineProperty(out, name, { value, writable: true, enumerable: true, configurable: true });
|
|
19110
|
+
}
|
|
19111
|
+
return out;
|
|
19112
|
+
}
|
|
19113
|
+
|
|
19071
19114
|
// src/node/node.ts
|
|
19072
19115
|
var NODE_VERSION = "v22.12.0";
|
|
19073
19116
|
new TextEncoder();
|
|
@@ -19334,7 +19377,7 @@ The filesystem a script sees is the container's filesystem.`,
|
|
|
19334
19377
|
`);
|
|
19335
19378
|
return 9;
|
|
19336
19379
|
}
|
|
19337
|
-
Object.assign(loaded,
|
|
19380
|
+
Object.assign(loaded, parseEnv(text2));
|
|
19338
19381
|
}
|
|
19339
19382
|
env2 = { ...loaded, ...ctx.env };
|
|
19340
19383
|
}
|
|
@@ -19571,27 +19614,6 @@ var VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
|
19571
19614
|
"--report-dir",
|
|
19572
19615
|
"--report-filename"
|
|
19573
19616
|
]);
|
|
19574
|
-
function parseEnvFile(text2) {
|
|
19575
|
-
const out = {};
|
|
19576
|
-
for (const raw of text2.split(/\r?\n/)) {
|
|
19577
|
-
const line = raw.trim();
|
|
19578
|
-
if (!line || line.startsWith("#")) continue;
|
|
19579
|
-
const match2 = /^(?:export\s+)?([A-Za-z_][A-Za-z0-9_.-]*)\s*=\s*(.*)$/.exec(line);
|
|
19580
|
-
if (!match2) continue;
|
|
19581
|
-
let value = match2[2];
|
|
19582
|
-
const quote3 = value[0];
|
|
19583
|
-
if ((quote3 === '"' || quote3 === "'" || quote3 === "`") && value.length >= 2 && value.endsWith(quote3)) {
|
|
19584
|
-
value = value.slice(1, -1);
|
|
19585
|
-
if (quote3 === '"') value = value.replace(/\\n/g, "\n");
|
|
19586
|
-
} else {
|
|
19587
|
-
const comment = value.indexOf(" #");
|
|
19588
|
-
if (comment >= 0) value = value.slice(0, comment);
|
|
19589
|
-
value = value.trim();
|
|
19590
|
-
}
|
|
19591
|
-
out[match2[1]] = value;
|
|
19592
|
-
}
|
|
19593
|
-
return out;
|
|
19594
|
-
}
|
|
19595
19617
|
var AsyncFunction = Object.getPrototypeOf(async function() {
|
|
19596
19618
|
}).constructor;
|
|
19597
19619
|
function checkSyntax(ctx, script) {
|
|
@@ -20215,7 +20237,7 @@ var wheels_default = {
|
|
|
20215
20237
|
|
|
20216
20238
|
// package.json
|
|
20217
20239
|
var package_default = {
|
|
20218
|
-
version: "0.1.
|
|
20240
|
+
version: "0.1.80"};
|
|
20219
20241
|
|
|
20220
20242
|
// src/python/config.ts
|
|
20221
20243
|
function runtimeModuleUrl() {
|
|
@@ -26331,6 +26353,9 @@ function render(value, depth, seen, options) {
|
|
|
26331
26353
|
if (value instanceof Date) return Number.isNaN(value.getTime()) ? "Invalid Date" : value.toISOString();
|
|
26332
26354
|
if (value instanceof RegExp) return String(value);
|
|
26333
26355
|
if (Buffer2.isBuffer(value)) return renderBuffer(value);
|
|
26356
|
+
if (value instanceof DataView) {
|
|
26357
|
+
return `DataView { byteLength: ${value.byteLength}, byteOffset: ${value.byteOffset} }`;
|
|
26358
|
+
}
|
|
26334
26359
|
if (ArrayBuffer.isView(value)) return renderTypedArray(value);
|
|
26335
26360
|
seen.add(object);
|
|
26336
26361
|
try {
|
|
@@ -26392,7 +26417,13 @@ function renderBuffer(value) {
|
|
|
26392
26417
|
}
|
|
26393
26418
|
function renderTypedArray(value) {
|
|
26394
26419
|
const name = value.constructor?.name ?? "TypedArray";
|
|
26395
|
-
const items = [
|
|
26420
|
+
const items = [];
|
|
26421
|
+
const indexed = value;
|
|
26422
|
+
for (let i = 0; i < Math.min(value.length, MAX_ARRAY); i++) {
|
|
26423
|
+
const item = indexed[i];
|
|
26424
|
+
items.push(typeof item === "bigint" ? `${item}n` : String(item));
|
|
26425
|
+
}
|
|
26426
|
+
if (value.length > MAX_ARRAY) items.push(`... ${value.length - MAX_ARRAY} more items`);
|
|
26396
26427
|
return `${name}(${value.length}) [ ${items.join(", ")} ]`;
|
|
26397
26428
|
}
|
|
26398
26429
|
function prefixed(name, size, parts) {
|
|
@@ -26648,6 +26679,7 @@ var legacy = {
|
|
|
26648
26679
|
};
|
|
26649
26680
|
inspect.custom = customInspect;
|
|
26650
26681
|
var utilModule = {
|
|
26682
|
+
parseEnv,
|
|
26651
26683
|
format,
|
|
26652
26684
|
formatWithOptions,
|
|
26653
26685
|
inspect,
|
|
@@ -29153,6 +29185,10 @@ function createCoreModules(options) {
|
|
|
29153
29185
|
arch: "x64",
|
|
29154
29186
|
version: "v22.12.0",
|
|
29155
29187
|
versions: { ...processShim__default.default.versions, node: "22.12.0" },
|
|
29188
|
+
binding: (name) => {
|
|
29189
|
+
if (name === "constants") return { fs: { ...fs.constants } };
|
|
29190
|
+
throw new Error(`No such module: ${name}`);
|
|
29191
|
+
},
|
|
29156
29192
|
pid: 100,
|
|
29157
29193
|
ppid: 1,
|
|
29158
29194
|
title: "node",
|
|
@@ -29252,6 +29288,14 @@ function createCoreModules(options) {
|
|
|
29252
29288
|
processObject.stdin = stdin;
|
|
29253
29289
|
Reflect.deleteProperty(processObject, "browser");
|
|
29254
29290
|
const fs = createFsModule(volume, () => cwd, options.stdinPath, defer);
|
|
29291
|
+
processObject.loadEnvFile = (path2 = ".env") => {
|
|
29292
|
+
const parsed = parseEnv(fs.readFileSync(path2, "utf8"));
|
|
29293
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
29294
|
+
if (!Object.prototype.hasOwnProperty.call(processObject.env, key)) {
|
|
29295
|
+
Object.defineProperty(processObject.env, key, { value, writable: true, enumerable: true, configurable: true });
|
|
29296
|
+
}
|
|
29297
|
+
}
|
|
29298
|
+
};
|
|
29255
29299
|
const path = createPathModule(() => cwd);
|
|
29256
29300
|
const consoleObject = new Console(stdoutWrite, stderrWrite);
|
|
29257
29301
|
const os = createOsModule();
|
|
@@ -29451,7 +29495,7 @@ function createFsModule(volume, cwd, stdinPath, defer = queueMicrotask) {
|
|
|
29451
29495
|
if (stdinPath) fds.set(0, { path: stdinPath, position: 0, flags: "r" });
|
|
29452
29496
|
const abs = (value) => {
|
|
29453
29497
|
if (typeof value === "number") return requiredFd(fds, value).path;
|
|
29454
|
-
if (value instanceof URL) value = value.pathname;
|
|
29498
|
+
if (value instanceof URL) value = decodeURIComponent(value.pathname);
|
|
29455
29499
|
if (Buffer2.isBuffer(value) || value instanceof Uint8Array) value = new TextDecoder().decode(value);
|
|
29456
29500
|
if (typeof value !== "string") throw new TypeError("path must be a string, Buffer, or URL");
|
|
29457
29501
|
return value.startsWith("/") ? clean(value) : resolve(cwd(), value);
|
|
@@ -29509,6 +29553,9 @@ function createFsModule(volume, cwd, stdinPath, defer = queueMicrotask) {
|
|
|
29509
29553
|
O_EXCL: 128,
|
|
29510
29554
|
O_TRUNC: 512,
|
|
29511
29555
|
O_APPEND: 1024,
|
|
29556
|
+
O_NOCTTY: 256,
|
|
29557
|
+
O_SYNC: 1052672,
|
|
29558
|
+
O_NOFOLLOW: 131072,
|
|
29512
29559
|
COPYFILE_EXCL: 1
|
|
29513
29560
|
},
|
|
29514
29561
|
Dirent,
|