@ai-ecoverse/slicc-kernel 1.146.7 → 1.147.1

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/node.js CHANGED
@@ -3305,7 +3305,7 @@ function satisfies(version, range2) {
3305
3305
  }
3306
3306
 
3307
3307
  // src/version.ts
3308
- var KERNEL_VERSION = true ? "1.146.7" : "0.0.0-dev";
3308
+ var KERNEL_VERSION = true ? "1.147.1" : "0.0.0-dev";
3309
3309
  var OS_RELEASE = "6.0.0-slicc";
3310
3310
  function procVersion() {
3311
3311
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -27876,6 +27876,8 @@ function linksOf2(req) {
27876
27876
  return req.links === void 0 ? {} : { links: req.links };
27877
27877
  }
27878
27878
  var COMMAND2 = /^\/(?:usr\/)?bin\/([^/]+)$/;
27879
+ var SHIM_MARKER = /^\/\/ pnpm-wasm-shim=(\{.*\})$/gm;
27880
+ var SHIM_MAX = 64 * 1024;
27879
27881
  var PACKAGE_ROOT = /^(.*\/node_modules\/(?:@[^/]+\/)?[^/]+)\//;
27880
27882
  var ENV_REFERENCE = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
27881
27883
  var WASM_MAGIC = [0, 97, 115, 109];
@@ -28567,7 +28569,10 @@ var Launcher = class {
28567
28569
  return { abi: "emscripten", glue, wasm, argv0: baseName2(argv0 || file), ...asked };
28568
28570
  }
28569
28571
  const owner = await this.glueOwner(glue, baseName2(file), scope);
28570
- if (!owner) return void 0;
28572
+ if (!owner) {
28573
+ const shim = await this.shimOwner(glue, baseName2(file), scope);
28574
+ return shim && { ...targetOf(shim), ...asked, shim: glue };
28575
+ }
28571
28576
  return { ...targetOf(owner), ...asked, ...owner.glue === glue ? {} : { copy: glue } };
28572
28577
  }
28573
28578
  async ownOrRefused(path, name2, scope) {
@@ -28603,6 +28608,43 @@ var Launcher = class {
28603
28608
  }
28604
28609
  return void 0;
28605
28610
  }
28611
+ async shimOwner(script, name2, scope) {
28612
+ const command = (await this.commands(scope)).get(name2);
28613
+ if (!command || command.script || command.origin?.script) return void 0;
28614
+ const target = await this.shimTarget(script);
28615
+ if (target === void 0) return void 0;
28616
+ const pkg = await this.installedPackage(await physicalPathAsync(this.base, target), scope);
28617
+ if (!pkg) return void 0;
28618
+ const glue = command.origin?.glue ?? command.glue;
28619
+ const own = await physicalPathAsync(this.base, glue).catch(() => void 0);
28620
+ return own?.startsWith(`${pkg}/`) ? command : void 0;
28621
+ }
28622
+ async shimTarget(script) {
28623
+ const st = await this.base.stat(script).catch(() => void 0);
28624
+ if (!st?.isFile || st.size > SHIM_MAX) return void 0;
28625
+ const text = await this.base.readFile(script).catch(() => "");
28626
+ const marker = [...text.matchAll(SHIM_MARKER)].at(-1)?.[1];
28627
+ if (marker === void 0) return void 0;
28628
+ let target;
28629
+ try {
28630
+ target = JSON.parse(marker).target;
28631
+ } catch {
28632
+ return void 0;
28633
+ }
28634
+ if (typeof target !== "string" || target === "") return void 0;
28635
+ const dir = await physicalPathAsync(this.base, script.slice(0, script.lastIndexOf("/")) || "/");
28636
+ return this.fs.resolvePath(dir, target);
28637
+ }
28638
+ async installedPackage(real, scope) {
28639
+ for (const root of await this.roots(scope)) {
28640
+ const top = await physicalPathAsync(this.base, root).catch(() => void 0);
28641
+ if (!top || !real.startsWith(`${top}/`)) continue;
28642
+ const [first = "", second] = real.slice(top.length + 1).split("/");
28643
+ const pkg = first.startsWith("@") && second ? `${top}/${first}/${second}` : `${top}/${first}`;
28644
+ if (pkg !== real && await this.base.exists(`${pkg}/package.json`)) return pkg;
28645
+ }
28646
+ return void 0;
28647
+ }
28606
28648
  async glueOwner(glue, name2, scope) {
28607
28649
  const commands = [...(await this.commands(scope)).values()];
28608
28650
  const owners = commands.filter((c) => c.abi === "emscripten" && !c.script && c.glue === glue);
@@ -28698,7 +28740,10 @@ var Launcher = class {
28698
28740
  const found = await this.resolve(file, argv[0] ?? file, cwd, scope);
28699
28741
  const named = typeof argv0 === "string" && found && !found.fixed;
28700
28742
  const direct = named ? { ...found, argv0 } : found;
28701
- if (direct) return { target: direct, args: [...direct.prefix ?? [], ...argv.slice(1)] };
28743
+ if (direct) {
28744
+ const shim = direct.shim ? { sources: [direct.shim], asked: direct.asked ? { [direct.shim]: direct.asked } : {} } : {};
28745
+ return { target: direct, args: [...direct.prefix ?? [], ...argv.slice(1)], ...shim };
28746
+ }
28702
28747
  if (catalogOnly && !await this.scriptCommand(file, cwd, scope)) return void 0;
28703
28748
  const script = await this.interpreted(file, argv, cwd, scope);
28704
28749
  return script && { ...script, script: true };