@ox-content/napi 2.15.0 → 2.25.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 +79 -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. */
@@ -943,6 +1000,22 @@ export interface JsTransformOptions {
943
1000
  codeAnnotationSyntax?: string
944
1001
  /** Enable line numbers for all code blocks by default. */
945
1002
  codeAnnotationDefaultLineNumbers?: boolean
1003
+ /**
1004
+ * Auto-link bare URLs in text. When enabled, the renderer wraps any
1005
+ * text occurrence starting with a registered pattern (default `http://`
1006
+ * and `https://`) in an `<a>` tag.
1007
+ */
1008
+ autolinkUrls?: boolean
1009
+ /**
1010
+ * URL prefix patterns for [`Self::autolink_urls`]. Overrides the
1011
+ * default `["http://", "https://"]` when set.
1012
+ */
1013
+ autolinkPatterns?: Array<string>
1014
+ /**
1015
+ * Add `target="_blank" rel="noopener noreferrer"` to auto-linked URLs.
1016
+ * Defaults to true; ignored when [`Self::autolink_urls`] is off.
1017
+ */
1018
+ autolinkTargetBlank?: boolean
946
1019
  }
947
1020
 
948
1021
  export declare function lintMarkdown(source: string, options?: JsMarkdownLintOptions | undefined | null): JsMarkdownLintResult
@@ -989,6 +1062,9 @@ export interface Mf2ValidateResult {
989
1062
  astJson?: string
990
1063
  }
991
1064
 
1065
+ /** Normalizes VitePress-specific frontmatter into ox-content's entry-page shape. */
1066
+ export declare function normalizeVitePressFrontmatter(frontmatter: any): any
1067
+
992
1068
  /**
993
1069
  * Parses Markdown source into an AST.
994
1070
  *
@@ -1131,5 +1207,8 @@ export declare function validateMf2(message: string): Mf2ValidateResult
1131
1207
  /** Returns the version of ox_content_napi. */
1132
1208
  export declare function version(): string
1133
1209
 
1210
+ /** Writes generated API documentation files and native sidecars. */
1211
+ export declare function writeGeneratedDocs(docs: Record<string, string>, outDir: string, extractedDocs?: Array<JsDocsMarkdownModule> | undefined | null, options?: JsDocsOutputOptions | undefined | null): void
1212
+
1134
1213
  /** Writes a serialized search index to `search-index.json` under an output directory. */
1135
1214
  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.15.0",
3
+ "version": "2.25.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.15.0",
49
- "@ox-content/binding-darwin-arm64": "2.15.0",
50
- "@ox-content/binding-linux-x64-gnu": "2.15.0",
51
- "@ox-content/binding-linux-arm64-gnu": "2.15.0",
52
- "@ox-content/binding-win32-x64-msvc": "2.15.0"
48
+ "@ox-content/binding-darwin-x64": "2.25.0",
49
+ "@ox-content/binding-darwin-arm64": "2.25.0",
50
+ "@ox-content/binding-linux-x64-gnu": "2.25.0",
51
+ "@ox-content/binding-linux-arm64-gnu": "2.25.0",
52
+ "@ox-content/binding-win32-x64-msvc": "2.25.0"
53
53
  }
54
54
  }