@ox-content/napi 1.1.0 → 2.0.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.
Files changed (3) hide show
  1. package/index.d.ts +238 -214
  2. package/index.js +1 -0
  3. package/package.json +6 -6
package/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Takes an array of documents and returns a serialized search index as JSON.
7
7
  */
8
- export declare function buildSearchIndex(documents: Array<JsSearchDocument>): string;
8
+ export declare function buildSearchIndex(documents: Array<JsSearchDocument>): string
9
9
 
10
10
  /**
11
11
  * Runs i18n checks on dictionaries against used translation keys.
@@ -13,30 +13,24 @@ export declare function buildSearchIndex(documents: Array<JsSearchDocument>): st
13
13
  * `dict_dir` is the path to the i18n directory with locale subdirectories.
14
14
  * `used_keys` is a list of translation keys found in source code.
15
15
  */
16
- export declare function checkI18n(dictDir: string, usedKeys: Array<string>): I18NCheckResult;
16
+ export declare function checkI18n(dictDir: string, usedKeys: Array<string>): I18NCheckResult
17
+
18
+ /** Extracts documented declarations from a JavaScript/TypeScript file using Oxc. */
19
+ export declare function extractFileDocs(filePath: string, includePrivate?: boolean | undefined | null): Array<JsSourceDocItem>
17
20
 
18
21
  /**
19
22
  * Extracts searchable content from Markdown source.
20
23
  *
21
24
  * Parses the Markdown and extracts title, body text, headings, and code.
22
25
  */
23
- export declare function extractSearchContent(
24
- source: string,
25
- id: string,
26
- url: string,
27
- options?: JsParserOptions | undefined | null,
28
- ): JsSearchDocument;
26
+ export declare function extractSearchContent(source: string, id: string, url: string, options?: JsParserOptions | undefined | null): JsSearchDocument
29
27
 
30
28
  /**
31
29
  * Extracts translation keys from a TypeScript/JavaScript source string.
32
30
  *
33
31
  * Finds calls like `t('key')` and `$t('key')`.
34
32
  */
35
- export declare function extractTranslationKeys(
36
- source: string,
37
- filePath: string,
38
- functionNames?: Array<string> | undefined | null,
39
- ): Array<I18NKeyUsage>;
33
+ export declare function extractTranslationKeys(source: string, filePath: string, functionNames?: Array<string> | undefined | null): Array<I18NKeyUsage>
40
34
 
41
35
  /**
42
36
  * Generates an OG image as SVG.
@@ -44,414 +38,466 @@ export declare function extractTranslationKeys(
44
38
  * This function generates an SVG representation of an OG image
45
39
  * that can be used for social media previews.
46
40
  */
47
- export declare function generateOgImageSvg(
48
- data: JsOgImageData,
49
- config?: JsOgImageConfig | undefined | null,
50
- ): string;
41
+ export declare function generateOgImageSvg(data: JsOgImageData, config?: JsOgImageConfig | undefined | null): string
51
42
 
52
43
  /** Generates SSG HTML page with navigation and search. */
53
- export declare function generateSsgHtml(
54
- pageData: JsSsgPageData,
55
- navGroups: Array<JsSsgNavGroup>,
56
- config: JsSsgConfig,
57
- ): string;
44
+ export declare function generateSsgHtml(pageData: JsSsgPageData, navGroups: Array<JsSsgNavGroup>, config: JsSsgConfig): string
58
45
 
59
46
  /** Result of i18n checking. */
60
47
  export interface I18NCheckResult {
61
48
  /** All diagnostics. */
62
- diagnostics: Array<I18NDiagnostic>;
49
+ diagnostics: Array<I18NDiagnostic>
63
50
  /** Number of errors. */
64
- errorCount: number;
51
+ errorCount: number
65
52
  /** Number of warnings. */
66
- warningCount: number;
53
+ warningCount: number
67
54
  }
68
55
 
69
56
  /** A single i18n diagnostic. */
