@rspress/core 2.0.22 → 2.0.23
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/{o~0.js → a~0.js} +0 -14
- package/dist/{v~0.js → b~0.js} +19 -14
- package/dist/cli/index.js +2 -2
- package/dist/config/loadConfigFile.js +1 -1
- package/dist/eject-theme/components/Search/SearchPanel.tsx +9 -5
- package/dist/eject-theme/components/Search/logic/providers/LocalProvider.ts +1 -1
- package/dist/eject-theme/components/Search/useSearchPanel.ts +6 -5
- package/dist/eject-theme/components/SocialLinks/SocialLink.tsx +2 -2
- package/dist/eject-theme/components/SourceCode/index.tsx +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 +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 +2 -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/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 +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.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 +1 -1
- 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 +1 -1
- package/dist/n~0.js +11 -10
- package/dist/runtime/App.js +3 -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/index.d.ts +3 -1
- package/dist/runtime/index.js +5 -1
- package/dist/runtime/initPageData.js +10 -10
- package/dist/runtime/route.js +5 -5
- package/dist/runtime/utils.js +6 -6
- package/dist/theme/components/Search/SearchPanel.js +8 -6
- package/dist/theme/components/Search/logic/providers/LocalProvider.js +1 -1
- package/dist/theme/components/Search/useSearchPanel.js +7 -7
- package/dist/theme/components/SocialLinks/SocialLink.js +2 -2
- package/dist/theme/components/SourceCode/index.js +1 -1
- package/dist/theme/logic/utils.d.ts +0 -2
- package/dist/theme/logic/utils.js +56 -6
- package/package.json +11 -11
package/bin/rspress.js
CHANGED
|
@@ -4,7 +4,9 @@ import nodeModule from 'node:module';
|
|
|
4
4
|
// enable on-disk code caching of all modules loaded by Node.js
|
|
5
5
|
// requires Nodejs >= 22.8.0
|
|
6
6
|
const { enableCompileCache } = nodeModule;
|
|
7
|
-
|
|
7
|
+
const isCI = Boolean(process.env.CI) && process.env.CI !== 'false';
|
|
8
|
+
// Skip CI, where the cache is unlikely to be reused.
|
|
9
|
+
if (enableCompileCache && !isCI) {
|
|
8
10
|
try {
|
|
9
11
|
enableCompileCache();
|
|
10
12
|
} catch {
|
package/dist/{o~0.js → a~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) {
|
package/dist/{v~0.js → b~0.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var package_namespaceObject = {
|
|
2
|
-
rE: "2.0.
|
|
2
|
+
rE: "2.0.23"
|
|
3
3
|
};
|
|
4
4
|
async function pMap(iterable, mapper, { concurrency = 1 / 0, stopOnError = true, signal } = {}) {
|
|
5
5
|
return new Promise((resolve_, reject_)=>{
|
|
@@ -14,7 +14,7 @@ async function pMap(iterable, mapper, { concurrency = 1 / 0, stopOnError = true,
|
|
|
14
14
|
let isIterableDone = false;
|
|
15
15
|
let resolvingCount = 0;
|
|
16
16
|
let currentIndex = 0;
|
|
17
|
-
const iterator = void 0 === iterable[Symbol.
|
|
17
|
+
const iterator = void 0 === iterable[Symbol.asyncIterator] ? iterable[Symbol.iterator]() : iterable[Symbol.asyncIterator]();
|
|
18
18
|
const signalListener = ()=>{
|
|
19
19
|
reject(signal.reason);
|
|
20
20
|
};
|
|
@@ -26,10 +26,12 @@ async function pMap(iterable, mapper, { concurrency = 1 / 0, stopOnError = true,
|
|
|
26
26
|
cleanup();
|
|
27
27
|
};
|
|
28
28
|
const reject = (reason)=>{
|
|
29
|
+
if (isResolved) return;
|
|
29
30
|
isRejected = true;
|
|
30
31
|
isResolved = true;
|
|
31
32
|
reject_(reason);
|
|
32
33
|
cleanup();
|
|
34
|
+
if (!isIterableDone) closeIterator(iterator);
|
|
33
35
|
};
|
|
34
36
|
if (signal) {
|
|
35
37
|
if (signal.aborted) return void reject(signal.reason);
|
|
@@ -39,7 +41,9 @@ async function pMap(iterable, mapper, { concurrency = 1 / 0, stopOnError = true,
|
|
|
39
41
|
}
|
|
40
42
|
const next = async ()=>{
|
|
41
43
|
if (isResolved) return;
|
|
42
|
-
const nextItem =
|
|
44
|
+
const nextItem = isIterableDone ? {
|
|
45
|
+
done: true
|
|
46
|
+
} : await iterator.next();
|
|
43
47
|
const index = currentIndex;
|
|
44
48
|
currentIndex++;
|
|
45
49
|
if (nextItem.done) {
|
|
@@ -62,19 +66,15 @@ async function pMap(iterable, mapper, { concurrency = 1 / 0, stopOnError = true,
|
|
|
62
66
|
const value = await mapper(element, index);
|
|
63
67
|
if (value === pMapSkip) skippedIndexesMap.set(index, value);
|
|
64
68
|
result[index] = value;
|
|
65
|
-
|
|
69
|
+
} catch (error) {
|
|
70
|
+
if (stopOnError) return void reject(error);
|
|
71
|
+
errors.push(error);
|
|
72
|
+
}
|
|
73
|
+
resolvingCount--;
|
|
74
|
+
try {
|
|
66
75
|
await next();
|
|
67
76
|
} catch (error) {
|
|
68
|
-
|
|
69
|
-
else {
|
|
70
|
-
errors.push(error);
|
|
71
|
-
resolvingCount--;
|
|
72
|
-
try {
|
|
73
|
-
await next();
|
|
74
|
-
} catch (error) {
|
|
75
|
-
reject(error);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
77
|
+
reject(error);
|
|
78
78
|
}
|
|
79
79
|
})();
|
|
80
80
|
};
|
|
@@ -92,6 +92,11 @@ async function pMap(iterable, mapper, { concurrency = 1 / 0, stopOnError = true,
|
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
const pMapSkip = Symbol('skip');
|
|
95
|
+
async function closeIterator(iterator) {
|
|
96
|
+
try {
|
|
97
|
+
await iterator.return?.();
|
|
98
|
+
} catch {}
|
|
99
|
+
}
|
|
95
100
|
export { getDefaultDarkModeValue, isDarkModeSwitchEnabled } from "@rspress/shared";
|
|
96
101
|
export { createRequire } from "node:module";
|
|
97
102
|
export { default as node_path, isAbsolute, posix, relative, resolve as external_node_path_resolve } from "node:path";
|
package/dist/cli/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { logger, cac } from "../
|
|
2
|
-
import { package_namespaceObject } from "../
|
|
1
|
+
import { logger, cac } from "../a~0.js";
|
|
2
|
+
import { package_namespaceObject } from "../b~0.js";
|
|
3
3
|
import { loadConfigFile, resolveDocRoot } from "../config/loadConfigFile.js";
|
|
4
4
|
import { dev } from "../node/dev.js";
|
|
5
5
|
import { build } from "../node/build.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { node_path, logger, DEFAULT_CONFIG_NAME, DEFAULT_CONFIG_EXTENSIONS } from "../
|
|
1
|
+
import { node_path, logger, DEFAULT_CONFIG_NAME, DEFAULT_CONFIG_EXTENSIONS } from "../a~0.js";
|
|
2
2
|
async function loadConfigFile(customConfigFile) {
|
|
3
3
|
const { loadConfig } = await import("@rsbuild/core");
|
|
4
4
|
const result = await loadConfig({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Head, useI18n } from '@rspress/core/runtime';
|
|
1
|
+
import { Head, useI18n, useSearchHooks } from '@rspress/core/runtime';
|
|
2
2
|
import {
|
|
3
3
|
IconClose,
|
|
4
4
|
IconSearch,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from '@rspress/core/theme';
|
|
10
10
|
import { useEffect, useRef, useState } from 'react';
|
|
11
11
|
import { createPortal } from 'react-dom';
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
import type {
|
|
14
14
|
DefaultMatchResult,
|
|
15
15
|
DefaultMatchResultItem,
|
|
@@ -99,6 +99,7 @@ export function SearchPanel({ focused, setFocused }: SearchPanelProps) {
|
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
101
|
const t = useI18n();
|
|
102
|
+
const userSearchHooks = useSearchHooks();
|
|
102
103
|
const navigate = useLinkNavigate();
|
|
103
104
|
|
|
104
105
|
const {
|
|
@@ -182,6 +183,7 @@ export function SearchPanel({ focused, setFocused }: SearchPanelProps) {
|
|
|
182
183
|
return;
|
|
183
184
|
}
|
|
184
185
|
if (
|
|
186
|
+
focused &&
|
|
185
187
|
currentSuggestionIndex >= 0 &&
|
|
186
188
|
currentRenderType === RenderType.Default
|
|
187
189
|
) {
|
|
@@ -190,8 +192,10 @@ export function SearchPanel({ focused, setFocused }: SearchPanelProps) {
|
|
|
190
192
|
normalizeSuggestions(currentSuggestions).values(),
|
|
191
193
|
).flat();
|
|
192
194
|
const suggestion = flatSuggestions[currentSuggestionIndex];
|
|
193
|
-
|
|
194
|
-
|
|
195
|
+
if (suggestion) {
|
|
196
|
+
navigate(suggestion.link);
|
|
197
|
+
clearSearchState();
|
|
198
|
+
}
|
|
195
199
|
}
|
|
196
200
|
break;
|
|
197
201
|
case KEY_CODE.ESC:
|
|
@@ -242,7 +246,7 @@ export function SearchPanel({ focused, setFocused }: SearchPanelProps) {
|
|
|
242
246
|
{item.renderType === RenderType.Default &&
|
|
243
247
|
renderSearchResultItem(item.result)}
|
|
244
248
|
{item.renderType === RenderType.Custom &&
|
|
245
|
-
userSearchHooks[renderKey](item.result)}
|
|
249
|
+
userSearchHooks[renderKey]?.(item.result)}
|
|
246
250
|
</Tab>
|
|
247
251
|
))}
|
|
248
252
|
</Tabs>
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
type DocumentValue,
|
|
16
16
|
type EnrichedDocumentSearchResults,
|
|
17
17
|
} from 'flexsearch';
|
|
18
|
-
import { searchIndexHash } from '
|
|
18
|
+
import { searchIndexHash } from '@rspress/core/runtime';
|
|
19
19
|
import { LOCAL_INDEX, type Provider, type SearchQuery } from '../Provider';
|
|
20
20
|
import type { SearchOptions } from '../types';
|
|
21
21
|
import { normalizeTextCase } from '../util';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { usePageData } from '@rspress/core/runtime';
|
|
1
|
+
import { usePageData, useSearchHooks } from '@rspress/core/runtime';
|
|
2
2
|
import type { LocalSearchOptions } from '@rspress/core';
|
|
3
3
|
import { debounce } from '@rspress/shared/lodash-es';
|
|
4
4
|
import {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
useState,
|
|
9
9
|
type RefObject,
|
|
10
10
|
} from 'react';
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
import { getSearchIndexURL } from './logic/providers/LocalProvider';
|
|
13
13
|
import { PageSearcher } from './logic/search';
|
|
14
14
|
import type {
|
|
@@ -42,6 +42,7 @@ export function useSearchPanel({
|
|
|
42
42
|
siteData,
|
|
43
43
|
page: { lang, version },
|
|
44
44
|
} = usePageData();
|
|
45
|
+
const userSearchHooks = useSearchHooks();
|
|
45
46
|
const { search, title: siteTitle } = siteData;
|
|
46
47
|
const [query, setQuery] = useState('');
|
|
47
48
|
const [searchResult, setSearchResult] = useState<MatchResult>([]);
|
|
@@ -153,13 +154,13 @@ export function useSearchPanel({
|
|
|
153
154
|
return;
|
|
154
155
|
}
|
|
155
156
|
const result: MatchResult = [];
|
|
156
|
-
if (
|
|
157
|
+
if (userSearchHooks.beforeSearch) {
|
|
157
158
|
const transformedQuery = await userSearchHooks.beforeSearch(newQuery);
|
|
158
159
|
if (transformedQuery) newQuery = transformedQuery;
|
|
159
160
|
}
|
|
160
161
|
const defaultSearchResult = await pageSearcherRef.current?.match(newQuery);
|
|
161
162
|
if (defaultSearchResult) result.push(...defaultSearchResult);
|
|
162
|
-
if (
|
|
163
|
+
if (userSearchHooks.onSearch) {
|
|
163
164
|
const customSearchResult = await userSearchHooks.onSearch(
|
|
164
165
|
newQuery,
|
|
165
166
|
result as DefaultMatchResult[],
|
|
@@ -173,7 +174,7 @@ export function useSearchPanel({
|
|
|
173
174
|
);
|
|
174
175
|
}
|
|
175
176
|
}
|
|
176
|
-
if (
|
|
177
|
+
if (userSearchHooks.afterSearch) {
|
|
177
178
|
await userSearchHooks.afterSearch(newQuery, result);
|
|
178
179
|
}
|
|
179
180
|
if (searchInputRef.current?.value === newQuery) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SocialLink as ISocialLink } from '@rspress/core';
|
|
2
|
-
import
|
|
2
|
+
import { socialLinks } from '@rspress/core/runtime';
|
|
3
3
|
import './index.scss';
|
|
4
4
|
import { GithubStars } from './GithubStars';
|
|
5
5
|
import { useHoverGroup } from '../HoverGroup/useHoverGroup';
|
|
@@ -18,7 +18,7 @@ export const SocialLink = (props: SocialLinkProps) => {
|
|
|
18
18
|
|
|
19
19
|
let IconComp: React.ReactElement = <></>;
|
|
20
20
|
if (icon) {
|
|
21
|
-
const html = typeof icon === 'string' ?
|
|
21
|
+
const html = typeof icon === 'string' ? socialLinks[icon] : icon.svg;
|
|
22
22
|
IconComp = (
|
|
23
23
|
<div
|
|
24
24
|
className="rp-social-links__icon"
|
|
@@ -11,7 +11,7 @@ export function SourceCode(props: SourceCodeProps) {
|
|
|
11
11
|
const { href, platform = 'github' } = props;
|
|
12
12
|
const t = useI18n();
|
|
13
13
|
return (
|
|
14
|
-
<div className="rp-not-doc rp-source-code">
|
|
14
|
+
<div className="rp-not-doc rp-source-code rp-toc-exclude">
|
|
15
15
|
<a href={href} target="_blank" className="rp-source-code__link">
|
|
16
16
|
<span className="rp-source-code__icon">
|
|
17
17
|
{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addTrailingSlash, node_path, addLeadingSlash } from "../
|
|
1
|
+
import { addTrailingSlash, node_path, addLeadingSlash } from "../a~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 {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_PAGE_EXTENSIONS, node_path } from "../../
|
|
1
|
+
import { DEFAULT_PAGE_EXTENSIONS, node_path } from "../../a~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 "../../a~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 "../../a~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 "../a~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 "../a~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
|
}
|
|
@@ -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 "../../a~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 "../../a~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 "../../a~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 [
|
|
@@ -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 "../../a~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 "../../../a~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 "../../../a~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 "../../../a~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 "../../../a~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 "../../../a~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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeHref, removeTrailingSlash, addLeadingSlash, normalizePosixPath, withSiteOrigin } from "../../
|
|
1
|
+
import { normalizeHref, removeTrailingSlash, addLeadingSlash, normalizePosixPath, withSiteOrigin } from "../../a~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");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { writeFile, mkdir, dirname, workerData } from "../../4~0.js";
|
|
2
2
|
import { createError } from "../utils/error.js";
|
|
3
3
|
import { resolveHtmlFilePath } from "./htmlFile.js";
|
|
4
|
-
import { pMap } from "../../
|
|
4
|
+
import { pMap } from "../../b~0.js";
|
|
5
5
|
import { renderPage } from "./renderPage.js";
|
|
6
6
|
const params = workerData?.[1]?.params;
|
|
7
7
|
if (!params) throw createError('SSG Worker Thread workerData params missing');
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*! LICENSE: renderPages.js.LICENSE.txt */
|
|
2
2
|
import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
|
|
3
3
|
import "../../t~0.js";
|
|
4
|
-
import { node_path, fileURLToPath, logger, chunk } from "../../
|
|
4
|
+
import { node_path, fileURLToPath, logger, chunk } from "../../a~0.js";
|
|
5
5
|
import { createAlternateLinksByRoute } from "./alternateLinks.js";
|
|
6
6
|
import { SSGWorkerThreadTaskSize, getNumberOfThreads, SSGWorkerThreadRecyclerMaxMemory, SSGConcurrency } from "./ssgEnv.js";
|
|
7
7
|
import { routePath2HtmlFileName } from "./htmlFile.js";
|
|
8
|
-
import { pMap } from "../../
|
|
8
|
+
import { pMap } from "../../b~0.js";
|
|
9
9
|
import { renderPage } from "./renderPage.js";
|
|
10
10
|
import { hintSSGFailed } from "../logger/hint.js";
|
|
11
11
|
import { renderHtmlTemplate } from "./renderHtmlTemplate.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { logger, writeFile, mkdir, rm, join, isDebugMode } from "../../
|
|
1
|
+
import { logger, writeFile, mkdir, rm, join, isDebugMode } from "../../a~0.js";
|
|
2
2
|
import { NODE_SSG_BUNDLE_FOLDER, NODE_SSG_BUNDLE_NAME } from "../constants.js";
|
|
3
3
|
import { renderPages } from "./renderPages.js";
|
|
4
4
|
const rsbuildPluginSSG = ({ routeService, config, routeChunkAssets })=>({
|
package/dist/node/ssg/ssgEnv.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! LICENSE: ssgEnv.js.LICENSE.txt */
|
|
2
|
-
import { node_os } from "../../
|
|
2
|
+
import { node_os } from "../../a~0.js";
|
|
3
3
|
/**
|
|
4
4
|
* these codes are copied from
|
|
5
5
|
* @link https://github.com/facebook/docusaurus/blob/45065e8d2b5831117b8d69fec1be28f5520cf105/packages/docusaurus/src/ssg/ssgEnv.ts#L11
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { matchPath, getSidebarDataGroup } from "../../../
|
|
1
|
+
import { matchPath, getSidebarDataGroup } from "../../../a~0.js";
|
|
2
2
|
import { generateLlmsTxt, generateLlmsFullTxt } from "./llmsTxt.js";
|
|
3
3
|
async function emitLlmsTxt(config, routeService, emitAsset, mdContents) {
|
|
4
4
|
const base = config.base ?? '/';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeHref, withSiteOrigin, logger, withBase } from "../../../
|
|
1
|
+
import { normalizeHref, withSiteOrigin, logger, withBase } from "../../../a~0.js";
|
|
2
2
|
import { extractInfoFromFrontmatterWithAbsolutePath } from "../../auto-nav-sidebar/utils.js";
|
|
3
3
|
function routePathToMdPath(routePath, base, siteOrigin) {
|
|
4
4
|
let url = routePath;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
|
|
2
2
|
import "../../t~0.js";
|
|
3
|
-
import { createHead, pathToFileURL, logger } from "../../
|
|
3
|
+
import { createHead, pathToFileURL, logger } from "../../a~0.js";
|
|
4
4
|
import { hintSSGFailed } from "../logger/hint.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);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
|
|
2
2
|
import "../../t~0.js";
|
|
3
|
-
import { logger } from "../../
|
|
4
|
-
import { pMap } from "../../
|
|
3
|
+
import { logger } from "../../a~0.js";
|
|
4
|
+
import { pMap } from "../../b~0.js";
|
|
5
5
|
import { renderPage } from "./renderPage.js";
|
|
6
6
|
import { SSGConcurrency } from "../ssg/ssgEnv.js";
|
|
7
7
|
const picocolors = rspackRequire("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { writeFile, mkdir, rm, join, isDebugMode } from "../../
|
|
1
|
+
import { writeFile, mkdir, rm, join, isDebugMode } from "../../a~0.js";
|
|
2
2
|
import { NODE_SSG_MD_BUNDLE_FOLDER, NODE_SSG_MD_BUNDLE_NAME } from "../constants.js";
|
|
3
3
|
import { renderPages } from "./renderPages.js";
|
|
4
4
|
import { emitLlmsTxt } from "./llms/emitLlmsTxt.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createHash as external_node_crypto_createHash } from "../../
|
|
1
|
+
import { createHash as external_node_crypto_createHash } from "../../a~0.js";
|
|
2
2
|
function createHash(str, length = 8) {
|
|
3
3
|
return external_node_crypto_createHash('sha256').update(str).digest('hex').slice(0, length);
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { node_fs, node_path, core_rspack, logger, createProcessor, MDX_OR_MD_REGEXP } from "../../
|
|
1
|
+
import { node_fs, node_path, core_rspack, logger, createProcessor, MDX_OR_MD_REGEXP } from "../../a~0.js";
|
|
2
2
|
import { createError } from "./error.js";
|
|
3
3
|
import { importStatementRegex } from "../constants.js";
|
|
4
4
|
const RspackResolveFactory = core_rspack.experiments.resolver.ResolverFactory;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { rspackRequire, compatGetDefaultExport } from "../../rslib-runtime~0.js";
|
|
2
2
|
import "../../t~0.js";
|
|
3
|
-
import { node_path, core_rspack, logger } from "../../
|
|
3
|
+
import { node_path, core_rspack, logger } from "../../a~0.js";
|
|
4
4
|
import { pathExists, readJson } from "./fs.js";
|
|
5
5
|
import { PACKAGE_ROOT } from "../constants.js";
|
|
6
6
|
import { hintReactVersion } from "../logger/hint.js";
|