zen-fs-config 0.7.1 → 0.7.2
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/zen-fs-config.js +0 -55
- package/package.json +3 -3
package/dist/zen-fs-config.js
CHANGED
|
@@ -25487,36 +25487,6 @@ var ZenFSConfig = (() => {
|
|
|
25487
25487
|
await visit(normalizedRoot);
|
|
25488
25488
|
return results;
|
|
25489
25489
|
}
|
|
25490
|
-
async function collectDirectories(fs, root, filter) {
|
|
25491
|
-
const results = [];
|
|
25492
|
-
const normalizedRoot = normalizePath(root);
|
|
25493
|
-
async function visit(dir) {
|
|
25494
|
-
let entries2;
|
|
25495
|
-
try {
|
|
25496
|
-
entries2 = await fs.readdir(dir);
|
|
25497
|
-
} catch {
|
|
25498
|
-
return;
|
|
25499
|
-
}
|
|
25500
|
-
for (const entry of entries2) {
|
|
25501
|
-
if (entry === ".zenfs-sync") continue;
|
|
25502
|
-
const fullPath = resolvePath(dir, entry);
|
|
25503
|
-
let relPath = fullPath.slice(normalizedRoot.length) || "/";
|
|
25504
|
-
if (!relPath.startsWith("/")) relPath = "/" + relPath;
|
|
25505
|
-
let stat5;
|
|
25506
|
-
try {
|
|
25507
|
-
stat5 = await fs.stat(fullPath);
|
|
25508
|
-
} catch {
|
|
25509
|
-
continue;
|
|
25510
|
-
}
|
|
25511
|
-
if (isDirectory(stat5)) {
|
|
25512
|
-
if (isPathAllowed(relPath, filter)) results.push(relPath);
|
|
25513
|
-
await visit(fullPath);
|
|
25514
|
-
}
|
|
25515
|
-
}
|
|
25516
|
-
}
|
|
25517
|
-
await visit(normalizedRoot);
|
|
25518
|
-
return results;
|
|
25519
|
-
}
|
|
25520
25490
|
async function buildSnapshot(fs, root, filter) {
|
|
25521
25491
|
const normalizedRoot = normalizePath(root);
|
|
25522
25492
|
const fsName = fs.backendName || "unknown";
|
|
@@ -26031,7 +26001,6 @@ var ZenFSConfig = (() => {
|
|
|
26031
26001
|
}
|
|
26032
26002
|
}
|
|
26033
26003
|
}
|
|
26034
|
-
await this.preserveDirectories(src, tgt);
|
|
26035
26004
|
return {
|
|
26036
26005
|
pairId: this.pairId,
|
|
26037
26006
|
direction: this.options.direction,
|
|
@@ -26232,8 +26201,6 @@ var ZenFSConfig = (() => {
|
|
|
26232
26201
|
}
|
|
26233
26202
|
}
|
|
26234
26203
|
}
|
|
26235
|
-
await this.preserveDirectories(this.source, this.target);
|
|
26236
|
-
await this.preserveDirectories(this.target, this.source);
|
|
26237
26204
|
const durationMs = Date.now() - startTime;
|
|
26238
26205
|
log3(`[zen-fs-sync] syncBidirectional END pairId=${this.pairId} +${filesCreated}/~${filesUpdated}/-${filesDeleted} ${durationMs}ms`);
|
|
26239
26206
|
return {
|
|
@@ -26263,28 +26230,6 @@ var ZenFSConfig = (() => {
|
|
|
26263
26230
|
}
|
|
26264
26231
|
return buildSnapshot(fs, this.root, this.options.filter);
|
|
26265
26232
|
}
|
|
26266
|
-
/**
|
|
26267
|
-
* Preserve empty directories across backends (zen-fs-sync/docs/SyncableFS.md §2).
|
|
26268
|
-
*
|
|
26269
|
-
* A backend that cannot store empty directories (Git, RemoteStorage) keeps a
|
|
26270
|
-
* directory alive with an internal `.keep` placeholder that is hidden from
|
|
26271
|
-
* callers. Because the sync snapshot is file-based, empty directories are not
|
|
26272
|
-
* represented, so the sync engine must explicitly `mkdir` each source
|
|
26273
|
-
* directory on the target. The target's own `mkdir` then produces its own
|
|
26274
|
-
* (hidden) placeholder. Best-effort: failures are logged, never thrown.
|
|
26275
|
-
*/
|
|
26276
|
-
async preserveDirectories(source, target) {
|
|
26277
|
-
try {
|
|
26278
|
-
const dirs = await collectDirectories(source, this.root, this.options.filter);
|
|
26279
|
-
for (const relDir of dirs) {
|
|
26280
|
-
if (relDir === "/") continue;
|
|
26281
|
-
const fullDir = resolvePath(this.root, relDir);
|
|
26282
|
-
await ensureDir(target, fullDir);
|
|
26283
|
-
}
|
|
26284
|
-
} catch (err2) {
|
|
26285
|
-
log3(`[zen-fs-sync] preserveDirectories FAIL: ${err2}`);
|
|
26286
|
-
}
|
|
26287
|
-
}
|
|
26288
26233
|
/**
|
|
26289
26234
|
* Compare two snapshots for equality (same paths, same size, same mtime).
|
|
26290
26235
|
* Returns true if they are identical, false otherwise.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zen-fs-config",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Distributed config management library built on ZenFS, zen-fs-cache, and zen-fs-sync",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@zenfs/core": ">=2.3.0",
|
|
50
50
|
"@zenfs/dom": ">=1.0.0",
|
|
51
51
|
"zen-fs-cache": ">=1.0.0",
|
|
52
|
-
"zen-fs-sync": ">=0.4.
|
|
52
|
+
"zen-fs-sync": ">=0.4.18",
|
|
53
53
|
"zen-fs-github": "*",
|
|
54
54
|
"zen-fs-gitee": "*",
|
|
55
55
|
"zen-fs-remotestoragejs": "*",
|
|
@@ -85,6 +85,6 @@
|
|
|
85
85
|
"typescript": "^5.9.3",
|
|
86
86
|
"vitest": "^1.6.1",
|
|
87
87
|
"zen-fs-cache": "^1.0.6",
|
|
88
|
-
"zen-fs-sync": "^0.4.
|
|
88
|
+
"zen-fs-sync": "^0.4.18"
|
|
89
89
|
}
|
|
90
90
|
}
|