70
57
  export interface I18NDiagnostic {
71
58
  /** Severity: "error", "warning", or "info". */
72
- severity: string;
59
+ severity: string
73
60
  /** Diagnostic message. */
74
- message: string;
61
+ message: string
75
62
  /** Related translation key, if any. */
76
- key?: string;
63
+ key?: string
77
64
  /** Related locale, if any. */
78
- locale?: string;
65
+ locale?: string
79
66
  }
80
67
 
81
68
  /** A translation key usage found in source code. */
82
69
  export interface I18NKeyUsage {
83
70
  /** The translation key. */
84
- key: string;
71
+ key: string
85
72
  /** Source file path. */
86
- filePath: string;
73
+ filePath: string
87
74
  /** Line number. */
88
- line: number;
75
+ line: number
89
76
  /** Column number. */
90
- column: number;
77
+ column: number
91
78
  /** End column number. */
92
- endColumn: number;
79
+ endColumn: number
93
80
  }
94
81
 
95
82
  /** Result of loading dictionaries. */
96
83
  export interface I18NLoadResult {
97
84
  /** Number of locales loaded. */
98
- localeCount: number;
85
+ localeCount: number
99
86
  /** All locale tags. */
100
- locales: Array<string>;
87
+ locales: Array<string>
101
88
  /** Errors encountered during loading. */
102
- errors: Array<string>;
89
+ errors: Array<string>
103
90
  }
104
91
 
105
92
  /** Entry page configuration. */
106
93
  export interface JsEntryPageConfig {
107
94
  /** Hero section. */
108
- hero?: JsHeroConfig;
95
+ hero?: JsHeroConfig
109
96
  /** Feature cards. */
110
- features?: Array<JsFeatureConfig>;
97
+ features?: Array<JsFeatureConfig>
111
98
  }
112
99
 
113
100
  /** Feature card for entry page. */
114
101
  export interface JsFeatureConfig {
115
102
  /** Icon - supports: "mdi:icon-name" (Iconify), image URL, or emoji. */
116
- icon?: string;
103
+ icon?: string
117
104
  /** Feature title. */
118
- title: string;
105
+ title: string
119
106
  /** Feature description. */
120
- details?: string;
107
+ details?: string
121
108
  /** Optional link. */
122
- link?: string;
109
+ link?: string
123
110
  /** Link text. */
124
- linkText?: string;
111
+ linkText?: string
125
112
  }
126
113
 
127
114
  /** Hero action for entry page. */
128
115
  export interface JsHeroAction {
129
116
  /** Button theme: "brand" or "alt". */
130
- theme?: string;
117
+ theme?: string
131
118
  /** Button text. */
132
- text: string;
119
+ text: string
133
120
  /** Link URL. */
134
- link: string;
121
+ link: string
135
122
  }
136
123
 
137
124
  /** Hero section configuration for entry page. */
138
125
  export interface JsHeroConfig {
139
126
  /** Main title (large, gradient text). */
140
- name?: string;
127
+ name?: string
141
128
  /** Secondary text. */
142
- text?: string;
129
+ text?: string
143
130
  /** Tagline. */
144
- tagline?: string;
131
+ tagline?: string
132
+ /** Optional notice shown in the hero. */
133
+ notice?: JsHeroNotice
145
134
  /** Hero image. */
146
- image?: JsHeroImage;
135
+ image?: JsHeroImage
147
136
  /** Action buttons. */
148
- actions?: Array<JsHeroAction>;
137
+ actions?: Array<JsHeroAction>
149
138
  }
150
139
 
151
140
  /** Hero image for entry page. */
152
141
  export interface JsHeroImage {
153
142
  /** Image source URL. */
154
- src: string;
143
+ src: string
144
+ /** Light mode image source URL. */
145
+ lightSrc?: string
146
+ /** Dark mode image source URL. */
147
+ darkSrc?: string
155
148
  /** Alt text. */
156
- alt?: string;
149
+ alt?: string
157
150
  /** Image width. */
158
- width?: number;
151
+ width?: number
159
152
  /** Image height. */
160
- height?: number;
153
+ height?: number
154
+ }
155
+
156
+ /** Hero notice for entry page. */
157
+ export interface JsHeroNotice {
158
+ /** Notice title. */
159
+ title?: string
160
+ /** Notice paragraphs. */
161
+ body?: Array<string>
161
162
  }
