poe-code 14.0.95 → 14.0.96

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 (39) hide show
  1. package/dist/metafile.json +1 -1
  2. package/package.json +1 -1
  3. package/packages/safe-bash/dist/commands/filesystem-requirements.d.ts.map +1 -1
  4. package/packages/safe-bash/dist/commands/filesystem-requirements.js +1 -0
  5. package/packages/safe-bash/dist/commands/filesystem-requirements.js.map +1 -1
  6. package/packages/safe-bash/dist/commands/filesystem.d.ts.map +1 -1
  7. package/packages/safe-bash/dist/commands/filesystem.js +29 -1
  8. package/packages/safe-bash/dist/commands/filesystem.js.map +1 -1
  9. package/packages/safe-bash/dist/contracts/filesystem.d.ts +1 -1
  10. package/packages/safe-bash/dist/contracts/filesystem.d.ts.map +1 -1
  11. package/packages/safe-bash/dist/core.browser.js +34 -2
  12. package/packages/safe-bash/dist/core.browser.js.map +2 -2
  13. package/packages/safe-fs/dist/contracts/filesystem.d.ts +5 -1
  14. package/packages/safe-fs/dist/fs/devices/index.d.ts +2 -2
  15. package/packages/safe-fs/dist/fs/memory/index.d.ts +3 -2
  16. package/packages/safe-fs/dist/fs/mount/index.d.ts +2 -2
  17. package/packages/safe-fs/dist/fs/overlay/index.d.ts +2 -2
  18. package/packages/safe-fs/dist/fs/readonly/index.d.ts +2 -2
  19. package/packages/safe-fs/dist/fs/real/index.d.ts +2 -2
  20. package/packages/safe-fs/dist/fs/s3/filesystem.d.ts +3 -2
  21. package/packages/safe-fs/dist/fs/webdav/webdav.d.ts +3 -2
  22. package/packages/safe-js/dist/browser/chunks/{chunk-YJ7IIV57.js → chunk-QK4IEGRO.js} +44 -2
  23. package/packages/safe-js/dist/browser/chunks/chunk-QK4IEGRO.js.map +7 -0
  24. package/packages/safe-js/dist/browser/safe-fs-core.js +1 -1
  25. package/packages/safe-js/dist/browser/safe-fs.js +1 -1
  26. package/packages/safe-js/dist/chunks/{chunk-3HQSRMV6.js → chunk-6V4U2JZS.js} +44 -2
  27. package/packages/safe-js/dist/chunks/chunk-6V4U2JZS.js.map +7 -0
  28. package/packages/safe-js/dist/chunks/{chunk-NZIVWYYY.js → chunk-EZRL4ES2.js} +3 -3
  29. package/packages/safe-js/dist/chunks/{chunk-5JIIALYB.js → chunk-XOQ5CVQM.js} +9 -2
  30. package/packages/safe-js/dist/chunks/chunk-XOQ5CVQM.js.map +7 -0
  31. package/packages/safe-js/dist/cli.js +3 -3
  32. package/packages/safe-js/dist/index.js +3 -3
  33. package/packages/safe-js/dist/safe-fs-core.js +1 -1
  34. package/packages/safe-js/dist/safe-fs-node.js +2 -2
  35. package/packages/safe-js/dist/safe-fs.js +2 -2
  36. package/packages/safe-js/dist/browser/chunks/chunk-YJ7IIV57.js.map +0 -7
  37. package/packages/safe-js/dist/chunks/chunk-3HQSRMV6.js.map +0 -7
  38. package/packages/safe-js/dist/chunks/chunk-5JIIALYB.js.map +0 -7
  39. /package/packages/safe-js/dist/chunks/{chunk-NZIVWYYY.js.map → chunk-EZRL4ES2.js.map} +0 -0
