mdzilla 0.2.0 → 0.2.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/dist/index.d.mts CHANGED
@@ -21,12 +21,19 @@ interface NavEntry {
21
21
  }
22
22
  //#endregion
23
23
  //#region src/sources/_base.d.ts
24
+ type WatchCallback = (event: {
25
+ path: string;
26
+ }) => void;
24
27
  declare abstract class Source {
25
28
  abstract load(): Promise<{
26
29
  tree: NavEntry[];
27
30
  fileMap: Map<string, string>;
28
31
  }>;
29
32
  abstract readContent(filePath: string): Promise<string>;
33
+ /** Start watching for file changes. Override in sources that support it. */
34
+ watch(_callback: WatchCallback): void;
35
+ /** Stop watching. Override in sources that support it. */
36
+ unwatch(): void;
30
37
  }
31
38
  //#endregion
32
39
  //#region src/collection.d.ts
@@ -53,9 +60,17 @@ declare class Collection {
53
60
  flat: FlatEntry[];
54
61
  private _fileMap;
55
62
  private _contentCache;
63
+ private _changeListeners;
64
+ private _reloadTimer?;
56
65
  constructor(source: Source);
57
66
  load(): Promise<void>;
58
67
  reload(): Promise<void>;
68
+ /** Start watching source for changes. Debounces, reloads collection, and notifies listeners. */
69
+ watch(): void;
70
+ /** Stop watching source. */
71
+ unwatch(): void;
72
+ /** Register a change listener. Returns unsubscribe function. */
73
+ onChange(listener: (path: string) => void): () => void;
59
74
  /** Get raw file content for a flat entry (cached). */
60
75
  getContent(entry: FlatEntry): Promise<string | undefined>;
61
76
  /** Invalidate cached content for a specific file path. */
@@ -92,12 +107,15 @@ declare function extractSnippets(content: string, terms: string[], opts?: {
92
107
  //#region src/sources/fs.d.ts
93
108
  declare class FSSource extends Source {
94
109
  dir: string;
110
+ private _watcher?;
95
111
  constructor(dir: string);
96
112
  load(): Promise<{
97
113
  tree: NavEntry[];
98
114
  fileMap: Map<string, string>;
99
115
  }>;
100
116
  readContent(filePath: string): Promise<string>;
117
+ watch(callback: WatchCallback): void;
118
+ unwatch(): void;
101
119
  }
102
120
  //#endregion
103
121
  //#region src/sources/git.d.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mdzilla",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "repository": "pi0/mdzilla",
@@ -31,22 +31,22 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@speed-highlight/core": "^1.2.15",
34
- "giget": "^3.1.2",
34
+ "giget": "^3.2.0",
35
35
  "md4x": "^0.0.25",
36
36
  "srvx": "^0.11.13",
37
37
  "std-env": "^4.0.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/node": "^25.5.0",
41
- "@typescript/native-preview": "^7.0.0-dev.20260325.1",
42
- "@vitest/coverage-v8": "^4.1.1",
41
+ "@typescript/native-preview": "^7.0.0-dev.20260327.2",
42
+ "@vitest/coverage-v8": "^4.1.2",
43
43
  "automd": "^0.4.3",
44
44
  "changelogen": "^0.6.2",
45
45
  "obuild": "^0.4.32",
46
46
  "oxfmt": "^0.42.0",
47
47
  "oxlint": "^1.57.0",
48
48
  "typescript": "^6.0.2",
49
- "vitest": "^4.1.1"
49
+ "vitest": "^4.1.2"
50
50
  },
51
51
  "packageManager": "pnpm@10.33.0"
52
52
  }