zen-fs-config 0.11.3 → 0.11.5
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/{backend-registry-R6L6MFJS.mjs → backend-registry-F7RJCILX.mjs} +1 -1
- package/dist/backends/gitee.mjs +1 -1
- package/dist/backends/github.mjs +1 -1
- package/dist/backends/remotestorage.mjs +1 -1
- package/dist/backends/webdav.mjs +1 -1
- package/dist/{chunk-7QFHGFCG.mjs → chunk-VUFW6U3A.mjs} +102 -2
- package/dist/index.d.mts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +134 -10
- package/dist/index.mjs +21 -4
- package/dist/zen-fs-config.js +134 -10
- package/package.json +1 -1
package/dist/backends/gitee.mjs
CHANGED
package/dist/backends/github.mjs
CHANGED
package/dist/backends/webdav.mjs
CHANGED
|
@@ -260,6 +260,88 @@ function withAllocId(base) {
|
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
+
// src/write-trace.ts
|
|
264
|
+
var WTRACE_KEY = "debug:wtrace";
|
|
265
|
+
var WTRACE_TAG_KEY = "debug:wtrace:tag";
|
|
266
|
+
var WTRACE_ENV = "DEBUG_WTRACE";
|
|
267
|
+
var cachedTag = null;
|
|
268
|
+
function readLocalStorage(key) {
|
|
269
|
+
try {
|
|
270
|
+
const ls = globalThis?.localStorage;
|
|
271
|
+
if (ls && typeof ls.getItem === "function") return ls.getItem(key);
|
|
272
|
+
} catch {
|
|
273
|
+
}
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
function readEnv() {
|
|
277
|
+
try {
|
|
278
|
+
const env = globalThis?.process?.env;
|
|
279
|
+
if (env && typeof env[WTRACE_ENV] === "string") return env[WTRACE_ENV];
|
|
280
|
+
} catch {
|
|
281
|
+
}
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
function watchPatterns() {
|
|
285
|
+
const raw = readLocalStorage(WTRACE_KEY) ?? readEnv();
|
|
286
|
+
if (!raw) return [];
|
|
287
|
+
const value = String(raw).trim();
|
|
288
|
+
if (!value || value === "0") return [];
|
|
289
|
+
if (value === "1" || value === "*" || value.toLowerCase() === "all") return ["*"];
|
|
290
|
+
return value.split(",").map((s) => s.trim()).filter(Boolean);
|
|
291
|
+
}
|
|
292
|
+
function getWriteTraceTag() {
|
|
293
|
+
const configured = (readLocalStorage(WTRACE_TAG_KEY) ?? "").trim();
|
|
294
|
+
if (configured) return configured;
|
|
295
|
+
if (cachedTag === null) cachedTag = Math.random().toString(36).slice(2, 6);
|
|
296
|
+
return cachedTag;
|
|
297
|
+
}
|
|
298
|
+
function fnv1a(bytes) {
|
|
299
|
+
let hash = 2166136261;
|
|
300
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
301
|
+
hash ^= bytes[i];
|
|
302
|
+
hash = Math.imul(hash, 16777619) >>> 0;
|
|
303
|
+
}
|
|
304
|
+
return hash.toString(16).padStart(8, "0");
|
|
305
|
+
}
|
|
306
|
+
function toBytes(data) {
|
|
307
|
+
if (data instanceof Uint8Array) return data;
|
|
308
|
+
if (data instanceof ArrayBuffer) return new Uint8Array(data);
|
|
309
|
+
if (typeof data === "string") return new TextEncoder().encode(data);
|
|
310
|
+
try {
|
|
311
|
+
return new Uint8Array(data);
|
|
312
|
+
} catch {
|
|
313
|
+
return new Uint8Array(0);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
function fmtTime(ms) {
|
|
317
|
+
if (ms === void 0 || !Number.isFinite(ms)) {
|
|
318
|
+
const now = Date.now();
|
|
319
|
+
return `none->now(${now}@${new Date(now).toISOString()})`;
|
|
320
|
+
}
|
|
321
|
+
return `${ms}@${new Date(ms).toISOString()}`;
|
|
322
|
+
}
|
|
323
|
+
function callerFrames() {
|
|
324
|
+
try {
|
|
325
|
+
const stack = new Error().stack;
|
|
326
|
+
if (!stack) return "";
|
|
327
|
+
return stack.split("\n").slice(2, 5).map((line) => line.trim().replace(/^at\s+/, "")).filter(Boolean).join(" <- ").slice(0, 240);
|
|
328
|
+
} catch {
|
|
329
|
+
return "";
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
function traceWrite(backend, op, path, data, mtime) {
|
|
333
|
+
const patterns = watchPatterns();
|
|
334
|
+
if (patterns.length === 0) return;
|
|
335
|
+
if (!patterns.some((p) => p === "*" || path.includes(p))) return;
|
|
336
|
+
const bytes = toBytes(data);
|
|
337
|
+
const frames = callerFrames();
|
|
338
|
+
const line = `tag=${getWriteTraceTag()} backend=${backend} op=${op} path=${path} bytes=${bytes.byteLength} fnv=${fnv1a(bytes)} mtime=${fmtTime(mtime)}` + (frames ? ` at=${frames}` : "");
|
|
339
|
+
try {
|
|
340
|
+
console.log(`[wtrace] ${line}`);
|
|
341
|
+
} catch {
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
263
345
|
// src/backend-registry.ts
|
|
264
346
|
var registry = /* @__PURE__ */ new Map();
|
|
265
347
|
var metadataRegistry = /* @__PURE__ */ new Map();
|
|
@@ -354,9 +436,23 @@ function stripAccountFields(type, options) {
|
|
|
354
436
|
}
|
|
355
437
|
return stripped ?? source;
|
|
356
438
|
}
|
|
357
|
-
async function wrapZenFSFileSystem(config) {
|
|
439
|
+
async function wrapZenFSFileSystem(config, label) {
|
|
358
440
|
const zenfs = await import("@zenfs/core");
|
|
359
441
|
const isolatedFS = await zenfs.resolveMountConfig(config);
|
|
442
|
+
const backendLabel = (() => {
|
|
443
|
+
if (label) return label;
|
|
444
|
+
const c = config ?? {};
|
|
445
|
+
const hints = [
|
|
446
|
+
c.owner && c.repo ? `${c.owner}/${c.repo}` : null,
|
|
447
|
+
c.storeName,
|
|
448
|
+
c.label,
|
|
449
|
+
c.name
|
|
450
|
+
];
|
|
451
|
+
for (const hint of hints) {
|
|
452
|
+
if (typeof hint === "string" && hint.trim()) return hint.trim();
|
|
453
|
+
}
|
|
454
|
+
return "backend";
|
|
455
|
+
})();
|
|
360
456
|
let changeCallback = null;
|
|
361
457
|
const notifyChange = () => {
|
|
362
458
|
if (changeCallback) changeCallback();
|
|
@@ -387,6 +483,7 @@ async function wrapZenFSFileSystem(config) {
|
|
|
387
483
|
async writeFile(path, data, _options) {
|
|
388
484
|
const source = data instanceof ArrayBuffer ? new Uint8Array(data) : data instanceof Uint8Array ? data : new TextEncoder().encode(data);
|
|
389
485
|
const bytes = new Uint8Array(source);
|
|
486
|
+
traceWrite(backendLabel, "writeFile", path, bytes, _options?.mtime);
|
|
390
487
|
await runExclusive(path, async () => {
|
|
391
488
|
const parts = path.split("/").filter(Boolean);
|
|
392
489
|
parts.pop();
|
|
@@ -445,7 +542,10 @@ async function wrapZenFSFileSystem(config) {
|
|
|
445
542
|
backend.createSnapshot = (root, filter) => isolatedFS.createSnapshot(root, filter);
|
|
446
543
|
}
|
|
447
544
|
if (typeof isolatedFS.writeFileWithMtime === "function") {
|
|
448
|
-
backend.writeFileWithMtime = (path, data, mtimeMs) =>
|
|
545
|
+
backend.writeFileWithMtime = (path, data, mtimeMs) => {
|
|
546
|
+
traceWrite(backendLabel, "writeFileWithMtime", path, data, mtimeMs);
|
|
547
|
+
return isolatedFS.writeFileWithMtime(path, data, mtimeMs);
|
|
548
|
+
};
|
|
449
549
|
}
|
|
450
550
|
if (typeof isolatedFS.shouldSync === "function") {
|
|
451
551
|
backend.shouldSync = (...args) => isolatedFS.shouldSync(...args);
|
package/dist/index.d.mts
CHANGED
|
@@ -179,6 +179,16 @@ interface TombstoneMeta {
|
|
|
179
179
|
confirmedBy: string[];
|
|
180
180
|
/** 目标类型;缺省视为 `file`(旧版本墓碑没有该字段)。 */
|
|
181
181
|
type?: TombstoneType;
|
|
182
|
+
/**
|
|
183
|
+
* 人工作废标记:**只能由用户手改墓碑文件**置为 `true`。
|
|
184
|
+
*
|
|
185
|
+
* 为 `true` 时整条墓碑被忽略 —— 不删目标路径、不参与 GC、不进入同步排除表,
|
|
186
|
+
* 也不会被任何自动写入路径改写(`readTombstonesFromFs` 直接把它过滤掉,所有
|
|
187
|
+
* 依赖墓碑列表的逻辑都看不到它)。改回 `false` / 删掉该键即恢复。
|
|
188
|
+
*
|
|
189
|
+
* 只对目录墓碑(`type: "directory"`)生效;文件墓碑上的该字段被忽略。
|
|
190
|
+
*/
|
|
191
|
+
obsolete?: boolean;
|
|
182
192
|
}
|
|
183
193
|
/** Content of a conflict archive file in `.meta/.conflicts/`. */
|
|
184
194
|
interface ConflictArchive {
|
|
@@ -1339,7 +1349,7 @@ declare function mergeAccountFields(targetType: string, sourceOptions: Record<st
|
|
|
1339
1349
|
* never persist credentials — they only reference a config-sync backend.
|
|
1340
1350
|
*/
|
|
1341
1351
|
declare function stripAccountFields(type: string, options: Record<string, unknown> | undefined): Record<string, unknown>;
|
|
1342
|
-
declare function wrapZenFSFileSystem(config: any): Promise<BackendInstance>;
|
|
1352
|
+
declare function wrapZenFSFileSystem(config: any, label?: string): Promise<BackendInstance>;
|
|
1343
1353
|
/** Loader that resolves to an optional backend package's module namespace. */
|
|
1344
1354
|
type BackendModuleLoader = () => Promise<any>;
|
|
1345
1355
|
declare const GITHUB_BACKEND_METADATA: BackendMetadata;
|
package/dist/index.d.ts
CHANGED
|
@@ -179,6 +179,16 @@ interface TombstoneMeta {
|
|
|
179
179
|
confirmedBy: string[];
|
|
180
180
|
/** 目标类型;缺省视为 `file`(旧版本墓碑没有该字段)。 */
|
|
181
181
|
type?: TombstoneType;
|
|
182
|
+
/**
|
|
183
|
+
* 人工作废标记:**只能由用户手改墓碑文件**置为 `true`。
|
|
184
|
+
*
|
|
185
|
+
* 为 `true` 时整条墓碑被忽略 —— 不删目标路径、不参与 GC、不进入同步排除表,
|
|
186
|
+
* 也不会被任何自动写入路径改写(`readTombstonesFromFs` 直接把它过滤掉,所有
|
|
187
|
+
* 依赖墓碑列表的逻辑都看不到它)。改回 `false` / 删掉该键即恢复。
|
|
188
|
+
*
|
|
189
|
+
* 只对目录墓碑(`type: "directory"`)生效;文件墓碑上的该字段被忽略。
|
|
190
|
+
*/
|
|
191
|
+
obsolete?: boolean;
|
|
182
192
|
}
|
|
183
193
|
/** Content of a conflict archive file in `.meta/.conflicts/`. */
|
|
184
194
|
interface ConflictArchive {
|
|
@@ -1339,7 +1349,7 @@ declare function mergeAccountFields(targetType: string, sourceOptions: Record<st
|
|
|
1339
1349
|
* never persist credentials — they only reference a config-sync backend.
|
|
1340
1350
|
*/
|
|
1341
1351
|
declare function stripAccountFields(type: string, options: Record<string, unknown> | undefined): Record<string, unknown>;
|
|
1342
|
-
declare function wrapZenFSFileSystem(config: any): Promise<BackendInstance>;
|
|
1352
|
+
declare function wrapZenFSFileSystem(config: any, label?: string): Promise<BackendInstance>;
|
|
1343
1353
|
/** Loader that resolves to an optional backend package's module namespace. */
|
|
1344
1354
|
type BackendModuleLoader = () => Promise<any>;
|
|
1345
1355
|
declare const GITHUB_BACKEND_METADATA: BackendMetadata;
|
package/dist/index.js
CHANGED
|
@@ -305,6 +305,94 @@ var init_idb_alloc = __esm({
|
|
|
305
305
|
}
|
|
306
306
|
});
|
|
307
307
|
|
|
308
|
+
// src/write-trace.ts
|
|
309
|
+
function readLocalStorage(key) {
|
|
310
|
+
try {
|
|
311
|
+
const ls = globalThis?.localStorage;
|
|
312
|
+
if (ls && typeof ls.getItem === "function") return ls.getItem(key);
|
|
313
|
+
} catch {
|
|
314
|
+
}
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
function readEnv() {
|
|
318
|
+
try {
|
|
319
|
+
const env = globalThis?.process?.env;
|
|
320
|
+
if (env && typeof env[WTRACE_ENV] === "string") return env[WTRACE_ENV];
|
|
321
|
+
} catch {
|
|
322
|
+
}
|
|
323
|
+
return null;
|
|
324
|
+
}
|
|
325
|
+
function watchPatterns() {
|
|
326
|
+
const raw = readLocalStorage(WTRACE_KEY) ?? readEnv();
|
|
327
|
+
if (!raw) return [];
|
|
328
|
+
const value = String(raw).trim();
|
|
329
|
+
if (!value || value === "0") return [];
|
|
330
|
+
if (value === "1" || value === "*" || value.toLowerCase() === "all") return ["*"];
|
|
331
|
+
return value.split(",").map((s) => s.trim()).filter(Boolean);
|
|
332
|
+
}
|
|
333
|
+
function getWriteTraceTag() {
|
|
334
|
+
const configured = (readLocalStorage(WTRACE_TAG_KEY) ?? "").trim();
|
|
335
|
+
if (configured) return configured;
|
|
336
|
+
if (cachedTag === null) cachedTag = Math.random().toString(36).slice(2, 6);
|
|
337
|
+
return cachedTag;
|
|
338
|
+
}
|
|
339
|
+
function fnv1a(bytes) {
|
|
340
|
+
let hash = 2166136261;
|
|
341
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
342
|
+
hash ^= bytes[i];
|
|
343
|
+
hash = Math.imul(hash, 16777619) >>> 0;
|
|
344
|
+
}
|
|
345
|
+
return hash.toString(16).padStart(8, "0");
|
|
346
|
+
}
|
|
347
|
+
function toBytes(data) {
|
|
348
|
+
if (data instanceof Uint8Array) return data;
|
|
349
|
+
if (data instanceof ArrayBuffer) return new Uint8Array(data);
|
|
350
|
+
if (typeof data === "string") return new TextEncoder().encode(data);
|
|
351
|
+
try {
|
|
352
|
+
return new Uint8Array(data);
|
|
353
|
+
} catch {
|
|
354
|
+
return new Uint8Array(0);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
function fmtTime(ms) {
|
|
358
|
+
if (ms === void 0 || !Number.isFinite(ms)) {
|
|
359
|
+
const now = Date.now();
|
|
360
|
+
return `none->now(${now}@${new Date(now).toISOString()})`;
|
|
361
|
+
}
|
|
362
|
+
return `${ms}@${new Date(ms).toISOString()}`;
|
|
363
|
+
}
|
|
364
|
+
function callerFrames() {
|
|
365
|
+
try {
|
|
366
|
+
const stack = new Error().stack;
|
|
367
|
+
if (!stack) return "";
|
|
368
|
+
return stack.split("\n").slice(2, 5).map((line) => line.trim().replace(/^at\s+/, "")).filter(Boolean).join(" <- ").slice(0, 240);
|
|
369
|
+
} catch {
|
|
370
|
+
return "";
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
function traceWrite(backend, op, path, data, mtime) {
|
|
374
|
+
const patterns = watchPatterns();
|
|
375
|
+
if (patterns.length === 0) return;
|
|
376
|
+
if (!patterns.some((p) => p === "*" || path.includes(p))) return;
|
|
377
|
+
const bytes = toBytes(data);
|
|
378
|
+
const frames = callerFrames();
|
|
379
|
+
const line = `tag=${getWriteTraceTag()} backend=${backend} op=${op} path=${path} bytes=${bytes.byteLength} fnv=${fnv1a(bytes)} mtime=${fmtTime(mtime)}` + (frames ? ` at=${frames}` : "");
|
|
380
|
+
try {
|
|
381
|
+
console.log(`[wtrace] ${line}`);
|
|
382
|
+
} catch {
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
var WTRACE_KEY, WTRACE_TAG_KEY, WTRACE_ENV, cachedTag;
|
|
386
|
+
var init_write_trace = __esm({
|
|
387
|
+
"src/write-trace.ts"() {
|
|
388
|
+
"use strict";
|
|
389
|
+
WTRACE_KEY = "debug:wtrace";
|
|
390
|
+
WTRACE_TAG_KEY = "debug:wtrace:tag";
|
|
391
|
+
WTRACE_ENV = "DEBUG_WTRACE";
|
|
392
|
+
cachedTag = null;
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
|
|
308
396
|
// src/backend-registry.ts
|
|
309
397
|
var backend_registry_exports = {};
|
|
310
398
|
__export(backend_registry_exports, {
|
|
@@ -406,9 +494,23 @@ function stripAccountFields(type, options) {
|
|
|
406
494
|
}
|
|
407
495
|
return stripped ?? source;
|
|
408
496
|
}
|
|
409
|
-
async function wrapZenFSFileSystem(config) {
|
|
497
|
+
async function wrapZenFSFileSystem(config, label) {
|
|
410
498
|
const zenfs = await import("@zenfs/core");
|
|
411
499
|
const isolatedFS = await zenfs.resolveMountConfig(config);
|
|
500
|
+
const backendLabel = (() => {
|
|
501
|
+
if (label) return label;
|
|
502
|
+
const c = config ?? {};
|
|
503
|
+
const hints = [
|
|
504
|
+
c.owner && c.repo ? `${c.owner}/${c.repo}` : null,
|
|
505
|
+
c.storeName,
|
|
506
|
+
c.label,
|
|
507
|
+
c.name
|
|
508
|
+
];
|
|
509
|
+
for (const hint of hints) {
|
|
510
|
+
if (typeof hint === "string" && hint.trim()) return hint.trim();
|
|
511
|
+
}
|
|
512
|
+
return "backend";
|
|
513
|
+
})();
|
|
412
514
|
let changeCallback = null;
|
|
413
515
|
const notifyChange = () => {
|
|
414
516
|
if (changeCallback) changeCallback();
|
|
@@ -439,6 +541,7 @@ async function wrapZenFSFileSystem(config) {
|
|
|
439
541
|
async writeFile(path, data, _options) {
|
|
440
542
|
const source = data instanceof ArrayBuffer ? new Uint8Array(data) : data instanceof Uint8Array ? data : new TextEncoder().encode(data);
|
|
441
543
|
const bytes = new Uint8Array(source);
|
|
544
|
+
traceWrite(backendLabel, "writeFile", path, bytes, _options?.mtime);
|
|
442
545
|
await runExclusive(path, async () => {
|
|
443
546
|
const parts = path.split("/").filter(Boolean);
|
|
444
547
|
parts.pop();
|
|
@@ -497,7 +600,10 @@ async function wrapZenFSFileSystem(config) {
|
|
|
497
600
|
backend.createSnapshot = (root, filter) => isolatedFS.createSnapshot(root, filter);
|
|
498
601
|
}
|
|
499
602
|
if (typeof isolatedFS.writeFileWithMtime === "function") {
|
|
500
|
-
backend.writeFileWithMtime = (path, data, mtimeMs) =>
|
|
603
|
+
backend.writeFileWithMtime = (path, data, mtimeMs) => {
|
|
604
|
+
traceWrite(backendLabel, "writeFileWithMtime", path, data, mtimeMs);
|
|
605
|
+
return isolatedFS.writeFileWithMtime(path, data, mtimeMs);
|
|
606
|
+
};
|
|
501
607
|
}
|
|
502
608
|
if (typeof isolatedFS.shouldSync === "function") {
|
|
503
609
|
backend.shouldSync = (...args) => isolatedFS.shouldSync(...args);
|
|
@@ -714,6 +820,7 @@ var init_backend_registry = __esm({
|
|
|
714
820
|
"src/backend-registry.ts"() {
|
|
715
821
|
"use strict";
|
|
716
822
|
init_idb_alloc();
|
|
823
|
+
init_write_trace();
|
|
717
824
|
registry = /* @__PURE__ */ new Map();
|
|
718
825
|
metadataRegistry = /* @__PURE__ */ new Map();
|
|
719
826
|
REGISTRY_TOKEN = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -2029,8 +2136,12 @@ function serializeTombstone(tombstone) {
|
|
|
2029
2136
|
confirmedBy: tombstone.confirmedBy
|
|
2030
2137
|
};
|
|
2031
2138
|
if (tombstone.type) ordered.type = tombstone.type;
|
|
2139
|
+
if (isObsoleteTombstone(tombstone)) ordered.obsolete = true;
|
|
2032
2140
|
return JSON.stringify(ordered, null, 2);
|
|
2033
2141
|
}
|
|
2142
|
+
function isObsoleteTombstone(tombstone) {
|
|
2143
|
+
return tombstone.obsolete === true && tombstone.type === "directory";
|
|
2144
|
+
}
|
|
2034
2145
|
async function purgeTombstonedTree(fs, targetPath) {
|
|
2035
2146
|
let isDir2 = false;
|
|
2036
2147
|
try {
|
|
@@ -2101,14 +2212,14 @@ var DATA_GROUP_DEFAULT_FEATURES = {
|
|
|
2101
2212
|
configHost: false,
|
|
2102
2213
|
appData: true
|
|
2103
2214
|
};
|
|
2104
|
-
function
|
|
2215
|
+
function toBytes2(raw) {
|
|
2105
2216
|
if (raw instanceof Uint8Array) return raw;
|
|
2106
2217
|
if (raw instanceof ArrayBuffer) return new Uint8Array(raw);
|
|
2107
2218
|
if (typeof raw === "string") return new TextEncoder().encode(raw);
|
|
2108
2219
|
return new Uint8Array(raw);
|
|
2109
2220
|
}
|
|
2110
2221
|
async function writeFileOverwrite(fs, path, data, options = {}) {
|
|
2111
|
-
const bytes =
|
|
2222
|
+
const bytes = toBytes2(data);
|
|
2112
2223
|
try {
|
|
2113
2224
|
await fs.writeFile(path, bytes);
|
|
2114
2225
|
return;
|
|
@@ -2158,7 +2269,7 @@ async function readJson(fs, path) {
|
|
|
2158
2269
|
}
|
|
2159
2270
|
async function readText(fs, path) {
|
|
2160
2271
|
try {
|
|
2161
|
-
return new TextDecoder().decode(
|
|
2272
|
+
return new TextDecoder().decode(toBytes2(await fs.readFile(path)));
|
|
2162
2273
|
} catch {
|
|
2163
2274
|
return null;
|
|
2164
2275
|
}
|
|
@@ -2203,12 +2314,14 @@ function normalizeTombstoneRecord(value, fallbackPath) {
|
|
|
2203
2314
|
const path = normalizeTombstonePath(rawPath);
|
|
2204
2315
|
const confirmedBy = Array.isArray(record.confirmedBy) ? record.confirmedBy.filter((id) => typeof id === "string") : [];
|
|
2205
2316
|
const type = record.type === "directory" ? "directory" : record.type === "file" ? "file" : void 0;
|
|
2317
|
+
const obsolete = record.obsolete === true && type === "directory";
|
|
2206
2318
|
return {
|
|
2207
2319
|
path,
|
|
2208
2320
|
deletedAt: typeof record.deletedAt === "number" ? record.deletedAt : 0,
|
|
2209
2321
|
deletedBy: typeof record.deletedBy === "string" ? record.deletedBy : "unknown",
|
|
2210
2322
|
confirmedBy,
|
|
2211
|
-
...type ? { type } : {}
|
|
2323
|
+
...type ? { type } : {},
|
|
2324
|
+
...obsolete ? { obsolete: true } : {}
|
|
2212
2325
|
};
|
|
2213
2326
|
}
|
|
2214
2327
|
function normalizeTombstonePath(rawPath) {
|
|
@@ -2296,6 +2409,7 @@ function mergeTombstone(byPath, tombstone) {
|
|
|
2296
2409
|
if (!prev.confirmedBy.includes(id)) prev.confirmedBy.push(id);
|
|
2297
2410
|
}
|
|
2298
2411
|
if (isDirectoryTombstone(tombstone) && !isDirectoryTombstone(prev)) prev.type = "directory";
|
|
2412
|
+
if (isObsoleteTombstone(tombstone) && prev.type === "directory") prev.obsolete = true;
|
|
2299
2413
|
}
|
|
2300
2414
|
async function readTombstonesFromFs(fs, warn) {
|
|
2301
2415
|
const byPath = /* @__PURE__ */ new Map();
|
|
@@ -2312,7 +2426,7 @@ async function readTombstonesFromFs(fs, warn) {
|
|
|
2312
2426
|
const filePath = `${dir}/${entry}`;
|
|
2313
2427
|
let raw;
|
|
2314
2428
|
try {
|
|
2315
|
-
raw = new TextDecoder().decode(
|
|
2429
|
+
raw = new TextDecoder().decode(toBytes2(await fs.readFile(filePath)));
|
|
2316
2430
|
} catch (err) {
|
|
2317
2431
|
warn(
|
|
2318
2432
|
`[Tombstones] unreadable tombstone ${filePath}: ${err instanceof Error ? err.message : String(err)} \u2014 skipped`
|
|
@@ -2327,7 +2441,17 @@ async function readTombstonesFromFs(fs, warn) {
|
|
|
2327
2441
|
for (const tombstone of tombstones) mergeTombstone(byPath, tombstone);
|
|
2328
2442
|
}
|
|
2329
2443
|
}
|
|
2330
|
-
|
|
2444
|
+
const active = [];
|
|
2445
|
+
for (const tombstone of byPath.values()) {
|
|
2446
|
+
if (isObsoleteTombstone(tombstone)) {
|
|
2447
|
+
log3.log(
|
|
2448
|
+
`[Tombstones] "${tombstone.path}" ignored \u2014 obsolete=true (marked by user)`
|
|
2449
|
+
);
|
|
2450
|
+
continue;
|
|
2451
|
+
}
|
|
2452
|
+
active.push(tombstone);
|
|
2453
|
+
}
|
|
2454
|
+
return active;
|
|
2331
2455
|
}
|
|
2332
2456
|
async function readGroupDescriptor(fs) {
|
|
2333
2457
|
const parsed = await readJson(fs, GROUP_DESCRIPTOR_FILE2);
|
|
@@ -2344,7 +2468,7 @@ function isNotFoundError(err) {
|
|
|
2344
2468
|
async function readGroupDescriptorStrict(fs) {
|
|
2345
2469
|
let raw;
|
|
2346
2470
|
try {
|
|
2347
|
-
raw = new TextDecoder().decode(
|
|
2471
|
+
raw = new TextDecoder().decode(toBytes2(await fs.readFile(GROUP_DESCRIPTOR_FILE2)));
|
|
2348
2472
|
} catch (err) {
|
|
2349
2473
|
if (isNotFoundError(err)) return null;
|
|
2350
2474
|
throw err;
|
|
@@ -2828,7 +2952,7 @@ var ConflictStore = class {
|
|
|
2828
2952
|
for (const dir of this.candidatesFor(conflictId)) {
|
|
2829
2953
|
const p = `${dir}/${fileType}`;
|
|
2830
2954
|
try {
|
|
2831
|
-
return new TextDecoder().decode(
|
|
2955
|
+
return new TextDecoder().decode(toBytes2(await this.fs.readFile(p)));
|
|
2832
2956
|
} catch {
|
|
2833
2957
|
}
|
|
2834
2958
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
unregisterBackend,
|
|
24
24
|
withAllocId,
|
|
25
25
|
wrapZenFSFileSystem
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-VUFW6U3A.mjs";
|
|
27
27
|
|
|
28
28
|
// src/config-repo.ts
|
|
29
29
|
import {
|
|
@@ -515,7 +515,7 @@ function registerFolderBackend() {
|
|
|
515
515
|
const pathMod = await import("path");
|
|
516
516
|
const dir = options.path;
|
|
517
517
|
const store = new FolderStore({ path: dir, label: options.label, fs, pathMod });
|
|
518
|
-
return (await import("./backend-registry-
|
|
518
|
+
return (await import("./backend-registry-F7RJCILX.mjs")).wrapZenFSFileSystem({ backend: FolderBackend, path: dir, label: options.label });
|
|
519
519
|
},
|
|
520
520
|
{
|
|
521
521
|
type: "Folder",
|
|
@@ -1033,8 +1033,12 @@ function serializeTombstone(tombstone) {
|
|
|
1033
1033
|
confirmedBy: tombstone.confirmedBy
|
|
1034
1034
|
};
|
|
1035
1035
|
if (tombstone.type) ordered.type = tombstone.type;
|
|
1036
|
+
if (isObsoleteTombstone(tombstone)) ordered.obsolete = true;
|
|
1036
1037
|
return JSON.stringify(ordered, null, 2);
|
|
1037
1038
|
}
|
|
1039
|
+
function isObsoleteTombstone(tombstone) {
|
|
1040
|
+
return tombstone.obsolete === true && tombstone.type === "directory";
|
|
1041
|
+
}
|
|
1038
1042
|
async function purgeTombstonedTree(fs, targetPath) {
|
|
1039
1043
|
let isDir2 = false;
|
|
1040
1044
|
try {
|
|
@@ -1207,12 +1211,14 @@ function normalizeTombstoneRecord(value, fallbackPath) {
|
|
|
1207
1211
|
const path = normalizeTombstonePath(rawPath);
|
|
1208
1212
|
const confirmedBy = Array.isArray(record.confirmedBy) ? record.confirmedBy.filter((id) => typeof id === "string") : [];
|
|
1209
1213
|
const type = record.type === "directory" ? "directory" : record.type === "file" ? "file" : void 0;
|
|
1214
|
+
const obsolete = record.obsolete === true && type === "directory";
|
|
1210
1215
|
return {
|
|
1211
1216
|
path,
|
|
1212
1217
|
deletedAt: typeof record.deletedAt === "number" ? record.deletedAt : 0,
|
|
1213
1218
|
deletedBy: typeof record.deletedBy === "string" ? record.deletedBy : "unknown",
|
|
1214
1219
|
confirmedBy,
|
|
1215
|
-
...type ? { type } : {}
|
|
1220
|
+
...type ? { type } : {},
|
|
1221
|
+
...obsolete ? { obsolete: true } : {}
|
|
1216
1222
|
};
|
|
1217
1223
|
}
|
|
1218
1224
|
function normalizeTombstonePath(rawPath) {
|
|
@@ -1300,6 +1306,7 @@ function mergeTombstone(byPath, tombstone) {
|
|
|
1300
1306
|
if (!prev.confirmedBy.includes(id)) prev.confirmedBy.push(id);
|
|
1301
1307
|
}
|
|
1302
1308
|
if (isDirectoryTombstone(tombstone) && !isDirectoryTombstone(prev)) prev.type = "directory";
|
|
1309
|
+
if (isObsoleteTombstone(tombstone) && prev.type === "directory") prev.obsolete = true;
|
|
1303
1310
|
}
|
|
1304
1311
|
async function readTombstonesFromFs(fs, warn) {
|
|
1305
1312
|
const byPath = /* @__PURE__ */ new Map();
|
|
@@ -1331,7 +1338,17 @@ async function readTombstonesFromFs(fs, warn) {
|
|
|
1331
1338
|
for (const tombstone of tombstones) mergeTombstone(byPath, tombstone);
|
|
1332
1339
|
}
|
|
1333
1340
|
}
|
|
1334
|
-
|
|
1341
|
+
const active = [];
|
|
1342
|
+
for (const tombstone of byPath.values()) {
|
|
1343
|
+
if (isObsoleteTombstone(tombstone)) {
|
|
1344
|
+
log3.log(
|
|
1345
|
+
`[Tombstones] "${tombstone.path}" ignored \u2014 obsolete=true (marked by user)`
|
|
1346
|
+
);
|
|
1347
|
+
continue;
|
|
1348
|
+
}
|
|
1349
|
+
active.push(tombstone);
|
|
1350
|
+
}
|
|
1351
|
+
return active;
|
|
1335
1352
|
}
|
|
1336
1353
|
async function readGroupDescriptor(fs) {
|
|
1337
1354
|
const parsed = await readJson(fs, GROUP_DESCRIPTOR_FILE2);
|
package/dist/zen-fs-config.js
CHANGED
|
@@ -24618,6 +24618,94 @@ var ZenFSConfig = (() => {
|
|
|
24618
24618
|
}
|
|
24619
24619
|
});
|
|
24620
24620
|
|
|
24621
|
+
// src/write-trace.ts
|
|
24622
|
+
function readLocalStorage(key) {
|
|
24623
|
+
try {
|
|
24624
|
+
const ls = globalThis?.localStorage;
|
|
24625
|
+
if (ls && typeof ls.getItem === "function") return ls.getItem(key);
|
|
24626
|
+
} catch {
|
|
24627
|
+
}
|
|
24628
|
+
return null;
|
|
24629
|
+
}
|
|
24630
|
+
function readEnv() {
|
|
24631
|
+
try {
|
|
24632
|
+
const env = globalThis?.process?.env;
|
|
24633
|
+
if (env && typeof env[WTRACE_ENV] === "string") return env[WTRACE_ENV];
|
|
24634
|
+
} catch {
|
|
24635
|
+
}
|
|
24636
|
+
return null;
|
|
24637
|
+
}
|
|
24638
|
+
function watchPatterns() {
|
|
24639
|
+
const raw = readLocalStorage(WTRACE_KEY) ?? readEnv();
|
|
24640
|
+
if (!raw) return [];
|
|
24641
|
+
const value = String(raw).trim();
|
|
24642
|
+
if (!value || value === "0") return [];
|
|
24643
|
+
if (value === "1" || value === "*" || value.toLowerCase() === "all") return ["*"];
|
|
24644
|
+
return value.split(",").map((s) => s.trim()).filter(Boolean);
|
|
24645
|
+
}
|
|
24646
|
+
function getWriteTraceTag() {
|
|
24647
|
+
const configured = (readLocalStorage(WTRACE_TAG_KEY) ?? "").trim();
|
|
24648
|
+
if (configured) return configured;
|
|
24649
|
+
if (cachedTag === null) cachedTag = Math.random().toString(36).slice(2, 6);
|
|
24650
|
+
return cachedTag;
|
|
24651
|
+
}
|
|
24652
|
+
function fnv1a(bytes) {
|
|
24653
|
+
let hash = 2166136261;
|
|
24654
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
24655
|
+
hash ^= bytes[i];
|
|
24656
|
+
hash = Math.imul(hash, 16777619) >>> 0;
|
|
24657
|
+
}
|
|
24658
|
+
return hash.toString(16).padStart(8, "0");
|
|
24659
|
+
}
|
|
24660
|
+
function toBytes(data) {
|
|
24661
|
+
if (data instanceof Uint8Array) return data;
|
|
24662
|
+
if (data instanceof ArrayBuffer) return new Uint8Array(data);
|
|
24663
|
+
if (typeof data === "string") return new TextEncoder().encode(data);
|
|
24664
|
+
try {
|
|
24665
|
+
return new Uint8Array(data);
|
|
24666
|
+
} catch {
|
|
24667
|
+
return new Uint8Array(0);
|
|
24668
|
+
}
|
|
24669
|
+
}
|
|
24670
|
+
function fmtTime(ms) {
|
|
24671
|
+
if (ms === void 0 || !Number.isFinite(ms)) {
|
|
24672
|
+
const now = Date.now();
|
|
24673
|
+
return `none->now(${now}@${new Date(now).toISOString()})`;
|
|
24674
|
+
}
|
|
24675
|
+
return `${ms}@${new Date(ms).toISOString()}`;
|
|
24676
|
+
}
|
|
24677
|
+
function callerFrames() {
|
|
24678
|
+
try {
|
|
24679
|
+
const stack = new Error().stack;
|
|
24680
|
+
if (!stack) return "";
|
|
24681
|
+
return stack.split("\n").slice(2, 5).map((line) => line.trim().replace(/^at\s+/, "")).filter(Boolean).join(" <- ").slice(0, 240);
|
|
24682
|
+
} catch {
|
|
24683
|
+
return "";
|
|
24684
|
+
}
|
|
24685
|
+
}
|
|
24686
|
+
function traceWrite(backend, op, path, data, mtime) {
|
|
24687
|
+
const patterns = watchPatterns();
|
|
24688
|
+
if (patterns.length === 0) return;
|
|
24689
|
+
if (!patterns.some((p) => p === "*" || path.includes(p))) return;
|
|
24690
|
+
const bytes = toBytes(data);
|
|
24691
|
+
const frames = callerFrames();
|
|
24692
|
+
const line = `tag=${getWriteTraceTag()} backend=${backend} op=${op} path=${path} bytes=${bytes.byteLength} fnv=${fnv1a(bytes)} mtime=${fmtTime(mtime)}` + (frames ? ` at=${frames}` : "");
|
|
24693
|
+
try {
|
|
24694
|
+
console.log(`[wtrace] ${line}`);
|
|
24695
|
+
} catch {
|
|
24696
|
+
}
|
|
24697
|
+
}
|
|
24698
|
+
var WTRACE_KEY, WTRACE_TAG_KEY, WTRACE_ENV, cachedTag;
|
|
24699
|
+
var init_write_trace = __esm({
|
|
24700
|
+
"src/write-trace.ts"() {
|
|
24701
|
+
"use strict";
|
|
24702
|
+
WTRACE_KEY = "debug:wtrace";
|
|
24703
|
+
WTRACE_TAG_KEY = "debug:wtrace:tag";
|
|
24704
|
+
WTRACE_ENV = "DEBUG_WTRACE";
|
|
24705
|
+
cachedTag = null;
|
|
24706
|
+
}
|
|
24707
|
+
});
|
|
24708
|
+
|
|
24621
24709
|
// src/backend-registry.ts
|
|
24622
24710
|
var backend_registry_exports = {};
|
|
24623
24711
|
__export(backend_registry_exports, {
|
|
@@ -24719,9 +24807,23 @@ var ZenFSConfig = (() => {
|
|
|
24719
24807
|
}
|
|
24720
24808
|
return stripped ?? source;
|
|
24721
24809
|
}
|
|
24722
|
-
async function wrapZenFSFileSystem(config) {
|
|
24810
|
+
async function wrapZenFSFileSystem(config, label) {
|
|
24723
24811
|
const zenfs = await Promise.resolve().then(() => (init_dist4(), dist_exports));
|
|
24724
24812
|
const isolatedFS = await zenfs.resolveMountConfig(config);
|
|
24813
|
+
const backendLabel = (() => {
|
|
24814
|
+
if (label) return label;
|
|
24815
|
+
const c = config ?? {};
|
|
24816
|
+
const hints = [
|
|
24817
|
+
c.owner && c.repo ? `${c.owner}/${c.repo}` : null,
|
|
24818
|
+
c.storeName,
|
|
24819
|
+
c.label,
|
|
24820
|
+
c.name
|
|
24821
|
+
];
|
|
24822
|
+
for (const hint of hints) {
|
|
24823
|
+
if (typeof hint === "string" && hint.trim()) return hint.trim();
|
|
24824
|
+
}
|
|
24825
|
+
return "backend";
|
|
24826
|
+
})();
|
|
24725
24827
|
let changeCallback = null;
|
|
24726
24828
|
const notifyChange = () => {
|
|
24727
24829
|
if (changeCallback) changeCallback();
|
|
@@ -24752,6 +24854,7 @@ var ZenFSConfig = (() => {
|
|
|
24752
24854
|
async writeFile(path, data, _options) {
|
|
24753
24855
|
const source = data instanceof ArrayBuffer ? new Uint8Array(data) : data instanceof Uint8Array ? data : new TextEncoder().encode(data);
|
|
24754
24856
|
const bytes = new Uint8Array(source);
|
|
24857
|
+
traceWrite(backendLabel, "writeFile", path, bytes, _options?.mtime);
|
|
24755
24858
|
await runExclusive(path, async () => {
|
|
24756
24859
|
const parts = path.split("/").filter(Boolean);
|
|
24757
24860
|
parts.pop();
|
|
@@ -24810,7 +24913,10 @@ var ZenFSConfig = (() => {
|
|
|
24810
24913
|
backend.createSnapshot = (root, filter) => isolatedFS.createSnapshot(root, filter);
|
|
24811
24914
|
}
|
|
24812
24915
|
if (typeof isolatedFS.writeFileWithMtime === "function") {
|
|
24813
|
-
backend.writeFileWithMtime = (path, data, mtimeMs) =>
|
|
24916
|
+
backend.writeFileWithMtime = (path, data, mtimeMs) => {
|
|
24917
|
+
traceWrite(backendLabel, "writeFileWithMtime", path, data, mtimeMs);
|
|
24918
|
+
return isolatedFS.writeFileWithMtime(path, data, mtimeMs);
|
|
24919
|
+
};
|
|
24814
24920
|
}
|
|
24815
24921
|
if (typeof isolatedFS.shouldSync === "function") {
|
|
24816
24922
|
backend.shouldSync = (...args) => isolatedFS.shouldSync(...args);
|
|
@@ -25027,6 +25133,7 @@ var ZenFSConfig = (() => {
|
|
|
25027
25133
|
"src/backend-registry.ts"() {
|
|
25028
25134
|
"use strict";
|
|
25029
25135
|
init_idb_alloc();
|
|
25136
|
+
init_write_trace();
|
|
25030
25137
|
registry = /* @__PURE__ */ new Map();
|
|
25031
25138
|
metadataRegistry = /* @__PURE__ */ new Map();
|
|
25032
25139
|
REGISTRY_TOKEN = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -28026,8 +28133,12 @@ var ZenFSConfig = (() => {
|
|
|
28026
28133
|
confirmedBy: tombstone.confirmedBy
|
|
28027
28134
|
};
|
|
28028
28135
|
if (tombstone.type) ordered.type = tombstone.type;
|
|
28136
|
+
if (isObsoleteTombstone(tombstone)) ordered.obsolete = true;
|
|
28029
28137
|
return JSON.stringify(ordered, null, 2);
|
|
28030
28138
|
}
|
|
28139
|
+
function isObsoleteTombstone(tombstone) {
|
|
28140
|
+
return tombstone.obsolete === true && tombstone.type === "directory";
|
|
28141
|
+
}
|
|
28031
28142
|
async function purgeTombstonedTree(fs, targetPath) {
|
|
28032
28143
|
let isDir2 = false;
|
|
28033
28144
|
try {
|
|
@@ -28098,14 +28209,14 @@ var ZenFSConfig = (() => {
|
|
|
28098
28209
|
configHost: false,
|
|
28099
28210
|
appData: true
|
|
28100
28211
|
};
|
|
28101
|
-
function
|
|
28212
|
+
function toBytes2(raw) {
|
|
28102
28213
|
if (raw instanceof Uint8Array) return raw;
|
|
28103
28214
|
if (raw instanceof ArrayBuffer) return new Uint8Array(raw);
|
|
28104
28215
|
if (typeof raw === "string") return new TextEncoder().encode(raw);
|
|
28105
28216
|
return new Uint8Array(raw);
|
|
28106
28217
|
}
|
|
28107
28218
|
async function writeFileOverwrite(fs, path, data, options = {}) {
|
|
28108
|
-
const bytes =
|
|
28219
|
+
const bytes = toBytes2(data);
|
|
28109
28220
|
try {
|
|
28110
28221
|
await fs.writeFile(path, bytes);
|
|
28111
28222
|
return;
|
|
@@ -28155,7 +28266,7 @@ var ZenFSConfig = (() => {
|
|
|
28155
28266
|
}
|
|
28156
28267
|
async function readText(fs, path) {
|
|
28157
28268
|
try {
|
|
28158
|
-
return new TextDecoder().decode(
|
|
28269
|
+
return new TextDecoder().decode(toBytes2(await fs.readFile(path)));
|
|
28159
28270
|
} catch {
|
|
28160
28271
|
return null;
|
|
28161
28272
|
}
|
|
@@ -28200,12 +28311,14 @@ var ZenFSConfig = (() => {
|
|
|
28200
28311
|
const path = normalizeTombstonePath(rawPath);
|
|
28201
28312
|
const confirmedBy = Array.isArray(record.confirmedBy) ? record.confirmedBy.filter((id) => typeof id === "string") : [];
|
|
28202
28313
|
const type = record.type === "directory" ? "directory" : record.type === "file" ? "file" : void 0;
|
|
28314
|
+
const obsolete = record.obsolete === true && type === "directory";
|
|
28203
28315
|
return {
|
|
28204
28316
|
path,
|
|
28205
28317
|
deletedAt: typeof record.deletedAt === "number" ? record.deletedAt : 0,
|
|
28206
28318
|
deletedBy: typeof record.deletedBy === "string" ? record.deletedBy : "unknown",
|
|
28207
28319
|
confirmedBy,
|
|
28208
|
-
...type ? { type } : {}
|
|
28320
|
+
...type ? { type } : {},
|
|
28321
|
+
...obsolete ? { obsolete: true } : {}
|
|
28209
28322
|
};
|
|
28210
28323
|
}
|
|
28211
28324
|
function normalizeTombstonePath(rawPath) {
|
|
@@ -28293,6 +28406,7 @@ var ZenFSConfig = (() => {
|
|
|
28293
28406
|
if (!prev.confirmedBy.includes(id)) prev.confirmedBy.push(id);
|
|
28294
28407
|
}
|
|
28295
28408
|
if (isDirectoryTombstone(tombstone) && !isDirectoryTombstone(prev)) prev.type = "directory";
|
|
28409
|
+
if (isObsoleteTombstone(tombstone) && prev.type === "directory") prev.obsolete = true;
|
|
28296
28410
|
}
|
|
28297
28411
|
async function readTombstonesFromFs(fs, warn2) {
|
|
28298
28412
|
const byPath = /* @__PURE__ */ new Map();
|
|
@@ -28309,7 +28423,7 @@ var ZenFSConfig = (() => {
|
|
|
28309
28423
|
const filePath = `${dir}/${entry}`;
|
|
28310
28424
|
let raw;
|
|
28311
28425
|
try {
|
|
28312
|
-
raw = new TextDecoder().decode(
|
|
28426
|
+
raw = new TextDecoder().decode(toBytes2(await fs.readFile(filePath)));
|
|
28313
28427
|
} catch (err2) {
|
|
28314
28428
|
warn2(
|
|
28315
28429
|
`[Tombstones] unreadable tombstone ${filePath}: ${err2 instanceof Error ? err2.message : String(err2)} \u2014 skipped`
|
|
@@ -28324,7 +28438,17 @@ var ZenFSConfig = (() => {
|
|
|
28324
28438
|
for (const tombstone of tombstones) mergeTombstone(byPath, tombstone);
|
|
28325
28439
|
}
|
|
28326
28440
|
}
|
|
28327
|
-
|
|
28441
|
+
const active = [];
|
|
28442
|
+
for (const tombstone of byPath.values()) {
|
|
28443
|
+
if (isObsoleteTombstone(tombstone)) {
|
|
28444
|
+
log7.log(
|
|
28445
|
+
`[Tombstones] "${tombstone.path}" ignored \u2014 obsolete=true (marked by user)`
|
|
28446
|
+
);
|
|
28447
|
+
continue;
|
|
28448
|
+
}
|
|
28449
|
+
active.push(tombstone);
|
|
28450
|
+
}
|
|
28451
|
+
return active;
|
|
28328
28452
|
}
|
|
28329
28453
|
async function readGroupDescriptor(fs) {
|
|
28330
28454
|
const parsed = await readJson(fs, GROUP_DESCRIPTOR_FILE2);
|
|
@@ -28341,7 +28465,7 @@ var ZenFSConfig = (() => {
|
|
|
28341
28465
|
async function readGroupDescriptorStrict(fs) {
|
|
28342
28466
|
let raw;
|
|
28343
28467
|
try {
|
|
28344
|
-
raw = new TextDecoder().decode(
|
|
28468
|
+
raw = new TextDecoder().decode(toBytes2(await fs.readFile(GROUP_DESCRIPTOR_FILE2)));
|
|
28345
28469
|
} catch (err2) {
|
|
28346
28470
|
if (isNotFoundError(err2)) return null;
|
|
28347
28471
|
throw err2;
|
|
@@ -28817,7 +28941,7 @@ var ZenFSConfig = (() => {
|
|
|
28817
28941
|
for (const dir of this.candidatesFor(conflictId)) {
|
|
28818
28942
|
const p = `${dir}/${fileType}`;
|
|
28819
28943
|
try {
|
|
28820
|
-
return new TextDecoder().decode(
|
|
28944
|
+
return new TextDecoder().decode(toBytes2(await this.fs.readFile(p)));
|
|
28821
28945
|
} catch {
|
|
28822
28946
|
}
|
|
28823
28947
|
}
|