docula 1.11.0 → 1.12.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
@@ -1,590 +1,605 @@
1
- import fs from 'node:fs';
2
- import http from 'node:http';
3
- export { Writr } from 'writr';
1
+ import fs from "node:fs";
2
+ import http from "node:http";
3
+ import { Writr } from "writr";
4
4
 
5
+ //#region src/console.d.ts
5
6
  declare class DoculaConsole {
6
- quiet: boolean;
7
- log(message: string): void;
8
- error(message: string): void;
9
- warn(message: string): void;
10
- success(message: string): void;
11
- info(message: string): void;
12
- step(message: string): void;
13
- fileBuilt(filePath: string): void;
14
- fileCopied(filePath: string): void;
15
- serverLog(method: string, url: string, statusCode: number, durationMs?: number): void;
16
- banner(message: string): void;
17
- printHelp(): void;
18
- parseProcessArgv(argv: string[]): DoculaConsoleProcess;
19
- getCommand(argv: string[]): string | undefined;
20
- getArguments(argv: string[]): DoculaConsoleArguments;
7
+ quiet: boolean;
8
+ log(message: string): void;
9
+ error(message: string): void;
10
+ warn(message: string): void;
11
+ success(message: string): void;
12
+ info(message: string): void;
13
+ step(message: string): void;
14
+ fileBuilt(filePath: string): void;
15
+ fileCopied(filePath: string): void;
16
+ serverLog(method: string, url: string, statusCode: number, durationMs?: number): void;
17
+ banner(message: string): void;
18
+ printHelp(): void;
19
+ parseProcessArgv(argv: string[]): DoculaConsoleProcess;
20
+ getCommand(argv: string[]): string | undefined;
21
+ getArguments(argv: string[]): DoculaConsoleArguments;
21
22
  }
22
23
  type DoculaConsoleProcess = {
23
- argv: string[];
24
- command: string | undefined;
25
- args: DoculaConsoleArguments;
24
+ argv: string[];
25
+ command: string | undefined;
26
+ args: DoculaConsoleArguments;
26
27
  };
27
28
  type DoculaConsoleArguments = {
28
- sitePath: string | undefined;
29
- templatePath: string | undefined;
30
- template: string | undefined;
31
- output: string | undefined;
32
- watch: boolean;
33
- clean: boolean;
34
- build: boolean;
35
- port: number | undefined;
36
- typescript: boolean;
37
- javascript: boolean;
38
- overwrite: boolean;
39
- downloadTarget: string;
29
+ sitePath: string | undefined;
30
+ templatePath: string | undefined;
31
+ template: string | undefined;
32
+ output: string | undefined;
33
+ watch: boolean;
34
+ clean: boolean;
35
+ build: boolean;
36
+ port: number | undefined;
37
+ typescript: boolean;
38
+ javascript: boolean;
39
+ overwrite: boolean;
40
+ downloadTarget: string;
40
41
  };
41
-
42
+ //#endregion
43
+ //#region src/github.d.ts
42
44
  type GithubData = {
43
- releases: Record<string, unknown>;
44
- contributors: Record<string, unknown>;
45
+ releases: Record<string, unknown>;
46
+ contributors: Record<string, unknown>;
45
47
  };
46
-
48
+ //#endregion
49
+ //#region src/api-parser.d.ts
47
50
  type ApiSchemaProperty = {
48
- name: string;
49
- type: string;
50
- required: boolean;
51
- description: string;
52
- enumValues?: string[];
51
+ name: string;
52
+ type: string;
53
+ required: boolean;
54
+ description: string;
55
+ enumValues?: string[];
53
56
  };
54
57
  type ApiOperationParameter = {
55
- name: string;
56
- in: string;
57
- required: boolean;
58
- type: string;
59
- description: string;
58
+ name: string;
59
+ in: string;
60
+ required: boolean;
61
+ type: string;
62
+ description: string;
60
63
  };
61
64
  type ApiRequestBody = {
62
- contentType: string;
63
- schemaProperties: ApiSchemaProperty[];
64
- example: string;
65
+ contentType: string;
66
+ schemaProperties: ApiSchemaProperty[];
67
+ example: string;
65
68
  };
66
69
  type ApiResponse = {
67
- statusCode: string;
68
- statusClass: string;
69
- description: string;
70
- contentType: string;
71
- schemaProperties: ApiSchemaProperty[];
72
- example: string;
70
+ statusCode: string;
71
+ statusClass: string;
72
+ description: string;
73
+ contentType: string;
74
+ schemaProperties: ApiSchemaProperty[];
75
+ example: string;
73
76
  };
74
77
  type ApiCodeExamples = {
75
- curl: string;
76
- javascript: string;
77
- python: string;
78
+ curl: string;
79
+ javascript: string;
80
+ python: string;
78
81
  };
79
82
  type ApiOperation = {
80
- id: string;
81
- method: string;
82
- methodUpper: string;
83
- path: string;
84
- summary: string;
85
- description: string;
86
- parameters: ApiOperationParameter[];
87
- requestBody?: ApiRequestBody;
88
- responses: ApiResponse[];
89
- codeExamples: ApiCodeExamples;
83
+ id: string;
84
+ method: string;
85
+ methodUpper: string;
86
+ path: string;
87
+ summary: string;
88
+ description: string;
89
+ parameters: ApiOperationParameter[];
90
+ requestBody?: ApiRequestBody;
91
+ responses: ApiResponse[];
92
+ codeExamples: ApiCodeExamples;
90
93
  };
