docula 1.2.0 → 1.5.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
  */
@@ -220,7 +255,10 @@ type DoculaChangelogEntry = {
220
255
  slug: string;
221
256
  content: string;
222
257
  generatedHtml: string;
258
+ preview: string;
259
+ previewImage?: string;
223
260
  urlPath: string;
261
+ lastModified: string;
224
262
  };
225
263
  type DoculaData = {
226
264
  siteUrl: string;
@@ -242,12 +280,14 @@ type DoculaData = {
242
280
  hasApi?: boolean;
243
281
  apiSpec?: ApiSpecData;
244
282
  changelogEntries?: DoculaChangelogEntry[];
245
- homePage?: boolean;
283
+ hasReadme?: boolean;
246
284
  themeMode?: string;
247
285
  cookieAuth?: {
248
286
  loginUrl: string;
249
- cookieName?: string;
250
287
  logoutUrl?: string;
288
+ authCheckUrl?: string;
289
+ authCheckMethod?: string;
290
+ authCheckUserPath?: string;
251
291
  };
252
292
  headerLinks?: Array<{
253
293
  label: string;
@@ -256,6 +296,7 @@ type DoculaData = {
256
296
  }>;
257
297
  enableLlmsTxt?: boolean;
258
298
  hasFeed?: boolean;
299
+ lastModified?: string;
259
300
  };
260
301
  type DoculaTemplates = {
261
302
  home: string;
@@ -283,11 +324,14 @@ type DoculaDocument = {
283
324
  documentPath: string;
284
325
  urlPath: string;
285
326
  isRoot: boolean;
327
+ lastModified: string;
286
328
  };
287
329
  declare class DoculaBuilder {
288
330
  private readonly _options;
289
331
  private readonly _ecto;
290
332
  private readonly _console;
333
+ private readonly _hash;
334
+ onReleaseChangelog?: (entries: DoculaChangelogEntry[], console: DoculaConsole) => Promise<DoculaChangelogEntry[]> | DoculaChangelogEntry[];
291
335
  constructor(options?: DoculaOptions, engineOptions?: any);
292
336
  get options(): DoculaOptions;
293
337
  build(): Promise<void>;
@@ -317,16 +361,19 @@ declare class DoculaBuilder {
317
361
  buildReadmeSection(data: DoculaData): Promise<string>;
318
362
  buildAnnouncementSection(data: DoculaData): Promise<string | undefined>;
319
363
  buildDocsPages(data: DoculaData): Promise<void>;
364
+ renderApiContent(data: DoculaData): Promise<string>;
320
365
  buildApiPage(data: DoculaData): Promise<void>;
321
- getChangelogEntries(changelogPath: string): DoculaChangelogEntry[];
366
+ buildApiHomePage(data: DoculaData): Promise<void>;
367
+ getChangelogEntries(changelogPath: string, cachedEntries?: Map<string, DoculaChangelogEntry>, previousHashes?: Record<string, string>, currentHashes?: Record<string, string>): DoculaChangelogEntry[];
322
368
  parseChangelogEntry(filePath: string): DoculaChangelogEntry;
369
+ generateChangelogPreview(markdown: string, maxLength?: number, mdx?: boolean): string;
323
370
  convertReleaseToChangelogEntry(release: Record<string, any>): DoculaChangelogEntry;
324
371
  getReleasesAsChangelogEntries(releases: any[]): DoculaChangelogEntry[];
325
372
  buildChangelogPage(data: DoculaData): Promise<void>;
326
373
  buildChangelogEntryPages(data: DoculaData): Promise<void>;
327
374
  generateSidebarItems(data: DoculaData): DoculaSection[];
328
- getDocuments(sitePath: string, doculaData: DoculaData): DoculaDocument[];
329
- getDocumentInDirectory(sitePath: string): DoculaDocument[];
375
+ getDocuments(sitePath: string, doculaData: DoculaData, cachedDocs?: Map<string, DoculaDocument>, previousDocHashes?: Record<string, string>, currentDocHashes?: Record<string, string>): DoculaDocument[];
376
+ getDocumentInDirectory(sitePath: string, docsRootPath: string, cachedDocs?: Map<string, DoculaDocument>, previousDocHashes?: Record<string, string>, currentDocHashes?: Record<string, string>): DoculaDocument[];
330
377
  getSections(sitePath: string, doculaOptions: DoculaOptions): DoculaSection[];
331
378
  mergeSectionWithOptions(section: DoculaSection, options: DoculaOptions): DoculaSection;
332
379
  parseDocumentData(documentPath: string): DoculaDocument;
@@ -334,13 +381,31 @@ declare class DoculaBuilder {
334
381
  private directoryContainsMarkdown;
335
382
  private mergeTemplateOverrides;
336
383
  private ensureCacheInGitignore;
337
- private isCacheFresh;
384
+ private getChangedOverrides;
385
+ private hashFile;
338
386
  private listFilesRecursive;
339
387
  private copyDirectory;
340
388
  private copyPublicFolder;
341
389
  private copyPublicDirectory;
342
390
  private copyDocumentSiblingAssets;
343
391
  private listContentAssets;
392
+ private loadBuildManifest;
393
+ private saveBuildManifest;
394
+ private hashOptions;
395
+ private hashTemplateDirectory;
396
+ private loadCachedDocuments;
397
+ private saveCachedDocuments;
398
+ private loadCachedChangelog;
399
+ private saveCachedChangelog;
400
+ private hashSourceFiles;
401
+ private recordsEqual;
402
+ private hasAssetsChanged;
403
+ /**
404
+ * Hashes the source file, records it in currentAssets, and returns
405
+ * whether the copy can be skipped (unchanged from previous build).
406
+ */
407
+ private hashAssetAndCheckSkip;
408
+ private copyDirectoryWithHashing;
344
409
  private copyContentAssets;
345
410
  }
346
411
 
@@ -400,6 +465,12 @@ declare class Docula {
400
465
  * @returns {Promise<void>}
401
466
  */
402
467
  execute(process: NodeJS.Process): Promise<void>;
468
+ private runBuild;
469
+ /**
470
+ * Detect if the current project uses TypeScript by checking for tsconfig.json
471
+ * @returns {boolean}
472
+ */
473
+ detectTypeScript(): boolean;
403
474
  /**
404
475
  * Generate the init files
405
476
  * @param {string} sitePath
@@ -434,4 +505,4 @@ declare class Docula {
434
505
  serve(options: DoculaOptions): Promise<http.Server>;
435
506
  }
436
507
 
437
- export { type DoculaCacheOptions, type DoculaCookieAuth, type DoculaHeaderLink, DoculaOptions, Docula as default };
508
+ export { type DoculaCacheOptions, type DoculaChangelogEntry, DoculaConsole, type DoculaCookieAuth, type DoculaHeaderLink, DoculaOptions, Docula as default };