@componentor/fs 3.0.22 → 3.0.23
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.
- package/dist/index.js +21 -9
- package/dist/index.js.map +1 -1
- package/dist/workers/opfs-sync.worker.js +23 -8
- package/dist/workers/opfs-sync.worker.js.map +1 -1
- package/dist/workers/repair.worker.js +21 -9
- package/dist/workers/repair.worker.js.map +1 -1
- package/dist/workers/server.worker.js +21 -9
- package/dist/workers/server.worker.js.map +1 -1
- package/dist/workers/sync-relay.worker.js +51 -10
- package/dist/workers/sync-relay.worker.js.map +1 -1
- package/package.json +1 -1
|
@@ -653,6 +653,16 @@ var VFSEngine = class {
|
|
|
653
653
|
}
|
|
654
654
|
/** Resolve symlinks in intermediate path components */
|
|
655
655
|
resolvePathComponents(path, followLast = true, depth = 0) {
|
|
656
|
+
const result = this.resolvePathFull(path, followLast, depth);
|
|
657
|
+
return result?.idx;
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Resolve a path following symlinks, returning both the inode index AND the
|
|
661
|
+
* fully resolved path. This is needed by readdir: when listing a symlinked
|
|
662
|
+
* directory, we must search for children under the resolved target path
|
|
663
|
+
* (where files actually exist in pathIndex), not under the symlink path.
|
|
664
|
+
*/
|
|
665
|
+
resolvePathFull(path, followLast = true, depth = 0) {
|
|
656
666
|
if (depth > MAX_SYMLINK_DEPTH) return void 0;
|
|
657
667
|
const parts = path.split("/").filter(Boolean);
|
|
658
668
|
let current = "/";
|
|
@@ -666,14 +676,16 @@ var VFSEngine = class {
|
|
|
666
676
|
const target = decoder.decode(this.readData(inode.firstBlock, inode.blockCount, inode.size));
|
|
667
677
|
const resolved = target.startsWith("/") ? target : this.resolveRelative(current, target);
|
|
668
678
|
if (isLast) {
|
|
669
|
-
return this.
|
|
679
|
+
return this.resolvePathFull(resolved, true, depth + 1);
|
|
670
680
|
}
|
|
671
681
|
const remaining = parts.slice(i + 1).join("/");
|
|
672
682
|
const newPath = resolved + (remaining ? "/" + remaining : "");
|
|
673
|
-
return this.
|
|
683
|
+
return this.resolvePathFull(newPath, followLast, depth + 1);
|
|
674
684
|
}
|
|
675
685
|
}
|
|
676
|
-
|
|
686
|
+
const finalIdx = this.pathIndex.get(current);
|
|
687
|
+
if (finalIdx === void 0) return void 0;
|
|
688
|
+
return { idx: finalIdx, resolvedPath: current };
|
|
677
689
|
}
|
|
678
690
|
resolveRelative(from, target) {
|
|
679
691
|
const dir = from.substring(0, from.lastIndexOf("/")) || "/";
|
|
@@ -872,10 +884,10 @@ var VFSEngine = class {
|
|
|
872
884
|
if (idx === void 0) return { status: CODE_TO_STATUS.ENOENT, data: null };
|
|
873
885
|
return this.encodeStatResponse(idx);
|
|
874
886
|
}
|
|
875
|
-
// ---- LSTAT (no symlink follow) ----
|
|
887
|
+
// ---- LSTAT (no symlink follow for the FINAL component) ----
|
|
876
888
|
lstat(path) {
|
|
877
889
|
path = this.normalizePath(path);
|
|
878
|
-
const idx = this.
|
|
890
|
+
const idx = this.resolvePathComponents(path, false);
|
|
879
891
|
if (idx === void 0) return { status: CODE_TO_STATUS.ENOENT, data: null };
|
|
880
892
|
return this.encodeStatResponse(idx);
|
|
881
893
|
}
|
|
@@ -962,12 +974,12 @@ var VFSEngine = class {
|
|
|
962
974
|
// ---- READDIR ----
|
|
963
975
|
readdir(path, flags = 0) {
|
|
964
976
|
path = this.normalizePath(path);
|
|
965
|
-
const
|
|
966
|
-
if (
|
|
967
|
-
const inode = this.readInode(idx);
|
|
977
|
+
const resolved = this.resolvePathFull(path, true);
|
|
978
|
+
if (!resolved) return { status: CODE_TO_STATUS.ENOENT, data: null };
|
|
979
|
+
const inode = this.readInode(resolved.idx);
|
|
968
980
|
if (inode.type !== INODE_TYPE.DIRECTORY) return { status: CODE_TO_STATUS.ENOTDIR, data: null };
|
|
969
981
|
const withFileTypes = (flags & 1) !== 0;
|
|
970
|
-
const children = this.getDirectChildren(
|
|
982
|
+
const children = this.getDirectChildren(resolved.resolvedPath);
|
|
971
983
|
if (withFileTypes) {
|
|
972
984
|
let totalSize2 = 4;
|
|
973
985
|
const entries = [];
|
|
@@ -2573,6 +2585,35 @@ async function handleRequestOPFS(reqTabId, buffer) {
|
|
|
2573
2585
|
default:
|
|
2574
2586
|
result = { status: 7 };
|
|
2575
2587
|
}
|
|
2588
|
+
const ENOENT_STATUS = 1;
|
|
2589
|
+
const READ_OPS = [OP.READ, OP.STAT, OP.LSTAT, OP.READDIR, OP.EXISTS, OP.ACCESS, OP.REALPATH, OP.READLINK];
|
|
2590
|
+
if (result.status === ENOENT_STATUS && READ_OPS.includes(op)) {
|
|
2591
|
+
const vfsResult = (() => {
|
|
2592
|
+
switch (op) {
|
|
2593
|
+
case OP.READ:
|
|
2594
|
+
return engine.read(path);
|
|
2595
|
+
case OP.STAT:
|
|
2596
|
+
return engine.stat(path);
|
|
2597
|
+
case OP.LSTAT:
|
|
2598
|
+
return engine.lstat(path);
|
|
2599
|
+
case OP.READDIR:
|
|
2600
|
+
return engine.readdir(path, flags);
|
|
2601
|
+
case OP.EXISTS:
|
|
2602
|
+
return engine.exists(path);
|
|
2603
|
+
case OP.ACCESS:
|
|
2604
|
+
return engine.access(path, flags);
|
|
2605
|
+
case OP.REALPATH:
|
|
2606
|
+
return engine.realpath(path);
|
|
2607
|
+
case OP.READLINK:
|
|
2608
|
+
return engine.readlink(path);
|
|
2609
|
+
default:
|
|
2610
|
+
return null;
|
|
2611
|
+
}
|
|
2612
|
+
})();
|
|
2613
|
+
if (vfsResult && vfsResult.status !== ENOENT_STATUS) {
|
|
2614
|
+
result = vfsResult;
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2576
2617
|
const ret = {
|
|
2577
2618
|
status: result.status,
|
|
2578
2619
|
data: result.data instanceof Uint8Array ? result.data : void 0
|
|
@@ -3218,4 +3259,4 @@ self.onmessage = async (e) => {
|
|
|
3218
3259
|
return;
|
|
3219
3260
|
}
|
|
3220
3261
|
};
|
|
3221
|
-
//# sourceMappingURL=sync-relay.worker.js.map
|
|
3262
|
+
//# sourceMappingURL=sync-relay.worker.js.map// FORCE_CACHE_BUST_1775761372
|