@ai-ecoverse/slicc-kernel 1.132.0 → 1.132.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.
@@ -1620,6 +1620,22 @@ function physicalPath(fs, path) {
1620
1620
  }
1621
1621
  return `/${walk.done.join("/")}`;
1622
1622
  }
1623
+ function physicalLeaf(fs, path) {
1624
+ const walk = start(path);
1625
+ for (let part = next(walk); part !== void 0; part = next(walk)) {
1626
+ const at = `/${[...walk.done, part].join("/")}`;
1627
+ let target;
1628
+ try {
1629
+ target = fs.lstat(at).isSymbolicLink ? fs.readlink(at) : void 0;
1630
+ } catch {
1631
+ const tail = walk.todo;
1632
+ return tail.some((p) => p === "." || p === "..") ? void 0 : [at, ...tail].join("/");
1633
+ }
1634
+ if (target === void 0) walk.done.push(part);
1635
+ else if (!follow(walk, target)) return void 0;
1636
+ }
1637
+ return `/${walk.done.join("/")}`;
1638
+ }
1623
1639
  async function physicalPathAsync(fs, path) {
1624
1640
  const walk = start(path);
1625
1641
  for (let part = next(walk); part !== void 0; part = next(walk)) {
@@ -5778,8 +5794,8 @@ var init_wasi_host = __esm({
5778
5794
  }
5779
5795
  linkedDev(path, follow3) {
5780
5796
  if (!follow3) return void 0;
5781
- const real = physicalPath(this.o.fs, path);
5782
- return real !== path && kernelDev(real) ? real : void 0;
5797
+ const real = physicalLeaf(this.o.fs, path);
5798
+ return real !== void 0 && real !== path && kernelDev(real) ? real : void 0;
5783
5799
  }
5784
5800
  statOf(path, follow3) {
5785
5801
  return follow3 ? this.o.fs.stat(path) : this.o.fs.lstat(path);
@@ -5807,12 +5823,12 @@ var init_wasi_host = __esm({
5807
5823
  if (!follow3) {
5808
5824
  const slash = path.lastIndexOf("/");
5809
5825
  if (slash <= 0) return void 0;
5810
- const parent = physicalPath(this.o.fs, path.slice(0, slash));
5811
- const resolved3 = `${parent}/${path.slice(slash + 1)}`;
5812
- return resolved3 !== path && this.synthetic(resolved3) ? resolved3 : void 0;
5826
+ const parent = physicalLeaf(this.o.fs, path.slice(0, slash));
5827
+ const resolved3 = parent === void 0 ? void 0 : `${parent}/${path.slice(slash + 1)}`;
5828
+ return resolved3 !== void 0 && resolved3 !== path && this.synthetic(resolved3) ? resolved3 : void 0;
5813
5829
  }
5814
- const resolved2 = physicalPath(this.o.fs, path);
5815
- return resolved2 !== path && this.synthetic(resolved2) ? resolved2 : void 0;
5830
+ const resolved2 = physicalLeaf(this.o.fs, path);
5831
+ return resolved2 !== void 0 && resolved2 !== path && this.synthetic(resolved2) ? resolved2 : void 0;
5816
5832
  } catch {
5817
5833
  return void 0;
5818
5834
  }
@@ -6479,7 +6495,7 @@ var KERNEL_VERSION, OS_RELEASE;
6479
6495
  var init_version = __esm({
6480
6496
  "src/version.ts"() {
6481
6497
  "use strict";
6482
- KERNEL_VERSION = true ? "1.132.0" : "0.0.0-dev";
6498
+ KERNEL_VERSION = true ? "1.132.1" : "0.0.0-dev";
6483
6499
  OS_RELEASE = "6.0.0-slicc";
6484
6500
  }
6485
6501
  });