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.js CHANGED
@@ -21634,12 +21634,25 @@ var CHILD_PROCESS_SHIM = `
21634
21634
  }
21635
21635
  var kind = classify(head(found));
21636
21636
  if (kind === null || kind === 'WebAssembly module') return null;
21637
+ if (kind.indexOf('ELF') === 0) {
21638
+ // The container does run these \u2014 on the emulated CPU, dispatched by the
21639
+ // kernel. What cannot reach that is child_process from inside a Node
21640
+ // script, which is served by the pod's own shell.
21641
+ return {
21642
+ code: 'ENOEXEC',
21643
+ lines: [
21644
+ found + ': ' + kind + '.',
21645
+ 'The container can run this from the shell, on its emulated x86-64 CPU, but',
21646
+ 'child_process inside a Node script cannot reach it. Run it from the shell.',
21647
+ ],
21648
+ };
21649
+ }
21637
21650
  return {
21638
21651
  code: 'ENOEXEC',
21639
21652
  lines: [
21640
21653
  found + ': ' + kind + '.',
21641
- 'This container executes JavaScript and WebAssembly. It has no CPU to run',
21642
- 'machine code on, so this file cannot be started from a script either.',
21654
+ 'This container runs x86-64 Linux binaries, JavaScript and WebAssembly. It',
21655
+ 'does not emulate other operating systems, so this file cannot start.',
21643
21656
  ],
21644
21657
  };
21645
21658
  }
@@ -27212,10 +27225,18 @@ function inspectPackage(ctx, packageDir, packageName) {
27212
27225
  );
27213
27226
  lines.push("each of which is native machine code for one OS and CPU.");
27214
27227
  }
27228
+ const hasLinuxBuild = platformDeps.some((dep) => /linux/.test(dep)) || platformDeps.length === 0;
27215
27229
  lines.push("");
27216
- lines.push("This container has no CPU to run machine code on \u2014 only JavaScript and");
27217
- lines.push("WebAssembly. The package is installed and its files are on disk, but the");
27218
- lines.push("command it provides cannot start.");
27230
+ if (hasLinuxBuild) {
27231
+ lines.push("This container emulates x86-64 Linux, so a linux-x64 build can run \u2014 but it");
27232
+ lines.push("has to be on disk, and a dynamically linked one also needs its loader:");
27233
+ lines.push(" x86 info <binary> what it is and whether it can start");
27234
+ lines.push(" /lib64/ld-linux-x86-64.so.2 copy in from any Linux system, with libc.so.6");
27235
+ lines.push("Builds for macOS or Windows will not run.");
27236
+ } else {
27237
+ lines.push("This container emulates x86-64 Linux only. None of the platform packages");
27238
+ lines.push("above target it, so there is no build here that can start.");
27239
+ }
27219
27240
  return { verdict: "native", lines };
27220
27241
  }
27221
27242
 
@@ -27352,8 +27373,6 @@ async function linkGlobalPackages(ctx, stagingRoot, specs, quiet, runScripts) {
27352
27373
  ctx.stderr.write("\n");
27353
27374
  for (const line of report.lines) ctx.stderr.write(`npm warn ${line}
27354
27375
  `);
27355
- status = report.verdict === "native" ? 1 : status;
27356
- continue;
27357
27376
  }
27358
27377
  if (!quiet) {
27359
27378
  if (linked.length > 0) {
@@ -27563,8 +27582,6 @@ var npm = defineCommand({
27563
27582
  if (report.verdict !== "ok") {
27564
27583
  for (const line of report.lines) ctx.stderr.write(`npm warn ${line}
27565
27584
  `);
27566
- status = 1;
27567
- continue;
27568
27585
  }
27569
27586
  for (const bin of linked) ctx.line(`${join(binDir, bin)} -> ${dir3}`);
27570
27587
  }