@ai-ecoverse/slicc-kernel 1.170.2 → 1.170.3

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.
@@ -7513,7 +7513,7 @@ var init_version = __esm({
7513
7513
  "src/version.ts"() {
7514
7514
  "use strict";
7515
7515
  init_captured_globals();
7516
- KERNEL_VERSION = true ? "1.170.2" : "0.0.0-dev";
7516
+ KERNEL_VERSION = true ? "1.170.3" : "0.0.0-dev";
7517
7517
  OS_RELEASE = "6.0.0-slicc";
7518
7518
  }
7519
7519
  });
@@ -7512,7 +7512,7 @@ var init_version = __esm({
7512
7512
  "src/version.ts"() {
7513
7513
  "use strict";
7514
7514
  init_captured_globals();
7515
- KERNEL_VERSION = true ? "1.170.2" : "0.0.0-dev";
7515
+ KERNEL_VERSION = true ? "1.170.3" : "0.0.0-dev";
7516
7516
  OS_RELEASE = "6.0.0-slicc";
7517
7517
  }
7518
7518
  });
package/dist/node.js CHANGED
@@ -3695,7 +3695,7 @@ function satisfies(version, range2) {
3695
3695
  }
3696
3696
 
3697
3697
  // src/version.ts
3698
- var KERNEL_VERSION = true ? "1.170.2" : "0.0.0-dev";
3698
+ var KERNEL_VERSION = true ? "1.170.3" : "0.0.0-dev";
3699
3699
  var OS_RELEASE = "6.0.0-slicc";