162
163
 
163
164
  /** Locale information for the locale switcher. */
164
165
  export interface JsLocaleInfo {
165
166
  /** BCP 47 locale tag. */
166
- code: string;
167
+ code: string
167
168
  /** Display name. */
168
- name: string;
169
+ name: string
169
170
  /** Text direction. */
170
- dir: string;
171
+ dir: string
171
172
  }
172
173
 
173
174
  /** OG image configuration for JavaScript. */
174
175
  export interface JsOgImageConfig {
175
176
  /** Image width in pixels. */
176
- width?: number;
177
+ width?: number
177
178
  /** Image height in pixels. */
178
- height?: number;
179
+ height?: number
179
180
  /** Background color (hex). */
180
- backgroundColor?: string;
181
+ backgroundColor?: string
181
182
  /** Text color (hex). */
182
- textColor?: string;
183
+ textColor?: string
183
184
  /** Title font size. */
184
- titleFontSize?: number;
185
+ titleFontSize?: number
185
186
  /** Description font size. */
186
- descriptionFontSize?: number;
187
+ descriptionFontSize?: number
187
188
  }
188
189
 
189
190
  /** OG image data for JavaScript. */
190
191
  export interface JsOgImageData {
191
192
  /** Page title. */
192
- title: string;
193
+ title: string
193
194
  /** Page description. */
194
- description?: string;
195
+ description?: string
195
196
  /** Site name. */
196
- siteName?: string;
197
+ siteName?: string
197
198
  /** Author name. */
198
- author?: string;
199
+ author?: string
199
200
  }
200
201
 
201
202
  /** Parser options for JavaScript. */
202
203
  export interface JsParserOptions {
203
204
  /** Enable GFM extensions. */
204
- gfm?: boolean;
205
+ gfm?: boolean
205
206
  /** Enable footnotes. */
206
- footnotes?: boolean;
207
+ footnotes?: boolean
207
208
  /** Enable task lists. */
208
- taskLists?: boolean;
209
+ taskLists?: boolean
209
210
  /** Enable tables. */
210
- tables?: boolean;
211
+ tables?: boolean
211
212
  /** Enable strikethrough. */
212
- strikethrough?: boolean;
213
+ strikethrough?: boolean
213
214
  /** Enable autolinks. */
214
- autolinks?: boolean;
215
+ autolinks?: boolean
215
216
  }
216
217
 
217
218
  /** Search document for JavaScript. */
218
219
  export interface JsSearchDocument {
219
220
  /** Unique document identifier. */
220
- id: string;
221
+ id: string
221
222
  /** Document title. */
222
- title: string;
223
+ title: string
223
224
  /** Document URL. */
224
- url: string;
225
+ url: string
225
226
  /** Document body text. */
226
- body: string;
227
+ body: string
227
228
  /** Document headings. */
228
- headings: Array<string>;
229
+ headings: Array<string>
229
230
  /** Code snippets. */
230
- code: Array<string>;
231
+ code: Array<string>
231
232
  }
232
233
 
233
234
  /** Search options for JavaScript. */
234
235
  export interface JsSearchOptions {
235
236
  /** Maximum number of results. */
236
- limit?: number;
237
+ limit?: number
237
238
  /** Enable prefix matching. */
238
- prefix?: boolean;
239
+ prefix?: boolean
239
240
  /** Enable fuzzy matching. */
240
- fuzzy?: boolean;
241
+ fuzzy?: boolean
241
242
  /** Minimum score threshold. */
242
- threshold?: number;
243
+ threshold?: number
243
244
  }
244
245
 
245
246
  /** Search result for JavaScript. */
246
247
  export interface JsSearchResult {
247
248
  /** Document ID. */
248
- id: string;
249
+ id: string
249
250
  /** Document title. */
250
- title: string;
251
+ title: string
251
252
  /** Document URL. */
252
- url: string;
253
+ url: string
253
254
  /** Relevance score. */
254
- score: number;
255
+ score: number
255
256
  /** Matched terms. */
256
- matches: Array<string>;
257
+ matches: Array<string>
257
258
  /** Content snippet. */
258
- snippet: string;
259
+ snippet: string
259
260
  }