91
94
  type ApiGroup = {
92
- name: string;
93
- description: string;
94
- id: string;
95
- operations: ApiOperation[];
95
+ name: string;
96
+ description: string;
97
+ id: string;
98
+ operations: ApiOperation[];
96
99
  };
97
100
  type ApiOAuth2Flow = {
98
- authorizationUrl?: string;
99
- tokenUrl?: string;
100
- refreshUrl?: string;
101
- scopes: Record<string, string>;
101
+ authorizationUrl?: string;
102
+ tokenUrl?: string;
103
+ refreshUrl?: string;
104
+ scopes: Record<string, string>;
102
105
  };
103
106
  type ApiSecurityScheme = {
104
- key: string;
105
- type: string;
106
- scheme?: string;
107
- bearerFormat?: string;
108
- name?: string;
109
- in?: string;
110
- description: string;
111
- flows?: {
112
- authorizationCode?: ApiOAuth2Flow;
113
- implicit?: ApiOAuth2Flow;
114
- clientCredentials?: ApiOAuth2Flow;
115
- password?: ApiOAuth2Flow;
116
- };
107
+ key: string;
108
+ type: string;
109
+ scheme?: string;
110
+ bearerFormat?: string;
111
+ name?: string;
112
+ in?: string;
113
+ description: string;
114
+ flows?: {
115
+ authorizationCode?: ApiOAuth2Flow;
116
+ implicit?: ApiOAuth2Flow;
117
+ clientCredentials?: ApiOAuth2Flow;
118
+ password?: ApiOAuth2Flow;
119
+ };
117
120
  };
118
121
  type ApiSpecData = {
119
- info: {
120
- title: string;
121
- description: string;
122
- version: string;
123
- };
124
- servers: Array<{
125
- url: string;
126
- description: string;
127
- }>;
128
- groups: ApiGroup[];
129
- securitySchemes: ApiSecurityScheme[];
122
+ info: {
123
+ title: string;
124
+ description: string;
125
+ version: string;
126
+ };
127
+ servers: Array<{
128
+ url: string;
129
+ description: string;
130
+ }>;
131
+ groups: ApiGroup[];
132
+ securitySchemes: ApiSecurityScheme[];
130
133
  };
131
-
134
+ //#endregion
135
+ //#region src/types.d.ts
132
136
  type DoculaOpenApiSpecEntry = {
133
- name: string;
134
- url: string;
135
- order?: number;
136
- apiSpec?: ApiSpecData;
137
+ name: string;
138
+ url: string;
139
+ order?: number;
140
+ apiSpec?: ApiSpecData;
137
141
  };
138
142
  type DoculaChangelogEntry = {
139
- title: string;
140
- date: string;
141
- formattedDate: string;
142
- tag?: string;
143
- tagClass?: string;
144
- slug: string;
145
- content: string;
146
- generatedHtml: string;
147
- preview: string;
148
- draft?: boolean;
149
- previewImage?: string;
150
- urlPath: string;
151
- lastModified: string;
143
+ title: string;
144
+ date: string;
145
+ formattedDate: string;
146
+ tag?: string;
147
+ tagClass?: string;
148
+ slug: string;
149
+ content: string;
150
+ generatedHtml: string;
151
+ preview: string;
152
+ draft?: boolean;
153
+ previewImage?: string;
154
+ urlPath: string;
155
+ lastModified: string;
152
156
  };
153
157
  type DoculaData = {
154
- siteUrl: string;
155
- siteTitle: string;
156
- siteDescription: string;
157
- sitePath: string;
158
- templatePath: string;
159
- output: string;
160
- githubPath?: string;
161
- github?: GithubData;
162
- templates?: DoculaTemplates;
163
- hasDocuments?: boolean;
164
- hasChangelog?: boolean;
165
- sections?: DoculaSection[];
166
- documents?: DoculaDocument[];
167
- sidebarItems?: DoculaSection[];
168
- announcement?: string;
169
- hasApi?: boolean;
170
- apiSpec?: ApiSpecData;
171
- openApiSpecs?: DoculaOpenApiSpecEntry[];
172
- changelogEntries?: DoculaChangelogEntry[];
173
- hasReadme?: boolean;
174
- themeMode?: string;
175
- cookieAuth?: {
176
- loginUrl: string;
177
- logoutUrl?: string;
178
- authCheckUrl?: string;
179
- authCheckMethod?: string;
180
- authCheckUserPath?: string;
181
- };
182
- headerLinks?: Array<{
183
- label: string;
184
- url: string;
185
- icon?: string;
186
- }>;
187
- enableLlmsTxt?: boolean;
188
- hasFeed?: boolean;
189
- lastModified?: string;
190
- homeUrl?: string;
191
- baseUrl: string;
192
- docsPath: string;
193
- apiPath: string;
194
- changelogPath: string;
195
- docsUrl: string;
196
- apiUrl: string;
197
- changelogUrl: string;
198
- editPageUrl?: string;
199
- openGraph?: DoculaOpenGraph;
158
+ siteUrl: string;
159
+ siteTitle: string;
160
+ siteDescription: string;
161
+ sitePath: string;
162
+ templatePath: string;
163
+ output: string;
164
+ githubPath?: string;
165
+ github?: GithubData;
166
+ templates?: DoculaTemplates;
167
+ hasDocuments?: boolean;
168
+ hasChangelog?: boolean;
169
+ sections?: DoculaSection[];
170
+ documents?: DoculaDocument[];
171
+ sidebarItems?: DoculaSection[];
172
+ announcement?: string;
173
+ hasApi?: boolean;
174
+ apiSpec?: ApiSpecData;
175
+ openApiSpecs?: DoculaOpenApiSpecEntry[];
176
+ changelogEntries?: DoculaChangelogEntry[];
177
+ hasReadme?: boolean;
178
+ themeMode?: string;
179
+ cookieAuth?: {
180
+ loginUrl: string;
181
+ logoutUrl?: string;
182
+ authCheckUrl?: string;
183
+ authCheckMethod?: string;
184
+ authCheckUserPath?: string;
185
+ };
186
+ headerLinks?: Array<{
187
+ label: string;
188
+ url: string;
189
+ icon?: string;
190
+ }>;
191
+ googleTagManager?: string;
192
+ isGtag?: boolean;
193
+ enableLlmsTxt?: boolean;
194
+ hasFeed?: boolean;
195
+ lastModified?: string;
196
+ homeUrl?: string;
197
+ baseUrl: string;
198
+ docsPath: string;
199
+ apiPath: string;
200
+ changelogPath: string;
201
+ docsUrl: string;
202
+ apiUrl: string;
203
+ changelogUrl: string;
204
+ editPageUrl?: string;
205
+ openGraph?: DoculaOpenGraph;
200
206
  };
