@componentor/fs 3.0.48 → 3.0.50
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 +32 -9
- package/dist/index.js.map +1 -1
- package/dist/workers/opfs-sync.worker.js +74 -2
- package/dist/workers/opfs-sync.worker.js.map +1 -1
- package/dist/workers/repair.worker.js +32 -9
- package/dist/workers/repair.worker.js.map +1 -1
- package/dist/workers/server.worker.js +32 -9
- package/dist/workers/server.worker.js.map +1 -1
- package/dist/workers/sync-relay.worker.js +32 -9
- package/dist/workers/sync-relay.worker.js.map +1 -1
- package/package.json +1 -1
- package/readme.md +15 -0
package/dist/index.js
CHANGED
|
@@ -4954,6 +4954,7 @@ var VFSEngine = class {
|
|
|
4954
4954
|
this.writeInode(existingIdx, inode);
|
|
4955
4955
|
tInode = this.debug ? performance.now() : 0;
|
|
4956
4956
|
} else {
|
|
4957
|
+
if (this.isImplicitDirectory(path)) return { status: CODE_TO_STATUS.EISDIR };
|
|
4957
4958
|
const mode = DEFAULT_FILE_MODE & ~(this.umask & 511);
|
|
4958
4959
|
this.createInode(path, INODE_TYPE.FILE, mode, data.byteLength, data);
|
|
4959
4960
|
tAlloc = this.debug ? performance.now() : 0;
|
|
@@ -5243,15 +5244,33 @@ var VFSEngine = class {
|
|
|
5243
5244
|
newPath = this.normalizePath(newPath);
|
|
5244
5245
|
const idx = this.pathIndex.get(oldPath);
|
|
5245
5246
|
if (idx === void 0) return { status: CODE_TO_STATUS.ENOENT };
|
|
5247
|
+
if (oldPath === newPath) return { status: 0 };
|
|
5246
5248
|
const parentStatus = this.ensureParent(newPath);
|
|
5247
5249
|
if (parentStatus !== 0) return { status: parentStatus };
|
|
5248
5250
|
const existingIdx = this.pathIndex.get(newPath);
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5251
|
+
const targetIsImplicitDir = existingIdx === void 0 && this.isImplicitDirectory(newPath);
|
|
5252
|
+
if (existingIdx !== void 0 || targetIsImplicitDir) {
|
|
5253
|
+
let cleanDescendants = targetIsImplicitDir;
|
|
5254
|
+
if (existingIdx !== void 0) {
|
|
5255
|
+
const existingInode = this.readInode(existingIdx);
|
|
5256
|
+
cleanDescendants = existingInode.type === INODE_TYPE.DIRECTORY;
|
|
5257
|
+
this.freeBlockRange(existingInode.firstBlock, existingInode.blockCount);
|
|
5258
|
+
existingInode.type = INODE_TYPE.FREE;
|
|
5259
|
+
this.writeInode(existingIdx, existingInode);
|
|
5260
|
+
this.pathIndex.delete(newPath);
|
|
5261
|
+
if (existingIdx < this.freeInodeHint) this.freeInodeHint = existingIdx;
|
|
5262
|
+
}
|
|
5263
|
+
if (cleanDescendants) {
|
|
5264
|
+
for (const desc of this.getAllDescendants(newPath)) {
|
|
5265
|
+
const descIdx = this.pathIndex.get(desc);
|
|
5266
|
+
const descInode = this.readInode(descIdx);
|
|
5267
|
+
this.freeBlockRange(descInode.firstBlock, descInode.blockCount);
|
|
5268
|
+
descInode.type = INODE_TYPE.FREE;
|
|
5269
|
+
this.writeInode(descIdx, descInode);
|
|
5270
|
+
this.pathIndex.delete(desc);
|
|
5271
|
+
if (descIdx < this.freeInodeHint) this.freeInodeHint = descIdx;
|
|
5272
|
+
}
|
|
5273
|
+
}
|
|
5255
5274
|
}
|
|
5256
5275
|
const inode = this.readInode(idx);
|
|
5257
5276
|
const { offset: pathOff, length: pathLen } = this.appendPath(newPath);
|
|
@@ -5355,7 +5374,7 @@ var VFSEngine = class {
|
|
|
5355
5374
|
if (srcIdx === void 0) return { status: CODE_TO_STATUS.ENOENT };
|
|
5356
5375
|
const srcInode = this.readInode(srcIdx);
|
|
5357
5376
|
if (srcInode.type === INODE_TYPE.DIRECTORY) return { status: CODE_TO_STATUS.EISDIR };
|
|
5358
|
-
if (flags & 1 && this.pathIndex.has(destPath)) {
|
|
5377
|
+
if (flags & 1 && (this.pathIndex.has(destPath) || this.isImplicitDirectory(destPath))) {
|
|
5359
5378
|
return { status: CODE_TO_STATUS.EEXIST };
|
|
5360
5379
|
}
|
|
5361
5380
|
if (srcPath === destPath) return { status: 0 };
|
|
@@ -5464,7 +5483,9 @@ var VFSEngine = class {
|
|
|
5464
5483
|
// ---- SYMLINK ----
|
|
5465
5484
|
symlink(target, linkPath) {
|
|
5466
5485
|
linkPath = this.normalizePath(linkPath);
|
|
5467
|
-
if (this.pathIndex.has(linkPath)
|
|
5486
|
+
if (this.pathIndex.has(linkPath) || this.isImplicitDirectory(linkPath)) {
|
|
5487
|
+
return { status: CODE_TO_STATUS.EEXIST };
|
|
5488
|
+
}
|
|
5468
5489
|
const parentStatus = this.ensureParent(linkPath);
|
|
5469
5490
|
if (parentStatus !== 0) return { status: parentStatus };
|
|
5470
5491
|
const targetBytes = encoder10.encode(target);
|
|
@@ -5490,7 +5511,9 @@ var VFSEngine = class {
|
|
|
5490
5511
|
if (srcIdx === void 0) return { status: CODE_TO_STATUS.ENOENT };
|
|
5491
5512
|
const srcInode = this.readInode(srcIdx);
|
|
5492
5513
|
if (srcInode.type === INODE_TYPE.DIRECTORY) return { status: CODE_TO_STATUS.EPERM };
|
|
5493
|
-
if (this.pathIndex.has(newPath)
|
|
5514
|
+
if (this.pathIndex.has(newPath) || this.isImplicitDirectory(newPath)) {
|
|
5515
|
+
return { status: CODE_TO_STATUS.EEXIST };
|
|
5516
|
+
}
|
|
5494
5517
|
const result = this.copy(existingPath, newPath);
|
|
5495
5518
|
if (result.status !== 0) return result;
|
|
5496
5519
|
srcInode.nlink++;
|