260
261
 
261
262
  /** Social links for JavaScript. */
262
263
  export interface JsSocialLinks {
263
264
  /** GitHub URL. */
264
- github?: string;
265
+ github?: string
265
266
  /** Twitter/X URL. */
266
- twitter?: string;
267
+ twitter?: string
267
268
  /** Discord URL. */
268
- discord?: string;
269
+ discord?: string
270
+ }
271
+
272
+ /** Source documentation item extracted from a JS/TS file. */
273
+ export interface JsSourceDocItem {
274
+ name: string
275
+ kind: string
276
+ doc?: string
277
+ jsdoc?: string
278
+ sourcePath: string
279
+ line: number
280
+ endLine: number
281
+ exported: boolean
282
+ signature?: string
283
+ params: Array<JsSourceDocParam>
284
+ returnType?: string
285
+ tags: Array<JsSourceDocTag>
286
+ }
287
+
288
+ /** Parameter documentation extracted from source code. */
289
+ export interface JsSourceDocParam {
290
+ name: string
291
+ typeAnnotation?: string
292
+ optional: boolean
293
+ defaultValue?: string
294
+ description?: string
295
+ }
296
+
297
+ /** Raw JSDoc tag extracted from source code. */
298
+ export interface JsSourceDocTag {
299
+ tag: string
300
+ value: string
269
301
  }
270
302
 
271
303
  /** SSG configuration. */
272
304
  export interface JsSsgConfig {
273
305
  /** Site name. */
274
- siteName: string;
306
+ siteName: string
275
307
  /** Base URL path. */
276
- base: string;
308
+ base: string
277
309
  /** OG image URL. */
278
- ogImage?: string;
310
+ ogImage?: string
279
311
  /** Theme configuration. */
280
- theme?: JsThemeConfig;
312
+ theme?: JsThemeConfig
281
313
  /** Current locale for this page. */
282
- locale?: string;
314
+ locale?: string
283
315
  /** Available locales for locale switcher. */
284
- availableLocales?: Array<JsLocaleInfo>;
316
+ availableLocales?: Array<JsLocaleInfo>
285
317
  }
286
318
 
287
319
  /** Navigation group for SSG. */
288
320
  export interface JsSsgNavGroup {
289
321
  /** Group title. */
290
- title: string;
322
+ title: string
291
323
  /** Navigation items. */
292
- items: Array<JsSsgNavItem>;
324
+ items: Array<JsSsgNavItem>
293
325
  }
294
326
 
295
327
  /** Navigation item for SSG. */
296
328
  export interface JsSsgNavItem {
297
329
  /** Display title. */
298
- title: string;
330
+ title: string
299
331
  /** URL path. */
300
- path: string;
332
+ path: string
301
333
  /** Full href. */
302
- href: string;
334
+ href: string
303
335
  }
304
336
 
305
337
  /** Page data for SSG. */
306
338
  export interface JsSsgPageData {
307
339
  /** Page title. */
308
- title: string;
340
+ title: string
309
341
  /** Page description. */
310
- description?: string;
342
+ description?: string
311
343
  /** Page content HTML. */
312
- content: string;
344
+ content: string
313
345
  /** Table of contents entries. */
314
- toc: Array<TocEntry>;
346
+ toc: Array<TocEntry>
315
347
  /** URL path. */
316
- path: string;
348
+ path: string
317
349
  /** Entry page configuration (if layout: entry). */
318
- entryPage?: JsEntryPageConfig;
350
+ entryPage?: JsEntryPageConfig
319
351
  }
320
352
 
321
353
  /** Theme colors for JavaScript. */
