@bendyline/docblocks 2.6.1 → 2.7.0
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/THIRD_PARTY_NOTICES.txt +33 -33
- package/dist/capabilities-CdQAc745.d.ts +1233 -0
- package/dist/catalog-BQK05tne.d.ts +122 -0
- package/dist/chunk-245W57QP.js +31 -0
- package/dist/{chunk-2WDJ27EH.js → chunk-46AGYHDY.js} +8 -0
- package/dist/{chunk-4437YWLE.js → chunk-6UPO2GE6.js} +4 -2
- package/dist/{chunk-UMWCTEXW.js → chunk-7SN7YQL4.js} +211 -40
- package/dist/{chunk-OQCPBOQA.js → chunk-DAPFSEKY.js} +35 -0
- package/dist/{chunk-M62ZGJ5I.js → chunk-HABG2JM3.js} +0 -17
- package/dist/{chunk-YM7O3PWO.js → chunk-HKOOHM67.js} +20 -12
- package/dist/chunk-IDYE73TU.js +77 -0
- package/dist/{chunk-KLQKU74Q.js → chunk-IGB2VSRE.js} +124 -330
- package/dist/{chunk-BVY7GGNV.js → chunk-L6PRMR7T.js} +137 -95
- package/dist/chunk-LPIJ6HKL.js +19 -0
- package/dist/{chunk-SJBB5OD7.js → chunk-QS5WTLUZ.js} +10 -8
- package/dist/chunk-R2JX5N3F.js +382 -0
- package/dist/{chunk-ZO7G53QP.js → chunk-UDEWLHQI.js} +4 -2
- package/dist/chunk-UK7R3RC7.js +514 -0
- package/dist/chunk-XTNWCNSK.js +464 -0
- package/dist/chunk-YHSFRPBS.js +42 -0
- package/dist/chunk-YNUQG4GF.js +1173 -0
- package/dist/document/index.d.ts +31 -1
- package/dist/document/index.js +7 -6
- package/dist/filesystem/electron.d.ts +8 -34
- package/dist/filesystem/electron.js +7 -4
- package/dist/filesystem/host.d.ts +28 -0
- package/dist/filesystem/host.js +103 -0
- package/dist/filesystem/index.d.ts +52 -6
- package/dist/filesystem/index.js +36 -15
- package/dist/filesystem/indexeddb.d.ts +8 -1
- package/dist/filesystem/indexeddb.js +7 -6
- package/dist/filesystem/memory.d.ts +2 -1
- package/dist/filesystem/memory.js +3 -2
- package/dist/filesystem/native.d.ts +2 -1
- package/dist/filesystem/native.js +3 -2
- package/dist/filesystem-v2-C8AdSXUN.d.ts +74 -0
- package/dist/host/index.d.ts +127 -5
- package/dist/host/index.js +100 -4
- package/dist/host/mobile.d.ts +389 -0
- package/dist/host/mobile.js +315 -0
- package/dist/host-provider-v2-CyLTRKJF.d.ts +51 -0
- package/dist/index.d.ts +8 -5
- package/dist/index.js +153 -34
- package/dist/mcp/index.d.ts +2 -2
- package/dist/mcp/zod.d.ts +23 -1
- package/dist/mcp/zod.js +1 -0
- package/dist/settings-HrrCikVX.d.ts +170 -0
- package/dist/types-BvDnr3YU.d.ts +88 -0
- package/dist/{types-Oy9U5FST.d.ts → types-d0yvHUJz.d.ts} +6 -0
- package/dist/{types-Bb3yccTH.d.ts → v2-BVnZZyd4.d.ts} +1 -86
- package/dist/vscode/index.d.ts +43 -1
- package/dist/vscode/index.js +67 -1
- package/dist/workspace/index.d.ts +10 -6
- package/dist/workspace/index.js +4 -2
- package/dist/workspace-index/index.d.ts +240 -0
- package/dist/workspace-index/index.js +1287 -0
- package/dist/workspace-settings/index.d.ts +301 -0
- package/dist/workspace-settings/index.js +820 -0
- package/package.json +22 -2
- package/dist/chunk-6XHOOBYF.js +0 -36
- package/dist/chunk-QI6YKTQV.js +0 -110
- package/dist/types-DBYraXxE.d.ts +0 -557
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
FILE_SYSTEM_TRANSFER_LIMITS,
|
|
3
3
|
maybeGetDocBlocksHost
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YNUQG4GF.js";
|
|
5
|
+
import {
|
|
6
|
+
parseFileSystemCapabilities
|
|
7
|
+
} from "./chunk-245W57QP.js";
|
|
8
|
+
import {
|
|
9
|
+
HOST_WIRE_LIMITS,
|
|
10
|
+
isBoundedBytePayload,
|
|
11
|
+
isBoundedString
|
|
12
|
+
} from "./chunk-46AGYHDY.js";
|
|
5
13
|
import {
|
|
6
14
|
isRecord
|
|
7
15
|
} from "./chunk-73OOROXH.js";
|
|
8
16
|
import {
|
|
9
17
|
compareSnapshotsByPath,
|
|
10
18
|
compareText,
|
|
11
|
-
copyBytes
|
|
19
|
+
copyBytes
|
|
20
|
+
} from "./chunk-HABG2JM3.js";
|
|
21
|
+
import {
|
|
12
22
|
parseFileSystemVersion
|
|
13
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-LPIJ6HKL.js";
|
|
14
24
|
import {
|
|
15
25
|
FsError,
|
|
16
26
|
WORKSPACE_ROOT,
|
|
@@ -22,20 +32,19 @@ import {
|
|
|
22
32
|
workspacePathDirname
|
|
23
33
|
} from "./chunk-AYWKIZLD.js";
|
|
24
34
|
|
|
25
|
-
// src/filesystem/
|
|
35
|
+
// src/filesystem/host-provider-v2.ts
|
|
26
36
|
var fallbackInstanceSequence = 0;
|
|
27
37
|
function getHostFsV2(operation) {
|
|
28
38
|
const host = maybeGetDocBlocksHost();
|
|
29
39
|
if (!host?.fsV2) {
|
|
30
|
-
throw new FsError("not-supported", "
|
|
40
|
+
throw new FsError("not-supported", "Native filesystem v2 host is unavailable.", {
|
|
31
41
|
operation
|
|
32
42
|
});
|
|
33
43
|
}
|
|
34
44
|
return host.fsV2;
|
|
35
45
|
}
|
|
36
|
-
var
|
|
37
|
-
constructor(id, label, rootPath) {
|
|
38
|
-
this.capabilities = ELECTRON_FILE_SYSTEM_V2_CAPABILITIES;
|
|
46
|
+
var HostFileSystemProviderV2 = class {
|
|
47
|
+
constructor(id, label, rootPath, options) {
|
|
39
48
|
this.instanceId = createInstanceId();
|
|
40
49
|
this.watchers = /* @__PURE__ */ new Map();
|
|
41
50
|
this.subscriptions = /* @__PURE__ */ new Set();
|
|
@@ -48,6 +57,12 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
48
57
|
this.id = id;
|
|
49
58
|
this.label = label;
|
|
50
59
|
this.rootPath = rootPath;
|
|
60
|
+
this.capabilities = parseFileSystemCapabilities(options.capabilities);
|
|
61
|
+
this.limits = options.limits ?? FILE_SYSTEM_TRANSFER_LIMITS;
|
|
62
|
+
if (!Number.isSafeInteger(this.limits.fileBytes) || this.limits.fileBytes < 1 || this.limits.fileBytes > FILE_SYSTEM_TRANSFER_LIMITS.fileBytes || !Number.isSafeInteger(this.limits.chunkBytes) || this.limits.chunkBytes < 1 || this.limits.chunkBytes > FILE_SYSTEM_TRANSFER_LIMITS.chunkBytes || this.limits.chunkBytes > this.limits.fileBytes) {
|
|
63
|
+
throw new TypeError("Invalid native filesystem transfer limits.");
|
|
64
|
+
}
|
|
65
|
+
this.transport = options.transport;
|
|
51
66
|
}
|
|
52
67
|
getRootPath() {
|
|
53
68
|
return this.rootPath;
|
|
@@ -56,7 +71,7 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
56
71
|
const canonical = parseWorkspacePath(String(path));
|
|
57
72
|
return this.request(
|
|
58
73
|
"stat",
|
|
59
|
-
() =>
|
|
74
|
+
() => this.getTransport("stat").stat(this.instanceId, canonical),
|
|
60
75
|
(value) => value ? normalizeEntry(value) : null
|
|
61
76
|
);
|
|
62
77
|
}
|
|
@@ -64,40 +79,118 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
64
79
|
const canonical = parseWorkspacePath(String(path));
|
|
65
80
|
return this.request(
|
|
66
81
|
"read",
|
|
67
|
-
() =>
|
|
68
|
-
|
|
69
|
-
if (
|
|
82
|
+
async () => {
|
|
83
|
+
const host = this.getTransport("read");
|
|
84
|
+
if (host.beginRead && host.readChunk && host.closeTransfer) {
|
|
85
|
+
const value2 = unwrap(await host.stat(this.instanceId, canonical), "read");
|
|
86
|
+
const stat = value2 ? normalizeEntry(value2) : null;
|
|
87
|
+
if (stat?.kind === "file" && stat.size > this.limits.chunkBytes) {
|
|
88
|
+
return { ok: true, value: await this.readTransferredFile(host, canonical) };
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const value = unwrap(await host.readFile(this.instanceId, canonical), "read");
|
|
92
|
+
if (!value) return { ok: true, value: null };
|
|
70
93
|
const entry = normalizeFile(value.entry);
|
|
71
94
|
const data = copyWireBuffer(value.data);
|
|
72
95
|
if (data.byteLength !== entry.size) {
|
|
73
96
|
throw new TypeError("Filesystem transport returned file bytes with the wrong size.");
|
|
74
97
|
}
|
|
75
|
-
return Object.freeze({ entry, data });
|
|
76
|
-
}
|
|
98
|
+
return { ok: true, value: Object.freeze({ entry, data }) };
|
|
99
|
+
},
|
|
100
|
+
(value) => value
|
|
77
101
|
);
|
|
78
102
|
}
|
|
79
103
|
async readDirectory(path) {
|
|
80
104
|
const canonical = parseWorkspacePath(String(path));
|
|
81
105
|
return this.request(
|
|
82
106
|
"list",
|
|
83
|
-
() =>
|
|
107
|
+
() => this.getTransport("list").readDirectory(this.instanceId, canonical),
|
|
84
108
|
(value) => normalizeDirectoryListing(value, canonical)
|
|
85
109
|
);
|
|
86
110
|
}
|
|
87
111
|
async writeFile(path, data, options) {
|
|
88
112
|
const canonical = parseWorkspacePath(String(path));
|
|
113
|
+
this.assertOpen("write");
|
|
114
|
+
if (data.byteLength > this.limits.fileBytes) {
|
|
115
|
+
throw new FsError("quota-exceeded", "This file exceeds this host\u2019s file size limit.", {
|
|
116
|
+
operation: "write",
|
|
117
|
+
path: canonical
|
|
118
|
+
});
|
|
119
|
+
}
|
|
89
120
|
const owned = copyBytes(data);
|
|
90
121
|
return this.request(
|
|
91
122
|
"write",
|
|
92
|
-
() =>
|
|
123
|
+
async () => {
|
|
124
|
+
const host = this.getTransport("write");
|
|
125
|
+
if (owned.byteLength > this.limits.chunkBytes && host.beginWrite && host.writeChunk && host.finishWrite && host.closeTransfer) {
|
|
126
|
+
const id = normalizeTransferId(
|
|
127
|
+
unwrap(
|
|
128
|
+
await host.beginWrite(this.instanceId, canonical, owned.byteLength, options),
|
|
129
|
+
"write"
|
|
130
|
+
)
|
|
131
|
+
);
|
|
132
|
+
try {
|
|
133
|
+
for (let offset = 0; offset < owned.byteLength; offset += this.limits.chunkBytes) {
|
|
134
|
+
unwrap(
|
|
135
|
+
await host.writeChunk(
|
|
136
|
+
this.instanceId,
|
|
137
|
+
id,
|
|
138
|
+
offset,
|
|
139
|
+
owned.slice(offset, offset + this.limits.chunkBytes)
|
|
140
|
+
),
|
|
141
|
+
"write"
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
return await host.finishWrite(this.instanceId, id);
|
|
145
|
+
} finally {
|
|
146
|
+
unwrap(await host.closeTransfer(this.instanceId, id), "write");
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (owned.byteLength > HOST_WIRE_LIMITS.binaryBytes) {
|
|
150
|
+
throw new FsError(
|
|
151
|
+
"not-supported",
|
|
152
|
+
"This host does not support large file transfers. Update DocBlocks and retry."
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
return host.writeFile(this.instanceId, canonical, owned, options);
|
|
156
|
+
},
|
|
93
157
|
normalizeFile
|
|
94
158
|
);
|
|
95
159
|
}
|
|
160
|
+
async readTransferredFile(host, path) {
|
|
161
|
+
if (!host.beginRead || !host.readChunk || !host.closeTransfer) {
|
|
162
|
+
throw new FsError("not-supported", "Large file transfers are unavailable.");
|
|
163
|
+
}
|
|
164
|
+
const transfer = unwrap(await host.beginRead(this.instanceId, path), "read");
|
|
165
|
+
if (transfer === null) return null;
|
|
166
|
+
if (!isRecord(transfer) || Object.keys(transfer).some((key) => key !== "transferId" && key !== "entry")) {
|
|
167
|
+
throw new TypeError("Filesystem returned an invalid transfer.");
|
|
168
|
+
}
|
|
169
|
+
const id = normalizeTransferId(transfer.transferId);
|
|
170
|
+
try {
|
|
171
|
+
const entry = normalizeFile(transfer.entry);
|
|
172
|
+
if (entry.path !== path || entry.size > this.limits.fileBytes) {
|
|
173
|
+
throw new TypeError("Filesystem transfer returned an invalid file.");
|
|
174
|
+
}
|
|
175
|
+
const data = new Uint8Array(entry.size);
|
|
176
|
+
for (let offset = 0; offset < data.byteLength; ) {
|
|
177
|
+
const chunk = unwrap(await host.readChunk(this.instanceId, id, offset), "read");
|
|
178
|
+
if (!isBoundedBytePayload(chunk, this.limits.chunkBytes) || chunk.byteLength === 0 || offset + chunk.byteLength > data.byteLength) {
|
|
179
|
+
throw new TypeError("Filesystem transfer returned an invalid chunk.");
|
|
180
|
+
}
|
|
181
|
+
data.set(chunk instanceof Uint8Array ? chunk : new Uint8Array(chunk), offset);
|
|
182
|
+
offset += chunk.byteLength;
|
|
183
|
+
}
|
|
184
|
+
return Object.freeze({ entry, data: data.buffer });
|
|
185
|
+
} finally {
|
|
186
|
+
unwrap(await host.closeTransfer(this.instanceId, id), "read");
|
|
187
|
+
}
|
|
188
|
+
}
|
|
96
189
|
async createDirectory(path, options) {
|
|
97
190
|
const canonical = parseWorkspacePath(String(path));
|
|
98
191
|
return this.request(
|
|
99
192
|
"create-directory",
|
|
100
|
-
() =>
|
|
193
|
+
() => this.getTransport("create-directory").createDirectory(this.instanceId, canonical, options),
|
|
101
194
|
normalizeDirectory
|
|
102
195
|
);
|
|
103
196
|
}
|
|
@@ -105,7 +198,7 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
105
198
|
const canonical = parseWorkspacePath(String(path));
|
|
106
199
|
return this.request(
|
|
107
200
|
"remove",
|
|
108
|
-
() =>
|
|
201
|
+
() => this.getTransport("remove").remove(this.instanceId, canonical, options),
|
|
109
202
|
normalizeRemoveResult
|
|
110
203
|
);
|
|
111
204
|
}
|
|
@@ -114,14 +207,14 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
114
207
|
const destination = parseWorkspacePath(String(newPath));
|
|
115
208
|
return this.request(
|
|
116
209
|
"move",
|
|
117
|
-
() =>
|
|
210
|
+
() => this.getTransport("move").move(this.instanceId, source, destination, options),
|
|
118
211
|
normalizeEntry
|
|
119
212
|
);
|
|
120
213
|
}
|
|
121
214
|
async snapshot() {
|
|
122
215
|
return this.request(
|
|
123
216
|
"snapshot",
|
|
124
|
-
() =>
|
|
217
|
+
() => this.getTransport("snapshot").snapshot(this.instanceId),
|
|
125
218
|
normalizeSnapshot
|
|
126
219
|
);
|
|
127
220
|
}
|
|
@@ -136,7 +229,10 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
136
229
|
let closePromise = null;
|
|
137
230
|
const ready = this.ensureOpen("watch").then(async () => {
|
|
138
231
|
if (closed) return;
|
|
139
|
-
unwrap(
|
|
232
|
+
unwrap(
|
|
233
|
+
await this.getTransport("watch").watchSubscribe(this.instanceId, subscriptionId),
|
|
234
|
+
"watch"
|
|
235
|
+
);
|
|
140
236
|
subscribed = true;
|
|
141
237
|
}).catch((error) => {
|
|
142
238
|
closed = true;
|
|
@@ -162,7 +258,7 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
162
258
|
await ready.catch(() => void 0);
|
|
163
259
|
if (subscribed) {
|
|
164
260
|
unwrap(
|
|
165
|
-
await
|
|
261
|
+
await this.getTransport("watch").watchUnsubscribe(this.instanceId, subscriptionId),
|
|
166
262
|
"watch"
|
|
167
263
|
);
|
|
168
264
|
}
|
|
@@ -188,7 +284,7 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
188
284
|
}
|
|
189
285
|
if (this.hostOpened) {
|
|
190
286
|
try {
|
|
191
|
-
unwrap(await
|
|
287
|
+
unwrap(await this.getTransport("dispose").dispose(this.instanceId), "dispose");
|
|
192
288
|
} catch (error) {
|
|
193
289
|
if (!(error instanceof FsError && error.code === "closed")) throw error;
|
|
194
290
|
} finally {
|
|
@@ -221,14 +317,14 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
221
317
|
ensureOpen(operation) {
|
|
222
318
|
this.assertOpen(operation);
|
|
223
319
|
if (!this.openPromise) {
|
|
224
|
-
const attempt =
|
|
320
|
+
const attempt = this.getTransport(operation).open({
|
|
225
321
|
instanceId: this.instanceId,
|
|
226
322
|
providerId: this.id,
|
|
227
323
|
label: this.label
|
|
228
324
|
}).then((result) => {
|
|
229
325
|
if (isRecord(result) && result.ok === true) this.hostOpened = true;
|
|
230
326
|
const capabilities = unwrap(result, operation);
|
|
231
|
-
assertCapabilities(capabilities, operation);
|
|
327
|
+
assertCapabilities(capabilities, this.capabilities, operation);
|
|
232
328
|
}).catch((error) => {
|
|
233
329
|
const typed = withOperation(fsErrorFromUnknown(error, { operation }), operation);
|
|
234
330
|
if (typed.retryable && this.openPromise === attempt) this.openPromise = null;
|
|
@@ -240,7 +336,7 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
240
336
|
}
|
|
241
337
|
ensureWatchBridge() {
|
|
242
338
|
if (this.removeWatchBridge) return;
|
|
243
|
-
this.removeWatchBridge =
|
|
339
|
+
this.removeWatchBridge = this.getTransport("watch").onWatchMessage(
|
|
244
340
|
(message) => this.handleWatchMessage(message)
|
|
245
341
|
);
|
|
246
342
|
}
|
|
@@ -271,6 +367,9 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
271
367
|
} catch {
|
|
272
368
|
}
|
|
273
369
|
}
|
|
370
|
+
getTransport(operation) {
|
|
371
|
+
return this.transport ?? getHostFsV2(operation);
|
|
372
|
+
}
|
|
274
373
|
assertOpen(operation) {
|
|
275
374
|
if (!this.disposed) return;
|
|
276
375
|
throw new FsError("disposed", "Filesystem provider is disposed.", { operation });
|
|
@@ -291,6 +390,12 @@ function unwrap(result, operation) {
|
|
|
291
390
|
}
|
|
292
391
|
throw deserializeFsError(result.error);
|
|
293
392
|
}
|
|
393
|
+
function normalizeTransferId(value) {
|
|
394
|
+
if (!isBoundedString(value, HOST_WIRE_LIMITS.identifierCharacters, 1)) {
|
|
395
|
+
throw new TypeError("Filesystem returned an invalid transfer ID.");
|
|
396
|
+
}
|
|
397
|
+
return value;
|
|
398
|
+
}
|
|
294
399
|
function normalizeEntry(entry) {
|
|
295
400
|
if (!isRecord(entry)) throw new TypeError("Expected a filesystem entry object.");
|
|
296
401
|
if (typeof entry.path !== "string")
|
|
@@ -435,12 +540,10 @@ function normalizeRemoveResult(value) {
|
|
|
435
540
|
}
|
|
436
541
|
return Object.freeze({ removed: value.removed, version: parseFileSystemVersion(value.version) });
|
|
437
542
|
}
|
|
438
|
-
function assertCapabilities(
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
for (const key of Object.keys(ELECTRON_FILE_SYSTEM_V2_CAPABILITIES)) {
|
|
443
|
-
if (value[key] !== ELECTRON_FILE_SYSTEM_V2_CAPABILITIES[key]) {
|
|
543
|
+
function assertCapabilities(input, expected, operation) {
|
|
544
|
+
const value = parseFileSystemCapabilities(input);
|
|
545
|
+
for (const key of Object.keys(expected)) {
|
|
546
|
+
if (value[key] !== expected[key]) {
|
|
444
547
|
throw invalidTransport(operation, `Filesystem host capability mismatch: ${key}.`);
|
|
445
548
|
}
|
|
446
549
|
}
|
|
@@ -486,67 +589,6 @@ function createInstanceId() {
|
|
|
486
589
|
return `electron-fs-v2-${Date.now()}-${fallbackInstanceSequence}`;
|
|
487
590
|
}
|
|
488
591
|
|
|
489
|
-
// src/filesystem/electron-provider.ts
|
|
490
|
-
function getHostFs() {
|
|
491
|
-
const host = maybeGetDocBlocksHost();
|
|
492
|
-
if (!host) {
|
|
493
|
-
throw new Error(
|
|
494
|
-
"ElectronFileSystemProvider: docBlocksHost is not available \u2014 not running under Electron?"
|
|
495
|
-
);
|
|
496
|
-
}
|
|
497
|
-
return host.fs;
|
|
498
|
-
}
|
|
499
|
-
var ElectronFileSystemProvider = class {
|
|
500
|
-
constructor(id, label, rootPath) {
|
|
501
|
-
this.id = id;
|
|
502
|
-
this.label = label;
|
|
503
|
-
this.rootPath = rootPath;
|
|
504
|
-
this.v2 = new ElectronFileSystemProviderV2(id, label, rootPath);
|
|
505
|
-
}
|
|
506
|
-
/** Absolute path this provider is rooted at. */
|
|
507
|
-
getRootPath() {
|
|
508
|
-
return this.rootPath;
|
|
509
|
-
}
|
|
510
|
-
readFile(path) {
|
|
511
|
-
return getHostFs().readFile(this.id, path);
|
|
512
|
-
}
|
|
513
|
-
writeFile(path, content) {
|
|
514
|
-
return getHostFs().writeFile(this.id, path, content);
|
|
515
|
-
}
|
|
516
|
-
commitFile(path, content, expectedContent) {
|
|
517
|
-
return getHostFs().commitFile(this.id, path, content, expectedContent);
|
|
518
|
-
}
|
|
519
|
-
delete(path) {
|
|
520
|
-
return getHostFs().delete(this.id, path);
|
|
521
|
-
}
|
|
522
|
-
rename(oldPath, newPath) {
|
|
523
|
-
return getHostFs().rename(this.id, oldPath, newPath);
|
|
524
|
-
}
|
|
525
|
-
readDirectory(path) {
|
|
526
|
-
return getHostFs().readDirectory(this.id, path);
|
|
527
|
-
}
|
|
528
|
-
exists(path) {
|
|
529
|
-
return getHostFs().exists(this.id, path);
|
|
530
|
-
}
|
|
531
|
-
createDirectory(path) {
|
|
532
|
-
return getHostFs().createDirectory(this.id, path);
|
|
533
|
-
}
|
|
534
|
-
stat(path) {
|
|
535
|
-
return getHostFs().stat(this.id, path);
|
|
536
|
-
}
|
|
537
|
-
readBinary(path) {
|
|
538
|
-
return getHostFs().readBinary(this.id, path);
|
|
539
|
-
}
|
|
540
|
-
writeBinary(path, data) {
|
|
541
|
-
return getHostFs().writeBinary(this.id, path, data);
|
|
542
|
-
}
|
|
543
|
-
/** Subscribe to external change notifications under this root. */
|
|
544
|
-
watch(onChange) {
|
|
545
|
-
return getHostFs().watch(this.id, onChange);
|
|
546
|
-
}
|
|
547
|
-
};
|
|
548
|
-
|
|
549
592
|
export {
|
|
550
|
-
|
|
551
|
-
ElectronFileSystemProvider
|
|
593
|
+
HostFileSystemProviderV2
|
|
552
594
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/filesystem/v2.ts
|
|
2
|
+
function parseFileSystemVersion(value) {
|
|
3
|
+
if (typeof value !== "string" || !value || value.length > 1024 || value.includes("\0")) {
|
|
4
|
+
throw new TypeError("Filesystem version tokens must be non-empty bounded strings.");
|
|
5
|
+
}
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
function tryParseFileSystemVersion(value) {
|
|
9
|
+
try {
|
|
10
|
+
return parseFileSystemVersion(value);
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
parseFileSystemVersion,
|
|
18
|
+
tryParseFileSystemVersion
|
|
19
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RawIndexedDBFileSystemStore
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DAPFSEKY.js";
|
|
4
4
|
import {
|
|
5
5
|
getFileSystemProviderV2
|
|
6
6
|
} from "./chunk-XAMILHQP.js";
|
|
@@ -23,13 +23,14 @@ function parsePersistedWorkspace(value, index) {
|
|
|
23
23
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
24
24
|
throw new Error(`Persisted workspace ${index} must be an object.`);
|
|
25
25
|
}
|
|
26
|
-
const record = value;
|
|
26
|
+
const record = { ...value };
|
|
27
|
+
if (record.type === "electron-native") record.type = "host-native";
|
|
27
28
|
const allowed = ["id", "name", "type", "lastOpened", "rootPath", "versioningOverride"];
|
|
28
29
|
const unknownKey = Object.keys(record).find((key) => !allowed.includes(key));
|
|
29
30
|
if (unknownKey) throw new Error(`Persisted workspace ${index} has unknown field ${unknownKey}.`);
|
|
30
31
|
const id = boundedString(record.id, MAX_IDENTIFIER_CHARACTERS, `workspace ${index} id`);
|
|
31
32
|
const name = boundedString(record.name, MAX_LABEL_CHARACTERS, `workspace ${index} name`);
|
|
32
|
-
if (record.type !== "indexeddb" && record.type !== "native" && record.type !== "
|
|
33
|
+
if (record.type !== "indexeddb" && record.type !== "native" && record.type !== "host-native") {
|
|
33
34
|
throw new Error(`Persisted workspace ${index} has an invalid provider type.`);
|
|
34
35
|
}
|
|
35
36
|
const lastOpened = boundedString(
|
|
@@ -48,10 +49,10 @@ function parsePersistedWorkspace(value, index) {
|
|
|
48
49
|
`workspace ${index} rootPath`
|
|
49
50
|
);
|
|
50
51
|
}
|
|
51
|
-
if (record.type === "
|
|
52
|
+
if (record.type === "host-native" && descriptor.rootPath === void 0) {
|
|
52
53
|
throw new Error(`Persisted Electron workspace ${index} is missing rootPath.`);
|
|
53
54
|
}
|
|
54
|
-
if (record.type !== "
|
|
55
|
+
if (record.type !== "host-native" && descriptor.rootPath !== void 0) {
|
|
55
56
|
throw new Error(`Persisted workspace ${index} must not contain rootPath.`);
|
|
56
57
|
}
|
|
57
58
|
if (record.versioningOverride !== void 0) {
|
|
@@ -181,13 +182,13 @@ function comparableRoot(rootPath, platform) {
|
|
|
181
182
|
return platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
182
183
|
}
|
|
183
184
|
function reconcileElectronWorkspaceDescriptors(local, hostWorkspaces, platform, now) {
|
|
184
|
-
const electron = local.filter((workspace) => workspace.type === "
|
|
185
|
+
const electron = local.filter((workspace) => workspace.type === "host-native");
|
|
185
186
|
const matchedLocalIds = /* @__PURE__ */ new Set();
|
|
186
187
|
const idRemap = {};
|
|
187
188
|
const upsert = hostWorkspaces.map((hostWorkspace) => {
|
|
188
189
|
const root = comparableRoot(hostWorkspace.rootPath, platform);
|
|
189
190
|
const candidates = electron.filter(
|
|
190
|
-
(workspace) => workspace.rootPath && comparableRoot(workspace.rootPath, platform) === root
|
|
191
|
+
(workspace) => workspace.id === hostWorkspace.id || platform !== "ios" && platform !== "android" && workspace.rootPath && comparableRoot(workspace.rootPath, platform) === root
|
|
191
192
|
);
|
|
192
193
|
const matching = candidates.sort(
|
|
193
194
|
(left, right) => right.lastOpened.localeCompare(left.lastOpened)
|
|
@@ -199,7 +200,7 @@ function reconcileElectronWorkspaceDescriptors(local, hostWorkspaces, platform,
|
|
|
199
200
|
return {
|
|
200
201
|
id: hostWorkspace.id,
|
|
201
202
|
name: matching?.name ?? hostWorkspace.name,
|
|
202
|
-
type: "
|
|
203
|
+
type: "host-native",
|
|
203
204
|
rootPath: hostWorkspace.rootPath,
|
|
204
205
|
lastOpened: matching?.lastOpened ?? now,
|
|
205
206
|
...matching?.versioningOverride ? { versioningOverride: matching.versioningOverride } : {}
|
|
@@ -214,6 +215,7 @@ function reconcileElectronWorkspaceDescriptors(local, hostWorkspaces, platform,
|
|
|
214
215
|
|
|
215
216
|
export {
|
|
216
217
|
parsePersistedWorkspaceList,
|
|
218
|
+
DEFAULT_WORKSPACE_ID,
|
|
217
219
|
registerTransientWorkspace,
|
|
218
220
|
getTransientWorkspace,
|
|
219
221
|
unregisterTransientWorkspace,
|