docula 1.2.0 → 1.6.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/dist/docula.d.ts CHANGED
@@ -87,6 +87,40 @@ type ApiSpecData = {
87
87
  securitySchemes: ApiSecurityScheme[];
88
88
  };
89
89
 
90
+ declare class DoculaConsole {
91
+ log(message: string): void;
92
+ error(message: string): void;
93
+ warn(message: string): void;
94
+ success(message: string): void;
95
+ info(message: string): void;
96
+ step(message: string): void;
97
+ fileBuilt(filePath: string): void;
98
+ fileCopied(filePath: string): void;
99
+ serverLog(method: string, url: string, statusCode: number, durationMs?: number): void;
100
+ banner(message: string): void;
101
+ printHelp(): void;
102
+ parseProcessArgv(argv: string[]): DoculaConsoleProcess;
103
+ getCommand(argv: string[]): string | undefined;
104
+ getArguments(argv: string[]): DoculaConsoleArguments;
105
+ }
106
+ type DoculaConsoleProcess = {
107
+ argv: string[];
108
+ command: string | undefined;
109
+ args: DoculaConsoleArguments;
110
+ };
111
+ type DoculaConsoleArguments = {
112
+ sitePath: string | undefined;
113
+ templatePath: string | undefined;
114
+ template: string | undefined;
115
+ output: string | undefined;
116
+ watch: boolean;
117
+ clean: boolean;
118
+ build: boolean;
119
+ port: number | undefined;
120
+ typescript: boolean;
121
+ javascript: boolean;
122
+ };
123
+
90
124
  type GithubData = {
91
125
  releases: Record<string, unknown>;
92
126
  contributors: Record<string, unknown>;
@@ -94,8 +128,10 @@ type GithubData = {
94
128
 
95
129
  type DoculaCookieAuth = {
96
130
  loginUrl: string;
97
- cookieName?: string;
98
131
  logoutUrl?: string;
132
+ authCheckUrl?: string;
133
+ authCheckMethod?: string;
134
+ authCheckUserPath?: string;
99
135
  };
100
136
  type DoculaHeaderLink = {
101
137
  label: string;
@@ -160,10 +196,9 @@ declare class DoculaOptions {
160
196
  */
161
197
  enableReleaseChangelog: boolean;
162
198
  /**
163
- * When false, the first document becomes the home page (index.html)
164
- * and the home.hbs template is not rendered.
199
+ * Number of changelog entries to display per page on the changelog index.
165
200
  */
166
- homePage: boolean;
201
+ changelogPerPage: number;
167
202
  /**
168
203
  * When true, generates llms.txt and llms-full.txt files for the built site.
169
204
  */
@@ -180,9 +215,23 @@ declare class DoculaOptions {
180
215
  */
181
216
  autoUpdateIgnores: boolean;
182
217
  /**
183
- * File extensions to copy as assets from docs/ and changelog/ directories.
184
- * Override in docula.config to customize.
218
+ * Base URL path prefix for all generated paths (e.g., "/docs").
219
+ * When set, all asset and navigation URLs are prefixed with this path.
220
+ */
221
+ baseUrl: string;
222
+ /**
223
+ * Output subdirectory and URL segment for documentation pages.
224
+ * Set to empty string to place docs at the output root.
225
+ */
226
+ docsPath: string;
227
+ /**
228
+ * Output subdirectory and URL segment for API reference pages.
185
229
  */
230
+ apiPath: string;
231
+ /**
232
+ * Output subdirectory and URL segment for changelog pages.
233
+ */
234
+ changelogPath: string;
186
235
  /**
187
236
  * Cookie-based authentication. When set, shows a Login/Logout button
188
237
  * in the header based on whether a JWT cookie is present.
@@ -220,7 +269,10 @@ type DoculaChangelogEntry = {
220
269
  slug: string;
221
270
  content: string;
222
271
  generatedHtml: string;
272
+ preview: string;
273
+ previewImage?: string;
223
274
  urlPath: string;
275
+ lastModified: string;
224
276
  };
225
277
  type DoculaData = {
226
278
  siteUrl: string;
@@ -242,12 +294,14 @@ type DoculaData = {
242
294
  hasApi?: boolean;
243
295
  apiSpec?: ApiSpecData;
244
296
  changelogEntries?: DoculaChangelogEntry[];
245
- homePage?: boolean;
297
+ hasReadme?: boolean;
246
298
  themeMode?: string;
247
299
  cookieAuth?: {
248
300
  loginUrl: string;
249
- cookieName?: string;
250
301
  logoutUrl?: string;
302
+ authCheckUrl?: string;
303
+ authCheckMethod?: string;
304
+ authCheckUserPath?: string;
251
305
  };
252
306
  headerLinks?: Array<{
253
307
  label: string;
@@ -256,6 +310,14 @@ type DoculaData = {
256
310
  }>;
257
311
  enableLlmsTxt?: boolean;
258
312
  hasFeed?: boolean;
313
+ lastModified?: string;
314
+ baseUrl: string;
315
+ docsPath: string;
316
+ apiPath: string;
317
+ changelogPath: string;
318
+ docsUrl: string;
319
+ apiUrl: string;
320
+ changelogUrl: string;
259
321
  };
260
322
  type DoculaTemplates = {
261
323
  home: string;
@@ -283,11 +345,14 @@ type DoculaDocument = {
283
345
  documentPath: string;
284
346
  urlPath: string;
285
347
  isRoot: boolean;
348
+ lastModified: string;
286
349
  };
287
350
  declare class DoculaBuilder {
288
351
  private readonly _options;
289
352
  private readonly _ecto;
290
353
  private readonly _console;
354
+ private readonly _hash;
355
+ onReleaseChangelog?: (entries: DoculaChangelogEntry[], console: DoculaConsole) => Promise<DoculaChangelogEntry[]> | DoculaChangelogEntry[];
291
356
  constructor(options?: DoculaOptions, engineOptions?: any);
292
357
  get options(): DoculaOptions;
293
358
  build(): Promise<void>;
@@ -301,6 +366,7 @@ declare class DoculaBuilder {
301
366
  buildLlmsFiles(data: DoculaData): Promise<void>;
302
367
  private generateLlmsIndexContent;
303
368
  private generateLlmsFullContent;
369
+ private buildUrlPath;
304
370
  private buildAbsoluteSiteUrl;
305
371
  private normalizePathForUrl;
306
372
  private escapeXml;
@@ -317,16 +383,19 @@ declare class DoculaBuilder {
317
383
  buildReadmeSection(data: DoculaData): Promise<string>;
318
384
  buildAnnouncementSection(data: DoculaData): Promise<string | undefined>;
319
385
  buildDocsPages(data: DoculaData): Promise<void>;
386
+ renderApiContent(data: DoculaData): Promise<string>;
320
387
  buildApiPage(data: DoculaData): Promise<void>;
321
- getChangelogEntries(changelogPath: string): DoculaChangelogEntry[];
388
+ buildApiHomePage(data: DoculaData): Promise<void>;
389
+ getChangelogEntries(changelogPath: string, cachedEntries?: Map<string, DoculaChangelogEntry>, previousHashes?: Record<string, string>, currentHashes?: Record<string, string>): DoculaChangelogEntry[];
322
390
  parseChangelogEntry(filePath: string): DoculaChangelogEntry;
391
+ generateChangelogPreview(markdown: string, maxLength?: number, mdx?: boolean): string;
323
392
  convertReleaseToChangelogEntry(release: Record<string, any>): DoculaChangelogEntry;
324
393
  getReleasesAsChangelogEntries(releases: any[]): DoculaChangelogEntry[];
325
394
  buildChangelogPage(data: DoculaData): Promise<void>;
326
395
  buildChangelogEntryPages(data: DoculaData): Promise<void>;
327
396
  generateSidebarItems(data: DoculaData): DoculaSection[];
328
- getDocuments(sitePath: string, doculaData: DoculaData): DoculaDocument[];
329
- getDocumentInDirectory(sitePath: string): DoculaDocument[];
397
+ getDocuments(sitePath: string, doculaData: DoculaData, cachedDocs?: Map<string, DoculaDocument>, previousDocHashes?: Record<string, string>, currentDocHashes?: Record<string, string>): DoculaDocument[];
398
+ getDocumentInDirectory(sitePath: string, docsRootPath: string, cachedDocs?: Map<string, DoculaDocument>, previousDocHashes?: Record<string, string>, currentDocHashes?: Record<string, string>): DoculaDocument[];
330
399
  getSections(sitePath: string, doculaOptions: DoculaOptions): DoculaSection[];
331
400
  mergeSectionWithOptions(section: DoculaSection, options: DoculaOptions): DoculaSection;
332
401
  parseDocumentData(documentPath: string): DoculaDocument;
@@ -334,13 +403,31 @@ declare class DoculaBuilder {
334
403
  private directoryContainsMarkdown;
335
404
  private mergeTemplateOverrides;
336
405
  private ensureCacheInGitignore;
337
- private isCacheFresh;
406
+ private getChangedOverrides;
407
+ private hashFile;
338
408
  private listFilesRecursive;
339
409
  private copyDirectory;
340
410
  private copyPublicFolder;
341
411
  private copyPublicDirectory;
342
412
  private copyDocumentSiblingAssets;
343
413
  private listContentAssets;
414
+ private loadBuildManifest;
415
+ private saveBuildManifest;
416
+ private hashOptions;
417
+ private hashTemplateDirectory;
418
+ private loadCachedDocuments;
419
+ private saveCachedDocuments;
420
+ private loadCachedChangelog;
421
+ private saveCachedChangelog;
422
+ private hashSourceFiles;
423
+ private recordsEqual;
424
+ private hasAssetsChanged;
425
+ /**
426
+ * Hashes the source file, records it in currentAssets, and returns
427
+ * whether the copy can be skipped (unchanged from previous build).
428
+ */
429
+ private hashAssetAndCheckSkip;
430
+ private copyDirectoryWithHashing;
344
431
  private copyContentAssets;
345
432
  }
346
433
 
@@ -400,6 +487,12 @@ declare class Docula {
400
487
  * @returns {Promise<void>}
401
488
  */
402
489
  execute(process: NodeJS.Process): Promise<void>;
490
+ private runBuild;
491
+ /**
492
+ * Detect if the current project uses TypeScript by checking for tsconfig.json
493
+ * @returns {boolean}
494
+ */
495
+ detectTypeScript(): boolean;
403
496
  /**
404
497
  * Generate the init files
405
498
  * @param {string} sitePath
@@ -434,4 +527,4 @@ declare class Docula {
434
527
  serve(options: DoculaOptions): Promise<http.Server>;
435
528
  }
436
529
 
437
- export { type DoculaCacheOptions, type DoculaCookieAuth, type DoculaHeaderLink, DoculaOptions, Docula as default };
530
+ export { type DoculaCacheOptions, type DoculaChangelogEntry, DoculaConsole, type DoculaCookieAuth, type DoculaHeaderLink, DoculaOptions, Docula as default };