322
354
  export interface JsThemeColors {
323
355
  /** Primary accent color. */
324
- primary?: string;
356
+ primary?: string
325
357
  /** Primary color on hover. */
326
- primaryHover?: string;
358
+ primaryHover?: string
327
359
  /** Background color. */
328
- background?: string;
360
+ background?: string
329
361
  /** Alternative background color. */
330
- backgroundAlt?: string;
362
+ backgroundAlt?: string
331
363
  /** Main text color. */
332
- text?: string;
364
+ text?: string
333
365
  /** Muted text color. */
334
- textMuted?: string;
366
+ textMuted?: string
335
367
  /** Border color. */
336
- border?: string;
368
+ border?: string
337
369
  /** Code block background color. */
338
- codeBackground?: string;
370
+ codeBackground?: string
339
371
  /** Code block text color. */
340
- codeText?: string;
372
+ codeText?: string
341
373
  }
342
374
 
343
375
  /** Theme configuration for JavaScript. */
344
376
  export interface JsThemeConfig {
345
377
  /** Light mode colors. */
346
- colors?: JsThemeColors;
378
+ colors?: JsThemeColors
347
379
  /** Dark mode colors. */
348
- darkColors?: JsThemeColors;
380
+ darkColors?: JsThemeColors
349
381
  /** Font configuration. */
350
- fonts?: JsThemeFonts;
382
+ fonts?: JsThemeFonts
383
+ /** Entry page configuration. */
384
+ entryPage?: JsThemeEntryPage
351
385
  /** Layout configuration. */
352
- layout?: JsThemeLayout;
386
+ layout?: JsThemeLayout
353
387
  /** Header configuration. */
354
- header?: JsThemeHeader;
388
+ header?: JsThemeHeader
355
389
  /** Footer configuration. */
356
- footer?: JsThemeFooter;
390
+ footer?: JsThemeFooter
357
391
  /** Social links configuration. */
358
- socialLinks?: JsSocialLinks;
392
+ socialLinks?: JsSocialLinks
359
393
  /** Embedded HTML content at specific positions. */
360
- embed?: JsThemeEmbed;
394
+ embed?: JsThemeEmbed
361
395
  /** Additional custom CSS. */
362
- css?: string;
396
+ css?: string
363
397
  /** Additional custom JavaScript. */
364
- js?: string;
398
+ js?: string
365
399
  }
366
400
 
367
401
  /** Embedded HTML content for specific positions. */
368
402
  export interface JsThemeEmbed {
369
403
  /** Content to embed into `<head>`. */
370
- head?: string;
404
+ head?: string
371
405
  /** Content before header. */
372
- headerBefore?: string;
406
+ headerBefore?: string
373
407
  /** Content after header. */
374
- headerAfter?: string;
408
+ headerAfter?: string
375
409
  /** Content before sidebar navigation. */
376
- sidebarBefore?: string;
410
+ sidebarBefore?: string
377
411
  /** Content after sidebar navigation. */
378
- sidebarAfter?: string;
412
+ sidebarAfter?: string
379
413
  /** Content before main content. */
380
- contentBefore?: string;
414
+ contentBefore?: string
381
415
  /** Content after main content. */
382
- contentAfter?: string;
416
+ contentAfter?: string
383
417
  /** Content before footer. */
384
- footerBefore?: string;
418
+ footerBefore?: string
385
419
  /** Custom footer content. */
386
- footer?: string;
420
+ footer?: string
421
+ }
422
+
423
+ /** Entry page theme configuration for JavaScript. */
424
+ export interface JsThemeEntryPage {
425
+ /** Landing page presentation mode. */
426
+ mode?: string
387
427
  }
388
428
 
389
429
  /** Theme fonts for JavaScript. */
390
430
  export interface JsThemeFonts {
391
431
  /** Sans-serif font stack. */
392
- sans?: string;
432
+ sans?: string
393
433
  /** Monospace font stack. */
394
- mono?: string;
434
+ mono?: string
395
435
  }
396
436
 
397
437
  /** Theme footer for JavaScript. */
398
438
  export interface JsThemeFooter {
399
439
  /** Footer message (supports HTML). */
400
- message?: string;
440
+ message?: string
401
441
  /** Copyright text (supports HTML). */
402
- copyright?: string;
442
+ copyright?: string
403
443
  }
404
444
 
405
445
  /** Theme header for JavaScript. */
