docula 1.1.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
@@ -52,6 +52,27 @@ type ApiGroup = {
52
52
  id: string;
53
53
  operations: ApiOperation[];
54
54
  };
55
+ type ApiOAuth2Flow = {
56
+ authorizationUrl?: string;
57
+ tokenUrl?: string;
58
+ refreshUrl?: string;
59
+ scopes: Record<string, string>;
60
+ };
61
+ type ApiSecurityScheme = {
62
+ key: string;
63
+ type: string;
64
+ scheme?: string;
65
+ bearerFormat?: string;
66
+ name?: string;
67
+ in?: string;
68
+ description: string;
69
+ flows?: {
70
+ authorizationCode?: ApiOAuth2Flow;
71
+ implicit?: ApiOAuth2Flow;
72
+ clientCredentials?: ApiOAuth2Flow;
73
+ password?: ApiOAuth2Flow;
74
+ };
75
+ };
55
76
  type ApiSpecData = {
56
77
  info: {
57
78
  title: string;
@@ -63,6 +84,41 @@ type ApiSpecData = {
63
84
  description: string;
64
85
  }>;
65
86
  groups: ApiGroup[];
87
+ securitySchemes: ApiSecurityScheme[];
88
+ };
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;
66
122
  };
67
123
 
68
124
  type GithubData = {
@@ -72,8 +128,10 @@ type GithubData = {
72
128
 
73
129
  type DoculaCookieAuth = {
74
130
  loginUrl: string;
75
- cookieName?: string;
76
131
  logoutUrl?: string;
132
+ authCheckUrl?: string;
133
+ authCheckMethod?: string;
134
+ authCheckUserPath?: string;
77
135
  };
78
136
  type DoculaHeaderLink = {
79
137
  label: string;
@@ -138,10 +196,9 @@ declare class DoculaOptions {
138
196
  */
139
197
  enableReleaseChangelog: boolean;
140
198
  /**
141
- * When false, the first document becomes the home page (index.html)
142
- * and the home.hbs template is not rendered.
199
+ * Number of changelog entries to display per page on the changelog index.
143
200
  */
144
- homePage: boolean;
201
+ changelogPerPage: number;
145
202
  /**
146
203
  * When true, generates llms.txt and llms-full.txt files for the built site.
147
204
  */
@@ -198,7 +255,10 @@ type DoculaChangelogEntry = {
198
255
  slug: string;
199
256
  content: string;
200
257
  generatedHtml: string;
258
+ preview: string;
259
+ previewImage?: string;
201
260
  urlPath: string;
261
+ lastModified: string;
202
262
  };
203
263
  type DoculaData = {
204
264
  siteUrl: string;
@@ -220,18 +280,23 @@ type DoculaData = {
220
280
  hasApi?: boolean;
221
281
  apiSpec?: ApiSpecData;
222
282
  changelogEntries?: DoculaChangelogEntry[];
223
- homePage?: boolean;
283
+ hasReadme?: boolean;
224
284
  themeMode?: string;
225
285
  cookieAuth?: {
226
286
  loginUrl: string;
227
- cookieName?: string;
228
287
  logoutUrl?: string;
288
+ authCheckUrl?: string;
289
+ authCheckMethod?: string;
290
+ authCheckUserPath?: string;
229
291
  };
230
292
  headerLinks?: Array<{
231
293
  label: string;
232
294
  url: string;
233
295
  icon?: string;
234
296
  }>;
297
+ enableLlmsTxt?: boolean;
298
+ hasFeed?: boolean;
299
+ lastModified?: string;
235
300
  };
236
301
  type DoculaTemplates = {
237
302
  home: string;
@@ -259,11 +324,14 @@ type DoculaDocument = {
259
324
  documentPath: string;
260
325
  urlPath: string;
261
326
  isRoot: boolean;
327
+ lastModified: string;
262
328
  };
263
329
  declare class DoculaBuilder {
264
330
  private readonly _options;
265
331
  private readonly _ecto;
266
332
  private readonly _console;
333
+ private readonly _hash;
334
+ onReleaseChangelog?: (entries: DoculaChangelogEntry[], console: DoculaConsole) => Promise<DoculaChangelogEntry[]> | DoculaChangelogEntry[];
267
335
  constructor(options?: DoculaOptions, engineOptions?: any);
268
336
  get options(): DoculaOptions;
269
337
  build(): Promise<void>;
@@ -273,11 +341,14 @@ declare class DoculaBuilder {
273
341
  getTemplateFile(path: string, name: string): Promise<string | undefined>;
274
342
  buildRobotsPage(options: DoculaOptions): Promise<void>;
275
343
  buildSiteMapPage(data: DoculaData): Promise<void>;
344
+ buildFeedPage(data: DoculaData): Promise<void>;
276
345
  buildLlmsFiles(data: DoculaData): Promise<void>;
277
346
  private generateLlmsIndexContent;
278
347
  private generateLlmsFullContent;
279
348
  private buildAbsoluteSiteUrl;
280
349
  private normalizePathForUrl;
350
+ private escapeXml;
351
+ private summarizeMarkdown;
281
352
  private isRemoteUrl;
282
353
  private resolveOpenApiSpecUrl;
283
354
  private resolveLocalOpenApiPath;
@@ -290,16 +361,19 @@ declare class DoculaBuilder {
290
361
  buildReadmeSection(data: DoculaData): Promise<string>;
291
362
  buildAnnouncementSection(data: DoculaData): Promise<string | undefined>;
292
363
  buildDocsPages(data: DoculaData): Promise<void>;
364
+ renderApiContent(data: DoculaData): Promise<string>;
293
365
  buildApiPage(data: DoculaData): Promise<void>;
294
- 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[];
295
368
  parseChangelogEntry(filePath: string): DoculaChangelogEntry;
369
+ generateChangelogPreview(markdown: string, maxLength?: number, mdx?: boolean): string;
296
370
  convertReleaseToChangelogEntry(release: Record<string, any>): DoculaChangelogEntry;
297
371
  getReleasesAsChangelogEntries(releases: any[]): DoculaChangelogEntry[];
298
372
  buildChangelogPage(data: DoculaData): Promise<void>;
299
373
  buildChangelogEntryPages(data: DoculaData): Promise<void>;
300
374
  generateSidebarItems(data: DoculaData): DoculaSection[];
301
- getDocuments(sitePath: string, doculaData: DoculaData): DoculaDocument[];
302
- 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[];
303
377
  getSections(sitePath: string, doculaOptions: DoculaOptions): DoculaSection[];
304
378
  mergeSectionWithOptions(section: DoculaSection, options: DoculaOptions): DoculaSection;
305
379
  parseDocumentData(documentPath: string): DoculaDocument;
@@ -307,13 +381,31 @@ declare class DoculaBuilder {
307
381
  private directoryContainsMarkdown;
308
382
  private mergeTemplateOverrides;
309
383
  private ensureCacheInGitignore;
310
- private isCacheFresh;
384
+ private getChangedOverrides;
385
+ private hashFile;
311
386
  private listFilesRecursive;
312
387
  private copyDirectory;
313
388
  private copyPublicFolder;
314
389
  private copyPublicDirectory;
315
390
  private copyDocumentSiblingAssets;
316
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;
317
409
  private copyContentAssets;
318
410
  }
319
411
 
@@ -373,6 +465,12 @@ declare class Docula {
373
465
  * @returns {Promise<void>}
374
466
  */
375
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;
376
474
  /**
377
475
  * Generate the init files
378
476
  * @param {string} sitePath
@@ -407,4 +505,4 @@ declare class Docula {
407
505
  serve(options: DoculaOptions): Promise<http.Server>;
408
506
  }
409
507
 
410
- 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 };