poe-code 14.0.37 → 14.0.38

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 (30) hide show
  1. package/dist/metafile.json +1 -1
  2. package/package.json +1 -1
  3. package/packages/safe-bash/dist/browser.js +97 -54
  4. package/packages/safe-bash/dist/browser.js.map +4 -4
  5. package/packages/safe-bash/dist/commands/internal.d.ts +1 -1
  6. package/packages/safe-bash/dist/commands/internal.d.ts.map +1 -1
  7. package/packages/safe-bash/dist/commands/internal.js +18 -25
  8. package/packages/safe-bash/dist/commands/internal.js.map +1 -1
  9. package/packages/safe-bash/dist/commands/record-buffer.d.ts +11 -0
  10. package/packages/safe-bash/dist/commands/record-buffer.d.ts.map +1 -0
  11. package/packages/safe-bash/dist/commands/record-buffer.js +61 -0
  12. package/packages/safe-bash/dist/commands/record-buffer.js.map +1 -0
  13. package/packages/safe-bash/dist/commands/text.d.ts.map +1 -1
  14. package/packages/safe-bash/dist/commands/text.js +23 -37
  15. package/packages/safe-bash/dist/commands/text.js.map +1 -1
  16. package/packages/safe-js/dist/browser/chunks/{chunk-BB4KTS26.js → chunk-CQ4URS56.js} +34 -5
  17. package/packages/safe-js/dist/browser/chunks/{chunk-BB4KTS26.js.map → chunk-CQ4URS56.js.map} +2 -2
  18. package/packages/safe-js/dist/browser/safe-fs-core.js +1 -1
  19. package/packages/safe-js/dist/browser/safe-fs.js +1 -1
  20. package/packages/safe-js/dist/chunks/{chunk-LRWPYBOU.js → chunk-5DYEOCT5.js} +34 -5
  21. package/packages/safe-js/dist/chunks/{chunk-LRWPYBOU.js.map → chunk-5DYEOCT5.js.map} +2 -2
  22. package/packages/safe-js/dist/chunks/{chunk-FOWKJRPH.js → chunk-QXSG4XRW.js} +3 -3
  23. package/packages/safe-js/dist/chunks/{chunk-OXQ2XP74.js → chunk-UXMKEUH3.js} +2 -2
  24. package/packages/safe-js/dist/cli.js +3 -3
  25. package/packages/safe-js/dist/index.js +3 -3
  26. package/packages/safe-js/dist/safe-fs-core.js +1 -1
  27. package/packages/safe-js/dist/safe-fs-node.js +2 -2
  28. package/packages/safe-js/dist/safe-fs.js +2 -2
  29. /package/packages/safe-js/dist/chunks/{chunk-FOWKJRPH.js.map → chunk-QXSG4XRW.js.map} +0 -0
  30. /package/packages/safe-js/dist/chunks/{chunk-OXQ2XP74.js.map → chunk-UXMKEUH3.js.map} +0 -0
@@ -32,7 +32,7 @@ import {
32
32
  toFsError,
33
33
  validatePath,
34
34
  withFileSystemQuota
35
- } from "./chunks/chunk-BB4KTS26.js";
35
+ } from "./chunks/chunk-CQ4URS56.js";
36
36
  export {
37
37
  ACCESS_MODES,
38
38
  FileSystemQuotaError,
@@ -32,7 +32,7 @@ import {
32
32
  toFsError,
33
33
  validatePath,
34
34
  withFileSystemQuota
35
- } from "./chunks/chunk-BB4KTS26.js";
35
+ } from "./chunks/chunk-CQ4URS56.js";
36
36
  export {
37
37
  ACCESS_MODES,
38
38
  FileSystemQuotaError,
@@ -3980,17 +3980,38 @@ var FileSystemQuotaError = class extends Error {
3980
3980
  }
3981
3981
  maxBytes;
3982
3982
  };
3983
- async function usedBytes(fs, options) {
3983
+ async function usedBytes(fs, options, change) {
3984
3984
  let total = 0;
3985
+ let possibleAliases = 0;
3985
3986
  const pending = ["/"];
3986
3987
  while (pending.length) {
3988
+ options?.signal?.throwIfAborted();
3987
3989
  const directory = pending.pop();
3988
3990
  for (const entry of await fs.readdir(directory, options)) {
3991
+ options?.signal?.throwIfAborted();
3989
3992
  const path = `${directory === "/" ? "" : directory}/${entry.name}`;
3990
3993
  if (entry.type === "directory") pending.push(path);
3991
- else total += (await fs.lstat(path, options)).size;
3994
+ else {
3995
+ const stat = await fs.lstat(path, options);
3996
+ total += stat.size;
3997
+ if (!change || stat.type !== "file") continue;
3998
+ const scope = change.stat.identityScope;
3999
+ const comparable = [scope, stat.identityScope].every((value) => typeof value === "symbol" || typeof value === "object" && value !== null) && [change.stat.dev, change.stat.ino, stat.dev, stat.ino].every((value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0);
4000
+ const compare = comparable ? void 0 : fs.compareEntry;
4001
+ const comparison = comparable ? scope === stat.identityScope && change.stat.dev === stat.dev && change.stat.ino === stat.ino ? "same" : "distinct" : compare === void 0 ? "unknown" : await compare.call(fs, change.path, fs, path, options);
4002
+ options?.signal?.throwIfAborted();
4003
+ if (comparison !== "same" && comparison !== "distinct" && comparison !== "unknown") throw new FsError("EIO", { syscall: "compareEntry", path: change.path, dest: path, message: "invalid entry comparison" });
4004
+ if (comparison === "same") {
4005
+ total += change.delta;
4006
+ possibleAliases++;
4007
+ } else if (comparison !== "distinct") {
4008
+ total += Math.max(0, change.delta);
4009
+ possibleAliases++;
4010
+ }
4011
+ }
3992
4012
  }
3993
4013
  }
4014
+ if (change && possibleAliases === 0) total += Math.max(0, change.delta);
3994
4015
  return total;
3995
4016
  }
3996
4017
  async function existingBytes(fs, path, options) {
@@ -4011,8 +4032,16 @@ function withFileSystemQuota(fs, options) {
4011
4032
  return result;
4012
4033
  };
4013
4034
  const assertDelta = async (path, nextBytes, fsOptions) => {
4014
- const current = await existingBytes(fs, path, fsOptions);
4015
- if (await usedBytes(fs, fsOptions) - current + nextBytes > options.maxBytes) throw new FileSystemQuotaError(options.maxBytes);
4035
+ fsOptions?.signal?.throwIfAborted();
4036
+ let current;
4037
+ try {
4038
+ current = await fs.stat(path, fsOptions);
4039
+ } catch (error) {
4040
+ if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) throw error;
4041
+ }
4042
+ const projected = current?.type === "file" && nextBytes > current.size ? await usedBytes(fs, fsOptions, { path, stat: current, delta: nextBytes - current.size }) : await usedBytes(fs, fsOptions) - (current?.type === "directory" ? 0 : current?.size ?? 0) + nextBytes;
4043
+ fsOptions?.signal?.throwIfAborted();
4044
+ if (projected > options.maxBytes) throw new FileSystemQuotaError(options.maxBytes);
4016
4045
  };
4017
4046
  const mutations = {
4018
4047
  writeFile(path, data, writeOptions) {
@@ -4704,4 +4733,4 @@ export {
4704
4733
  withFileSystemQuota,
4705
4734
  FileSystemBridge
4706
4735
  };
4707
- //# sourceMappingURL=chunk-LRWPYBOU.js.map
4736
+ //# sourceMappingURL=chunk-5DYEOCT5.js.map