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