@ox-content/vite-plugin 3.0.0-alpha.16 → 3.0.0-alpha.17

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 (46) hide show
  1. package/dist/index.cjs +98 -69
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +3 -5693
  4. package/dist/index.d.cts.map +1 -1
  5. package/dist/index.d.mts +3 -5693
  6. package/dist/index.d.mts.map +1 -1
  7. package/dist/index.mjs +37 -18
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/markdown-tables.d.cts +13 -16
  10. package/dist/markdown-tables.d.cts.map +1 -1
  11. package/dist/markdown-tables.d.mts +13 -16
  12. package/dist/markdown-tables.d.mts.map +1 -1
  13. package/dist/napi.cjs +44 -0
  14. package/dist/napi.cjs.map +1 -0
  15. package/dist/napi.mjs +34 -0
  16. package/dist/napi.mjs.map +1 -0
  17. package/dist/reader-chrome-client.cjs +103 -0
  18. package/dist/reader-chrome-client.d.cts +2 -0
  19. package/dist/reader-chrome-client.d.mts +2 -0
  20. package/dist/reader-chrome-client.mjs +102 -0
  21. package/dist/reader-chrome.cjs +109 -0
  22. package/dist/reader-chrome.cjs.map +1 -0
  23. package/dist/reader-chrome.d.cts +5748 -0
  24. package/dist/reader-chrome.d.cts.map +1 -0
  25. package/dist/reader-chrome.d.mts +5748 -0
  26. package/dist/reader-chrome.d.mts.map +1 -0
  27. package/dist/reader-chrome.mjs +98 -0
  28. package/dist/reader-chrome.mjs.map +1 -0
  29. package/dist/reader-chrome2.d.cts +2 -0
  30. package/dist/reader-chrome2.d.mts +2 -0
  31. package/dist/styles/all.css +1 -0
  32. package/dist/styles/reader-chrome.css +160 -0
  33. package/dist/styles/twitter-full.css +65 -9
  34. package/dist/theme-tokens.d.cts +18 -21
  35. package/dist/theme-tokens.d.cts.map +1 -1
  36. package/dist/theme-tokens.d.mts +18 -21
  37. package/dist/theme-tokens.d.mts.map +1 -1
  38. package/dist/theme-tokens2.d.cts +75 -0
  39. package/dist/theme-tokens2.d.cts.map +1 -0
  40. package/dist/theme-tokens2.d.mts +75 -0
  41. package/dist/theme-tokens2.d.mts.map +1 -0
  42. package/dist/vitepress.cjs +2 -43
  43. package/dist/vitepress.cjs.map +1 -1
  44. package/dist/vitepress.mjs +2 -31
  45. package/dist/vitepress.mjs.map +1 -1
  46. package/package.json +25 -4
package/dist/index.cjs CHANGED
@@ -1,7 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_vitepress = require("./vitepress.cjs");
3
+ const require_napi = require("./napi.cjs");
3
4
  const require_theme_tokens = require("./theme-tokens.cjs");
4
5
  const require_jsx_html = require("./jsx-html.cjs");
6
+ const require_reader_chrome = require("./reader-chrome.cjs");
5
7
  const require_markdown_tables = require("./markdown-tables.cjs");
6
8
  let path = require("path");
7
9
  path = require_vitepress.__toESM(path, 1);