406
446
  export interface JsThemeHeader {
407
447
  /** Logo image URL. */
408
- logo?: string;
448
+ logo?: string
449
+ /** Light mode logo image URL. */
450
+ logoLight?: string
451
+ /** Dark mode logo image URL. */
452
+ logoDark?: string
453
+ /** Whether to render the site name text next to the logo. */
454
+ showSiteNameText?: boolean
409
455
  /** Logo width in pixels. */
410
- logoWidth?: number;
456
+ logoWidth?: number
411
457
  /** Logo height in pixels. */
412
- logoHeight?: number;
458
+ logoHeight?: number
413
459
  }
414
460
 
415
461
  /** Theme layout for JavaScript. */
416
462
  export interface JsThemeLayout {
417
463
  /** Sidebar width (CSS value). */
418
- sidebarWidth?: string;
464
+ sidebarWidth?: string
419
465
  /** Header height (CSS value). */
420
- headerHeight?: string;
466
+ headerHeight?: string
421
467
  /** Maximum content width (CSS value). */
422
- maxContentWidth?: string;
468
+ maxContentWidth?: string
423
469
  }
424
470
 
425
471
  /** Transform options for JavaScript. */
426
472
  export interface JsTransformOptions {
427
473
  /** Enable GFM extensions. */
428
- gfm?: boolean;
474
+ gfm?: boolean
429
475
  /** Enable footnotes. */
430
- footnotes?: boolean;
476
+ footnotes?: boolean
431
477
  /** Enable task lists. */
432
- taskLists?: boolean;
478
+ taskLists?: boolean
433
479
  /** Enable tables. */
434
- tables?: boolean;
480
+ tables?: boolean
435
481
  /** Enable strikethrough. */
436
- strikethrough?: boolean;
482
+ strikethrough?: boolean
437
483
  /** Enable autolinks. */
438
- autolinks?: boolean;
484
+ autolinks?: boolean
439
485
  /** Maximum TOC depth (1-6). */
440
- tocMaxDepth?: number;
486
+ tocMaxDepth?: number
441
487
  /** Convert `.md` links to `.html` links for SSG output. */
442
- convertMdLinks?: boolean;
488
+ convertMdLinks?: boolean
443
489
  /** Base URL for absolute link conversion (e.g., "/" or "/docs/"). */
444
- baseUrl?: string;
490
+ baseUrl?: string
445
491
  /** Source file path for relative link resolution. */
446
- sourcePath?: string;
492
+ sourcePath?: string
447
493
  /** Enable line annotations for code blocks using fence meta. */
448
- codeAnnotations?: boolean;
494
+ codeAnnotations?: boolean
449
495
  /** Fence meta key used to read code annotations. */
450
- codeAnnotationMetaKey?: string;
496
+ codeAnnotationMetaKey?: string
451
497
  /** Code annotation syntax mode. */
452
- codeAnnotationSyntax?: string;
498
+ codeAnnotationSyntax?: string
453
499
  /** Enable line numbers for all code blocks by default. */
454
- codeAnnotationDefaultLineNumbers?: boolean;
500
+ codeAnnotationDefaultLineNumbers?: boolean
455
501
  }
456
502
 
457
503
  /**
@@ -460,7 +506,7 @@ export interface JsTransformOptions {
460
506
  * The directory should contain locale subdirectories (e.g., `en/`, `ja/`)
461
507
  * with JSON or YAML translation files.
462
508
  */
463
- export declare function loadDictionaries(dir: string): I18NLoadResult;
509
+ export declare function loadDictionaries(dir: string): I18NLoadResult
464
510
 
465
511
  /**
466
512
  * Loads dictionaries from the given directory and returns a flat key-value map per locale.
@@ -468,30 +514,27 @@ export declare function loadDictionaries(dir: string): I18NLoadResult;
468
514
  * Each locale maps to a flat `{ "namespace.key": "value" }` structure.
469
515
  * Supports both JSON and YAML dictionary files.
470
516
  */
471
- export declare function loadDictionariesFlat(dir: string): Record<string, Record<string, string>>;
517
+ export declare function loadDictionariesFlat(dir: string): Record<string, Record<string, string>>
472
518
 
473
519
  /** Restores code block metadata after JavaScript-side syntax highlighting. */