201
207
  type DoculaTemplates = {
202
- home: string;
203
- docPage?: string;
204
- api?: string;
205
- changelog?: string;
206
- changelogEntry?: string;
208
+ home: string;
209
+ docPage?: string;
210
+ api?: string;
211
+ changelog?: string;
212
+ changelogEntry?: string;
207
213
  };
208
214
  type DoculaSection = {
209
- name: string;
210
- order?: number;
211
- path: string;
212
- children?: DoculaSection[];
215
+ name: string;
216
+ order?: number;
217
+ path: string;
218
+ children?: DoculaSection[];
213
219
  };
214
220
  type DoculaDocument = {
215
- title: string;
216
- navTitle: string;
217
- description: string;
218
- order?: number;
219
- section?: string;
220
- keywords: string[];
221
- content: string;
222
- markdown: string;
223
- generatedHtml: string;
224
- documentPath: string;
225
- urlPath: string;
226
- isRoot: boolean;
227
- lastModified: string;
228
- ogTitle?: string;
229
- ogDescription?: string;
230
- ogImage?: string;
221
+ title: string;
222
+ navTitle: string;
223
+ description: string;
224
+ order?: number;
225
+ section?: string;
226
+ keywords: string[];
227
+ content: string;
228
+ markdown: string;
229
+ generatedHtml: string;
230
+ documentPath: string;
231
+ urlPath: string;
232
+ isRoot: boolean;
233
+ lastModified: string;
234
+ ogTitle?: string;
235
+ ogDescription?: string;
236
+ ogImage?: string;
231
237
  };
232
-
238
+ //#endregion
239
+ //#region src/options.d.ts
233
240
  type DoculaCookieAuth = {
234
- loginUrl: string;
235
- logoutUrl?: string;
236
- authCheckUrl?: string;
237
- authCheckMethod?: string;
238
- authCheckUserPath?: string;
241
+ loginUrl: string;
242
+ logoutUrl?: string;
243
+ authCheckUrl?: string;
244
+ authCheckMethod?: string;
245
+ authCheckUserPath?: string;
239
246
  };
240
247
  type DoculaHeaderLink = {
241
- label: string;
242
- url: string;
243
- icon?: string;
248
+ label: string;
249
+ url: string;
250
+ icon?: string;
244
251
  };
245
252
  type DoculaOpenApiSpec = {
246
- name: string;
247
- url: string;
248
- order?: number;
253
+ name: string;
254
+ url: string;
255
+ order?: number;
249
256
  };
250
257
  type DoculaOpenGraph = {
251
- title?: string;
252
- description?: string;
253
- image?: string;
254
- url?: string;
255
- type?: string;
256
- siteName?: string;
257
- twitterCard?: string;
258
+ title?: string;
259
+ description?: string;
260
+ image?: string;
261
+ url?: string;
262
+ type?: string;
263
+ siteName?: string;
264
+ twitterCard?: string;
258
265
  };
259
266
  type DoculaCacheOptions = {
260
- github: {
261
- ttl: number;
262
- };
267
+ github: {
268
+ ttl: number;
269
+ };
263
270
  };
264
271
  type DoculaAIOptions = {
265
- provider: string;
266
- model?: string;
267
- apiKey: string;
272
+ provider: string;
273
+ model?: string;
274
+ apiKey: string;
268
275
  };
