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

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 +322 -1
  2. package/index.js +1 -0
  3. package/package.json +8 -8
package/index.d.ts CHANGED
@@ -70,7 +70,7 @@ export declare function buildSearchIndex(documents: Array<JsSearchDocument>): st
70
70
  * File discovery, Markdown parsing, search document extraction, and index
71
71
  * construction all run on the Rust side.
72
72
  */
73
- export declare function buildSearchIndexFromDirectory(srcDir: string, base: string, extensions: Array<string>): string
73
+ export declare function buildSearchIndexFromDirectory(srcDir: string, base: string, extensions: Array<string>, options?: JsSearchIndexBuildOptions | undefined | null): string
74
74
 
75
75
  /** Builds SSG navigation groups from markdown files. */
76
76
  export declare function buildSsgNavItems(markdownFiles: Array<string>, srcDir: string, base: string, extension: string): Array<JsSsgNavGroup>
@@ -96,6 +96,9 @@ export declare function checkI18n(dictDir: string, usedKeys: Array<string>): I18
96
96
  */
97
97
  export declare function checkI18nProject(dictDir: string, srcDirs: Array<string>, functionNames: Array<string>, defaultLocale: string): I18NCheckResult
98
98
 
99
+ /** Classifies already-parsed frontmatter JSON against publish-state options. */
100
+ export declare function classifyPublishState(frontmatterJson: string, options?: JsPublishStateOptions | undefined | null): JsPublishDecision
101
+
99
102
  /** Collects source files for generated API documentation. */
100
103
  export declare function collectDocsSourceFiles(srcDir: string, include: Array<string>, exclude: Array<string>): Array<string>
101
104
 
@@ -323,6 +326,12 @@ export interface IncrementalMarkdownRenderResult {
323
326
  errors: Array<string>
324
327
  }
325
328
 
329
+ /** Opt-in skip link and print styles. Presence of the object enables the feature. */
330
+ export interface JsA11y {
331
+ /** Override for the skip-link label. Empty / omitted uses "Skip to content". */
332
+ skipLinkLabel?: string
333
+ }
334
+
326
335
  /** Attribute syntax transform options. */