474
- export declare function mergeHighlightedCodeBlocks(
475
- originalHtml: string,
476
- highlightedHtml: string,
477
- ): string;
520
+ export declare function mergeHighlightedCodeBlocks(originalHtml: string, highlightedHtml: string): string
478
521
 
479
522
  /** Mermaid transform result. */
480
523
  export interface MermaidTransformResult {
481
524
  /** The transformed HTML with mermaid code blocks replaced by rendered SVGs. */
482
- html: string;
525
+ html: string
483
526
  /** Non-fatal errors encountered during rendering (per-diagram). */
484
- errors: Array<string>;
527
+ errors: Array<string>
485
528
  }
486
529
 
487
530
  /** Result of MF2 validation. */
488
531
  export interface Mf2ValidateResult {
489
532
  /** Whether the message is valid. */
490
- valid: boolean;
533
+ valid: boolean
491
534
  /** Validation errors. */
492
- errors: Array<string>;
535
+ errors: Array<string>
493
536
  /** AST as JSON (if parsing succeeded). */
494
- astJson?: string;
537
+ astJson?: string
495
538
  }
496
539
 
497
540
  /**
@@ -499,40 +542,31 @@ export interface Mf2ValidateResult {
499
542
  *
500
543
  * Returns the AST as a JSON string for zero-copy transfer to JavaScript.
501
544
  */
502
- export declare function parse(
503
- source: string,
504
- options?: JsParserOptions | undefined | null,
505
- ): ParseResult;
545
+ export declare function parse(source: string, options?: JsParserOptions | undefined | null): ParseResult
506
546
 
507
547
  /** Parses Markdown and renders to HTML. */
508
- export declare function parseAndRender(
509
- source: string,
510
- options?: JsParserOptions | undefined | null,
511
- ): RenderResult;
548
+ export declare function parseAndRender(source: string, options?: JsParserOptions | undefined | null): RenderResult
512
549
 
513
550
  /** Parses Markdown and renders to HTML asynchronously (runs on worker thread). */
514
- export declare function parseAndRenderAsync(
515
- source: string,
516
- options?: JsParserOptions | undefined | null,
517
- ): Promise<unknown>;
551
+ export declare function parseAndRenderAsync(source: string, options?: JsParserOptions | undefined | null): Promise<unknown>
518
552
 
519
553
  /** Parse result containing the AST as JSON. */
520
554
  export interface ParseResult {
521
555
  /** The AST as a JSON string. */
522
- ast: string;
556
+ ast: string
523
557
  /** Parse errors, if any. */
524
- errors: Array<string>;
558
+ errors: Array<string>
525
559
  }
526
560
 
527
561
  /** Renders an AST (provided as JSON) to HTML. */
528
- export declare function render(astJson: string): RenderResult;
562
+ export declare function render(astJson: string): RenderResult
529
563
 
530
564
  /** Render result containing the HTML output. */
531
565
  export interface RenderResult {
532
566
  /** The rendered HTML. */
533
- html: string;
567
+ html: string
534
568
  /** Render errors, if any. */
535
- errors: Array<string>;
569
+ errors: Array<string>
536
570
  }
537
571
 
538
572
  /**
@@ -541,20 +575,16 @@ export interface RenderResult {
541
575
  * Takes a JSON-serialized index, query string, and options.
542
576
  * Returns an array of search results.
543
577
  */
544
- export declare function searchIndex(
545
- indexJson: string,
546
- query: string,
547
- options?: JsSearchOptions | undefined | null,
548
- ): Array<JsSearchResult>;
578
+ export declare function searchIndex(indexJson: string, query: string, options?: JsSearchOptions | undefined | null): Array<JsSearchResult>
549
579
 
550
580
  /** Table of contents entry. */
551
581
  export interface TocEntry {
552
582
  /** Heading depth (1-6). */
553
- depth: number;
583
+ depth: number
554
584
  /** Heading text. */
555
- text: string;
585
+ text: string
556
586
  /** URL-friendly slug. */
557
- slug: string;
587
+ slug: string
558
588
  }
559
589
 
