poe-code 14.0.36 → 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 (34) hide show
  1. package/dist/metafile.json +1 -1
  2. package/package.json +1 -1
  3. package/packages/safe-bash/dist/browser.js +131 -65
  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/sort-admission.d.ts +6 -0
  14. package/packages/safe-bash/dist/commands/sort-admission.d.ts.map +1 -0
  15. package/packages/safe-bash/dist/commands/sort-admission.js +16 -0
  16. package/packages/safe-bash/dist/commands/sort-admission.js.map +1 -0
  17. package/packages/safe-bash/dist/commands/text.d.ts.map +1 -1
  18. package/packages/safe-bash/dist/commands/text.js +41 -49
  19. package/packages/safe-bash/dist/commands/text.js.map +1 -1
  20. package/packages/safe-js/dist/browser/chunks/{chunk-BB4KTS26.js → chunk-CQ4URS56.js} +34 -5
  21. package/packages/safe-js/dist/browser/chunks/{chunk-BB4KTS26.js.map → chunk-CQ4URS56.js.map} +2 -2
  22. package/packages/safe-js/dist/browser/safe-fs-core.js +1 -1
  23. package/packages/safe-js/dist/browser/safe-fs.js +1 -1
  24. package/packages/safe-js/dist/chunks/{chunk-LRWPYBOU.js → chunk-5DYEOCT5.js} +34 -5
  25. package/packages/safe-js/dist/chunks/{chunk-LRWPYBOU.js.map → chunk-5DYEOCT5.js.map} +2 -2
  26. package/packages/safe-js/dist/chunks/{chunk-FOWKJRPH.js → chunk-QXSG4XRW.js} +3 -3
  27. package/packages/safe-js/dist/chunks/{chunk-OXQ2XP74.js → chunk-UXMKEUH3.js} +2 -2
  28. package/packages/safe-js/dist/cli.js +3 -3
  29. package/packages/safe-js/dist/index.js +3 -3
  30. package/packages/safe-js/dist/safe-fs-core.js +1 -1
  31. package/packages/safe-js/dist/safe-fs-node.js +2 -2
  32. package/packages/safe-js/dist/safe-fs.js +2 -2
  33. /package/packages/safe-js/dist/chunks/{chunk-FOWKJRPH.js.map → chunk-QXSG4XRW.js.map} +0 -0
  34. /package/packages/safe-js/dist/chunks/{chunk-OXQ2XP74.js.map → chunk-UXMKEUH3.js.map} +0 -0
@@ -2597,17 +2597,38 @@ var FileSystemQuotaError = class extends Error {
2597
2597
  }
2598
2598
  maxBytes;
2599
2599
  };
2600
- async function usedBytes(fs, options) {
2600
+ async function usedBytes(fs, options, change) {
2601
2601
  let total = 0;
2602
+ let possibleAliases = 0;
2602
2603
  const pending = ["/"];
2603
2604
  while (pending.length) {
2605
+ options?.signal?.throwIfAborted();
2604
2606
  const directory = pending.pop();
2605
2607
  for (const entry of await fs.readdir(directory, options)) {
2608
+ options?.signal?.throwIfAborted();
2606
2609
  const path = `${directory === "/" ? "" : directory}/${entry.name}`;
2607
2610
  if (entry.type === "directory") pending.push(path);
2608
- else total += (await fs.lstat(path, options)).size;
2611
+ else {
2612
+ const stat = await fs.lstat(path, options);
2613
+ total += stat.size;
2614
+ if (!change || stat.type !== "file") continue;
2615
+ const scope = change.stat.identityScope;
2616
+ 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);
2617
+ const compare = comparable ? void 0 : fs.compareEntry;
2618
+ 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);
2619
+ options?.signal?.throwIfAborted();
2620
+ if (comparison !== "same" && comparison !== "distinct" && comparison !== "unknown") throw new FsError("EIO", { syscall: "compareEntry", path: change.path, dest: path, message: "invalid entry comparison" });
2621
+ if (comparison === "same") {
2622
+ total += change.delta;
2623
+ possibleAliases++;
2624
+ } else if (comparison !== "distinct") {
2625
+ total += Math.max(0, change.delta);
2626
+ possibleAliases++;
2627
+ }
2628
+ }
2609
2629
  }
2610
2630
  }
2631
+ if (change && possibleAliases === 0) total += Math.max(0, change.delta);
2611
2632
  return total;
2612
2633
  }
2613
2634
  async function existingBytes(fs, path, options) {
@@ -2628,8 +2649,16 @@ function withFileSystemQuota(fs, options) {
2628
2649
  return result;
2629
2650
  };
2630
2651
  const assertDelta = async (path, nextBytes, fsOptions) => {
2631
- const current = await existingBytes(fs, path, fsOptions);
2632
- if (await usedBytes(fs, fsOptions) - current + nextBytes > options.maxBytes) throw new FileSystemQuotaError(options.maxBytes);
2652
+ fsOptions?.signal?.throwIfAborted();
2653
+ let current;
2654
+ try {
2655
+ current = await fs.stat(path, fsOptions);
2656
+ } catch (error) {
2657
+ if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) throw error;
2658
+ }
2659
+ 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;
2660
+ fsOptions?.signal?.throwIfAborted();
2661
+ if (projected > options.maxBytes) throw new FileSystemQuotaError(options.maxBytes);
2633
2662
  };
2634
2663
  const mutations = {
2635
2664
  writeFile(path, data, writeOptions) {
@@ -4722,4 +4751,4 @@ export {
4722
4751
  WebDavFileSystem,
4723
4752
  createFsBridge
4724
4753
  };
4725
- //# sourceMappingURL=chunk-BB4KTS26.js.map
4754
+ //# sourceMappingURL=chunk-CQ4URS56.js.map