@rspress/core 2.0.16 → 2.0.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.
- package/bin/rspress.js +6 -1
- package/dist/0~execa.js +1 -1
- package/dist/{9882.js → 102.js} +1 -1
- package/dist/{9958.js → 7448.js} +1 -1
- package/dist/{5580.js → 8629.js} +2455 -6
- package/dist/cli/index.d.ts +8 -1
- package/dist/cli/index.js +105 -102
- package/dist/config/loadConfigFile.js +1 -1
- package/dist/eject-theme/components/Link/index.tsx +1 -1
- package/dist/eject-theme/components/Link/useLinkNavigate.ts +17 -4
- package/dist/eject-theme/components/SocialLinks/GithubStars.test.tsx +48 -0
- package/dist/eject-theme/components/SocialLinks/GithubStars.tsx +35 -20
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/node/PluginDriver.js +1 -1
- package/dist/node/auto-nav-sidebar/index.js +1 -1
- package/dist/node/auto-nav-sidebar/locales.js +1 -1
- package/dist/node/auto-nav-sidebar/normalize.js +2 -2
- package/dist/node/auto-nav-sidebar/utils.js +1 -1
- package/dist/node/auto-nav-sidebar/walk.js +1 -1
- package/dist/node/constants.js +1 -1
- package/dist/node/eject.js +2 -2
- package/dist/node/initRsbuild.js +5 -5
- package/dist/node/logger/hint.js +1 -1
- package/dist/node/mdx/options.js +1 -1
- package/dist/node/mdx/processor.js +1 -1
- package/dist/node/mdx/rehypePlugins/codeMeta.js +1 -1
- package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -1
- package/dist/node/mdx/rehypePlugins/shiki.js +1 -1
- package/dist/node/mdx/remarkPlugins/builtin.js +1 -1
- package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +2 -2
- package/dist/node/mdx/remarkPlugins/image.js +2 -2
- package/dist/node/mdx/remarkPlugins/link.js +2 -2
- package/dist/node/mdx/remarkPlugins/toc.js +1 -1
- package/dist/node/medium-zoom/index.js +1 -1
- package/dist/node/route/RoutePage.js +1 -1
- package/dist/node/route/RouteService.js +1 -1
- package/dist/node/route/extractPageData.js +1 -1
- package/dist/node/route/normalizeRoutePath.js +1 -1
- package/dist/node/runtimeModule/i18n.js +3 -3
- package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
- package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
- package/dist/node/runtimeModule/searchHooks.js +1 -1
- package/dist/node/runtimeModule/siteData/createSiteData.js +6 -2
- package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +1 -1
- package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +1 -1
- package/dist/node/serve.js +1 -1
- package/dist/node/ssg/htmlFile.js +1 -1
- package/dist/node/ssg/renderPage.js +2 -2
- package/dist/node/ssg/renderPageWorker.js +2 -2
- package/dist/node/ssg/renderPages.js +3 -3
- package/dist/node/ssg/rsbuildPluginSSG.js +1 -1
- package/dist/node/ssg/ssgEnv.js +1 -1
- package/dist/node/ssg-md/llms/emitLlmsTxt.js +3 -3
- package/dist/node/ssg-md/llms/llmsTxt.d.ts +3 -3
- package/dist/node/ssg-md/llms/llmsTxt.js +8 -8
- package/dist/node/ssg-md/remarkSplitMdx.js +1 -1
- package/dist/node/ssg-md/renderPage.js +2 -2
- package/dist/node/ssg-md/renderPages.js +3 -3
- package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
- package/dist/node/utils/checkLanguageParity.js +1 -1
- package/dist/node/utils/createHash.js +1 -1
- package/dist/node/utils/error.js +1 -1
- package/dist/node/utils/flattenMdxContent.js +1 -1
- package/dist/node/utils/fs.js +1 -1
- package/dist/node/utils/getPageKey.js +1 -1
- package/dist/node/utils/normalizePath.js +1 -1
- package/dist/node/utils/reactAlias.js +2 -2
- package/dist/runtime/ClientApp.js +3 -2
- package/dist/runtime/route.js +2 -0
- package/dist/theme/components/DocContent/docComponents/index.d.ts +25 -18
- package/dist/theme/components/Link/index.d.ts +1 -1
- package/dist/theme/components/Link/useLinkNavigate.d.ts +1 -1
- package/dist/theme/components/Link/useLinkNavigate.js +13 -5
- package/dist/theme/components/Search/SearchPanel.js +8 -8
- package/dist/theme/components/SocialLinks/GithubStars.js +27 -17
- package/dist/theme/logic/getCopyableText.js +1 -0
- package/package.json +9 -9
- package/dist/6010.js +0 -2461
- package/dist/{0~8787.js → 0~8016.js} +0 -0
- package/dist/{7986.js → 4538.js} +0 -0
- package/dist/{3358.js → 5357.js} +0 -0
- package/dist/{8005.js → 7748.js} +2 -2
- /package/dist/{5580.js.LICENSE.txt → 8629.js.LICENSE.txt} +0 -0
- /package/dist/{6646.js → 9857.js} +0 -0
- /package/dist/{9283.js → 9940.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { transformerAddLang, transformerAddLineNumbers, transformerAddTitle, transformerAddFold, createCssVariablesTheme, transformerAddWrapCode } from "../../../
|
|
1
|
+
import { transformerAddLang, transformerAddLineNumbers, transformerAddTitle, transformerAddFold, createCssVariablesTheme, transformerAddWrapCode } from "../../../9940.js";
|
|
2
2
|
const cssVariablesTheme = createCssVariablesTheme({
|
|
3
3
|
name: 'css-variables',
|
|
4
4
|
variablePrefix: '--shiki-',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { node_path } from "../../../
|
|
1
|
+
import { node_path } from "../../../9940.js";
|
|
2
2
|
import { getDefaultImportAstNode } from "../../utils/getImportAstNode.js";
|
|
3
3
|
const remarkBuiltin = ({ globalComponents })=>(tree)=>{
|
|
4
4
|
const demos = globalComponents.map((componentPath)=>{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __webpack_require__ } from "../../../0~rslib-runtime.js";
|
|
2
|
-
import "../../../
|
|
3
|
-
import { visit, node_path, logger, cwd, readFile } from "../../../
|
|
2
|
+
import "../../../4538.js";
|
|
3
|
+
import { visit, node_path, logger, cwd, readFile } from "../../../5357.js";
|
|
4
4
|
import { createError } from "../../utils/error.js";
|
|
5
5
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
6
6
|
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __webpack_require__ } from "../../../0~rslib-runtime.js";
|
|
2
|
-
import "../../../
|
|
3
|
-
import { visit, node_path, logger, isDataUrl, existsSync, getNodeAttribute, isExternalUrl, isProduction, parseUrl } from "../../../
|
|
2
|
+
import "../../../4538.js";
|
|
3
|
+
import { visit, node_path, logger, isDataUrl, existsSync, getNodeAttribute, isExternalUrl, isProduction, parseUrl } from "../../../5357.js";
|
|
4
4
|
import { createError } from "../../utils/error.js";
|
|
5
5
|
import { getDefaultImportAstNode } from "../../utils/getImportAstNode.js";
|
|
6
6
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __webpack_require__ } from "../../../0~rslib-runtime.js";
|
|
2
|
-
import "../../../
|
|
3
|
-
import { normalizeHref, node_path, addLeadingSlash, logger, visit, isExternalUrl, isProduction, parseUrl, MDX_OR_MD_REGEXP, withBase } from "../../../
|
|
2
|
+
import "../../../4538.js";
|
|
3
|
+
import { normalizeHref, node_path, addLeadingSlash, logger, visit, isExternalUrl, isProduction, parseUrl, MDX_OR_MD_REGEXP, withBase } from "../../../5357.js";
|
|
4
4
|
import { hintRelativeMarkdownLink } from "../../logger/hint.js";
|
|
5
5
|
import { createError } from "../../utils/error.js";
|
|
6
6
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { visitChildren, extractTextAndId, github_slugger, slug } from "../../../
|
|
1
|
+
import { visitChildren, extractTextAndId, github_slugger, slug } from "../../../7748.js";
|
|
2
2
|
const extractChildText = (child, preserveInlineMarkdown = true)=>{
|
|
3
3
|
if ('link' === child.type) return child.children?.map((child)=>extractChildText(child, preserveInlineMarkdown)).join('') ?? '';
|
|
4
4
|
if ('strong' === child.type) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RSPRESS_TEMP_DIR, node_path, removeTrailingSlash, promises, addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, glob } from "../../
|
|
1
|
+
import { RSPRESS_TEMP_DIR, node_path, removeTrailingSlash, promises, addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, glob } from "../../8629.js";
|
|
2
2
|
import { RoutePage, absolutePathToRoutePath, absolutePathToRelativePath } from "./RoutePage.js";
|
|
3
3
|
import { createError } from "../utils/error.js";
|
|
4
4
|
import { getRoutePathParts, normalizeRoutePath, splitRoutePathParts } from "./normalizeRoutePath.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unified, node_path, promises, loadFrontMatter, remove, remark_gfm, MDX_OR_MD_REGEXP, remark_parse } from "../../
|
|
1
|
+
import { unified, node_path, promises, loadFrontMatter, remove, remark_gfm, MDX_OR_MD_REGEXP, remark_parse } from "../../8629.js";
|
|
2
2
|
import { applyReplaceRules } from "../utils/applyReplaceRules.js";
|
|
3
3
|
import { flattenMdxContent } from "../utils/flattenMdxContent.js";
|
|
4
4
|
import { importStatementRegex } from "../constants.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, addLeadingSlash } from "../../
|
|
1
|
+
import { addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, addLeadingSlash } from "../../8629.js";
|
|
2
2
|
const getRoutePathParts = (relativePath, lang, version, langs, versions)=>{
|
|
3
3
|
const [versionPart, langPart, purePath] = splitRoutePathParts(relativePath, lang, version, langs, versions);
|
|
4
4
|
return [
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { __webpack_require__ } from "../../0~rslib-runtime.js";
|
|
2
|
-
import "../../
|
|
3
|
-
import {
|
|
2
|
+
import "../../4538.js";
|
|
3
|
+
import { createRequire, join, logger } from "../../8629.js";
|
|
4
4
|
import { DEFAULT_I18N_TEXT } from "./DEFAULT_I18N_TEXT.js";
|
|
5
5
|
import { createError } from "../utils/error.js";
|
|
6
6
|
import { pathExists } from "../utils/fs.js";
|
|
7
7
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
8
8
|
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
9
|
-
const i18n_require =
|
|
9
|
+
const i18n_require = createRequire(import.meta.url);
|
|
10
10
|
const DEFAULT_I18N_SOURCE_PATH = join(process.cwd(), 'i18n.json');
|
|
11
11
|
function mergeI18nData(...sources) {
|
|
12
12
|
const result = {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SEARCH_INDEX_NAME, groupBy } from "../../../
|
|
1
|
+
import { SEARCH_INDEX_NAME, groupBy } from "../../../8629.js";
|
|
2
2
|
import { extractPageData } from "../../route/extractPageData.js";
|
|
3
3
|
import { createHash } from "../../utils/createHash.js";
|
|
4
4
|
function deletePrivateField(obj) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { logger, pluginVirtualModule } from "../../../
|
|
1
|
+
import { logger, pluginVirtualModule } from "../../../8629.js";
|
|
2
2
|
import { createPageData } from "./createPageData.js";
|
|
3
3
|
const rsbuildPluginDocVM = async ({ config, userDocRoot, routeService, pluginDriver })=>{
|
|
4
4
|
const ref = {
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { getIconUrlPath } from "../../../
|
|
1
|
+
import { getIconUrlPath } from "../../../8629.js";
|
|
2
2
|
import { normalizeThemeConfig } from "./normalizeThemeConfig.js";
|
|
3
3
|
async function createSiteData(userConfig) {
|
|
4
4
|
const tempSearchObj = Object.assign({}, userConfig.search);
|
|
5
5
|
if (tempSearchObj) tempSearchObj.searchHooks = void 0;
|
|
6
6
|
const siteData = {
|
|
7
7
|
base: userConfig.base ?? '/',
|
|
8
|
+
siteOrigin: userConfig.siteOrigin ?? '',
|
|
8
9
|
title: userConfig?.title || '',
|
|
9
10
|
description: userConfig?.description || '',
|
|
10
11
|
icon: getIconUrlPath(userConfig?.icon) || '',
|
|
11
|
-
route:
|
|
12
|
+
route: {
|
|
13
|
+
useTransitions: true,
|
|
14
|
+
...userConfig?.route
|
|
15
|
+
},
|
|
12
16
|
themeConfig: await normalizeThemeConfig(userConfig),
|
|
13
17
|
lang: userConfig?.lang || '',
|
|
14
18
|
locales: userConfig?.locales || userConfig.themeConfig?.locales || [],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isExternalUrl, slash, addLeadingSlash, normalizeHref } from "../../../
|
|
1
|
+
import { isExternalUrl, slash, addLeadingSlash, normalizeHref } from "../../../8629.js";
|
|
2
2
|
import { getI18nData } from "../i18n.js";
|
|
3
3
|
import { applyReplaceRules } from "../../utils/applyReplaceRules.js";
|
|
4
4
|
async function normalizeThemeConfig(docConfig) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isProduction, logger } from "../../../
|
|
1
|
+
import { isProduction, logger } from "../../../8629.js";
|
|
2
2
|
import { modifyConfigWithAutoNavSide } from "../../auto-nav-sidebar/index.js";
|
|
3
3
|
import { createSiteData } from "./createSiteData.js";
|
|
4
4
|
const siteDataVMPlugin = (context)=>{
|
package/dist/node/serve.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { external_node_path_resolve, relative, isAbsolute } from "../../
|
|
1
|
+
import { external_node_path_resolve, relative, isAbsolute } from "../../7448.js";
|
|
2
2
|
const routePath2HtmlFileName = (routePath)=>{
|
|
3
3
|
let fileName = routePath;
|
|
4
4
|
fileName = fileName.endsWith('/') ? `${routePath}index.html` : `${routePath}.html`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __webpack_require__ } from "../../0~rslib-runtime.js";
|
|
2
|
-
import "../../
|
|
3
|
-
import { createHead, logger, transformHtmlTemplate, pathToFileURL } from "../../
|
|
2
|
+
import "../../4538.js";
|
|
3
|
+
import { createHead, logger, transformHtmlTemplate, pathToFileURL } from "../../7448.js";
|
|
4
4
|
import { hintSSGFailed } from "../logger/hint.js";
|
|
5
5
|
import { renderHtmlTemplate } from "./renderHtmlTemplate.js";
|
|
6
6
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { writeFile, mkdir, dirname, workerData } from "../../
|
|
1
|
+
import { writeFile, mkdir, dirname, workerData } from "../../9857.js";
|
|
2
2
|
import { createError } from "../utils/error.js";
|
|
3
3
|
import { resolveHtmlFilePath } from "./htmlFile.js";
|
|
4
|
-
import { pMap } from "../../
|
|
4
|
+
import { pMap } from "../../7448.js";
|
|
5
5
|
import { renderPage } from "./renderPage.js";
|
|
6
6
|
const params = workerData?.[1]?.params;
|
|
7
7
|
if (!params) throw createError('SSG Worker Thread workerData params missing');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*! LICENSE: renderPages.js.LICENSE.txt */
|
|
2
2
|
import { __webpack_require__ } from "../../0~rslib-runtime.js";
|
|
3
|
-
import "../../
|
|
4
|
-
import { chunk, logger } from "../../
|
|
3
|
+
import "../../4538.js";
|
|
4
|
+
import { chunk, logger } from "../../8629.js";
|
|
5
5
|
import { SSGWorkerThreadTaskSize, getNumberOfThreads, SSGWorkerThreadRecyclerMaxMemory, SSGConcurrency } from "./ssgEnv.js";
|
|
6
6
|
import { routePath2HtmlFileName } from "./htmlFile.js";
|
|
7
|
-
import { pMap } from "../../
|
|
7
|
+
import { pMap } from "../../7448.js";
|
|
8
8
|
import { renderPage } from "./renderPage.js";
|
|
9
9
|
import { hintSSGFailed } from "../logger/hint.js";
|
|
10
10
|
import { renderHtmlTemplate } from "./renderHtmlTemplate.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { logger, writeFile, mkdir, rm, join, isDebugMode } from "../../
|
|
1
|
+
import { logger, writeFile, mkdir, rm, join, isDebugMode } from "../../8629.js";
|
|
2
2
|
import { NODE_SSG_BUNDLE_FOLDER, NODE_SSG_BUNDLE_NAME } from "../constants.js";
|
|
3
3
|
import { renderPages } from "./renderPages.js";
|
|
4
4
|
const rsbuildPluginSSG = ({ routeService, config })=>({
|
package/dist/node/ssg/ssgEnv.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! LICENSE: ssgEnv.js.LICENSE.txt */
|
|
2
|
-
import { node_os } from "../../
|
|
2
|
+
import { node_os } from "../../8629.js";
|
|
3
3
|
/**
|
|
4
4
|
* these codes are copied from
|
|
5
5
|
* @link https://github.com/facebook/docusaurus/blob/45065e8d2b5831117b8d69fec1be28f5520cf105/packages/docusaurus/src/ssg/ssgEnv.ts#L11
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { matchPath, getSidebarDataGroup } from "../../../
|
|
1
|
+
import { matchPath, getSidebarDataGroup } from "../../../8629.js";
|
|
2
2
|
import { generateLlmsTxt, generateLlmsFullTxt } from "./llmsTxt.js";
|
|
3
3
|
async function emitLlmsTxt(config, routeService, emitAsset, mdContents) {
|
|
4
4
|
const base = config.base ?? '/';
|
|
@@ -56,8 +56,8 @@ async function emitLlmsTxt(config, routeService, emitAsset, mdContents) {
|
|
|
56
56
|
others.push(routePath);
|
|
57
57
|
});
|
|
58
58
|
for (const routeGroup of routeGroups)organizeBySidebar(sidebar, routeGroup);
|
|
59
|
-
const llmsTxtContent = await generateLlmsTxt(routeGroups, others, navList, config.title, config.description, config.base, routeService);
|
|
60
|
-
const llmsFullTxtContent = generateLlmsFullTxt(routeGroups, navList, others, base, mdContents);
|
|
59
|
+
const llmsTxtContent = await generateLlmsTxt(routeGroups, others, navList, config.title, config.description, config.base, config.siteOrigin, routeService);
|
|
60
|
+
const llmsFullTxtContent = generateLlmsFullTxt(routeGroups, navList, others, base, config.siteOrigin, mdContents);
|
|
61
61
|
const langPrefix = defaultLang === lang ? '' : `${lang}/`;
|
|
62
62
|
const versionPrefix = isMultiVersion && version !== defaultVersion ? `${version}/` : '';
|
|
63
63
|
const prefix = `${versionPrefix}${langPrefix}`;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type NavItemWithLink } from '@rspress/shared';
|
|
2
2
|
import type { RouteService } from '../../route/RouteService.js';
|
|
3
|
-
declare function routePathToMdPath(routePath: string, base: string): string;
|
|
3
|
+
declare function routePathToMdPath(routePath: string, base: string, siteOrigin?: string): string;
|
|
4
4
|
declare function generateLlmsTxt(routeGroups: string[][], others: string[], navList: {
|
|
5
5
|
text: string;
|
|
6
|
-
}[], title: string | undefined, description: string | undefined, base: string, routeService: RouteService): Promise<string>;
|
|
6
|
+
}[], title: string | undefined, description: string | undefined, base: string, siteOrigin: string | undefined, routeService: RouteService): Promise<string>;
|
|
7
7
|
declare function generateLlmsFullTxt(routeGroups: string[][], navList: (NavItemWithLink & {
|
|
8
8
|
lang: string;
|
|
9
|
-
})[], others: string[], base: string, mdContents: Map<string, string>): string;
|
|
9
|
+
})[], others: string[], base: string, siteOrigin: string | undefined, mdContents: Map<string, string>): string;
|
|
10
10
|
export { generateLlmsFullTxt, generateLlmsTxt, routePathToMdPath };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { normalizeHref, logger, withBase } from "../../../
|
|
1
|
+
import { normalizeHref, withSiteOrigin, logger, withBase } from "../../../8629.js";
|
|
2
2
|
import { extractInfoFromFrontmatterWithAbsolutePath } from "../../auto-nav-sidebar/utils.js";
|
|
3
|
-
function routePathToMdPath(routePath, base) {
|
|
3
|
+
function routePathToMdPath(routePath, base, siteOrigin) {
|
|
4
4
|
let url = routePath;
|
|
5
5
|
url = normalizeHref(url, false);
|
|
6
6
|
url = url.replace(/\.html$/, '.md');
|
|
7
|
-
return withBase(url, base);
|
|
7
|
+
return withSiteOrigin(withBase(url, base), siteOrigin);
|
|
8
8
|
}
|
|
9
|
-
async function generateLlmsTxt(routeGroups, others, navList, title, description, base, routeService) {
|
|
9
|
+
async function generateLlmsTxt(routeGroups, others, navList, title, description, base, siteOrigin, routeService) {
|
|
10
10
|
const lines = [];
|
|
11
11
|
if (!title) logger.warn('No `title` is configured in your Rspress setup. Please set `title` in rspress.config.ts so llms.txt can include an appropriate heading.');
|
|
12
12
|
const summary = title ? `# ${title}${description ? `\n\n> ${description}` : ''}` : '';
|
|
@@ -29,7 +29,7 @@ async function generateLlmsTxt(routeGroups, others, navList, title, description,
|
|
|
29
29
|
title = info.title;
|
|
30
30
|
description = info.description;
|
|
31
31
|
}
|
|
32
|
-
return `- [${title}](${routePathToMdPath(routePath, base)})${description ? `: ${description}` : ''}`;
|
|
32
|
+
return `- [${title}](${routePathToMdPath(routePath, base, siteOrigin)})${description ? `: ${description}` : ''}`;
|
|
33
33
|
}))).filter((i)=>Boolean(i));
|
|
34
34
|
if (routeLines.length > 0) {
|
|
35
35
|
const title = text;
|
|
@@ -52,13 +52,13 @@ async function generateLlmsTxt(routeGroups, others, navList, title, description,
|
|
|
52
52
|
llmsTxt = summary ? lines.length > 0 ? `${summary}\n${lines.join('\n')}` : summary : lines.join('\n').trimStart();
|
|
53
53
|
return llmsTxt;
|
|
54
54
|
}
|
|
55
|
-
function generateLlmsFullTxt(routeGroups, navList, others, base, mdContents) {
|
|
55
|
+
function generateLlmsFullTxt(routeGroups, navList, others, base, siteOrigin, mdContents) {
|
|
56
56
|
const lines = [];
|
|
57
57
|
for(let i = 0; i < navList.length; i++){
|
|
58
58
|
const routeGroup = routeGroups[i];
|
|
59
59
|
if (0 !== routeGroup.length) for (const routePath of routeGroup){
|
|
60
60
|
lines.push(`---
|
|
61
|
-
url: ${routePathToMdPath(routePath, base)}
|
|
61
|
+
url: ${routePathToMdPath(routePath, base, siteOrigin)}
|
|
62
62
|
---
|
|
63
63
|
`);
|
|
64
64
|
lines.push(mdContents.get(routePath) ?? '');
|
|
@@ -67,7 +67,7 @@ url: ${routePathToMdPath(routePath, base)}
|
|
|
67
67
|
}
|
|
68
68
|
for (const routePath of others){
|
|
69
69
|
lines.push(`---
|
|
70
|
-
url: ${routePathToMdPath(routePath, base)}
|
|
70
|
+
url: ${routePathToMdPath(routePath, base, siteOrigin)}
|
|
71
71
|
---
|
|
72
72
|
`);
|
|
73
73
|
lines.push(mdContents.get(routePath) ?? '');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __webpack_require__ } from "../../0~rslib-runtime.js";
|
|
2
|
-
import "../../
|
|
3
|
-
import { createHead, pathToFileURL, logger } from "../../
|
|
2
|
+
import "../../4538.js";
|
|
3
|
+
import { createHead, pathToFileURL, logger } from "../../8629.js";
|
|
4
4
|
import { hintSSGFailed } from "../logger/hint.js";
|
|
5
5
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
6
6
|
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __webpack_require__ } from "../../0~rslib-runtime.js";
|
|
2
|
-
import "../../
|
|
3
|
-
import { logger } from "../../
|
|
4
|
-
import { pMap } from "../../
|
|
2
|
+
import "../../4538.js";
|
|
3
|
+
import { logger } from "../../8629.js";
|
|
4
|
+
import { pMap } from "../../7448.js";
|
|
5
5
|
import { renderPage } from "./renderPage.js";
|
|
6
6
|
import { SSGConcurrency } from "../ssg/ssgEnv.js";
|
|
7
7
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { writeFile, mkdir, rm, join, isDebugMode } from "../../
|
|
1
|
+
import { writeFile, mkdir, rm, join, isDebugMode } from "../../8629.js";
|
|
2
2
|
import { NODE_SSG_MD_BUNDLE_FOLDER, NODE_SSG_MD_BUNDLE_NAME } from "../constants.js";
|
|
3
3
|
import { renderPages } from "./renderPages.js";
|
|
4
4
|
import { emitLlmsTxt } from "./llms/emitLlmsTxt.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createHash as external_node_crypto_createHash } from "../../
|
|
1
|
+
import { createHash as external_node_crypto_createHash } from "../../8629.js";
|
|
2
2
|
function createHash(str) {
|
|
3
3
|
return external_node_crypto_createHash('sha256').update(str).digest('hex').slice(0, 8);
|
|
4
4
|
}
|
package/dist/node/utils/error.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __webpack_require__ } from "../../0~rslib-runtime.js";
|
|
2
|
-
import "../../
|
|
2
|
+
import "../../4538.js";
|
|
3
3
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
4
4
|
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
5
5
|
function createError(message, maxStackLines = 5) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { node_fs, node_path, core_rspack, logger, createProcessor, MDX_OR_MD_REGEXP } from "../../
|
|
1
|
+
import { node_fs, node_path, core_rspack, logger, createProcessor, MDX_OR_MD_REGEXP } from "../../8629.js";
|
|
2
2
|
import { createError } from "./error.js";
|
|
3
3
|
import { importStatementRegex } from "../constants.js";
|
|
4
4
|
const RspackResolveFactory = core_rspack.experiments.resolver.ResolverFactory;
|
package/dist/node/utils/fs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __webpack_require__ } from "../../0~rslib-runtime.js";
|
|
2
|
-
import "../../
|
|
3
|
-
import { node_path, core_rspack, logger } from "../../
|
|
2
|
+
import "../../4538.js";
|
|
3
|
+
import { node_path, core_rspack, logger } from "../../8629.js";
|
|
4
4
|
import { pathExists, readJson } from "./fs.js";
|
|
5
5
|
import { PACKAGE_ROOT } from "../constants.js";
|
|
6
6
|
import { hintReactVersion } from "../logger/hint.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { BrowserRouter, PageContext, ThemeContext, removeTrailingSlash, withBase } from "@rspress/core/runtime";
|
|
2
|
+
import { BrowserRouter, PageContext, ThemeContext, removeTrailingSlash, useSite, withBase } from "@rspress/core/runtime";
|
|
3
3
|
import { useThemeState } from "@rspress/core/theme";
|
|
4
4
|
import { UnheadProvider, createHead } from "@unhead/react/client";
|
|
5
5
|
import { useMemo, useState } from "react";
|
|
@@ -8,6 +8,7 @@ const head = createHead();
|
|
|
8
8
|
function ClientApp({ initialPageData = null }) {
|
|
9
9
|
const [data, setData] = useState(initialPageData);
|
|
10
10
|
const [theme, setTheme] = useThemeState();
|
|
11
|
+
const { site } = useSite();
|
|
11
12
|
return /*#__PURE__*/ jsx(ThemeContext.Provider, {
|
|
12
13
|
value: useMemo(()=>({
|
|
13
14
|
theme,
|
|
@@ -26,7 +27,7 @@ function ClientApp({ initialPageData = null }) {
|
|
|
26
27
|
]),
|
|
27
28
|
children: /*#__PURE__*/ jsx(BrowserRouter, {
|
|
28
29
|
basename: removeTrailingSlash(withBase('/')),
|
|
29
|
-
useTransitions:
|
|
30
|
+
useTransitions: site.route.useTransitions,
|
|
30
31
|
children: /*#__PURE__*/ jsx(UnheadProvider, {
|
|
31
32
|
head: head,
|
|
32
33
|
children: /*#__PURE__*/ jsx(App, {})
|
package/dist/runtime/route.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { cleanUrl } from "@rspress/shared";
|
|
2
2
|
import { routes } from "virtual-routes";
|
|
3
|
+
import virtual_site_data from "virtual-site-data";
|
|
3
4
|
function normalizeRoutePath(routePath) {
|
|
4
5
|
return cleanUrl(decodeURIComponent(routePath)).replace(/\.html$/, '').replace(/\/index$/, '/').toLowerCase();
|
|
5
6
|
}
|
|
@@ -47,6 +48,7 @@ function isActive(itemLink, currentPathname) {
|
|
|
47
48
|
return null !== linkMatched;
|
|
48
49
|
}
|
|
49
50
|
const preloadLink = (link)=>{
|
|
51
|
+
if (virtual_site_data?.route?.prefetchLink === false) return;
|
|
50
52
|
const route = pathnameToRouteService(link);
|
|
51
53
|
if (route) route.preload();
|
|
52
54
|
};
|
|
@@ -1,25 +1,32 @@
|
|
|
1
|
+
import { A } from './a.js';
|
|
1
2
|
import { Code } from './code.js';
|
|
3
|
+
import { Hr } from './hr.js';
|
|
4
|
+
import { Img } from './img.js';
|
|
5
|
+
import { Li, Ol, Ul } from './list.js';
|
|
6
|
+
import { Blockquote, P, Strong } from './paragraph.js';
|
|
2
7
|
import { ShikiPre } from './pre.js';
|
|
8
|
+
import { Td, Th, Tr } from './table.js';
|
|
9
|
+
import { H1, H2, H3, H4, H5, H6 } from './title.js';
|
|
3
10
|
export declare function getCustomMDXComponent(): {
|
|
4
|
-
h1:
|
|
5
|
-
h2:
|
|
6
|
-
h3:
|
|
7
|
-
h4:
|
|
8
|
-
h5:
|
|
9
|
-
h6:
|
|
10
|
-
ul:
|
|
11
|
-
ol:
|
|
12
|
-
li:
|
|
11
|
+
h1: typeof H1;
|
|
12
|
+
h2: typeof H2;
|
|
13
|
+
h3: typeof H3;
|
|
14
|
+
h4: typeof H4;
|
|
15
|
+
h5: typeof H5;
|
|
16
|
+
h6: typeof H6;
|
|
17
|
+
ul: typeof Ul;
|
|
18
|
+
ol: typeof Ol;
|
|
19
|
+
li: typeof Li;
|
|
13
20
|
table: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "ref"> & import("react").RefAttributes<HTMLTableElement>>;
|
|
14
|
-
td:
|
|
15
|
-
th:
|
|
16
|
-
tr:
|
|
17
|
-
hr:
|
|
18
|
-
p:
|
|
19
|
-
blockquote:
|
|
20
|
-
strong:
|
|
21
|
-
a:
|
|
21
|
+
td: typeof Td;
|
|
22
|
+
th: typeof Th;
|
|
23
|
+
tr: typeof Tr;
|
|
24
|
+
hr: typeof Hr;
|
|
25
|
+
p: typeof P;
|
|
26
|
+
blockquote: typeof Blockquote;
|
|
27
|
+
strong: typeof Strong;
|
|
28
|
+
a: typeof A;
|
|
22
29
|
code: typeof Code;
|
|
23
|
-
img:
|
|
30
|
+
img: typeof Img;
|
|
24
31
|
pre: typeof ShikiPre;
|
|
25
32
|
};
|
|
@@ -29,7 +29,7 @@ export interface LinkProps extends ComponentProps<'a'> {
|
|
|
29
29
|
* Link can tell whether it's in current site or external site.
|
|
30
30
|
* 1. If external, open a new page and navigate to it.
|
|
31
31
|
* 2. If inCurrentPage, scroll to anchor.
|
|
32
|
-
* 3. If inCurrentSite, it will navigate and scroll to anchor,
|
|
32
|
+
* 3. If inCurrentSite, it will navigate and scroll to anchor, prefetch route resources when hovering over the link.
|
|
33
33
|
* 4. Link is styled.
|
|
34
34
|
*/
|
|
35
35
|
export declare const Link: React.ForwardRefExoticComponent<Omit<LinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
@@ -9,7 +9,7 @@ export declare function getHref(href: string): {
|
|
|
9
9
|
* For import { Link } from '@rspress/core/theme';
|
|
10
10
|
* useNavigate with preload logic
|
|
11
11
|
*/
|
|
12
|
-
export declare function useLinkNavigate({ startTransition }?: {
|
|
12
|
+
export declare function useLinkNavigate({ startTransition, }?: {
|
|
13
13
|
startTransition?: TransitionStartFunction;
|
|
14
14
|
}): (href: string) => Promise<void>;
|
|
15
15
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cleanUrlByConfig, initPageData, isActive, isExternalUrl, pathnameToRouteService, removeBase, useLocation, useNavigate, warmPageData, withBase } from "@rspress/core/runtime";
|
|
1
|
+
import { cleanUrlByConfig, initPageData, isActive, isExternalUrl, pathnameToRouteService, removeBase, useLocation, useNavigate, useSite, warmPageData, withBase } from "@rspress/core/runtime";
|
|
2
2
|
import nprogress from "nprogress";
|
|
3
3
|
import { startTransition as external_react_startTransition, useCallback } from "react";
|
|
4
4
|
nprogress.configure({
|
|
@@ -29,14 +29,17 @@ function getHref(href) {
|
|
|
29
29
|
linkType
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
function useLinkNavigate({ startTransition } = {
|
|
32
|
+
function useLinkNavigate({ startTransition = external_react_startTransition } = {
|
|
33
33
|
startTransition: external_react_startTransition
|
|
34
34
|
}) {
|
|
35
35
|
const { pathname: currPagePathname } = useLocation();
|
|
36
36
|
const navigate = useNavigate();
|
|
37
|
+
const { site } = useSite();
|
|
38
|
+
const useTransitions = site?.route?.useTransitions;
|
|
37
39
|
return useCallback(async (href)=>{
|
|
38
40
|
const { linkType, removeBaseHref, withBaseHref } = getHref(href);
|
|
39
41
|
if ('external' === linkType || 'hashOnly' === linkType) return void window.location.assign(href);
|
|
42
|
+
const isTransitionable = !!(useTransitions && startTransition);
|
|
40
43
|
const preloadChunkThenNavigate = async ()=>{
|
|
41
44
|
const inCurrPage = isActive(removeBaseHref, currPagePathname);
|
|
42
45
|
if (!import.meta.env.SSR && !inCurrPage) {
|
|
@@ -52,15 +55,20 @@ function useLinkNavigate({ startTransition } = {
|
|
|
52
55
|
nprogress.done();
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
|
-
|
|
58
|
+
if (isTransitionable) startTransition(()=>navigate(removeBaseHref, {
|
|
59
|
+
replace: false
|
|
60
|
+
}));
|
|
61
|
+
else navigate(removeBaseHref, {
|
|
56
62
|
replace: false
|
|
57
63
|
});
|
|
58
64
|
};
|
|
59
|
-
if (
|
|
65
|
+
if (isTransitionable) startTransition(preloadChunkThenNavigate);
|
|
60
66
|
else preloadChunkThenNavigate();
|
|
61
67
|
}, [
|
|
68
|
+
useTransitions,
|
|
62
69
|
currPagePathname,
|
|
63
|
-
navigate
|
|
70
|
+
navigate,
|
|
71
|
+
startTransition
|
|
64
72
|
]);
|
|
65
73
|
}
|
|
66
74
|
export { getHref, useLinkNavigate };
|