@poe-platform/safe-bash 0.1.658 → 0.1.660

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.
@@ -99,7 +99,7 @@ init_platform();
99
99
  // packages/safe-js/dist/browser/safe-fs.js
100
100
  init_platform();
101
101
 
102
- // packages/safe-js/dist/browser/chunks/chunk-EKRTCQ5Y.js
102
+ // packages/safe-js/dist/browser/chunks/chunk-VUCZTCHV.js
103
103
  init_platform();
104
104
  var platform = Object.freeze({
105
105
  errno(_code) {
@@ -970,6 +970,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
970
970
  atomicFileStaging: true,
971
971
  atomicFileMutation: true,
972
972
  atomicEntryRemoval: true,
973
+ atomicTreeRemoval: true,
973
974
  atomicDirectoryMetadata: true,
974
975
  streamingRead: true,
975
976
  retainedRead: true,
@@ -1535,6 +1536,14 @@ var MemoryFileSystem = class _MemoryFileSystem {
1535
1536
  this.releaseNode(node);
1536
1537
  this.changed(location.parent);
1537
1538
  }
1539
+ async removeTreeConditional(path, options) {
1540
+ options.signal?.throwIfAborted();
1541
+ const location = this.entry(path, "removeTreeConditional", true);
1542
+ this.expectEntry(location.parent, options.parent, path, false);
1543
+ this.expectEntry(location.node, options.expected, path, false);
1544
+ if (location.node?.type !== "directory") this.fail("ENOTDIR", "removeTreeConditional", path);
1545
+ this.removeLocation(location, path, "removeTreeConditional", true);
1546
+ }
1538
1547
  async writeFile(path, data, options = {}) {
1539
1548
  options.signal?.throwIfAborted();
1540
1549
  this.writeData(path, data, options, "writeFile");
@@ -1602,16 +1611,19 @@ var MemoryFileSystem = class _MemoryFileSystem {
1602
1611
  if (options.force && error instanceof FsError && error.code === "ENOENT") return;
1603
1612
  throw error;
1604
1613
  }
1614
+ this.removeLocation(location, path, "rm", options.recursive === true);
1615
+ }
1616
+ removeLocation(location, path, syscall, recursive) {
1605
1617
  const node = location.node;
1606
- if (this.terminalDot(path)) this.fail("EINVAL", "rm", path);
1607
- if (node === this.root) this.fail("EBUSY", "rm", path);
1608
- this.permission(location.parent, 3, "rm", path);
1609
- if (node.type === "directory" && !options.recursive) this.fail("EISDIR", "rm", path);
1618
+ if (this.terminalDot(path)) this.fail("EINVAL", syscall, path);
1619
+ if (node === this.root) this.fail("EBUSY", syscall, path);
1620
+ this.permission(location.parent, 3, syscall, path);
1621
+ if (node.type === "directory" && !recursive) this.fail("EISDIR", syscall, path);
1610
1622
  const removed = [node];
1611
1623
  for (let index = 0; index < removed.length; index++) {
1612
1624
  const entry = removed[index];
1613
1625
  if (entry.type === "directory" && entry.entries.size > 0) {
1614
- this.permission(entry, 7, "rm", path);
1626
+ this.permission(entry, 7, syscall, path);
1615
1627
  for (const child of entry.entries.values()) removed.push(child);
1616
1628
  }
1617
1629
  }
@@ -2048,6 +2060,7 @@ var deviceCapabilities = Object.freeze({
2048
2060
  open: false,
2049
2061
  atomicFileMutation: false,
2050
2062
  atomicEntryRemoval: false,
2063
+ atomicTreeRemoval: false,
2051
2064
  atomicFileStaging: false,
2052
2065
  atomicDirectoryMetadata: false,
2053
2066
  atomicRename: false,
@@ -4282,4 +4295,4 @@ export {
4282
4295
  safeJsNodeCommands,
4283
4296
  createSafeJsNodeCommand
4284
4297
  };
4285
- //# sourceMappingURL=chunk-EYC5LGC7.js.map
4298
+ //# sourceMappingURL=chunk-STBTGG6M.js.map