@bendyline/docblocks 2.6.2 → 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-5MJC4KOE.js → chunk-L6PRMR7T.js} +53 -101
- 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 -35
- 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 +98 -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 +151 -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-KFWPPIJH.js +0 -45
- package/dist/chunk-QI6YKTQV.js +0 -110
- package/dist/types-DhLZZNEn.d.ts +0 -577
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ELECTRON_FILE_SYSTEM_V2_CAPABILITIES,
|
|
3
2
|
FILE_SYSTEM_TRANSFER_LIMITS,
|
|
4
3
|
maybeGetDocBlocksHost
|
|
5
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YNUQG4GF.js";
|
|
5
|
+
import {
|
|
6
|
+
parseFileSystemCapabilities
|
|
7
|
+
} from "./chunk-245W57QP.js";
|
|
6
8
|
import {
|
|
7
9
|
HOST_WIRE_LIMITS,
|
|
8
10
|
isBoundedBytePayload,
|
|
9
11
|
isBoundedString
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-46AGYHDY.js";
|
|
11
13
|
import {
|
|
12
14
|
isRecord
|
|
13
15
|
} from "./chunk-73OOROXH.js";
|
|
14
16
|
import {
|
|
15
17
|
compareSnapshotsByPath,
|
|
16
18
|
compareText,
|
|
17
|
-
copyBytes
|
|
19
|
+
copyBytes
|
|
20
|
+
} from "./chunk-HABG2JM3.js";
|
|
21
|
+
import {
|
|
18
22
|
parseFileSystemVersion
|
|
19
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-LPIJ6HKL.js";
|
|
20
24
|
import {
|
|
21
25
|
FsError,
|
|
22
26
|
WORKSPACE_ROOT,
|
|
@@ -28,20 +32,19 @@ import {
|
|
|
28
32
|
workspacePathDirname
|
|
29
33
|
} from "./chunk-AYWKIZLD.js";
|
|
30
34
|
|
|
31
|
-
// src/filesystem/
|
|
35
|
+
// src/filesystem/host-provider-v2.ts
|
|
32
36
|
var fallbackInstanceSequence = 0;
|
|
33
37
|
function getHostFsV2(operation) {
|
|
34
38
|
const host = maybeGetDocBlocksHost();
|
|
35
39
|
if (!host?.fsV2) {
|
|
36
|
-
throw new FsError("not-supported", "
|
|
40
|
+
throw new FsError("not-supported", "Native filesystem v2 host is unavailable.", {
|
|
37
41
|
operation
|
|
38
42
|
});
|
|
39
43
|
}
|
|
40
44
|
return host.fsV2;
|
|
41
45
|
}
|
|
42
|
-
var
|
|
43
|
-
constructor(id, label, rootPath) {
|
|
44
|
-
this.capabilities = ELECTRON_FILE_SYSTEM_V2_CAPABILITIES;
|
|
46
|
+
var HostFileSystemProviderV2 = class {
|
|
47
|
+
constructor(id, label, rootPath, options) {
|
|
45
48
|
this.instanceId = createInstanceId();
|
|
46
49
|
this.watchers = /* @__PURE__ */ new Map();
|
|
47
50
|
this.subscriptions = /* @__PURE__ */ new Set();
|
|
@@ -54,6 +57,12 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
54
57
|
this.id = id;
|
|
55
58
|
this.label = label;
|
|
56
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;
|
|
57
66
|
}
|
|
58
67
|
getRootPath() {
|
|
59
68
|
return this.rootPath;
|
|
@@ -62,7 +71,7 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
62
71
|
const canonical = parseWorkspacePath(String(path));
|
|
63
72
|
return this.request(
|
|
64
73
|
"stat",
|
|
65
|
-
() =>
|
|
74
|
+
() => this.getTransport("stat").stat(this.instanceId, canonical),
|
|
66
75
|
(value) => value ? normalizeEntry(value) : null
|
|
67
76
|
);
|
|
68
77
|
}
|
|
@@ -71,11 +80,11 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
71
80
|
return this.request(
|
|
72
81
|
"read",
|
|
73
82
|
async () => {
|
|
74
|
-
const host =
|
|
83
|
+
const host = this.getTransport("read");
|
|
75
84
|
if (host.beginRead && host.readChunk && host.closeTransfer) {
|
|
76
85
|
const value2 = unwrap(await host.stat(this.instanceId, canonical), "read");
|
|
77
86
|
const stat = value2 ? normalizeEntry(value2) : null;
|
|
78
|
-
if (stat?.kind === "file" && stat.size >
|
|
87
|
+
if (stat?.kind === "file" && stat.size > this.limits.chunkBytes) {
|
|
79
88
|
return { ok: true, value: await this.readTransferredFile(host, canonical) };
|
|
80
89
|
}
|
|
81
90
|
}
|
|
@@ -95,15 +104,15 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
95
104
|
const canonical = parseWorkspacePath(String(path));
|
|
96
105
|
return this.request(
|
|
97
106
|
"list",
|
|
98
|
-
() =>
|
|
107
|
+
() => this.getTransport("list").readDirectory(this.instanceId, canonical),
|
|
99
108
|
(value) => normalizeDirectoryListing(value, canonical)
|
|
100
109
|
);
|
|
101
110
|
}
|
|
102
111
|
async writeFile(path, data, options) {
|
|
103
112
|
const canonical = parseWorkspacePath(String(path));
|
|
104
113
|
this.assertOpen("write");
|
|
105
|
-
if (data.byteLength >
|
|
106
|
-
throw new FsError("quota-exceeded", "This file exceeds
|
|
114
|
+
if (data.byteLength > this.limits.fileBytes) {
|
|
115
|
+
throw new FsError("quota-exceeded", "This file exceeds this host\u2019s file size limit.", {
|
|
107
116
|
operation: "write",
|
|
108
117
|
path: canonical
|
|
109
118
|
});
|
|
@@ -112,8 +121,8 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
112
121
|
return this.request(
|
|
113
122
|
"write",
|
|
114
123
|
async () => {
|
|
115
|
-
const host =
|
|
116
|
-
if (owned.byteLength >
|
|
124
|
+
const host = this.getTransport("write");
|
|
125
|
+
if (owned.byteLength > this.limits.chunkBytes && host.beginWrite && host.writeChunk && host.finishWrite && host.closeTransfer) {
|
|
117
126
|
const id = normalizeTransferId(
|
|
118
127
|
unwrap(
|
|
119
128
|
await host.beginWrite(this.instanceId, canonical, owned.byteLength, options),
|
|
@@ -121,13 +130,13 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
121
130
|
)
|
|
122
131
|
);
|
|
123
132
|
try {
|
|
124
|
-
for (let offset = 0; offset < owned.byteLength; offset +=
|
|
133
|
+
for (let offset = 0; offset < owned.byteLength; offset += this.limits.chunkBytes) {
|
|
125
134
|
unwrap(
|
|
126
135
|
await host.writeChunk(
|
|
127
136
|
this.instanceId,
|
|
128
137
|
id,
|
|
129
138
|
offset,
|
|
130
|
-
owned.slice(offset, offset +
|
|
139
|
+
owned.slice(offset, offset + this.limits.chunkBytes)
|
|
131
140
|
),
|
|
132
141
|
"write"
|
|
133
142
|
);
|
|
@@ -140,7 +149,7 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
140
149
|
if (owned.byteLength > HOST_WIRE_LIMITS.binaryBytes) {
|
|
141
150
|
throw new FsError(
|
|
142
151
|
"not-supported",
|
|
143
|
-
"This
|
|
152
|
+
"This host does not support large file transfers. Update DocBlocks and retry."
|
|
144
153
|
);
|
|
145
154
|
}
|
|
146
155
|
return host.writeFile(this.instanceId, canonical, owned, options);
|
|
@@ -160,13 +169,13 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
160
169
|
const id = normalizeTransferId(transfer.transferId);
|
|
161
170
|
try {
|
|
162
171
|
const entry = normalizeFile(transfer.entry);
|
|
163
|
-
if (entry.path !== path || entry.size >
|
|
172
|
+
if (entry.path !== path || entry.size > this.limits.fileBytes) {
|
|
164
173
|
throw new TypeError("Filesystem transfer returned an invalid file.");
|
|
165
174
|
}
|
|
166
175
|
const data = new Uint8Array(entry.size);
|
|
167
176
|
for (let offset = 0; offset < data.byteLength; ) {
|
|
168
177
|
const chunk = unwrap(await host.readChunk(this.instanceId, id, offset), "read");
|
|
169
|
-
if (!isBoundedBytePayload(chunk,
|
|
178
|
+
if (!isBoundedBytePayload(chunk, this.limits.chunkBytes) || chunk.byteLength === 0 || offset + chunk.byteLength > data.byteLength) {
|
|
170
179
|
throw new TypeError("Filesystem transfer returned an invalid chunk.");
|
|
171
180
|
}
|
|
172
181
|
data.set(chunk instanceof Uint8Array ? chunk : new Uint8Array(chunk), offset);
|
|
@@ -181,7 +190,7 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
181
190
|
const canonical = parseWorkspacePath(String(path));
|
|
182
191
|
return this.request(
|
|
183
192
|
"create-directory",
|
|
184
|
-
() =>
|
|
193
|
+
() => this.getTransport("create-directory").createDirectory(this.instanceId, canonical, options),
|
|
185
194
|
normalizeDirectory
|
|
186
195
|
);
|
|
187
196
|
}
|
|
@@ -189,7 +198,7 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
189
198
|
const canonical = parseWorkspacePath(String(path));
|
|
190
199
|
return this.request(
|
|
191
200
|
"remove",
|
|
192
|
-
() =>
|
|
201
|
+
() => this.getTransport("remove").remove(this.instanceId, canonical, options),
|
|
193
202
|
normalizeRemoveResult
|
|
194
203
|
);
|
|
195
204
|
}
|
|
@@ -198,14 +207,14 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
198
207
|
const destination = parseWorkspacePath(String(newPath));
|
|
199
208
|
return this.request(
|
|
200
209
|
"move",
|
|
201
|
-
() =>
|
|
210
|
+
() => this.getTransport("move").move(this.instanceId, source, destination, options),
|
|
202
211
|
normalizeEntry
|
|
203
212
|
);
|
|
204
213
|
}
|
|
205
214
|
async snapshot() {
|
|
206
215
|
return this.request(
|
|
207
216
|
"snapshot",
|
|
208
|
-
() =>
|
|
217
|
+
() => this.getTransport("snapshot").snapshot(this.instanceId),
|
|
209
218
|
normalizeSnapshot
|
|
210
219
|
);
|
|
211
220
|
}
|
|
@@ -220,7 +229,10 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
220
229
|
let closePromise = null;
|
|
221
230
|
const ready = this.ensureOpen("watch").then(async () => {
|
|
222
231
|
if (closed) return;
|
|
223
|
-
unwrap(
|
|
232
|
+
unwrap(
|
|
233
|
+
await this.getTransport("watch").watchSubscribe(this.instanceId, subscriptionId),
|
|
234
|
+
"watch"
|
|
235
|
+
);
|
|
224
236
|
subscribed = true;
|
|
225
237
|
}).catch((error) => {
|
|
226
238
|
closed = true;
|
|
@@ -246,7 +258,7 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
246
258
|
await ready.catch(() => void 0);
|
|
247
259
|
if (subscribed) {
|
|
248
260
|
unwrap(
|
|
249
|
-
await
|
|
261
|
+
await this.getTransport("watch").watchUnsubscribe(this.instanceId, subscriptionId),
|
|
250
262
|
"watch"
|
|
251
263
|
);
|
|
252
264
|
}
|
|
@@ -272,7 +284,7 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
272
284
|
}
|
|
273
285
|
if (this.hostOpened) {
|
|
274
286
|
try {
|
|
275
|
-
unwrap(await
|
|
287
|
+
unwrap(await this.getTransport("dispose").dispose(this.instanceId), "dispose");
|
|
276
288
|
} catch (error) {
|
|
277
289
|
if (!(error instanceof FsError && error.code === "closed")) throw error;
|
|
278
290
|
} finally {
|
|
@@ -305,14 +317,14 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
305
317
|
ensureOpen(operation) {
|
|
306
318
|
this.assertOpen(operation);
|
|
307
319
|
if (!this.openPromise) {
|
|
308
|
-
const attempt =
|
|
320
|
+
const attempt = this.getTransport(operation).open({
|
|
309
321
|
instanceId: this.instanceId,
|
|
310
322
|
providerId: this.id,
|
|
311
323
|
label: this.label
|
|
312
324
|
}).then((result) => {
|
|
313
325
|
if (isRecord(result) && result.ok === true) this.hostOpened = true;
|
|
314
326
|
const capabilities = unwrap(result, operation);
|
|
315
|
-
assertCapabilities(capabilities, operation);
|
|
327
|
+
assertCapabilities(capabilities, this.capabilities, operation);
|
|
316
328
|
}).catch((error) => {
|
|
317
329
|
const typed = withOperation(fsErrorFromUnknown(error, { operation }), operation);
|
|
318
330
|
if (typed.retryable && this.openPromise === attempt) this.openPromise = null;
|
|
@@ -324,7 +336,7 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
324
336
|
}
|
|
325
337
|
ensureWatchBridge() {
|
|
326
338
|
if (this.removeWatchBridge) return;
|
|
327
|
-
this.removeWatchBridge =
|
|
339
|
+
this.removeWatchBridge = this.getTransport("watch").onWatchMessage(
|
|
328
340
|
(message) => this.handleWatchMessage(message)
|
|
329
341
|
);
|
|
330
342
|
}
|
|
@@ -355,6 +367,9 @@ var ElectronFileSystemProviderV2 = class {
|
|
|
355
367
|
} catch {
|
|
356
368
|
}
|
|
357
369
|
}
|
|
370
|
+
getTransport(operation) {
|
|
371
|
+
return this.transport ?? getHostFsV2(operation);
|
|
372
|
+
}
|
|
358
373
|
assertOpen(operation) {
|
|
359
374
|
if (!this.disposed) return;
|
|
360
375
|
throw new FsError("disposed", "Filesystem provider is disposed.", { operation });
|
|
@@ -525,12 +540,10 @@ function normalizeRemoveResult(value) {
|
|
|
525
540
|
}
|
|
526
541
|
return Object.freeze({ removed: value.removed, version: parseFileSystemVersion(value.version) });
|
|
527
542
|
}
|
|
528
|
-
function assertCapabilities(
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
for (const key of Object.keys(ELECTRON_FILE_SYSTEM_V2_CAPABILITIES)) {
|
|
533
|
-
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]) {
|
|
534
547
|
throw invalidTransport(operation, `Filesystem host capability mismatch: ${key}.`);
|
|
535
548
|
}
|
|
536
549
|
}
|
|
@@ -576,67 +589,6 @@ function createInstanceId() {
|
|
|
576
589
|
return `electron-fs-v2-${Date.now()}-${fallbackInstanceSequence}`;
|
|
577
590
|
}
|
|
578
591
|
|
|
579
|
-
// src/filesystem/electron-provider.ts
|
|
580
|
-
function getHostFs() {
|
|
581
|
-
const host = maybeGetDocBlocksHost();
|
|
582
|
-
if (!host) {
|
|
583
|
-
throw new Error(
|
|
584
|
-
"ElectronFileSystemProvider: docBlocksHost is not available \u2014 not running under Electron?"
|
|
585
|
-
);
|
|
586
|
-
}
|
|
587
|
-
return host.fs;
|
|
588
|
-
}
|
|
589
|
-
var ElectronFileSystemProvider = class {
|
|
590
|
-
constructor(id, label, rootPath) {
|
|
591
|
-
this.id = id;
|
|
592
|
-
this.label = label;
|
|
593
|
-
this.rootPath = rootPath;
|
|
594
|
-
this.v2 = new ElectronFileSystemProviderV2(id, label, rootPath);
|
|
595
|
-
}
|
|
596
|
-
/** Absolute path this provider is rooted at. */
|
|
597
|
-
getRootPath() {
|
|
598
|
-
return this.rootPath;
|
|
599
|
-
}
|
|
600
|
-
readFile(path) {
|
|
601
|
-
return getHostFs().readFile(this.id, path);
|
|
602
|
-
}
|
|
603
|
-
writeFile(path, content) {
|
|
604
|
-
return getHostFs().writeFile(this.id, path, content);
|
|
605
|
-
}
|
|
606
|
-
commitFile(path, content, expectedContent) {
|
|
607
|
-
return getHostFs().commitFile(this.id, path, content, expectedContent);
|
|
608
|
-
}
|
|
609
|
-
delete(path) {
|
|
610
|
-
return getHostFs().delete(this.id, path);
|
|
611
|
-
}
|
|
612
|
-
rename(oldPath, newPath) {
|
|
613
|
-
return getHostFs().rename(this.id, oldPath, newPath);
|
|
614
|
-
}
|
|
615
|
-
readDirectory(path) {
|
|
616
|
-
return getHostFs().readDirectory(this.id, path);
|
|
617
|
-
}
|
|
618
|
-
exists(path) {
|
|
619
|
-
return getHostFs().exists(this.id, path);
|
|
620
|
-
}
|
|
621
|
-
createDirectory(path) {
|
|
622
|
-
return getHostFs().createDirectory(this.id, path);
|
|
623
|
-
}
|
|
624
|
-
stat(path) {
|
|
625
|
-
return getHostFs().stat(this.id, path);
|
|
626
|
-
}
|
|
627
|
-
readBinary(path) {
|
|
628
|
-
return getHostFs().readBinary(this.id, path);
|
|
629
|
-
}
|
|
630
|
-
writeBinary(path, data) {
|
|
631
|
-
return getHostFs().writeBinary(this.id, path, data);
|
|
632
|
-
}
|
|
633
|
-
/** Subscribe to external change notifications under this root. */
|
|
634
|
-
watch(onChange) {
|
|
635
|
-
return getHostFs().watch(this.id, onChange);
|
|
636
|
-
}
|
|
637
|
-
};
|
|
638
|
-
|
|
639
592
|
export {
|
|
640
|
-
|
|
641
|
-
ElectronFileSystemProvider
|
|
593
|
+
HostFileSystemProviderV2
|
|
642
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,
|