269
276
  declare class DoculaOptions {
270
- /**
271
- * Name of the built-in template to use (e.g., "modern", "classic")
272
- */
273
- template: string;
274
- /**
275
- * Path to the template directory. When set, overrides the `template` option.
276
- */
277
- templatePath: string;
278
- /**
279
- * Path to the output directory
280
- */
281
- output: string;
282
- /**
283
- * Path to the site directory
284
- */
285
- sitePath: string;
286
- /**
287
- * Path to the github repository
288
- */
289
- githubPath: string;
290
- /**
291
- * Site title
292
- */
293
- siteTitle: string;
294
- /**
295
- * Site description
296
- */
297
- siteDescription: string;
298
- /**
299
- * Site URL
300
- */
301
- siteUrl: string;
302
- /**
303
- * Port to run the server
304
- */
305
- port: number;
306
- /**
307
- * Sections
308
- */
309
- sections?: DoculaSection[];
310
- /**
311
- * OpenAPI specification for API documentation.
312
- * Pass a string URL for a single spec, or an array of DoculaOpenApiSpec for multiple specs.
313
- * When provided, creates a dedicated /api page.
314
- */
315
- openApiUrl?: string | DoculaOpenApiSpec[];
316
- /**
317
- * When true, GitHub releases are converted to changelog entries and merged
318
- * with file-based changelog entries. Requires a changelog template to exist.
319
- */
320
- enableReleaseChangelog: boolean;
321
- /**
322
- * Number of changelog entries to display per page on the changelog index.
323
- */
324
- changelogPerPage: number;
325
- /**
326
- * When true, generates llms.txt and llms-full.txt files for the built site.
327
- */
328
- enableLlmsTxt: boolean;
329
- /**
330
- * Override the default theme toggle. By default the site follows the system
331
- * preference. Set to "light" or "dark" to use that theme when no user
332
- * preference is stored in localStorage.
333
- */
334
- themeMode?: "light" | "dark";
335
- /**
336
- * When true, automatically adds generated paths (e.g., .cache) to the
337
- * site directory's .gitignore file if not already present.
338
- */
339
- autoUpdateIgnores: boolean;
340
- /**
341
- * When true, automatically copies the project root README.md into the site
342
- * directory if one does not already exist. The package.json name field is
343
- * used to prepend a title heading when the README lacks one.
344
- */
345
- autoReadme: boolean;
346
- /**
347
- * When true, suppresses all non-error console output during the build.
348
- */
349
- quiet: boolean;
350
- /**
351
- * URL for the logo/home link in the header. Defaults to baseUrl or "/".
352
- * Useful when hosting docs under a subpath but the logo should link to the parent site.
353
- */
354
- homeUrl?: string;
355
- /**
356
- * Base URL path prefix for all generated paths (e.g., "/docs").
357
- * When set, all asset and navigation URLs are prefixed with this path.
358
- */
359
- baseUrl: string;
360
- /**
361
- * Output subdirectory and URL segment for documentation pages.
362
- * Set to empty string to place docs at the output root.
363
- */
364
- docsPath: string;
365
- /**
366
- * Output subdirectory and URL segment for API reference pages.
367
- */
368
- apiPath: string;
369
- /**
370
- * Output subdirectory and URL segment for changelog pages.
371
- */
372
- changelogPath: string;
373
- /**
374
- * Base URL for "Edit this page" links on documentation pages.
375
- * When set, an edit link is shown at the bottom of each doc page.
376
- * The document's relative path is appended to this URL.
377
- * Example: "https://github.com/owner/repo/edit/main/site/docs"
378
- */
379
- editPageUrl?: string;
380
- /**
381
- * OpenGraph meta tags for social sharing. When set, og: and twitter:
382
- * meta tags are rendered in the page head. Fields fall back to
383
- * siteTitle / siteDescription / siteUrl when omitted.
384
- */
385
- openGraph?: DoculaOpenGraph;
386
- /**
387
- * Cookie-based authentication. When set, shows a Login/Logout button
388
- * in the header based on whether a JWT cookie is present.
389
- */
390
- cookieAuth?: DoculaCookieAuth;
391
- /**
392
- * Additional links to display in the site header navigation.
393
- * Each link requires a label and url.
394
- */
395
- headerLinks?: DoculaHeaderLink[];
396
- /**
397
- * AI-powered metadata enrichment configuration. When set, uses AI to fill
398
- * missing OpenGraph and HTML meta tag fields during the build.
399
- * Requires provider name and API key. Omit to disable AI enrichment.
400
- */
401
- ai?: DoculaAIOptions;
402
- /**
403
- * Cache settings. Controls caching of external data (e.g., GitHub API responses)
404
- * in the .cache directory within the site path.
405
- */
406
- cache: DoculaCacheOptions;
407
- /**
408
- * File extensions to copy as assets from docs/ and changelog/ directories.
409
- * Override in docula.config to customize.
410
- */
411
- allowedAssets: string[];
412
- constructor(options?: Record<string, unknown>);
413
- parseOptions(options: Record<string, any>): void;
277
+ /**
278
+ * Name of the built-in template to use (e.g., "modern", "classic")
279
+ */
280
+ template: string;
281
+ /**
282
+ * Path to the template directory. When set, overrides the `template` option.
283
+ */
284
+ templatePath: string;
285
+ /**
286
+ * Path to the output directory
287
+ */
288
+ output: string;
289
+ /**
290
+ * Path to the site directory
291
+ */
292
+ sitePath: string;
293
+ /**
294
+ * Path to the github repository
295
+ */
296
+ githubPath: string;
297
+ /**
298
+ * Site title
299
+ */
300
+ siteTitle: string;
301
+ /**
302
+ * Site description
303
+ */
304
+ siteDescription: string;
305
+ /**
306
+ * Site URL
307
+ */
308
+ siteUrl: string;
309
+ /**
310
+ * Port to run the server
311
+ */
312
+ port: number;
313
+ /**
314
+ * Sections
315
+ */
316
+ sections?: DoculaSection[];
317
+ /**
318
+ * OpenAPI specification for API documentation.
319
+ * Pass a string URL for a single spec, or an array of DoculaOpenApiSpec for multiple specs.
320
+ * When provided, creates a dedicated /api page.
321
+ */
322
+ openApiUrl?: string | DoculaOpenApiSpec[];
323
+ /**
324
+ * When true, GitHub releases are converted to changelog entries and merged
325
+ * with file-based changelog entries. Requires a changelog template to exist.
326
+ */
327
+ enableReleaseChangelog: boolean;
328
+ /**
329
+ * Number of changelog entries to display per page on the changelog index.
330
+ */
331
+ changelogPerPage: number;
332
+ /**
333
+ * When true, generates llms.txt and llms-full.txt files for the built site.
334
+ */
335
+ enableLlmsTxt: boolean;
336
+ /**
337
+ * Override the default theme toggle. By default the site follows the system
338
+ * preference. Set to "light" or "dark" to use that theme when no user
339
+ * preference is stored in localStorage.
340
+ */
341
+ themeMode?: "light" | "dark";
342
+ /**
343
+ * When true, automatically adds generated paths (e.g., .cache) to the
344
+ * site directory's .gitignore file if not already present.
345
+ */
346
+ autoUpdateIgnores: boolean;
347
+ /**
348
+ * When true, automatically copies the project root README.md into the site
349
+ * directory if one does not already exist. The package.json name field is
350
+ * used to prepend a title heading when the README lacks one.
351
+ */
352
+ autoReadme: boolean;
353
+ /**
354
+ * When true, suppresses all non-error console output during the build.
355
+ */
356
+ quiet: boolean;
357
+ /**
358
+ * URL for the logo/home link in the header. Defaults to baseUrl or "/".
359
+ * Useful when hosting docs under a subpath but the logo should link to the parent site.
360
+ */
361
+ homeUrl?: string;
362
+ /**
363
+ * Base URL path prefix for all generated paths (e.g., "/docs").
364
+ * When set, all asset and navigation URLs are prefixed with this path.
365
+ */
366
+ baseUrl: string;
367
+ /**
368
+ * Output subdirectory and URL segment for documentation pages.
369
+ * Set to empty string to place docs at the output root.
370
+ */
371
+ docsPath: string;
372
+ /**
373
+ * Output subdirectory and URL segment for API reference pages.
374
+ */
375
+ apiPath: string;
376
+ /**
377
+ * Output subdirectory and URL segment for changelog pages.
378
+ */
379
+ changelogPath: string;
380
+ /**
381
+ * Base URL for "Edit this page" links on documentation pages.
382
+ * When set, an edit link is shown at the bottom of each doc page.
383
+ * The document's relative path is appended to this URL.
384
+ * Example: "https://github.com/owner/repo/edit/main/site/docs"
385
+ */
386
+ editPageUrl?: string;
387
+ /**
388
+ * OpenGraph meta tags for social sharing. When set, og: and twitter:
389
+ * meta tags are rendered in the page head. Fields fall back to
390
+ * siteTitle / siteDescription / siteUrl when omitted.
391
+ */
392
+ openGraph?: DoculaOpenGraph;
393
+ /**
394
+ * Cookie-based authentication. When set, shows a Login/Logout button
395
+ * in the header based on whether a JWT cookie is present.
396
+ */
397
+ cookieAuth?: DoculaCookieAuth;
398
+ /**
399
+ * Additional links to display in the site header navigation.
400
+ * Each link requires a label and url.
401
+ */
402
+ headerLinks?: DoculaHeaderLink[];
403
+ /**
404
+ * Google Tag Manager container ID (e.g., "GTM-XXXXXX") or
405
+ * Google Analytics 4 measurement ID (e.g., "G-XXXXXXXXXX").
406
+ * When set, injects the appropriate tracking script on every page.
407
+ */
408
+ googleTagManager?: string;
409
+ /**
410
+ * AI-powered metadata enrichment configuration. When set, uses AI to fill
411
+ * missing OpenGraph and HTML meta tag fields during the build.
412
+ * Requires provider name and API key. Omit to disable AI enrichment.
413
+ */
414
+ ai?: DoculaAIOptions;
415
+ /**
416
+ * Cache settings. Controls caching of external data (e.g., GitHub API responses)
417
+ * in the .cache directory within the site path.
418
+ */
419
+ cache: DoculaCacheOptions;
420
+ /**
421
+ * File extensions to copy as assets from docs/ and changelog/ directories.
422
+ * Override in docula.config to customize.
423
+ */
424
+ allowedAssets: string[];
425
+ constructor(options?: Record<string, unknown>);
426
+ parseOptions(options: Record<string, any>): void;
414
427
  }
