@rspress/core 2.0.22 → 2.1.0-beta.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.
- package/bin/rspress.js +3 -1
- package/dist/{v~0.js → b~0.js} +19 -16
- package/dist/cli/index.js +2 -2
- package/dist/{common-Qw-RoVFD.js → common-Bo3KCGim.js} +4 -1
- package/dist/config/loadConfigFile.js +1 -1
- package/dist/eject-theme/components/Link/getHref.ts +1 -0
- package/dist/eject-theme/components/Link/index.tsx +0 -3
- package/dist/eject-theme/components/Link/useLinkNavigate.ts +29 -54
- package/dist/eject-theme/components/Search/SearchPanel.tsx +9 -5
- package/dist/eject-theme/components/Search/logic/providers/LocalProvider.ts +5 -2
- package/dist/eject-theme/components/Search/useSearchPanel.ts +105 -37
- package/dist/eject-theme/components/SocialLinks/GithubStars.test.tsx +4 -1
- package/dist/eject-theme/components/SocialLinks/GithubStars.tsx +1 -1
- package/dist/eject-theme/components/SocialLinks/SocialLink.tsx +2 -2
- package/dist/eject-theme/components/SourceCode/index.tsx +1 -1
- package/dist/entry/worker.js +1 -1
- package/dist/{o~0.js → h~0.js} +18 -29
- package/dist/index.d.ts +1 -1
- package/dist/node/PluginDriver.js +8 -2
- 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 +1 -1
- 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 +1 -1
- package/dist/node/initRsbuild.js +9 -5
- package/dist/node/llms.d.ts +1 -1
- package/dist/node/llms.js +2 -2
- package/dist/node/logger/hint.d.ts +1 -0
- package/dist/node/logger/hint.js +8 -2
- 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/DEFAULT_I18N_TEXT.d.ts +28 -0
- package/dist/node/runtimeModule/DEFAULT_I18N_TEXT.js +28 -0
- package/dist/node/runtimeModule/i18n.js +1 -1
- package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
- package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
- package/dist/node/runtimeModule/searchHooks.js +2 -2
- package/dist/node/runtimeModule/siteData/createSiteData.js +1 -1
- 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/sitemap.d.ts +2 -0
- package/dist/node/sitemap.js +103 -0
- package/dist/node/ssg/alternateLinks.js +1 -1
- package/dist/node/ssg/htmlFile.js +1 -1
- package/dist/node/ssg/renderHtmlTemplate.js +4 -3
- package/dist/node/ssg/renderPage.js +1 -1
- package/dist/node/ssg/renderPageWorker.js +1 -1
- package/dist/node/ssg/renderPages.js +2 -2
- package/dist/node/ssg/rsbuildPluginSSG.js +1 -1
- package/dist/node/ssg/ssgEnv.js +1 -1
- package/dist/node/ssg-md/llms/emitLlmsTxt.js +1 -1
- package/dist/node/ssg-md/llms/llmsTxt.js +1 -1
- package/dist/node/ssg-md/renderPage.js +5 -4
- package/dist/node/ssg-md/renderPages.js +2 -2
- 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/flattenMdxContent.js +1 -1
- package/dist/node/utils/getPageKey.js +1 -1
- package/dist/node/utils/reactAlias.js +5 -2
- package/dist/n~0.js +11 -10
- package/dist/runtime/App.js +15 -27
- package/dist/runtime/ClientApp.d.ts +3 -2
- package/dist/runtime/ClientApp.js +27 -21
- package/dist/runtime/ErrorRoute.d.ts +1 -0
- package/dist/runtime/ErrorRoute.js +30 -0
- package/dist/runtime/PageRoute.d.ts +2 -0
- package/dist/runtime/PageRoute.js +58 -0
- package/dist/runtime/createServerRouter.d.ts +4 -0
- package/dist/runtime/createServerRouter.js +17 -0
- package/dist/runtime/csrClientEntry.js +5 -2
- package/dist/runtime/hooks/createExternalStore.d.ts +4 -0
- package/dist/runtime/hooks/createExternalStore.js +20 -0
- package/dist/runtime/hooks/useGlobalComponents.d.ts +1 -0
- package/dist/runtime/hooks/useGlobalComponents.js +10 -0
- package/dist/runtime/hooks/useI18n.js +5 -3
- package/dist/runtime/hooks/useI18nText.d.ts +1 -0
- package/dist/runtime/hooks/useI18nText.js +10 -0
- package/dist/runtime/hooks/usePages.d.ts +2 -0
- package/dist/runtime/hooks/usePages.js +12 -3
- package/dist/runtime/hooks/useSearchHooks.d.ts +8 -0
- package/dist/runtime/hooks/useSearchHooks.js +14 -0
- package/dist/runtime/hooks/useSite.d.ts +1 -0
- package/dist/runtime/hooks/useSite.js +9 -2
- package/dist/runtime/hooks/useWebMcp.d.ts +36 -0
- package/dist/runtime/hooks/useWebMcp.js +80 -0
- package/dist/runtime/index.d.ts +6 -2
- package/dist/runtime/index.js +8 -2
- package/dist/runtime/initPageData.d.ts +0 -3
- package/dist/runtime/initPageData.js +13 -49
- package/dist/runtime/pageDataLoader.d.ts +11 -0
- package/dist/runtime/pageDataLoader.js +7 -0
- package/dist/runtime/route.js +5 -5
- package/dist/runtime/ssrClientEntry.js +14 -6
- package/dist/runtime/ssrMdServerEntry.js +10 -21
- package/dist/runtime/ssrServerEntry.js +10 -21
- package/dist/runtime/utils.js +6 -6
- package/dist/static/assets/package.json +58 -0
- package/dist/theme/components/Link/index.js +0 -4
- package/dist/theme/components/Link/useLinkNavigate.d.ts +2 -2
- package/dist/theme/components/Link/useLinkNavigate.js +13 -35
- package/dist/theme/components/Search/SearchPanel.js +8 -6
- package/dist/theme/components/Search/logic/providers/LocalProvider.js +5 -2
- package/dist/theme/components/Search/useSearchPanel.js +75 -27
- package/dist/theme/components/SocialLinks/GithubStars.js +1 -1
- package/dist/theme/components/SocialLinks/SocialLink.js +2 -2
- package/dist/theme/components/SourceCode/index.js +1 -1
- package/dist/theme/hooks/useWebMcpNavigation.d.ts +6 -0
- package/dist/theme/hooks/useWebMcpNavigation.js +123 -0
- package/dist/theme/hooks/useWebMcpPageList.d.ts +6 -0
- package/dist/theme/hooks/useWebMcpPageList.js +25 -0
- package/dist/theme/hooks/useWebMcpPageReading.d.ts +7 -0
- package/dist/theme/hooks/useWebMcpPageReading.js +23 -0
- package/dist/theme/hooks/useWebMcpSiteInfo.d.ts +6 -0
- package/dist/theme/hooks/useWebMcpSiteInfo.js +22 -0
- package/dist/theme/index.d.ts +5 -0
- package/dist/theme/index.js +5 -0
- package/dist/theme/layout/ErrorLayout/index.css +52 -0
- package/dist/theme/layout/ErrorLayout/index.d.ts +8 -0
- package/dist/theme/layout/ErrorLayout/index.js +76 -0
- package/dist/theme/logic/utils.d.ts +0 -2
- package/dist/theme/logic/utils.js +56 -6
- package/dist/theme/webMcp/tools.d.ts +56 -0
- package/dist/theme/webMcp/tools.js +122 -0
- package/dist/theme/webMcp/types.d.ts +35 -0
- package/dist/theme/webMcp/types.js +0 -0
- package/dist/tinypool~0.js +19 -49
- package/dist/tu~0.js +3 -0
- package/package.json +17 -17
package/dist/{o~0.js → h~0.js}
RENAMED
|
@@ -5,8 +5,6 @@ import { basename, dirname, isAbsolute, normalize, posix, relative as external_p
|
|
|
5
5
|
import * as __rspack_external_fs from "fs";
|
|
6
6
|
import { readdir, readdirSync, realpath, realpathSync, stat as external_fs_stat, statSync } from "fs";
|
|
7
7
|
import { createRequire as external_module_createRequire } from "module";
|
|
8
|
-
import { createRequire as __rspack_createRequire } from "node:module";
|
|
9
|
-
const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
|
|
10
8
|
moduleFactories.add({
|
|
11
9
|
"../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/index.js" (module) {
|
|
12
10
|
const pico = rspackRequire("../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/picomatch.js");
|
|
@@ -1660,18 +1658,6 @@ moduleFactories.add({
|
|
|
1660
1658
|
if ('' === last) return segs[segs.length - 2];
|
|
1661
1659
|
return last;
|
|
1662
1660
|
};
|
|
1663
|
-
},
|
|
1664
|
-
child_process (module) {
|
|
1665
|
-
module.exports = __rspack_createRequire_require("child_process");
|
|
1666
|
-
},
|
|
1667
|
-
"fs?cdbd" (module) {
|
|
1668
|
-
module.exports = __rspack_createRequire_require("fs");
|
|
1669
|
-
},
|
|
1670
|
-
"path?37f5" (module) {
|
|
1671
|
-
module.exports = __rspack_createRequire_require("path");
|
|
1672
|
-
},
|
|
1673
|
-
stream (module) {
|
|
1674
|
-
module.exports = __rspack_createRequire_require("stream");
|
|
1675
1661
|
}
|
|
1676
1662
|
});
|
|
1677
1663
|
function toArr(any) {
|
|
@@ -1783,7 +1769,7 @@ function findAllBrackets(v) {
|
|
|
1783
1769
|
}
|
|
1784
1770
|
function getMriOptions(options) {
|
|
1785
1771
|
const result = {
|
|
1786
|
-
alias:
|
|
1772
|
+
alias: Object.create(null),
|
|
1787
1773
|
boolean: []
|
|
1788
1774
|
};
|
|
1789
1775
|
for (const [index, option] of options.entries()){
|
|
@@ -1795,7 +1781,7 @@ function getMriOptions(options) {
|
|
|
1795
1781
|
return result;
|
|
1796
1782
|
}
|
|
1797
1783
|
function findLongest(arr) {
|
|
1798
|
-
return arr.sort((a, b)=>
|
|
1784
|
+
return arr.sort((a, b)=>b.length - a.length)[0];
|
|
1799
1785
|
}
|
|
1800
1786
|
function padRight(str, length) {
|
|
1801
1787
|
return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
|
|
@@ -1803,7 +1789,13 @@ function padRight(str, length) {
|
|
|
1803
1789
|
function camelcase(input) {
|
|
1804
1790
|
return input.replaceAll(/([a-z])-([a-z])/g, (_, p1, p2)=>p1 + p2.toUpperCase());
|
|
1805
1791
|
}
|
|
1792
|
+
const UNSAFE_KEYS = /* @__PURE__ */ new Set([
|
|
1793
|
+
"__proto__",
|
|
1794
|
+
"constructor",
|
|
1795
|
+
"prototype"
|
|
1796
|
+
]);
|
|
1806
1797
|
function setDotProp(obj, keys, val) {
|
|
1798
|
+
if (keys.some((key)=>UNSAFE_KEYS.has(key))) return;
|
|
1807
1799
|
let current = obj;
|
|
1808
1800
|
for(let i = 0; i < keys.length; i++){
|
|
1809
1801
|
const key = keys[i];
|
|
@@ -1819,14 +1811,11 @@ function setDotProp(obj, keys, val) {
|
|
|
1819
1811
|
}
|
|
1820
1812
|
}
|
|
1821
1813
|
function setByType(obj, transforms) {
|
|
1822
|
-
for (const key of Object.
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
].flat();
|
|
1828
|
-
if ("function" == typeof transform.transformFunction) obj[key] = obj[key].map(transform.transformFunction);
|
|
1829
|
-
}
|
|
1814
|
+
for (const [key, transform] of Object.entries(transforms))if (transform.shouldTransform) {
|
|
1815
|
+
obj[key] = [
|
|
1816
|
+
obj[key]
|
|
1817
|
+
].flat();
|
|
1818
|
+
if ("function" == typeof transform.transformFunction) obj[key] = obj[key].map(transform.transformFunction);
|
|
1830
1819
|
}
|
|
1831
1820
|
}
|
|
1832
1821
|
function getFileName(input) {
|
|
@@ -1865,7 +1854,7 @@ var Option = class {
|
|
|
1865
1854
|
name = name.replace(/^no-/, "");
|
|
1866
1855
|
}
|
|
1867
1856
|
return camelcaseOptionName(name);
|
|
1868
|
-
}).sort((a, b)=>a.length
|
|
1857
|
+
}).sort((a, b)=>a.length - b.length);
|
|
1869
1858
|
this.name = this.names.at(-1);
|
|
1870
1859
|
if (this.negated && null == this.config.default) this.config.default = true;
|
|
1871
1860
|
if (rawName.includes("<")) this.required = true;
|
|
@@ -1951,7 +1940,7 @@ var Command = class {
|
|
|
1951
1940
|
return this instanceof GlobalCommand;
|
|
1952
1941
|
}
|
|
1953
1942
|
hasOption(name) {
|
|
1954
|
-
name = name.split(".")[0];
|
|
1943
|
+
name = name.split(".", 1)[0];
|
|
1955
1944
|
return this.options.find((option)=>option.names.includes(name));
|
|
1956
1945
|
}
|
|
1957
1946
|
outputHelp() {
|
|
@@ -2020,7 +2009,7 @@ var Command = class {
|
|
|
2020
2009
|
...this.options
|
|
2021
2010
|
];
|
|
2022
2011
|
for (const option of options){
|
|
2023
|
-
const value = parsedOptions[option.name.split(".")[0]];
|
|
2012
|
+
const value = parsedOptions[option.name.split(".", 1)[0]];
|
|
2024
2013
|
if (option.required) {
|
|
2025
2014
|
const hasNegated = options.some((o)=>o.negated && o.names.includes(option.name));
|
|
2026
2015
|
if (true === value || false === value && !hasNegated) throw new CACError(`option \`${option.rawName}\` value is missing`);
|
|
@@ -2195,8 +2184,8 @@ var CAC = class extends EventTarget {
|
|
|
2195
2184
|
transforms[cliOption.name].transformFunction = cliOption.config.type[0];
|
|
2196
2185
|
}
|
|
2197
2186
|
}
|
|
2198
|
-
for (const key of Object.
|
|
2199
|
-
setDotProp(options, key.split("."),
|
|
2187
|
+
for (const [key, value] of Object.entries(parsed))if ("_" !== key) {
|
|
2188
|
+
setDotProp(options, key.split("."), value);
|
|
2200
2189
|
setByType(options, transforms);
|
|
2201
2190
|
}
|
|
2202
2191
|
return {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { DarkMode, EditLink, Feature, FrontMatterMeta, Header, Hero, I18nText, LlmsTxtContext, LlmsTxtPage, LlmsTxtRenderer, LlmsTxtSection, LocalSearchOptions, Nav, NavItem, NavItemWithChildren, NavItemWithLink, NavItemWithLinkAndChildren, NormalizedSidebarGroup, PageIndexInfo, RemotePageInfo, RouteMeta, RspressPlugin, Sidebar, SidebarData, SidebarDivider, SidebarGroup, SidebarItem, SidebarSectionHeader, SocialLink, UserConfig, } from '@rspress/shared';
|
|
1
|
+
export type { DarkMode, EditLink, Feature, FrontMatterMeta, Header, Hero, I18nText, LlmsTxtContext, LlmsTxtPage, LlmsTxtRenderer, LlmsTxtSection, LocalSearchOptions, Nav, NavItem, NavItemWithChildren, NavItemWithLink, NavItemWithLinkAndChildren, NormalizedSidebarGroup, PageIndexInfo, RemotePageInfo, RouteMeta, RspressPlugin, Sidebar, SidebarData, SidebarDivider, SidebarGroup, SidebarItem, SidebarSectionHeader, SitemapOptions, SocialLink, UserConfig, } from '@rspress/shared';
|
|
2
2
|
export { getSidebarDataGroup, normalizeHref, normalizePosixPath, RSPRESS_TEMP_DIR, removeTrailingSlash, withBase, withSiteOrigin, } from '@rspress/shared';
|
|
3
3
|
export { logger } from '@rspress/shared/logger';
|
|
4
4
|
export { getIconUrlPath, getNodeAttribute, mergeDocConfig, } from '@rspress/shared/node-utils';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addTrailingSlash, node_path, addLeadingSlash } from "../
|
|
1
|
+
import { addTrailingSlash, node_path, addLeadingSlash } from "../h~0.js";
|
|
2
2
|
import { createError } from "./utils/error.js";
|
|
3
3
|
import { haveNavSidebarConfig as auto_nav_sidebar_haveNavSidebarConfig } from "./auto-nav-sidebar/index.js";
|
|
4
4
|
class PluginDriver {
|
|
@@ -31,6 +31,10 @@ class PluginDriver {
|
|
|
31
31
|
const { pluginMediumZoom } = await import("./medium-zoom/index.js");
|
|
32
32
|
this.addPlugin(pluginMediumZoom('object' == typeof mediumZoomConfig ? mediumZoomConfig : void 0));
|
|
33
33
|
}
|
|
34
|
+
if (this.#isProd) {
|
|
35
|
+
const { pluginSitemap } = await import("./sitemap.js");
|
|
36
|
+
this.addPlugin(pluginSitemap());
|
|
37
|
+
}
|
|
34
38
|
(config.plugins || []).forEach((plugin)=>{
|
|
35
39
|
this.addPlugin(plugin);
|
|
36
40
|
});
|
|
@@ -53,7 +57,9 @@ class PluginDriver {
|
|
|
53
57
|
async normalizeConfig() {
|
|
54
58
|
this.#config.root ??= 'docs';
|
|
55
59
|
this.#config.ssg ??= true;
|
|
56
|
-
this.#config.llms ??=
|
|
60
|
+
this.#config.llms ??= true;
|
|
61
|
+
this.#config.webMcp ??= true;
|
|
62
|
+
this.#config.sitemap ??= true;
|
|
57
63
|
this.#config.base = addTrailingSlash(addLeadingSlash(this.#config.base ?? '/'));
|
|
58
64
|
this.#config.lang ??= 'en';
|
|
59
65
|
this.#config.themeDir ??= node_path.join(process.cwd(), 'theme');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_PAGE_EXTENSIONS, node_path } from "../../
|
|
1
|
+
import { DEFAULT_PAGE_EXTENSIONS, node_path } from "../../h~0.js";
|
|
2
2
|
import { processLocales, combineWalkResult } from "./locales.js";
|
|
3
3
|
import { walk } from "./walk.js";
|
|
4
4
|
async function runAutoNavSide(config, metaFileSet, mdFileSet) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
|
|
2
2
|
import "../../t~0.js";
|
|
3
|
-
import { extname, logger, promises_readdir, external_node_path_relative, isExternalUrl, slash, promises_stat, join } from "../../
|
|
3
|
+
import { extname, logger, promises_readdir, external_node_path_relative, isExternalUrl, slash, promises_stat, join } from "../../h~0.js";
|
|
4
4
|
import { createError } from "../utils/error.js";
|
|
5
5
|
import { pathExists, extractInfoFromFrontmatterWithAbsolutePath, readJson } from "./utils.js";
|
|
6
6
|
import { absolutePathToRoutePath, addRoutePrefix } from "../route/RoutePage.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isExternalUrl, node_path, promises } from "../../
|
|
1
|
+
import { isExternalUrl, node_path, promises } from "../../h~0.js";
|
|
2
2
|
import { pathExists } from "../utils/fs.js";
|
|
3
3
|
import { readJson } from "./utils.js";
|
|
4
4
|
import { addRoutePrefix } from "../route/RoutePage.js";
|
package/dist/node/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isDarkModeSwitchEnabled, node_path, package_namespaceObject, getDefaultDarkModeValue, createRequire } from "../
|
|
1
|
+
import { isDarkModeSwitchEnabled, node_path, package_namespaceObject, getDefaultDarkModeValue, createRequire } from "../b~0.js";
|
|
2
2
|
const constants_require = createRequire(import.meta.url);
|
|
3
3
|
const RSPRESS_VERSION = package_namespaceObject.rE;
|
|
4
4
|
const APPEARANCE_KEY = 'rspress-theme-appearance';
|
package/dist/node/eject.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { rspackRequire, compatGetDefaultExport } from "../rslib-runtime~0.js";
|
|
2
2
|
import "../t~0.js";
|
|
3
|
-
import { node_path, logger, promises } from "../
|
|
3
|
+
import { node_path, logger, promises } from "../h~0.js";
|
|
4
4
|
import { EJECTED_THEME } from "./constants.js";
|
|
5
5
|
const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
6
6
|
var picocolors_default = /*#__PURE__*/ compatGetDefaultExport(picocolors);
|
package/dist/node/initRsbuild.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { external_node_process_cwd, node_path, fileURLToPath, addTrailingSlash, PLUGIN_REACT_NAME, removeTrailingSlash, normalizeDarkMode, pluginVirtualModule, pluginReact, createRequire, MDX_OR_MD_REGEXP } from "../
|
|
1
|
+
import { external_node_process_cwd, node_path, fileURLToPath, addTrailingSlash, PLUGIN_REACT_NAME, removeTrailingSlash, normalizeDarkMode, pluginVirtualModule, pluginReact, createRequire, MDX_OR_MD_REGEXP } from "../h~0.js";
|
|
2
2
|
import { createError } from "./utils/error.js";
|
|
3
3
|
import { CSR_CLIENT_ENTRY, SSR_CLIENT_ENTRY, OUTPUT_DIR, SSG_MD_SERVER_ENTRY, NODE_SSG_BUNDLE_FOLDER, getInlineLocaleRedirectScript, isProduction, PACKAGE_ROOT, SSR_SERVER_ENTRY, TEMPLATE_PATH, NODE_SSG_MD_BUNDLE_FOLDER, DEFAULT_THEME, NODE_SSG_MD_BUNDLE_NAME, getInlineThemeScript, DEFAULT_TITLE, NODE_SSG_BUNDLE_NAME } from "./constants.js";
|
|
4
4
|
import { isLlmsUIEnabled, isLlmsHintEnabled } from "./llms.js";
|
|
@@ -16,7 +16,7 @@ import { siteDataVMPlugin } from "./runtimeModule/siteData/rsbuildPlugin.js";
|
|
|
16
16
|
import { rsbuildPluginSSG } from "./ssg/rsbuildPluginSSG.js";
|
|
17
17
|
import { rsbuildPluginCSR } from "./ssg/rsbuildPluginCSR.js";
|
|
18
18
|
import { rsbuildPluginSSGMD } from "./ssg-md/rsbuildPluginSSGMD.js";
|
|
19
|
-
import { package_namespaceObject } from "../
|
|
19
|
+
import { package_namespaceObject } from "../b~0.js";
|
|
20
20
|
function isPluginIncluded(config, pluginName) {
|
|
21
21
|
return Boolean(config.builderConfig?.plugins?.some((plugin)=>plugin && plugin.name === pluginName));
|
|
22
22
|
}
|
|
@@ -186,8 +186,11 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
186
186
|
PACKAGE_ROOT
|
|
187
187
|
],
|
|
188
188
|
define: {
|
|
189
|
+
'import.meta.env.ENABLE_WEBMCP': JSON.stringify(false !== config.webMcp),
|
|
190
|
+
'import.meta.env.WEBMCP_EXPOSED_TO': JSON.stringify('object' == typeof config.webMcp ? config.webMcp.exposedTo ?? [] : []),
|
|
189
191
|
'import.meta.env.ENABLE_LLMS_UI': JSON.stringify(enableLlmsUI),
|
|
190
|
-
'import.meta.env.ENABLE_LLMS_HINT': JSON.stringify(enableLlmsHint)
|
|
192
|
+
'import.meta.env.ENABLE_LLMS_HINT': JSON.stringify(enableLlmsHint),
|
|
193
|
+
'import.meta.env.ENABLE_SSG_MD': JSON.stringify(Boolean(enableSSG && config.llms))
|
|
191
194
|
}
|
|
192
195
|
},
|
|
193
196
|
performance: {
|
|
@@ -283,7 +286,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
283
286
|
},
|
|
284
287
|
source: {
|
|
285
288
|
entry: {
|
|
286
|
-
index: enableSSG && isProduction() ? SSR_CLIENT_ENTRY : CSR_CLIENT_ENTRY
|
|
289
|
+
index: enableSSG && config.ssg && isProduction() ? SSR_CLIENT_ENTRY : CSR_CLIENT_ENTRY
|
|
287
290
|
},
|
|
288
291
|
define: {
|
|
289
292
|
'process.env.__SSR__': JSON.stringify(false),
|
|
@@ -361,7 +364,8 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
361
364
|
define: {
|
|
362
365
|
'process.env.__SSR__': JSON.stringify(true),
|
|
363
366
|
'process.env.__SSR_MD__': JSON.stringify(true),
|
|
364
|
-
'import.meta.env.SSG_MD': JSON.stringify(true)
|
|
367
|
+
'import.meta.env.SSG_MD': JSON.stringify(true),
|
|
368
|
+
'import.meta.env.ENABLE_LLMS_HINT': JSON.stringify(isLlmsHintEnabled(config, enableSSG, 'markdown'))
|
|
365
369
|
}
|
|
366
370
|
},
|
|
367
371
|
output: {
|
package/dist/node/llms.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { UserConfig } from '@rspress/shared';
|
|
2
2
|
export declare function isLlmsUIEnabled(config: UserConfig): boolean;
|
|
3
|
-
export declare function isLlmsHintEnabled(config: UserConfig, enableSSG: boolean): boolean;
|
|
3
|
+
export declare function isLlmsHintEnabled(config: UserConfig, enableSSG: boolean, output?: 'html' | 'markdown'): boolean;
|
package/dist/node/llms.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
function isLlmsUIEnabled(config) {
|
|
2
2
|
return Boolean(config.themeConfig?.llmsUI ?? config.llms);
|
|
3
3
|
}
|
|
4
|
-
function isLlmsHintEnabled(config, enableSSG) {
|
|
4
|
+
function isLlmsHintEnabled(config, enableSSG, output = 'html') {
|
|
5
5
|
const llmsUI = config.themeConfig?.llmsUI;
|
|
6
|
-
return enableSSG && false !== config.ssg && isLlmsUIEnabled(config) && ('object' != typeof llmsUI || false !== llmsUI.injectLlmsHint);
|
|
6
|
+
return enableSSG && ('markdown' === output ? Boolean(config.llms) : false !== config.ssg) && isLlmsUIEnabled(config) && ('object' != typeof llmsUI || false !== llmsUI.injectLlmsHint);
|
|
7
7
|
}
|
|
8
8
|
export { isLlmsHintEnabled, isLlmsUIEnabled };
|
|
@@ -7,6 +7,7 @@ import type { NavJson } from '../auto-nav-sidebar/type.js';
|
|
|
7
7
|
export declare function hintThemeBreakingChange(customThemeDir: string): Promise<void>;
|
|
8
8
|
export declare function hintBuilderPluginsBreakingChange(config: UserConfig): void;
|
|
9
9
|
export declare function hintSSGFailed(): void;
|
|
10
|
+
export declare function hintSSGMDFailed(): void;
|
|
10
11
|
/**
|
|
11
12
|
* Print "ssg: false" explicitly to give users a clear perception.
|
|
12
13
|
*/
|
package/dist/node/logger/hint.js
CHANGED
|
@@ -63,7 +63,13 @@ let isSSGFailedLogged = false;
|
|
|
63
63
|
function hintSSGFailed() {
|
|
64
64
|
if (isSSGFailedLogged) return;
|
|
65
65
|
isSSGFailedLogged = true;
|
|
66
|
-
logger.info("[Rspress v2]
|
|
66
|
+
logger.info("[Rspress v2] SSG requires the source code to support SSR. If the code is not compatible with SSR, the build process will fail. You can try:\n 1. Fix code to make it SSR-compatible.\n 2. Set `ssg: false` to disable SSG if the code is difficult to fix.");
|
|
67
|
+
}
|
|
68
|
+
let isSSGMDFailedLogged = false;
|
|
69
|
+
function hintSSGMDFailed() {
|
|
70
|
+
if (isSSGMDFailedLogged) return;
|
|
71
|
+
isSSGMDFailedLogged = true;
|
|
72
|
+
logger.info("[Rspress v2] SSG-MD requires the source code to support SSR. If the code is not compatible with SSR, Markdown rendering will fail. You can try:\n 1. Fix code to make it SSR-compatible.\n 2. Set `llms: false` and use @rspress/plugin-llms to generate Markdown, llms.txt, and llms-full.txt without SSR: https://rspress.rs/plugin/official-plugins/llms");
|
|
67
73
|
}
|
|
68
74
|
function hintSSGFalse() {
|
|
69
75
|
logger.info('`ssg: false` detected, SSG will be disabled.');
|
|
@@ -92,4 +98,4 @@ function hintRelativeMarkdownLink() {
|
|
|
92
98
|
isLogged = true;
|
|
93
99
|
logger.info('[Rspress v2] Markdown links without "./" prefix are now relative links, e.g: [](guide/getting-started) is equal to [](./guide/getting-started). You can rewrite it to [](/guide/getting-started) to always use absolute links, or use [](./getting-started.md)');
|
|
94
100
|
}
|
|
95
|
-
export { hintBuilderPluginsBreakingChange, hintNavJsonChangeThenPanic, hintReactVersion, hintRelativeMarkdownLink, hintSSGFailed, hintSSGFalse, hintThemeBreakingChange };
|
|
101
|
+
export { hintBuilderPluginsBreakingChange, hintNavJsonChangeThenPanic, hintReactVersion, hintRelativeMarkdownLink, hintSSGFailed, hintSSGFalse, hintSSGMDFailed, hintThemeBreakingChange };
|
|
@@ -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 "../../h~0.js";
|
|
2
2
|
import { RoutePage, absolutePathToRoutePath, absolutePathToRelativePath } from "./RoutePage.js";
|
|
3
3
|
import { createError } from "../utils/error.js";
|
|
4
4
|
import { getRouteChunkName } from "./routeChunkAssets.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unified, node_path, promises, loadFrontMatter, extractTextAndId, remark_gfm, remark_parse, MDX_OR_MD_REGEXP } from "../../
|
|
1
|
+
import { unified, node_path, promises, loadFrontMatter, extractTextAndId, remark_gfm, remark_parse, MDX_OR_MD_REGEXP } from "../../h~0.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 "../../h~0.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 [
|
|
@@ -181,6 +181,34 @@ export declare const DEFAULT_I18N_TEXT: {
|
|
|
181
181
|
readonly ko: '홈으로 이동';
|
|
182
182
|
readonly ru: 'Вернуться на главную';
|
|
183
183
|
};
|
|
184
|
+
readonly errorTitleText: {
|
|
185
|
+
readonly en: 'Something went wrong';
|
|
186
|
+
readonly zh: '页面出了点问题';
|
|
187
|
+
readonly ja: 'エラーが発生しました';
|
|
188
|
+
readonly ko: '문제가 발생했습니다';
|
|
189
|
+
readonly ru: 'Что-то пошло не так';
|
|
190
|
+
};
|
|
191
|
+
readonly errorDescriptionText: {
|
|
192
|
+
readonly en: 'This page could not be loaded. Try reloading it or return to the home page.';
|
|
193
|
+
readonly zh: '页面未能正常加载,请尝试重新加载,或返回首页。';
|
|
194
|
+
readonly ja: 'ページを読み込めませんでした。再読み込みするか、ホームに戻ってください。';
|
|
195
|
+
readonly ko: '페이지를 불러올 수 없습니다. 새로고침하거나 홈으로 돌아가세요.';
|
|
196
|
+
readonly ru: 'Не удалось загрузить страницу. Попробуйте обновить её или вернуться на главную.';
|
|
197
|
+
};
|
|
198
|
+
readonly reloadPageText: {
|
|
199
|
+
readonly en: 'Reload page';
|
|
200
|
+
readonly zh: '重新加载';
|
|
201
|
+
readonly ja: '再読み込み';
|
|
202
|
+
readonly ko: '새로고침';
|
|
203
|
+
readonly ru: 'Обновить страницу';
|
|
204
|
+
};
|
|
205
|
+
readonly errorDetailsText: {
|
|
206
|
+
readonly en: 'Error details';
|
|
207
|
+
readonly zh: '错误详情';
|
|
208
|
+
readonly ja: 'エラーの詳細';
|
|
209
|
+
readonly ko: '오류 세부 정보';
|
|
210
|
+
readonly ru: 'Подробности ошибки';
|
|
211
|
+
};
|
|
184
212
|
readonly promptCopyText: {
|
|
185
213
|
readonly en: 'Copy Prompt';
|
|
186
214
|
readonly zh: '复制 Prompt';
|
|
@@ -181,6 +181,34 @@ const DEFAULT_I18N_TEXT = {
|
|
|
181
181
|
ko: '홈으로 이동',
|
|
182
182
|
ru: 'Вернуться на главную'
|
|
183
183
|
},
|
|
184
|
+
errorTitleText: {
|
|
185
|
+
en: 'Something went wrong',
|
|
186
|
+
zh: '页面出了点问题',
|
|
187
|
+
ja: 'エラーが発生しました',
|
|
188
|
+
ko: '문제가 발생했습니다',
|
|
189
|
+
ru: 'Что-то пошло не так'
|
|
190
|
+
},
|
|
191
|
+
errorDescriptionText: {
|
|
192
|
+
en: 'This page could not be loaded. Try reloading it or return to the home page.',
|
|
193
|
+
zh: '页面未能正常加载,请尝试重新加载,或返回首页。',
|
|
194
|
+
ja: 'ページを読み込めませんでした。再読み込みするか、ホームに戻ってください。',
|
|
195
|
+
ko: '페이지를 불러올 수 없습니다. 새로고침하거나 홈으로 돌아가세요.',
|
|
196
|
+
ru: 'Не удалось загрузить страницу. Попробуйте обновить её или вернуться на главную.'
|
|
197
|
+
},
|
|
198
|
+
reloadPageText: {
|
|
199
|
+
en: 'Reload page',
|
|
200
|
+
zh: '重新加载',
|
|
201
|
+
ja: '再読み込み',
|
|
202
|
+
ko: '새로고침',
|
|
203
|
+
ru: 'Обновить страницу'
|
|
204
|
+
},
|
|
205
|
+
errorDetailsText: {
|
|
206
|
+
en: 'Error details',
|
|
207
|
+
zh: '错误详情',
|
|
208
|
+
ja: 'エラーの詳細',
|
|
209
|
+
ko: '오류 세부 정보',
|
|
210
|
+
ru: 'Подробности ошибки'
|
|
211
|
+
},
|
|
184
212
|
promptCopyText: {
|
|
185
213
|
en: 'Copy Prompt',
|
|
186
214
|
zh: '复制 Prompt',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
|
|
2
2
|
import "../../t~0.js";
|
|
3
|
-
import { createRequire, join, logger } from "../../
|
|
3
|
+
import { createRequire, join, logger } from "../../h~0.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";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SEARCH_INDEX_NAME, groupBy } from "../../../
|
|
1
|
+
import { SEARCH_INDEX_NAME, groupBy } from "../../../h~0.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 "../../../h~0.js";
|
|
2
2
|
import { createPageData } from "./createPageData.js";
|
|
3
3
|
const rsbuildPluginDocVM = async ({ config, userDocRoot, routeService, pluginDriver })=>{
|
|
4
4
|
const ref = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { node_path } from "../../
|
|
1
|
+
import { node_path } from "../../h~0.js";
|
|
2
2
|
const searchHookVMPlugin = (context)=>({
|
|
3
3
|
["virtual-search-hooks"]: ()=>{
|
|
4
4
|
const { config } = context;
|
|
5
|
-
let content = 'export
|
|
5
|
+
let content = 'export {};';
|
|
6
6
|
const searchHooks = 'object' == typeof config.search && config.search?.searchHooks;
|
|
7
7
|
if (searchHooks) content = `export * from ${JSON.stringify(node_path.posix.normalize(searchHooks))}`;
|
|
8
8
|
return content;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getIconUrlPath } from "../../../
|
|
1
|
+
import { getIconUrlPath } from "../../../h~0.js";
|
|
2
2
|
import { normalizeThemeConfig } from "./normalizeThemeConfig.js";
|
|
3
3
|
async function createSiteData(userConfig) {
|
|
4
4
|
const tempSearchObj = Object.assign({}, userConfig.search);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isExternalUrl, slash, addLeadingSlash, normalizeHref } from "../../../
|
|
1
|
+
import { isExternalUrl, slash, addLeadingSlash, normalizeHref } from "../../../h~0.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 "../../../h~0.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
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { withSiteOrigin, stat, logger, withBase } from "../tu~0.js";
|
|
2
|
+
import { glob } from "../h~0.js";
|
|
3
|
+
import { routePath2HtmlFileName } from "./ssg/htmlFile.js";
|
|
4
|
+
function ensureTrailingSlash(url) {
|
|
5
|
+
return url.endsWith('/') ? url : `${url}/`;
|
|
6
|
+
}
|
|
7
|
+
function normalizeSiteUrl(siteUrl) {
|
|
8
|
+
try {
|
|
9
|
+
const url = new URL(siteUrl);
|
|
10
|
+
if (![
|
|
11
|
+
'http:',
|
|
12
|
+
'https:'
|
|
13
|
+
].includes(url.protocol) || url.href.includes('?') || url.href.includes('#')) throw new Error('Expected an HTTP(S) URL without a query or fragment.');
|
|
14
|
+
url.pathname = ensureTrailingSlash(url.pathname);
|
|
15
|
+
return url.href;
|
|
16
|
+
} catch {
|
|
17
|
+
throw new Error('[sitemap] `sitemap.siteUrl` must be an absolute HTTP(S) URL without a query or fragment, such as `https://example.com/base/`.');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function getSiteUrl(siteUrl, config) {
|
|
21
|
+
if (siteUrl) return normalizeSiteUrl(siteUrl);
|
|
22
|
+
const base = withBase('/', config.base ?? '/');
|
|
23
|
+
try {
|
|
24
|
+
return config.siteOrigin ? withSiteOrigin(base, config.siteOrigin) : encodeURI(base);
|
|
25
|
+
} catch {
|
|
26
|
+
throw new Error('[sitemap] `siteOrigin` in rspress.config.ts must be a valid absolute URL origin with protocol, such as `https://example.com`.');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const generateNode = (sitemap)=>{
|
|
30
|
+
let result = '<url>';
|
|
31
|
+
for (const [tag, value] of Object.entries(sitemap)){
|
|
32
|
+
const escaped = String(value).replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"').replaceAll("'", ''');
|
|
33
|
+
result += `<${tag}>${escaped}</${tag}>`;
|
|
34
|
+
}
|
|
35
|
+
result += '</url>';
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
const generateXml = (sitemaps)=>{
|
|
39
|
+
logger.info(`Generate sitemap.xml for ${sitemaps.length} pages.`);
|
|
40
|
+
return `<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">${sitemaps.reduce((node, sitemap)=>node + generateNode(sitemap), '')}</urlset>`;
|
|
41
|
+
};
|
|
42
|
+
function pluginSitemap() {
|
|
43
|
+
let options;
|
|
44
|
+
const sitemaps = [];
|
|
45
|
+
const set = new Set();
|
|
46
|
+
let resolvedSiteUrl = '';
|
|
47
|
+
let cleanUrls = false;
|
|
48
|
+
return {
|
|
49
|
+
name: 'rspress:sitemap',
|
|
50
|
+
builderConfig: {
|
|
51
|
+
plugins: [
|
|
52
|
+
{
|
|
53
|
+
name: 'rspress:sitemap-output',
|
|
54
|
+
setup (api) {
|
|
55
|
+
api.processAssets({
|
|
56
|
+
stage: 'additional',
|
|
57
|
+
environments: [
|
|
58
|
+
'web'
|
|
59
|
+
]
|
|
60
|
+
}, async ({ compilation, sources })=>{
|
|
61
|
+
if (!options || compilation.errors.length) return;
|
|
62
|
+
for (const publicDir of api.getNormalizedConfig().server.publicDir){
|
|
63
|
+
if (false === publicDir.copyOnBuild) continue;
|
|
64
|
+
const files = await glob('sitemap.xml', {
|
|
65
|
+
cwd: publicDir.name,
|
|
66
|
+
ignore: publicDir.ignore
|
|
67
|
+
});
|
|
68
|
+
if (files.length) return void logger.warn('[sitemap] Preserving public sitemap.xml.');
|
|
69
|
+
}
|
|
70
|
+
compilation.emitAsset('sitemap.xml', new sources.RawSource(generateXml(sitemaps)));
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
beforeBuild (config, isProd) {
|
|
77
|
+
sitemaps.length = 0;
|
|
78
|
+
set.clear();
|
|
79
|
+
options = isProd && config.sitemap ? 'object' == typeof config.sitemap ? config.sitemap : {} : void 0;
|
|
80
|
+
if (options) {
|
|
81
|
+
resolvedSiteUrl = getSiteUrl(options.siteUrl, config);
|
|
82
|
+
cleanUrls = config.route?.cleanUrls ?? false;
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
async extendPageData (pageData, isProd) {
|
|
86
|
+
if (isProd && options) {
|
|
87
|
+
if (!set.has(pageData.routePath)) {
|
|
88
|
+
set.add(pageData.routePath);
|
|
89
|
+
const pathname = cleanUrls ? pageData.routePath : `/${routePath2HtmlFileName(pageData.routePath)}`;
|
|
90
|
+
const encodedPath = pathname.split('/').map(encodeURIComponent).join('/');
|
|
91
|
+
sitemaps.push({
|
|
92
|
+
loc: `${resolvedSiteUrl.replace(/\/$/, '')}${encodedPath}`,
|
|
93
|
+
lastmod: (await stat(pageData._filepath)).mtime.toISOString(),
|
|
94
|
+
priority: '/' === pageData.routePath ? '1.0' : options.defaultPriority ?? '0.5',
|
|
95
|
+
changefreq: options.defaultChangeFreq ?? 'monthly',
|
|
96
|
+
...options.customMaps?.[pageData.routePath] ?? {}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
export { pluginSitemap };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeHref, removeTrailingSlash, addLeadingSlash, normalizePosixPath, withSiteOrigin } from "../../
|
|
1
|
+
import { normalizeHref, removeTrailingSlash, addLeadingSlash, normalizePosixPath, withSiteOrigin } from "../../h~0.js";
|
|
2
2
|
function createAlternateLinksByRoute(routes, config) {
|
|
3
3
|
const routeGroups = new Map();
|
|
4
4
|
for (const route of routes){
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { external_node_path_resolve, relative, isAbsolute } from "../../
|
|
1
|
+
import { external_node_path_resolve, relative, isAbsolute } from "../../b~0.js";
|
|
2
2
|
const routePath2HtmlFileName = (routePath)=>{
|
|
3
3
|
let fileName = routePath;
|
|
4
4
|
fileName = fileName.endsWith('/') ? `${routePath}index.html` : `${routePath}.html`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { posix } from "../../
|
|
1
|
+
import { posix } from "../../b~0.js";
|
|
2
2
|
import { META_GENERATOR, RSPRESS_VERSION, APP_HTML_MARKER, HEAD_MARKER } from "../constants.js";
|
|
3
3
|
import { routePath2HtmlFileName } from "./htmlFile.js";
|
|
4
4
|
import { createError } from "../utils/error.js";
|
|
@@ -23,11 +23,12 @@ async function renderHtmlTemplate(htmlTemplate, head, route, appHtml = '', alter
|
|
|
23
23
|
href
|
|
24
24
|
})}>`).join('');
|
|
25
25
|
const routePreloadLinks = renderRoutePreloadLinks(route, routeChunkAssets);
|
|
26
|
-
const
|
|
26
|
+
const headHtml = [
|
|
27
27
|
routePreloadLinks,
|
|
28
28
|
await renderConfigHead(head, route),
|
|
29
29
|
alternateLinkTags
|
|
30
|
-
].join('')
|
|
30
|
+
].join('');
|
|
31
|
+
const replacedHtmlTemplate = htmlTemplate.replace(APP_HTML_MARKER, ()=>appHtml).replace(META_GENERATOR, ()=>`<meta name="generator" content="Rspress v${RSPRESS_VERSION}">`).replace(HEAD_MARKER, ()=>headHtml);
|
|
31
32
|
return replacedHtmlTemplate;
|
|
32
33
|
}
|
|
33
34
|
function renderRoutePreloadLinks(route, manifest) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
|
|
2
2
|
import "../../t~0.js";
|
|
3
|
-
import { createHead, logger, transformHtmlTemplate, pathToFileURL } from "../../
|
|
3
|
+
import { createHead, logger, transformHtmlTemplate, pathToFileURL } from "../../b~0.js";
|
|
4
4
|
import { hintSSGFailed } from "../logger/hint.js";
|
|
5
5
|
import { renderHtmlTemplate } from "./renderHtmlTemplate.js";
|
|
6
6
|
const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|