@bendyline/docblocks 2.7.3 → 2.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/THIRD_PARTY_NOTICES.txt +37 -6
  2. package/dist/{capabilities-r03EXSAi.d.ts → capabilities-DHwh4P4D.d.ts} +29 -3
  3. package/dist/{chunk-KQ6756AJ.js → chunk-3GSMJ4MQ.js} +1 -1
  4. package/dist/{chunk-YWYT6K6J.js → chunk-3LXXRIO2.js} +1 -1
  5. package/dist/{chunk-ZTSG7AC3.js → chunk-64733GFL.js} +35 -2
  6. package/dist/{chunk-UK7R3RC7.js → chunk-BC42VRYW.js} +1 -1
  7. package/dist/{chunk-DFMRE22M.js → chunk-EFGQUOTL.js} +17 -3
  8. package/dist/{chunk-IGB2VSRE.js → chunk-FIEMYP2N.js} +2 -2
  9. package/dist/{chunk-M5ZNQGR5.js → chunk-IYKGM3PV.js} +1 -1
  10. package/dist/{chunk-6UPO2GE6.js → chunk-K5HRMSXD.js} +3 -3
  11. package/dist/{chunk-UDEWLHQI.js → chunk-LDAG5NTQ.js} +3 -3
  12. package/dist/{chunk-7SN7YQL4.js → chunk-LJLQYXVL.js} +99 -3
  13. package/dist/{chunk-4I4AG2BH.js → chunk-P32NVUQL.js} +2 -2
  14. package/dist/{chunk-HKOOHM67.js → chunk-Q3OFZWJS.js} +3 -3
  15. package/dist/{chunk-AYWKIZLD.js → chunk-UTH3HYCZ.js} +5 -1
  16. package/dist/{chunk-QS5WTLUZ.js → chunk-XI2LYBRR.js} +167 -0
  17. package/dist/document/index.d.ts +2 -2
  18. package/dist/document/index.js +3 -3
  19. package/dist/filesystem/electron.d.ts +5 -5
  20. package/dist/filesystem/electron.js +4 -4
  21. package/dist/filesystem/host.d.ts +4 -4
  22. package/dist/filesystem/host.js +4 -4
  23. package/dist/filesystem/index.d.ts +27 -8
  24. package/dist/filesystem/index.js +22 -12
  25. package/dist/filesystem/indexeddb.d.ts +2 -2
  26. package/dist/filesystem/indexeddb.js +4 -4
  27. package/dist/filesystem/memory.d.ts +2 -2
  28. package/dist/filesystem/memory.js +4 -4
  29. package/dist/filesystem/native.d.ts +2 -2
  30. package/dist/filesystem/native.js +4 -4
  31. package/dist/{filesystem-v2-C8AdSXUN.d.ts → filesystem-v2-CXdAPR27.d.ts} +1 -1
  32. package/dist/host/index.d.ts +7 -5
  33. package/dist/host/index.js +1 -1
  34. package/dist/host/mobile.d.ts +2 -2
  35. package/dist/host/mobile.js +1 -1
  36. package/dist/{host-provider-v2-CV0joXaL.d.ts → host-provider-v2-DEWMPiRD.d.ts} +2 -2
  37. package/dist/index.d.ts +8 -7
  38. package/dist/index.js +23 -13
  39. package/dist/mcp/index.js +2 -2
  40. package/dist/mcp/zod.js +2 -2
  41. package/dist/reconcile-electron-Ci2lhAdW.d.ts +142 -0
  42. package/dist/{types-BvDnr3YU.d.ts → types-DLteNrK0.d.ts} +3 -1
  43. package/dist/{v2-BVnZZyd4.d.ts → v2-DwxWjFC0.d.ts} +12 -1
  44. package/dist/vscode/index.d.ts +28 -2
  45. package/dist/vscode/index.js +21 -3
  46. package/dist/workspace/index.d.ts +41 -141
  47. package/dist/workspace/index.js +16 -1
  48. package/dist/workspace-index/index.d.ts +3 -1
  49. package/dist/workspace-index/index.js +18 -2
  50. package/dist/workspace-settings/index.d.ts +1 -1
  51. package/dist/workspace-settings/index.js +3 -3
  52. package/package.json +2 -2