@@ -170,7 +172,7 @@ function normalizeClassName(className) {
170
172
  */
171
173
  function highlightNatively(code, lang) {
172
174
  try {
173
- return require_vitepress.importNapiModuleSync().highlightCodeBlock(code, lang);
175
+ return require_napi.importNapiModuleSync().highlightCodeBlock(code, lang);
174
176
  } catch {
175
177
  return null;
176
178
  }
@@ -183,7 +185,7 @@ function highlightNatively(code, lang) {
183
185
  */
184
186
  async function highlightDocumentNatively(html) {
185
187
  try {
186
- return await require_vitepress.importNapiModuleSync().highlightHtmlCodeBlocksAsync(html);
188
+ return await require_napi.importNapiModuleSync().highlightHtmlCodeBlocksAsync(html);
187
189
  } catch {
188
190
  return null;
189
191
  }
@@ -305,7 +307,7 @@ async function loadNapi() {
305
307
  if (napiLoadAttempted) return napiBindings;
306
308
  napiLoadAttempted = true;
307
309
  try {
308
- const binding = await require_vitepress.importNapiModule();
310
+ const binding = await require_napi.importNapiModule();
309
311
  if (typeof binding.transformMermaid !== "function") {
310
312
  napiBindings = null;
311
313
  return null;
@@ -833,7 +835,7 @@ function transformCrossReferences(html, options) {
833
835
  html,
834
836
  references: []
835
837
  };
836
- const output = require_vitepress.importNapiModuleSync().transformCrossReferences(html, {
838
+ const output = require_napi.importNapiModuleSync().transformCrossReferences(html, {
837
839
  enabled: true,
838
840
  missing: options.missing,
839
841
  duplicates: options.duplicates,
@@ -1432,7 +1434,7 @@ function setTabGroupCounter(value) {
1432
1434
  */
1433
1435
  async function transformTabs(html) {
1434
1436
  if (!/<tabs/i.test(html)) return html;
1435
- const result = (await require_vitepress.importNapiModule()).transformTabsEmbeds(html, tabGroupCounter);
1437
+ const result = (await require_napi.importNapiModule()).transformTabsEmbeds(html, tabGroupCounter);
1436
1438
  tabGroupCounter += result.groupCount;
1437
1439
  return result.html;
1438
1440
  }
@@ -1473,7 +1475,7 @@ function generateTabsCSS(groupCount) {
1473
1475
  */
1474
1476
  async function transformPm(html, options) {
1475
1477
  if (!/<pm[\s/>]/i.test(html)) return html;
1476
- const mod = await require_vitepress.importNapiModule();
1478
+ const mod = await require_napi.importNapiModule();
1477
1479
  const startGroup = getTabGroupCounter();
1478
1480
  const result = mod.transformPmEmbeds(html, startGroup, { sync: options?.sync ?? false });
1479
1481
  setTabGroupCounter(startGroup + result.groupCount);
@@ -1502,14 +1504,14 @@ async function transformPm(html, options) {
1502
1504
  * resolves IDs with the same code.
1503
1505
  */
1504
1506
  function extractVideoId(input) {
1505
- return require_vitepress.importNapiModuleSync().extractYoutubeVideoId(input);
1507
+ return require_napi.importNapiModuleSync().extractYoutubeVideoId(input);
1506
1508
  }
1507
1509
  /**
1508
1510
  * Transform YouTube components in HTML.
1509
1511
  */
1510
1512
  async function transformYouTube(html, options) {
1511
1513
  if (!/<youtube/i.test(html)) return html;
1512
- return (await require_vitepress.importNapiModule()).transformYoutubeEmbeds(html, options);
1514
+ return (await require_napi.importNapiModule()).transformYoutubeEmbeds(html, options);
1513
1515
  }
1514
1516
  //#endregion
1515
1517
  //#region src/plugins/media-marker.ts
@@ -1531,7 +1533,7 @@ const TYPESCRIPT_ONLY_TAGS = ["reddit"];
1531
1533
  let cachedPattern;
1532
1534
  async function markerPattern() {
1533
1535
  if (cachedPattern) return cachedPattern;
1534
- const tags = (await require_vitepress.importNapiModule()).mediaEmbedTags();
1536
+ const tags = (await require_napi.importNapiModule()).mediaEmbedTags();
1535
1537
  const anyCase = [...tags.filter((tag) => !tag.pascalOnly).map((tag) => tag.name), ...TYPESCRIPT_ONLY_TAGS];
1536
1538
  const pascalOnly = tags.filter((tag) => tag.pascalOnly).map((tag) => tag.name);
1537
1539
  const parts = [`(?:<(?:${anyCase.join("|")})[\\s/>])`];
@@ -3965,9 +3967,9 @@ function renderActions(permalink, data) {
3965
3967
  if (!id) return "";
3966
3968
  return [
3967
3969
  "<div class=\"ox-tweet__actions\">",
3968
- `<a class="ox-tweet__action ox-tweet__action--like" href="https://x.com/intent/like?tweet_id=${id}" target="_blank" rel="noopener noreferrer"><span class="ox-tweet__icon ox-tweet__icon--like"></span><span>${formatCount(data.favorite_count) ?? "0"}</span></a>`,
3969
- `<a class="ox-tweet__action ox-tweet__action--reply" href="https://x.com/intent/tweet?in_reply_to=${id}" target="_blank" rel="noopener noreferrer"><span class="ox-tweet__icon ox-tweet__icon--reply"></span>Reply</a>`,
3970
- `<a class="ox-tweet__action ox-tweet__action--copy" href="${escapeAttribute$4(permalink)}" target="_blank" rel="noopener noreferrer" data-ox-tweet-copy data-ox-tweet-copy-url="${escapeAttribute$4(permalink)}" aria-label="Copy link to post"><span class="ox-tweet__icon ox-tweet__icon--copy"></span><span class="ox-tweet__copy-text">Copy link</span><span class="ox-tweet__copied-text">Copied!</span></a>`,
3970
+ `<a class="ox-tweet__action ox-tweet__action--like" href="https://x.com/intent/like?tweet_id=${id}" target="_blank" rel="noopener noreferrer"><span class="ox-tweet__action-icon"><span class="ox-tweet__icon ox-tweet__icon--like"></span></span><span class="ox-tweet__action-text">${formatCount(data.favorite_count) ?? "0"}</span></a>`,
3971
+ `<a class="ox-tweet__action ox-tweet__action--reply" href="https://x.com/intent/tweet?in_reply_to=${id}" target="_blank" rel="noopener noreferrer"><span class="ox-tweet__action-icon"><span class="ox-tweet__icon ox-tweet__icon--reply"></span></span><span class="ox-tweet__action-text">Reply</span></a>`,
3972
+ `<a class="ox-tweet__action ox-tweet__action--copy" href="${escapeAttribute$4(permalink)}" target="_blank" rel="noopener noreferrer" data-ox-tweet-copy data-ox-tweet-copy-url="${escapeAttribute$4(permalink)}" aria-label="Copy link to post"><span class="ox-tweet__action-icon"><span class="ox-tweet__icon ox-tweet__icon--copy"></span></span><span class="ox-tweet__action-text ox-tweet__copy-text">Copy link</span><span class="ox-tweet__action-text ox-tweet__copied-text">Copied!</span></a>`,
3971
3973
  "</div>"
3972
3974
  ].join("");
3973
3975
  }
@@ -4136,7 +4138,7 @@ async function transformMediaEmbeds(html, options) {
4136
4138
  twitch: normalizeProviderVideoOptions(options.twitch)
4137
4139
  });
4138
4140
  if (!hasMediaMarker(result)) return result;
4139
- const transformed = (await require_vitepress.importNapiModule()).transformMediaEmbedsWithDiagnostics(result, {
4141
+ const transformed = (await require_napi.importNapiModule()).transformMediaEmbedsWithDiagnostics(result, {
4140
4142
  spotify: options.spotify,
4141
4143
  appleMusic: options.appleMusic,
4142
4144
  speakerDeck: options.speakerDeck,
@@ -6129,7 +6131,7 @@ function normalizeSelfClosingEmbeds(html) {
6129
6131
  }
6130
6132
  function selfClosingEmbedPattern() {
6131
6133
  if (selfClosingPattern) return selfClosingPattern;
6132
- const registryTags = require_vitepress.importNapiModuleSync().mediaEmbedTags().map((tag) => tag.name);
6134
+ const registryTags = require_napi.importNapiModuleSync().mediaEmbedTags().map((tag) => tag.name);
6133
6135
  const names = [.../* @__PURE__ */ new Set([...TYPESCRIPT_ONLY_EMBED_TAGS, ...registryTags])];
6134
6136
  selfClosingPattern = new RegExp(`<(${names.join("|")})((?:[^>"']|"[^"]*"|'[^']*')*?)\\s*\\/>(?:\\s*<\\/\\1\\s*>)?`, "gi");
6135
6137
  return selfClosingPattern;
@@ -6311,10 +6313,10 @@ function findMatchingElementEnd(html, start, tag) {
6311
6313
  //#region src/code-blocks.ts
6312
6314
  const execFileAsync = (0, node_util.promisify)(node_child_process.execFile);
6313
6315
  async function extractCodeBlocks(source) {
6314
- return (await require_vitepress.importNapiModule()).extractCodeBlocks(source).map(normalizeBlock);
6316
+ return (await require_napi.importNapiModule()).extractCodeBlocks(source).map(normalizeBlock);
6315
6317
  }
6316
6318
  async function lintCodeBlocks(source, options = {}) {
6317
- return (await require_vitepress.importNapiModule()).lintCodeBlocks(source, {
6319
+ return (await require_napi.importNapiModule()).lintCodeBlocks(source, {
6318
6320
  enabled: true,
6319
6321
  languages: options.languages,
6320
6322
  requireLanguage: options.requireLanguage,
@@ -6322,7 +6324,7 @@ async function lintCodeBlocks(source, options = {}) {
6322
6324
  }).map(normalizeDiagnostic);
6323
6325
  }
6324
6326
  async function extractDocsTests(source, options = {}) {
6325
- return (await require_vitepress.importNapiModule()).extractDocsTests(source, {
6327
+ return (await require_napi.importNapiModule()).extractDocsTests(source, {
6326
6328
  enabled: true,
6327
6329
  languages: options.languages,
6328
6330
  requireMeta: options.requireMeta
@@ -6976,7 +6978,7 @@ let napiLoad;
6976
6978
  * @internal
6977
6979
  */
6978
6980
  function loadNapiBindings() {
6979
- napiLoad ??= require_vitepress.importNapiModule().catch((error) => {
6981
+ napiLoad ??= require_napi.importNapiModule().catch((error) => {
6980
6982
  if (process.env.DEBUG) console.debug("[ox-content] NAPI bindings load failed:", error);
6981
6983
  return null;
6982
6984
  });
@@ -7460,7 +7462,7 @@ const DEFAULT_OPENAPI_NAV_BASE_PATH = "/api";
7460
7462
  * ```
7461
7463
  */
7462
7464
  async function extractDocs(srcDirs, options) {
7463
- const napi = await require_vitepress.importNapiModule();
7465
+ const napi = await require_napi.importNapiModule();
7464
7466
  if (options.entryPoints?.length) {
7465
7467
  const extractDocsFromEntryPoints = napi.extractDocsFromEntryPoints;
7466
7468
  if (!extractDocsFromEntryPoints) throw new Error("[ox-content] extractDocsFromEntryPoints is not available from @ox-content/napi.");
@@ -7489,7 +7491,7 @@ async function extractDocs(srcDirs, options) {
7489
7491
  * Generates Markdown documentation from extracted docs.
7490
7492
  */
7491
7493
  function generateMarkdown(docs, options) {
7492
- const napi = require_vitepress.importNapiModuleSync();
7494
+ const napi = require_napi.importNapiModuleSync();
7493
7495
  if (typeof napi.generateDocsMarkdown !== "function") throw new Error("[ox-content] generateDocsMarkdown is not available from @ox-content/napi. Please rebuild the NAPI package.");
7494
7496
  return napi.generateDocsMarkdown(toRustDocsModules(docs), {
7495
7497
  groupBy: options.groupBy,
@@ -7523,7 +7525,7 @@ function generateOpenApiDocs(options, root = process.cwd()) {
7523
7525
  pages: {},
7524
7526
  nav: []
7525
7527
  };
7526
- const generateOpenApiDocs = require_vitepress.importNapiModuleSync().generateOpenApiDocs;
7528
+ const generateOpenApiDocs = require_napi.importNapiModuleSync().generateOpenApiDocs;
7527
7529
  if (typeof generateOpenApiDocs !== "function") throw new Error("[ox-content] generateOpenApiDocs is not available from @ox-content/napi. Please rebuild the NAPI package.");
7528
7530
  return generateOpenApiDocs(options.openapi.src, {
7529
7531
  root,
@@ -7534,7 +7536,7 @@ function generateOpenApiDocs(options, root = process.cwd()) {
7534
7536
  * Writes generated documentation to the output directory.
7535
7537
  */
7536
7538
  async function writeDocs(docs, outDir, extractedDocs, options, extraNav = []) {
7537
- const napi = require_vitepress.importNapiModuleSync();
7539
+ const napi = require_napi.importNapiModuleSync();
7538
7540
  if (typeof napi.writeGeneratedDocs !== "function") throw new Error("[ox-content] writeGeneratedDocs is not available from @ox-content/napi. Please rebuild the NAPI package.");
7539
7541
  let generateNav = options?.generateNav ?? false;
7540
7542
  let docsToWrite = docs;
@@ -9260,7 +9262,7 @@ function stripLocalePrefix(sitePath, locales) {
9260
9262
  //#region src/page-head.ts
9261
9263
  /** Resolve descriptors to escaped `<head>` markup. Build-time only. */
9262
9264
  function renderHead(input) {
9263
- return require_vitepress.importNapiModuleSync().renderHead(JSON.stringify(input));
9265
+ return require_napi.importNapiModuleSync().renderHead(JSON.stringify(input));
9264
9266
  }
9265
9267
  function resolveHeadValidation(value) {
9266
9268
  if (value === "warn" || value === "strict") return value;
@@ -9667,7 +9669,7 @@ function generateSiteMaps(input) {
9667
9669
  if (!input.options?.enabled) return {};
9668
9670
  const warning = siteUrlWarning$1(input.siteUrl);
9669
9671
  if (warning) return { warning };
9670
- return require_vitepress.importNapiModuleSync().generateSiteMapBodies({
9672
+ return require_napi.importNapiModuleSync().generateSiteMapBodies({
9671
9673
  enabled: true,
9672
9674
  siteUrl: input.siteUrl,
9673
9675
  sitemapLoc: input.sitemapLoc ?? "",
@@ -9749,7 +9751,7 @@ function resolveCascadeOptions(value) {
9749
9751
  * on the file-tree URL. Hostile non-string values are ignored.
9750
9752
  */
9751
9753
  function resolvePageRoutes(input) {
9752
- return require_vitepress.importNapiModuleSync().resolveSsgPageRoutes(input.pages.map((page) => ({
9754
+ return require_napi.importNapiModuleSync().resolveSsgPageRoutes(input.pages.map((page) => ({
9753
9755
  source: page.source,
9754
9756
  fileUrl: page.fileUrl,
9755
9757
  frontmatter: page.frontmatter
@@ -9808,7 +9810,7 @@ function resolvePublishStateOptions(value) {
9808
9810
  /** Classifies one frontmatter object. Never throws. */
9809
9811
  function classifyPublishState(frontmatter, options) {
9810
9812
  try {
9811
- return require_vitepress.importNapiModuleSync().classifyPublishState(JSON.stringify(frontmatter ?? {}), toNapiPublishState(options));
9813
+ return require_napi.importNapiModuleSync().classifyPublishState(JSON.stringify(frontmatter ?? {}), toNapiPublishState(options));
9812
9814
  } catch {
9813
9815
  return {
9814
9816
  output: true,
@@ -9994,7 +9996,7 @@ async function buildMarkdownSourceIndex(input) {
9994
9996
  const source = await node_fs_promises.readFile(file, "utf8");
9995
9997
  return {
9996
9998
  source: file,
9997
- fileUrl: require_vitepress.importNapiModuleSync().getSsgUrlPath(file, input.srcDir),
9999
+ fileUrl: require_napi.importNapiModuleSync().getSsgUrlPath(file, input.srcDir),
9998
10000
  frontmatter: parseSourceFrontmatter(source),
9999
10001
  body: source
10000
10002
  };
@@ -10028,7 +10030,7 @@ function resolveMarkdownSourceRequest(pathname, index) {
10028
10030
  }
10029
10031
  /** Frontmatter keys only — not a Markdown parse. */
10030
10032
  function parseSourceFrontmatter(source) {
10031
- return require_vitepress.importNapiModuleSync().prepareSource(source, { frontmatter: true }).frontmatter;
10033
+ return require_napi.importNapiModuleSync().prepareSource(source, { frontmatter: true }).frontmatter;
10032
10034
  }
10033
10035
  function companionRelativePath(urlPath) {
10034
10036
  const trimmed = urlPath === "/" || !urlPath ? "index" : urlPath.replace(/^\/+|\/+$/gu, "");
@@ -10138,7 +10140,7 @@ function remapNavGroups(nav, kept, skippedFileUrls) {
10138
10140
  }
10139
10141
  function routePathsFromUrl(urlPath, srcDir, outDir, base, extension, siteUrl) {
10140
10142
  const relative = urlPath === "/" || !urlPath ? "index.md" : `${urlPath.replace(/^\/+|\/+$/gu, "")}.md`;
10141
- return require_vitepress.importNapiModuleSync().resolveSsgRoutePaths(node_path.join(srcDir, relative), srcDir, outDir, base, extension, siteUrl);
10143
+ return require_napi.importNapiModuleSync().resolveSsgRoutePaths(node_path.join(srcDir, relative), srcDir, outDir, base, extension, siteUrl);
10142
10144
  }
10143
10145
  function remapNavItems(items, byFile, skipped) {
10144
10146
  return items.flatMap((item) => {
@@ -10704,7 +10706,7 @@ function resolveCollectionsOptions(options) {
10704
10706
  }
10705
10707
  async function buildCollectionManifest(root, options) {
10706
10708
  if (!options.collections.enabled) return { collections: {} };
10707
- const { manifest, errors } = applyCollectionRoutes(parseCollectionManifest((await require_vitepress.importNapiModule()).buildCollectionManifest({
10709
+ const { manifest, errors } = applyCollectionRoutes(parseCollectionManifest((await require_napi.importNapiModule()).buildCollectionManifest({
10708
10710
  srcDir: node_path.resolve(root, options.srcDir),
10709
10711
  extensions: [...options.extensions],
10710
10712
  frontmatter: options.frontmatter,
@@ -10834,7 +10836,7 @@ function defaultCollections() {
10834
10836
  * input (#1068). One implementation cannot drift.
10835
10837
  */
10836
10838
  function renderFeedBodies(doc, items, formats, extras, siteUrl) {
10837
- return require_vitepress.importNapiModuleSync().generateFeedBodies({
10839
+ return require_napi.importNapiModuleSync().generateFeedBodies({
10838
10840
  enabled: true,
10839
10841
  siteUrl,
10840
10842
  siteName: doc.siteName,
@@ -10959,7 +10961,7 @@ function feedOutputDirectory(feedPath) {
10959
10961
  * plugin writes and the ones the native SSG writes agree on what a date is.
10960
10962
  */
10961
10963
  function parseDate(value) {
10962
- const parsed = require_vitepress.importNapiModuleSync().parseFeedDate(value);
10964
+ const parsed = require_napi.importNapiModuleSync().parseFeedDate(value);
10963
10965
  if (!parsed) return;
10964
10966
  return {
10965
10967
  unix: parsed.unix,
@@ -12834,7 +12836,7 @@ function escapeSectionIndexHtml(value) {
12834
12836
  /** Renders the listing body. Titles are escaped; hostile hrefs are dropped. */
12835
12837
  function renderSectionIndexHtml(title, items, style) {
12836
12838
  try {
12837
- const napi = require_vitepress.importNapiModuleSync();
12839
+ const napi = require_napi.importNapiModuleSync();
12838
12840
  if (typeof napi.renderSsgSectionIndex === "function") return napi.renderSsgSectionIndex(title, items.map((item) => ({
12839
12841
  title: item.title,
12840
12842
  href: item.href,
@@ -12871,7 +12873,7 @@ function sectionTitle(dir) {
12871
12873
  }
12872
12874
  function formatSectionTitle(name) {
12873
12875
  try {
12874
- return require_vitepress.importNapiModuleSync().formatSsgTitle(name);
12876
+ return require_napi.importNapiModuleSync().formatSsgTitle(name);
12875
12877
  } catch {
12876
12878
  if (!name) return "Untitled";
12877
12879
  return name.charAt(0).toUpperCase() + name.slice(1).replace(/[-_]+/g, " ");
@@ -14382,7 +14384,7 @@ function generateLocalSearchModule(options, indexPath) {
14382
14384
  let oxContent$1 = null;
14383
14385
  async function getOxContent() {
14384
14386
  if (!oxContent$1) try {
14385
- oxContent$1 = await require_vitepress.importNapiModule();
14387
+ oxContent$1 = await require_napi.importNapiModule();
14386
14388
  } catch {
14387
14389
  console.warn("[ox-content] Native bindings not available, search disabled");
14388
14390
  return null;
@@ -16690,7 +16692,7 @@ function parseSsgPagerOverride(value) {
16690
16692
  * Extracts title from content or frontmatter.
16691
16693
  */
16692
16694
  function extractTitle$1(content, frontmatter) {
16693
- return require_vitepress.importNapiModuleSync().extractSsgTitle(content, typeof frontmatter.title === "string" ? frontmatter.title : void 0);
16695
+ return require_napi.importNapiModuleSync().extractSsgTitle(content, typeof frontmatter.title === "string" ? frontmatter.title : void 0);
16694
16696
  }
16695
16697
  /**
16696
16698
  * Generates a bare HTML page carrying head metadata and injected markup.
@@ -16702,7 +16704,7 @@ function extractTitle$1(content, frontmatter) {
16702
16704
  * mode emitted before, which keeps the no-JS size baseline honest.
16703
16705
  */
16704
16706
  function generateBarePage(page) {
16705
- return require_vitepress.importNapiModuleSync().generateSsgBarePage(page);
16707
+ return require_napi.importNapiModuleSync().generateSsgBarePage(page);
16706
16708
  }
16707
16709
  /**
16708
16710
  * Per-build cache for the Rust-facing nav conversion. `navGroups` is the same
@@ -16782,7 +16784,7 @@ async function generateHtmlPage(pageData, navGroups, siteName, base, ogImage, th
16782
16784
  enabled: false,
16783
16785
  members: []
16784
16786
  }, pageChrome = false, breadcrumbRootHref, jsonLd = false, siteUrl, headValidation = false, defaultLocale, iconsEnabled = false) {
16785
- const mod = await require_vitepress.importNapiModule();
16787
+ const mod = await require_napi.importNapiModule();
16786
16788
  const tocForRust = pageData.toc.map(toRustTocEntry);
16787
16789
  const navGroupsForRust = convertNavGroupsForRust(navGroups);
16788
16790
  const themeForRust = theme ? require_vitepress.themeToNapi(theme, locale, base, iconsEnabled) : iconsEnabled ? { embed: require_vitepress.withSelfHostedIconHead(void 0, true, base) } : void 0;
@@ -16873,7 +16875,7 @@ async function generateHtmlPage(pageData, navGroups, siteName, base, ogImage, th
16873
16875
  });
16874
16876
  }
16875
16877
  async function externalizeSharedPageAssets(pages, outDir, base) {
16876
- const optimized = (await require_vitepress.importNapiModule()).externalizeSsgAssets(pages, outDir, base);
16878
+ const optimized = (await require_napi.importNapiModule()).externalizeSsgAssets(pages, outDir, base);
16877
16879
  await Promise.all(optimized.assets.map(async (asset) => {
16878
16880
  await fs_promises.mkdir(path.dirname(asset.outputPath), { recursive: true });
16879
16881
  await fs_promises.writeFile(asset.outputPath, asset.content, "utf-8");
@@ -16887,52 +16889,52 @@ async function externalizeSharedPageAssets(pages, outDir, base) {
16887
16889
  * Converts a markdown file path to a relative URL path.
16888
16890
  */
16889
16891
  function getUrlPath$1(inputPath, srcDir, routePrefix) {
16890
- return applyUrlPrefix(require_vitepress.importNapiModuleSync().getSsgUrlPath(inputPath, srcDir), routePrefix);
16892
+ return applyUrlPrefix(require_napi.importNapiModuleSync().getSsgUrlPath(inputPath, srcDir), routePrefix);
16891
16893
  }
16892
16894
  /**
16893
16895
  * Converts a markdown file path to an href.
16894
16896
  */
16895
16897
  function getHref(inputPath, srcDir, base, extension, routePrefix) {
16896
- return applyHrefPrefix(require_vitepress.importNapiModuleSync().getSsgHref(inputPath, srcDir, base, extension), base, routePrefix);
16898
+ return applyHrefPrefix(require_napi.importNapiModuleSync().getSsgHref(inputPath, srcDir, base, extension), base, routePrefix);
16897
16899
  }
16898
16900
  /**
16899
16901
  * Resolves manual navigation config to the format used by the built-in SSG renderer.
16900
16902
  */
16901
16903
  function resolveNavigationGroups(navigation, base, extension) {
16902
16904
  if (!navigation) return;
16903
- return require_vitepress.importNapiModuleSync().resolveSsgNavigationGroups(navigation, base, extension);
16905
+ return require_napi.importNapiModuleSync().resolveSsgNavigationGroups(navigation, base, extension);
16904
16906
  }
16905
16907
  function getPageLocale(urlPath, i18n) {
16906
16908
  if (!i18n) return void 0;
16907
- return require_vitepress.importNapiModuleSync().getSsgPageLocale(urlPath, i18n.defaultLocale, localeCodesFor(i18n.locales)) ?? void 0;
16909
+ return require_napi.importNapiModuleSync().getSsgPageLocale(urlPath, i18n.defaultLocale, localeCodesFor(i18n.locales)) ?? void 0;
16908
16910
  }
16909
16911
  function getRoutePaths(inputPath, srcDir, outDir, base, extension, siteUrl, routePrefix) {
16910
- return applySsgRoutePrefix(require_vitepress.importNapiModuleSync().resolveSsgRoutePaths(inputPath, srcDir, outDir, base, extension, siteUrl), routePrefix, outDir, base);
16912
+ return applySsgRoutePrefix(require_napi.importNapiModuleSync().resolveSsgRoutePaths(inputPath, srcDir, outDir, base, extension, siteUrl), routePrefix, outDir, base);
16911
16913
  }
16912
16914
  /**
16913
16915
  * Formats a file/dir name as a title.
16914
16916
  */
16915
16917
  function formatTitle(name) {
16916
- return require_vitepress.importNapiModuleSync().formatSsgTitle(name);
16918
+ return require_napi.importNapiModuleSync().formatSsgTitle(name);
16917
16919
  }
16918
16920
  /**
16919
16921
  * Collects all markdown files from the source directory.
16920
16922
  */
16921
16923
  async function collectMarkdownFiles(srcDir, extensions = DEFAULT_MARKDOWN_EXTENSIONS) {
16922
- return require_vitepress.importNapiModuleSync().collectSsgMarkdownFiles(srcDir, [...extensions]);
16924
+ return require_napi.importNapiModuleSync().collectSsgMarkdownFiles(srcDir, [...extensions]);
16923
16925
  }
16924
16926
  /**
16925
16927
  * Builds navigation items from markdown files, grouped by directory.
16926
16928
  */
16927
16929
  function buildNavItems(markdownFiles, srcDir, base, extension) {
16928
- return require_vitepress.importNapiModuleSync().buildSsgNavItems(markdownFiles, srcDir, base, extension);
16930
+ return require_napi.importNapiModuleSync().buildSsgNavItems(markdownFiles, srcDir, base, extension);
16929
16931
  }
16930
16932
  /**
16931
16933
  * Builds navigation items from an explicit theme sidebar tree while retaining
16932
16934
  * locale-map labels for per-page resolution.
16933
16935
  */
16934
16936
  function buildThemeNavItems(sidebar, base, extension) {
16935
- return attachSidebarLabels(require_vitepress.importNapiModuleSync().buildSsgThemeNavItems(resolveSidebarItems(sidebar), base, extension), sidebar);
16937
+ return attachSidebarLabels(require_napi.importNapiModuleSync().buildSsgThemeNavItems(resolveSidebarItems(sidebar), base, extension), sidebar);
16936
16938
  }
16937
16939
  /**
16938
16940
  * Builds all markdown files to static HTML.
@@ -17050,7 +17052,7 @@ async function createBuildSsgContext(options, root, srcDir, outDir, markdownFile
17050
17052
  siteName: await resolveSiteName$1(root, ssgOptions),
17051
17053
  shouldGenerateOgImages: shouldGenerateOgImages(options),
17052
17054
  markdownSourcePages: [],
17053
- napi: ssgOptions.lastUpdated || ssgOptions.contributors || options.siteMaps?.enabled ? await require_vitepress.importNapiModule() : void 0
17055
+ napi: ssgOptions.lastUpdated || ssgOptions.contributors || options.siteMaps?.enabled ? await require_napi.importNapiModule() : void 0
17054
17056
  };
17055
17057
  }
17056
17058
  /**
@@ -17294,26 +17296,29 @@ async function renderSsgPage(context, pageResult, collected, allPageResults) {
17294
17296
  const markdownSource = pageMarkdownSourceHref(context, pageResult);
17295
17297
  if (context.ssgOptions.render) {
17296
17298
  const nav = context.versionNavigation ? rewriteVersionedNavGroups(context.navItems, context.versionNavigation) : context.navItems;
17297
- return applyMarkdownSourceAlternate(context, renderPage(toThemePageData(pageResult, markdownSource), {
17299
+ return applyMarkdownSourceAlternate(context, applyReaderChromeDocument(renderPage(toThemePageData(pageResult, markdownSource), {
17298
17300
  theme: context.ssgOptions.render,
17299
17301
  siteName: context.siteName,
17300
17302
  base: context.base,
17301
17303
  nav,
17302
17304
  pages: allPageResults.map((page) => toThemePageData(page, pageMarkdownSourceHref(context, page)))
17305
+ }), context.ssgOptions.readerChrome), markdownSource);
17306
+ }
17307
+ if (context.ssgOptions.bare) {
17308
+ const content = require_reader_chrome.applyReaderChromeHtml(pageResult.transformedHtml, context.ssgOptions.readerChrome);
17309
+ return applyMarkdownSourceAlternate(context, generateBarePage({
17310
+ title: pageResult.title,
17311
+ content,
17312
+ lang: context.ssgOptions.lang ?? getPageLocale(localeUrlPath(pageResult.routePaths.urlPath, context.ssgOptions.routePrefix), context.options.i18n),
17313
+ description: pageResult.description,
17314
+ canonicalUrl: canonicalPageUrl(context, pageResult.routePaths.urlPath),
17315
+ siteName: context.ssgOptions.siteName,
17316
+ ogImage: pageOgImage,
17317
+ head: appendHtml(context.ssgOptions.head, require_reader_chrome.renderReaderChromeStyleTag(context.ssgOptions.readerChrome)),
17318
+ bodyStart: context.ssgOptions.bodyStart,
17319
+ bodyEnd: appendHtml(context.ssgOptions.bodyEnd, require_reader_chrome.renderReaderChromeScriptTag(context.ssgOptions.readerChrome))
17303
17320
  }), markdownSource);
17304
17321
  }
17305
- if (context.ssgOptions.bare) return applyMarkdownSourceAlternate(context, generateBarePage({
17306
- title: pageResult.title,
17307
- content: pageResult.transformedHtml,
17308
- lang: context.ssgOptions.lang ?? getPageLocale(localeUrlPath(pageResult.routePaths.urlPath, context.ssgOptions.routePrefix), context.options.i18n),
17309
- description: pageResult.description,
17310
- canonicalUrl: canonicalPageUrl(context, pageResult.routePaths.urlPath),
17311
- siteName: context.ssgOptions.siteName,
17312
- ogImage: pageOgImage,
17313
- head: context.ssgOptions.head,
17314
- bodyStart: context.ssgOptions.bodyStart,
17315
- bodyEnd: context.ssgOptions.bodyEnd
17316
- }), markdownSource);
17317
17322
  const pageData = createSsgPageData(pageResult, context.ssgOptions.markdownSource?.copy && pageResult.source != null ? markdownSource : void 0);
17318
17323
  const versionNavigation = context.versionNavigation;
17319
17324
  if (versionNavigation) {
@@ -17367,6 +17372,20 @@ function applyMarkdownSourceAlternate(context, html, href) {
17367
17372
  if (!href || !context.ssgOptions.markdownSource?.alternate) return html;
17368
17373
  return injectMarkdownSourceAlternate(html, href);
17369
17374
  }
17375
+ function applyReaderChromeDocument(html, readerChrome) {
17376
+ if (!readerChrome) return html;
17377
+ return injectBeforeClosingTag(injectBeforeClosingTag(require_reader_chrome.applyReaderChromeHtml(html, readerChrome), "</head>", require_reader_chrome.renderReaderChromeStyleTag(readerChrome)), "</body>", require_reader_chrome.renderReaderChromeScriptTag(readerChrome));
17378
+ }
17379
+ function appendHtml(first, second) {
17380
+ if (!second) return first;
17381
+ return first ? `${first}\n${second}` : second;
17382
+ }
17383
+ function injectBeforeClosingTag(html, closingTag, snippet) {
17384
+ if (!snippet) return html;
17385
+ const index = html.toLowerCase().lastIndexOf(closingTag);
17386
+ if (index === -1) return `${html}\n${snippet}`;
17387
+ return `${html.slice(0, index)}${snippet}\n${html.slice(index)}`;
17388
+ }
17370
17389
  function rewritePagerOverride(pager, context) {
17371
17390
  return pager?.href ? {
17372
17391
  ...pager,
@@ -18383,7 +18402,7 @@ function createI18nPlugin(resolvedOptions) {
18383
18402
  return;
18384
18403
  }
18385
18404
  try {
18386
- const { checkI18nProject } = await require_vitepress.importNapiModule();
18405
+ const { checkI18nProject } = await require_napi.importNapiModule();
18387
18406
  const checkResult = checkI18nProject(dictDir, [path.resolve(root, "src"), path.resolve(root, "content")], i18nOptions.functionNames, i18nOptions.defaultLocale);
18388
18407
  if (checkResult.errorCount > 0 || checkResult.warningCount > 0) {
18389
18408
  for (const diag of checkResult.diagnostics) if (diag.severity === "error") console.error(`[ox-content:i18n] ${diag.message}`);
@@ -18982,7 +19001,7 @@ var IncrementalMarkdownParser = class {
18982
19001
  #includePendingAst;
18983
19002
  #completeInline;
18984
19003
  constructor(options = {}) {
18985
- const napi = require_vitepress.importNapiModuleSync();
19004
+ const napi = require_napi.importNapiModuleSync();
18986
19005
  this.#native = new napi.IncrementalMarkdownParser(toNativeParserOptions(options));
18987
19006
  this.#includePendingAst = options.includePendingAst ?? false;
18988
19007
  this.#completeInline = options.completeInline ?? true;
@@ -19018,7 +19037,7 @@ var IncrementalMarkdownRenderer = class {
19018
19037
  #renderPending;
19019
19038
  #completeInline;
19020
19039
  constructor(options = {}) {
19021
- const napi = require_vitepress.importNapiModuleSync();
19040
+ const napi = require_napi.importNapiModuleSync();
19022
19041
  this.#native = new napi.IncrementalMarkdownRenderer(toNativeParserOptions(options));
19023
19042
  this.#renderPending = options.renderPending ?? true;
19024
19043
  this.#completeInline = options.completeInline ?? true;
@@ -19146,7 +19165,7 @@ function isRegisteredComponent(name, components) {
19146
19165
  }
19147
19166
  async function tryCollectNamesFromParse(source) {
19148
19167
  try {
19149
- const parsed = (await require_vitepress.importNapiModule()).parse(source, {
19168
+ const parsed = (await require_napi.importNapiModule()).parse(source, {
19150
19169
  mdx: true,
19151
19170
  gfm: true
19152
19171
  });
@@ -19640,7 +19659,7 @@ function renderHtmlToVueH(html, islands = []) {
19640
19659
  return renderHtmlToFrameworkCode(html, "vue", "expression", islands);
19641
19660
  }
19642
19661
  function renderHtmlToFrameworkCode(html, target, mode, islands = []) {
19643
- return require_vitepress.importNapiModuleSync().renderFrameworkComponentCode(html, target, toNapiIslands(islands), mode);
19662
+ return require_napi.importNapiModuleSync().renderFrameworkComponentCode(html, target, toNapiIslands(islands), mode);
19644
19663
  }
19645
19664
  function renderHtmlToReactComponent(html, islands = []) {
19646
19665
  return renderHtmlToFrameworkCode(html, "react", "component", islands);
@@ -19652,7 +19671,7 @@ function renderHtmlToSvelteComponent(html) {
19652
19671
  return renderHtmlToFrameworkCode(html, "svelte", "component");
19653
19672
  }
19654
19673
  function escapeSvelteMarkup(html) {
19655
- return require_vitepress.importNapiModuleSync().escapeSvelteMarkup(html);
19674
+ return require_napi.importNapiModuleSync().escapeSvelteMarkup(html);
19656
19675
  }
19657
19676
  function toNapiIslands(islands) {
19658
19677
  return islands.map((island) => ({
@@ -20461,7 +20480,7 @@ function writeMarkdownCompanions(input) {
20461
20480
  function resolveGitLastmod(filePath, root) {
20462
20481
  if (!root) return;
20463
20482
  try {
20464
- const value = require_vitepress.importNapiModuleSync().getGitLastUpdated(filePath, root);
20483
+ const value = require_napi.importNapiModuleSync().getGitLastUpdated(filePath, root);
20465
20484
  return typeof value === "number" && Number.isFinite(value) ? value : void 0;
20466
20485
  } catch {
20467
20486
  return;
@@ -20967,6 +20986,7 @@ exports.IncrementalMarkdownParser = IncrementalMarkdownParser;
20967
20986
  exports.IncrementalMarkdownRenderer = IncrementalMarkdownRenderer;
20968
20987
  exports.PageResourceError = PageResourceError;
20969
20988
  exports.applyIslandSsrHtml = applyIslandSsrHtml;
20989
+ exports.applyReaderChromeHtml = require_reader_chrome.applyReaderChromeHtml;
20970
20990
  exports.buildCollectionManifest = buildCollectionManifest;
20971
20991
  exports.buildSearchIndex = buildSearchIndex;
20972
20992
  exports.buildSsg = buildSsg;
@@ -21047,6 +21067,11 @@ exports.prefetchGitHubRepos = prefetchGitHubRepos;
21047
21067
  exports.prefetchGitHubSources = prefetchGitHubSources;
21048
21068
  exports.prefetchOgpData = prefetchOgpData;
21049
21069
  exports.raw = require_jsx_html.raw;
21070
+ exports.readerChromeAttributes = require_reader_chrome.readerChromeAttributes;
21071
+ exports.readerChromeCss = require_reader_chrome.readerChromeCss;
21072
+ exports.readerChromeIsEnabled = require_reader_chrome.readerChromeIsEnabled;
21073
+ exports.readerChromeNeedsJs = require_reader_chrome.readerChromeNeedsJs;
21074
+ exports.readerChromeScript = require_reader_chrome.readerChromeScript;
21050
21075
  exports.readingTimeMinutes = readingTimeMinutes;
21051
21076
  exports.renderAllPages = renderAllPages;
21052
21077
  exports.renderFeedFiles = renderFeedFiles;
@@ -21061,6 +21086,9 @@ exports.renderIslandComponentImports = renderIslandComponentImports;
21061
21086
  exports.renderMarkdown = renderMarkdown;
21062
21087
  exports.renderMarkdownStream = renderMarkdownStream;
21063
21088
  exports.renderPage = renderPage;
21089
+ exports.renderReaderChromeAttributes = require_reader_chrome.renderReaderChromeAttributes;
21090
+ exports.renderReaderChromeScriptTag = require_reader_chrome.renderReaderChromeScriptTag;
21091
+ exports.renderReaderChromeStyleTag = require_reader_chrome.renderReaderChromeStyleTag;
21064
21092
  exports.renderThemeTokenCss = require_theme_tokens.renderThemeTokenCss;
21065
21093
  exports.renderToString = require_jsx_html.renderToString;
21066
21094
  exports.resolveAbbreviationsOptions = resolveAbbreviationsOptions;
@@ -21101,6 +21129,7 @@ exports.resolvePartialsOptions = resolvePartialsOptions;
21101
21129
  exports.resolvePermalinksOptions = resolvePermalinksOptions;
21102
21130
  exports.resolvePublishStateOptions = resolvePublishStateOptions;
21103
21131
  exports.resolvePwaOptions = resolvePwaOptions;
21132
+ exports.resolveReaderChromeInput = require_reader_chrome.resolveReaderChromeInput;
21104
21133
  exports.resolveRedirectsOptions = resolveRedirectsOptions;
21105
21134
  exports.resolveResourcesOptions = resolveResourcesOptions;
21106
21135
  exports.resolveSearchOptions = resolveSearchOptions;