@poe-platform/safe-fs 0.1.801 → 0.1.802

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.
@@ -937,6 +937,7 @@ export class MemoryFileSystem {
937
937
  }
938
938
  replaceData(node, allocation, length = allocation.data.byteLength) {
939
939
  const previous = node.allocation;
940
+ node.sourceRef = undefined;
940
941
  this.totalBytes += length - node.byteLength;
941
942
  node.byteLength = length;
942
943
  node.view = length === allocation.data.byteLength ? allocation.data : undefined;
@@ -1581,6 +1582,7 @@ export class MemoryFileSystem {
1581
1582
  node.byteLength = length;
1582
1583
  node.view = length === allocation.data.byteLength ? allocation.data : undefined;
1583
1584
  }
1585
+ node.sourceRef = undefined;
1584
1586
  this.changed(node, now);
1585
1587
  }
1586
1588
  writeMemoryFileFast(path, data, append, mode) {
@@ -1832,6 +1834,7 @@ export class MemoryFileSystem {
1832
1834
  const entries = parent.entries;
1833
1835
  const existing = nameHash !== undefined ? entries.getForWriteWithHash(name, nameHash) : entries.getForWrite(name);
1834
1836
  if (existing === undefined && entries._next < entries._keys.length) {
1837
+ this.ledger.reserve(name.length * 2, 2, "writeFile", name);
1835
1838
  const now = fastWriteCachedNow;
1836
1839
  const length = data.byteLength;
1837
1840
  const node = sharedFileNodePool[--sharedFileNodePoolLen];
@@ -1858,7 +1861,6 @@ export class MemoryFileSystem {
1858
1861
  entries._vals[entryIdx] = node;
1859
1862
  entries.size++;
1860
1863
  entries._missKey = "";
1861
- this.ledger.reserve(name.length * 2, 2, "writeFile", name);
1862
1864
  this.totalBytes += length;
1863
1865
  this.mutationTick = (this.mutationTick + 1) | 0;
1864
1866
  parent.revision = parent.revision < 1073741823 ? (parent.revision + 1) | 0 : Math.min(Number.MAX_SAFE_INTEGER + 1, parent.revision + 1);
@@ -3457,6 +3459,9 @@ export function getLastReadMemoryFileSourceRef(view) {
3457
3459
  return ref;
3458
3460
  }
3459
3461
  export function tryReadMemoryFileViewSync(filesystem, path, maxBytes, signal, captureSourceRef = false) {
3462
+ // A capture belongs only to the most recent read, including failed/fallback reads.
3463
+ lastReadViewData = undefined;
3464
+ lastReadViewSourceRef = undefined;
3460
3465
  const mem = filesystem;
3461
3466
  if (mem._owner === undefined || !isStockMemoryMethods(mem, readFileFastMethodNames, false))
3462
3467
  return undefined;
@@ -3472,6 +3477,8 @@ export function tryReadMemoryFileViewSync(filesystem, path, maxBytes, signal, ca
3472
3477
  node.atimeMs = Date.now();
3473
3478
  else if ((++fastWriteNowTick & 63) === 0)
3474
3479
  node.atimeMs = fastWriteCachedNow = Date.now();
3480
+ else
3481
+ node.atimeMs = fastWriteCachedNow;
3475
3482
  if (captureSourceRef && node.revision === 0) {
3476
3483
  lastReadViewData = new WeakRef(data);
3477
3484
  lastReadViewSourceRef = node.sourceRef === undefined ? undefined : new WeakRef(node.sourceRef);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-fs",
3
- "version": "0.1.801",
3
+ "version": "0.1.802",
4
4
  "description": "Composable filesystem with a portable core and explicit Node adapters",
5
5
  "type": "module",
6
6
  "license": "MIT",