@ox-content/napi 2.11.0 → 2.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/index.d.ts +133 -0
- package/index.js +16 -0
- package/package.json +7 -7
package/index.d.ts
CHANGED
|
@@ -7,6 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export declare function buildSearchIndex(documents: Array<JsSearchDocument>): string
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Builds a search index directly from Markdown files under a source directory.
|
|
12
|
+
*
|
|
13
|
+
* File discovery, Markdown parsing, search document extraction, and index
|
|
14
|
+
* construction all run on the Rust side.
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildSearchIndexFromDirectory(srcDir: string, base: string, extensions: Array<string>): string
|
|
17
|
+
|
|
10
18
|
/** Builds SSG navigation groups from markdown files. */
|
|
11
19
|
export declare function buildSsgNavItems(markdownFiles: Array<string>, srcDir: string, base: string, extension: string): Array<JsSsgNavGroup>
|
|
12
20
|
|
|
@@ -21,6 +29,25 @@ export declare function buildSsgThemeNavItems(sidebar: Array<JsSsgSidebarItem>,
|
|
|
21
29
|
*/
|
|
22
30
|
export declare function checkI18n(dictDir: string, usedKeys: Array<string>): I18NCheckResult
|
|
23
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Runs project-level i18n checks by collecting source keys and validating dictionaries.
|
|
34
|
+
*
|
|
35
|
+
* `dict_dir` is the path to the i18n directory with locale subdirectories.
|
|
36
|
+
* `src_dirs` are source/content directories to scan recursively.
|
|
37
|
+
* `function_names` are translation call names to collect from JS/TS source.
|
|
38
|
+
* `default_locale` is used for dictionary fallback rules.
|
|
39
|
+
*/
|
|
40
|
+
export declare function checkI18nProject(dictDir: string, srcDirs: Array<string>, functionNames: Array<string>, defaultLocale: string): I18NCheckResult
|
|
41
|
+
|
|
42
|
+
/** Collects source files for generated API documentation. */
|
|
43
|
+
export declare function collectDocsSourceFiles(srcDir: string, include: Array<string>, exclude: Array<string>): Array<string>
|
|
44
|
+
|
|
45
|
+
/** Collects Markdown files for search indexing from a source directory. */
|
|
46
|
+
export declare function collectSearchMarkdownFiles(srcDir: string, extensions: Array<string>): Array<string>
|
|
47
|
+
|
|
48
|
+
/** Collects Markdown files for SSG from a source directory. */
|
|
49
|
+
export declare function collectSsgMarkdownFiles(srcDir: string, extensions: Array<string>): Array<string>
|
|
50
|
+
|
|
24
51
|
/** Extracts shared CSS and JavaScript assets from generated SSG pages. */
|
|
25
52
|
export declare function externalizeSsgAssets(pages: Array<JsSsgGeneratedHtmlPage>, outDir: string, base: string): JsSsgExternalizedAssets
|
|
26
53
|
|
|
@@ -50,6 +77,12 @@ export declare function extractTranslationKeys(source: string, filePath: string,
|
|
|
50
77
|
/** Formats a file or directory segment as an SSG title. */
|
|
51
78
|
export declare function formatSsgTitle(name: string): string
|
|
52
79
|
|
|
80
|
+
/** Generates the machine-readable docs data JSON payload. */
|
|
81
|
+
export declare function generateDocsDataJson(docs: Array<JsDocsMarkdownModule>, generatedAt: string): string
|
|
82
|
+
|
|
83
|
+
/** Generates Markdown API reference pages from extracted documentation entries. */
|
|
84
|
+
export declare function generateDocsMarkdown(docs: Array<JsDocsMarkdownModule>, options?: JsDocsMarkdownOptions | undefined | null): Record<string, string>
|
|
85
|
+
|
|
53
86
|
/** Generates TypeScript source code for documentation navigation metadata. */
|
|
54
87
|
export declare function generateDocsNavCode(navItems: Array<JsDocsNavItem>, exportName?: string | undefined | null): string
|
|
55
88
|
|
|
@@ -70,6 +103,12 @@ export declare function generateOgImageSvg(data: JsOgImageData, config?: JsOgIma
|
|
|
70
103
|
/** Generates the client-side search runtime module. */
|
|
71
104
|
export declare function generateSearchModule(optionsJson: string, indexPath: string): string
|
|
72
105
|
|
|
106
|
+
/** Generates the client-side search runtime module from typed options. */
|
|
107
|
+
export declare function generateSearchModuleFromOptions(options: JsSearchRuntimeOptions, indexPath: string): string
|
|
108
|
+
|
|
109
|
+
/** Generates a bare SSG HTML page without navigation or styles. */
|
|
110
|
+
export declare function generateSsgBareHtml(content: string, title: string): string
|
|
111
|
+
|
|
73
112
|
/** Generates SSG HTML page with navigation and search. */
|
|
74
113
|
export declare function generateSsgHtml(pageData: JsSsgPageData, navGroups: Array<JsSsgNavGroup>, config: JsSsgConfig): string
|
|
75
114
|
|
|
@@ -168,6 +207,40 @@ export interface JsDocReturn {
|
|
|
168
207
|
description: string
|
|
169
208
|
}
|
|
170
209
|
|
|
210
|
+
/** Documentation entry used by generated API Markdown. */
|
|
211
|
+
export interface JsDocsMarkdownEntry {
|
|
212
|
+
name: string
|
|
213
|
+
kind: string
|
|
214
|
+
description: string
|
|
215
|
+
params?: Array<JsDocParam>
|
|
216
|
+
returns?: JsDocReturn
|
|
217
|
+
examples?: Array<string>
|
|
218
|
+
tags?: Array<JsDocsMarkdownTag>
|
|
219
|
+
private: boolean
|
|
220
|
+
file: string
|
|
221
|
+
line: number
|
|
222
|
+
endLine: number
|
|
223
|
+
signature?: string
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** Extracted docs for one source file used by generated API Markdown. */
|
|
227
|
+
export interface JsDocsMarkdownModule {
|
|
228
|
+
file: string
|
|
229
|
+
entries: Array<JsDocsMarkdownEntry>
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** Options for generated API Markdown. */
|
|
233
|
+
export interface JsDocsMarkdownOptions {
|
|
234
|
+
groupBy?: string
|
|
235
|
+
githubUrl?: string
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** Ordered JSDoc tag used by generated API Markdown. */
|
|
239
|
+
export interface JsDocsMarkdownTag {
|
|
240
|
+
tag: string
|
|
241
|
+
value: string
|
|
242
|
+
}
|
|
243
|
+
|
|
171
244
|
/** Navigation item emitted for generated documentation. */
|
|
172
245
|
export interface JsDocsNavItem {
|
|
173
246
|
title: string
|
|
@@ -420,6 +493,20 @@ export interface JsSearchResult {
|
|
|
420
493
|
snippet: string
|
|
421
494
|
}
|
|
422
495
|
|
|
496
|
+
/** Resolved search runtime options for JavaScript. */
|
|
497
|
+
export interface JsSearchRuntimeOptions {
|
|
498
|
+
/** Whether search is enabled. */
|
|
499
|
+
enabled: boolean
|
|
500
|
+
/** Maximum number of results. */
|
|
501
|
+
limit: number
|
|
502
|
+
/** Enable prefix matching. */
|
|
503
|
+
prefix: boolean
|
|
504
|
+
/** Search input placeholder. */
|
|
505
|
+
placeholder: string
|
|
506
|
+
/** Keyboard shortcut to focus search. */
|
|
507
|
+
hotkey: string
|
|
508
|
+
}
|
|
509
|
+
|
|
423
510
|
/** Custom social link for JavaScript. */
|
|
424
511
|
export interface JsSocialLink {
|
|
425
512
|
/** Icon label. */
|
|
@@ -481,6 +568,18 @@ export interface JsSourceOptions {
|
|
|
481
568
|
frontmatter?: boolean
|
|
482
569
|
}
|
|
483
570
|
|
|
571
|
+
/** Source offset where prepared Markdown content begins in the original source. */
|
|
572
|
+
export interface JsSourceOrigin {
|
|
573
|
+
/** UTF-8 byte offset. */
|
|
574
|
+
byteOffset: number
|
|
575
|
+
/** UTF-16 code-unit offset. */
|
|
576
|
+
offset: number
|
|
577
|
+
/** 1-based line number. */
|
|
578
|
+
line: number
|
|
579
|
+
/** 1-based column number. */
|
|
580
|
+
column: number
|
|
581
|
+
}
|
|
582
|
+
|
|
484
583
|
/** SSG configuration. */
|
|
485
584
|
export interface JsSsgConfig {
|
|
486
585
|
/** Site name. */
|
|
@@ -524,6 +623,19 @@ export interface JsSsgNavGroup {
|
|
|
524
623
|
collapsed?: boolean
|
|
525
624
|
}
|
|
526
625
|
|
|
626
|
+
/** Manual SSG navigation group supplied by user configuration. */
|
|
627
|
+
export interface JsSsgNavigationGroup {
|
|
628
|
+
title: string
|
|
629
|
+
items: Array<JsSsgNavigationItem>
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/** Manual SSG navigation item supplied by user configuration. */
|
|
633
|
+
export interface JsSsgNavigationItem {
|
|
634
|
+
title: string
|
|
635
|
+
path?: string
|
|
636
|
+
href?: string
|
|
637
|
+
}
|
|
638
|
+
|
|
527
639
|
/** Navigation item for SSG. */
|
|
528
640
|
export interface JsSsgNavItem {
|
|
529
641
|
/** Display title. */
|
|
@@ -821,6 +933,19 @@ export declare function parseScopedSearchQuery(query: string): JsScopedSearchQue
|
|
|
821
933
|
*/
|
|
822
934
|
export declare function parseTransferRaw(source: string, kind: string, options?: JsParserOptions | undefined | null): Uint8Array
|
|
823
935
|
|
|
936
|
+
/** Prepared Markdown source with parsed frontmatter. */
|
|
937
|
+
export interface PreparedSourceResult {
|
|
938
|
+
/** Markdown content after optional frontmatter removal. */
|
|
939
|
+
content: string
|
|
940
|
+
/** Parsed frontmatter object. */
|
|
941
|
+
frontmatter: Record<string, any>
|
|
942
|
+
/** Source position where `content` starts in the original source. */
|
|
943
|
+
sourceOffset: JsSourceOrigin
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
/** Splits Markdown source into content and parsed frontmatter. */
|
|
947
|
+
export declare function prepareSource(source: string, options?: JsSourceOptions | undefined | null): PreparedSourceResult
|
|
948
|
+
|
|
824
949
|
/**
|
|
825
950
|
* Splits Markdown source into content and frontmatter in a raw transfer buffer.
|
|
826
951
|
*
|
|
@@ -840,6 +965,9 @@ export interface RenderResult {
|
|
|
840
965
|
errors: Array<string>
|
|
841
966
|
}
|
|
842
967
|
|
|
968
|
+
/** Resolves manual SSG navigation groups. */
|
|
969
|
+
export declare function resolveSsgNavigationGroups(navigation: Array<JsSsgNavigationGroup>, base: string, extension: string): Array<JsSsgNavGroup>
|
|
970
|
+
|
|
843
971
|
/** Resolves all output and public route paths for an SSG page. */
|
|
844
972
|
export declare function resolveSsgRoutePaths(inputPath: string, srcDir: string, outDir: string, base: string, extension: string, siteUrl?: string | undefined | null): JsSsgRoutePaths
|
|
845
973
|
|
|
@@ -859,6 +987,8 @@ export interface TocEntry {
|
|
|
859
987
|
text: string
|
|
860
988
|
/** URL-friendly slug. */
|
|
861
989
|
slug: string
|
|
990
|
+
/** Child entries. */
|
|
991
|
+
children: Array<TocEntry>
|
|
862
992
|
}
|
|
863
993
|
|
|
864
994
|
/**
|
|
@@ -909,3 +1039,6 @@ export declare function validateMf2(message: string): Mf2ValidateResult
|
|
|
909
1039
|
|
|
910
1040
|
/** Returns the version of ox_content_napi. */
|
|
911
1041
|
export declare function version(): string
|
|
1042
|
+
|
|
1043
|
+
/** Writes a serialized search index to `search-index.json` under an output directory. */
|
|
1044
|
+
export declare function writeSearchIndex(indexJson: string, outDir: string): void
|
package/index.js
CHANGED
|
@@ -74,25 +74,38 @@ module.exports.parseTransferRaw = binding.parseTransferRaw;
|
|
|
74
74
|
module.exports.parseMdastRaw = binding.parseMdastRaw;
|
|
75
75
|
module.exports.parseAndRender = binding.parseAndRender;
|
|
76
76
|
module.exports.parseAndRenderAsync = binding.parseAndRenderAsync;
|
|
77
|
+
module.exports.prepareSource = binding.prepareSource;
|
|
78
|
+
module.exports.prepareSourceRaw = binding.prepareSourceRaw;
|
|
77
79
|
module.exports.lintMarkdown = binding.lintMarkdown;
|
|
78
80
|
module.exports.lintMarkdownDocuments = binding.lintMarkdownDocuments;
|
|
79
81
|
module.exports.render = binding.render;
|
|
80
82
|
module.exports.transform = binding.transform;
|
|
81
83
|
module.exports.transformAsync = binding.transformAsync;
|
|
84
|
+
module.exports.transformMdastRaw = binding.transformMdastRaw;
|
|
82
85
|
module.exports.version = binding.version;
|
|
83
86
|
module.exports.extractFileDocs = binding.extractFileDocs;
|
|
84
87
|
module.exports.extractFileDocEntries = binding.extractFileDocEntries;
|
|
85
88
|
module.exports.generateDocsNavMetadata = binding.generateDocsNavMetadata;
|
|
86
89
|
module.exports.generateDocsNavCode = binding.generateDocsNavCode;
|
|
90
|
+
module.exports.collectDocsSourceFiles = binding.collectDocsSourceFiles;
|
|
91
|
+
module.exports.generateDocsDataJson = binding.generateDocsDataJson;
|
|
92
|
+
module.exports.generateDocsMarkdown = binding.generateDocsMarkdown;
|
|
93
|
+
module.exports.mergeHighlightedCodeBlocks = binding.mergeHighlightedCodeBlocks;
|
|
87
94
|
module.exports.generateOgImageSvg = binding.generateOgImageSvg;
|
|
88
95
|
module.exports.buildSearchIndex = binding.buildSearchIndex;
|
|
96
|
+
module.exports.buildSearchIndexFromDirectory = binding.buildSearchIndexFromDirectory;
|
|
97
|
+
module.exports.writeSearchIndex = binding.writeSearchIndex;
|
|
89
98
|
module.exports.searchIndex = binding.searchIndex;
|
|
90
99
|
module.exports.extractSearchContent = binding.extractSearchContent;
|
|
91
100
|
module.exports.parseScopedSearchQuery = binding.parseScopedSearchQuery;
|
|
92
101
|
module.exports.getSearchDocumentScopes = binding.getSearchDocumentScopes;
|
|
93
102
|
module.exports.matchesSearchScopes = binding.matchesSearchScopes;
|
|
94
103
|
module.exports.generateSearchModule = binding.generateSearchModule;
|
|
104
|
+
module.exports.generateSearchModuleFromOptions = binding.generateSearchModuleFromOptions;
|
|
105
|
+
module.exports.collectSearchMarkdownFiles = binding.collectSearchMarkdownFiles;
|
|
95
106
|
module.exports.generateSsgHtml = binding.generateSsgHtml;
|
|
107
|
+
module.exports.generateSsgBareHtml = binding.generateSsgBareHtml;
|
|
108
|
+
module.exports.getGitLastUpdated = binding.getGitLastUpdated;
|
|
96
109
|
module.exports.resolveSsgRoutePaths = binding.resolveSsgRoutePaths;
|
|
97
110
|
module.exports.getSsgOutputPath = binding.getSsgOutputPath;
|
|
98
111
|
module.exports.getSsgUrlPath = binding.getSsgUrlPath;
|
|
@@ -102,6 +115,8 @@ module.exports.extractSsgTitle = binding.extractSsgTitle;
|
|
|
102
115
|
module.exports.formatSsgTitle = binding.formatSsgTitle;
|
|
103
116
|
module.exports.buildSsgNavItems = binding.buildSsgNavItems;
|
|
104
117
|
module.exports.buildSsgThemeNavItems = binding.buildSsgThemeNavItems;
|
|
118
|
+
module.exports.resolveSsgNavigationGroups = binding.resolveSsgNavigationGroups;
|
|
119
|
+
module.exports.collectSsgMarkdownFiles = binding.collectSsgMarkdownFiles;
|
|
105
120
|
module.exports.externalizeSsgAssets = binding.externalizeSsgAssets;
|
|
106
121
|
module.exports.transformMermaid = binding.transformMermaid;
|
|
107
122
|
module.exports.loadDictionaries = binding.loadDictionaries;
|
|
@@ -109,4 +124,5 @@ module.exports.loadDictionariesFlat = binding.loadDictionariesFlat;
|
|
|
109
124
|
module.exports.generateI18nModule = binding.generateI18nModule;
|
|
110
125
|
module.exports.validateMf2 = binding.validateMf2;
|
|
111
126
|
module.exports.checkI18n = binding.checkI18n;
|
|
127
|
+
module.exports.checkI18nProject = binding.checkI18nProject;
|
|
112
128
|
module.exports.extractTranslationKeys = binding.extractTranslationKeys;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ox-content/napi",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0",
|
|
4
4
|
"description": "Node.js bindings for Ox Content - High-performance Markdown parser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"build:debug": "napi build"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@napi-rs/cli": "^3.
|
|
34
|
+
"@napi-rs/cli": "^3.6.2"
|
|
35
35
|
},
|
|
36
36
|
"napi": {
|
|
37
37
|
"binaryName": "ox-content",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
]
|
|
46
46
|
},
|
|
47
47
|
"optionalDependencies": {
|
|
48
|
-
"@ox-content/binding-darwin-x64": "2.
|
|
49
|
-
"@ox-content/binding-darwin-arm64": "2.
|
|
50
|
-
"@ox-content/binding-linux-x64-gnu": "2.
|
|
51
|
-
"@ox-content/binding-linux-arm64-gnu": "2.
|
|
52
|
-
"@ox-content/binding-win32-x64-msvc": "2.
|
|
48
|
+
"@ox-content/binding-darwin-x64": "2.12.0",
|
|
49
|
+
"@ox-content/binding-darwin-arm64": "2.12.0",
|
|
50
|
+
"@ox-content/binding-linux-x64-gnu": "2.12.0",
|
|
51
|
+
"@ox-content/binding-linux-arm64-gnu": "2.12.0",
|
|
52
|
+
"@ox-content/binding-win32-x64-msvc": "2.12.0"
|
|
53
53
|
}
|
|
54
54
|
}
|