@ox-content/vite-plugin 3.0.0-alpha.4 → 3.0.0-alpha.5
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/dist/index.cjs +39 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +97 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +97 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +38 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -4130,6 +4130,22 @@ function stripLocalePrefix(sitePath, locales) {
|
|
|
4130
4130
|
return normalized;
|
|
4131
4131
|
}
|
|
4132
4132
|
//#endregion
|
|
4133
|
+
//#region src/page-head.ts
|
|
4134
|
+
/** Resolve descriptors to escaped `<head>` markup. Build-time only. */
|
|
4135
|
+
function renderHead(input) {
|
|
4136
|
+
return importNapiModuleSync().renderHead(JSON.stringify(input));
|
|
4137
|
+
}
|
|
4138
|
+
function resolveHeadValidation(value) {
|
|
4139
|
+
if (value === "warn" || value === "strict") return value;
|
|
4140
|
+
return false;
|
|
4141
|
+
}
|
|
4142
|
+
function reportHeadDiagnostics(diagnostics, validation) {
|
|
4143
|
+
if (!validation || diagnostics.length === 0) return;
|
|
4144
|
+
const fatal = diagnostics.filter((item) => item.strict);
|
|
4145
|
+
if (validation === "strict" && fatal.length > 0) throw new Error(`[ox-content] ${fatal[0].message}`);
|
|
4146
|
+
if (validation === "warn") for (const item of diagnostics) console.warn(`[ox-content] ${item.message}`);
|
|
4147
|
+
}
|
|
4148
|
+
//#endregion
|
|
4133
4149
|
//#region src/page-context.ts
|
|
4134
4150
|
var page_context_exports = /* @__PURE__ */ __exportAll({
|
|
4135
4151
|
clearRenderContext: () => clearRenderContext,
|
|
@@ -9249,6 +9265,7 @@ function resolveSsgOptions(ssg) {
|
|
|
9249
9265
|
pagination: false,
|
|
9250
9266
|
breadcrumbs: false,
|
|
9251
9267
|
jsonLd: false,
|
|
9268
|
+
headValidation: false,
|
|
9252
9269
|
readerChrome: false,
|
|
9253
9270
|
localeSwitcher: false,
|
|
9254
9271
|
a11y: false,
|
|
@@ -9269,6 +9286,7 @@ function resolveSsgOptions(ssg) {
|
|
|
9269
9286
|
pagination: false,
|
|
9270
9287
|
breadcrumbs: false,
|
|
9271
9288
|
jsonLd: false,
|
|
9289
|
+
headValidation: false,
|
|
9272
9290
|
readerChrome: false,
|
|
9273
9291
|
localeSwitcher: false,
|
|
9274
9292
|
a11y: false,
|
|
@@ -9297,6 +9315,7 @@ function resolveSsgOptions(ssg) {
|
|
|
9297
9315
|
pagination: resolvePaginationOption(ssg.pagination),
|
|
9298
9316
|
breadcrumbs: resolvePaginationOption(ssg.breadcrumbs),
|
|
9299
9317
|
jsonLd: resolveJsonLdOption(ssg.jsonLd),
|
|
9318
|
+
headValidation: resolveHeadValidation(ssg.headValidation),
|
|
9300
9319
|
readerChrome: resolveReaderChromeOption(ssg.readerChrome),
|
|
9301
9320
|
localeSwitcher: resolveLocaleSwitcherOption(ssg.localeSwitcher),
|
|
9302
9321
|
a11y: resolveA11yOption(ssg.a11y),
|
|
@@ -9328,7 +9347,9 @@ function resolveJsonLdOption(value) {
|
|
|
9328
9347
|
const publisher = resolveJsonLdPublisher(value.publisher);
|
|
9329
9348
|
return {
|
|
9330
9349
|
breadcrumbs: value.breadcrumbs !== false,
|
|
9331
|
-
...publisher ? { publisher } : {}
|
|
9350
|
+
...publisher ? { publisher } : {},
|
|
9351
|
+
...value.type ? { type: value.type } : {},
|
|
9352
|
+
...value.graph ? { graph: value.graph } : {}
|
|
9332
9353
|
};
|
|
9333
9354
|
}
|
|
9334
9355
|
return false;
|
|
@@ -9471,7 +9492,7 @@ function localeCodesFor(locales) {
|
|
|
9471
9492
|
async function generateHtmlPage(pageData, navGroups, siteName, base, ogImage, theme, locale, availableLocales, pagination = false, readerChrome = false, breadcrumbs = false, localeSwitcher = false, localePaths, a11y = false, team = {
|
|
9472
9493
|
enabled: false,
|
|
9473
9494
|
members: []
|
|
9474
|
-
}, pageChrome = false, breadcrumbRootHref, jsonLd = false, siteUrl) {
|
|
9495
|
+
}, pageChrome = false, breadcrumbRootHref, jsonLd = false, siteUrl, headValidation = false) {
|
|
9475
9496
|
const mod = await importNapiModule();
|
|
9476
9497
|
const tocForRust = pageData.toc.map(toRustTocEntry);
|
|
9477
9498
|
const navGroupsForRust = convertNavGroupsForRust(navGroups);
|
|
@@ -9507,7 +9528,7 @@ async function generateHtmlPage(pageData, navGroups, siteName, base, ogImage, th
|
|
|
9507
9528
|
linkText: f.linkText
|
|
9508
9529
|
}))
|
|
9509
9530
|
} : void 0;
|
|
9510
|
-
|
|
9531
|
+
const result = mod.generateSsgHtml({
|
|
9511
9532
|
title: pageData.title,
|
|
9512
9533
|
description: pageData.description,
|
|
9513
9534
|
content: pageData.content,
|
|
@@ -9520,12 +9541,16 @@ async function generateHtmlPage(pageData, navGroups, siteName, base, ogImage, th
|
|
|
9520
9541
|
next: pageData.next,
|
|
9521
9542
|
breadcrumbs: pageData.breadcrumbs,
|
|
9522
9543
|
layout: typeof pageData.frontmatter.layout === "string" ? pageData.frontmatter.layout : void 0,
|
|
9523
|
-
chrome: pageData.chrome
|
|
9544
|
+
chrome: pageData.chrome,
|
|
9545
|
+
robots: typeof pageData.frontmatter.robots === "string" ? pageData.frontmatter.robots : void 0,
|
|
9546
|
+
canonical: typeof pageData.frontmatter.canonical === "string" ? pageData.frontmatter.canonical : void 0
|
|
9524
9547
|
}, navGroupsForRust, {
|
|
9525
9548
|
siteName,
|
|
9526
9549
|
base,
|
|
9527
9550
|
breadcrumbRootHref,
|
|
9528
9551
|
ogImage,
|
|
9552
|
+
siteUrl,
|
|
9553
|
+
headValidation: headValidation || void 0,
|
|
9529
9554
|
theme: themeForRust,
|
|
9530
9555
|
locale,
|
|
9531
9556
|
availableLocales: availableLocales ? toRustLocales(availableLocales) : void 0,
|
|
@@ -9544,9 +9569,14 @@ async function generateHtmlPage(pageData, navGroups, siteName, base, ogImage, th
|
|
|
9544
9569
|
jsonLd: jsonLd ? {
|
|
9545
9570
|
breadcrumbs: jsonLd.breadcrumbs,
|
|
9546
9571
|
publisher: jsonLd.publisher,
|
|
9547
|
-
siteUrl
|
|
9572
|
+
siteUrl,
|
|
9573
|
+
pageType: jsonLd.type,
|
|
9574
|
+
graph: jsonLd.graph?.map((node) => JSON.stringify(node))
|
|
9548
9575
|
} : void 0
|
|
9549
9576
|
});
|
|
9577
|
+
const html = typeof result === "string" ? result : result.html;
|
|
9578
|
+
reportHeadDiagnostics(typeof result === "string" ? [] : result.diagnostics ?? [], headValidation);
|
|
9579
|
+
return html;
|
|
9550
9580
|
}
|
|
9551
9581
|
async function externalizeSharedPageAssets(pages, outDir, base) {
|
|
9552
9582
|
const optimized = (await importNapiModule()).externalizeSsgAssets(pages, outDir, base);
|
|
@@ -9989,7 +10019,7 @@ async function renderSsgPage(context, pageResult, collected, allPageResults) {
|
|
|
9989
10019
|
return generateHtmlPage(pageData, navItems, context.siteName, context.base, pageOgImage, theme, locale, i18n ? i18n.locales : void 0, context.ssgOptions.pagination, context.ssgOptions.readerChrome, context.ssgOptions.breadcrumbs, context.ssgOptions.localeSwitcher, localePaths, context.ssgOptions.a11y, context.ssgOptions.team ?? {
|
|
9990
10020
|
enabled: false,
|
|
9991
10021
|
members: []
|
|
9992
|
-
}, context.ssgOptions.pageChrome, versionNavigation?.root.href, context.ssgOptions.jsonLd, context.ssgOptions.siteUrl);
|
|
10022
|
+
}, context.ssgOptions.pageChrome, versionNavigation?.root.href, context.ssgOptions.jsonLd, context.ssgOptions.siteUrl, context.ssgOptions.headValidation);
|
|
9993
10023
|
}
|
|
9994
10024
|
function rewritePagerOverride(pager, context) {
|
|
9995
10025
|
return pager?.href ? {
|
|
@@ -10450,7 +10480,7 @@ async function renderPage$1(filePath, options, navGroups, siteName, base, root,
|
|
|
10450
10480
|
let html = await generateHtmlPage(pageData, localizedNav, siteName, base, options.ssg.ogImage, theme, locale, i18n ? i18n.locales : void 0, options.ssg.pagination, options.ssg.readerChrome, options.ssg.breadcrumbs, options.ssg.localeSwitcher, localePaths, options.ssg.a11y, options.ssg.team ?? {
|
|
10451
10481
|
enabled: false,
|
|
10452
10482
|
members: []
|
|
10453
|
-
}, options.ssg.pageChrome, void 0, options.ssg.jsonLd, options.ssg.siteUrl);
|
|
10483
|
+
}, options.ssg.pageChrome, void 0, options.ssg.jsonLd, options.ssg.siteUrl, options.ssg.headValidation);
|
|
10454
10484
|
html = injectViteHmrClient(html);
|
|
10455
10485
|
return html;
|
|
10456
10486
|
}
|
|
@@ -12989,6 +13019,6 @@ function normalizeRuntimeBase(base) {
|
|
|
12989
13019
|
return withLeading.endsWith("/") ? withLeading : `${withLeading}/`;
|
|
12990
13020
|
}
|
|
12991
13021
|
//#endregion
|
|
12992
|
-
export { DEFAULT_HTML_TEMPLATE, DEFAULT_MARKDOWN_EXTENSIONS, DefaultTheme, DocsTestRunError, Fragment, IncrementalMarkdownParser, IncrementalMarkdownRenderer, PageResourceError, applyIslandSsrHtml, buildCollectionManifest, buildSearchIndex, buildSsg, classifyPublishState, clearRenderContext, collectDocsTests, collectGitHubRepos, collectGitHubSources, collectMdxIslandNamesFromHtml, collectMdxJsxNamesFromAst, collectOgpUrls, convertVitePressNav, convertVitePressSidebar, createFrameworkMarkdownOptions, createI18nPlugin, createIncrementalMarkdownParser, createIncrementalMarkdownRenderer, createMarkdownEnvironment, createTheme, defaultTheme, defineCollection, defineCollections, defineTheme, discoverDocumentMdxIslands, discoverRegisteredMdxComponents, each, escapeSvelteMarkup, extractCodeBlocks, extractDocs, extractDocsTests, extractIslandInfo, extractVideoId, fetchGitHubSource, fetchOgpData, fetchRepoData, fromVitePressConfig, generateCollectionsVirtualModule, generateFrontmatterTypes, generateHydrationScript, generateMarkdown, generateOgImages, generateTabsCSS, generateTypes, generateVirtualModule, generateVitePressMigrationConfig, hasIslands, inferType, intersectHydratableComponentNames, intersectRegisteredComponentNames, isMarkdownFilePath, isMdxFilePath, isRegisteredComponent, jsx, jsxs, lintCodeBlocks, lintMarkdown, lintMarkdownAsync, lintMarkdownFile, lintMarkdownFiles, mergeThemes, mermaidClientScript, normalizeMarkdownExtensions, normalizeVitePressFrontmatter, oxContent, parseGitHubLineRange, parseGitHubPermalink, parsePageChromeFlags, partitionPublishedPages, prefetchGitHubRepos, prefetchGitHubSources, prefetchOgpData, raw, readingTimeMinutes, renderAllPages, renderHtmlToFrameworkCode, renderHtmlToReactComponent, renderHtmlToReactCreateElement, renderHtmlToSvelteComponent, renderHtmlToVueComponent, renderHtmlToVueH, renderIslandComponentImports, renderMarkdownStream, renderPage, renderToString, resolveBadgeOptions, resolveBlogCollectionName, resolveBlogOptions, resolveBuiltinEmbedOptions, resolveCardOptions, resolveCascadeOptions, resolveCollectionsOptions, resolveContentRootPath, resolveDocsOptions, resolveDocumentComponentImports, resolveFeedsOptions, resolveFileTreeOptions, resolveHeaderNavItems, resolveI18nOptions, resolveImageOptions, resolveIncludeOptions, resolveLocaleLabel, resolveMathOptions, resolveMdxForFilePath, resolveNotFoundOptions, resolveOgImageOptions, resolvePageChromeOption, resolvePermalinksOptions, resolvePublishStateOptions, resolvePwaOptions, resolveRedirectsOptions, resolveResourcesOptions, resolveSearchOptions, resolveSectionIndexOptions, resolveSiteMapsOptions, resolveSsgOptions, resolveStepsOptions, resolveTaxonomiesOptions, resolveTeamOptions, resolveTheme, resolveTypedHoverOptions, resolveVersionsOptions, runDocsTests, setRenderContext, shouldLintMarkdownFile, stripMarkdownExtension, stripViteQuery, transformAllPlugins, transformGitHub, transformIslands, transformMarkdown, transformMermaidStatic, transformOgp, transformTabs, transformYouTube, typecheckCodeBlocks, useIsActive, useNav, usePageProps, useRenderContext, useSiteConfig, when, writeDocs, writeDocsTestFiles, writeSearchIndex };
|
|
13022
|
+
export { DEFAULT_HTML_TEMPLATE, DEFAULT_MARKDOWN_EXTENSIONS, DefaultTheme, DocsTestRunError, Fragment, IncrementalMarkdownParser, IncrementalMarkdownRenderer, PageResourceError, applyIslandSsrHtml, buildCollectionManifest, buildSearchIndex, buildSsg, classifyPublishState, clearRenderContext, collectDocsTests, collectGitHubRepos, collectGitHubSources, collectMdxIslandNamesFromHtml, collectMdxJsxNamesFromAst, collectOgpUrls, convertVitePressNav, convertVitePressSidebar, createFrameworkMarkdownOptions, createI18nPlugin, createIncrementalMarkdownParser, createIncrementalMarkdownRenderer, createMarkdownEnvironment, createTheme, defaultTheme, defineCollection, defineCollections, defineTheme, discoverDocumentMdxIslands, discoverRegisteredMdxComponents, each, escapeSvelteMarkup, extractCodeBlocks, extractDocs, extractDocsTests, extractIslandInfo, extractVideoId, fetchGitHubSource, fetchOgpData, fetchRepoData, fromVitePressConfig, generateCollectionsVirtualModule, generateFrontmatterTypes, generateHydrationScript, generateMarkdown, generateOgImages, generateTabsCSS, generateTypes, generateVirtualModule, generateVitePressMigrationConfig, hasIslands, inferType, intersectHydratableComponentNames, intersectRegisteredComponentNames, isMarkdownFilePath, isMdxFilePath, isRegisteredComponent, jsx, jsxs, lintCodeBlocks, lintMarkdown, lintMarkdownAsync, lintMarkdownFile, lintMarkdownFiles, mergeThemes, mermaidClientScript, normalizeMarkdownExtensions, normalizeVitePressFrontmatter, oxContent, parseGitHubLineRange, parseGitHubPermalink, parsePageChromeFlags, partitionPublishedPages, prefetchGitHubRepos, prefetchGitHubSources, prefetchOgpData, raw, readingTimeMinutes, renderAllPages, renderHead, renderHtmlToFrameworkCode, renderHtmlToReactComponent, renderHtmlToReactCreateElement, renderHtmlToSvelteComponent, renderHtmlToVueComponent, renderHtmlToVueH, renderIslandComponentImports, renderMarkdownStream, renderPage, renderToString, resolveBadgeOptions, resolveBlogCollectionName, resolveBlogOptions, resolveBuiltinEmbedOptions, resolveCardOptions, resolveCascadeOptions, resolveCollectionsOptions, resolveContentRootPath, resolveDocsOptions, resolveDocumentComponentImports, resolveFeedsOptions, resolveFileTreeOptions, resolveHeadValidation, resolveHeaderNavItems, resolveI18nOptions, resolveImageOptions, resolveIncludeOptions, resolveLocaleLabel, resolveMathOptions, resolveMdxForFilePath, resolveNotFoundOptions, resolveOgImageOptions, resolvePageChromeOption, resolvePermalinksOptions, resolvePublishStateOptions, resolvePwaOptions, resolveRedirectsOptions, resolveResourcesOptions, resolveSearchOptions, resolveSectionIndexOptions, resolveSiteMapsOptions, resolveSsgOptions, resolveStepsOptions, resolveTaxonomiesOptions, resolveTeamOptions, resolveTheme, resolveTypedHoverOptions, resolveVersionsOptions, runDocsTests, setRenderContext, shouldLintMarkdownFile, stripMarkdownExtension, stripViteQuery, transformAllPlugins, transformGitHub, transformIslands, transformMarkdown, transformMermaidStatic, transformOgp, transformTabs, transformYouTube, typecheckCodeBlocks, useIsActive, useNav, usePageProps, useRenderContext, useSiteConfig, when, writeDocs, writeDocsTestFiles, writeSearchIndex };
|
|
12993
13023
|
|
|
12994
13024
|
//# sourceMappingURL=index.mjs.map
|