560
590
  /**
@@ -562,16 +592,10 @@ export interface TocEntry {
562
592
  *
563
593
  * This is the main entry point for @ox-content/unplugin.
564
594
  */
565
- export declare function transform(
566
- source: string,
567
- options?: JsTransformOptions | undefined | null,
568
- ): TransformResult;
595
+ export declare function transform(source: string, options?: JsTransformOptions | undefined | null): TransformResult
569
596
 
570
597
  /** Transforms Markdown source asynchronously (runs on worker thread). */
571
- export declare function transformAsync(
572
- source: string,
573
- options?: JsTransformOptions | undefined | null,
574
- ): Promise<unknown>;
598
+ export declare function transformAsync(source: string, options?: JsTransformOptions | undefined | null): Promise<unknown>
575
599
 
576
600
  /**
577
601
  * Transforms mermaid code blocks in HTML to rendered SVG diagrams.
@@ -580,18 +604,18 @@ export declare function transformAsync(
580
604
  * renders each in parallel using the mmdc CLI, and replaces them with
581
605
  * `<div class="ox-mermaid">...</div>`.
582
606
  */
583
- export declare function transformMermaid(html: string, mmdcPath: string): MermaidTransformResult;
607
+ export declare function transformMermaid(html: string, mmdcPath: string): MermaidTransformResult
584
608
 
585
609
  /** Transform result containing HTML, frontmatter, and TOC. */
586
610
  export interface TransformResult {
587
611
  /** The rendered HTML. */
588
- html: string;
612
+ html: string
589
613
  /** Parsed frontmatter as JSON string. */
590
- frontmatter: string;
614
+ frontmatter: string
591
615
  /** Table of contents entries. */
592
- toc: Array<TocEntry>;
616
+ toc: Array<TocEntry>
593
617
  /** Parse/render errors, if any. */
594
- errors: Array<string>;
618
+ errors: Array<string>
595
619
  }
596
620
 
597
621
  /**
@@ -599,7 +623,7 @@ export interface TransformResult {
599
623
  *
600
624
  * Returns parsing and semantic validation results.
601
625
  */
602
- export declare function validateMf2(message: string): Mf2ValidateResult;
626
+ export declare function validateMf2(message: string): Mf2ValidateResult
603
627
 
604
628
  /** Returns the version of ox_content_napi. */
605
- export declare function version(): string;
629
+ export declare function version(): string
package/index.js CHANGED
@@ -76,6 +76,7 @@ module.exports.render = binding.render;
76
76
  module.exports.transform = binding.transform;
77
77
  module.exports.transformAsync = binding.transformAsync;
78
78
  module.exports.version = binding.version;
79
+ module.exports.extractFileDocs = binding.extractFileDocs;
79
80
  module.exports.generateOgImageSvg = binding.generateOgImageSvg;
80
81
  module.exports.buildSearchIndex = binding.buildSearchIndex;
81
82
  module.exports.searchIndex = binding.searchIndex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ox-content/napi",
3
- "version": "1.1.0",
3
+ "version": "2.0.0",
4
4
  "description": "Node.js bindings for Ox Content - High-performance Markdown parser",
5
5
  "keywords": [
6
6
  "markdown",
@@ -45,10 +45,10 @@
45
45
  ]
46
46
  },
47
47
  "optionalDependencies": {
48
- "@ox-content/binding-darwin-x64": "1.1.0",
49
- "@ox-content/binding-darwin-arm64": "1.1.0",
50
- "@ox-content/binding-linux-x64-gnu": "1.1.0",
51
- "@ox-content/binding-linux-arm64-gnu": "1.1.0",
52
- "@ox-content/binding-win32-x64-msvc": "1.1.0"
48
+ "@ox-content/binding-darwin-x64": "2.0.0",
49
+ "@ox-content/binding-darwin-arm64": "2.0.0",
50
+ "@ox-content/binding-linux-x64-gnu": "2.0.0",
51
+ "@ox-content/binding-linux-arm64-gnu": "2.0.0",
52
+ "@ox-content/binding-win32-x64-msvc": "2.0.0"
53
53
  }
54
54
  }