@ox-content/napi 3.0.0-alpha.1 → 3.0.0-alpha.3

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 +101 -1
  2. package/index.js +2 -0
  3. package/package.json +8 -8
package/index.d.ts CHANGED
@@ -198,6 +198,9 @@ export declare function generateSsgBarePage(page: JsSsgBarePage): string
198
198
  /** Generates SSG HTML page with navigation and search. */
199
199
  export declare function generateSsgHtml(pageData: JsSsgPageData, navGroups: Array<JsSsgNavGroup>, config: JsSsgConfig): string
200
200
 
201
+ /** Returns unique git authors for a file. Empty when git is missing or fails. */
202
+ export declare function getGitContributors(filePath: string, root?: string | undefined | null): Array<JsGitContributor>
203
+
201
204
  /** Returns the last git commit timestamp for a file in milliseconds. */
202
205
  export declare function getGitLastUpdated(filePath: string, root?: string | undefined | null): number | null
203
206
 
@@ -872,6 +875,26 @@ export interface JsFileTreeOptions {
872
875
  * Default: `false`.
873
876
  */
874
877
  enabled?: boolean
878
+ /**
879
+ * Open directory `<details>` by default.
880
+ *
881
+ * Default: `true`.
882
+ */
883
+ defaultOpen?: boolean
884
+ /**
885
+ * Render folder and file icons.
886
+ *
887
+ * Default: `true`.
888
+ */
889
+ icons?: boolean
890
+ /** Trusted SVG markup or class tokens for collapsed folders. */
891
+ iconFolder?: string
892
+ /** Trusted SVG markup or class tokens for open folders. */
893
+ iconFolderOpen?: string
894
+ /** Trusted SVG markup or class tokens for files. */
895
+ iconFile?: string
896
+ /** Trusted SVG markup or class tokens keyed by file extension. */
897
+ iconFiles?: Record<string, string>
875
898
  }
876
899
 