327
336
  export interface JsAttrsOptions {
328
337
  /**
@@ -333,6 +342,16 @@ export interface JsAttrsOptions {
333
342
  enabled?: boolean
334
343
  }
335
344
 
345
+ /** Opt-in `{badge:variant}` inline badges. */
346
+ export interface JsBadgeOptions {
347
+ /**
348
+ * Enable `{badge:variant}text{/badge}` expansion.
349
+ *
350
+ * Default: `false`.
351
+ */
352
+ enabled?: boolean
353
+ }
354
+
336
355
  export interface JsBuildCollectionManifestOptions {
337
356
  /** Source directory containing Markdown files. */
338
357
  srcDir: string
@@ -346,6 +365,16 @@ export interface JsBuildCollectionManifestOptions {
346
365
  transformOptions?: JsTransformOptions
347
366
  }
348
367
 
368
+ /** Opt-in `::: card` / `::: link-card` / `::: card-grid` blocks. */
369
+ export interface JsCardOptions {
370
+ /**
371
+ * Enable card, link-card, and card-grid containers.
372
+ *
373
+ * Default: `false`.
374
+ */
375
+ enabled?: boolean
376
+ }
377
+
349
378
  /** Extracted fenced code block. */
350
379
  export interface JsCodeBlock {
351
380
  language: string
@@ -420,6 +449,26 @@ export interface JsCollectionDefinition {
420
449
  include: Array<string>
421
450
  }
422
451
 
452
+ /** Opt-in `::: tip` custom containers. */
453
+ export interface JsContainerOptions {
454
+ /**
455
+ * Enable `::: type` containers.
456
+ *
457
+ * Default: `false`.
458
+ */
459
+ enabled?: boolean
460
+ /** Extra or overriding container types. */
461
+ types?: Record<string, JsContainerTypeOptions>
462
+ }
463
+
464
+ /** Custom container transform options. */
465
+ export interface JsContainerTypeOptions {
466
+ /** Title used when the opener does not set one. */
467
+ title?: string
468
+ /** `"details"` renders `<details>`/`<summary>`; anything else is a `<div>`. */
469
+ tag?: string
470
+ }
471
+
423
472
  /** Normalized documentation entry used by generated API docs. */
424
473
  export interface JsDocEntry {
425
474
  name: string
@@ -815,6 +864,16 @@ export interface JsFeatureConfig {
815
864
  linkText?: string
816
865
  }
817
866
 
867
+ /** Opt-in static `file-tree` fences. */
868
+ export interface JsFileTreeOptions {
869
+ /**
870
+ * Enable `file-tree` fences.
871
+ *
872
+ * Default: `false`.
873
+ */
874
+ enabled?: boolean
875
+ }
876
+
818
877
  export interface JsFrameworkComponentIsland {
819
878
  name: string
820
879
  props: Record<string, any>
@@ -830,6 +889,16 @@ export interface JsGraphOptions {
830
889
  externalPackageSources?: Array<JsExternalPackageSource>
831
890
  }
832
891
 
892
+ /** Header nav link or dropdown. */
893
+ export interface JsHeaderNavItem {
894
+ /** Display label. */
895
+ text: string
896
+ /** Link URL. */
897
+ link?: string
898
+ /** Dropdown children. */
899
+ items?: Array<JsHeaderNavItem>
900
+ }
901
+
833
902
  /** Hero action for entry page. */
834
903
  export interface JsHeroAction {
835
904
  /** Button theme: "brand" or "alt". */
@@ -918,6 +987,38 @@ export interface JsI18NRuntimeLocale {
918
987
  dir?: string
919
988
  }
920
989
 
990
+ /** Opt-in figures, captions, and lazy images. */
991
+ export interface JsImageOptions {
992
+ /**
993
+ * Enable figure captions, lazy loading, and safe dimensions.
994
+ *
995
+ * Default: `false`.
996
+ */
997
+ enabled?: boolean
998
+ /**
999
+ * Add `loading="lazy"` to transformed images.
1000
+ *
1001
+ * Default: `true`.
1002
+ */
1003
+ lazy?: boolean
1004
+ }
1005
+
1006
+ /** Markdown file include options. */
1007
+ export interface JsIncludeOptions {
1008
+ /**
1009
+ * Enable `<!-- @include: PATH -->` expansion.
1010
+ *
1011
+ * Default: `false`.
1012
+ */
1013
+ enabled?: boolean
1014
+ /**
1015
+ * Root directory used for `@/` and absolute include paths.
1016
+ *
1017
+ * Default: project root from the JavaScript caller.
1018
+ */
1019
+ rootDir?: string
1020
+ }
1021
+
921
1022
  /** Options for appending to an incremental parser. */
922
1023
  export interface JsIncrementalParseOptions {
923
1024
  /** Treat this append as the final stream chunk. */
@@ -948,6 +1049,16 @@ export interface JsLocaleInfo {
948
1049
  dir: string
949
1050
  }
950
1051
 
1052
+ /** Sibling page or locale-root href for one locale. */
1053
+ export interface JsLocalePath {
1054
+ /** BCP 47 locale tag. */
1055
+ code: string
1056
+ /** Href of the same page in this locale, when that translation exists. */
1057
+ href?: string
1058
+ /** Locale home href used when `href` is missing. */
1059
+ root?: string
1060
+ }
1061
+
951
1062
  export interface JsMarkdownLintDiagnostic {
952
1063
  ruleId: string
953
1064
  severity: string
@@ -975,6 +1086,8 @@ export interface JsMarkdownLintOptions {
975
1086
  languages?: Array<string>
976
1087
  rules?: JsMarkdownLintRuleOptions
977
1088
  dictionary?: JsMarkdownLintDictionaryOptions
1089
+ /** Enable MDX-aware syntax masking while linting visible prose. */
1090
+ mdx?: boolean
978
1091
  }
979
1092
 
980
1093
  export interface JsMarkdownLintResult {
@@ -995,6 +1108,16 @@ export interface JsMarkdownLintRuleOptions {
995
1108
  trailingSpaces?: boolean
996
1109
  }
997
1110
 
1111
+ /** Opt-in `$…$` inline and `$$…$$` block math. */
1112
+ export interface JsMathOptions {
1113
+ /**
1114
+ * Enable `$…$` inline and `$$…$$` block math.
1115
+ *
1116
+ * Default: `false` when the whole option is omitted; `true` when this object is present.
1117
+ */
1118
+ enabled?: boolean
1119
+ }
1120
+
998
1121
  /** Built-in media embed transform switches. */
999
1122
  export interface JsMediaEmbedsOptions {
1000
1123
  /**
@@ -1057,6 +1180,27 @@ export interface JsOgImageData {
1057
1180
  author?: string
1058
1181
  }
1059
1182
 
1183
+ /** Per-page frontmatter chrome flags. */
1184
+ export interface JsPageChromeFlags {
1185
+ sidebar?: boolean
1186
+ outline?: boolean
1187
+ aside?: boolean
1188
+ footer?: boolean
1189
+ navbar?: boolean
1190
+ lastUpdated?: boolean
1191
+ editLink?: boolean
1192
+ }
1193
+
1194
+ /** Frontmatter override for one previous/next pager side. */
1195
+ export interface JsPagerOverride {
1196
+ /** Hide this side when true. */
1197
+ hidden?: boolean
1198
+ /** Replacement title. */
1199
+ text?: string
1200
+ /** Replacement href. */
1201
+ href?: string
1202
+ }
1203
+
1060
1204
  /**
1061
1205
  * Parser options for JavaScript.
1062
1206
  *
@@ -1069,6 +1213,12 @@ export interface JsParserOptions {
1069
1213
  * Default: `false`.
1070
1214
  */
1071
1215
  gfm?: boolean
1216
+ /**
1217
+ * Enable MDX JSX, ESM, and expression nodes.
1218
+ *
1219
+ * Default: `false`.
1220
+ */
1221
+ mdx?: boolean
1072
1222
  /**
1073
1223
  * Enable footnote references and definitions.
1074
1224
  *
@@ -1139,6 +1289,34 @@ export interface JsPublicExport {
1139
1289
  source: JsExportSource
1140
1290
  }
1141
1291
 
1292
+ /** Whether a page should be written and listed. */
1293
+ export interface JsPublishDecision {
1294
+ /** Write HTML for this page. */
1295
+ output: boolean
1296
+ /** Include the page in nav, sitemap, and search. */
1297
+ listed: boolean
1298
+ }
1299
+
1300
+ /** JavaScript publish-state options. */
1301
+ export interface JsPublishStateOptions {
1302
+ /** When false, every page stays published and listed. */
1303
+ enabled?: boolean
1304
+ /** Injected ISO-8601 clock used for scheduled / expiry comparison. */
1305
+ now?: string
1306
+ /** Keep draft and not-yet-scheduled pages visible (dev preview). */
1307
+ includeDrafts?: boolean
1308
+ }
1309
+
1310
+ /** Opt-in reader chrome flags. Presence of the object enables the feature. */
1311
+ export interface JsReaderChrome {
1312
+ /** Copy button on fenced code blocks. */
1313
+ copy?: boolean
1314
+ /** Icon and `rel` on outbound links. */
1315
+ externalLinks?: boolean
1316
+ /** Back-to-top control that appears after scroll. */
1317
+ backToTop?: boolean
1318
+ }
1319
+
1142
1320
  /** Resolved source module. */
1143
1321
  export interface JsResolvedModule {
1144
1322
  path: string
@@ -1197,6 +1375,14 @@ export interface JsSearchDocument {
1197
1375
  code: Array<string>
1198
1376
  }
1199
1377
 
1378
+ /** Optional filters for directory search-index construction. */
1379
+ export interface JsSearchIndexBuildOptions {
1380
+ /** Publish-state filter applied while walking Markdown files. */
1381
+ publishState?: JsPublishStateOptions
1382
+ /** Explicit MDX parser override. When omitted, `.mdx` files enable MDX. */
1383
+ mdx?: boolean
1384
+ }
1385
+
1200
1386
  /** Search options for JavaScript. */
1201
1387
  export interface JsSearchOptions {
1202
1388
  /** Maximum number of results. */
@@ -1357,6 +1543,8 @@ export interface JsSsgConfig {
1357
1543
  siteName: string
1358
1544
  /** Base URL path. */
1359
1545
  base: string
1546
+ /** Optional site-root href for breadcrumbs. */
1547
+ breadcrumbRootHref?: string
1360
1548
  /** OG image URL. */
1361
1549
  ogImage?: string
1362
1550
  /** Theme configuration. */
@@ -1365,6 +1553,22 @@ export interface JsSsgConfig {
1365
1553
  locale?: string
1366
1554
  /** Available locales for locale switcher. */
1367
1555
  availableLocales?: Array<JsLocaleInfo>
1556
+ /** When true, render previous/next page links after the article. */
1557
+ pagination?: boolean
1558
+ /** When true, render a breadcrumb trail above the article. */
1559
+ breadcrumbs?: boolean
1560
+ /** Opt-in copy, external-link, and back-to-top chrome. */
1561
+ readerChrome?: JsReaderChrome
1562
+ /** Opt-in header locale switcher. */
1563
+ localeSwitcher?: boolean
1564
+ /** Existing sibling hrefs and locale roots. */
1565
+ localePaths?: Array<JsLocalePath>
1566
+ /** Opt-in skip link and print styles. Presence enables the feature. */
1567
+ a11y?: JsA11y
1568
+ /** Opt-in team / members page. Omitted stays off. */
1569
+ team?: JsTeamOptions
1570
+ /** When true, honor per-page frontmatter chrome flags. */
1571
+ pageChrome?: boolean
1368
1572
  }
1369
1573
 
1370
1574
  /** Result of SSG shared asset extraction. */
@@ -1437,6 +1641,16 @@ export interface JsSsgPageData {
1437
1641
  path: string
1438
1642
  /** Entry page configuration (if layout: entry). */
1439
1643
  entryPage?: JsEntryPageConfig
1644
+ /** Frontmatter override for the previous-page link. */
1645
+ prev?: JsPagerOverride
1646
+ /** Frontmatter override for the next-page link. */
1647
+ next?: JsPagerOverride
1648
+ /** Frontmatter `breadcrumbs: false` hides the trail on this page. */
1649
+ breadcrumbs?: boolean
1650
+ /** Frontmatter `layout`. `team` renders member cards when the option is on. */
1651
+ layout?: string
1652
+ /** Per-page chrome flags. Honored only when page chrome is enabled. */
1653
+ chrome?: JsPageChromeFlags
1440
1654
  }
1441
1655
 
1442
1656
  /** Resolved SSG output and public route paths. */
@@ -1477,6 +1691,11 @@ export interface JsSsgSidebarItem {
1477
1691
  stickyCollapsed?: boolean
1478
1692
  }
1479
1693
 
1694
+ /** Opt-in `::: steps` wrappers. `enabled` defaults to `false`. */
1695
+ export interface JsStepsOptions {
1696
+ enabled?: boolean
1697
+ }
1698
+
1480
1699
  /** Result of [`super::transform_tabs_embeds`]. */
1481
1700
  export interface JsTabsTransformResult {
1482
1701
  /** HTML with every `<tabs>` block expanded. */
@@ -1488,6 +1707,44 @@ export interface JsTabsTransformResult {
1488
1707
  groupCount: number
1489
1708
  }
1490
1709
 
1710
+ /** One link on a team member card. */
1711
+ export interface JsTeamLink {
1712
+ /** Visible label. */
1713
+ label: string
1714
+ /** Destination URL. */
1715
+ href: string
1716
+ }
1717
+
1718
+ /** One person on the team page. */
1719
+ export interface JsTeamMember {
1720
+ /** Display name. */
1721
+ name: string
1722
+ /** Optional role or title. */
1723
+ role?: string
1724
+ /** Avatar URL. */
1725
+ avatar?: string
1726
+ /** Optional profile or social links. */
1727
+ links?: Array<JsTeamLink>
1728
+ }
1729
+
1730
+ /** Opt-in team / members page. Presence of the object enables the feature. */
1731
+ export interface JsTeamOptions {
1732
+ /** When false, `layout: team` is ignored. */
1733
+ enabled?: boolean
1734
+ /** Members rendered as static cards. */
1735
+ members?: Array<JsTeamMember>
1736
+ }
1737
+
1738
+ /** Announcement bar for JavaScript. */
1739
+ export interface JsThemeAnnouncement {
1740
+ /** Escaped bar text. */
1741
+ text: string
1742
+ /** Optional https or same-origin link. */
1743
+ link?: string
1744
+ /** localStorage key used to persist dismiss. */
1745
+ dismissKey?: string
1746
+ }
1747
+
1491
1748
  /** Theme colors for JavaScript. */
1492
1749
  export interface JsThemeColors {
1493
1750
  /** Primary accent color. */
@@ -1514,6 +1771,12 @@ export interface JsThemeColors {
1514
1771
 
1515
1772
  /** Theme configuration for JavaScript. */
1516
1773
  export interface JsThemeConfig {
1774
+ /** Progressive cross-document transitions for same-origin MPA navigation. */
1775
+ viewTransitions?: boolean
1776
+ /** Right-hand "On this page" outline. Omitted and `false` hide it. */
1777
+ aside?: boolean
1778
+ /** Breadcrumb trail from the site root through sidebar ancestors. */
1779
+ breadcrumbs?: boolean
1517
1780
  /** Light mode colors. */
1518
1781
  colors?: JsThemeColors
1519
1782
  /** Dark mode colors. */
@@ -1526,6 +1789,10 @@ export interface JsThemeConfig {
1526
1789
  layout?: JsThemeLayout
1527
1790
  /** Header configuration. */
1528
1791
  header?: JsThemeHeader
1792
+ /** Opt-in header nav items. */
1793
+ nav?: Array<JsHeaderNavItem>
1794
+ /** Opt-in announcement bar. */
1795
+ announcement?: JsThemeAnnouncement
1529
1796
  /** Footer configuration. */
1530
1797
  footer?: JsThemeFooter
1531
1798
  /** Social links configuration. */
@@ -1621,6 +1888,12 @@ export interface JsTransformOptions {
1621
1888
  * Default: `false`.
1622
1889
  */
1623
1890
  gfm?: boolean
1891
+ /**
1892
+ * Enable MDX JSX, ESM, and expression nodes.
1893
+ *
1894
+ * Default: `false`.
1895
+ */
1896
+ mdx?: boolean
1624
1897
  /**
1625
1898
  * Enable footnote references and definitions.
1626
1899
  *
@@ -1782,6 +2055,54 @@ export interface JsTransformOptions {
1782
2055
  * Default: disabled.
1783
2056
  */
1784
2057
  editThisPage?: JsEditThisPageOptions
2058
+ /**
2059
+ * Opt-in `::: tip` custom containers.
2060
+ *
2061
+ * Default: disabled.
2062
+ */
2063
+ containers?: JsContainerOptions
2064
+ /**
2065
+ * Opt-in Markdown file includes via `<!-- @include: PATH -->`.
2066
+ *
2067
+ * Default: disabled.
2068
+ */
2069
+ includes?: JsIncludeOptions
2070
+ /**
2071
+ * Opt-in `::: steps` ordered lists.
2072
+ *
2073
+ * Default: disabled.
2074
+ */
2075
+ steps?: JsStepsOptions
2076
+ /**
2077
+ * Opt-in `{badge:variant}` inline badges.
2078
+ *
2079
+ * Default: disabled.
2080
+ */
2081
+ badges?: JsBadgeOptions
2082
+ /**
2083
+ * Opt-in figures, captions, and lazy images.
2084
+ *
2085
+ * Default: disabled.
2086
+ */
2087
+ images?: JsImageOptions
2088
+ /**
2089
+ * Opt-in `::: card` / `::: link-card` / `::: card-grid` blocks.
2090
+ *
2091
+ * Default: disabled.
2092
+ */
2093
+ cards?: JsCardOptions
2094
+ /**
2095
+ * Opt-in `$…$` inline and `$$…$$` block math.
2096
+ *
2097
+ * Default: disabled.
2098
+ */
2099
+ math?: boolean | JsMathOptions
2100
+ /**
2101
+ * Opt-in static `file-tree` fences.
2102
+ *
2103
+ * Default: disabled.
2104
+ */
2105
+ fileTree?: JsFileTreeOptions
1785
2106
  }
1786
2107
 
1787
2108
  /** Type parameter documentation (`<T extends C = D>`) used by generated API docs. */
package/index.js CHANGED
@@ -197,6 +197,7 @@ module.exports.mergeHighlightedCodeBlocks = binding.mergeHighlightedCodeBlocks;
197
197
  module.exports.generateOgImageSvg = binding.generateOgImageSvg;
198
198
  module.exports.buildSearchIndex = binding.buildSearchIndex;
199
199
  module.exports.buildSearchIndexFromDirectory = binding.buildSearchIndexFromDirectory;
200
+ module.exports.classifyPublishState = binding.classifyPublishState;
200
201
  module.exports.writeSearchIndex = binding.writeSearchIndex;
201
202
  module.exports.searchIndex = binding.searchIndex;
202
203
  module.exports.extractSearchContent = binding.extractSearchContent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ox-content/napi",
3
- "version": "2.90.0",
3
+ "version": "3.0.0-alpha.1",
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": "2.90.0",
51
- "@ox-content/binding-darwin-arm64": "2.90.0",
52
- "@ox-content/binding-linux-x64-gnu": "2.90.0",
53
- "@ox-content/binding-linux-x64-musl": "2.90.0",
54
- "@ox-content/binding-linux-arm64-gnu": "2.90.0",
55
- "@ox-content/binding-linux-arm64-musl": "2.90.0",
56
- "@ox-content/binding-win32-x64-msvc": "2.90.0"
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"
57
57
  }
58
58
  }