sandboxedjs 0.1.9 → 0.1.10

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
@@ -21639,12 +21639,25 @@ var CHILD_PROCESS_SHIM = `
21639
21639
  }
21640
21640
  var kind = classify(head(found));
21641
21641
  if (kind === null || kind === 'WebAssembly module') return null;
21642
+ if (kind.indexOf('ELF') === 0) {
21643
+ // The container does run these \u2014 on the emulated CPU, dispatched by the
21644
+ // kernel. What cannot reach that is child_process from inside a Node
21645
+ // script, which is served by the pod's own shell.
21646
+ return {
21647
+ code: 'ENOEXEC',
21648
+ lines: [
21649
+ found + ': ' + kind + '.',
21650
+ 'The container can run this from the shell, on its emulated x86-64 CPU, but',
21651
+ 'child_process inside a Node script cannot reach it. Run it from the shell.',
21652
+ ],
21653
+ };
21654
+ }
21642
21655
  return {
21643
21656
  code: 'ENOEXEC',
21644
21657
  lines: [
21645
21658
  found + ': ' + kind + '.',
21646
- 'This container executes JavaScript and WebAssembly. It has no CPU to run',
21647
- 'machine code on, so this file cannot be started from a script either.',
21659
+ 'This container runs x86-64 Linux binaries, JavaScript and WebAssembly. It',
21660
+ 'does not emulate other operating systems, so this file cannot start.',
21648
21661
  ],
21649
21662
  };
21650
21663
  }
@@ -27217,10 +27230,18 @@ function inspectPackage(ctx, packageDir, packageName) {
27217
27230
  );
27218
27231
  lines.push("each of which is native machine code for one OS and CPU.");
27219
27232
  }
27233
+ const hasLinuxBuild = platformDeps.some((dep) => /linux/.test(dep)) || platformDeps.length === 0;
27220
27234
  lines.push("");
27221
- lines.push("This container has no CPU to run machine code on \u2014 only JavaScript and");
27222
- lines.push("WebAssembly. The package is installed and its files are on disk, but the");
27223
- lines.push("command it provides cannot start.");
27235
+ if (hasLinuxBuild) {
27236
+ lines.push("This container emulates x86-64 Linux, so a linux-x64 build can run \u2014 but it");
27237
+ lines.push("has to be on disk, and a dynamically linked one also needs its loader:");
27238
+ lines.push(" x86 info <binary> what it is and whether it can start");
27239
+ lines.push(" /lib64/ld-linux-x86-64.so.2 copy in from any Linux system, with libc.so.6");
27240
+ lines.push("Builds for macOS or Windows will not run.");
27241
+ } else {
27242
+ lines.push("This container emulates x86-64 Linux only. None of the platform packages");
27243
+ lines.push("above target it, so there is no build here that can start.");
27244
+ }
27224
27245
  return { verdict: "native", lines };
27225
27246
  }
27226
27247
 
@@ -27357,8 +27378,6 @@ async function linkGlobalPackages(ctx, stagingRoot, specs, quiet, runScripts) {
27357
27378
  ctx.stderr.write("\n");
27358
27379
  for (const line of report.lines) ctx.stderr.write(`npm warn ${line}
27359
27380
  `);
27360
- status = report.verdict === "native" ? 1 : status;
27361
- continue;
27362
27381
  }
27363
27382
  if (!quiet) {
27364
27383
  if (linked.length > 0) {
@@ -27568,8 +27587,6 @@ var npm = defineCommand({
27568
27587
  if (report.verdict !== "ok") {
27569
27588
  for (const line of report.lines) ctx.stderr.write(`npm warn ${line}
27570
27589
  `);
27571
- status = 1;
27572
- continue;
27573
27590
  }
27574
27591
  for (const bin of linked) ctx.line(`${join(binDir, bin)} -> ${dir3}`);
27575
27592
  }