415
-
428
+ //#endregion
429
+ //#region src/builder.d.ts
416
430
  type DoculaBuilderOptions = {
417
- console?: DoculaConsole;
431
+ console?: DoculaConsole;
418
432
  } & DoculaOptions;
419
433
  declare class DoculaBuilder {
420
- private readonly _options;
421
- private readonly _ecto;
422
- private readonly _console;
423
- private readonly _hash;
424
- onReleaseChangelog?: (entries: DoculaChangelogEntry[], console: DoculaConsole) => Promise<DoculaChangelogEntry[]> | DoculaChangelogEntry[];
425
- get console(): DoculaConsole;
426
- constructor(options?: DoculaBuilderOptions, engineOptions?: any);
427
- get options(): DoculaOptions;
428
- build(): Promise<void>;
429
- validateOptions(options: DoculaOptions): void;
430
- autoReadme(): Promise<void>;
431
- getGithubData(githubPath: string): Promise<GithubData>;
432
- getTemplates(templatePath: string, hasDocuments: boolean, hasChangelog?: boolean): Promise<DoculaTemplates>;
433
- getTemplateFile(path: string, name: string): Promise<string | undefined>;
434
- buildRobotsPage(options: DoculaOptions): Promise<void>;
435
- buildSiteMapPage(data: DoculaData): Promise<void>;
436
- buildFeedPage(data: DoculaData): Promise<void>;
437
- buildChangelogFeedJson(data: DoculaData): Promise<void>;
438
- buildChangelogLatestFeedJson(data: DoculaData): Promise<void>;
439
- buildLlmsFiles(data: DoculaData): Promise<void>;
440
- resolveOpenGraphData(data: DoculaData, pageUrl: string, pageData?: Partial<DoculaDocument> & {
441
- previewImage?: string;
442
- preview?: string;
443
- }): Record<string, string | undefined>;
444
- resolveJsonLd(pageType: "home" | "docs" | "api" | "changelog" | "changelog-entry", data: DoculaData, pageUrl: string, pageData?: Partial<DoculaDocument> & {
445
- date?: string;
446
- preview?: string;
447
- previewImage?: string;
448
- }): string;
449
- buildIndexPage(data: DoculaData): Promise<void>;
450
- buildDocsHomePage(data: DoculaData): Promise<void>;
451
- buildReadmeSection(data: DoculaData): Promise<string>;
452
- buildAnnouncementSection(data: DoculaData): Promise<string | undefined>;
453
- buildDocsPages(data: DoculaData): Promise<void>;
454
- renderApiContent(data: DoculaData): Promise<string>;
455
- buildApiPage(data: DoculaData): Promise<void>;
456
- buildAllApiPages(data: DoculaData): Promise<void>;
457
- buildApiHomePage(data: DoculaData): Promise<void>;
458
- getChangelogEntries(changelogPath: string, cachedEntries?: Map<string, DoculaChangelogEntry>, previousHashes?: Record<string, string>, currentHashes?: Record<string, string>): DoculaChangelogEntry[];
459
- parseChangelogEntry(filePath: string): DoculaChangelogEntry;
460
- generateChangelogPreview(markdown: string, maxLength?: number, mdx?: boolean): string;
461
- convertReleaseToChangelogEntry(release: Record<string, any>): DoculaChangelogEntry;
462
- getReleasesAsChangelogEntries(releases: any[]): DoculaChangelogEntry[];
463
- buildChangelogPage(data: DoculaData): Promise<void>;
464
- buildChangelogEntryPages(data: DoculaData): Promise<void>;
465
- generateSidebarItems(data: DoculaData): DoculaSection[];
466
- getDocuments(sitePath: string, doculaData: DoculaData, cachedDocs?: Map<string, DoculaDocument>, previousDocHashes?: Record<string, string>, currentDocHashes?: Record<string, string>): DoculaDocument[];
467
- getDocumentInDirectory(sitePath: string, docsRootPath: string, cachedDocs?: Map<string, DoculaDocument>, previousDocHashes?: Record<string, string>, currentDocHashes?: Record<string, string>): DoculaDocument[];
468
- getSections(sitePath: string, doculaOptions: DoculaOptions): DoculaSection[];
469
- mergeSectionWithOptions(section: DoculaSection, options: DoculaOptions): DoculaSection;
470
- parseDocumentData(documentPath: string): DoculaDocument;
434
+ private readonly _options;
435
+ private readonly _ecto;
436
+ private readonly _console;
437
+ private readonly _hash;
438
+ onReleaseChangelog?: (entries: DoculaChangelogEntry[], console: DoculaConsole) => Promise<DoculaChangelogEntry[]> | DoculaChangelogEntry[];
439
+ get console(): DoculaConsole;
440
+ constructor(options?: DoculaBuilderOptions, engineOptions?: any);
441
+ get options(): DoculaOptions;
442
+ build(): Promise<void>;
443
+ validateOptions(options: DoculaOptions): void;
444
+ autoReadme(): Promise<void>;
445
+ getGithubData(githubPath: string): Promise<GithubData>;
446
+ getTemplates(templatePath: string, hasDocuments: boolean, hasChangelog?: boolean): Promise<DoculaTemplates>;
447
+ getTemplateFile(path: string, name: string): Promise<string | undefined>;
448
+ buildRobotsPage(options: DoculaOptions): Promise<void>;
449
+ buildSiteMapPage(data: DoculaData): Promise<void>;
450
+ buildFeedPage(data: DoculaData): Promise<void>;
451
+ buildChangelogFeedJson(data: DoculaData): Promise<void>;
452
+ buildChangelogLatestFeedJson(data: DoculaData): Promise<void>;
453
+ buildLlmsFiles(data: DoculaData): Promise<void>;
454
+ resolveOpenGraphData(data: DoculaData, pageUrl: string, pageData?: Partial<DoculaDocument> & {
455
+ previewImage?: string;
456
+ preview?: string;
457
+ }): Record<string, string | undefined>;
458
+ resolveJsonLd(pageType: "home" | "docs" | "api" | "changelog" | "changelog-entry", data: DoculaData, pageUrl: string, pageData?: Partial<DoculaDocument> & {
459
+ date?: string;
460
+ preview?: string;
461
+ previewImage?: string;
462
+ }): string;
463
+ buildIndexPage(data: DoculaData): Promise<void>;
464
+ buildDocsHomePage(data: DoculaData): Promise<void>;
465
+ buildReadmeSection(data: DoculaData): Promise<string>;
466
+ buildAnnouncementSection(data: DoculaData): Promise<string | undefined>;
467
+ buildDocsPages(data: DoculaData): Promise<void>;
468
+ renderApiContent(data: DoculaData): Promise<string>;
469
+ buildApiPage(data: DoculaData): Promise<void>;
470
+ buildAllApiPages(data: DoculaData): Promise<void>;
471
+ buildApiHomePage(data: DoculaData): Promise<void>;
472
+ getChangelogEntries(changelogPath: string, cachedEntries?: Map<string, DoculaChangelogEntry>, previousHashes?: Record<string, string>, currentHashes?: Record<string, string>): DoculaChangelogEntry[];
473
+ parseChangelogEntry(filePath: string): DoculaChangelogEntry;
474
+ generateChangelogPreview(markdown: string, maxLength?: number, mdx?: boolean): string;
475
+ convertReleaseToChangelogEntry(release: Record<string, any>): DoculaChangelogEntry;
476
+ getReleasesAsChangelogEntries(releases: any[]): DoculaChangelogEntry[];
477
+ buildChangelogPage(data: DoculaData): Promise<void>;
478
+ buildChangelogEntryPages(data: DoculaData): Promise<void>;
479
+ generateSidebarItems(data: DoculaData): DoculaSection[];
480
+ getDocuments(sitePath: string, doculaData: DoculaData, cachedDocs?: Map<string, DoculaDocument>, previousDocHashes?: Record<string, string>, currentDocHashes?: Record<string, string>): DoculaDocument[];
481
+ getDocumentInDirectory(sitePath: string, docsRootPath: string, cachedDocs?: Map<string, DoculaDocument>, previousDocHashes?: Record<string, string>, currentDocHashes?: Record<string, string>): DoculaDocument[];
482
+ getSections(sitePath: string, doculaOptions: DoculaOptions): DoculaSection[];
483
+ mergeSectionWithOptions(section: DoculaSection, options: DoculaOptions): DoculaSection;
484
+ parseDocumentData(documentPath: string): DoculaDocument;
471
485
  }