3700
3700
  function procVersion() {
3701
3701
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -3964,9 +3964,19 @@ function replacesOf(manifest) {
3964
3964
  if (!Array.isArray(replaces)) return [];
3965
3965
  return replaces.every((name2) => typeof name2 === "string" && PACKAGE_NAME.test(name2)) ? replaces : [];
3966
3966
  }
3967
- async function tierPackages(fs, physical, roots, bins, kernel) {
3967
+ async function directInstalls(fs, root) {
3968
+ try {
3969
+ const project = root.slice(0, root.lastIndexOf("/"));
3970
+ const { dependencies } = JSON.parse(await fs.readFile(`${project}/package.json`));
3971
+ return new Set(Object.keys(dependencies ?? {}));
3972
+ } catch {
3973
+ return void 0;
3974
+ }
3975
+ }
3976
+ async function tierPackages(fs, physical, roots, bins, kernel, global) {
3968
3977
  const out = [];
3969
3978
  for (const root of roots) {
3979
+ const direct = global.has(root) ? await directInstalls(fs, root) : void 0;
3970
3980
  for (const pkg of await packages(fs, root)) {
3971
3981
  let manifest;
3972
3982
  try {
@@ -3978,12 +3988,15 @@ async function tierPackages(fs, physical, roots, bins, kernel) {
3978
3988
  const named = new Set(own.map((command) => command.name));
3979
3989
  const extra = bins ? await binCommandsOf(physical, pkg, manifest, named) : [];
3980
3990
  const refused3 = engineRefusal(manifest, kernel);
3981
- const commands = [...own, ...extra];
3991
+ const name2 = pkg.slice(root.length + 1);
3992
+ const dependency = direct?.has(name2) === false;
3993
+ const marks = { ...refused3 ? { refused: refused3 } : {}, ...dependency ? { dependency } : {} };
3982
3994
  out.push({
3983
- name: pkg.slice(root.length + 1),
3995
+ name: name2,
3984
3996
  pkg,
3985
3997
  replaces: replacesOf(manifest),
3986
- commands: refused3 ? commands.map((command) => ({ ...command, refused: refused3 })) : commands
3998
+ commands: [...own, ...extra].map((command) => ({ ...command, ...marks })),
3999
+ dependency
3987
4000
  });
3988
4001
  }
3989
4002
  }
@@ -4009,19 +4022,25 @@ function winners(tier) {
4009
4022
  }
4010
4023
  return out;
4011
4024
  }
4012
- async function scanCommands(fs, modules, binsFrom = Number.POSITIVE_INFINITY, kernel = KERNEL_VERSION, refused3) {
4025
+ async function scanCommands(fs, modules, binsFrom = Number.POSITIVE_INFINITY, kernel = KERNEL_VERSION, refused3, global = /* @__PURE__ */ new Set()) {
4013
4026
  const found = /* @__PURE__ */ new Map();
4014
4027
  const physical = physicalResolver(fs);
4015
4028
  const tiers = (typeof modules === "string" ? [modules] : modules).map(
4016
4029
  (tier) => typeof tier === "string" ? [tier] : tier
4017
4030
  );
4018
- for (const [index, roots] of tiers.entries()) {
4019
- const tier = await tierPackages(fs, physical, roots, index >= binsFrom, kernel);
4020
- if (refused3) refused3.push(...tier.flatMap((entry) => entry.commands.filter((c) => c.refused)));
4031
+ const take = async (tier) => {
4021
4032
  for (const [name2, { pkg, command }] of winners(tier)) {
4022
4033
  if (!found.has(name2)) found.set(name2, await withPackagePaths(fs, pkg, command));
4023
4034
  }
4035
+ };
4036
+ const dependencies = [];
4037
+ for (const [index, roots] of tiers.entries()) {
4038
+ const tier = await tierPackages(fs, physical, roots, index >= binsFrom, kernel, global);
4039
+ if (refused3) refused3.push(...tier.flatMap((entry) => entry.commands.filter((c) => c.refused)));
4040
+ await take(tier.filter((entry) => !entry.dependency));
4041
+ dependencies.push(tier.filter((entry) => entry.dependency));
4024
4042
  }
4043
+ for (const tier of dependencies) await take(tier);
4025
4044
  if (!found.has("sh") && found.has("bash")) {
4026
4045
  found.set("sh", { ...found.get("bash"), name: "sh", argv0: "sh" });
4027
4046
  }
@@ -31132,7 +31151,8 @@ var Launcher = class {
31132
31151
  tiers,
31133
31152
  tiers.length - appended2.length,
31134
31153
  void 0,
31135
- refused3
31154
+ refused3,
31155
+ await this.globalRoots(scope)
31136
31156
  );
31137
31157
  this.refusedOf.set(commands, refused3.map(refusing));
31138
31158
  return commands;
@@ -31157,11 +31177,31 @@ var Launcher = class {
31157
31177
  ownCommands(scope) {
31158
31178
  let found = this.ownCatalogs.get(scope);
31159
31179
  if (!found) {
31160
- found = pnpmGlobalRoots(this.base, scope).then((roots) => scanCommands(this.scanned, roots)).then((commands) => new Set(commands.keys()));
31180
+ found = this.ownCatalog(scope);
31161
31181
  this.ownCatalogs.set(scope, found);
31162
31182
  }
31163
31183
  return found;
31164
31184
  }
31185
+ async ownCatalog(scope) {
31186
+ const roots = await pnpmGlobalRoots(this.base, scope);
31187
+ const own = await scanCommands(
31188
+ this.scanned,
31189
+ roots,
31190
+ void 0,
31191
+ void 0,
31192
+ void 0,
31193
+ new Set(roots)
31194
+ );
31195
+ const system = await this.commands();
31196
+ return new Set(
31197
+ [...own.values()].filter((command) => !command.dependency || !system.has(command.name)).map((command) => command.name)
31198
+ );
31199
+ }
31200
+ async globalRoots(scope) {
31201
+ const homes = scope ? [scope, this.pnpmHome] : [this.pnpmHome];
31202
+ const roots = await Promise.all(homes.map((home) => pnpmGlobalRoots(this.base, home)));
31203
+ return new Set(roots.flat());
31204
+ }
31165
31205
  interpreters(scope = "") {
31166
31206
  let found = this.binfmts.get(scope);
31167
31207
  if (!found) {