sandboxedjs 0.1.77 → 0.1.78

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 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, parseEnvFile(text2));
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.77"};
20240
+ version: "0.1.78"};
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 = [...value].slice(0, MAX_ARRAY);
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,
@@ -29252,6 +29284,14 @@ function createCoreModules(options) {
29252
29284
  processObject.stdin = stdin;
29253
29285
  Reflect.deleteProperty(processObject, "browser");
29254
29286
  const fs = createFsModule(volume, () => cwd, options.stdinPath, defer);
29287
+ processObject.loadEnvFile = (path2 = ".env") => {
29288
+ const parsed = parseEnv(fs.readFileSync(path2, "utf8"));
29289
+ for (const [key, value] of Object.entries(parsed)) {
29290
+ if (!Object.prototype.hasOwnProperty.call(processObject.env, key)) {
29291
+ Object.defineProperty(processObject.env, key, { value, writable: true, enumerable: true, configurable: true });
29292
+ }
29293
+ }
29294
+ };
29255
29295
  const path = createPathModule(() => cwd);
29256
29296
  const consoleObject = new Console(stdoutWrite, stderrWrite);
29257
29297
  const os = createOsModule();