doccupine 0.0.144 → 0.0.146

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 (51) hide show
  1. package/dist/generator/api-reference-generator.d.ts +4 -2
  2. package/dist/generator/api-reference-generator.js +32 -31
  3. package/dist/generator/app-scaffolder.d.ts +1 -2
  4. package/dist/generator/app-scaffolder.js +1 -6
  5. package/dist/generator/generated-page-publisher.d.ts +21 -0
  6. package/dist/generator/generated-page-publisher.js +124 -0
  7. package/dist/generator/generated-route-manager.d.ts +7 -3
  8. package/dist/generator/generated-route-manager.js +55 -19
  9. package/dist/generator/mdx-pass-builder.d.ts +31 -0
  10. package/dist/generator/mdx-pass-builder.js +45 -0
  11. package/dist/generator/openapi-refresh-coordinator.d.ts +42 -0
  12. package/dist/generator/openapi-refresh-coordinator.js +211 -0
  13. package/dist/generator/page-catalog.d.ts +4 -0
  14. package/dist/generator/page-catalog.js +8 -1
  15. package/dist/generator/project-config-repository.d.ts +8 -0
  16. package/dist/generator/project-config-repository.js +73 -15
  17. package/dist/generator/section-index-generator.d.ts +10 -0
  18. package/dist/generator/section-index-generator.js +68 -0
  19. package/dist/generator/secure-source-fs.d.ts +5 -1
  20. package/dist/generator/secure-source-fs.js +112 -3
  21. package/dist/generator/site-artifacts.d.ts +3 -2
  22. package/dist/generator/site-artifacts.js +6 -9
  23. package/dist/generator/watch-coordinator.d.ts +11 -2
  24. package/dist/generator/watch-coordinator.js +157 -62
  25. package/dist/lib/config-manager.d.ts +1 -0
  26. package/dist/lib/config-manager.js +194 -12
  27. package/dist/lib/generated-artifacts.d.ts +8 -2
  28. package/dist/lib/generated-artifacts.js +25 -6
  29. package/dist/lib/openapi.d.ts +4 -0
  30. package/dist/lib/openapi.js +36 -4
  31. package/dist/lib/output-safety.js +10 -3
  32. package/dist/mdx-to-nextjs-generator.d.ts +38 -23
  33. package/dist/mdx-to-nextjs-generator.js +521 -310
  34. package/dist/templates/mdx/api-playground.mdx.d.ts +1 -1
  35. package/dist/templates/mdx/api-playground.mdx.js +11 -2
  36. package/dist/templates/mdx/commands.mdx.d.ts +1 -1
  37. package/dist/templates/mdx/commands.mdx.js +26 -1
  38. package/dist/templates/mdx/media-and-assets.mdx.d.ts +1 -1
  39. package/dist/templates/mdx/media-and-assets.mdx.js +5 -0
  40. package/dist/templates/mdx/model-context-protocol.mdx.d.ts +1 -1
  41. package/dist/templates/mdx/model-context-protocol.mdx.js +2 -1
  42. package/dist/templates/mdx/platform/api-playground.mdx.d.ts +1 -1
  43. package/dist/templates/mdx/platform/api-playground.mdx.js +2 -2
  44. package/dist/templates/mdx/platform/publishing.mdx.d.ts +1 -1
  45. package/dist/templates/mdx/platform/publishing.mdx.js +3 -3
  46. package/dist/templates/mdx/what-is-doccupine.mdx.d.ts +1 -1
  47. package/dist/templates/mdx/what-is-doccupine.mdx.js +8 -3
  48. package/dist/templates/package.js +1 -1
  49. package/dist/templates/utils/orderNavItems.d.ts +1 -1
  50. package/dist/templates/utils/orderNavItems.js +1 -1
  51. package/package.json +2 -2
@@ -1,6 +1,5 @@
1
1
  import chalk from "chalk";
2
2
  import fs from "fs-extra";
3
- import path from "node:path";
4
3
  import { resolveOutputPath } from "../lib/output-safety.js";
5
4
  import { safeMatter, writeFileAtomic } from "../lib/utils.js";
6
5
  import { robotsTemplate } from "../templates/app/robots.js";
@@ -8,14 +7,13 @@ import { sitemapTemplate, } from "../templates/app/sitemap.js";
8
7
  import { llmsFullTemplate, } from "../templates/llms/llmsFull.js";
9
8
  import { llmsIndexTemplate } from "../templates/llms/llmsIndex.js";
