@bendyline/docblocks 2.0.0 → 2.1.1
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/README.md +2 -2
- package/dist/{chunk-2D7Y4IR3.js → chunk-4437YWLE.js} +123 -67
- package/dist/{chunk-5MYAICRE.js → chunk-45T5AFCN.js} +44 -57
- package/dist/{chunk-PGR7LK6D.js → chunk-6L3JRDE7.js} +14 -6
- package/dist/{chunk-RVQHY3XU.js → chunk-6XHOOBYF.js} +0 -1
- package/dist/chunk-73OOROXH.js +8 -0
- package/dist/{chunk-SI2LU2RP.js → chunk-AYWKIZLD.js} +1 -1
- package/dist/{chunk-GCPBEMMH.js → chunk-BVY7GGNV.js} +10 -21
- package/dist/{chunk-AEHCVWU5.js → chunk-DZB666V7.js} +0 -1
- package/dist/{chunk-75UUF6C4.js → chunk-HI7QEWL6.js} +18 -10
- package/dist/chunk-KQ6756AJ.js +28 -0
- package/dist/chunk-LMMOFRGQ.js +148 -0
- package/dist/{chunk-FNW556FN.js → chunk-M2PUNKHS.js} +0 -1
- package/dist/chunk-M5ZNQGR5.js +19 -0
- package/dist/chunk-M62ZGJ5I.js +51 -0
- package/dist/chunk-OQCPBOQA.js +168 -0
- package/dist/{chunk-EGNDADXB.js → chunk-QI6YKTQV.js} +2 -3
- package/dist/chunk-SJBB5OD7.js +227 -0
- package/dist/{chunk-EZKJZUNJ.js → chunk-XAMILHQP.js} +0 -1
- package/dist/{chunk-J32GU3F3.js → chunk-YM7O3PWO.js} +249 -222
- package/dist/{chunk-RQJRQF46.js → chunk-ZO7G53QP.js} +41 -49
- package/dist/document/index.d.ts +358 -6
- package/dist/document/index.js +24 -4
- package/dist/filesystem/electron.d.ts +73 -4
- package/dist/filesystem/electron.js +16 -4
- package/dist/filesystem/index.d.ts +228 -22
- package/dist/filesystem/index.js +133 -20
- package/dist/filesystem/indexeddb.d.ts +284 -5
- package/dist/filesystem/indexeddb.js +22 -5
- package/dist/filesystem/memory.d.ts +152 -4
- package/dist/filesystem/memory.js +12 -4
- package/dist/filesystem/native.d.ts +136 -4
- package/dist/filesystem/native.js +27 -4
- package/dist/host/index.d.ts +32 -9
- package/dist/host/index.js +26 -30
- package/dist/index.d.ts +14 -10
- package/dist/index.js +204 -10
- package/dist/mcp/index.d.ts +33 -4
- package/dist/mcp/index.js +31 -4
- package/dist/mcp/zod.d.ts +645 -643
- package/dist/mcp/zod.js +700 -885
- package/dist/share/index.d.ts +43 -0
- package/dist/share/index.js +12 -0
- package/dist/{types-CsX6EN2t.d.ts → types-BEg5SQ1_.d.ts} +1 -1
- package/dist/{types-eOlt9J7n.d.ts → types-CueK0tvU.d.ts} +34 -11
- package/dist/vscode/index.d.ts +225 -3
- package/dist/vscode/index.js +389 -3
- package/dist/workspace/index.d.ts +141 -4
- package/dist/workspace/index.js +28 -3
- package/package.json +10 -5
- package/dist/chunk-2D7Y4IR3.js.map +0 -1
- package/dist/chunk-5MYAICRE.js.map +0 -1
- package/dist/chunk-75UUF6C4.js.map +0 -1
- package/dist/chunk-AEHCVWU5.js.map +0 -1
- package/dist/chunk-AYZ4HN5M.js +0 -20
- package/dist/chunk-AYZ4HN5M.js.map +0 -1
- package/dist/chunk-EGNDADXB.js.map +0 -1
- package/dist/chunk-EZKJZUNJ.js.map +0 -1
- package/dist/chunk-FNW556FN.js.map +0 -1
- package/dist/chunk-GCPBEMMH.js.map +0 -1
- package/dist/chunk-J32GU3F3.js.map +0 -1
- package/dist/chunk-PGR7LK6D.js.map +0 -1
- package/dist/chunk-RQJRQF46.js.map +0 -1
- package/dist/chunk-RVQHY3XU.js.map +0 -1
- package/dist/chunk-SI2LU2RP.js.map +0 -1
- package/dist/chunk-W5UUUII5.js +0 -142
- package/dist/chunk-W5UUUII5.js.map +0 -1
- package/dist/document/document-session.d.ts +0 -127
- package/dist/document/document-session.d.ts.map +0 -1
- package/dist/document/document-session.js +0 -749
- package/dist/document/document-session.js.map +0 -1
- package/dist/document/filesystem-target.d.ts +0 -17
- package/dist/document/filesystem-target.d.ts.map +0 -1
- package/dist/document/filesystem-target.js +0 -70
- package/dist/document/filesystem-target.js.map +0 -1
- package/dist/document/index.d.ts.map +0 -1
- package/dist/document/index.js.map +0 -1
- package/dist/document/recovery-journal.d.ts +0 -125
- package/dist/document/recovery-journal.d.ts.map +0 -1
- package/dist/document/recovery-journal.js +0 -385
- package/dist/document/recovery-journal.js.map +0 -1
- package/dist/document/types.d.ts +0 -89
- package/dist/document/types.d.ts.map +0 -1
- package/dist/document/types.js +0 -9
- package/dist/document/types.js.map +0 -1
- package/dist/filesystem/commit-lock.d.ts +0 -3
- package/dist/filesystem/commit-lock.d.ts.map +0 -1
- package/dist/filesystem/commit-lock.js +0 -20
- package/dist/filesystem/commit-lock.js.map +0 -1
- package/dist/filesystem/dbk-workspace.d.ts +0 -34
- package/dist/filesystem/dbk-workspace.d.ts.map +0 -1
- package/dist/filesystem/dbk-workspace.js +0 -85
- package/dist/filesystem/dbk-workspace.js.map +0 -1
- package/dist/filesystem/electron-provider-v2.d.ts +0 -36
- package/dist/filesystem/electron-provider-v2.d.ts.map +0 -1
- package/dist/filesystem/electron-provider-v2.js +0 -503
- package/dist/filesystem/electron-provider-v2.js.map +0 -1
- package/dist/filesystem/electron-provider.d.ts +0 -35
- package/dist/filesystem/electron-provider.d.ts.map +0 -1
- package/dist/filesystem/electron-provider.js +0 -69
- package/dist/filesystem/electron-provider.js.map +0 -1
- package/dist/filesystem/electron.d.ts.map +0 -1
- package/dist/filesystem/electron.js.map +0 -1
- package/dist/filesystem/file-media-provider.d.ts +0 -23
- package/dist/filesystem/file-media-provider.d.ts.map +0 -1
- package/dist/filesystem/file-media-provider.js +0 -85
- package/dist/filesystem/file-media-provider.js.map +0 -1
- package/dist/filesystem/filesystem-content-container.d.ts +0 -24
- package/dist/filesystem/filesystem-content-container.d.ts.map +0 -1
- package/dist/filesystem/filesystem-content-container.js +0 -153
- package/dist/filesystem/filesystem-content-container.js.map +0 -1
- package/dist/filesystem/fs-error.d.ts +0 -46
- package/dist/filesystem/fs-error.d.ts.map +0 -1
- package/dist/filesystem/fs-error.js +0 -170
- package/dist/filesystem/fs-error.js.map +0 -1
- package/dist/filesystem/index.d.ts.map +0 -1
- package/dist/filesystem/index.js.map +0 -1
- package/dist/filesystem/indexeddb-content-container.d.ts +0 -22
- package/dist/filesystem/indexeddb-content-container.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-content-container.js +0 -100
- package/dist/filesystem/indexeddb-content-container.js.map +0 -1
- package/dist/filesystem/indexeddb-provider-v2.d.ts +0 -96
- package/dist/filesystem/indexeddb-provider-v2.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-provider-v2.js +0 -1241
- package/dist/filesystem/indexeddb-provider-v2.js.map +0 -1
- package/dist/filesystem/indexeddb-provider.d.ts +0 -39
- package/dist/filesystem/indexeddb-provider.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-provider.js +0 -145
- package/dist/filesystem/indexeddb-provider.js.map +0 -1
- package/dist/filesystem/indexeddb-store.d.ts +0 -34
- package/dist/filesystem/indexeddb-store.d.ts.map +0 -1
- package/dist/filesystem/indexeddb-store.js +0 -165
- package/dist/filesystem/indexeddb-store.js.map +0 -1
- package/dist/filesystem/indexeddb.d.ts.map +0 -1
- package/dist/filesystem/indexeddb.js.map +0 -1
- package/dist/filesystem/legacy-v2-adapter.d.ts +0 -62
- package/dist/filesystem/legacy-v2-adapter.d.ts.map +0 -1
- package/dist/filesystem/legacy-v2-adapter.js +0 -499
- package/dist/filesystem/legacy-v2-adapter.js.map +0 -1
- package/dist/filesystem/memory-provider-v2.d.ts +0 -92
- package/dist/filesystem/memory-provider-v2.d.ts.map +0 -1
- package/dist/filesystem/memory-provider-v2.js +0 -615
- package/dist/filesystem/memory-provider-v2.js.map +0 -1
- package/dist/filesystem/memory-provider.d.ts +0 -54
- package/dist/filesystem/memory-provider.d.ts.map +0 -1
- package/dist/filesystem/memory-provider.js +0 -132
- package/dist/filesystem/memory-provider.js.map +0 -1
- package/dist/filesystem/memory.d.ts.map +0 -1
- package/dist/filesystem/memory.js.map +0 -1
- package/dist/filesystem/move-entry.d.ts +0 -9
- package/dist/filesystem/move-entry.d.ts.map +0 -1
- package/dist/filesystem/move-entry.js +0 -103
- package/dist/filesystem/move-entry.js.map +0 -1
- package/dist/filesystem/move-error.d.ts +0 -53
- package/dist/filesystem/move-error.d.ts.map +0 -1
- package/dist/filesystem/move-error.js +0 -99
- package/dist/filesystem/move-error.js.map +0 -1
- package/dist/filesystem/native-provider-v2.d.ts +0 -75
- package/dist/filesystem/native-provider-v2.d.ts.map +0 -1
- package/dist/filesystem/native-provider-v2.js +0 -849
- package/dist/filesystem/native-provider-v2.js.map +0 -1
- package/dist/filesystem/native-provider.d.ts +0 -53
- package/dist/filesystem/native-provider.d.ts.map +0 -1
- package/dist/filesystem/native-provider.js +0 -471
- package/dist/filesystem/native-provider.js.map +0 -1
- package/dist/filesystem/native.d.ts.map +0 -1
- package/dist/filesystem/native.js.map +0 -1
- package/dist/filesystem/types.d.ts +0 -83
- package/dist/filesystem/types.d.ts.map +0 -1
- package/dist/filesystem/types.js +0 -16
- package/dist/filesystem/types.js.map +0 -1
- package/dist/filesystem/v2.d.ts +0 -172
- package/dist/filesystem/v2.d.ts.map +0 -1
- package/dist/filesystem/v2.js +0 -16
- package/dist/filesystem/v2.js.map +0 -1
- package/dist/filesystem/workspace-path.d.ts +0 -21
- package/dist/filesystem/workspace-path.d.ts.map +0 -1
- package/dist/filesystem/workspace-path.js +0 -80
- package/dist/filesystem/workspace-path.js.map +0 -1
- package/dist/host/filesystem-v2.d.ts +0 -45
- package/dist/host/filesystem-v2.d.ts.map +0 -1
- package/dist/host/filesystem-v2.js +0 -13
- package/dist/host/filesystem-v2.js.map +0 -1
- package/dist/host/git.d.ts +0 -200
- package/dist/host/git.d.ts.map +0 -1
- package/dist/host/git.js +0 -15
- package/dist/host/git.js.map +0 -1
- package/dist/host/index.d.ts.map +0 -1
- package/dist/host/index.js.map +0 -1
- package/dist/host/types.d.ts +0 -232
- package/dist/host/types.d.ts.map +0 -1
- package/dist/host/types.js +0 -10
- package/dist/host/types.js.map +0 -1
- package/dist/host/wire-policy.d.ts +0 -22
- package/dist/host/wire-policy.d.ts.map +0 -1
- package/dist/host/wire-policy.js +0 -92
- package/dist/host/wire-policy.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/types.d.ts +0 -466
- package/dist/mcp/types.d.ts.map +0 -1
- package/dist/mcp/types.js +0 -25
- package/dist/mcp/types.js.map +0 -1
- package/dist/mcp/wire.d.ts +0 -29
- package/dist/mcp/wire.d.ts.map +0 -1
- package/dist/mcp/wire.js +0 -1046
- package/dist/mcp/wire.js.map +0 -1
- package/dist/mcp/zod.d.ts.map +0 -1
- package/dist/mcp/zod.js.map +0 -1
- package/dist/vscode/index.d.ts.map +0 -1
- package/dist/vscode/index.js.map +0 -1
- package/dist/vscode/messages.d.ts +0 -204
- package/dist/vscode/messages.d.ts.map +0 -1
- package/dist/vscode/messages.js +0 -494
- package/dist/vscode/messages.js.map +0 -1
- package/dist/workspace/index.d.ts.map +0 -1
- package/dist/workspace/index.js.map +0 -1
- package/dist/workspace/reconcile-electron.d.ts +0 -19
- package/dist/workspace/reconcile-electron.d.ts.map +0 -1
- package/dist/workspace/reconcile-electron.js +0 -42
- package/dist/workspace/reconcile-electron.js.map +0 -1
- package/dist/workspace/types.d.ts +0 -69
- package/dist/workspace/types.d.ts.map +0 -1
- package/dist/workspace/types.js +0 -2
- package/dist/workspace/types.js.map +0 -1
- package/dist/workspace/workspace-manager.d.ts +0 -47
- package/dist/workspace/workspace-manager.d.ts.map +0 -1
- package/dist/workspace/workspace-manager.js +0 -126
- package/dist/workspace/workspace-manager.js.map +0 -1
- package/src/document/document-session.ts +0 -834
- package/src/document/filesystem-target.ts +0 -109
- package/src/document/index.ts +0 -41
- package/src/document/recovery-journal.ts +0 -536
- package/src/document/types.ts +0 -116
- package/src/filesystem/commit-lock.ts +0 -29
- package/src/filesystem/dbk-workspace.ts +0 -135
- package/src/filesystem/electron-provider-v2.ts +0 -630
- package/src/filesystem/electron-provider.ts +0 -99
- package/src/filesystem/electron.ts +0 -3
- package/src/filesystem/file-media-provider.ts +0 -103
- package/src/filesystem/filesystem-content-container.ts +0 -164
- package/src/filesystem/fs-error.ts +0 -234
- package/src/filesystem/index.ts +0 -143
- package/src/filesystem/indexeddb-content-container.ts +0 -112
- package/src/filesystem/indexeddb-provider-v2.ts +0 -1740
- package/src/filesystem/indexeddb-provider.ts +0 -171
- package/src/filesystem/indexeddb-store.ts +0 -207
- package/src/filesystem/indexeddb.ts +0 -12
- package/src/filesystem/legacy-v2-adapter.ts +0 -779
- package/src/filesystem/memory-provider-v2.ts +0 -896
- package/src/filesystem/memory-provider.ts +0 -180
- package/src/filesystem/memory.ts +0 -15
- package/src/filesystem/move-entry.ts +0 -142
- package/src/filesystem/move-error.ts +0 -159
- package/src/filesystem/native-provider-v2.ts +0 -1165
- package/src/filesystem/native-provider.ts +0 -537
- package/src/filesystem/native.ts +0 -16
- package/src/filesystem/types.ts +0 -114
- package/src/filesystem/v2.ts +0 -231
- package/src/filesystem/workspace-path.ts +0 -92
- package/src/host/filesystem-v2.ts +0 -104
- package/src/host/git.ts +0 -246
- package/src/host/index.ts +0 -93
- package/src/host/types.ts +0 -274
- package/src/host/wire-policy.ts +0 -103
- package/src/index.ts +0 -10
- package/src/mcp/index.ts +0 -3
- package/src/mcp/types.ts +0 -594
- package/src/mcp/wire.ts +0 -1280
- package/src/mcp/zod.ts +0 -1000
- package/src/vscode/index.ts +0 -2
- package/src/vscode/messages.ts +0 -704
- package/src/workspace/index.ts +0 -17
- package/src/workspace/reconcile-electron.ts +0 -65
- package/src/workspace/types.ts +0 -67
- package/src/workspace/workspace-manager.ts +0 -151
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
|
+
parentChainWithRoot
|
|
3
|
+
} from "./chunk-KQ6756AJ.js";
|
|
4
|
+
import {
|
|
5
|
+
compareSnapshotsByName,
|
|
6
|
+
compareText,
|
|
7
|
+
copyBytes,
|
|
2
8
|
parseFileSystemVersion
|
|
3
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-M62ZGJ5I.js";
|
|
10
|
+
import {
|
|
11
|
+
decodeUtf8Text
|
|
12
|
+
} from "./chunk-M5ZNQGR5.js";
|
|
4
13
|
import {
|
|
5
14
|
FsError,
|
|
6
15
|
WORKSPACE_ROOT,
|
|
@@ -8,7 +17,7 @@ import {
|
|
|
8
17
|
workspacePathBasename,
|
|
9
18
|
workspacePathContains,
|
|
10
19
|
workspacePathDirname
|
|
11
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-AYWKIZLD.js";
|
|
12
21
|
|
|
13
22
|
// src/filesystem/memory-provider-v2.ts
|
|
14
23
|
var MEMORY_CAPABILITIES = Object.freeze({
|
|
@@ -126,7 +135,7 @@ var MemoryFileSystemProviderV2 = class {
|
|
|
126
135
|
"Replacement path has conflicting file and directory kinds."
|
|
127
136
|
);
|
|
128
137
|
}
|
|
129
|
-
for (const parent of
|
|
138
|
+
for (const parent of parentChainWithRoot(path)) {
|
|
130
139
|
if (parent && stagedFiles.has(parent)) {
|
|
131
140
|
throw this.error("type-mismatch", "write", parent, "A replacement parent is a file.");
|
|
132
141
|
}
|
|
@@ -185,8 +194,12 @@ var MemoryFileSystemProviderV2 = class {
|
|
|
185
194
|
if (existing?.kind === "directory") {
|
|
186
195
|
throw this.error("type-mismatch", "write", canonical, "Cannot replace a directory.");
|
|
187
196
|
}
|
|
188
|
-
const currentContent = existing?.kind === "file"
|
|
189
|
-
|
|
197
|
+
const currentContent = existing?.kind === "file" ? decodeUtf8Text(existing.data, {
|
|
198
|
+
label: "The stored file",
|
|
199
|
+
operation: "write",
|
|
200
|
+
path: canonical
|
|
201
|
+
}) : null;
|
|
202
|
+
if (currentContent !== expectedContent && currentContent !== content) {
|
|
190
203
|
return {
|
|
191
204
|
status: "conflict",
|
|
192
205
|
content: currentContent,
|
|
@@ -246,7 +259,7 @@ var MemoryFileSystemProviderV2 = class {
|
|
|
246
259
|
children.push(this.toEntrySnapshot(entryPath2, entry));
|
|
247
260
|
}
|
|
248
261
|
}
|
|
249
|
-
children.sort(
|
|
262
|
+
children.sort(compareSnapshotsByName);
|
|
250
263
|
return Object.freeze(children);
|
|
251
264
|
}
|
|
252
265
|
async writeFile(path, data, options = {}) {
|
|
@@ -537,7 +550,7 @@ var MemoryFileSystemProviderV2 = class {
|
|
|
537
550
|
}
|
|
538
551
|
planParents(path, createParents, operation) {
|
|
539
552
|
const missing = [];
|
|
540
|
-
for (const parent of
|
|
553
|
+
for (const parent of parentChainWithRoot(path)) {
|
|
541
554
|
if (!parent) continue;
|
|
542
555
|
const entry = this.entries.get(parent);
|
|
543
556
|
if (entry?.kind === "file") {
|
|
@@ -563,7 +576,7 @@ var MemoryFileSystemProviderV2 = class {
|
|
|
563
576
|
}
|
|
564
577
|
}
|
|
565
578
|
touchParents(target, path, version, lastModified) {
|
|
566
|
-
for (const parent of
|
|
579
|
+
for (const parent of parentChainWithRoot(path)) {
|
|
567
580
|
const entry = target.get(parent);
|
|
568
581
|
if (entry?.kind === "directory") {
|
|
569
582
|
target.set(parent, { kind: "directory", version, lastModified });
|
|
@@ -635,36 +648,14 @@ var MemoryFileSystemProviderV2 = class {
|
|
|
635
648
|
return new FsError(code, message, { operation, path });
|
|
636
649
|
}
|
|
637
650
|
};
|
|
638
|
-
function parentChain(path) {
|
|
639
|
-
const parents = [];
|
|
640
|
-
let current = workspacePathDirname(path);
|
|
641
|
-
while (true) {
|
|
642
|
-
parents.unshift(current);
|
|
643
|
-
if (!current) return parents;
|
|
644
|
-
current = workspacePathDirname(current);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
651
|
function addParentPaths(target, path) {
|
|
648
|
-
for (const parent of
|
|
652
|
+
for (const parent of parentChainWithRoot(path)) {
|
|
649
653
|
if (parent) target.add(parent);
|
|
650
654
|
}
|
|
651
655
|
}
|
|
652
656
|
function isMemoryFilePayloadKind(value) {
|
|
653
657
|
return value === "text" || value === "binary";
|
|
654
658
|
}
|
|
655
|
-
function copyBytes(data) {
|
|
656
|
-
const source = ArrayBuffer.isView(data) ? new Uint8Array(data.buffer, data.byteOffset, data.byteLength) : new Uint8Array(data);
|
|
657
|
-
const copy = new Uint8Array(source.byteLength);
|
|
658
|
-
copy.set(source);
|
|
659
|
-
return copy.buffer;
|
|
660
|
-
}
|
|
661
|
-
function compareSnapshots(left, right) {
|
|
662
|
-
if (left.kind !== right.kind) return left.kind === "directory" ? -1 : 1;
|
|
663
|
-
return compareText(left.name, right.name);
|
|
664
|
-
}
|
|
665
|
-
function compareText(left, right) {
|
|
666
|
-
return left < right ? -1 : left > right ? 1 : 0;
|
|
667
|
-
}
|
|
668
659
|
|
|
669
660
|
// src/filesystem/memory-provider.ts
|
|
670
661
|
function canonicalPath(path) {
|
|
@@ -680,8 +671,8 @@ function entryPath(path, operation) {
|
|
|
680
671
|
}
|
|
681
672
|
return canonical;
|
|
682
673
|
}
|
|
683
|
-
function decode(data) {
|
|
684
|
-
return
|
|
674
|
+
function decode(data, path) {
|
|
675
|
+
return decodeUtf8Text(data, { label: "The file", operation: "read", path });
|
|
685
676
|
}
|
|
686
677
|
var MemoryFileSystemProvider = class {
|
|
687
678
|
constructor(id, label) {
|
|
@@ -698,7 +689,7 @@ var MemoryFileSystemProvider = class {
|
|
|
698
689
|
const state = this.v2.captureState();
|
|
699
690
|
return {
|
|
700
691
|
files: state.files.map(
|
|
701
|
-
(file) => file.payloadKind === "text" ? { kind: "text", path: file.path, content: decode(file.data) } : { kind: "binary", path: file.path, data: file.data.slice(0) }
|
|
692
|
+
(file) => file.payloadKind === "text" ? { kind: "text", path: file.path, content: decode(file.data, file.path) } : { kind: "binary", path: file.path, data: file.data.slice(0) }
|
|
702
693
|
),
|
|
703
694
|
directories: [...state.directories]
|
|
704
695
|
};
|
|
@@ -720,20 +711,21 @@ var MemoryFileSystemProvider = class {
|
|
|
720
711
|
this.v2.seedText(entryPath(path, "write"), content);
|
|
721
712
|
}
|
|
722
713
|
async readFile(path) {
|
|
723
|
-
const
|
|
724
|
-
|
|
714
|
+
const canonical = canonicalPath(path);
|
|
715
|
+
const file = await this.v2.readFile(canonical);
|
|
716
|
+
return file ? decode(file.data, canonical) : null;
|
|
725
717
|
}
|
|
726
718
|
async writeFile(path, content) {
|
|
727
|
-
await this.v2.writeText(
|
|
719
|
+
await this.v2.writeText(canonicalPath(path), content, { createParents: true });
|
|
728
720
|
}
|
|
729
721
|
commitFile(path, content, expectedContent) {
|
|
730
|
-
return this.v2.commitText(
|
|
722
|
+
return this.v2.commitText(canonicalPath(path), content, expectedContent);
|
|
731
723
|
}
|
|
732
724
|
async delete(path) {
|
|
733
|
-
await this.v2.remove(
|
|
725
|
+
await this.v2.remove(canonicalPath(path), { recursive: true, missing: "ignore" });
|
|
734
726
|
}
|
|
735
727
|
async rename(oldPath, newPath) {
|
|
736
|
-
await this.v2.move(
|
|
728
|
+
await this.v2.move(canonicalPath(oldPath), canonicalPath(newPath), {
|
|
737
729
|
createParents: true
|
|
738
730
|
});
|
|
739
731
|
}
|
|
@@ -758,9 +750,7 @@ var MemoryFileSystemProvider = class {
|
|
|
758
750
|
await this.v2.createDirectory(canonicalPath(path), { createParents: true });
|
|
759
751
|
}
|
|
760
752
|
async stat(path) {
|
|
761
|
-
const
|
|
762
|
-
if (!canonical) return null;
|
|
763
|
-
const entry = await this.v2.stat(canonical);
|
|
753
|
+
const entry = await this.v2.stat(canonicalPath(path));
|
|
764
754
|
if (!entry || entry.kind !== "file") return null;
|
|
765
755
|
return {
|
|
766
756
|
name: entry.name,
|
|
@@ -769,14 +759,17 @@ var MemoryFileSystemProvider = class {
|
|
|
769
759
|
lastModified: entry.lastModified
|
|
770
760
|
};
|
|
771
761
|
}
|
|
762
|
+
/**
|
|
763
|
+
* Every stored file is bytes, so every stored file is readable as binary.
|
|
764
|
+
* `payloadKind` records how a file was written for DBK export fidelity; it is
|
|
765
|
+
* not a filter. Gating on it made `readBinary` report an existing text file as
|
|
766
|
+
* missing, which no other provider does and which callers read as "no file".
|
|
767
|
+
*/
|
|
772
768
|
async readBinary(path) {
|
|
773
|
-
|
|
774
|
-
const file = this.v2.readCompatibilityFile(canonical);
|
|
775
|
-
if (!file || file.payloadKind !== "binary") return null;
|
|
776
|
-
return file.data;
|
|
769
|
+
return this.v2.readCompatibilityFile(canonicalPath(path))?.data ?? null;
|
|
777
770
|
}
|
|
778
771
|
async writeBinary(path, data) {
|
|
779
|
-
await this.v2.writeBinary(
|
|
772
|
+
await this.v2.writeBinary(canonicalPath(path), data, { createParents: true });
|
|
780
773
|
}
|
|
781
774
|
};
|
|
782
775
|
|
|
@@ -784,4 +777,3 @@ export {
|
|
|
784
777
|
MemoryFileSystemProviderV2,
|
|
785
778
|
MemoryFileSystemProvider
|
|
786
779
|
};
|
|
787
|
-
//# sourceMappingURL=chunk-RQJRQF46.js.map
|
package/dist/document/index.d.ts
CHANGED
|
@@ -1,6 +1,358 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { q as FileSystemProvider } from '../types-BEg5SQ1_.js';
|
|
2
|
+
import '../workspace-path-CWVrcuPL.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Synchronous crash-recovery journal for dirty document snapshots.
|
|
6
|
+
*
|
|
7
|
+
* The journal deliberately depends on a tiny injected Storage-like contract
|
|
8
|
+
* instead of reading `window.localStorage` at module load time. This keeps the
|
|
9
|
+
* document package usable in Node, Electron main, VS Code extension hosts, and
|
|
10
|
+
* tests while allowing browser renderers to use localStorage for a best-effort
|
|
11
|
+
* write that completes before the current JavaScript turn ends.
|
|
12
|
+
*/
|
|
13
|
+
declare const DOCUMENT_RECOVERY_JOURNAL_STORAGE_KEY = "docblocks:document-recovery:v1";
|
|
14
|
+
declare const DOCUMENT_RECOVERY_JOURNAL_SCHEMA_VERSION = 1;
|
|
15
|
+
interface DocumentRecoveryStorage {
|
|
16
|
+
getItem(key: string): string | null;
|
|
17
|
+
setItem(key: string, value: string): void;
|
|
18
|
+
removeItem(key: string): void;
|
|
19
|
+
}
|
|
20
|
+
interface DocumentRecoveryRecord {
|
|
21
|
+
/** Stable commit-target key, including the workspace/provider scope. */
|
|
22
|
+
targetKey: string;
|
|
23
|
+
/** DocumentSession generation that produced this snapshot. */
|
|
24
|
+
generation: number;
|
|
25
|
+
/** Monotonic DocumentSession revision represented by `content`. */
|
|
26
|
+
revision: number;
|
|
27
|
+
/** Complete markdown snapshot. */
|
|
28
|
+
content: string;
|
|
29
|
+
/**
|
|
30
|
+
* Content last acknowledged by the commit target when this draft was made.
|
|
31
|
+
* Recovery may be applied automatically only when storage still matches this
|
|
32
|
+
* baseline; otherwise the caller must surface an external-change conflict.
|
|
33
|
+
*/
|
|
34
|
+
persistedContent: string | null;
|
|
35
|
+
/** Time the dirty record for this target was first created. */
|
|
36
|
+
createdAt: number;
|
|
37
|
+
/** Time the record was most recently replaced. */
|
|
38
|
+
updatedAt: number;
|
|
39
|
+
}
|
|
40
|
+
interface DocumentRecoveryWrite {
|
|
41
|
+
targetKey: string;
|
|
42
|
+
generation: number;
|
|
43
|
+
revision: number;
|
|
44
|
+
content: string;
|
|
45
|
+
persistedContent: string | null;
|
|
46
|
+
}
|
|
47
|
+
interface DocumentRecoveryAcknowledgement {
|
|
48
|
+
targetKey: string;
|
|
49
|
+
generation: number;
|
|
50
|
+
/** Highest revision durably acknowledged by the commit target. */
|
|
51
|
+
persistedRevision: number;
|
|
52
|
+
}
|
|
53
|
+
type DocumentRecoveryWriteFailure = 'invalid-record' | 'record-too-large' | 'storage-unavailable' | 'quota-exceeded';
|
|
54
|
+
type DocumentRecoveryWriteResult = {
|
|
55
|
+
status: 'stored';
|
|
56
|
+
evicted: number;
|
|
57
|
+
} | {
|
|
58
|
+
status: 'unchanged';
|
|
59
|
+
evicted: 0;
|
|
60
|
+
} | {
|
|
61
|
+
status: 'ignored-stale';
|
|
62
|
+
evicted: 0;
|
|
63
|
+
} | {
|
|
64
|
+
status: 'rejected';
|
|
65
|
+
reason: DocumentRecoveryWriteFailure;
|
|
66
|
+
evicted: number;
|
|
67
|
+
};
|
|
68
|
+
interface DocumentRecoveryJournalOptions {
|
|
69
|
+
storageKey?: string;
|
|
70
|
+
/** Maximum number of document records retained. Defaults to 20. */
|
|
71
|
+
maxEntries?: number;
|
|
72
|
+
/** Conservative UTF-16 estimate for the whole serialized journal. */
|
|
73
|
+
maxStorageBytes?: number;
|
|
74
|
+
/** Conservative UTF-16 estimate for one serialized record. */
|
|
75
|
+
maxRecordBytes?: number;
|
|
76
|
+
/** Records older than this are discarded while reading. Defaults to 7 days. */
|
|
77
|
+
maxAgeMs?: number;
|
|
78
|
+
/** Tolerated clock skew for records dated in the future. Defaults to 5 minutes. */
|
|
79
|
+
maxFutureSkewMs?: number;
|
|
80
|
+
/** Injected for deterministic tests. */
|
|
81
|
+
now?: () => number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Best-effort, synchronous recovery storage.
|
|
85
|
+
*
|
|
86
|
+
* Normal save acknowledgement is the only automatic path that removes the
|
|
87
|
+
* current record. Explicit discard, age expiry, corruption repair, and bounded
|
|
88
|
+
* eviction are intentional exceptions: callers can discard after the user
|
|
89
|
+
* rejects recovery, and the journal must never grow without limit.
|
|
90
|
+
*/
|
|
91
|
+
declare class DocumentRecoveryJournal {
|
|
92
|
+
private readonly storage;
|
|
93
|
+
private readonly storageKey;
|
|
94
|
+
private readonly maxEntries;
|
|
95
|
+
private readonly maxStorageBytes;
|
|
96
|
+
private readonly maxRecordBytes;
|
|
97
|
+
private readonly maxAgeMs;
|
|
98
|
+
private readonly maxFutureSkewMs;
|
|
99
|
+
private readonly now;
|
|
100
|
+
constructor(storage: DocumentRecoveryStorage | null, options?: DocumentRecoveryJournalOptions);
|
|
101
|
+
/**
|
|
102
|
+
* Synchronously persist the latest dirty snapshot for a target.
|
|
103
|
+
* Storage/quota failures are returned, never thrown into an editor onChange.
|
|
104
|
+
*/
|
|
105
|
+
write(input: DocumentRecoveryWrite): DocumentRecoveryWriteResult;
|
|
106
|
+
/** Return the recoverable snapshot for one target, if present and valid. */
|
|
107
|
+
lookup(targetKey: string, generation?: number): DocumentRecoveryRecord | null;
|
|
108
|
+
/** List valid records, newest first. Optionally restrict to one target. */
|
|
109
|
+
list(targetKey?: string): DocumentRecoveryRecord[];
|
|
110
|
+
/**
|
|
111
|
+
* Clear a record only when the same generation has durably acknowledged at
|
|
112
|
+
* least the journaled revision. A stale acknowledgement cannot erase a newer
|
|
113
|
+
* crash-recovery snapshot.
|
|
114
|
+
*/
|
|
115
|
+
acknowledge(input: DocumentRecoveryAcknowledgement): boolean;
|
|
116
|
+
/** Explicitly discard recovery data after a user or lifecycle decision. */
|
|
117
|
+
discard(targetKey: string, generation?: number): boolean;
|
|
118
|
+
private load;
|
|
119
|
+
private persistBounded;
|
|
120
|
+
private persistExact;
|
|
121
|
+
private tryRemove;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Resolve browser localStorage on demand. Importing this module never touches
|
|
125
|
+
* browser globals, and access errors (sandboxing/security settings) yield null.
|
|
126
|
+
*/
|
|
127
|
+
declare function getDefaultDocumentRecoveryStorage(): DocumentRecoveryStorage | null;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Framework-neutral document persistence contracts.
|
|
131
|
+
*
|
|
132
|
+
* A DocumentSession owns one logical document at a time. Storage-specific
|
|
133
|
+
* adapters implement DocumentCommitTarget; the session owns revisions,
|
|
134
|
+
* serialization, lifecycle transitions, and conflict state.
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
type DocumentSaveReason = 'autosave' | 'manual' | 'transition' | 'close' | 'backup' | 'conflict';
|
|
138
|
+
type DocumentExternalVersion = string | number | null;
|
|
139
|
+
interface DocumentCommitRequest {
|
|
140
|
+
/** Stable key for the target this commit was created for. */
|
|
141
|
+
targetKey: string;
|
|
142
|
+
/** Latest complete document snapshot to persist. */
|
|
143
|
+
content: string;
|
|
144
|
+
/** Monotonic session revision represented by content. */
|
|
145
|
+
revision: number;
|
|
146
|
+
/** Most recent revision acknowledged by this target. */
|
|
147
|
+
persistedRevision: number;
|
|
148
|
+
/** Content last acknowledged by the target, or null if it did not exist. */
|
|
149
|
+
persistedContent: string | null;
|
|
150
|
+
reason: DocumentSaveReason;
|
|
151
|
+
}
|
|
152
|
+
interface DocumentCommitResult {
|
|
153
|
+
/** Optional backend version (mtime, TextDocument.version, etag, and so on). */
|
|
154
|
+
version?: DocumentExternalVersion;
|
|
155
|
+
}
|
|
156
|
+
interface DocumentCommitTarget {
|
|
157
|
+
readonly key: string;
|
|
158
|
+
commit(request: DocumentCommitRequest): Promise<DocumentCommitResult | void>;
|
|
159
|
+
}
|
|
160
|
+
type DocumentSessionStatus = 'idle' | 'saved' | 'dirty' | 'saving' | 'error' | 'conflict' | 'closed';
|
|
161
|
+
type DocumentSessionLifecycle = 'open' | 'transitioning' | 'closing' | 'closed';
|
|
162
|
+
interface DocumentExternalSnapshot {
|
|
163
|
+
/** Target key captured before the external read began. */
|
|
164
|
+
targetKey: string;
|
|
165
|
+
/** Monotonic observation number assigned by the target watcher. */
|
|
166
|
+
sequence?: number;
|
|
167
|
+
/** Null represents an externally deleted document. */
|
|
168
|
+
content: string | null;
|
|
169
|
+
version?: DocumentExternalVersion;
|
|
170
|
+
}
|
|
171
|
+
interface DocumentSessionConflict {
|
|
172
|
+
targetKey: string;
|
|
173
|
+
localContent: string;
|
|
174
|
+
localRevision: number;
|
|
175
|
+
externalContent: string | null;
|
|
176
|
+
externalVersion: DocumentExternalVersion;
|
|
177
|
+
}
|
|
178
|
+
interface DocumentSessionSnapshot {
|
|
179
|
+
targetKey: string | null;
|
|
180
|
+
content: string;
|
|
181
|
+
revision: number;
|
|
182
|
+
persistedRevision: number;
|
|
183
|
+
persistedContent: string | null;
|
|
184
|
+
savingRevision: number | null;
|
|
185
|
+
generation: number;
|
|
186
|
+
status: DocumentSessionStatus;
|
|
187
|
+
lifecycle: DocumentSessionLifecycle;
|
|
188
|
+
frozen: boolean;
|
|
189
|
+
error: Error | null;
|
|
190
|
+
conflict: DocumentSessionConflict | null;
|
|
191
|
+
}
|
|
192
|
+
interface DocumentSessionOptions {
|
|
193
|
+
autoSaveDelayMs?: number;
|
|
194
|
+
/** Whether edits schedule automatic persistence. Manual and lifecycle flushes remain available. */
|
|
195
|
+
autoSaveEnabled?: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Bounded delays used after an automatic save fails. Each entry permits
|
|
198
|
+
* one retry; exhausting the list leaves the session in error state until
|
|
199
|
+
* the user edits again or explicitly flushes it. Conflicts never retry.
|
|
200
|
+
*/
|
|
201
|
+
autoSaveRetryDelaysMs?: readonly number[];
|
|
202
|
+
/** Optional synchronous crash-recovery journal owned by this session. */
|
|
203
|
+
recoveryJournal?: DocumentRecoveryJournal | null;
|
|
204
|
+
}
|
|
205
|
+
/** Scope captured by an editor instance when it mounts. */
|
|
206
|
+
interface DocumentSessionEditScope {
|
|
207
|
+
targetKey: string;
|
|
208
|
+
generation: number;
|
|
209
|
+
}
|
|
210
|
+
/** Result produced while a session transition is frozen. */
|
|
211
|
+
interface DocumentSessionTransition {
|
|
212
|
+
target: DocumentCommitTarget | null;
|
|
213
|
+
content: string;
|
|
214
|
+
}
|
|
215
|
+
type DocumentExternalChangeResult = 'applied' | 'conflict' | 'ignored';
|
|
216
|
+
type DocumentConflictStrategy = 'use-local' | 'use-external';
|
|
217
|
+
|
|
218
|
+
type SessionListener = () => void;
|
|
219
|
+
/**
|
|
220
|
+
* Raised by a commit target when optimistic external-change verification
|
|
221
|
+
* fails. The session converts it into durable conflict state.
|
|
222
|
+
*/
|
|
223
|
+
declare class DocumentCommitConflictError extends Error {
|
|
224
|
+
readonly externalContent: string | null;
|
|
225
|
+
readonly externalVersion: string | number | null;
|
|
226
|
+
constructor(message: string, externalContent: string | null, externalVersion?: string | number | null);
|
|
227
|
+
}
|
|
228
|
+
declare class DocumentSessionConflictError extends Error {
|
|
229
|
+
readonly conflict: DocumentSessionConflict;
|
|
230
|
+
constructor(conflict: DocumentSessionConflict);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* A revisioned, serialized persistence boundary for one active document.
|
|
234
|
+
*
|
|
235
|
+
* Invariants:
|
|
236
|
+
* - only drain() calls target.commit();
|
|
237
|
+
* - at most one commit is in flight;
|
|
238
|
+
* - revisions never decrease, including across target transitions;
|
|
239
|
+
* - destructive operations wait for an in-flight commit and run last;
|
|
240
|
+
* - a target is never changed by a React effect cleanup.
|
|
241
|
+
*/
|
|
242
|
+
declare class DocumentSession {
|
|
243
|
+
private readonly autoSaveDelayMs;
|
|
244
|
+
private readonly autoSaveRetryDelaysMs;
|
|
245
|
+
private readonly recoveryJournal;
|
|
246
|
+
private readonly listeners;
|
|
247
|
+
private autoSaveEnabled;
|
|
248
|
+
private target;
|
|
249
|
+
private content;
|
|
250
|
+
private persistedContent;
|
|
251
|
+
private revision;
|
|
252
|
+
private persistedRevision;
|
|
253
|
+
private savingRevision;
|
|
254
|
+
private savingContent;
|
|
255
|
+
private generation;
|
|
256
|
+
private externalSequence;
|
|
257
|
+
private lifecycle;
|
|
258
|
+
private frozen;
|
|
259
|
+
private error;
|
|
260
|
+
private conflict;
|
|
261
|
+
private autoSaveTimer;
|
|
262
|
+
private autoSaveRetryAttempt;
|
|
263
|
+
private drainPromise;
|
|
264
|
+
private haltDrain;
|
|
265
|
+
private operationTail;
|
|
266
|
+
private snapshot;
|
|
267
|
+
constructor(options?: DocumentSessionOptions);
|
|
268
|
+
readonly subscribe: (listener: SessionListener) => (() => void);
|
|
269
|
+
readonly getSnapshot: () => DocumentSessionSnapshot;
|
|
270
|
+
/** Enable or disable automatic persistence without weakening explicit or lifecycle flushes. */
|
|
271
|
+
setAutoSaveEnabled(enabled: boolean): void;
|
|
272
|
+
/**
|
|
273
|
+
* Record a complete local snapshot and schedule its persistence.
|
|
274
|
+
* Returns the assigned monotonic revision.
|
|
275
|
+
*/
|
|
276
|
+
edit(content: string, scope: DocumentSessionEditScope): number;
|
|
277
|
+
/**
|
|
278
|
+
* Persist the revision current when flush() is called. A later edit may
|
|
279
|
+
* advance the session again, but commits remain strictly serialized.
|
|
280
|
+
*/
|
|
281
|
+
flush(reason?: DocumentSaveReason): Promise<DocumentSessionSnapshot>;
|
|
282
|
+
/**
|
|
283
|
+
* Flush the old document, then replace it with a new clean baseline.
|
|
284
|
+
* UI state should change only after this promise resolves.
|
|
285
|
+
*/
|
|
286
|
+
transitionTo(target: DocumentCommitTarget | null, content: string): Promise<DocumentSessionSnapshot>;
|
|
287
|
+
/**
|
|
288
|
+
* Freeze and flush the current document before reading the next one. The
|
|
289
|
+
* loader may return null when a navigation request was superseded, leaving
|
|
290
|
+
* the current target active and clean.
|
|
291
|
+
*/
|
|
292
|
+
transitionWithLoad(load: () => Promise<DocumentSessionTransition | null>): Promise<DocumentSessionSnapshot | null>;
|
|
293
|
+
/**
|
|
294
|
+
* Flush the current path, run the storage move, and only then swap the
|
|
295
|
+
* commit target. No edit can enter between those steps.
|
|
296
|
+
*/
|
|
297
|
+
retarget(nextTarget: DocumentCommitTarget, moveStorage: () => Promise<void>): Promise<DocumentSessionSnapshot>;
|
|
298
|
+
/**
|
|
299
|
+
* Cancel queued writes, wait for an already-running write, then delete.
|
|
300
|
+
* The deletion is therefore the final storage operation for this target.
|
|
301
|
+
*/
|
|
302
|
+
delete(deleteStorage: () => Promise<void>): Promise<DocumentSessionSnapshot>;
|
|
303
|
+
/**
|
|
304
|
+
* Discard queued changes and detach without mutating storage. This is used
|
|
305
|
+
* for explicitly abandoned sessions, never as an implicit effect cleanup.
|
|
306
|
+
*/
|
|
307
|
+
cancel(): Promise<DocumentSessionSnapshot>;
|
|
308
|
+
/**
|
|
309
|
+
* Observe a filesystem/host change captured for targetKey. Clean sessions
|
|
310
|
+
* adopt it. Dirty or saving sessions preserve local text and enter conflict.
|
|
311
|
+
*/
|
|
312
|
+
observeExternal(change: DocumentExternalSnapshot): DocumentExternalChangeResult;
|
|
313
|
+
resolveConflict(strategy: DocumentConflictStrategy): Promise<DocumentSessionSnapshot>;
|
|
314
|
+
/**
|
|
315
|
+
* Freeze edits and flush through the latest revision. A successful call
|
|
316
|
+
* remains frozen until cancelClose(); the owning host may now destroy it.
|
|
317
|
+
*/
|
|
318
|
+
prepareClose(): Promise<DocumentSessionSnapshot>;
|
|
319
|
+
/** Resume editing when a host cancels a prepared close. */
|
|
320
|
+
cancelClose(): void;
|
|
321
|
+
private performTransition;
|
|
322
|
+
private scheduleAutoSave;
|
|
323
|
+
private clearAutoSaveTimer;
|
|
324
|
+
private ensureDrain;
|
|
325
|
+
private drain;
|
|
326
|
+
private awaitActiveDrain;
|
|
327
|
+
/**
|
|
328
|
+
* Rehydrate a synchronous crash snapshot after the durable baseline has
|
|
329
|
+
* been read. A matching baseline is safe to resume as dirty; a changed
|
|
330
|
+
* baseline becomes an explicit conflict and is never auto-overwritten.
|
|
331
|
+
*/
|
|
332
|
+
private restoreRecoverySnapshot;
|
|
333
|
+
private writeRecoverySnapshot;
|
|
334
|
+
private discardRecoverySnapshot;
|
|
335
|
+
private detach;
|
|
336
|
+
private assertNotPreparingClose;
|
|
337
|
+
private enqueueOperation;
|
|
338
|
+
private createSnapshot;
|
|
339
|
+
private computeStatus;
|
|
340
|
+
private emit;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
interface FileSystemDocumentTargetOptions {
|
|
344
|
+
/**
|
|
345
|
+
* Compare the current file with the session's persisted baseline before
|
|
346
|
+
* replacing it. Enabled by default.
|
|
347
|
+
*/
|
|
348
|
+
verifyExternalChanges?: boolean;
|
|
349
|
+
onCommitted?: (content: string, revision: number) => void;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Adapt a FileSystemProvider path to the commit protocol used by
|
|
353
|
+
* DocumentSession. The optimistic read catches external edits/deletions
|
|
354
|
+
* before a local write recreates or silently replaces them.
|
|
355
|
+
*/
|
|
356
|
+
declare function createFileSystemDocumentTarget(provider: FileSystemProvider, path: string, options?: FileSystemDocumentTargetOptions): DocumentCommitTarget;
|
|
357
|
+
|
|
358
|
+
export { DOCUMENT_RECOVERY_JOURNAL_SCHEMA_VERSION, DOCUMENT_RECOVERY_JOURNAL_STORAGE_KEY, DocumentCommitConflictError, type DocumentCommitRequest, type DocumentCommitResult, type DocumentCommitTarget, type DocumentConflictStrategy, type DocumentExternalChangeResult, type DocumentExternalSnapshot, type DocumentExternalVersion, type DocumentRecoveryAcknowledgement, DocumentRecoveryJournal, type DocumentRecoveryJournalOptions, type DocumentRecoveryRecord, type DocumentRecoveryStorage, type DocumentRecoveryWrite, type DocumentRecoveryWriteFailure, type DocumentRecoveryWriteResult, type DocumentSaveReason, DocumentSession, type DocumentSessionConflict, DocumentSessionConflictError, type DocumentSessionEditScope, type DocumentSessionLifecycle, type DocumentSessionOptions, type DocumentSessionSnapshot, type DocumentSessionStatus, type DocumentSessionTransition, type FileSystemDocumentTargetOptions, createFileSystemDocumentTarget, getDefaultDocumentRecoveryStorage };
|
package/dist/document/index.js
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
DOCUMENT_RECOVERY_JOURNAL_SCHEMA_VERSION,
|
|
3
|
+
DOCUMENT_RECOVERY_JOURNAL_STORAGE_KEY,
|
|
4
|
+
DocumentCommitConflictError,
|
|
5
|
+
DocumentRecoveryJournal,
|
|
6
|
+
DocumentSession,
|
|
7
|
+
DocumentSessionConflictError,
|
|
8
|
+
createFileSystemDocumentTarget,
|
|
9
|
+
getDefaultDocumentRecoveryStorage
|
|
10
|
+
} from "../chunk-6L3JRDE7.js";
|
|
11
|
+
import "../chunk-QI6YKTQV.js";
|
|
12
|
+
import "../chunk-M5ZNQGR5.js";
|
|
13
|
+
import "../chunk-AYWKIZLD.js";
|
|
14
|
+
import "../chunk-XAMILHQP.js";
|
|
15
|
+
export {
|
|
16
|
+
DOCUMENT_RECOVERY_JOURNAL_SCHEMA_VERSION,
|
|
17
|
+
DOCUMENT_RECOVERY_JOURNAL_STORAGE_KEY,
|
|
18
|
+
DocumentCommitConflictError,
|
|
19
|
+
DocumentRecoveryJournal,
|
|
20
|
+
DocumentSession,
|
|
21
|
+
DocumentSessionConflictError,
|
|
22
|
+
createFileSystemDocumentTarget,
|
|
23
|
+
getDefaultDocumentRecoveryStorage
|
|
24
|
+
};
|
|
@@ -1,4 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
|
|
1
|
+
import { s as FileSystemProviderV2, r as FileSystemProviderCapabilities, k as FileSystemEntrySnapshot, m as FileSystemFileRead, K as FileSystemWriteOptions, n as FileSystemFileSnapshot, g as FileSystemCreateDirectoryOptions, h as FileSystemDirectorySnapshot, u as FileSystemRemoveOptions, v as FileSystemRemoveResult, o as FileSystemMoveOptions, w as FileSystemSnapshot, C as FileSystemWatchEvent, H as FileSystemWatchOptions, I as FileSystemWatchSubscription, q as FileSystemProvider, F as FileCommitResult, j as FileSystemEntry, b as FileMeta } from '../types-BEg5SQ1_.js';
|
|
2
|
+
import { a as WorkspacePath } from '../workspace-path-CWVrcuPL.js';
|
|
3
|
+
export { isElectronHost } from '../host/index.js';
|
|
4
|
+
import '../types-CueK0tvU.js';
|
|
5
|
+
|
|
6
|
+
/** Pure renderer-side client for the typed Electron filesystem v2 transport. */
|
|
7
|
+
declare class ElectronFileSystemProviderV2 implements FileSystemProviderV2 {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly label: string;
|
|
10
|
+
readonly capabilities: FileSystemProviderCapabilities;
|
|
11
|
+
private readonly rootPath;
|
|
12
|
+
private readonly instanceId;
|
|
13
|
+
private readonly watchers;
|
|
14
|
+
private readonly subscriptions;
|
|
15
|
+
private readonly inFlight;
|
|
16
|
+
private openPromise;
|
|
17
|
+
private removeWatchBridge;
|
|
18
|
+
private disposePromise;
|
|
19
|
+
private hostOpened;
|
|
20
|
+
private disposed;
|
|
21
|
+
constructor(id: string, label: string, rootPath: string);
|
|
22
|
+
getRootPath(): string;
|
|
23
|
+
stat(path: WorkspacePath): Promise<FileSystemEntrySnapshot | null>;
|
|
24
|
+
readFile(path: WorkspacePath): Promise<FileSystemFileRead | null>;
|
|
25
|
+
readDirectory(path: WorkspacePath): Promise<readonly FileSystemEntrySnapshot[]>;
|
|
26
|
+
writeFile(path: WorkspacePath, data: ArrayBuffer | Uint8Array, options?: FileSystemWriteOptions): Promise<FileSystemFileSnapshot>;
|
|
27
|
+
createDirectory(path: WorkspacePath, options?: FileSystemCreateDirectoryOptions): Promise<FileSystemDirectorySnapshot>;
|
|
28
|
+
remove(path: WorkspacePath, options?: FileSystemRemoveOptions): Promise<FileSystemRemoveResult>;
|
|
29
|
+
move(oldPath: WorkspacePath, newPath: WorkspacePath, options?: FileSystemMoveOptions): Promise<FileSystemEntrySnapshot>;
|
|
30
|
+
snapshot(): Promise<FileSystemSnapshot>;
|
|
31
|
+
watch(listener: (event: FileSystemWatchEvent) => void, options?: FileSystemWatchOptions): FileSystemWatchSubscription;
|
|
32
|
+
dispose(): Promise<void>;
|
|
33
|
+
private request;
|
|
34
|
+
private ensureOpen;
|
|
35
|
+
private ensureWatchBridge;
|
|
36
|
+
private handleWatchMessage;
|
|
37
|
+
private assertOpen;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* ElectronFileSystemProvider — implements FileSystemProvider by delegating
|
|
42
|
+
* to the Electron desktop host's fs IPC bridge. Every operation is scoped
|
|
43
|
+
* to an opaque workspace id that the main process resolves against its
|
|
44
|
+
* registered workspace authority.
|
|
45
|
+
*
|
|
46
|
+
* This file has no Electron dependency — it is a pure IPC client that
|
|
47
|
+
* relies on the `docBlocksHost` global installed by the preload script.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
declare class ElectronFileSystemProvider implements FileSystemProvider {
|
|
51
|
+
readonly id: string;
|
|
52
|
+
readonly label: string;
|
|
53
|
+
readonly v2: ElectronFileSystemProviderV2;
|
|
54
|
+
private readonly rootPath;
|
|
55
|
+
constructor(id: string, label: string, rootPath: string);
|
|
56
|
+
/** Absolute path this provider is rooted at. */
|
|
57
|
+
getRootPath(): string;
|
|
58
|
+
readFile(path: string): Promise<string | null>;
|
|
59
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
60
|
+
commitFile(path: string, content: string, expectedContent: string | null): Promise<FileCommitResult>;
|
|
61
|
+
delete(path: string): Promise<void>;
|
|
62
|
+
rename(oldPath: string, newPath: string): Promise<void>;
|
|
63
|
+
readDirectory(path: string): Promise<FileSystemEntry[]>;
|
|
64
|
+
exists(path: string): Promise<boolean>;
|
|
65
|
+
createDirectory(path: string): Promise<void>;
|
|
66
|
+
stat(path: string): Promise<FileMeta | null>;
|
|
67
|
+
readBinary(path: string): Promise<ArrayBuffer | null>;
|
|
68
|
+
writeBinary(path: string, data: ArrayBuffer | Uint8Array): Promise<void>;
|
|
69
|
+
/** Subscribe to external change notifications under this root. */
|
|
70
|
+
watch(onChange: (changedPath: string) => void): () => void;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { ElectronFileSystemProvider, ElectronFileSystemProviderV2 };
|