@@ -1,145 +1,45 @@
1
- import { d as FileSystemProvider } from '../types-BvDnr3YU.js';
2
- import { Z as ElectronWorkspaceInfo, aj as HostEnvironment } from '../capabilities-r03EXSAi.js';
3
- import '../v2-BVnZZyd4.js';
4
- import '../workspace-path-CWVrcuPL.js';
5
- import '../filesystem-v2-C8AdSXUN.js';
1
+ export { D as DEFAULT_WORKSPACE_ID, E as ElectronWorkspaceReconciliation, T as TransientOrigin, W as WorkspaceDescriptor, e as ensureDefaultWorkspace, g as getTransientWorkspace, a as getWorkspace, l as listWorkspaces, p as parsePersistedWorkspaceList, r as reconcileElectronWorkspaceDescriptors, b as registerTransientWorkspace, c as removeWorkspace, s as saveWorkspace, t as touchWorkspace, u as unregisterTransientWorkspace } from '../reconcile-electron-Ci2lhAdW.js';
2
+ import { ContentContainer } from '@bendyline/squisq/storage';
3
+ import { o as FileSystemProviderV2 } from '../v2-DwxWjFC0.js';
4
+ import { a as WorkspacePath } from '../workspace-path-CWVrcuPL.js';
5
+ import '../types-DLteNrK0.js';
6
+ import '../capabilities-DHwh4P4D.js';
7
+ import '../filesystem-v2-CXdAPR27.js';
6
8
 
