@rspress/core 2.0.17 → 2.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{4538.js → 4538~0.js} +1 -1
- package/dist/6305~0.js +3007 -0
- package/dist/{7448.js → 8472~0.js} +3 -3
- package/dist/{0~execa.js → 864~0.js} +11 -11
- package/dist/cli/index.js +13 -40
- package/dist/config/defineConfig.d.ts +15 -15
- package/dist/config/loadConfigFile.js +1 -1
- package/dist/eject-theme/components/DocContent/docComponents/title.tsx +1 -1
- package/dist/eject-theme/components/HomeFeature/index.scss +1 -0
- package/dist/eject-theme/components/HomeFeature/index.tsx +1 -1
- package/dist/eject-theme/components/HoverGroup/index.scss +25 -0
- package/dist/eject-theme/components/HoverGroup/index.tsx +22 -1
- package/dist/eject-theme/components/Llms/LlmsCopyButton.tsx +2 -6
- package/dist/eject-theme/components/Llms/LlmsCopyRow.tsx +2 -5
- package/dist/eject-theme/components/Llms/LlmsHint.test.tsx +104 -0
- package/dist/eject-theme/components/Llms/LlmsHint.tsx +70 -0
- package/dist/eject-theme/components/Llms/LlmsOpenRow.tsx +51 -64
- package/dist/eject-theme/components/Llms/LlmsViewOptions.tsx +65 -51
- package/dist/eject-theme/components/Llms/getLlmsCopyContent.test.ts +21 -0
- package/dist/eject-theme/components/Llms/getLlmsCopyContent.ts +20 -0
- package/dist/eject-theme/components/Llms/index.tsx +6 -1
- package/dist/eject-theme/components/Nav/NavMenu.scss +16 -0
- package/dist/eject-theme/components/Nav/NavMenu.tsx +12 -0
- package/dist/eject-theme/components/NavScreen/NavScreenMenuItem.scss +18 -2
- package/dist/eject-theme/components/NavScreen/NavScreenMenuItem.tsx +27 -19
- package/dist/eject-theme/components/NavScreen/index.scss +4 -0
- package/dist/eject-theme/components/Outline/index.scss +4 -0
- package/dist/eject-theme/components/Outline/index.tsx +1 -1
- package/dist/eject-theme/components/Sidebar/SidebarGroup.tsx +3 -0
- package/dist/eject-theme/components/Sidebar/SidebarItem.scss +16 -0
- package/dist/eject-theme/components/Sidebar/SidebarItem.test.tsx +51 -0
- package/dist/eject-theme/components/Sidebar/SidebarItem.tsx +10 -1
- package/dist/eject-theme/components/Sidebar/SidebarSectionHeader.scss +15 -0
- package/dist/eject-theme/components/Sidebar/SidebarSectionHeader.tsx +6 -1
- package/dist/eject-theme/components/Sidebar/index.tsx +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -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 +39 -10
- package/dist/node/auto-nav-sidebar/type.d.ts +7 -0
- package/dist/node/auto-nav-sidebar/utils.d.ts +1 -0
- package/dist/node/auto-nav-sidebar/utils.js +2 -1
- package/dist/node/auto-nav-sidebar/walk.js +1 -1
- package/dist/node/constants.d.ts +2 -1
- package/dist/node/constants.js +50 -2
- package/dist/node/dev.d.ts +2 -1
- package/dist/node/dev.js +7 -2
- package/dist/node/eject.js +3 -3
- package/dist/node/initRsbuild.d.ts +6 -2
- package/dist/node/initRsbuild.js +49 -14
- package/dist/node/last-updated/index.js +112 -15
- package/dist/node/llms.d.ts +3 -0
- package/dist/node/llms.js +8 -0
- package/dist/node/logger/hint.js +2 -2
- 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 +3 -3
- package/dist/node/mdx/remarkPlugins/image.js +3 -3
- package/dist/node/mdx/remarkPlugins/link.js +3 -3
- package/dist/node/mdx/remarkPlugins/toc.js +1 -1
- package/dist/node/medium-zoom/index.js +1 -1
- package/dist/node/route/RoutePage.js +5 -3
- package/dist/node/route/RouteService.js +8 -3
- package/dist/node/route/extractPageData.js +3 -15
- package/dist/node/route/normalizeRoutePath.js +1 -1
- package/dist/node/route/routeChunkAssets.d.ts +15 -0
- package/dist/node/route/routeChunkAssets.js +56 -0
- 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 +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/ssg/alternateLinks.d.ts +7 -0
- package/dist/node/ssg/alternateLinks.js +40 -0
- package/dist/node/ssg/htmlFile.js +1 -1
- package/dist/node/ssg/renderHtmlTemplate.d.ts +3 -1
- package/dist/node/ssg/renderHtmlTemplate.js +25 -3
- package/dist/node/ssg/renderPage.d.ts +3 -1
- package/dist/node/ssg/renderPage.js +5 -5
- package/dist/node/ssg/renderPageWorker.js +5 -5
- package/dist/node/ssg/renderPages.d.ts +3 -2
- package/dist/node/ssg/renderPages.js +18 -13
- package/dist/node/ssg/rsbuildPluginCSR.d.ts +3 -1
- package/dist/node/ssg/rsbuildPluginCSR.js +2 -2
- package/dist/node/ssg/rsbuildPluginSSG.d.ts +3 -1
- package/dist/node/ssg/rsbuildPluginSSG.js +3 -3
- package/dist/node/ssg/ssgEnv.js +1 -1
- package/dist/node/ssg-md/llms/emitLlmsTxt.js +2 -2
- package/dist/node/ssg-md/llms/llmsTxt.d.ts +2 -2
- package/dist/node/ssg-md/llms/llmsTxt.js +49 -35
- package/dist/node/ssg-md/remarkSplitMdx.js +8 -10
- package/dist/node/ssg-md/renderPage.js +3 -3
- package/dist/node/ssg-md/renderPages.js +4 -4
- package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
- package/dist/node/utils/checkLanguageParity.js +1 -1
- package/dist/node/utils/createHash.d.ts +1 -1
- package/dist/node/utils/createHash.js +3 -3
- package/dist/node/utils/error.js +2 -2
- 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 +3 -3
- package/dist/runtime/App.js +7 -2
- package/dist/runtime/index.d.ts +2 -1
- package/dist/runtime/index.js +2 -1
- package/dist/runtime/reactDom.d.ts +19 -0
- package/dist/runtime/reactDom.js +5 -0
- package/dist/runtime/utils.d.ts +2 -1
- package/dist/runtime/utils.js +5 -2
- package/dist/theme/assets/anthropic.js +15 -0
- package/dist/theme/assets/open-in-chat.js +19 -0
- package/dist/theme/assets/openai.js +15 -0
- package/dist/theme/components/DocContent/docComponents/title.js +1 -1
- package/dist/theme/components/HomeFeature/index.css +1 -0
- package/dist/theme/components/HomeFeature/index.js +32 -34
- package/dist/theme/components/HoverGroup/index.css +22 -0
- package/dist/theme/components/HoverGroup/index.js +17 -1
- package/dist/theme/components/Llms/LlmsCopyButton.js +3 -4
- package/dist/theme/components/Llms/LlmsCopyRow.js +2 -3
- package/dist/theme/components/Llms/LlmsHint.d.ts +2 -0
- package/dist/theme/components/Llms/LlmsHint.js +40 -0
- package/dist/theme/components/Llms/LlmsOpenRow.js +31 -57
- package/dist/theme/components/Llms/LlmsViewOptions.d.ts +6 -4
- package/dist/theme/components/Llms/LlmsViewOptions.js +28 -45
- package/dist/theme/components/Llms/getLlmsCopyContent.d.ts +1 -0
- package/dist/theme/components/Llms/getLlmsCopyContent.js +14 -0
- package/dist/theme/components/Llms/index.d.ts +2 -1
- package/dist/theme/components/Llms/index.js +1 -0
- package/dist/theme/components/Nav/NavMenu.css +15 -0
- package/dist/theme/components/Nav/NavMenu.js +8 -0
- package/dist/theme/components/NavScreen/NavScreenMenuItem.css +17 -2
- package/dist/theme/components/NavScreen/NavScreenMenuItem.js +21 -22
- package/dist/theme/components/NavScreen/index.css +4 -0
- package/dist/theme/components/Outline/index.css +4 -0
- package/dist/theme/components/Outline/index.js +1 -1
- package/dist/theme/components/Sidebar/SidebarGroup.js +4 -1
- package/dist/theme/components/Sidebar/SidebarItem.css +15 -0
- package/dist/theme/components/Sidebar/SidebarItem.d.ts +2 -1
- package/dist/theme/components/Sidebar/SidebarItem.js +7 -2
- package/dist/theme/components/Sidebar/SidebarSectionHeader.css +14 -0
- package/dist/theme/components/Sidebar/SidebarSectionHeader.d.ts +2 -1
- package/dist/theme/components/Sidebar/SidebarSectionHeader.js +12 -6
- package/dist/theme/components/Sidebar/index.js +1 -0
- package/dist/theme/icons.d.ts +4 -1
- package/dist/theme/icons.js +8 -2
- package/dist/theme/index.d.ts +1 -2
- package/dist/theme/index.js +1 -2
- package/dist/theme/layout/Layout/index.js +1 -2
- package/meta-json-schema.json +33 -3
- package/nav-json-schema.json +9 -0
- package/package.json +16 -21
- package/dist/8629.js +0 -7275
- package/dist/8629.js.LICENSE.txt +0 -41
- package/dist/theme/logic/useRedirect4FirstVisit.d.ts +0 -5
- package/dist/theme/logic/useRedirect4FirstVisit.js +0 -31
- /package/dist/{102.js → 102~0.js} +0 -0
- /package/dist/{5357.js → 5357~0.js} +0 -0
- /package/dist/{7748.js → 7748~0.js} +0 -0
- /package/dist/{0~8016.js → 8016~0.js} +0 -0
- /package/dist/{9857.js → 9857~0.js} +0 -0
- /package/dist/{9940.js → 9940~0.js} +0 -0
- /package/dist/{0~rslib-runtime.js → rslib-runtime~0.js} +0 -0
- /package/dist/{0~tinypool.js → tinypool~0.js} +0 -0
package/dist/node/initRsbuild.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
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 "../6305~0.js";
|
|
2
2
|
import { createError } from "./utils/error.js";
|
|
3
|
-
import { CSR_CLIENT_ENTRY, SSR_CLIENT_ENTRY, OUTPUT_DIR, SSG_MD_SERVER_ENTRY, NODE_SSG_BUNDLE_FOLDER, 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";
|
|
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
|
+
import { isLlmsUIEnabled, isLlmsHintEnabled } from "./llms.js";
|
|
5
|
+
import { RouteChunkAssetsPlugin } from "./route/routeChunkAssets.js";
|
|
4
6
|
import { hintBuilderPluginsBreakingChange, hintThemeBreakingChange } from "./logger/hint.js";
|
|
5
7
|
import { resolveReactRouterDomAlias, resolveReactRenderToMarkdownAlias, resolveReactAlias } from "./utils/reactAlias.js";
|
|
6
8
|
import { rsbuildPluginDocVM } from "./runtimeModule/pageData/rsbuildPlugin.js";
|
|
@@ -14,7 +16,7 @@ import { siteDataVMPlugin } from "./runtimeModule/siteData/rsbuildPlugin.js";
|
|
|
14
16
|
import { rsbuildPluginSSG } from "./ssg/rsbuildPluginSSG.js";
|
|
15
17
|
import { rsbuildPluginCSR } from "./ssg/rsbuildPluginCSR.js";
|
|
16
18
|
import { rsbuildPluginSSGMD } from "./ssg-md/rsbuildPluginSSGMD.js";
|
|
17
|
-
import { package_namespaceObject } from "../
|
|
19
|
+
import { package_namespaceObject } from "../8472~0.js";
|
|
18
20
|
function isPluginIncluded(config, pluginName) {
|
|
19
21
|
return Boolean(config.builderConfig?.plugins?.some((plugin)=>plugin && plugin.name === pluginName));
|
|
20
22
|
}
|
|
@@ -35,11 +37,15 @@ async function getVirtualModulesFromPlugins(pluginDriver) {
|
|
|
35
37
|
});
|
|
36
38
|
return runtimeModule;
|
|
37
39
|
}
|
|
38
|
-
async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeService, pluginDriver) {
|
|
40
|
+
async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeService, pluginDriver, restart) {
|
|
39
41
|
const CUSTOM_THEME_DIR = node_path.isAbsolute(config.themeDir) ? config.themeDir : node_path.join(external_node_process_cwd(), config.themeDir);
|
|
40
42
|
const outDir = config?.outDir ?? OUTPUT_DIR;
|
|
41
43
|
const base = config?.base ?? '/';
|
|
44
|
+
const enableLlmsUI = isLlmsUIEnabled(config);
|
|
45
|
+
const enableLlmsHint = isLlmsHintEnabled(config, enableSSG);
|
|
46
|
+
const localeRedirectScript = getInlineLocaleRedirectScript(config);
|
|
42
47
|
const assetPrefix = isProduction() ? addTrailingSlash(config?.builderConfig?.output?.assetPrefix ?? base) : '/';
|
|
48
|
+
const routeChunkAssets = new RouteChunkAssetsPlugin(routeService);
|
|
43
49
|
const normalizeIcon = (icon)=>{
|
|
44
50
|
if (!icon) return;
|
|
45
51
|
icon = icon.toString();
|
|
@@ -86,10 +92,12 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
86
92
|
}),
|
|
87
93
|
enableSSG && config.ssg ? rsbuildPluginSSG({
|
|
88
94
|
routeService,
|
|
89
|
-
config
|
|
95
|
+
config,
|
|
96
|
+
routeChunkAssets
|
|
90
97
|
}) : rsbuildPluginCSR({
|
|
91
98
|
routeService,
|
|
92
|
-
config
|
|
99
|
+
config,
|
|
100
|
+
routeChunkAssets
|
|
93
101
|
}),
|
|
94
102
|
enableSSG && config.llms ? rsbuildPluginSSGMD({
|
|
95
103
|
routeService,
|
|
@@ -107,15 +115,36 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
107
115
|
},
|
|
108
116
|
dev: {
|
|
109
117
|
lazyCompilation: 'false' !== process.env.RSPRESS_LAZY_COMPILATION,
|
|
110
|
-
cliShortcuts:
|
|
111
|
-
|
|
112
|
-
|
|
118
|
+
cliShortcuts: true,
|
|
119
|
+
...restart ? {
|
|
120
|
+
watchFiles: {
|
|
121
|
+
paths: userDocRoot,
|
|
122
|
+
type: 'restart',
|
|
123
|
+
events: [
|
|
124
|
+
'add',
|
|
125
|
+
'unlink'
|
|
126
|
+
],
|
|
127
|
+
options: {
|
|
128
|
+
ignored: [
|
|
129
|
+
'**/node_modules/**',
|
|
130
|
+
'**/.git/**',
|
|
131
|
+
'**/.DS_Store/**',
|
|
132
|
+
node_path.join(userDocRoot, "public")
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
} : {}
|
|
113
137
|
},
|
|
114
138
|
html: {
|
|
115
139
|
title: config?.title ?? DEFAULT_TITLE,
|
|
116
140
|
favicon: normalizeIcon(config?.icon),
|
|
117
141
|
template: TEMPLATE_PATH,
|
|
118
142
|
tags: [
|
|
143
|
+
localeRedirectScript ? {
|
|
144
|
+
tag: "script",
|
|
145
|
+
children: localeRedirectScript,
|
|
146
|
+
append: false
|
|
147
|
+
} : null,
|
|
119
148
|
'force-light' !== normalizeDarkMode(config.themeConfig?.darkMode) ? {
|
|
120
149
|
tag: "script",
|
|
121
150
|
children: getInlineThemeScript(config.themeConfig?.darkMode),
|
|
@@ -157,8 +186,8 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
157
186
|
PACKAGE_ROOT
|
|
158
187
|
],
|
|
159
188
|
define: {
|
|
160
|
-
'
|
|
161
|
-
'
|
|
189
|
+
'import.meta.env.ENABLE_LLMS_UI': JSON.stringify(enableLlmsUI),
|
|
190
|
+
'import.meta.env.ENABLE_LLMS_HINT': JSON.stringify(enableLlmsHint)
|
|
162
191
|
}
|
|
163
192
|
},
|
|
164
193
|
performance: {
|
|
@@ -271,6 +300,9 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
271
300
|
},
|
|
272
301
|
tools: {
|
|
273
302
|
rspack: {
|
|
303
|
+
plugins: [
|
|
304
|
+
routeChunkAssets
|
|
305
|
+
],
|
|
274
306
|
node: {
|
|
275
307
|
__dirname: 'mock',
|
|
276
308
|
__filename: 'mock'
|
|
@@ -344,14 +376,17 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
|
|
|
344
376
|
}
|
|
345
377
|
};
|
|
346
378
|
}
|
|
347
|
-
async function initRsbuild(rootDir, config, pluginDriver, routeService, enableSSG,
|
|
379
|
+
async function initRsbuild(rootDir, config, pluginDriver, routeService, enableSSG, options = {}) {
|
|
348
380
|
const userDocRoot = node_path.resolve(rootDir || config.root);
|
|
349
381
|
hintBuilderPluginsBreakingChange(config);
|
|
350
382
|
const { createRsbuild, mergeRsbuildConfig } = await import("@rsbuild/core");
|
|
351
|
-
const internalRsbuildConfig = await createInternalBuildConfig(userDocRoot, config, enableSSG, routeService, pluginDriver);
|
|
383
|
+
const internalRsbuildConfig = await createInternalBuildConfig(userDocRoot, config, enableSSG, routeService, pluginDriver, options.restart);
|
|
384
|
+
const rsbuildConfig = mergeRsbuildConfig(internalRsbuildConfig, ...pluginDriver.getPlugins()?.map((plugin)=>plugin.builderConfig ?? {}) || [], config.builderConfig || {}, options.extraRsbuildConfig || {});
|
|
385
|
+
if (options.configFileMeta) rsbuildConfig._privateMeta = options.configFileMeta;
|
|
352
386
|
const rsbuild = await createRsbuild({
|
|
353
387
|
callerName: 'rspress',
|
|
354
|
-
|
|
388
|
+
restart: options.restart,
|
|
389
|
+
rsbuildConfig
|
|
355
390
|
});
|
|
356
391
|
return rsbuild;
|
|
357
392
|
}
|
|
@@ -1,33 +1,130 @@
|
|
|
1
|
-
import { execa } from "../../0
|
|
1
|
+
import { node_path, execa } from "../../864~0.js";
|
|
2
|
+
import { slash } from "../utils/normalizePath.js";
|
|
2
3
|
function transform(timestamp, lang) {
|
|
3
4
|
return new Date(timestamp).toLocaleString(lang || 'zh');
|
|
4
5
|
}
|
|
5
|
-
|
|
6
|
+
const COMMIT_FORMAT = '--pretty=format:%x00%at%x00%an%x00%ae';
|
|
7
|
+
const ESCAPES = {
|
|
8
|
+
a: '\x07',
|
|
9
|
+
b: '\b',
|
|
10
|
+
t: '\t',
|
|
11
|
+
n: '\n',
|
|
12
|
+
v: '\v',
|
|
13
|
+
f: '\f',
|
|
14
|
+
r: '\r',
|
|
15
|
+
'"': '"',
|
|
16
|
+
'\\': '\\'
|
|
17
|
+
};
|
|
18
|
+
function unquotePath(filePath) {
|
|
19
|
+
if (!filePath.startsWith('"')) return filePath;
|
|
20
|
+
return filePath.slice(1, -1).replace(/\\([0-7]{3}|.)/g, (_, escaped)=>3 === escaped.length ? String.fromCharCode(Number.parseInt(escaped, 8)) : ESCAPES[escaped] ?? escaped);
|
|
21
|
+
}
|
|
22
|
+
function getCommonDir(filePaths) {
|
|
23
|
+
let common = node_path.dirname(filePaths[0]).split(node_path.sep);
|
|
24
|
+
for (const filePath of filePaths.slice(1)){
|
|
25
|
+
const segments = node_path.dirname(filePath).split(node_path.sep);
|
|
26
|
+
let i = 0;
|
|
27
|
+
while(i < common.length && i < segments.length && common[i] === segments[i])i++;
|
|
28
|
+
common = common.slice(0, i);
|
|
29
|
+
}
|
|
30
|
+
return common.length > 1 ? common.join(node_path.sep) : node_path.parse(filePaths[0]).root;
|
|
31
|
+
}
|
|
32
|
+
function getMostCommonParent(filePaths) {
|
|
33
|
+
const counts = new Map();
|
|
34
|
+
let best = '';
|
|
35
|
+
let bestCount = 0;
|
|
36
|
+
for (const filePath of filePaths){
|
|
37
|
+
const dir = node_path.dirname(filePath);
|
|
38
|
+
const count = (counts.get(dir) ?? 0) + 1;
|
|
39
|
+
counts.set(dir, count);
|
|
40
|
+
if (count > bestCount) {
|
|
41
|
+
best = dir;
|
|
42
|
+
bestCount = count;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return best;
|
|
46
|
+
}
|
|
47
|
+
async function getRepoPrefix(dir) {
|
|
6
48
|
try {
|
|
7
49
|
const { stdout } = await execa('git', [
|
|
50
|
+
'rev-parse',
|
|
51
|
+
'--show-prefix'
|
|
52
|
+
], {
|
|
53
|
+
cwd: dir
|
|
54
|
+
});
|
|
55
|
+
return stdout.trim();
|
|
56
|
+
} catch (_e) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function stripPrefix(dir, prefix) {
|
|
61
|
+
let root = dir;
|
|
62
|
+
for(let i = prefix.split('/').filter(Boolean).length; i > 0; i--)root = node_path.dirname(root);
|
|
63
|
+
return root;
|
|
64
|
+
}
|
|
65
|
+
async function collectGitInfo(dir) {
|
|
66
|
+
const infoByPath = new Map();
|
|
67
|
+
let stdout;
|
|
68
|
+
try {
|
|
69
|
+
({ stdout } = await execa('git', [
|
|
70
|
+
'-c',
|
|
71
|
+
'core.quotePath=false',
|
|
8
72
|
'log',
|
|
9
|
-
|
|
10
|
-
'--
|
|
73
|
+
COMMIT_FORMAT,
|
|
74
|
+
'--name-only',
|
|
75
|
+
'--cc',
|
|
76
|
+
'--no-renames',
|
|
11
77
|
'--',
|
|
12
|
-
|
|
13
|
-
]
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
timestamp: 1000 * Number(at),
|
|
18
|
-
authorName: an ?? '',
|
|
19
|
-
authorEmail: ae ?? ''
|
|
20
|
-
};
|
|
78
|
+
'.'
|
|
79
|
+
], {
|
|
80
|
+
cwd: dir
|
|
81
|
+
}));
|
|
21
82
|
} catch (_e) {
|
|
22
|
-
return;
|
|
83
|
+
return infoByPath;
|
|
84
|
+
}
|
|
85
|
+
let commit;
|
|
86
|
+
for (const line of stdout.split('\n')){
|
|
87
|
+
if (line.startsWith('\0')) {
|
|
88
|
+
const [, at, an = '', ae = ''] = line.split('\0');
|
|
89
|
+
commit = {
|
|
90
|
+
timestamp: 1000 * Number(at),
|
|
91
|
+
authorName: an,
|
|
92
|
+
authorEmail: ae
|
|
93
|
+
};
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (!line || !commit) continue;
|
|
97
|
+
const filePath = unquotePath(line);
|
|
98
|
+
if (!infoByPath.has(filePath)) infoByPath.set(filePath, commit);
|
|
99
|
+
}
|
|
100
|
+
return infoByPath;
|
|
101
|
+
}
|
|
102
|
+
async function createLookup(filePaths) {
|
|
103
|
+
if (!filePaths.length) return ()=>void 0;
|
|
104
|
+
let dir = getCommonDir(filePaths);
|
|
105
|
+
let prefix = await getRepoPrefix(dir);
|
|
106
|
+
if (void 0 === prefix) {
|
|
107
|
+
const candidate = getMostCommonParent(filePaths);
|
|
108
|
+
const candidatePrefix = await getRepoPrefix(candidate);
|
|
109
|
+
if (void 0 === candidatePrefix) return ()=>void 0;
|
|
110
|
+
dir = stripPrefix(candidate, candidatePrefix);
|
|
111
|
+
prefix = '';
|
|
23
112
|
}
|
|
113
|
+
const repoPrefix = prefix;
|
|
114
|
+
const scope = dir;
|
|
115
|
+
const infoByPath = await collectGitInfo(dir);
|
|
116
|
+
return (filePath)=>infoByPath.get(repoPrefix + slash(node_path.relative(scope, filePath)));
|
|
24
117
|
}
|
|
25
118
|
function pluginLastUpdated(authorOption = false) {
|
|
119
|
+
let lookup;
|
|
26
120
|
return {
|
|
27
121
|
name: '@rspress/plugin-last-updated',
|
|
122
|
+
routeGenerated (routes) {
|
|
123
|
+
lookup = createLookup(routes.map((route)=>route.absolutePath));
|
|
124
|
+
},
|
|
28
125
|
async extendPageData (pageData) {
|
|
29
126
|
const { _filepath, lang } = pageData;
|
|
30
|
-
const info = await
|
|
127
|
+
const info = (await lookup)?.(_filepath);
|
|
31
128
|
if (!info) return;
|
|
32
129
|
pageData.lastUpdatedTime = transform(info.timestamp, lang);
|
|
33
130
|
if (false === authorOption) return;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
function isLlmsUIEnabled(config) {
|
|
2
|
+
return Boolean(config.themeConfig?.llmsUI ?? config.llms);
|
|
3
|
+
}
|
|
4
|
+
function isLlmsHintEnabled(config, enableSSG) {
|
|
5
|
+
const llmsUI = config.themeConfig?.llmsUI;
|
|
6
|
+
return enableSSG && false !== config.ssg && isLlmsUIEnabled(config) && ('object' != typeof llmsUI || false !== llmsUI.injectLlmsHint);
|
|
7
|
+
}
|
|
8
|
+
export { isLlmsHintEnabled, isLlmsUIEnabled };
|
package/dist/node/logger/hint.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { __webpack_require__ } from "../../
|
|
2
|
-
import { relative, logger, join, readFile } from "../../4538.js";
|
|
1
|
+
import { __webpack_require__ } from "../../rslib-runtime~0.js";
|
|
2
|
+
import { relative, logger, join, readFile } from "../../4538~0.js";
|
|
3
3
|
import { pathExists } from "../utils/fs.js";
|
|
4
4
|
const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
5
5
|
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
package/dist/node/mdx/options.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { node_path, rehype_external_links, rehype_raw, remark_cjk_friendly, nodeTypes, remark_gfm, rehype, remark_cjk_friendly_gfm_strikethrough } from "../../9940.js";
|
|
1
|
+
import { node_path, rehype_external_links, rehype_raw, remark_cjk_friendly, nodeTypes, remark_gfm, rehype, remark_cjk_friendly_gfm_strikethrough } from "../../9940~0.js";
|
|
2
2
|
import { remarkToc } from "./remarkPlugins/toc.js";
|
|
3
3
|
import { remarkContainerSyntax } from "./remarkPlugins/containerSyntax.js";
|
|
4
4
|
import { remarkFileCodeBlock } from "./remarkPlugins/fileCodeBlock.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { node_path, extractTextAndId, createProcessor, loadFrontMatter } from "../../9940.js";
|
|
1
|
+
import { node_path, extractTextAndId, createProcessor, loadFrontMatter } from "../../9940~0.js";
|
|
2
2
|
import { createMDXOptions } from "./options.js";
|
|
3
3
|
import { applyReplaceRules } from "../utils/applyReplaceRules.js";
|
|
4
4
|
import { escapeMarkdownHeadingIds } from "../utils/escapeHeadingIds.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { visit } from "../../../9940.js";
|
|
1
|
+
import { visit } from "../../../9940~0.js";
|
|
2
2
|
const rehypeCodeMeta = ()=>(tree)=>{
|
|
3
3
|
visit(tree, 'element', (node)=>{
|
|
4
4
|
if ('pre' === node.tagName && node.children[0]?.type === 'element' && 'code' === node.children[0].tagName) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { visit, extractTextAndId, github_slugger, headingRank } from "../../../9940.js";
|
|
1
|
+
import { visit, extractTextAndId, github_slugger, headingRank } from "../../../9940~0.js";
|
|
2
2
|
const rehypeHeaderAnchor = ()=>{
|
|
3
3
|
const slugger = new github_slugger();
|
|
4
4
|
return (tree)=>{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { transformerAddLang, transformerAddLineNumbers, transformerAddTitle, transformerAddFold, createCssVariablesTheme, transformerAddWrapCode } from "../../../9940.js";
|
|
1
|
+
import { transformerAddLang, transformerAddLineNumbers, transformerAddTitle, transformerAddFold, createCssVariablesTheme, transformerAddWrapCode } from "../../../9940~0.js";
|
|
2
2
|
const cssVariablesTheme = createCssVariablesTheme({
|
|
3
3
|
name: 'css-variables',
|
|
4
4
|
variablePrefix: '--shiki-',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { node_path } from "../../../9940.js";
|
|
1
|
+
import { node_path } from "../../../9940~0.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
|
-
import { __webpack_require__ } from "../../../
|
|
2
|
-
import "../../../4538.js";
|
|
3
|
-
import { visit, node_path, logger, cwd, readFile } from "../../../5357.js";
|
|
1
|
+
import { __webpack_require__ } from "../../../rslib-runtime~0.js";
|
|
2
|
+
import "../../../4538~0.js";
|
|
3
|
+
import { visit, node_path, logger, cwd, readFile } from "../../../5357~0.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
|
-
import { __webpack_require__ } from "../../../
|
|
2
|
-
import "../../../4538.js";
|
|
3
|
-
import { visit, node_path, logger, isDataUrl, existsSync, getNodeAttribute, isExternalUrl, isProduction, parseUrl } from "../../../5357.js";
|
|
1
|
+
import { __webpack_require__ } from "../../../rslib-runtime~0.js";
|
|
2
|
+
import "../../../4538~0.js";
|
|
3
|
+
import { visit, node_path, logger, isDataUrl, existsSync, getNodeAttribute, isExternalUrl, isProduction, parseUrl } from "../../../5357~0.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
|
-
import { __webpack_require__ } from "../../../
|
|
2
|
-
import "../../../4538.js";
|
|
3
|
-
import { normalizeHref, node_path, addLeadingSlash, logger, visit, isExternalUrl, isProduction, parseUrl, MDX_OR_MD_REGEXP, withBase } from "../../../5357.js";
|
|
1
|
+
import { __webpack_require__ } from "../../../rslib-runtime~0.js";
|
|
2
|
+
import "../../../4538~0.js";
|
|
3
|
+
import { normalizeHref, node_path, addLeadingSlash, logger, visit, isExternalUrl, isProduction, parseUrl, MDX_OR_MD_REGEXP, withBase } from "../../../5357~0.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 "../../../7748.js";
|
|
1
|
+
import { visitChildren, extractTextAndId, github_slugger, slug } from "../../../7748~0.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 { node_path } from "../../
|
|
1
|
+
import { node_path } from "../../6305~0.js";
|
|
2
2
|
import { RouteService } from "./RouteService.js";
|
|
3
3
|
import { normalizePath, slash } from "../utils/normalizePath.js";
|
|
4
4
|
import { getPageKey } from "../utils/getPageKey.js";
|
|
@@ -23,9 +23,10 @@ class RoutePage {
|
|
|
23
23
|
}
|
|
24
24
|
static generateRouteMeta(routePath, filepath, docDir) {
|
|
25
25
|
const routeService = RouteService.getInstance();
|
|
26
|
-
const { routePath: normalizedPath, lang, version } = routeService.normalizeRoutePath(routePath);
|
|
26
|
+
const { routePath: normalizedPath, lang, pureRoutePath, version } = routeService.normalizeRoutePath(routePath);
|
|
27
27
|
return {
|
|
28
28
|
routePath: normalizedPath,
|
|
29
|
+
pureRoutePath,
|
|
29
30
|
absolutePath: normalizePath(filepath),
|
|
30
31
|
relativePath: absolutePathToRelativePath(filepath, docDir),
|
|
31
32
|
pageName: getPageKey(routePath),
|
|
@@ -39,11 +40,12 @@ function absolutePathToRelativePath(absolutePath, docsDir) {
|
|
|
39
40
|
}
|
|
40
41
|
function absolutePathToRouteMeta(absolutePath, docsDir, routeService = RouteService.getInstance()) {
|
|
41
42
|
const relativePath = absolutePathToRelativePath(absolutePath, docsDir);
|
|
42
|
-
const { lang, routePath, version } = routeService.normalizeRoutePath(relativePath);
|
|
43
|
+
const { lang, pureRoutePath, routePath, version } = routeService.normalizeRoutePath(relativePath);
|
|
43
44
|
return {
|
|
44
45
|
pageName: getPageKey(relativePath),
|
|
45
46
|
absolutePath,
|
|
46
47
|
lang,
|
|
48
|
+
pureRoutePath,
|
|
47
49
|
version,
|
|
48
50
|
routePath,
|
|
49
51
|
relativePath
|
|
@@ -1,6 +1,7 @@
|
|
|
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 "../../6305~0.js";
|
|
2
2
|
import { RoutePage, absolutePathToRoutePath, absolutePathToRelativePath } from "./RoutePage.js";
|
|
3
3
|
import { createError } from "../utils/error.js";
|
|
4
|
+
import { getRouteChunkName } from "./routeChunkAssets.js";
|
|
4
5
|
import { getRoutePathParts, normalizeRoutePath, splitRoutePathParts } from "./normalizeRoutePath.js";
|
|
5
6
|
class RouteService {
|
|
6
7
|
routeData = new Map();
|
|
@@ -152,12 +153,16 @@ class RouteService {
|
|
|
152
153
|
return `
|
|
153
154
|
import React from 'react';
|
|
154
155
|
import { lazyWithPreload } from "react-lazy-with-preload";
|
|
155
|
-
${routeMeta.map((route, index)
|
|
156
|
+
${routeMeta.map((route, index)=>{
|
|
157
|
+
const chunkName = getRouteChunkName(route);
|
|
158
|
+
return `const loadRoute${index} = () => import(/* webpackChunkName: "${chunkName}" */ '${route.absolutePath}')
|
|
159
|
+
const Route${index} = lazyWithPreload(loadRoute${index})`;
|
|
160
|
+
}).join('\n')}
|
|
156
161
|
export const routes = [
|
|
157
162
|
${routeMeta.map((route, index)=>{
|
|
158
163
|
const preload = `async () => {
|
|
159
164
|
await Route${index}.preload();
|
|
160
|
-
return
|
|
165
|
+
return loadRoute${index}();
|
|
161
166
|
}`;
|
|
162
167
|
const component = `Route${index}`;
|
|
163
168
|
return `{ path: '${route.routePath}', element: React.createElement(${component}), filePath: '${route.relativePath}', preload: ${preload}, lang: '${route.lang}', version: '${route.version}' }`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unified, node_path, promises, loadFrontMatter,
|
|
1
|
+
import { unified, node_path, promises, loadFrontMatter, remark_gfm, MDX_OR_MD_REGEXP, remark_parse } from "../../6305~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";
|
|
@@ -8,17 +8,7 @@ function applyReplaceRulesToNestedObject(obj, replaceRules) {
|
|
|
8
8
|
else if ('object' == typeof obj[key] && null !== obj[key]) obj[key] = applyReplaceRulesToNestedObject(obj[key], replaceRules);
|
|
9
9
|
return obj;
|
|
10
10
|
}
|
|
11
|
-
const
|
|
12
|
-
remove(tree, 'code');
|
|
13
|
-
};
|
|
14
|
-
const remarkRemoveImages = ()=>(tree)=>{
|
|
15
|
-
remove(tree, 'image');
|
|
16
|
-
};
|
|
17
|
-
const createProcessor = (searchCodeBlocks)=>unified().use(remark_parse).use(remark_gfm).use(remarkRemoveImages).use(searchCodeBlocks ? [] : [
|
|
18
|
-
remarkRemoveCodeBlocks
|
|
19
|
-
]);
|
|
20
|
-
const processorWithCode = createProcessor(true);
|
|
21
|
-
const processorWithoutCode = createProcessor(false);
|
|
11
|
+
const processor = unified().use(remark_parse).use(remark_gfm);
|
|
22
12
|
function extractTextFromNode(node) {
|
|
23
13
|
if ('value' in node && 'string' == typeof node.value) return node.value;
|
|
24
14
|
if ('children' in node && Array.isArray(node.children)) return node.children.map(extractTextFromNode).join('');
|
|
@@ -164,7 +154,6 @@ async function getPageIndexInfoByRoute(route, options) {
|
|
|
164
154
|
const { flattenContent } = await flattenMdxContent(applyReplaceRules(contentWithoutFrontMatter, replaceRules), route.absolutePath, alias);
|
|
165
155
|
content = flattenContent.replace(importStatementRegex, '');
|
|
166
156
|
content = content.replace(/\r\n/g, '\n');
|
|
167
|
-
const processor = searchCodeBlocks ? processorWithCode : processorWithoutCode;
|
|
168
157
|
const tree = processor.parse(content);
|
|
169
158
|
const { title, toc: rawToc } = parseToc(tree);
|
|
170
159
|
const extractedDescription = frontmatter.description || !extractDescriptionConfig ? '' : extractDescription(tree);
|
|
@@ -183,8 +172,7 @@ async function getPageIndexInfoByRoute(route, options) {
|
|
|
183
172
|
__content: void 0
|
|
184
173
|
}
|
|
185
174
|
};
|
|
186
|
-
const
|
|
187
|
-
const { content: processedContent, toc } = buildSearchContent(processedTree, rawToc, searchCodeBlocks);
|
|
175
|
+
const { content: processedContent, toc } = buildSearchContent(tree, rawToc, searchCodeBlocks);
|
|
188
176
|
return {
|
|
189
177
|
...defaultIndexInfo,
|
|
190
178
|
title: frontmatter.title || title,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, addLeadingSlash } from "../../
|
|
1
|
+
import { addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, addLeadingSlash } from "../../6305~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 [
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Rspack } from '@rsbuild/core';
|
|
2
|
+
import type { RouteMeta } from '@rspress/shared';
|
|
3
|
+
import type { RouteService } from './RouteService.js';
|
|
4
|
+
export interface RouteChunkAssetsManifest {
|
|
5
|
+
assetPrefix: string;
|
|
6
|
+
assets: Record<string, string[]>;
|
|
7
|
+
}
|
|
8
|
+
export declare function getRouteChunkName(route: RouteMeta): string;
|
|
9
|
+
export declare class RouteChunkAssetsPlugin implements Rspack.RspackPluginInstance {
|
|
10
|
+
#private;
|
|
11
|
+
private readonly routeService;
|
|
12
|
+
constructor(routeService: RouteService);
|
|
13
|
+
apply(compiler: Rspack.Compiler): void;
|
|
14
|
+
getManifest(): RouteChunkAssetsManifest;
|
|
15
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { createHash } from "../utils/createHash.js";
|
|
2
|
+
const PLUGIN_NAME = 'RspressRouteChunkAssetsPlugin';
|
|
3
|
+
const JAVASCRIPT_ASSET_REGEXP = /\.[cm]?js$/;
|
|
4
|
+
const ROUTE_CHUNK_HASH_LENGTH = 12;
|
|
5
|
+
function getRouteChunkName(route) {
|
|
6
|
+
return `route-${createHash(route.relativePath, ROUTE_CHUNK_HASH_LENGTH)}`;
|
|
7
|
+
}
|
|
8
|
+
class RouteChunkAssetsPlugin {
|
|
9
|
+
routeService;
|
|
10
|
+
#assetPrefix = '/';
|
|
11
|
+
#chunks = new Map();
|
|
12
|
+
constructor(routeService){
|
|
13
|
+
this.routeService = routeService;
|
|
14
|
+
}
|
|
15
|
+
apply(compiler) {
|
|
16
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation)=>{
|
|
17
|
+
this.#assetPrefix = 'string' == typeof compilation.outputOptions.publicPath ? compilation.outputOptions.publicPath : '/';
|
|
18
|
+
this.#chunks.clear();
|
|
19
|
+
const routePathsByChunkName = new Map();
|
|
20
|
+
for (const route of this.routeService.getRoutes()){
|
|
21
|
+
const chunkName = getRouteChunkName(route);
|
|
22
|
+
const routePaths = routePathsByChunkName.get(chunkName) ?? [];
|
|
23
|
+
routePaths.push(route.routePath);
|
|
24
|
+
routePathsByChunkName.set(chunkName, routePaths);
|
|
25
|
+
}
|
|
26
|
+
compilation.hooks.chunkAsset.tap(PLUGIN_NAME, (chunk)=>{
|
|
27
|
+
if (!chunk.name) return;
|
|
28
|
+
const routePaths = routePathsByChunkName.get(chunk.name);
|
|
29
|
+
if (!routePaths) return;
|
|
30
|
+
for (const routePath of routePaths){
|
|
31
|
+
const chunks = this.#chunks.get(routePath) ?? new Set();
|
|
32
|
+
chunks.add(chunk);
|
|
33
|
+
this.#chunks.set(routePath, chunks);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
getManifest() {
|
|
39
|
+
return {
|
|
40
|
+
assetPrefix: this.#assetPrefix,
|
|
41
|
+
assets: Object.fromEntries([
|
|
42
|
+
...this.#chunks
|
|
43
|
+
].map(([routePath, chunks])=>{
|
|
44
|
+
const assets = new Set();
|
|
45
|
+
for (const chunk of chunks)for (const filename of chunk.files)if (JAVASCRIPT_ASSET_REGEXP.test(filename)) assets.add(filename);
|
|
46
|
+
return [
|
|
47
|
+
routePath,
|
|
48
|
+
[
|
|
49
|
+
...assets
|
|
50
|
+
]
|
|
51
|
+
];
|
|
52
|
+
}))
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export { RouteChunkAssetsPlugin, getRouteChunkName };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { __webpack_require__ } from "../../
|
|
2
|
-
import "../../4538.js";
|
|
3
|
-
import { createRequire, join, logger } from "../../
|
|
1
|
+
import { __webpack_require__ } from "../../rslib-runtime~0.js";
|
|
2
|
+
import "../../4538~0.js";
|
|
3
|
+
import { createRequire, join, logger } from "../../6305~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 "../../../6305~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 "../../../6305~0.js";
|
|
2
2
|
import { createPageData } from "./createPageData.js";
|
|
3
3
|
const rsbuildPluginDocVM = async ({ config, userDocRoot, routeService, pluginDriver })=>{
|
|
4
4
|
const ref = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getIconUrlPath } from "../../../
|
|
1
|
+
import { getIconUrlPath } from "../../../6305~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 "../../../6305~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 "../../../6305~0.js";
|
|
2
2
|
import { modifyConfigWithAutoNavSide } from "../../auto-nav-sidebar/index.js";
|
|
3
3
|
import { createSiteData } from "./createSiteData.js";
|
|
4
4
|
const siteDataVMPlugin = (context)=>{
|