10
9
  import { skillMdTemplate } from "../templates/llms/skillMd.js";
11
- export async function loadSiteUrl(rootDir) {
10
+ export async function loadSiteUrl(readConfigSource) {
12
11
  const fromEnv = process.env.NEXT_PUBLIC_SITE_URL?.trim();
13
12
  if (fromEnv)
14
13
  return fromEnv.replace(/\/$/, "");
15
- const configPath = path.join(rootDir, "config.json");
16
14
  try {
17
- if (await fs.pathExists(configPath)) {
18
- const content = await fs.readFile(configPath, "utf8");
15
+ const content = await readConfigSource();
16
+ if (content !== null) {
19
17
  const parsed = JSON.parse(content);
20
18
  if (typeof parsed.url === "string" && parsed.url.trim() !== "") {
21
19
  return parsed.url.trim().replace(/\/$/, "");
@@ -27,8 +25,7 @@ export async function loadSiteUrl(rootDir) {
27
25
  }
28
26
  return null;
29
27
  }
30
- export async function loadSiteMetadata(rootDir) {
31
- const configPath = path.join(rootDir, "config.json");
28
+ export async function loadSiteMetadata(readConfigSource) {
32
29
  let url = null;
33
30
  let name = "Documentation";
34
31
  let description = "";
@@ -36,8 +33,8 @@ export async function loadSiteMetadata(rootDir) {
36
33
  const fromEnv = process.env.NEXT_PUBLIC_SITE_URL?.trim();
37
34
  if (fromEnv)
38
35
  url = fromEnv.replace(/\/$/, "");
39
- if (await fs.pathExists(configPath)) {
40
- const content = await fs.readFile(configPath, "utf8");
36
+ const content = await readConfigSource();
37
+ if (content !== null) {
41
38
  const parsed = JSON.parse(content);
42
39
  if (!url && typeof parsed.url === "string" && parsed.url.trim() !== "") {
43
40
  url = parsed.url.trim().replace(/\/$/, "");
@@ -26,6 +26,7 @@ interface WatchCoordinatorOptions {
26
26
  doccupineConfigFile: string;
27
27
  sourceFs: SecureSourceFs;
28
28
  getOpenApiSpecs(): readonly NormalizedOpenApiSpec[];
29
+ getOpenApiSourceFiles(): readonly string[];
29
30
  callbacks: WatchCoordinatorCallbacks;
30
31
  }
31
32
  export declare class WatchCoordinator {
@@ -41,17 +42,25 @@ export declare class WatchCoordinator {
41
42
  private mutationQueue;
42
43
  private stopping;
43
44
  private readyCancellations;
45
+ private pendingWatcherClosures;
44
46
  private sourceSnapshot;
45
47
  private publicWatcherStarting;
48
+ private publicWatcherRestartRequested;
46
49
  constructor(options: WatchCoordinatorOptions);
47
50
  private enqueueMutation;
51
+ private closeDetachedWatcher;
48
52
  private waitForWatcherReady;
53
+ private trackWatcherReady;
54
+ private waitForPublicWatcherReady;
49
55
  private captureSourceSnapshot;
50
- establishSourceSnapshot(): Promise<void>;
56
+ establishSourceSnapshot(projectSourceStates?: Readonly<Record<string, string>>, openApiSourceState?: string, doccupineSourceState?: string): Promise<void>;
51
57
  private reconcileWatchedSources;
52
58
  startWatching(): Promise<void>;
59
+ private startWatchers;
53
60
  private setupPublicWatcher;
54
- syncOpenApiSpecWatcher(specs: readonly NormalizedOpenApiSpec[]): Promise<void>;
61
+ syncOpenApiSpecWatcher(specs: readonly NormalizedOpenApiSpec[], sourceFiles?: readonly string[]): Promise<void>;
55
62
  stop(): Promise<void>;
63
+ private drainMutationQueue;
64
+ private closeCurrentWatchers;
56
65
  }
57
66
  export {};
@@ -16,8 +16,10 @@ export class WatchCoordinator {
16
16
  mutationQueue = Promise.resolve();
17
17
  stopping = false;
18
18
  readyCancellations = new Set();
19
+ pendingWatcherClosures = new Set();
19
20
  sourceSnapshot = null;
20
21
  publicWatcherStarting = false;
22
+ publicWatcherRestartRequested = false;
21
23
  constructor(options) {
22
24
  this.options = options;
23
25
  }
@@ -26,6 +28,15 @@ export class WatchCoordinator {
26
28
  console.error(chalk.red(`❌ ${label}:`), error);
27
29
  });
28
30
  }
31
+ async closeDetachedWatcher(watcher) {
32
+ try {
33
+ await watcher.close();
34
+ }
35
+ catch (error) {
36
+ this.pendingWatcherClosures.add(watcher);
37
+ throw error;
38
+ }
39
+ }
29
40
  waitForWatcherReady(watcher) {
30
41
  if (this.stopping)
31
42
  return Promise.resolve();
@@ -52,15 +63,44 @@ export class WatchCoordinator {
52
63
  watcher.once("error", onError);
53
64
  });
54
65
  }
66
+ trackWatcherReady(ready, promise) {
67
+ // Startup performs other async work before awaiting the full ready set.
68
+ // Attach a handler now so an early watcher error is never unhandled.
69
+ void promise.catch(() => { });
70
+ ready.push(promise);
71
+ }
72
+ async waitForPublicWatcherReady() {
73
+ const watcher = this.setupPublicWatcher();
74
+ try {
75
+ await this.waitForWatcherReady(watcher);
76
+ }
77
+ catch (error) {
78
+ watcher.removeAllListeners();
79
+ watcher.on("error", (watcherError) => {
80
+ console.error(chalk.red("❌ Detached public watcher error:"), watcherError);
81
+ });
82
+ if (this.publicWatcher === watcher)
83
+ this.publicWatcher = null;
84
+ try {
85
+ await this.closeDetachedWatcher(watcher);
86
+ }
87
+ catch (closeError) {
88
+ throw new AggregateError([error, closeError], "Public watcher startup failed and cleanup was incomplete");
89
+ }
90
+ throw error;
91
+ }
92
+ }
55
93
  async captureSourceSnapshot() {
56
- const { analyticsConfigFile, configFiles, doccupineConfigFile, fontConfigFile, getOpenApiSpecs, rootDir, sourceFs, watchDir, } = this.options;
94
+ const { analyticsConfigFile, configFiles, doccupineConfigFile, fontConfigFile, getOpenApiSpecs, getOpenApiSourceFiles, rootDir, sourceFs, watchDir, } = this.options;
57
95
  const configs = Object.fromEntries(await Promise.all(configFiles.map(async (fileName) => [
58
96
  fileName,
59
97
  await sourceFs.pathState(path.join(rootDir, fileName), true),
60
98
  ])));
61
- const openapi = (await Promise.all(getOpenApiSpecs().map(async (spec) => {
62
- const specPath = path.resolve(rootDir, spec.file);
63
- return `${specPath}:${await sourceFs.pathState(specPath, true)}`;
99
+ const openApiSourceFiles = getOpenApiSourceFiles();
100
+ const openapi = (await Promise.all((openApiSourceFiles.length > 0
101
+ ? openApiSourceFiles
102
+ : getOpenApiSpecs().map((spec) => path.resolve(rootDir, spec.file))).map(async (sourcePath) => {
103
+ return `${sourcePath}:${await sourceFs.pathState(sourcePath, true)}`;
64
104
  }))).join("\n");
65
105
  return {
66
106
  mdx: await sourceFs.treeState(watchDir, (relativePath) => relativePath.toLowerCase().endsWith(".mdx"), true),
@@ -72,8 +112,21 @@ export class WatchCoordinator {
72
112
  openapi,
73
113
  };
74
114
  }
75
- async establishSourceSnapshot() {
76
- this.sourceSnapshot = await this.captureSourceSnapshot();
115
+ async establishSourceSnapshot(projectSourceStates = {}, openApiSourceState, doccupineSourceState) {
116
+ const snapshot = await this.captureSourceSnapshot();
117
+ for (const fileName of this.options.configFiles) {
118
+ if (projectSourceStates[fileName] !== undefined) {
119
+ snapshot.configs[fileName] = projectSourceStates[fileName];
120
+ }
121
+ }
122
+ snapshot.font =
123
+ projectSourceStates[this.options.fontConfigFile] ?? snapshot.font;
124
+ snapshot.analytics =
125
+ projectSourceStates[this.options.analyticsConfigFile] ??
126
+ snapshot.analytics;
127
+ snapshot.openapi = openApiSourceState ?? snapshot.openapi;
128
+ snapshot.doccupine = doccupineSourceState ?? snapshot.doccupine;
129
+ this.sourceSnapshot = snapshot;
77
130
  }
78
131
  async reconcileWatchedSources(previous, current) {
79
132
  const { analyticsConfigFile, callbacks, configFiles, doccupineConfigFile, fontConfigFile, getOpenApiSpecs, rootDir, } = this.options;
@@ -121,14 +174,13 @@ export class WatchCoordinator {
121
174
  if (!this.stopping &&
122
175
  !this.publicWatcher &&
123
176
  (await fs.pathExists(publicDir))) {
124
- await this.waitForWatcherReady(this.setupPublicWatcher());
177
+ await this.waitForPublicWatcherReady();
125
178
  if (this.stopping)
126
179
  return;
127
180
  }
128
181
  await callbacks.copyPublicFiles();
129
182
  }
130
- if (!doccupineChanged &&
131
- getOpenApiSpecs().length > 0 &&
183
+ if (getOpenApiSpecs().length > 0 &&
132
184
  (previous === null || previous.openapi !== current.openapi)) {
133
185
  await callbacks.handleOpenApiChange();
134
186
  }
@@ -138,8 +190,23 @@ export class WatchCoordinator {
138
190
  }
139
191
  }
140
192
  async startWatching() {
193
+ try {
194
+ await this.startWatchers();
195
+ }
196
+ catch (error) {
197
+ try {
198
+ await this.stop();
199
+ }
200
+ catch (cleanupError) {
201
+ throw new AggregateError([error, cleanupError], "Watcher startup failed and cleanup was incomplete");
202
+ }
203
+ throw error;
204
+ }
205
+ }
206
+ async startWatchers() {
141
207
  const { analyticsConfigFile, callbacks, configFiles, doccupineConfigFile, fontConfigFile, rootDir, watchDir, } = this.options;
142
208
  this.stopping = false;
209
+ this.publicWatcherRestartRequested = false;
143
210
  console.log(chalk.yellow(`👀 Watching for changes in: ${watchDir}`));
144
211
  const ready = [];
145
212
  this.watcher = chokidar.watch(watchDir, {
@@ -158,7 +225,7 @@ export class WatchCoordinator {
158
225
  return false;
159
226
  },
160
227
  });
161
- ready.push(this.waitForWatcherReady(this.watcher));
228
+ this.trackWatcherReady(ready, this.waitForWatcherReady(this.watcher));
162
229
  this.watcher
163
230
  .on("add", (filePath) => {
164
231
  const relativePath = path.relative(watchDir, filePath);
@@ -183,7 +250,7 @@ export class WatchCoordinator {
183
250
  persistent: true,
184
251
  ignoreInitial: true,
185
252
  });
186
- ready.push(this.waitForWatcherReady(this.configWatcher));
253
+ this.trackWatcherReady(ready, this.waitForWatcherReady(this.configWatcher));
187
254
  this.configWatcher
188
255
  .on("add", (filePath) => {
189
256
  console.log(chalk.cyan(`📝 Config file added: ${path.basename(filePath)}`));
@@ -205,7 +272,7 @@ export class WatchCoordinator {
205
272
  persistent: true,
206
273
  ignoreInitial: true,
207
274
  });
208
- ready.push(this.waitForWatcherReady(this.fontWatcher));
275
+ this.trackWatcherReady(ready, this.waitForWatcherReady(this.fontWatcher));
209
276
  this.fontWatcher
210
277
  .on("add", () => {
211
278
  console.log(chalk.cyan(`🔤 Font configuration added`));
@@ -225,7 +292,7 @@ export class WatchCoordinator {
225
292
  persistent: true,
226
293
  ignoreInitial: true,
227
294
  });
228
- ready.push(this.waitForWatcherReady(this.analyticsWatcher));
295
+ this.trackWatcherReady(ready, this.waitForWatcherReady(this.analyticsWatcher));
229
296
  this.analyticsWatcher
230
297
  .on("add", () => {
231
298
  console.log(chalk.cyan(`📊 Analytics configuration added`));
@@ -248,7 +315,7 @@ export class WatchCoordinator {
248
315
  persistent: true,
249
316
  ignoreInitial: true,
250
317
  });
251
- ready.push(this.waitForWatcherReady(this.doccupineConfigWatcher));
318
+ this.trackWatcherReady(ready, this.waitForWatcherReady(this.doccupineConfigWatcher));
252
319
  this.doccupineConfigWatcher
253
320
  .on("add", () => this.enqueueMutation("Error applying doccupine.json", () => callbacks.handleDoccupineConfigChange()))
254
321
  .on("change", () => this.enqueueMutation("Error applying doccupine.json", () => callbacks.handleDoccupineConfigChange()))
@@ -259,7 +326,7 @@ export class WatchCoordinator {
259
326
  if (await fs.pathExists(publicDir)) {
260
327
  if (this.stopping)
261
328
  return;
262
- ready.push(this.waitForWatcherReady(this.setupPublicWatcher()));
329
+ this.trackWatcherReady(ready, this.waitForPublicWatcherReady());
263
330
  }
264
331
  if (this.stopping)
265
332
  return;
@@ -268,24 +335,33 @@ export class WatchCoordinator {
268
335
  ignoreInitial: true,
269
336
  depth: 1,
270
337
  });
271
- ready.push(this.waitForWatcherReady(this.rootDirWatcher));
338
+ this.trackWatcherReady(ready, this.waitForWatcherReady(this.rootDirWatcher));
272
339
  const queuePublicWatcherStart = () => {
273
- if (this.stopping || this.publicWatcher || this.publicWatcherStarting) {
340
+ if (this.stopping)
341
+ return;
342
+ if (this.publicWatcherStarting) {
343
+ this.publicWatcherRestartRequested = true;
274
344
  return;
275
345
  }
346
+ if (this.publicWatcher)
347
+ return;
276
348
  this.publicWatcherStarting = true;
277
349
  this.enqueueMutation("Error initializing public directory", async () => {
278
350
  try {
279
351
  if (this.stopping)
280
352
  return;
281
353
  console.log(chalk.cyan("📁 Public directory created"));
282
- await this.waitForWatcherReady(this.setupPublicWatcher());
354
+ await this.waitForPublicWatcherReady();
283
355
  if (this.stopping)
284
356
  return;
285
357
  await callbacks.copyPublicFiles();
286
358
  }
287
359
  finally {
288
360
  this.publicWatcherStarting = false;
361
+ if (this.publicWatcherRestartRequested) {
362
+ this.publicWatcherRestartRequested = false;
363
+ queuePublicWatcherStart();
364
+ }
289
365
  }
290
366
  });
291
367
  };
@@ -307,7 +383,11 @@ export class WatchCoordinator {
307
383
  }
308
384
  const watcher = this.publicWatcher;
309
385
  this.publicWatcher = null;
310
- void watcher?.close();
386
+ if (watcher) {
387
+ void this.closeDetachedWatcher(watcher).catch((error) => {
388
+ console.error(chalk.red("❌ Public watcher close error:"), error);
389
+ });
390
+ }
311
391
  this.enqueueMutation("Error removing public directory", () => callbacks.copyPublicFiles());
312
392
  })
313
393
  .on("error", (error) => {
@@ -319,7 +399,7 @@ export class WatchCoordinator {
319
399
  this.enqueueMutation("Error reconciling watched sources", async () => {
320
400
  const current = await this.captureSourceSnapshot();
321
401
  await this.reconcileWatchedSources(this.sourceSnapshot, current);
322
- this.sourceSnapshot = await this.captureSourceSnapshot();
402
+ this.sourceSnapshot = current;
323
403
  });
324
404
  await this.mutationQueue;
325
405
  }
@@ -355,7 +435,11 @@ export class WatchCoordinator {
355
435
  return;
356
436
  const watcher = this.publicWatcher;
357
437
  this.publicWatcher = null;
358
- void watcher?.close();
438
+ if (watcher) {
439
+ void this.closeDetachedWatcher(watcher).catch((error) => {
440
+ console.error(chalk.red("❌ Public watcher close error:"), error);
441
+ });
442
+ }
359
443
  this.enqueueMutation("Error removing public directory", () => callbacks.copyPublicFiles());
360
444
  })
361
445
  .on("error", (error) => {
@@ -363,15 +447,19 @@ export class WatchCoordinator {
363
447
  });
364
448
  return this.publicWatcher;
365
449
  }
366
- async syncOpenApiSpecWatcher(specs) {
450
+ async syncOpenApiSpecWatcher(specs, sourceFiles = []) {
367
451
  const previousWatcher = this.openApiWatcher;
368
452
  this.openApiWatcher = null;
369
453
  if (previousWatcher)
370
- await previousWatcher.close();
454
+ await this.closeDetachedWatcher(previousWatcher);
371
455
  if (this.stopping || specs.length === 0)
372
456
  return;
373
457
  const { callbacks, rootDir } = this.options;
374
- const specPaths = specs.map((spec) => path.resolve(rootDir, spec.file));
458
+ const specPaths = [
459
+ ...new Set(sourceFiles.length > 0
460
+ ? sourceFiles
461
+ : specs.map((spec) => path.resolve(rootDir, spec.file))),
462
+ ];
375
463
  const watcher = chokidar.watch(specPaths, {
376
464
  persistent: true,
377
465
  ignoreInitial: true,
@@ -394,45 +482,52 @@ export class WatchCoordinator {
394
482
  this.stopping = true;
395
483
  for (const cancel of [...this.readyCancellations])
396
484
  cancel();
397
- if (this.watcher) {
398
- await this.watcher.close();
399
- console.log(chalk.yellow("👋 Stopped watching for MDX changes"));
400
- }
401
- if (this.configWatcher) {
402
- await this.configWatcher.close();
403
- console.log(chalk.yellow("👋 Stopped watching for config changes"));
404
- }
405
- if (this.fontWatcher) {
406
- await this.fontWatcher.close();
407
- console.log(chalk.yellow("👋 Stopped watching for font config changes"));
408
- }
409
- if (this.analyticsWatcher) {
410
- await this.analyticsWatcher.close();
411
- console.log(chalk.yellow("👋 Stopped watching for analytics config changes"));
412
- }
413
- if (this.openApiWatcher) {
414
- await this.openApiWatcher.close();
415
- console.log(chalk.yellow("👋 Stopped watching for OpenAPI spec changes"));
485
+ await this.closeCurrentWatchers();
486
+ await this.drainMutationQueue();
487
+ const errors = await this.closeCurrentWatchers();
488
+ await this.drainMutationQueue();
489
+ if (errors.length > 0) {
490
+ throw new AggregateError(errors, "Unable to close all source watchers");
416
491
  }
417
- if (this.doccupineConfigWatcher) {
418
- await this.doccupineConfigWatcher.close();
419
- console.log(chalk.yellow("👋 Stopped watching for doccupine.json changes"));
420
- }
421
- if (this.publicWatcher) {
422
- await this.publicWatcher.close();
423
- console.log(chalk.yellow("👋 Stopped watching for public directory changes"));
424
- }
425
- if (this.rootDirWatcher) {
426
- await this.rootDirWatcher.close();
427
- }
428
- await this.mutationQueue;
429
- if (this.openApiWatcher) {
430
- await this.openApiWatcher.close();
431
- this.openApiWatcher = null;
432
- }
433
- if (this.publicWatcher) {
434
- await this.publicWatcher.close();
435
- this.publicWatcher = null;
492
+ }
493
+ async drainMutationQueue() {
494
+ while (true) {
495
+ const queue = this.mutationQueue;
496
+ await queue;
497
+ if (queue === this.mutationQueue)
498
+ return;
436
499
  }
437
500
  }
501
+ async closeCurrentWatchers() {
502
+ const watchers = [
503
+ ...this.pendingWatcherClosures,
504
+ this.watcher,
505
+ this.configWatcher,
506
+ this.fontWatcher,
507
+ this.analyticsWatcher,
508
+ this.openApiWatcher,
509
+ this.doccupineConfigWatcher,
510
+ this.publicWatcher,
511
+ this.rootDirWatcher,
512
+ ].filter((watcher) => watcher !== null);
513
+ this.pendingWatcherClosures.clear();
514
+ this.watcher = null;
515
+ this.configWatcher = null;
516
+ this.fontWatcher = null;
517
+ this.analyticsWatcher = null;
518
+ this.openApiWatcher = null;
519
+ this.doccupineConfigWatcher = null;
520
+ this.publicWatcher = null;
521
+ this.rootDirWatcher = null;
522
+ const uniqueWatchers = [...new Set(watchers)];
523
+ const results = await Promise.allSettled(uniqueWatchers.map((watcher) => Promise.resolve().then(() => watcher.close())));
524
+ const errors = [];
525
+ results.forEach((result, index) => {
526
+ if (result.status === "fulfilled")
527
+ return;
528
+ this.pendingWatcherClosures.add(uniqueWatchers[index]);
529
+ errors.push(result.reason);
530
+ });
531
+ return errors;
532
+ }
438
533
  }
@@ -27,6 +27,7 @@ export declare function normalizeConfigPaths(config: DoccupineConfig, rootDir?:
27
27
  };
28
28
  export declare class ConfigManager {
29
29
  private configPath;
30
+ private projectRoot;
30
31
  constructor(configPath?: string);
31
32
  loadConfig(): Promise<DoccupineConfig | null>;
32
33
  saveConfig(config: DoccupineConfig): Promise<void>;