@ox-content/napi 2.16.0 → 2.26.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 +118 -0
  2. package/index.js +4 -0
  3. package/package.json +7 -7
package/index.d.ts CHANGED
@@ -54,6 +54,9 @@ export declare function collectSsgMarkdownFiles(srcDir: string, extensions: Arra
54
54
  /** Extracts shared CSS and JavaScript assets from generated SSG pages. */
55
55
  export declare function externalizeSsgAssets(pages: Array<JsSsgGeneratedHtmlPage>, outDir: string, base: string): JsSsgExternalizedAssets
56
56
 
57
+ /** Extracts normalized documentation entries from source directories using Oxc. */
58
+ export declare function extractDocsFromDirectories(srcDirs: Array<string>, include: Array<string>, exclude: Array<string>, includePrivate?: boolean | undefined | null, includeInternal?: boolean | undefined | null): Array<JsExtractedDocsModule>
59
+
57
60
  /** Extracts generated API docs grouped by public entry points. */
58
61
  export declare function extractDocsFromEntryPoints(entryPoints: Array<JsEntryPointSpec>, options?: JsEntryPointDocsOptions | undefined | null): Array<JsEntrypointDocsModule>
59
62
 
@@ -95,6 +98,14 @@ export declare function generateDocsNavCode(navItems: Array<JsDocsNavItem>, expo
95
98
  /** Generates sidebar navigation metadata from documentation file paths. */
96
99
  export declare function generateDocsNavMetadata(files: Array<string>, basePath?: string | undefined | null): Array<JsDocsNavItem>
97
100
 
101
+ /**
102
+ * Generates sidebar navigation metadata from extracted documentation modules.
103
+ *
104
+ * Use this when the output `pathStrategy` is `"typedoc"` so that the navigation
105
+ * tree mirrors the nested module/category/symbol pages.
106
+ */
107
+ export declare function generateDocsNavMetadataFromDocs(docs: Array<JsDocsMarkdownModule>, options?: JsDocsNavOptions | undefined | null): Array<JsDocsNavItem>
108
+
98
109
  /** Generates the `virtual:ox-content/i18n` runtime module. */
99
110
  export declare function generateI18nModule(dictDir: string, config: JsI18NRuntimeConfig): string
100
111
 
@@ -232,6 +243,16 @@ export interface JsDocReturn {
232
243
  description: string
233
244
  }
234
245
 
246
+ /** Diagnostic for an entry point export during docs extraction. */
247
+ export interface JsDocsDiagnostic {
248
+ code: string
249
+ entrypoint: string
250
+ exportName: string
251
+ exportKind: string
252
+ source: JsExportSource
253
+ message: string
254
+ }
255
+
235
256
  /** Documentation entry used by generated API Markdown. */
236
257
  export interface JsDocsMarkdownEntry {
237
258
  name: string
@@ -259,6 +280,9 @@ export interface JsDocsMarkdownModule {
259
280
  export interface JsDocsMarkdownOptions {
260
281
  groupBy?: string
261
282
  githubUrl?: string
283
+ linkStyle?: 'markdown' | 'clean'
284
+ basePath?: string
285
+ pathStrategy?: 'flat' | 'typedoc'
262
286
  }
263
287
 
264
288
  /** Ordered JSDoc tag used by generated API Markdown. */
@@ -274,6 +298,21 @@ export interface JsDocsNavItem {
274
298
  children?: Array<JsDocsNavItem>
275
299
  }
276
300
 
301
+ /** Options for generating sidebar navigation metadata from extracted docs. */
302
+ export interface JsDocsNavOptions {
303
+ basePath?: string
304
+ pathStrategy?: 'flat' | 'typedoc'
305
+ }
306
+
307
+ /** Options for writing generated API documentation files. */
308
+ export interface JsDocsOutputOptions {
309
+ generateNav?: boolean
310
+ groupBy?: string
311
+ generatedAt?: string
312
+ basePath?: string
313
+ pathStrategy?: 'flat' | 'typedoc'
314
+ }
315
+
277
316
  /** Entry page configuration. */
278
317
  export interface JsEntryPageConfig {
279
318
  /** Hero section. */
@@ -289,6 +328,7 @@ export interface JsEntrypointDocsModule {
289
328
  sourcePath: string
290
329
  entries: Array<JsDocEntry>
291
330
  exports: Array<JsPublicExport>
331
+ diagnostics: Array<JsDocsDiagnostic>
292
332
  }
293
333
 
294
334
  /** Options for extracting docs grouped by entry point. */
@@ -297,6 +337,8 @@ export interface JsEntryPointDocsOptions {
297
337
  tsconfig?: string
298
338
  private?: boolean
299
339
  internal?: boolean
340
+ externalDocs?: boolean
341
+ externalPackageSources?: Array<JsExternalPackageSource>
300
342
  }
301
343
 
302
344
  /** Public entry point module. */
@@ -323,10 +365,23 @@ export interface JsExportSource {
323
365
  kind: string
324
366
  module?: string
325
367
  package?: string
368
+ specifier?: string
326
369
  originalName: string
327
370
  typeOnly: boolean
328
371
  }
329
372
 
373
+ /** Explicit source entry for an external package. */
374
+ export interface JsExternalPackageSource {
375
+ package: string
376
+ entry: string
377
+ }
378
+
379
+ /** Extracted docs for one source file returned to JavaScript callers. */
380
+ export interface JsExtractedDocsModule {
381
+ file: string
382
+ entries: Array<JsDocEntry>
383
+ }
384
+
330
385
  /** Feature card for entry page. */
331
386
  export interface JsFeatureConfig {
332
387
  /** Icon - supports: "mdi:icon-name" (Iconify), image URL, or emoji. */
@@ -345,6 +400,8 @@ export interface JsFeatureConfig {
345
400
  export interface JsGraphOptions {
346
401
  root?: string
347
402
  tsconfig?: string
403
+ externalDocs?: boolean
404
+ externalPackageSources?: Array<JsExternalPackageSource>
348
405
  }
349
406
 
350
407
  /** Hero action for entry page. */
@@ -793,6 +850,17 @@ export interface JsSsgSidebarItem {
793
850
  collapsed?: boolean
794
851
  }
795
852
 
853
+ /** Result of [`transform_tabs_embeds`]. */
854
+ export interface JsTabsTransformResult {
855
+ /** HTML with every `<tabs>` block expanded. */
856
+ html: string
857
+ /**
858
+ * Number of tab groups expanded; the caller advances its group counter by
859
+ * this amount so generated CSS covers exactly the emitted groups.
860
+ */
861
+ groupCount: number
862
+ }
863
+
796
864
  /** Theme colors for JavaScript. */
797
865
  export interface JsThemeColors {
798
866
  /** Primary accent color. */
@@ -943,6 +1011,37 @@ export interface JsTransformOptions {
943
1011
  codeAnnotationSyntax?: string
944
1012
  /** Enable line numbers for all code blocks by default. */
945
1013
  codeAnnotationDefaultLineNumbers?: boolean
1014
+ /**
1015
+ * Auto-link bare URLs in text. When enabled, the renderer wraps any
1016
+ * text occurrence starting with a registered pattern (default `http://`
1017
+ * and `https://`) in an `<a>` tag.
1018
+ */
1019
+ autolinkUrls?: boolean
1020
+ /**
1021
+ * URL prefix patterns for [`Self::autolink_urls`]. Overrides the
1022
+ * default `["http://", "https://"]` when set.
1023
+ */
1024
+ autolinkPatterns?: Array<string>
1025
+ /**
1026
+ * Add `target="_blank" rel="noopener noreferrer"` to auto-linked URLs.
1027
+ * Defaults to true; ignored when [`Self::autolink_urls`] is off.
1028
+ */
1029
+ autolinkTargetBlank?: boolean
1030
+ }
1031
+
1032
+ /**
1033
+ * Options for [`transform_youtube_embeds`]; all optional, matching the TS
1034
+ * `YouTubeOptions` defaults when omitted.
1035
+ */
1036
+ export interface JsYouTubeOptions {
1037
+ /** Use privacy-enhanced mode (youtube-nocookie.com). Default: true. */
1038
+ privacyEnhanced?: boolean
1039
+ /** Default aspect ratio. Default: "16/9". */
1040
+ aspectRatio?: string
1041
+ /** Allow fullscreen. Default: true. */
1042
+ allowFullscreen?: boolean
1043
+ /** Lazy-load the iframe. Default: true. */
1044
+ lazyLoad?: boolean
946
1045
  }
947
1046
 
948
1047
  export declare function lintMarkdown(source: string, options?: JsMarkdownLintOptions | undefined | null): JsMarkdownLintResult
@@ -989,6 +1088,9 @@ export interface Mf2ValidateResult {
989
1088
  astJson?: string
990
1089
  }
991
1090
 
1091
+ /** Normalizes VitePress-specific frontmatter into ox-content's entry-page shape. */
1092
+ export declare function normalizeVitePressFrontmatter(frontmatter: any): any
1093
+
992
1094
  /**
993
1095
  * Parses Markdown source into an AST.
994
1096
  *
@@ -1121,6 +1223,19 @@ export interface TransformResult {
1121
1223
  errors: Array<string>
1122
1224
  }
1123
1225
 
1226
+ /**
1227
+ * Rewrites `<tabs><tab>…</tab></tabs>` blocks in rendered HTML into the no-JS
1228
+ * CSS tab widget plus a `<details>` fallback. Rust port of the TS
1229
+ * `transformTabs`. Groups are numbered from `start_group`.
1230
+ */
1231
+ export declare function transformTabsEmbeds(html: string, startGroup: number): JsTabsTransformResult
1232
+
1233
+ /**
1234
+ * Rewrites `<youtube …>` elements in rendered HTML into responsive,
1235
+ * privacy-enhanced iframe embeds. Rust port of the TS `transformYouTube`.
1236
+ */
1237
+ export declare function transformYoutubeEmbeds(html: string, options?: JsYouTubeOptions | undefined | null): string
1238
+
1124
1239
  /**
1125
1240
  * Validates an MF2 message string.
1126
1241
  *
@@ -1131,5 +1246,8 @@ export declare function validateMf2(message: string): Mf2ValidateResult
1131
1246
  /** Returns the version of ox_content_napi. */
1132
1247
  export declare function version(): string
1133
1248
 
1249
+ /** Writes generated API documentation files and native sidecars. */
1250
+ export declare function writeGeneratedDocs(docs: Record<string, string>, outDir: string, extractedDocs?: Array<JsDocsMarkdownModule> | undefined | null, options?: JsDocsOutputOptions | undefined | null): void
1251
+
1134
1252
  /** Writes a serialized search index to `search-index.json` under an output directory. */
1135
1253
  export declare function writeSearchIndex(indexJson: string, outDir: string): void
package/index.js CHANGED
@@ -86,12 +86,15 @@ module.exports.version = binding.version;
86
86
  module.exports.extractFileDocs = binding.extractFileDocs;
87
87
  module.exports.extractFileDocEntries = binding.extractFileDocEntries;
88
88
  module.exports.buildExportGraph = binding.buildExportGraph;
89
+ module.exports.extractDocsFromDirectories = binding.extractDocsFromDirectories;
89
90
  module.exports.extractDocsFromEntryPoints = binding.extractDocsFromEntryPoints;
90
91
  module.exports.generateDocsNavMetadata = binding.generateDocsNavMetadata;
92
+ module.exports.generateDocsNavMetadataFromDocs = binding.generateDocsNavMetadataFromDocs;
91
93
  module.exports.generateDocsNavCode = binding.generateDocsNavCode;
92
94
  module.exports.collectDocsSourceFiles = binding.collectDocsSourceFiles;
93
95
  module.exports.generateDocsDataJson = binding.generateDocsDataJson;
94
96
  module.exports.generateDocsMarkdown = binding.generateDocsMarkdown;
97
+ module.exports.writeGeneratedDocs = binding.writeGeneratedDocs;
95
98
  module.exports.mergeHighlightedCodeBlocks = binding.mergeHighlightedCodeBlocks;
96
99
  module.exports.generateOgImageSvg = binding.generateOgImageSvg;
97
100
  module.exports.buildSearchIndex = binding.buildSearchIndex;
@@ -105,6 +108,7 @@ module.exports.matchesSearchScopes = binding.matchesSearchScopes;
105
108
  module.exports.generateSearchModule = binding.generateSearchModule;
106
109
  module.exports.generateSearchModuleFromOptions = binding.generateSearchModuleFromOptions;
107
110
  module.exports.collectSearchMarkdownFiles = binding.collectSearchMarkdownFiles;
111
+ module.exports.normalizeVitePressFrontmatter = binding.normalizeVitePressFrontmatter;
108
112
  module.exports.generateSsgHtml = binding.generateSsgHtml;
109
113
  module.exports.generateSsgBareHtml = binding.generateSsgBareHtml;
110
114
  module.exports.getGitLastUpdated = binding.getGitLastUpdated;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ox-content/napi",
3
- "version": "2.16.0",
3
+ "version": "2.26.0",
4
4
  "description": "Node.js bindings for Ox Content - High-performance Markdown parser",
5
5
  "keywords": [
6
6
  "markdown",
@@ -13,7 +13,7 @@
13
13
  "author": "ubugeeei",
14
14
  "repository": {
15
15
  "type": "git",
16
- "url": "https://github.com/ubugeeei/ox-content.git",
16
+ "url": "https://github.com/ubugeeei-prod/ox-content.git",
17
17
  "directory": "crates/ox_content_napi"
18
18
  },
19
19
  "files": [
@@ -45,10 +45,10 @@
45
45
  ]
46
46
  },
47
47
  "optionalDependencies": {
48
- "@ox-content/binding-darwin-x64": "2.16.0",
49
- "@ox-content/binding-darwin-arm64": "2.16.0",
50
- "@ox-content/binding-linux-x64-gnu": "2.16.0",
51
- "@ox-content/binding-linux-arm64-gnu": "2.16.0",
52
- "@ox-content/binding-win32-x64-msvc": "2.16.0"
48
+ "@ox-content/binding-darwin-x64": "2.26.0",
49
+ "@ox-content/binding-darwin-arm64": "2.26.0",
50
+ "@ox-content/binding-linux-x64-gnu": "2.26.0",
51
+ "@ox-content/binding-linux-arm64-gnu": "2.26.0",
52
+ "@ox-content/binding-win32-x64-msvc": "2.26.0"
53
53
  }
54
54
  }