472
-
486
+ //#endregion
487
+ //#region src/docula.d.ts
473
488
  declare class Docula {
474
- private _options;
475
- private readonly _console;
476
- private _configFileModule;
477
- private _server;
478
- private _watcher;
479
- get console(): DoculaConsole;
480
- /**
481
- * Initialize the Docula class
482
- * @param {DoculaOptions} options
483
- * @returns {void}
484
- * @constructor
485
- */
486
- constructor(options?: DoculaOptions);
487
- /**
488
- * Get the options
489
- * @returns {DoculaOptions}
490
- */
491
- get options(): DoculaOptions;
492
- /**
493
- * Set the options
494
- * @param {DoculaOptions} value
495
- */
496
- set options(value: DoculaOptions);
497
- /**
498
- * The http server used to serve the site
499
- * @returns {http.Server | undefined}
500
- */
501
- get server(): http.Server | undefined;
502
- /**
503
- * The file watcher used in watch mode
504
- * @returns {fs.FSWatcher | undefined}
505
- */
506
- get watcher(): fs.FSWatcher | undefined;
507
- /**
508
- * The config file module. This is the module that is loaded from the docula.config.ts or docula.config.mjs file
509
- * @returns {any}
510
- */
511
- get configFileModule(): any;
512
- /**
513
- * Remove the .cache directory inside the site path.
514
- * Resolves the path and verifies it stays within sitePath to prevent
515
- * path-traversal attacks.
516
- * @param {string} sitePath
517
- */
518
- private cleanCache;
519
- /**
520
- * Check for updates
521
- * @returns {void}
522
- */
523
- checkForUpdates(): void;
524
- /**
525
- * Is the execution process that runs the docula command
526
- * @param {NodeJS.Process} process
527
- * @returns {Promise<void>}
528
- */
529
- execute(process: NodeJS.Process): Promise<void>;
530
- private runBuild;
531
- /**
532
- * Detect if the current project uses TypeScript by checking for tsconfig.json
533
- * @returns {boolean}
534
- */
535
- detectTypeScript(): boolean;
536
- /**
537
- * Generate the init files
538
- * @param {string} sitePath
539
- * @param {boolean} typescript - If true, generates docula.config.ts instead of docula.config.mjs
540
- * @returns {void}
541
- */
542
- generateInit(sitePath: string, typescript?: boolean): void;
543
- /**
544
- * Copy the template's variables.css to the site directory.
545
- * If the file already exists and overwrite is false, prints an error.
546
- * @param {string} sitePath
547
- * @param {string} templatePath
548
- * @param {string} templateName
549
- * @param {boolean} overwrite
550
- * @returns {void}
551
- */
552
- downloadVariables(sitePath: string, templatePath: string, templateName: string, overwrite?: boolean): void;
553
- /**
554
- * Copy the full template directory to {sitePath}/templates/{outputName}/.
555
- * If the directory already exists and overwrite is false, prints an error.
556
- * @param {string} sitePath
557
- * @param {string} templatePath
558
- * @param {string} templateName
559
- * @param {boolean} overwrite
560
- * @returns {void}
561
- */
562
- downloadTemplate(sitePath: string, templatePath: string, templateName: string, overwrite?: boolean): void;
563
- /**
564
- * Get the version of the package
565
- * @returns {string}
566
- */
567
- getVersion(): string;
568
- /**
569
- * Load the config file. Supports both .mjs and .ts config files.
570
- * Priority: docula.config.ts > docula.config.mjs
571
- * @param {string} sitePath
572
- * @returns {Promise<void>}
573
- */
574
- loadConfigFile(sitePath: string): Promise<void>;
575
- /**
576
- * Watch the site path for file changes and rebuild on change
577
- * @param {DoculaOptions} options
578
- * @param {DoculaBuilder} builder
579
- * @returns {fs.FSWatcher}
580
- */
581
- watch(options: DoculaOptions, builder: DoculaBuilder): fs.FSWatcher;
582
- /**
583
- * Serve the site based on the options (port and output path)
584
- * @param {DoculaOptions} options
585
- * @returns {Promise<void>}
586
- */
587
- serve(options: DoculaOptions): Promise<http.Server>;
489
+ private _options;
490
+ private readonly _console;
491
+ private _configFileModule;
492
+ private _server;
493
+ private _watcher;
494
+ get console(): DoculaConsole;
495
+ /**
496
+ * Initialize the Docula class
497
+ * @param {DoculaOptions} options
498
+ * @returns {void}
499
+ * @constructor
500
+ */
501
+ constructor(options?: DoculaOptions);
502
+ /**
503
+ * Get the options
504
+ * @returns {DoculaOptions}
505
+ */
506
+ get options(): DoculaOptions;
507
+ /**
508
+ * Set the options
509
+ * @param {DoculaOptions} value
510
+ */
511
+ set options(value: DoculaOptions);
512
+ /**
513
+ * The http server used to serve the site
514
+ * @returns {http.Server | undefined}
515
+ */
516
+ get server(): http.Server | undefined;
517
+ /**
518
+ * The file watcher used in watch mode
519
+ * @returns {fs.FSWatcher | undefined}
520
+ */
521
+ get watcher(): fs.FSWatcher | undefined;
522
+ /**
523
+ * The config file module. This is the module that is loaded from the docula.config.ts or docula.config.mjs file
524
+ * @returns {any}
525
+ */
526
+ get configFileModule(): any;
527
+ /**
528
+ * Remove the .cache directory inside the site path.
529
+ * Resolves the path and verifies it stays within sitePath to prevent
530
+ * path-traversal attacks.
531
+ * @param {string} sitePath
532
+ */
533
+ private cleanCache;
534
+ /**
535
+ * Check for updates
536
+ * @returns {void}
537
+ */
538
+ checkForUpdates(): void;
539
+ /**
540
+ * Is the execution process that runs the docula command
541
+ * @param {NodeJS.Process} process
542
+ * @returns {Promise<void>}
543
+ */
544
+ execute(process: NodeJS.Process): Promise<void>;
545
+ private runBuild;
546
+ /**
547
+ * Detect if the current project uses TypeScript by checking for tsconfig.json
548
+ * @returns {boolean}
549
+ */
550
+ detectTypeScript(): boolean;
551
+ /**
552
+ * Generate the init files
553
+ * @param {string} sitePath
554
+ * @param {boolean} typescript - If true, generates docula.config.ts instead of docula.config.mjs
555
+ * @returns {void}
556
+ */
557
+ generateInit(sitePath: string, typescript?: boolean): void;
558
+ /**
559
+ * Copy the template's variables.css to the site directory.
560
+ * If the file already exists and overwrite is false, prints an error.
561
+ * @param {string} sitePath
562
+ * @param {string} templatePath
563
+ * @param {string} templateName
564
+ * @param {boolean} overwrite
565
+ * @returns {void}
566
+ */
567
+ downloadVariables(sitePath: string, templatePath: string, templateName: string, overwrite?: boolean): void;
568
+ /**
569
+ * Copy the full template directory to {sitePath}/templates/{outputName}/.
570
+ * If the directory already exists and overwrite is false, prints an error.
571
+ * @param {string} sitePath
572
+ * @param {string} templatePath
573
+ * @param {string} templateName
574
+ * @param {boolean} overwrite
575
+ * @returns {void}
576
+ */
577
+ downloadTemplate(sitePath: string, templatePath: string, templateName: string, overwrite?: boolean): void;
578
+ /**
579
+ * Get the version of the package
580
+ * @returns {string}
581
+ */
582
+ getVersion(): string;
583
+ /**
584
+ * Load the config file. Supports both .mjs and .ts config files.
585
+ * Priority: docula.config.ts > docula.config.mjs
586
+ * @param {string} sitePath
587
+ * @returns {Promise<void>}
588
+ */
589
+ loadConfigFile(sitePath: string): Promise<void>;
590
+ /**
591
+ * Watch the site path for file changes and rebuild on change
592
+ * @param {DoculaOptions} options
593
+ * @param {DoculaBuilder} builder
594
+ * @returns {fs.FSWatcher}
595
+ */
596
+ watch(options: DoculaOptions, builder: DoculaBuilder): fs.FSWatcher;
597
+ /**
598
+ * Serve the site based on the options (port and output path)
599
+ * @param {DoculaOptions} options
600
+ * @returns {Promise<void>}
601
+ */
602
+ serve(options: DoculaOptions): Promise<http.Server>;
588
603
  }
589
-
590
- export { type DoculaAIOptions, type DoculaCacheOptions, type DoculaChangelogEntry, DoculaConsole, type DoculaCookieAuth, type DoculaHeaderLink, type DoculaOpenApiSpec, DoculaOptions, Docula as default };
604
+ //#endregion
605
+ export { type DoculaAIOptions, type DoculaCacheOptions, type DoculaChangelogEntry, DoculaConsole, type DoculaCookieAuth, type DoculaHeaderLink, type DoculaOpenApiSpec, DoculaOptions, Writr, Docula as default };