@catmint-fs/core 0.0.0-prealpha.2 → 0.0.0-prealpha.4

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.
Files changed (2) hide show
  1. package/dist/index.js +9 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -461,7 +461,11 @@ var Layer = class {
461
461
  */
462
462
  resolvePath(p) {
463
463
  const base = this.root.endsWith("/") ? this.root.slice(0, -1) : this.root;
464
- const virtual = p.startsWith("/") ? p : "/" + p;
464
+ let virtual = p.startsWith("/") ? p : "/" + p;
465
+ if (virtual.length > 1 && virtual.endsWith("/")) {
466
+ virtual = virtual.slice(0, -1);
467
+ }
468
+ virtual = virtual.replace(/\/\/+/g, "/");
465
469
  if (virtual === "/") return base || "/";
466
470
  return base + virtual;
467
471
  }
@@ -1530,12 +1534,12 @@ var Layer = class {
1530
1534
  async applyOne(detail) {
1531
1535
  switch (detail.type) {
1532
1536
  case "create": {
1537
+ const ownerOpts = (d) => d.uid || d.gid ? { uid: d.uid, gid: d.gid } : {};
1533
1538
  if (detail.entryType === "directory") {
1534
1539
  await this.adapter.mkdir(detail.path, {
1535
1540
  recursive: true,
1536
1541
  mode: detail.mode,
1537
- uid: detail.uid,
1538
- gid: detail.gid
1542
+ ...ownerOpts(detail)
1539
1543
  });
1540
1544
  } else {
1541
1545
  await this.adapter.writeFile(
@@ -1543,8 +1547,7 @@ var Layer = class {
1543
1547
  detail.content,
1544
1548
  {
1545
1549
  mode: detail.mode,
1546
- uid: detail.uid,
1547
- gid: detail.gid
1550
+ ...ownerOpts(detail)
1548
1551
  }
1549
1552
  );
1550
1553
  }
@@ -1556,8 +1559,7 @@ var Layer = class {
1556
1559
  detail.content,
1557
1560
  {
1558
1561
  mode: detail.mode,
1559
- uid: detail.uid,
1560
- gid: detail.gid
1562
+ ...detail.uid || detail.gid ? { uid: detail.uid, gid: detail.gid } : {}
1561
1563
  }
1562
1564
  );
1563
1565
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@catmint-fs/core",
3
- "version": "0.0.0-prealpha.2",
3
+ "version": "0.0.0-prealpha.4",
4
4
  "description": "Virtual filesystem layer with copy-on-write semantics over a pluggable backing store",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",