877
900
  export interface JsFrameworkComponentIsland {
@@ -881,6 +904,16 @@ export interface JsFrameworkComponentIsland {
881
904
  content?: string
882
905
  }
883
906
 
907
+ /** One unique git author returned by `getGitContributors`. */
908
+ export interface JsGitContributor {
909
+ /** Author name from `%an`. */
910
+ name: string
911
+ /** Author email from `%ae`. Never rendered into `href`. */
912
+ email?: string
913
+ /** Number of commits attributed to this author on the file. */
914
+ commits?: number
915
+ }
916
+
884
917
  /** Export graph resolution options. */
885
918
  export interface JsGraphOptions {
886
919
  root?: string
@@ -1039,6 +1072,24 @@ export interface JsIncrementalRenderOptions {
1039
1072
  completeInline?: boolean
1040
1073
  }
1041
1074
 
1075
+ /** Opt-in JSON-LD structured data. Presence of the object enables the feature. */
1076
+ export interface JsJsonLd {
1077
+ /** When false, omit BreadcrumbList even if a visible trail exists. */
1078
+ breadcrumbs?: boolean
1079
+ /** Optional publisher. Missing fields are not invented. */
1080
+ publisher?: JsJsonLdPublisher
1081
+ /** Site origin used for `@id` / `url`. */
1082
+ siteUrl?: string
1083
+ }
1084
+
1085
+ /** Optional JSON-LD publisher. Only configured fields are emitted. */
1086
+ export interface JsJsonLdPublisher {
1087
+ /** Organization name. */
1088
+ name?: string
1089
+ /** Organization URL. Unsafe schemes are dropped. */
1090
+ url?: string
1091
+ }
1092
+
1042
1093
  /** Locale information for the locale switcher. */
1043
1094
  export interface JsLocaleInfo {
1044
1095
  /** BCP 47 locale tag. */
@@ -1425,6 +1476,16 @@ export interface JsSearchRuntimeOptions {
1425
1476
  hotkey: string
1426
1477
  }
1427
1478
 
1479
+ /** One child link on a generated section index. */
1480
+ export interface JsSectionIndexItem {
1481
+ /** Visible title. Escaped in HTML. */
1482
+ title: string
1483
+ /** Destination. `javascript:` and other schemes are rejected. */
1484
+ href: string
1485
+ /** Optional card description. Escaped in HTML. */
1486
+ description?: string
1487
+ }
1488
+
1428
1489
  /** Custom social link for JavaScript. */
1429
1490
  export interface JsSocialLink {
1430
1491
  /** Icon label. */
@@ -1569,6 +1630,16 @@ export interface JsSsgConfig {
1569
1630
  team?: JsTeamOptions
1570
1631
  /** When true, honor per-page frontmatter chrome flags. */
1571
1632
  pageChrome?: boolean
1633
+ /** Opt-in JSON-LD structured data. Presence enables the feature. */
1634
+ jsonLd?: JsJsonLd
1635
+ }
1636
+
1637
+ /** One rendered git author on an SSG page. */
1638
+ export interface JsSsgContributor {
1639
+ /** Display name. Escaped in HTML. */
1640
+ name: string
1641
+ /** Optional `https:` avatar URL. Emails are never accepted here. */
1642
+ avatar?: string
1572
1643
  }
1573
1644
 
1574
1645
  /** Result of SSG shared asset extraction. */
@@ -1637,6 +1708,8 @@ export interface JsSsgPageData {
1637
1708
  toc: Array<TocEntry>
1638
1709
  /** Last updated timestamp in milliseconds since the Unix epoch. */
1639
1710
  lastUpdated?: number
1711
+ /** Unique git authors for this page. Empty unless the site opted in. */
1712
+ contributors?: Array<JsSsgContributor>
1640
1713
  /** URL path. */
1641
1714
  path: string
1642
1715
  /** Entry page configuration (if layout: entry). */
@@ -2186,6 +2259,24 @@ export declare function loadDictionariesFlat(dir: string): Record<string, Record
2186
2259
  /** Returns true when a document belongs to at least one requested search scope. */
2187
2260
  export declare function matchesSearchScopes(id: string, url: string, scopes: Array<string>): boolean
2188
2261
 
2262
+ /** One `import` statement collected from MDX ESM. */
2263
+ export interface MdxImport {
2264
+ /** Module specifier string. */
2265
+ source: string
2266
+ /** Bindings created by the import. */
2267
+ specifiers: Array<MdxImportSpecifier>
2268
+ }
2269
+
2270
+ /** How a specifier was imported. */
2271
+ export interface MdxImportSpecifier {
2272
+ /** Imported name (`default`, `*`, or the named export). */
2273
+ imported: string
2274
+ /** Local binding name. */
2275
+ local: string
2276
+ /** `default`, `named`, or `namespace`. */
2277
+ kind: 'default' | 'named' | 'namespace'
2278
+ }
2279
+
2189
2280
  /** Restores code block metadata after JavaScript-side syntax highlighting. */
2190
2281
  export declare function mergeHighlightedCodeBlocks(originalHtml: string, highlightedHtml: string): string
2191
2282
 
@@ -2288,6 +2379,9 @@ export interface RenderResult {
2288
2379
  errors: Array<string>
2289
2380
  }
2290
2381
 
2382
+ /** Renders escaped section-index listing HTML. Hostile hrefs are dropped. */
2383
+ export declare function renderSsgSectionIndex(title: string, items: Array<JsSectionIndexItem>, style: string): string
2384
+
2291
2385
  /** Resolves manual SSG navigation groups. */
2292
2386
  export declare function resolveSsgNavigationGroups(navigation: Array<JsSsgNavigationGroup>, base: string, extension: string): Array<JsSsgNavGroup>
2293
2387
 
@@ -2354,7 +2448,7 @@ export declare function transformMermaid(html: string, mmdcPath: string): Mermai
2354
2448
  */
2355
2449
  export declare function transformPmEmbeds(html: string, startGroup: number, options?: JsPmOptions | undefined | null): JsPmTransformResult
2356
2450
 
2357
- /** Transform result containing HTML, frontmatter, and TOC. */
2451
+ /** Transform result containing HTML, frontmatter, TOC, and MDX metadata. */
2358
2452
  export interface TransformResult {
2359
2453
  /** The rendered HTML. */
2360
2454
  html: string
@@ -2364,6 +2458,12 @@ export interface TransformResult {
2364
2458
  toc: Array<TocEntry>
2365
2459
  /** Parse/render errors, if any. */
2366
2460
  errors: Array<string>
2461
+ /** MDX `import` statements (empty when MDX is off or no ESM nodes). */
2462
+ imports: Array<MdxImport>
2463
+ /** Export names from MDX ESM (empty when MDX is off or no exports). */
2464
+ exports: Array<string>
2465
+ /** Unique JSX component names in document order (empty when none). */
2466
+ components: Array<string>
2367
2467
  }
2368
2468
 
2369
2469
  /**
package/index.js CHANGED
@@ -218,6 +218,7 @@ module.exports.supportsHighlightLanguage = binding.supportsHighlightLanguage;
218
218
  module.exports.nativeHighlightLanguages = binding.nativeHighlightLanguages;
219
219
  module.exports.generateSsgBarePage = binding.generateSsgBarePage;
220
220
  module.exports.getGitLastUpdated = binding.getGitLastUpdated;
221
+ module.exports.getGitContributors = binding.getGitContributors;
221
222
  module.exports.resolveSsgRoutePaths = binding.resolveSsgRoutePaths;
222
223
  module.exports.getSsgOutputPath = binding.getSsgOutputPath;
223
224
  module.exports.getSsgUrlPath = binding.getSsgUrlPath;
@@ -239,4 +240,5 @@ module.exports.checkI18n = binding.checkI18n;
239
240
  module.exports.checkI18nProject = binding.checkI18nProject;
240
241
  module.exports.extractTranslationKeys = binding.extractTranslationKeys;
241
242
  module.exports.renderFrameworkComponentCode = binding.renderFrameworkComponentCode;
243
+ module.exports.renderSsgSectionIndex = binding.renderSsgSectionIndex;
242
244
  module.exports.escapeSvelteMarkup = binding.escapeSvelteMarkup;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ox-content/napi",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.0-alpha.3",
4
4
  "description": "Node.js bindings for Ox Content - High-performance Markdown parser",
5
5
  "keywords": [
6
6
  "markdown",
@@ -47,12 +47,12 @@
47
47
  ]
48
48
  },
49
49
  "optionalDependencies": {
50
- "@ox-content/binding-darwin-x64": "3.0.0-alpha.1",
51
- "@ox-content/binding-darwin-arm64": "3.0.0-alpha.1",
52
- "@ox-content/binding-linux-x64-gnu": "3.0.0-alpha.1",
53
- "@ox-content/binding-linux-x64-musl": "3.0.0-alpha.1",
54
- "@ox-content/binding-linux-arm64-gnu": "3.0.0-alpha.1",
55
- "@ox-content/binding-linux-arm64-musl": "3.0.0-alpha.1",
56
- "@ox-content/binding-win32-x64-msvc": "3.0.0-alpha.1"
50
+ "@ox-content/binding-darwin-x64": "3.0.0-alpha.3",
51
+ "@ox-content/binding-darwin-arm64": "3.0.0-alpha.3",
52
+ "@ox-content/binding-linux-x64-gnu": "3.0.0-alpha.3",
53
+ "@ox-content/binding-linux-x64-musl": "3.0.0-alpha.3",
54
+ "@ox-content/binding-linux-arm64-gnu": "3.0.0-alpha.3",
55
+ "@ox-content/binding-linux-arm64-musl": "3.0.0-alpha.3",
56
+ "@ox-content/binding-win32-x64-msvc": "3.0.0-alpha.3"
57
57
  }
58
58
  }