@@ -36,7 +36,7 @@ import {
36
36
  toFsError,
37
37
  validatePath,
38
38
  withFileSystemQuota
39
- } from "./chunks/chunk-YJ7IIV57.js";
39
+ } from "./chunks/chunk-QK4IEGRO.js";
40
40
  export {
41
41
  ACCESS_MODES,
42
42
  DeviceFileSystem,
@@ -36,7 +36,7 @@ import {
36
36
  toFsError,
37
37
  validatePath,
38
38
  withFileSystemQuota
39
- } from "./chunks/chunk-YJ7IIV57.js";
39
+ } from "./chunks/chunk-QK4IEGRO.js";
40
40
  export {
41
41
  ACCESS_MODES,
42
42
  DeviceFileSystem,
@@ -807,6 +807,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
807
807
  removeDirectory: true,
808
808
  recursiveRemove: true,
809
809
  rename: true,
810
+ atomicRenameNoReplace: true,
810
811
  copy: true,
811
812
  exclusiveCopy: true,
812
813
  readlink: true,
@@ -1231,6 +1232,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
1231
1232
  if (this.terminalDot(source) || this.terminalDot(destination)) this.fail("EINVAL", "rename", source, destination);
1232
1233
  if (node === this.root || target.node === this.root) this.fail("EBUSY", "rename", source, destination);
1233
1234
  if (destination.endsWith("/") && node.type !== "directory") this.fail("ENOTDIR", "rename", source, destination);
1235
+ if (options.noReplace && target.node) this.fail("EEXIST", "rename", source, destination);
1234
1236
  if (target.node === node) return;
1235
1237
  if (node.type === "directory" && target.path.startsWith(`${origin.path}/`)) this.fail("EINVAL", "rename", source, destination);
1236
1238
  this.permission(origin.parent, 3, "rename", source);
@@ -1733,6 +1735,7 @@ var deviceCapabilities = Object.freeze({
1733
1735
  truncate: false,
1734
1736
  randomAccessWrite: false,
1735
1737
  atomicRename: false,
1738
+ atomicRenameNoReplace: false,
1736
1739
  descriptorWriteStream: true
1737
1740
  });
1738
1741
  function globalCapabilities(filesystem) {
@@ -2007,6 +2010,11 @@ var DeviceFileSystem = class {
2007
2010
  async rename(source, destination, options = {}) {
2008
2011
  await this.#mutable(source, options, false);
2009
2012
  await this.#mutable(destination, options, false);
2013
+ if (options.noReplace) {
2014
+ const capabilities = await this.#filesystem.capabilitiesFor?.(destination, options) ?? this.#filesystem.capabilities;
2015
+ options.signal?.throwIfAborted();
2016
+ if (capabilities.atomicRenameNoReplace !== true) throw new FsError("ENOTSUP", { syscall: "rename", path: source, dest: destination });
2017
+ }
2010
2018
  await this.#filesystem.rename(source, destination, options);
2011
2019
  }
2012
2020
  async copyFile(source, destination, options = {}) {
@@ -2452,6 +2460,7 @@ var WebDavFileSystem = class {
2452
2460
  remove: true,
2453
2461
  recursiveRemove: true,
2454
2462
  rename: true,
2463
+ atomicRenameNoReplace: false,
2455
2464
  copy: true,
2456
2465
  exclusiveCopy: true,
2457
2466
  readlink: false,
@@ -3390,6 +3399,10 @@ var WebDavFileSystem = class {
3390
3399
  }
3391
3400
  }
3392
3401
  async rename(source, destination, options = {}) {
3402
+ if (options.noReplace) {
3403
+ options.signal?.throwIfAborted();
3404
+ fail("ENOTSUP", "rename", source, "atomic no-replace rename is unsupported");
3405
+ }
3393
3406
  await this.transfer("MOVE", source, destination, options);
3394
3407
  }
3395
3408
  async copyFile(source, destination, options = {}) {
@@ -3526,6 +3539,7 @@ function readOnlyCapabilities(capabilities) {
3526
3539
  timestamps: false,
3527
3540
  descriptorWriteStream: false,
3528
3541
  atomicRename: false,
3542
+ atomicRenameNoReplace: false,
3529
3543
  streamingWrite: false
3530
3544
  });
3531
3545
  }
@@ -3781,7 +3795,7 @@ var MountFileSystem = class _MountFileSystem {
3781
3795
  if (capability === "descriptorWriteStream" && backend.capabilities.streamingWrite === false) return false;
3782
3796
  return declared === true && optional[capability]?.some((method) => typeof backend[method] !== "function") ? false : declared;
3783
3797
  });
3784
- if (["rename", "copy", "exclusiveCopy"].includes(capability) && mounts.length > 1) return void 0;
3798
+ if (["rename", "atomicRenameNoReplace", "copy", "exclusiveCopy"].includes(capability) && mounts.length > 1) return void 0;
3785
3799
  return values.every((value) => value === true) ? true : values.every((value) => value === false) ? false : void 0;
3786
3800
  };
3787
3801
  const semantics = Object.fromEntries([
@@ -3801,6 +3815,7 @@ var MountFileSystem = class _MountFileSystem {
3801
3815
  "removeDirectory",
3802
3816
  "recursiveRemove",
3803
3817
  "rename",
3818
+ "atomicRenameNoReplace",
3804
3819
  "copy",
3805
3820
  "exclusiveCopy",
3806
3821
  "readlink",
@@ -4114,6 +4129,11 @@ var MountFileSystem = class _MountFileSystem {
4114
4129
  this.mutable(target);
4115
4130
  this.entryPath(source);
4116
4131
  this.entryPath(destination);
4132
+ if (options.noReplace) {
4133
+ const capabilities = await target.mount.backend.capabilitiesFor?.(target.local, options) ?? target.mount.backend.capabilities;
4134
+ options.signal?.throwIfAborted();
4135
+ if (capabilities.atomicRenameNoReplace !== true) fail2("ENOTSUP");
4136
+ }
4117
4137
  await origin.mount.backend.rename(origin.local, target.local, options);
4118
4138
  }, destination);
4119
4139
  }
@@ -4377,6 +4397,7 @@ var OverlayFileSystem = class {
4377
4397
  ...upper.readOnly === void 0 ? {} : { readOnly: upper.readOnly },
4378
4398
  ...effectiveAppend === void 0 ? {} : { append: effectiveAppend },
4379
4399
  atomicRename: false,
4400
+ atomicRenameNoReplace: false,
4380
4401
  descriptorWriteStream: false,
4381
4402
  hardlinks: false,
4382
4403
  symlinks: writable && this.#upper.capabilities.symlinks === true && typeof this.#upper.symlink === "function" && typeof this.#upper.readlink === "function" && (this.#lower.capabilities.symlinks !== true || typeof this.#lower.readlink === "function"),
@@ -4883,6 +4904,7 @@ var OverlayFileSystem = class {
4883
4904
  }
4884
4905
  async rename(source, destination, options = {}) {
4885
4906
  return this.run(options, async () => {
4907
+ if (options.noReplace) fail3("ENOTSUP", source, "atomic no-replace rename is unsupported");
4886
4908
  this.writable(source);
4887
4909
  const original = await this.required(source, options, false);
4888
4910
  const target = await this.resolve(destination, options, false, true);
@@ -5210,6 +5232,15 @@ function withFileSystemQuota(fs, options) {
5210
5232
  await fs.appendFile(path, data, appendOptions);
5211
5233
  });
5212
5234
  },
5235
+ async rename(source, destination, renameOptions) {
5236
+ if (renameOptions?.noReplace) {
5237
+ renameOptions.signal?.throwIfAborted();
5238
+ const capabilities = await fs.capabilitiesFor?.(destination, renameOptions) ?? fs.capabilities;
5239
+ renameOptions?.signal?.throwIfAborted();
5240
+ if (capabilities.atomicRenameNoReplace !== true) throw new FsError("ENOTSUP", { syscall: "rename", path: source, dest: destination });
5241
+ }
5242
+ await fs.rename(source, destination, renameOptions);
5243
+ },
5213
5244
  copyFile(source, destination, copyOptions) {
5214
5245
  return mutate(async () => {
5215
5246
  await assertDelta(destination, (await fs.stat(source, copyOptions)).size, copyOptions);
@@ -5365,6 +5396,17 @@ function scopeFileSystem(filesystem, charge, signal) {
5365
5396
  const peer = args[1];
5366
5397
  args[1] = originals.get(peer) ?? peer;
5367
5398
  }
5399
+ if (property === "rename" && args[2]?.noReplace) return (async () => {
5400
+ const options = args[2];
5401
+ const capabilities = await original.capabilitiesFor?.(args[1], options) ?? original.capabilities;
5402
+ assertOpen(options);
5403
+ if (capabilities.atomicRenameNoReplace !== true) throw new FsError("ENOTSUP", {
5404
+ syscall: "rename",
5405
+ path: args[0],
5406
+ dest: args[1]
5407
+ });
5408
+ return Reflect.apply(method, original, args);
5409
+ })();
5368
5410
  return Reflect.apply(method, original, args);
5369
5411
  };
5370
5412
  const scoped = property === "openReadFile" ? async (...args) => wrapHandle(await dispatch(...args)) : property === "readStream" ? (...args) => wrapStream(dispatch(...args), args[1]) : operations.has(property) && property !== "canonicalizeMissingTarget" ? async (...args) => dispatch(...args) : dispatch;
@@ -6016,4 +6058,4 @@ export {
6016
6058
  scopeFileSystem,
6017
6059
  FileSystemBridge
6018
6060
  };
6019
- //# sourceMappingURL=chunk-3HQSRMV6.js.map
6061
+ //# sourceMappingURL=chunk-6V4U2JZS.js.map