7
- /**
8
- * Origin of a transient workspace — records where its contents came from and
9
- * how to save them back. Set only on `type: 'transient'` workspaces.
10
- * - 'loose-file' — a single markdown file opened from the OS (Electron);
11
- * edits write back through an owner-scoped `resourceId` grant.
12
- * - 'dbk' — a `.dbk`/zip bundle unpacked into memory (Electron); edits are
13
- * re-zipped and written back through an owner-scoped resource grant.
14
- * - 'web-file' — a single markdown file launched into the installed web app
15
- * (File Handling API); edits write back through `handle`.
16
- * - 'web-dbk' — a `.dbk`/zip bundle launched into the installed web app;
17
- * edits are re-zipped and written back through `handle`.
18
- *
19
- * The web variants hold a live `FileSystemFileHandle`. That is safe because
20
- * transient descriptors are never persisted — they live only in the
21
- * in-memory registry (see workspace-manager) for the current page session.
22
- */
23
- type TransientOrigin = {
24
- kind: 'loose-file';
25
- resourceId: string;
26
- } | {
27
- kind: 'dbk';
28
- resourceId: string;
29
- /** SHA-256 of the last bundle version acknowledged by the host. */
30
- version: string | null;
31
- } | {
32
- kind: 'web-file';
33
- handle: FileSystemFileHandle;
34
- name: string;
35
- } | {
36
- kind: 'web-dbk';
37
- handle: FileSystemFileHandle;
38
- name: string;
39
- /** SHA-256 of the last bundle version observed on disk. */
40
- version: string | null;
41
- };
42
- /**
43
- * Workspace — a named binding to a FileSystemProvider, representing
44
- * the user's current working context (a folder of markdown files).
45
- */
46
- interface WorkspaceDescriptor {
47
- /** Unique stable identifier (persisted in IndexedDB). */
48
- id: string;
49
- /** User-visible label. */
50
- name: string;
51
- /**
52
- * Provider kind:
53
- * - 'indexeddb' — browser-local storage (web only)
54
- * - 'native' — File System Access API (web Chrome/Edge only)
55
- * - 'host-native' — Electron main-process native filesystem
56
- * - 'transient' — session-only, in-memory (a loose file/`.dbk` opened from
57
- * the OS, or a document copied from a shared URL). Never persisted; its
58
- * provider lives in an in-memory registry (see workspace-manager). An
59
- * `origin` is present only when changes can be saved back externally.
60
- */
61
- type: 'indexeddb' | 'native' | 'host-native' | 'transient';
62
- /** ISO timestamp of last access. */
63
- lastOpened: string;
64
- /** Absolute filesystem path for 'host-native' workspaces. */
65
- rootPath?: string;
66
- /** For 'transient' workspaces: where the contents came from / save back to. */
67
- origin?: TransientOrigin;
68
- /**
69
- * Per-workspace override for the global versioning preference. When
70
- * `'inherit'` (or absent), the global preference applies. `'on'` /
71
- * `'off'` force the corresponding behavior regardless of the global
72
- * setting. See `resolveVersioningEnabled` in the preferences module.
73
- */
74
- versioningOverride?: 'inherit' | 'on' | 'off';
9
+ declare const WORKSPACE_BACKUP_MANIFEST = "docblocks-backup.json";
10
+ declare const WORKSPACE_BACKUP_LIMITS: Readonly<{
11
+ maxEntries: 10000;
12
+ maxUncompressedBytes: number;
13
+ maxEntryUncompressedBytes: number;
14
+ maxCompressionRatio: 1000;
15
+ }>;
16
+ interface BackupWorkspace {
17
+ readonly name: string;
18
+ readonly prefix: string;
19
+ readonly directories: readonly WorkspacePath[];
75
20
  }
76
-
77
- /** Parse the complete persisted workspace list before it reaches startup code. */
78
- declare function parsePersistedWorkspaceList(value: unknown): WorkspaceDescriptor[];
79
-
80
- /**
81
- * WorkspaceManager — manages the list of known workspaces in IndexedDB
82
- * and provides helpers for creating / switching / removing them.
83
- *
84
- * The actual FileSystemProvider instances are created by the caller
85
- * (since native providers need a DirectoryHandle from user interaction).
86
- */
87
-
88
- /** Id of the browser-local workspace `ensureDefaultWorkspace` creates. */
89
- declare const DEFAULT_WORKSPACE_ID = "default";
90
- /** Register a transient workspace and its (already-built) provider. */
91
- declare function registerTransientWorkspace(descriptor: WorkspaceDescriptor, provider: FileSystemProvider): void;
92
- /** Look up a transient workspace (descriptor + provider) by id, if any. */
93
- declare function getTransientWorkspace(id: string): {
94
- descriptor: WorkspaceDescriptor;
95
- provider: FileSystemProvider;
96
- } | null;
97
- /** Forget a transient workspace (e.g. when it is closed). */
98
- declare function unregisterTransientWorkspace(id: string): Promise<void>;
99
- /**
100
- * Get all known workspace descriptors — persisted plus any session-only
101
- * transient ones (so they show in the picker and resolve for the session).
102
- */
103
- declare function listWorkspaces(): Promise<WorkspaceDescriptor[]>;
104
- /**
105
- * Get a specific workspace descriptor by id (transient or persisted).
106
- */
107
- declare function getWorkspace(id: string): Promise<WorkspaceDescriptor | null>;
108
- /**
109
- * Add or update a workspace descriptor. If a workspace with the same id
110
- * already exists, it is replaced. Transient workspaces are never persisted.
111
- */
112
- declare function saveWorkspace(workspace: WorkspaceDescriptor): Promise<void>;
113
- /**
114
- * Remove a workspace descriptor by id (transient or persisted).
115
- */
116
- declare function removeWorkspace(id: string): Promise<void>;
117
- /**
118
- * Touch the lastOpened timestamp on a workspace. For transient workspaces this
119
- * updates the in-memory descriptor only (nothing is persisted).
120
- */
121
- declare function touchWorkspace(id: string): Promise<void>;
122
- /**
123
- * Ensure a default IndexedDB workspace exists. Called on app startup.
124
- * Returns the descriptor.
125
- */
126
- declare function ensureDefaultWorkspace(): Promise<WorkspaceDescriptor>;
127
-
128
- interface ElectronWorkspaceReconciliation {
129
- /** Obsolete renderer descriptors to remove before attempting restoration. */
130
- readonly removeIds: readonly string[];
131
- /** Canonical main-authorized descriptors to insert or replace. */
132
- readonly upsert: readonly WorkspaceDescriptor[];
133
- /** Safe navigation migration for a local descriptor matched by root. */
134
- readonly idRemap: Readonly<Record<string, string>>;
21
+ interface WorkspaceBackupManifest {
22
+ readonly format: 'docblocks-workspace-backup';
23
+ readonly version: 1;
24
+ readonly workspaces: readonly BackupWorkspace[];
135
25
  }
136
- /**
137
- * Reconcile renderer IndexedDB metadata with the main process authority list.
138
- * `hostWorkspaces` is authoritative: local Electron descriptors absent from
139
- * it cannot be opened safely and are removed. Root-path matching carries user
140
- * metadata across an id migration without treating that display path as
141
- * authority.
142
- */
143
- declare function reconcileElectronWorkspaceDescriptors(local: readonly WorkspaceDescriptor[], hostWorkspaces: readonly ElectronWorkspaceInfo[], platform: HostEnvironment['platform'], now: string): ElectronWorkspaceReconciliation;
26
+ interface RestorableWorkspace {
27
+ readonly name: string;
28
+ readonly directories: readonly WorkspacePath[];
29
+ readonly files: readonly {
30
+ path: WorkspacePath;
31
+ data: ArrayBuffer;
32
+ }[];
33
+ }
34
+ declare function parseWorkspaceBackupManifest(value: unknown): WorkspaceBackupManifest;
35
+ /** Capture bytes and empty directories without modifying the source workspace. */
36
+ declare function appendWorkspaceBackup(container: ContentContainer, provider: FileSystemProviderV2, previous: readonly BackupWorkspace[]): Promise<BackupWorkspace[]>;
37
+ declare function finishWorkspaceBackup(container: ContentContainer, workspaces: readonly BackupWorkspace[]): Promise<void>;
38
+ /** Validate the complete archive before creating any destination workspace.
39
+ * Legacy plain ZIP backups restore as one workspace, retaining their full tree.
40
+ */
41
+ declare function readWorkspaceBackup(container: ContentContainer, legacyName: string): Promise<RestorableWorkspace[]>;
42
+ /** Only an empty, newly allocated destination may receive a restored tree. */
43
+ declare function restoreWorkspaceBackup(workspace: RestorableWorkspace, provider: FileSystemProviderV2): Promise<void>;
144
44
 
145
- export { DEFAULT_WORKSPACE_ID, type ElectronWorkspaceReconciliation, type TransientOrigin, type WorkspaceDescriptor, ensureDefaultWorkspace, getTransientWorkspace, getWorkspace, listWorkspaces, parsePersistedWorkspaceList, reconcileElectronWorkspaceDescriptors, registerTransientWorkspace, removeWorkspace, saveWorkspace, touchWorkspace, unregisterTransientWorkspace };
45
+ export { type BackupWorkspace, type RestorableWorkspace, WORKSPACE_BACKUP_LIMITS, WORKSPACE_BACKUP_MANIFEST, type WorkspaceBackupManifest, appendWorkspaceBackup, finishWorkspaceBackup, parseWorkspaceBackupManifest, readWorkspaceBackup, restoreWorkspaceBackup };
@@ -1,29 +1,44 @@
1
1
  import {
2
2
  DEFAULT_WORKSPACE_ID,
3
+ WORKSPACE_BACKUP_LIMITS,
4
+ WORKSPACE_BACKUP_MANIFEST,
5
+ appendWorkspaceBackup,
3
6
  ensureDefaultWorkspace,
7
+ finishWorkspaceBackup,
4
8
  getTransientWorkspace,
5
9
  getWorkspace,
6
10
  listWorkspaces,
7
11
  parsePersistedWorkspaceList,
12
+ parseWorkspaceBackupManifest,
13
+ readWorkspaceBackup,
8
14
  reconcileElectronWorkspaceDescriptors,
9
15
  registerTransientWorkspace,
10
16
  removeWorkspace,
17
+ restoreWorkspaceBackup,
11
18
  saveWorkspace,
12
19
  touchWorkspace,
13
20
  unregisterTransientWorkspace
14
- } from "../chunk-QS5WTLUZ.js";
21
+ } from "../chunk-XI2LYBRR.js";
15
22
  import "../chunk-DAPFSEKY.js";
16
23
  import "../chunk-XAMILHQP.js";
24
+ import "../chunk-UTH3HYCZ.js";
17
25
  export {
18
26
  DEFAULT_WORKSPACE_ID,
27
+ WORKSPACE_BACKUP_LIMITS,
28
+ WORKSPACE_BACKUP_MANIFEST,
29
+ appendWorkspaceBackup,
19
30
  ensureDefaultWorkspace,
31
+ finishWorkspaceBackup,
20
32
  getTransientWorkspace,
21
33
  getWorkspace,
22
34
  listWorkspaces,
23
35
  parsePersistedWorkspaceList,
36
+ parseWorkspaceBackupManifest,
37
+ readWorkspaceBackup,
24
38
  reconcileElectronWorkspaceDescriptors,
25
39
  registerTransientWorkspace,
26
40
  removeWorkspace,
41
+ restoreWorkspaceBackup,
27
42
  saveWorkspace,
28
43
  touchWorkspace,
29
44
  unregisterTransientWorkspace
@@ -1,4 +1,4 @@
1
- import { n as FileSystemProviderV2, m as FileSystemProviderCapabilities } from '../v2-BVnZZyd4.js';
1
+ import { o as FileSystemProviderV2, n as FileSystemProviderCapabilities } from '../v2-DwxWjFC0.js';
2
2
  import { a as WorkspacePath } from '../workspace-path-CWVrcuPL.js';
3
3
  import { d as CatalogDocumentFormat, f as CatalogOutlineEntry } from '../catalog-BQK05tne.js';
4
4
  import '@bendyline/squisq/markdown';
@@ -151,6 +151,8 @@ interface WorkspaceIndex {
151
151
  start(): void;
152
152
  /** Every discoverable file, sorted by path; the same array within a generation. */
153
153
  getFiles(): readonly WorkspaceIndexFile[];
154
+ /** Discoverable folders, including empty folders; sorted within a generation. */
155
+ getDirectories(): readonly WorkspacePath[];
154
156
  /** Every document (Markdown and outside-in), sorted by path. */
155
157
  getDocuments(): readonly IndexedDocument[];
156
158
  getDocument(path: string): IndexedDocument | null;
@@ -11,14 +11,14 @@ import {
11
11
  } from "../chunk-YHSFRPBS.js";
12
12
  import {
13
13
  decodeUtf8Text
14
- } from "../chunk-M5ZNQGR5.js";
14
+ } from "../chunk-IYKGM3PV.js";
15
15
  import {
16
16
  FsError,
17
17
  WORKSPACE_ROOT,
18
18
  parseWorkspacePath,
19
19
  tryParseWorkspacePath,
20
20
  workspacePathContains
21
- } from "../chunk-AYWKIZLD.js";
21
+ } from "../chunk-UTH3HYCZ.js";
22
22
 
23
23
  // src/workspace-index/search-text.ts
24
24
  var LineBuilder = class {
@@ -533,6 +533,7 @@ var WorkspaceIndexImpl = class {
533
533
  this.generation = 0;
534
534
  this.lastPublish = 0;
535
535
  this.filesCache = null;
536
+ this.directoriesCache = null;
536
537
  this.documentsCache = null;
537
538
  this.statusCache = null;
538
539
  this.workspaceId = options.workspaceId;
@@ -592,6 +593,20 @@ var WorkspaceIndexImpl = class {
592
593
  }
593
594
  return this.documentsCache;
594
595
  }
596
+ getDirectories() {
597
+ if (!this.directoriesCache) {
598
+ const directories = new Set(this.tree.directories);
599
+ for (const path of [...this.tree.directories, ...this.tree.files.keys()]) {
600
+ let slash = path.lastIndexOf("/");
601
+ while (slash >= 0) {
602
+ directories.add(parseWorkspacePath(path.slice(0, slash)));
603
+ slash = path.lastIndexOf("/", slash - 1);
604
+ }
605
+ }
606
+ this.directoriesCache = Object.freeze([...directories].sort(compareCodeUnits2));
607
+ }
608
+ return this.directoriesCache;
609
+ }
595
610
  getDocument(path) {
596
611
  const canonical = tryParseWorkspacePath(path);
597
612
  const state = canonical === null ? void 0 : this.tree.documents.get(canonical);
@@ -1167,6 +1182,7 @@ var WorkspaceIndexImpl = class {
1167
1182
  this.generation += 1;
1168
1183
  this.lastPublish = this.now();
1169
1184
  this.filesCache = null;
1185
+ this.directoriesCache = null;
1170
1186
  this.documentsCache = null;
1171
1187
  this.statusCache = null;
1172
1188
  for (const listener of [...this.listeners]) {
@@ -3,7 +3,7 @@ export { b as CATALOG_JSON_CONTENT_MODES, c as CATALOG_SORT_ORDERS, d as Catalog
3
3
  import { C as CatalogEntry, W as WorkspaceCatalog } from '../catalog-BQK05tne.js';
4
4
  export { a as CATALOG_FORMAT_VERSION, b as CATALOG_GENERATOR, c as CATALOG_LIMITS, d as CatalogDocumentFormat, e as CatalogEntryHints, f as CatalogOutlineEntry, g as CatalogSource, O as OUTSIDE_IN_FORMAT_IDS, h as OutsideInFormatId, i as OutsideInLayout, j as buildCatalogMarkdownDocument, k as catalogEntryForUnreadable, l as catalogEntryFromDocument, m as catalogEntryFromMarkdown, n as chooseOutsideInMarkdownPath, o as createWorkspaceCatalog, p as isGeneratedCatalogHtml, q as isGeneratedCatalogJson, r as readCatalogHtmlDigest, s as relativeCatalogLink, t as relocateOutsideInLayout, u as resolveOutsideInLayout, v as serializeCatalogJson, w as sortCatalogEntries, x as stampCatalogHtml } from '../catalog-BQK05tne.js';
5
5
  import { MarkdownDocument } from '@bendyline/squisq/markdown';
6
- import { u as FileSystemVersion, n as FileSystemProviderV2 } from '../v2-BVnZZyd4.js';
6
+ import { v as FileSystemVersion, o as FileSystemProviderV2 } from '../v2-DwxWjFC0.js';
7
7
  import { a as WorkspacePath } from '../workspace-path-CWVrcuPL.js';
8
8
 
9
9
  /**
@@ -48,7 +48,7 @@ import {
48
48
  serializeWorkspaceSettings,
49
49
  tryApplyWorkspaceSettingsPatch,
50
50
  validateCatalogOutputPath
51
- } from "../chunk-UK7R3RC7.js";
51
+ } from "../chunk-BC42VRYW.js";
52
52
  import {
53
53
  SQUISQ_RUNTIME_DIRECTORY_NAME,
54
54
  isDiscoverableWorkspaceEntry,
@@ -57,12 +57,12 @@ import {
57
57
  } from "../chunk-YHSFRPBS.js";
58
58
  import {
59
59
  decodeUtf8Text
60
- } from "../chunk-M5ZNQGR5.js";
60
+ } from "../chunk-IYKGM3PV.js";
61
61
  import {
62
62
  FsError,
63
63
  WORKSPACE_ROOT,
64
64
  parseWorkspacePath
65
- } from "../chunk-AYWKIZLD.js";
65
+ } from "../chunk-UTH3HYCZ.js";
66
66
 
67
67
  // src/workspace-settings/schema.ts
68
68
  var themeId = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/docblocks",
3
- "version": "2.7.3",
3
+ "version": "2.7.5",
4
4
  "description": "Core data structures and filesystem abstractions for DocBlocks",
5
5
  "license": "MIT",
6
6
  "author": "Bendyline",
@@ -126,7 +126,7 @@
126
126
  "typecheck": "tsc --noEmit"
127
127
  },
128
128
  "dependencies": {
129
- "@bendyline/squisq": "2.12.3",
129
+ "@bendyline/squisq": "2.13.0",
130
130
  "zod": "3.25.76"
131
131
  }
132
132
  }