@rspress/core 2.0.0-rc.0 → 2.0.0-rc.2
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 +1 -1
- package/dist/0~7675.989ee664.js +1791 -0
- package/dist/1218.3869bad6.js +2 -0
- package/dist/4669.12208c6a.js +2 -0
- package/dist/5313.6594aba0.js +63 -0
- package/dist/5485.2a0273cf.js +98 -0
- package/dist/6289.c67fe0d5.js +5 -0
- package/dist/7805.cadab34e.js +4 -0
- package/dist/8813.9da1f210.js +2 -0
- package/dist/cli/config/index.js +4 -0
- package/dist/cli/config/loadConfigFile.js +30 -0
- package/dist/cli/index.cb89dbd1.js +3 -0
- package/dist/cli/index.js +122 -0
- package/dist/eject-theme/components/Banner/index.tsx +3 -4
- package/dist/eject-theme/components/Button/index.scss +1 -6
- package/dist/eject-theme/components/Callout/index.scss +0 -2
- package/dist/eject-theme/components/CodeBlock/index.scss +4 -12
- package/dist/eject-theme/components/CodeBlock/index.tsx +6 -1
- package/dist/eject-theme/components/CodeButtonGroup/CopyCodeButton.tsx +1 -3
- package/dist/eject-theme/components/CodeButtonGroup/index.scss +5 -1
- package/dist/eject-theme/components/CodeButtonGroup/index.tsx +1 -3
- package/dist/eject-theme/components/DocContent/doc.scss +30 -9
- package/dist/eject-theme/components/DocContent/docComponents/table.tsx +10 -4
- package/dist/eject-theme/components/DocContent/index.tsx +5 -2
- package/dist/eject-theme/components/{DocContent/FallbackHeading.tsx → FallbackHeading/index.tsx} +20 -11
- package/dist/eject-theme/components/HoverGroup/index.scss +5 -1
- package/dist/eject-theme/components/HoverGroup/index.tsx +5 -1
- package/dist/eject-theme/components/Link/index.tsx +43 -9
- package/dist/eject-theme/components/Link/useLinkNavigate.ts +32 -16
- package/dist/eject-theme/components/Nav/NavMenu.scss +1 -0
- package/dist/eject-theme/components/Nav/NavMenu.tsx +2 -3
- package/dist/eject-theme/components/Nav/NavTitle.scss +11 -0
- package/dist/eject-theme/components/Nav/NavTitle.tsx +1 -0
- package/dist/eject-theme/components/Nav/index.scss +0 -8
- package/dist/eject-theme/components/NavHamburger/index.tsx +3 -4
- package/dist/eject-theme/components/NavScreen/NavScreenMenuItem.scss +14 -0
- package/dist/eject-theme/components/NavScreen/NavScreenMenuItem.tsx +2 -3
- package/dist/eject-theme/components/Outline/index.scss +0 -1
- package/dist/eject-theme/components/Overview/OverviewGroup.tsx +1 -2
- package/dist/eject-theme/components/Overview/index.tsx +6 -2
- package/dist/eject-theme/components/PackageManagerTabs/index.tsx +12 -0
- package/dist/eject-theme/components/PrevNextPage/index.tsx +6 -3
- package/dist/eject-theme/components/Root/index.tsx +58 -0
- package/dist/eject-theme/components/Search/NoSearchResult.tsx +2 -3
- package/dist/eject-theme/components/Search/SearchButton.tsx +3 -4
- package/dist/eject-theme/components/Search/SearchPanel.tsx +14 -9
- package/dist/eject-theme/components/Search/SuggestItem.tsx +15 -12
- package/dist/eject-theme/components/Sidebar/SidebarGroup.tsx +2 -3
- package/dist/eject-theme/components/Sidebar/SidebarItem.scss +12 -8
- package/dist/eject-theme/components/Sidebar/SidebarItem.tsx +6 -4
- package/dist/eject-theme/components/Sidebar/SidebarSectionHeader.scss +1 -1
- package/dist/eject-theme/components/SidebarMenu/index.tsx +4 -4
- package/dist/eject-theme/components/SocialLinks/index.tsx +2 -3
- package/dist/eject-theme/components/SourceCode/index.scss +2 -1
- package/dist/eject-theme/components/SourceCode/index.tsx +6 -4
- package/dist/eject-theme/components/SwitchAppearance/index.tsx +3 -5
- package/dist/eject-theme/components/Tabs/index.scss +19 -22
- package/dist/eject-theme/components/Toc/TocItem.scss +8 -4
- package/dist/eject-theme/components/Toc/TocItem.tsx +1 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +16 -3134
- package/dist/node/PluginDriver.d.ts +1 -1
- package/dist/node/PluginDriver.js +143 -0
- package/dist/node/auto-nav-sidebar/index.js +44 -0
- package/dist/node/auto-nav-sidebar/locales.js +26 -0
- package/dist/node/auto-nav-sidebar/normalize.js +228 -0
- package/dist/node/auto-nav-sidebar/utils.js +68 -0
- package/dist/node/auto-nav-sidebar/walk.js +67 -0
- package/dist/node/build.js +31 -0
- package/dist/node/constants.d.ts +1 -0
- package/dist/node/constants.js +33 -0
- package/dist/node/dev.js +32 -0
- package/dist/node/eject.js +111 -0
- package/dist/node/index.d.ts +5 -5
- package/dist/node/initRsbuild.d.ts +2 -2
- package/dist/node/initRsbuild.js +338 -0
- package/dist/node/last-updated/index.js +28 -0
- package/dist/node/logger/hint.d.ts +1 -1
- package/dist/node/logger/hint.js +85 -0
- package/dist/node/mdx/loader.d.ts +1 -1
- package/dist/node/mdx/loader.e1578c62.js +13 -0
- package/dist/{loader.js → node/mdx/loader.js} +2 -2
- package/dist/node/mdx/options.d.ts +2 -2
- package/dist/node/mdx/options.js +100 -0
- package/dist/node/mdx/processor.d.ts +2 -2
- package/dist/node/mdx/processor.js +71 -0
- package/dist/node/mdx/rehypePlugins/codeMeta.js +10 -0
- package/dist/node/mdx/rehypePlugins/headerAnchor.js +53 -0
- package/dist/node/mdx/rehypePlugins/shiki.js +34 -0
- package/dist/node/mdx/rehypePlugins/transformers/add-lang.js +15 -0
- package/dist/node/mdx/rehypePlugins/transformers/add-line-numbers.js +22 -0
- package/dist/node/mdx/rehypePlugins/transformers/add-title.js +24 -0
- package/dist/node/mdx/rehypePlugins/transformers/add-wrap-code.js +22 -0
- package/dist/node/mdx/rehypePlugins/transformers/index.d.ts +5 -5
- package/dist/node/mdx/rehypePlugins/transformers/index.js +5 -0
- package/dist/node/mdx/rehypePlugins/transformers/meta-highlight.js +41 -0
- package/dist/node/mdx/remarkPlugins/builtin.js +11 -0
- package/dist/node/mdx/remarkPlugins/containerSyntax.js +190 -0
- package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +66 -0
- package/dist/node/mdx/remarkPlugins/image.js +67 -0
- package/dist/node/mdx/remarkPlugins/link.d.ts +1 -1
- package/dist/node/mdx/remarkPlugins/link.js +99 -0
- package/dist/node/mdx/remarkPlugins/toc.js +50 -0
- package/dist/node/mdx/types.d.ts +3 -3
- package/dist/node/medium-zoom/index.d.ts +1 -1
- package/dist/node/medium-zoom/index.js +14 -0
- package/dist/node/route/RoutePage.d.ts +1 -1
- package/dist/node/route/RoutePage.js +61 -0
- package/dist/node/route/RouteService.d.ts +1 -1
- package/dist/node/route/RouteService.js +177 -0
- package/dist/node/route/extractPageData.d.ts +1 -1
- package/dist/node/route/extractPageData.js +112 -0
- package/dist/node/route/normalizeRoutePath.js +54 -0
- package/dist/node/runtimeModule/DEFAULT_I18N_TEXT.d.ts +21 -0
- package/dist/node/runtimeModule/DEFAULT_I18N_TEXT.js +150 -0
- package/dist/node/runtimeModule/globalStyles.d.ts +1 -1
- package/dist/node/runtimeModule/globalStyles.js +12 -0
- package/dist/node/runtimeModule/globalUIComponents.d.ts +1 -1
- package/dist/node/runtimeModule/globalUIComponents.js +25 -0
- package/dist/node/runtimeModule/i18n.d.ts +2 -2
- package/dist/node/runtimeModule/i18n.js +83 -0
- package/dist/node/runtimeModule/pageData/createPageData.d.ts +1 -1
- package/dist/node/runtimeModule/pageData/createPageData.js +64 -0
- package/dist/node/runtimeModule/pageData/rsbuildPlugin.d.ts +1 -1
- package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +51 -0
- package/dist/node/runtimeModule/routeList.d.ts +1 -1
- package/dist/node/runtimeModule/routeList.js +7 -0
- package/dist/node/runtimeModule/searchHooks.d.ts +1 -1
- package/dist/node/runtimeModule/searchHooks.js +11 -0
- package/dist/node/runtimeModule/siteData/createSiteData.js +34 -0
- package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +94 -0
- package/dist/node/runtimeModule/siteData/rsbuildPlugin.d.ts +1 -1
- package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +24 -0
- package/dist/node/runtimeModule/socialLinks.d.ts +1 -1
- package/dist/node/runtimeModule/socialLinks.js +8 -0
- package/dist/node/runtimeModule/types.d.ts +2 -2
- package/dist/node/serve.js +23 -0
- package/dist/node/ssg/renderHtmlTemplate.js +33 -0
- package/dist/node/ssg/renderPage.js +34 -0
- package/dist/node/ssg/renderPageWorker.474f9f73.js +2 -0
- package/dist/node/ssg/renderPageWorker.js +15 -0
- package/dist/node/ssg/renderPages.d.ts +1 -1
- package/dist/node/ssg/renderPages.js +105 -0
- package/dist/node/ssg/renderPages.js.LICENSE.txt +4 -0
- package/dist/node/ssg/rsbuildPluginCSR.d.ts +1 -1
- package/dist/node/ssg/rsbuildPluginCSR.js +27 -0
- package/dist/node/ssg/rsbuildPluginSSG.d.ts +1 -1
- package/dist/node/ssg/rsbuildPluginSSG.js +72 -0
- package/dist/node/ssg/ssgEnv.js +33 -0
- package/dist/node/ssg/ssgEnv.js.LICENSE.txt +5 -0
- package/dist/node/ssg-md/llms/emitLlmsTxt.d.ts +1 -1
- package/dist/node/ssg-md/llms/emitLlmsTxt.js +80 -0
- package/dist/node/ssg-md/llms/llmsTxt.d.ts +1 -1
- package/dist/node/ssg-md/llms/llmsTxt.js +66 -0
- package/dist/node/ssg-md/react/index.d.ts +1 -1
- package/dist/node/ssg-md/remarkSplitMdx.js +202 -0
- package/dist/node/ssg-md/renderPage.js +31 -0
- package/dist/node/ssg-md/renderPages.d.ts +1 -1
- package/dist/node/ssg-md/renderPages.js +27 -0
- package/dist/node/ssg-md/rsbuildPluginSSGMD.d.ts +1 -1
- package/dist/node/ssg-md/rsbuildPluginSSGMD.js +47 -0
- package/dist/node/utils/applyReplaceRules.js +6 -0
- package/dist/node/utils/checkLanguageParity.js +77 -0
- package/dist/node/utils/createHash.js +5 -0
- package/dist/node/utils/error.d.ts +9 -0
- package/dist/node/utils/error.js +9 -0
- package/dist/node/utils/escapeHeadingIds.js +5 -0
- package/dist/node/utils/flattenMdxContent.js +74 -0
- package/dist/node/utils/fs.js +14 -0
- package/dist/node/utils/getImportAstNode.js +63 -0
- package/dist/node/utils/getPageKey.js +6 -0
- package/dist/node/utils/getSocialIcons.js +32 -0
- package/dist/node/utils/index.d.ts +10 -9
- package/dist/node/utils/normalizePath.js +10 -0
- package/dist/node/utils/reactAlias.d.ts +2 -0
- package/dist/node/utils/reactAlias.js +83 -0
- package/dist/rslib-runtime.99091bf6.js +18 -0
- package/dist/runtime/App.js +2 -2
- package/dist/runtime/ClientApp.d.ts +1 -1
- package/dist/runtime/ClientApp.js +0 -4
- package/dist/runtime/ssrMdServerEntry.js +1 -1
- package/dist/runtime/ssrServerEntry.js +2 -1
- package/dist/runtime.72d450ac.js +1 -0
- package/dist/runtime.js +3 -2
- package/dist/shiki-transformers.d.ts +1 -1
- package/dist/shiki-transformers.js +6 -120
- package/dist/theme/assets/moon.js +9 -26
- package/dist/theme/components/Banner/index.d.ts +1 -1
- package/dist/theme/components/Banner/index.js +2 -3
- package/dist/theme/components/Button/index.css +1 -1
- package/dist/theme/components/Callout/index.css +0 -2
- package/dist/theme/components/CodeBlock/index.css +4 -15
- package/dist/theme/components/CodeBlock/index.js +1 -0
- package/dist/theme/components/CodeButtonGroup/CopyCodeButton.js +3 -5
- package/dist/theme/components/CodeButtonGroup/index.css +5 -1
- package/dist/theme/components/CodeButtonGroup/index.js +3 -5
- package/dist/theme/components/DocContent/doc.css +30 -8
- package/dist/theme/components/DocContent/docComponents/index.d.ts +3 -3
- package/dist/theme/components/DocContent/docComponents/table.d.ts +2 -2
- package/dist/theme/components/DocContent/docComponents/table.js +8 -3
- package/dist/theme/components/DocContent/index.js +3 -2
- package/dist/theme/components/{DocContent/FallbackHeading.js → FallbackHeading/index.js} +19 -11
- package/dist/theme/components/HoverGroup/index.css +5 -1
- package/dist/theme/components/HoverGroup/index.js +1 -0
- package/dist/theme/components/HoverGroup/useHoverGroup.d.ts +1 -1
- package/dist/theme/components/Link/index.d.ts +18 -1
- package/dist/theme/components/Link/index.js +14 -8
- package/dist/theme/components/Link/useLinkNavigate.d.ts +4 -1
- package/dist/theme/components/Link/useLinkNavigate.js +23 -17
- package/dist/theme/components/Nav/NavMenu.css +1 -0
- package/dist/theme/components/Nav/NavMenu.js +2 -3
- package/dist/theme/components/Nav/NavTitle.css +12 -0
- package/dist/theme/components/Nav/NavTitle.d.ts +1 -0
- package/dist/theme/components/Nav/NavTitle.js +1 -0
- package/dist/theme/components/Nav/index.css +0 -8
- package/dist/theme/components/NavHamburger/index.js +3 -4
- package/dist/theme/components/NavScreen/NavScreenMenuItem.css +9 -0
- package/dist/theme/components/NavScreen/NavScreenMenuItem.js +2 -3
- package/dist/theme/components/Outline/index.css +0 -1
- package/dist/theme/components/Overview/OverviewGroup.js +1 -2
- package/dist/theme/components/Overview/index.js +1 -2
- package/dist/theme/components/PackageManagerTabs/index.d.ts +1 -1
- package/dist/theme/components/PackageManagerTabs/index.js +4 -0
- package/dist/theme/components/PrevNextPage/index.js +3 -4
- package/dist/theme/components/Root/index.d.ts +54 -0
- package/dist/theme/components/Root/index.js +7 -0
- package/dist/theme/components/Search/NoSearchResult.js +2 -3
- package/dist/theme/components/Search/SearchButton.js +3 -4
- package/dist/theme/components/Search/SearchPanel.js +13 -16
- package/dist/theme/components/Search/SuggestItem.d.ts +1 -1
- package/dist/theme/components/Search/SuggestItem.js +7 -11
- package/dist/theme/components/Search/logic/Provider.d.ts +1 -1
- package/dist/theme/components/Search/logic/providers/LocalProvider.d.ts +2 -2
- package/dist/theme/components/Search/logic/search.d.ts +1 -1
- package/dist/theme/components/Sidebar/SidebarGroup.js +2 -3
- package/dist/theme/components/Sidebar/SidebarItem.css +11 -3
- package/dist/theme/components/Sidebar/SidebarItem.js +6 -3
- package/dist/theme/components/Sidebar/SidebarSectionHeader.css +1 -1
- package/dist/theme/components/SidebarMenu/index.js +3 -5
- package/dist/theme/components/SocialLinks/index.js +2 -3
- package/dist/theme/components/SourceCode/index.css +5 -0
- package/dist/theme/components/SourceCode/index.js +2 -4
- package/dist/theme/components/SwitchAppearance/index.js +3 -5
- package/dist/theme/components/Tabs/index.css +13 -22
- package/dist/theme/components/Toc/TocItem.css +7 -4
- package/dist/theme/components/Toc/TocItem.js +1 -0
- package/dist/theme/icons.d.ts +25 -0
- package/dist/theme/icons.js +47 -0
- package/dist/theme/index.d.ts +62 -59
- package/dist/theme/index.js +5 -2
- package/dist/theme/layout/DocLayout/index.css +2 -2
- package/dist/theme/layout/DocLayout/index.js +1 -4
- package/dist/theme/layout/Layout/index.d.ts +1 -1
- package/dist/theme/layout/Layout/index.js +3 -3
- package/dist/theme/logic/useFullTextSearch.d.ts +1 -1
- package/dist/theme/logic/useScrollAfterNav.d.ts +5 -0
- package/dist/theme/logic/{sideEffects.js → useScrollAfterNav.js} +5 -6
- package/dist/theme/logic/useScrollReset.d.ts +5 -0
- package/dist/theme/logic/useScrollReset.js +12 -0
- package/dist/theme/logic/useSetup.js +2 -0
- package/dist/theme/styles/base.css +1 -10
- package/dist/theme/styles/index.d.ts +1 -1
- package/dist/theme/styles/index.js +1 -1
- package/dist/theme/styles/scrollbar.css +1 -0
- package/dist/theme/styles/vars/base-vars.css +5 -3
- package/dist/theme/styles/vars/home-vars.css +4 -2
- package/package.json +19 -20
- package/dist/3~101.js +0 -1786
- package/dist/3~335.js +0 -26
- package/dist/3~395.js +0 -74
- package/dist/cli.js +0 -259
- package/dist/index.js.LICENSE.txt +0 -10
- package/dist/node/auto-nav-sidebar/fixtures/docs/guide/c.d.ts +0 -2
- package/dist/node/auto-nav-sidebar/fixtures/docs-locales/en/guide/c.d.ts +0 -2
- package/dist/node/auto-nav-sidebar/fixtures/docs-locales/zh/guide/c.d.ts +0 -2
- package/dist/node/auto-nav-sidebar/locales.test.d.ts +0 -1
- package/dist/node/auto-nav-sidebar/walk.test.d.ts +0 -1
- package/dist/node/mdx/rehypePlugins/headerAnchor.test.d.ts +0 -1
- package/dist/node/mdx/remarkPlugins/containerSyntax.test.d.ts +0 -1
- package/dist/node/mdx/remarkPlugins/fileCodeBlock.test.d.ts +0 -1
- package/dist/node/mdx/remarkPlugins/image.test.d.ts +0 -1
- package/dist/node/mdx/remarkPlugins/link.test.d.ts +0 -1
- package/dist/node/route/RouteService.test.d.ts +0 -1
- package/dist/node/route/extractPageData.test.d.ts +0 -1
- package/dist/node/route/fixtures/basic/guide/c.d.ts +0 -2
- package/dist/node/route/normalizeRoutePath.test.d.ts +0 -1
- package/dist/node/runtimeModule/i18n.test.d.ts +0 -1
- package/dist/node/ssg-md/remarkSplitMdx.test.d.ts +0 -4
- package/dist/node/utils/checkLanguageParity.test.d.ts +0 -1
- package/dist/node/utils/detectCustomIcon.d.ts +0 -1
- package/dist/node/utils/detectReactVersion.d.ts +0 -3
- package/dist/processor.js +0 -4539
- package/dist/renderPageWorker.js +0 -196
- package/dist/theme/components/Search/logic/util.test.d.ts +0 -1
- /package/dist/cli/{config.d.ts → config/index.d.ts} +0 -0
- /package/dist/{shiki-transformers.js.LICENSE.txt → node/mdx/rehypePlugins/transformers/meta-highlight.js.LICENSE.txt} +0 -0
- /package/dist/theme/components/{DocContent/FallbackHeading.d.ts → FallbackHeading/index.d.ts} +0 -0
- /package/dist/theme/logic/{sideEffects.d.ts → useSetup.d.ts} +0 -0
package/dist/3~335.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export const __webpack_id__ = "335";
|
|
2
|
-
export const __webpack_ids__ = [
|
|
3
|
-
"335"
|
|
4
|
-
];
|
|
5
|
-
export const __webpack_modules__ = {
|
|
6
|
-
"./src/node/medium-zoom/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
7
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
8
|
-
pluginMediumZoom: ()=>pluginMediumZoom
|
|
9
|
-
});
|
|
10
|
-
var node_path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:path");
|
|
11
|
-
var node_url__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("node:url");
|
|
12
|
-
var _rspress_shared__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("@rspress/shared");
|
|
13
|
-
function pluginMediumZoom(options = {}) {
|
|
14
|
-
const __dirname = (0, _rspress_shared__WEBPACK_IMPORTED_MODULE_2__.normalizePosixPath)(node_path__WEBPACK_IMPORTED_MODULE_0__["default"].dirname((0, node_url__WEBPACK_IMPORTED_MODULE_1__.fileURLToPath)(import.meta.url)));
|
|
15
|
-
return {
|
|
16
|
-
name: '@rspress/plugin-medium-zoom',
|
|
17
|
-
globalUIComponents: [
|
|
18
|
-
[
|
|
19
|
-
node_path__WEBPACK_IMPORTED_MODULE_0__["default"].join(__dirname, '../static/MediumZoom.tsx'),
|
|
20
|
-
options
|
|
21
|
-
]
|
|
22
|
-
]
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
};
|
package/dist/3~395.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import * as __WEBPACK_EXTERNAL_MODULE_child_process__ from "child_process";
|
|
2
|
-
import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
|
|
3
|
-
import * as __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__ from "node:buffer";
|
|
4
|
-
import * as __WEBPACK_EXTERNAL_MODULE_node_child_process_27f17141__ from "node:child_process";
|
|
5
|
-
import * as __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__ from "node:process";
|
|
6
|
-
import * as __WEBPACK_EXTERNAL_MODULE_node_timers_promises_aedbf14c__ from "node:timers/promises";
|
|
7
|
-
import * as __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__ from "node:util";
|
|
8
|
-
import * as __WEBPACK_EXTERNAL_MODULE_path__ from "path";
|
|
9
|
-
import * as __WEBPACK_EXTERNAL_MODULE_stream__ from "stream";
|
|
10
|
-
export const __webpack_id__ = "395";
|
|
11
|
-
export const __webpack_ids__ = [
|
|
12
|
-
"395"
|
|
13
|
-
];
|
|
14
|
-
export const __webpack_modules__ = {
|
|
15
|
-
"./src/node/last-updated/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
16
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
17
|
-
pluginLastUpdated: ()=>pluginLastUpdated
|
|
18
|
-
});
|
|
19
|
-
var execa__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/index.js");
|
|
20
|
-
function transform(timestamp, lang) {
|
|
21
|
-
return new Date(timestamp).toLocaleString(lang || 'zh');
|
|
22
|
-
}
|
|
23
|
-
async function getGitLastUpdatedTimeStamp(filePath) {
|
|
24
|
-
let lastUpdated;
|
|
25
|
-
try {
|
|
26
|
-
const { stdout } = await (0, execa__WEBPACK_IMPORTED_MODULE_0__.Ho)('git', [
|
|
27
|
-
'log',
|
|
28
|
-
'-1',
|
|
29
|
-
'--format=%at',
|
|
30
|
-
filePath
|
|
31
|
-
]);
|
|
32
|
-
lastUpdated = 1000 * Number(stdout);
|
|
33
|
-
} catch (_e) {}
|
|
34
|
-
return lastUpdated;
|
|
35
|
-
}
|
|
36
|
-
function pluginLastUpdated() {
|
|
37
|
-
return {
|
|
38
|
-
name: '@rspress/plugin-last-updated',
|
|
39
|
-
async extendPageData (pageData) {
|
|
40
|
-
const { _filepath, lang } = pageData;
|
|
41
|
-
const lastUpdated = await getGitLastUpdatedTimeStamp(_filepath);
|
|
42
|
-
if (lastUpdated) pageData.lastUpdatedTime = transform(lastUpdated, lang);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
child_process: function(module) {
|
|
48
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_child_process__;
|
|
49
|
-
},
|
|
50
|
-
fs: function(module) {
|
|
51
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_fs__;
|
|
52
|
-
},
|
|
53
|
-
"node:buffer": function(module) {
|
|
54
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__;
|
|
55
|
-
},
|
|
56
|
-
"node:child_process": function(module) {
|
|
57
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_node_child_process_27f17141__;
|
|
58
|
-
},
|
|
59
|
-
"node:process": function(module) {
|
|
60
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__;
|
|
61
|
-
},
|
|
62
|
-
"node:timers/promises": function(module) {
|
|
63
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_node_timers_promises_aedbf14c__;
|
|
64
|
-
},
|
|
65
|
-
"node:util": function(module) {
|
|
66
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__;
|
|
67
|
-
},
|
|
68
|
-
path: function(module) {
|
|
69
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_path__;
|
|
70
|
-
},
|
|
71
|
-
stream: function(module) {
|
|
72
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_stream__;
|
|
73
|
-
}
|
|
74
|
-
};
|
package/dist/cli.js
DELETED
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
import node_path from "node:path";
|
|
2
|
-
import { logger } from "@rspress/shared/logger";
|
|
3
|
-
import { cac } from "cac";
|
|
4
|
-
import chokidar from "chokidar";
|
|
5
|
-
import picocolors from "picocolors";
|
|
6
|
-
import promises from "node:fs/promises";
|
|
7
|
-
import { fileURLToPath } from "node:url";
|
|
8
|
-
import { build, dev, serve } from "./index.js";
|
|
9
|
-
import node_fs from "node:fs";
|
|
10
|
-
import { DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME } from "@rspress/shared/constants";
|
|
11
|
-
var package_namespaceObject = {
|
|
12
|
-
rE: "2.0.0-rc.0"
|
|
13
|
-
};
|
|
14
|
-
const eject_filename = fileURLToPath(import.meta.url);
|
|
15
|
-
const eject_dirname = node_path.dirname(eject_filename);
|
|
16
|
-
let _themeComponentsPathOverride;
|
|
17
|
-
function getThemeComponentsPath() {
|
|
18
|
-
if (_themeComponentsPathOverride) return _themeComponentsPathOverride;
|
|
19
|
-
return node_path.join(eject_dirname, 'eject-theme/components');
|
|
20
|
-
}
|
|
21
|
-
async function getAvailableComponents() {
|
|
22
|
-
return [
|
|
23
|
-
'Banner',
|
|
24
|
-
'Badge',
|
|
25
|
-
'Callout',
|
|
26
|
-
'DocFooter',
|
|
27
|
-
'HomeFeature',
|
|
28
|
-
'HomeHero',
|
|
29
|
-
'HomeBackground',
|
|
30
|
-
'HomeFooter',
|
|
31
|
-
'Toc',
|
|
32
|
-
'Tabs',
|
|
33
|
-
'PackageManagerTabs',
|
|
34
|
-
'PrevNextPage',
|
|
35
|
-
'Overview',
|
|
36
|
-
'SocialLinks',
|
|
37
|
-
'Steps'
|
|
38
|
-
];
|
|
39
|
-
}
|
|
40
|
-
async function componentExists(componentName) {
|
|
41
|
-
const themePath = getThemeComponentsPath();
|
|
42
|
-
const componentPath = node_path.join(themePath, componentName);
|
|
43
|
-
try {
|
|
44
|
-
const stat = await promises.stat(componentPath);
|
|
45
|
-
return stat.isDirectory();
|
|
46
|
-
} catch {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
async function copyDir(src, dest) {
|
|
51
|
-
await promises.mkdir(dest, {
|
|
52
|
-
recursive: true
|
|
53
|
-
});
|
|
54
|
-
const entries = await promises.readdir(src, {
|
|
55
|
-
withFileTypes: true
|
|
56
|
-
});
|
|
57
|
-
for (const entry of entries){
|
|
58
|
-
const srcPath = node_path.join(src, entry.name);
|
|
59
|
-
const destPath = node_path.join(dest, entry.name);
|
|
60
|
-
if (entry.isDirectory()) await copyDir(srcPath, destPath);
|
|
61
|
-
else await promises.copyFile(srcPath, destPath);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
async function transformImports(filePath) {
|
|
65
|
-
const content = await promises.readFile(filePath, 'utf-8');
|
|
66
|
-
const transformed = content;
|
|
67
|
-
if (transformed !== content) await promises.writeFile(filePath, transformed, 'utf-8');
|
|
68
|
-
}
|
|
69
|
-
async function transformDirectory(dir) {
|
|
70
|
-
const entries = await promises.readdir(dir, {
|
|
71
|
-
withFileTypes: true
|
|
72
|
-
});
|
|
73
|
-
for (const entry of entries){
|
|
74
|
-
const fullPath = node_path.join(dir, entry.name);
|
|
75
|
-
if (entry.isDirectory()) await transformDirectory(fullPath);
|
|
76
|
-
else if (entry.name.endsWith('.ts') || entry.name.endsWith('.tsx')) await transformImports(fullPath);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
async function ejectComponent(componentName, cwd = process.cwd()) {
|
|
80
|
-
const exists = await componentExists(componentName);
|
|
81
|
-
if (!exists) {
|
|
82
|
-
logger.error(`Component ${picocolors.cyan(componentName)} not found in theme.`);
|
|
83
|
-
const available = await getAvailableComponents();
|
|
84
|
-
logger.info(`\nAvailable components:\n${available.map((c)=>` - ${c}`).join('\n')}`);
|
|
85
|
-
process.exit(1);
|
|
86
|
-
}
|
|
87
|
-
const themePath = getThemeComponentsPath();
|
|
88
|
-
const sourceComponentPath = node_path.join(themePath, componentName);
|
|
89
|
-
const destThemePath = node_path.join(cwd, 'theme', 'components');
|
|
90
|
-
const destComponentPath = node_path.join(destThemePath, componentName);
|
|
91
|
-
try {
|
|
92
|
-
await promises.access(destComponentPath);
|
|
93
|
-
logger.warn(`Component ${picocolors.cyan(componentName)} already exists in ${picocolors.yellow(node_path.relative(cwd, destComponentPath))}`);
|
|
94
|
-
logger.info('Overwriting existing component...');
|
|
95
|
-
} catch {}
|
|
96
|
-
try {
|
|
97
|
-
await promises.mkdir(destThemePath, {
|
|
98
|
-
recursive: true
|
|
99
|
-
});
|
|
100
|
-
await copyDir(sourceComponentPath, destComponentPath);
|
|
101
|
-
await transformDirectory(destComponentPath);
|
|
102
|
-
logger.success(`✨ Component ${picocolors.cyan(componentName)} ejected successfully!`);
|
|
103
|
-
logger.info(`Component files copied to: ${picocolors.green(node_path.relative(cwd, destComponentPath))}\nYou can now customize the component. To use it in your theme, you'll need to:\n 1. Re-export it in your custom \`theme/index.tsx\` file\n 2. Edit it by yourself`);
|
|
104
|
-
} catch (error) {
|
|
105
|
-
logger.error(`Failed to eject component: ${error}`);
|
|
106
|
-
throw error;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
async function listComponents() {
|
|
110
|
-
const components = await getAvailableComponents();
|
|
111
|
-
logger.info(`📦 Available components to eject:\n`);
|
|
112
|
-
components.forEach((component)=>{
|
|
113
|
-
logger.info(` ${picocolors.cyan('•')} ${component}`);
|
|
114
|
-
});
|
|
115
|
-
logger.info(`💡 Usage: ${picocolors.dim('rspress eject <ComponentName>')}\n`);
|
|
116
|
-
}
|
|
117
|
-
const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(node_fs.existsSync);
|
|
118
|
-
async function loadConfigFile(customConfigFile) {
|
|
119
|
-
const baseDir = process.cwd();
|
|
120
|
-
let configFilePath = '';
|
|
121
|
-
configFilePath = customConfigFile ? node_path.isAbsolute(customConfigFile) ? customConfigFile : node_path.join(baseDir, customConfigFile) : findConfig(node_path.join(baseDir, DEFAULT_CONFIG_NAME));
|
|
122
|
-
if (!configFilePath) {
|
|
123
|
-
logger.info(`No config file found in ${baseDir}`);
|
|
124
|
-
return {
|
|
125
|
-
config: {},
|
|
126
|
-
configFilePath: ''
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
const { loadConfig } = await import("@rsbuild/core");
|
|
130
|
-
const { content } = await loadConfig({
|
|
131
|
-
cwd: node_path.dirname(configFilePath),
|
|
132
|
-
path: configFilePath
|
|
133
|
-
});
|
|
134
|
-
return {
|
|
135
|
-
config: content,
|
|
136
|
-
configFilePath
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
function resolveDocRoot(cwd, cliRoot, configRoot) {
|
|
140
|
-
if (cliRoot) return node_path.join(cwd, cliRoot);
|
|
141
|
-
if (configRoot) return node_path.isAbsolute(configRoot) ? configRoot : node_path.join(cwd, configRoot);
|
|
142
|
-
return node_path.join(cwd, 'docs');
|
|
143
|
-
}
|
|
144
|
-
const CONFIG_FILES = [
|
|
145
|
-
'rspress.config.ts',
|
|
146
|
-
'rspress.config.js'
|
|
147
|
-
];
|
|
148
|
-
const META_FILES = [
|
|
149
|
-
'_meta.json',
|
|
150
|
-
'_nav.json'
|
|
151
|
-
];
|
|
152
|
-
const cli = cac('rspress').version(package_namespaceObject.rE).help();
|
|
153
|
-
const landingMessage = `🔥 Rspress v${package_namespaceObject.rE}\n`;
|
|
154
|
-
logger.greet(landingMessage);
|
|
155
|
-
const setNodeEnv = (env)=>{
|
|
156
|
-
process.env.NODE_ENV = env;
|
|
157
|
-
};
|
|
158
|
-
cli.option('-c,--config [config]', 'Specify the path to the config file');
|
|
159
|
-
cli.command('[root]', 'start dev server').alias('dev').option('--port [port]', 'port number').option('--host [host]', 'hostname').action(async (root, options)=>{
|
|
160
|
-
setNodeEnv('development');
|
|
161
|
-
let isRestarting = false;
|
|
162
|
-
const cwd = process.cwd();
|
|
163
|
-
let cliWatcher;
|
|
164
|
-
let devServer;
|
|
165
|
-
const startDevServer = async ()=>{
|
|
166
|
-
const { port, host } = options || {};
|
|
167
|
-
const { config, configFilePath } = await loadConfigFile(options?.config);
|
|
168
|
-
config.root = resolveDocRoot(cwd, root, config.root);
|
|
169
|
-
const docDirectory = config.root;
|
|
170
|
-
devServer = await dev({
|
|
171
|
-
appDirectory: cwd,
|
|
172
|
-
docDirectory,
|
|
173
|
-
config,
|
|
174
|
-
configFilePath,
|
|
175
|
-
extraBuilderConfig: {
|
|
176
|
-
server: {
|
|
177
|
-
port,
|
|
178
|
-
host
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
cliWatcher = chokidar.watch([
|
|
183
|
-
`${cwd}/**/{${CONFIG_FILES.join(',')}}`,
|
|
184
|
-
docDirectory
|
|
185
|
-
], {
|
|
186
|
-
ignoreInitial: true,
|
|
187
|
-
ignored: [
|
|
188
|
-
'**/node_modules/**',
|
|
189
|
-
'**/.git/**',
|
|
190
|
-
'**/.DS_Store/**'
|
|
191
|
-
]
|
|
192
|
-
});
|
|
193
|
-
cliWatcher.on('all', async (eventName, filepath)=>{
|
|
194
|
-
const basename = node_path.basename(filepath);
|
|
195
|
-
if ('change' === eventName && META_FILES.includes(basename)) return;
|
|
196
|
-
if ('add' === eventName || 'unlink' === eventName || 'change' === eventName && CONFIG_FILES.includes(basename)) {
|
|
197
|
-
if (isRestarting) return;
|
|
198
|
-
isRestarting = true;
|
|
199
|
-
console.log(`\n✨ ${eventName} ${picocolors.green(node_path.relative(cwd, filepath))}, dev server will restart...\n`);
|
|
200
|
-
await devServer.close();
|
|
201
|
-
await cliWatcher.close();
|
|
202
|
-
await startDevServer();
|
|
203
|
-
isRestarting = false;
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
};
|
|
207
|
-
await startDevServer();
|
|
208
|
-
const exitProcess = async ()=>{
|
|
209
|
-
try {
|
|
210
|
-
await devServer.close();
|
|
211
|
-
await cliWatcher.close();
|
|
212
|
-
} finally{
|
|
213
|
-
process.exit(0);
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
process.on('SIGINT', exitProcess);
|
|
217
|
-
process.on('SIGTERM', exitProcess);
|
|
218
|
-
});
|
|
219
|
-
cli.command('build [root]').action(async (root, options)=>{
|
|
220
|
-
setNodeEnv('production');
|
|
221
|
-
const cwd = process.cwd();
|
|
222
|
-
const { config, configFilePath } = await loadConfigFile(options.config);
|
|
223
|
-
config.root = resolveDocRoot(cwd, root, config.root);
|
|
224
|
-
const docDirectory = config.root;
|
|
225
|
-
try {
|
|
226
|
-
await build({
|
|
227
|
-
docDirectory,
|
|
228
|
-
config,
|
|
229
|
-
configFilePath
|
|
230
|
-
});
|
|
231
|
-
} catch (err) {
|
|
232
|
-
logger.error(err);
|
|
233
|
-
process.exit(1);
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
cli.command('preview [root]').alias('serve').option('--port [port]', 'port number').option('--host [host]', 'hostname').action(async (root, options)=>{
|
|
237
|
-
setNodeEnv('production');
|
|
238
|
-
const cwd = process.cwd();
|
|
239
|
-
const { port, host } = options || {};
|
|
240
|
-
const { config, configFilePath } = await loadConfigFile(options?.config);
|
|
241
|
-
config.root = resolveDocRoot(cwd, root, config.root);
|
|
242
|
-
await serve({
|
|
243
|
-
config,
|
|
244
|
-
host,
|
|
245
|
-
port,
|
|
246
|
-
configFilePath
|
|
247
|
-
});
|
|
248
|
-
});
|
|
249
|
-
cli.command('eject [component]', 'Eject a theme component to customize it').action(async (component)=>{
|
|
250
|
-
if (!component) return void await listComponents();
|
|
251
|
-
const cwd = process.cwd();
|
|
252
|
-
try {
|
|
253
|
-
await ejectComponent(component, cwd);
|
|
254
|
-
} catch (error) {
|
|
255
|
-
logger.error(`Failed to eject component: ${error}`);
|
|
256
|
-
process.exit(1);
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
cli.parse();
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* https://github.com/facebook/docusaurus/blob/0306d182407bb98f140cd5ec7481fa9608fe0297/packages/docusaurus/src/ssg/ssgExecutor.ts#L123
|
|
3
|
-
* @license MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* these codes are copied from
|
|
8
|
-
* @link https://github.com/facebook/docusaurus/blob/45065e8d2b5831117b8d69fec1be28f5520cf105/packages/docusaurus/src/ssg/ssgEnv.ts#L11
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const detectCustomIcon: (customThemeDir: string) => Promise<Record<string, string>>;
|