@rspress/core 2.1.0-beta.1 → 2.1.0-beta.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.
Files changed (133) hide show
  1. package/dist/cli/index.js +2 -2
  2. package/dist/config/loadConfigFile.js +1 -1
  3. package/dist/eject-theme/components/CdnTabs/index.test.tsx +71 -0
  4. package/dist/eject-theme/components/CdnTabs/index.tsx +175 -0
  5. package/dist/eject-theme/components/DocContent/index.tsx +0 -3
  6. package/dist/eject-theme/components/FallbackHeading/index.tsx +6 -1
  7. package/dist/eject-theme/components/Link/index.tsx +9 -18
  8. package/dist/eject-theme/components/Link/useLinkNavigate.ts +17 -3
  9. package/dist/eject-theme/components/NavTitle/index.test.tsx +78 -0
  10. package/dist/eject-theme/components/NavTitle/index.tsx +9 -5
  11. package/dist/eject-theme/components/PackageManagerTabs/index.test.tsx +79 -1
  12. package/dist/eject-theme/components/PackageManagerTabs/index.tsx +25 -12
  13. package/dist/eject-theme/components/Search/NoSearchResult.scss +1 -2
  14. package/dist/eject-theme/components/Search/SearchPanel.scss +75 -63
  15. package/dist/eject-theme/components/Search/SuggestItem.scss +28 -41
  16. package/dist/eject-theme/components/Sidebar/SidebarItem.scss +8 -0
  17. package/dist/eject-theme/components/Sidebar/SidebarSectionHeader.scss +3 -0
  18. package/dist/node/PluginDriver.d.ts +5 -0
  19. package/dist/node/PluginDriver.js +14 -5
  20. package/dist/node/auto-nav-sidebar/index.js +1 -1
  21. package/dist/node/auto-nav-sidebar/locales.js +1 -1
  22. package/dist/node/auto-nav-sidebar/normalize.js +1 -1
  23. package/dist/node/auto-nav-sidebar/utils.js +1 -1
  24. package/dist/node/auto-nav-sidebar/walk.js +1 -1
  25. package/dist/node/constants.js +1 -1
  26. package/dist/node/eject.js +1 -1
  27. package/dist/node/initRsbuild.js +12 -4
  28. package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -0
  29. package/dist/node/mdx/remarkPlugins/link.js +1 -1
  30. package/dist/node/route/RoutePage.js +1 -1
  31. package/dist/node/route/RouteService.js +1 -1
  32. package/dist/node/route/extractPageData.js +1 -1
  33. package/dist/node/route/normalizeRoutePath.js +1 -1
  34. package/dist/node/runtimeModule/i18n/getI18nData.d.ts +11 -0
  35. package/dist/node/runtimeModule/{i18n.js → i18n/getI18nData.js} +35 -22
  36. package/dist/node/runtimeModule/i18n/rsbuildPlugin.d.ts +5 -0
  37. package/dist/node/runtimeModule/i18n/rsbuildPlugin.js +21 -0
  38. package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
  39. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
  40. package/dist/node/runtimeModule/searchHooks.js +1 -1
  41. package/dist/node/runtimeModule/siteData/createSiteData.d.ts +2 -1
  42. package/dist/node/runtimeModule/siteData/createSiteData.js +3 -3
  43. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.d.ts +2 -1
  44. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +3 -4
  45. package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +2 -2
  46. package/dist/node/serve.js +1 -1
  47. package/dist/node/sitemap.d.ts +7 -2
  48. package/dist/node/sitemap.js +40 -57
  49. package/dist/node/ssg/alternateLinks.js +1 -1
  50. package/dist/node/ssg/htmlFile.js +1 -1
  51. package/dist/node/ssg/renderHtmlTemplate.js +1 -1
  52. package/dist/node/ssg/renderPage.js +1 -1
  53. package/dist/node/ssg/renderPageWorker.js +1 -1
  54. package/dist/node/ssg/renderPages.js +2 -2
  55. package/dist/node/ssg/rsbuildPluginSSG.js +1 -1
  56. package/dist/node/ssg/ssgEnv.js +1 -1
  57. package/dist/node/ssg-md/llms/emitLlmsTxt.js +1 -1
  58. package/dist/node/ssg-md/llms/llmsTxt.js +1 -1
  59. package/dist/node/ssg-md/renderPage.js +1 -1
  60. package/dist/node/ssg-md/renderPages.js +2 -2
  61. package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
  62. package/dist/node/utils/checkLanguageParity.js +1 -1
  63. package/dist/node/utils/createHash.js +1 -1
  64. package/dist/node/utils/flattenMdxContent.js +1 -1
  65. package/dist/node/utils/getPageKey.js +1 -1
  66. package/dist/node/utils/reactAlias.js +2 -2
  67. package/dist/{h~0.js → p~0.js} +6 -4
  68. package/dist/runtime/App.js +14 -10
  69. package/dist/runtime/BrowserOnly.d.ts +1 -1
  70. package/dist/runtime/BrowserOnly.js +53 -20
  71. package/dist/runtime/ClientApp.js +4 -0
  72. package/dist/runtime/NoSSR.d.ts +7 -3
  73. package/dist/runtime/NoSSR.js +30 -9
  74. package/dist/runtime/PageRoute.js +20 -8
  75. package/dist/runtime/index.d.ts +3 -2
  76. package/dist/runtime/index.js +3 -4
  77. package/dist/runtime/react.d.ts +5 -0
  78. package/dist/runtime/react.js +4 -0
  79. package/dist/runtime/reactDom.d.ts +6 -0
  80. package/dist/runtime/reactDom.js +2 -1
  81. package/dist/runtime/socialLinks.d.ts +1 -0
  82. package/dist/runtime/socialLinks.js +3 -0
  83. package/dist/theme/assets/bun.js +101 -0
  84. package/dist/theme/assets/deno.js +15 -0
  85. package/dist/theme/assets/jsdelivr.js +53 -0
  86. package/dist/theme/{components/PackageManagerTabs/icons/Npm.js → assets/npm.js} +4 -4
  87. package/dist/theme/{components/PackageManagerTabs/icons/Pnpm.js → assets/pnpm.js} +4 -4
  88. package/dist/theme/assets/unpkg.js +15 -0
  89. package/dist/theme/assets/yarn.js +22 -0
  90. package/dist/theme/components/CdnTabs/index.d.ts +10 -0
  91. package/dist/theme/components/CdnTabs/index.js +146 -0
  92. package/dist/theme/components/DocContent/index.js +1 -2
  93. package/dist/theme/components/FallbackHeading/index.js +1 -0
  94. package/dist/theme/components/Link/index.js +4 -13
  95. package/dist/theme/components/Link/useLinkNavigate.js +12 -4
  96. package/dist/theme/components/NavTitle/index.js +10 -5
  97. package/dist/theme/components/PackageManagerTabs/index.d.ts +2 -0
  98. package/dist/theme/components/PackageManagerTabs/index.js +22 -12
  99. package/dist/theme/components/Search/NoSearchResult.css +1 -2
  100. package/dist/theme/components/Search/SearchPanel.css +72 -51
  101. package/dist/theme/components/Search/SuggestItem.css +21 -34
  102. package/dist/theme/components/Sidebar/SidebarItem.css +5 -0
  103. package/dist/theme/components/Sidebar/SidebarSectionHeader.css +1 -0
  104. package/dist/theme/hooks/useDynamicToc.js +27 -34
  105. package/dist/theme/icons.d.ts +7 -0
  106. package/dist/theme/icons.js +15 -1
  107. package/dist/theme/index.d.ts +1 -2
  108. package/dist/theme/index.js +1 -2
  109. package/dist/theme/layout/Layout/index.js +1 -2
  110. package/dist/y~0.js +166 -0
  111. package/package.json +13 -13
  112. package/dist/b~0.js +0 -104
  113. package/dist/eject-theme/components/PackageManagerTabs/icons/Bun.tsx +0 -101
  114. package/dist/eject-theme/components/PackageManagerTabs/icons/Deno.tsx +0 -18
  115. package/dist/eject-theme/components/PackageManagerTabs/icons/Npm.tsx +0 -16
  116. package/dist/eject-theme/components/PackageManagerTabs/icons/Pnpm.tsx +0 -22
  117. package/dist/eject-theme/components/PackageManagerTabs/icons/Yarn.tsx +0 -18
  118. package/dist/node/runtimeModule/i18n.d.ts +0 -8
  119. package/dist/theme/components/PackageManagerTabs/icons/Bun.d.ts +0 -2
  120. package/dist/theme/components/PackageManagerTabs/icons/Bun.js +0 -137
  121. package/dist/theme/components/PackageManagerTabs/icons/Deno.d.ts +0 -2
  122. package/dist/theme/components/PackageManagerTabs/icons/Deno.js +0 -15
  123. package/dist/theme/components/PackageManagerTabs/icons/Npm.d.ts +0 -2
  124. package/dist/theme/components/PackageManagerTabs/icons/Pnpm.d.ts +0 -2
  125. package/dist/theme/components/PackageManagerTabs/icons/Yarn.d.ts +0 -2
  126. package/dist/theme/components/PackageManagerTabs/icons/Yarn.js +0 -22
  127. package/dist/theme/logic/useScrollAfterNav.d.ts +0 -5
  128. package/dist/theme/logic/useScrollAfterNav.js +0 -35
  129. package/dist/theme/logic/useScrollReset.d.ts +0 -5
  130. package/dist/theme/logic/useScrollReset.js +0 -12
  131. package/dist/tu~0.js +0 -3
  132. /package/dist/node/runtimeModule/{DEFAULT_I18N_TEXT.d.ts → i18n/DEFAULT_I18N_TEXT.d.ts} +0 -0
  133. /package/dist/node/runtimeModule/{DEFAULT_I18N_TEXT.js → i18n/DEFAULT_I18N_TEXT.js} +0 -0
@@ -1,9 +1,11 @@
1
1
  import arrow_down from "./assets/arrow-down.js";
2
2
  import arrow_right from "./assets/arrow-right.js";
3
3
  import anthropic from "./assets/anthropic.js";
4
+ import bun from "./assets/bun.js";
4
5
  import assets_close from "./assets/close.js";
5
6
  import copy from "./assets/copy.js";
6
7
  import deprecated from "./assets/deprecated.js";
8
+ import deno from "./assets/deno.js";
7
9
  import down from "./assets/down.js";
8
10
  import edit from "./assets/edit.js";
9
11
  import empty from "./assets/empty.js";
@@ -14,20 +16,25 @@ import file from "./assets/file.js";
14
16
  import github from "./assets/github.js";
15
17
  import gitlab from "./assets/gitlab.js";
16
18
  import header from "./assets/header.js";
19
+ import jsdelivr from "./assets/jsdelivr.js";
17
20
  import jump from "./assets/jump.js";
18
21
  import assets_link from "./assets/link.js";
19
22
  import loading from "./assets/loading.js";
20
23
  import menu from "./assets/menu.js";
21
24
  import moon from "./assets/moon.js";
25
+ import npm from "./assets/npm.js";
22
26
  import openai from "./assets/openai.js";
27
+ import pnpm from "./assets/pnpm.js";
23
28
  import scroll_to_top from "./assets/scroll-to-top.js";
24
29
  import search from "./assets/search.js";
25
30
  import small_menu from "./assets/small-menu.js";
26
31
  import success from "./assets/success.js";
27
32
  import sun from "./assets/sun.js";
28
33
  import title from "./assets/title.js";
34
+ import unpkg from "./assets/unpkg.js";
29
35
  import wrap from "./assets/wrap.js";
30
36
  import wrapped from "./assets/wrapped.js";
37
+ import yarn from "./assets/yarn.js";
31
38
  const IconDeprecated = deprecated;
32
39
  const IconExperimental = experimental;
33
40
  const IconExternalLink = external_link;
@@ -35,8 +42,10 @@ const IconOpenInChat = open_in_chat;
35
42
  const IconArrowDown = arrow_down;
36
43
  const IconArrowRight = arrow_right;
37
44
  const IconAnthropic = anthropic;
45
+ const IconBun = bun;
38
46
  const IconClose = assets_close;
39
47
  const IconCopy = copy;
48
+ const IconDeno = deno;
40
49
  const IconDown = down;
41
50
  const IconEdit = edit;
42
51
  const IconEmpty = empty;
@@ -44,18 +53,23 @@ const IconFile = file;
44
53
  const IconGithub = github;
45
54
  const IconGitlab = gitlab;
46
55
  const IconHeader = header;
56
+ const IconJsdelivr = jsdelivr;
47
57
  const IconJump = jump;
48
58
  const IconLoading = loading;
49
59
  const IconMenu = menu;
50
60
  const IconMoon = moon;
61
+ const IconNpm = npm;
51
62
  const IconOpenAI = openai;
63
+ const IconPnpm = pnpm;
52
64
  const IconScrollToTop = scroll_to_top;
53
65
  const IconSearch = search;
54
66
  const IconSmallMenu = small_menu;
55
67
  const IconSuccess = success;
56
68
  const IconSun = sun;
57
69
  const IconTitle = title;
70
+ const IconUnpkg = unpkg;
58
71
  const IconWrap = wrap;
59
72
  const IconWrapped = wrapped;
73
+ const IconYarn = yarn;
60
74
  const IconLink = assets_link;
61
- export { IconAnthropic, IconArrowDown, IconArrowRight, IconClose, IconCopy, IconDeprecated, IconDown, IconEdit, IconEmpty, IconExperimental, IconExternalLink, IconFile, IconGithub, IconGitlab, IconHeader, IconJump, IconLink, IconLoading, IconMenu, IconMoon, IconOpenAI, IconOpenInChat, IconScrollToTop, IconSearch, IconSmallMenu, IconSuccess, IconSun, IconTitle, IconWrap, IconWrapped };
75
+ export { IconAnthropic, IconArrowDown, IconArrowRight, IconBun, IconClose, IconCopy, IconDeno, IconDeprecated, IconDown, IconEdit, IconEmpty, IconExperimental, IconExternalLink, IconFile, IconGithub, IconGitlab, IconHeader, IconJsdelivr, IconJump, IconLink, IconLoading, IconMenu, IconMoon, IconNpm, IconOpenAI, IconOpenInChat, IconPnpm, IconScrollToTop, IconSearch, IconSmallMenu, IconSuccess, IconSun, IconTitle, IconUnpkg, IconWrap, IconWrapped, IconYarn };
@@ -2,6 +2,7 @@ export { Badge, type BadgeProps } from './components/Badge/index.js';
2
2
  export { Banner, type BannerProps } from './components/Banner/index.js';
3
3
  export { Button, type ButtonProps } from './components/Button/index.js';
4
4
  export { Callout, type CalloutProps } from './components/Callout/index.js';
5
+ export { CdnTabs, type CdnName, type CdnTabsProps, } from './components/CdnTabs/index.js';
5
6
  export { CodeBlock, type CodeBlockProps } from './components/CodeBlock/index.js';
6
7
  export { CodeBlockRuntime, type CodeBlockRuntimeProps, } from './components/CodeBlockRuntime/index.js';
7
8
  export { CodeButtonGroup, type CodeButtonGroupProps, useCodeButtonGroup, } from './components/CodeButtonGroup/index.js';
@@ -69,8 +70,6 @@ export { getCopyableText } from './logic/getCopyableText.js';
69
70
  export { mergeRefs } from './logic/mergeRefs.js';
70
71
  export { useFullTextSearch } from './logic/useFullTextSearch.js';
71
72
  export { usePrevNextPage } from './logic/usePrevNextPage.js';
72
- export { useScrollAfterNav } from './logic/useScrollAfterNav.js';
73
- export { useScrollReset } from './logic/useScrollReset.js';
74
73
  export { useSetup } from './logic/useSetup.js';
75
74
  export { useStorageValue } from './logic/useStorageValue.js';
76
75
  export { useThemeState } from './logic/useThemeState.js';
@@ -3,6 +3,7 @@ export { Badge } from "./components/Badge/index.js";
3
3
  export { Banner } from "./components/Banner/index.js";
4
4
  export { Button } from "./components/Button/index.js";
5
5
  export { Callout } from "./components/Callout/index.js";
6
+ export { CdnTabs } from "./components/CdnTabs/index.js";
6
7
  export { CodeBlock } from "./components/CodeBlock/index.js";
7
8
  export { CodeBlockRuntime } from "./components/CodeBlockRuntime/index.js";
8
9
  export { CodeButtonGroup, useCodeButtonGroup } from "./components/CodeButtonGroup/index.js";
@@ -67,8 +68,6 @@ export { getCopyableText } from "./logic/getCopyableText.js";
67
68
  export { mergeRefs } from "./logic/mergeRefs.js";
68
69
  export { useFullTextSearch } from "./logic/useFullTextSearch.js";
69
70
  export { usePrevNextPage } from "./logic/usePrevNextPage.js";
70
- export { useScrollAfterNav } from "./logic/useScrollAfterNav.js";
71
- export { useScrollReset } from "./logic/useScrollReset.js";
72
71
  export { useSetup } from "./logic/useSetup.js";
73
72
  export { useStorageValue } from "./logic/useStorageValue.js";
74
73
  export { useThemeState } from "./logic/useThemeState.js";
@@ -1,6 +1,6 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Content, useFrontmatter, useLocaleSiteData, usePage, useSite } from "@rspress/core/runtime";
3
- import { DocLayout, HomeLayout as theme_HomeLayout, Nav, NotFoundLayout as theme_NotFoundLayout, useScrollReset, useSetup } from "@rspress/core/theme";
3
+ import { DocLayout, HomeLayout as theme_HomeLayout, Nav, NotFoundLayout as theme_NotFoundLayout, useSetup } from "@rspress/core/theme";
4
4
  import { Head, useHead } from "@unhead/react";
5
5
  import react, { memo, useMemo } from "react";
6
6
  const concatTitle = (title, suffix)=>{
@@ -60,7 +60,6 @@ const HeadTags = /*#__PURE__*/ memo((props)=>{
60
60
  });
61
61
  const ClientEffects = ()=>{
62
62
  useSetup();
63
- useScrollReset();
64
63
  return null;
65
64
  };
66
65
  function Layout(props) {
package/dist/y~0.js ADDED
@@ -0,0 +1,166 @@
1
+ var package_namespaceObject = /*#__PURE__*/ JSON.parse('{"rE":"2.1.0-beta.2"}');
2
+ function pMap(iterable, mapper, options) {
3
+ return mapConcurrently(iterable, mapper, options, false);
4
+ }
5
+ async function mapConcurrently(iterable, mapper, { concurrency = 1 / 0, stopOnError = true, signal } = {}, isSettled) {
6
+ return new Promise((resolve_, reject_)=>{
7
+ validateOptions(iterable, mapper, concurrency);
8
+ const result = [];
9
+ const errors = [];
10
+ let skippedCount = 0;
11
+ let isResolved = false;
12
+ let isIterableDone = false;
13
+ const pendingIndexes = new Set();
14
+ let doneIndex = 1 / 0;
15
+ let currentIndex = 0;
16
+ const iterator = getIterator(iterable);
17
+ const signalListener = ()=>{
18
+ reject(signal.reason);
19
+ };
20
+ const cleanup = ()=>{
21
+ signal?.removeEventListener('abort', signalListener);
22
+ };
23
+ const resolve = (value)=>{
24
+ resolve_(value);
25
+ cleanup();
26
+ };
27
+ const reject = (reason)=>{
28
+ if (isResolved) return;
29
+ isResolved = true;
30
+ reject_(reason);
31
+ cleanup();
32
+ if (!isIterableDone) closeIterator(iterator);
33
+ };
34
+ if (signal) {
35
+ if (signal.aborted) return void reject(signal.reason);
36
+ signal.addEventListener('abort', signalListener, {
37
+ once: true
38
+ });
39
+ }
40
+ const pull = createPuller(iterator);
41
+ const settleIfFinished = ()=>{
42
+ if (isResolved || 1 / 0 === doneIndex) return;
43
+ for (const index of pendingIndexes)if (index < doneIndex) return;
44
+ if (!stopOnError) {
45
+ const collectedErrors = [];
46
+ for(let index = 0; index < Math.min(doneIndex, errors.length); index++)if (index in errors) collectedErrors.push(errors[index]);
47
+ if (collectedErrors.length > 0) return void reject(new AggregateError(collectedErrors));
48
+ }
49
+ isResolved = true;
50
+ if (!isIterableDone) closeIterator(iterator);
51
+ const lastIndex = Math.min(doneIndex, result.length);
52
+ if (lastIndex === result.length && 0 === skippedCount) return void resolve(result);
53
+ resolve(result.slice(0, lastIndex).filter((value)=>value !== pMapSkip));
54
+ };
55
+ const next = async ()=>{
56
+ if (isResolved || currentIndex >= doneIndex) return;
57
+ const index = currentIndex++;
58
+ pendingIndexes.add(index);
59
+ let nextItem;
60
+ try {
61
+ nextItem = await pull();
62
+ } catch (error) {
63
+ pendingIndexes.delete(index);
64
+ if (index < doneIndex) throw error;
65
+ settleIfFinished();
66
+ return;
67
+ }
68
+ if (nextItem.done) {
69
+ pendingIndexes.delete(index);
70
+ doneIndex = Math.min(doneIndex, index);
71
+ isIterableDone = true;
72
+ settleIfFinished();
73
+ return;
74
+ }
75
+ const runner = (async ()=>{
76
+ try {
77
+ const element = await nextItem.value;
78
+ if (isResolved || index >= doneIndex) return;
79
+ const value = await mapper(element, index);
80
+ if (index >= doneIndex) return;
81
+ if (value === pMapStop) {
82
+ doneIndex = index;
83
+ return;
84
+ }
85
+ if (value === pMapSkip) skippedCount++;
86
+ result[index] = isSettled && value !== pMapSkip ? {
87
+ status: 'fulfilled',
88
+ value
89
+ } : value;
90
+ } catch (error) {
91
+ if (index >= doneIndex) return;
92
+ if (isSettled) result[index] = {
93
+ status: 'rejected',
94
+ reason: error
95
+ };
96
+ else {
97
+ if (stopOnError) return void reject(error);
98
+ errors[index] = error;
99
+ }
100
+ } finally{
101
+ pendingIndexes.delete(index);
102
+ settleIfFinished();
103
+ }
104
+ try {
105
+ await next();
106
+ } catch (error) {
107
+ reject(error);
108
+ }
109
+ })();
110
+ runner.then(()=>new Promise(()=>{})).then(resolve_);
111
+ };
112
+ (async ()=>{
113
+ for(let index = 0; index < concurrency; index++){
114
+ try {
115
+ await next();
116
+ } catch (error) {
117
+ reject(error);
118
+ break;
119
+ }
120
+ if (isResolved || currentIndex >= doneIndex) break;
121
+ }
122
+ })();
123
+ });
124
+ }
125
+ const pMapSkip = Symbol('skip');
126
+ const pMapStop = Symbol('stop');
127
+ function validateOptions(iterable, mapper, concurrency) {
128
+ if (iterable?.[Symbol.iterator] === void 0 && iterable?.[Symbol.asyncIterator] === void 0) throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof iterable})`);
129
+ if ('function' != typeof mapper) throw new TypeError('Mapper function is required');
130
+ if (!isLimit(concurrency, 1)) throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
131
+ }
132
+ function isLimit(value, minimum) {
133
+ return Number.isSafeInteger(value) && value >= minimum || 1 / 0 === value;
134
+ }
135
+ function getIterator(iterable) {
136
+ return void 0 === iterable[Symbol.asyncIterator] ? iterable[Symbol.iterator]() : iterable[Symbol.asyncIterator]();
137
+ }
138
+ async function closeIterator(iterator) {
139
+ try {
140
+ await iterator.return?.();
141
+ } catch {}
142
+ }
143
+ function createPuller(iterator) {
144
+ let isSourceDone = false;
145
+ const markDone = (item)=>{
146
+ if (item?.done) isSourceDone = true;
147
+ };
148
+ return ()=>{
149
+ if (isSourceDone) return {
150
+ done: true
151
+ };
152
+ const result = iterator.next();
153
+ markDone(result);
154
+ if ('function' != typeof result?.then) return result;
155
+ const promise = Promise.resolve(result);
156
+ promise.then(markDone, ()=>{});
157
+ return promise;
158
+ };
159
+ }
160
+ export { getDefaultDarkModeValue, isDarkModeSwitchEnabled } from "@rspress/shared";
161
+ export { createRequire } from "node:module";
162
+ export { default as node_path, isAbsolute, posix, relative, resolve as external_node_path_resolve } from "node:path";
163
+ export { pathToFileURL } from "node:url";
164
+ export { logger } from "@rspress/shared/logger";
165
+ export { createHead, transformHtmlTemplate } from "@unhead/react/server";
166
+ export { pMap, package_namespaceObject };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/core",
3
- "version": "2.1.0-beta.1",
3
+ "version": "2.1.0-beta.2",
4
4
  "description": "The Rspress Documentation Framework",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -60,12 +60,12 @@
60
60
  "dependencies": {
61
61
  "@mdx-js/mdx": "^3.1.1",
62
62
  "@mdx-js/react": "^3.1.1",
63
- "@rsbuild/core": "^2.2.12",
63
+ "@rsbuild/core": "^2.2.14",
64
64
  "@rsbuild/plugin-react": "~2.1.1",
65
- "@rspress/shared": "2.1.0-beta.1",
65
+ "@rspress/shared": "2.1.0-beta.2",
66
66
  "@shikijs/rehype": "^4.2.0",
67
67
  "@types/mdast": "^4.0.4",
68
- "@types/react": "^19.2.18",
68
+ "@types/react": "^19.3.0",
69
69
  "@unhead/react": "^2.1.17",
70
70
  "body-scroll-lock": "4.0.0-beta.0",
71
71
  "clsx": "2.1.1",
@@ -77,15 +77,15 @@
77
77
  "mdast-util-mdxjs-esm": "^2.0.1",
78
78
  "medium-zoom": "1.1.0",
79
79
  "nprogress": "^0.2.0",
80
- "react": "^19.2.8",
81
- "react-dom": "^19.2.8",
80
+ "react": "^19.3.0",
81
+ "react-dom": "^19.3.0",
82
82
  "react-lazy-with-preload": "^2.2.1",
83
83
  "react-render-to-markdown": "19.1.0",
84
84
  "react-router-dom": "^7.18.4",
85
85
  "rehype-external-links": "^3.0.0",
86
86
  "rehype-raw": "^7.0.0",
87
- "remark-cjk-friendly": "^2.3.2",
88
- "remark-cjk-friendly-gfm-strikethrough": "^2.3.1",
87
+ "remark-cjk-friendly": "^2.3.3",
88
+ "remark-cjk-friendly-gfm-strikethrough": "^2.3.2",
89
89
  "remark-gfm": "^4.0.1",
90
90
  "remark-mdx": "^3.1.1",
91
91
  "remark-parse": "^11.0.0",
@@ -106,16 +106,16 @@
106
106
  "@types/hast": "^3.0.5",
107
107
  "@types/node": "^22.8.1",
108
108
  "@types/nprogress": "^0.2.3",
109
- "@types/react-dom": "^19.2.7",
110
- "@types/web": "^0.0.358",
111
- "cac": "^7.0.1",
109
+ "@types/react-dom": "^19.3.0",
110
+ "@types/web": "^0.0.359",
111
+ "cac": "^7.1.0",
112
112
  "execa": "8.0.1",
113
113
  "mdast-util-directive": "^3.1.1",
114
114
  "mdast-util-mdx-expression": "^2.0.1",
115
115
  "memfs": "^4.80.0",
116
- "p-map": "^7.0.8",
116
+ "p-map": "^7.1.1",
117
117
  "picocolors": "^1.1.1",
118
- "postcss": "8.5.29",
118
+ "postcss": "8.5.31",
119
119
  "remark-directive": "^4.0.0",
120
120
  "rsbuild-plugin-publint": "^1.0.0",
121
121
  "rsbuild-plugin-virtual-module": "0.4.5",
package/dist/b~0.js DELETED
@@ -1,104 +0,0 @@
1
- var package_namespaceObject = /*#__PURE__*/ JSON.parse('{"rE":"2.1.0-beta.1"}');
2
- async function pMap(iterable, mapper, { concurrency = 1 / 0, stopOnError = true, signal } = {}) {
3
- return new Promise((resolve_, reject_)=>{
4
- if (void 0 === iterable[Symbol.iterator] && void 0 === iterable[Symbol.asyncIterator]) throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof iterable})`);
5
- if ('function' != typeof mapper) throw new TypeError('Mapper function is required');
6
- if (!(Number.isSafeInteger(concurrency) && concurrency >= 1 || 1 / 0 === concurrency)) throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
7
- const result = [];
8
- const errors = [];
9
- const skippedIndexesMap = new Map();
10
- let isRejected = false;
11
- let isResolved = false;
12
- let isIterableDone = false;
13
- let resolvingCount = 0;
14
- let currentIndex = 0;
15
- const iterator = void 0 === iterable[Symbol.asyncIterator] ? iterable[Symbol.iterator]() : iterable[Symbol.asyncIterator]();
16
- const signalListener = ()=>{
17
- reject(signal.reason);
18
- };
19
- const cleanup = ()=>{
20
- signal?.removeEventListener('abort', signalListener);
21
- };
22
- const resolve = (value)=>{
23
- resolve_(value);
24
- cleanup();
25
- };
26
- const reject = (reason)=>{
27
- if (isResolved) return;
28
- isRejected = true;
29
- isResolved = true;
30
- reject_(reason);
31
- cleanup();
32
- if (!isIterableDone) closeIterator(iterator);
33
- };
34
- if (signal) {
35
- if (signal.aborted) return void reject(signal.reason);
36
- signal.addEventListener('abort', signalListener, {
37
- once: true
38
- });
39
- }
40
- const next = async ()=>{
41
- if (isResolved) return;
42
- const nextItem = isIterableDone ? {
43
- done: true
44
- } : await iterator.next();
45
- const index = currentIndex;
46
- currentIndex++;
47
- if (nextItem.done) {
48
- isIterableDone = true;
49
- if (0 === resolvingCount && !isResolved) {
50
- if (!stopOnError && errors.length > 0) return void reject(new AggregateError(errors));
51
- isResolved = true;
52
- if (0 === skippedIndexesMap.size) return void resolve(result);
53
- const pureResult = [];
54
- for (const [index, value] of result.entries())if (skippedIndexesMap.get(index) !== pMapSkip) pureResult.push(value);
55
- resolve(pureResult);
56
- }
57
- return;
58
- }
59
- resolvingCount++;
60
- (async ()=>{
61
- try {
62
- const element = await nextItem.value;
63
- if (isResolved) return;
64
- const value = await mapper(element, index);
65
- if (value === pMapSkip) skippedIndexesMap.set(index, value);
66
- result[index] = value;
67
- } catch (error) {
68
- if (stopOnError) return void reject(error);
69
- errors.push(error);
70
- }
71
- resolvingCount--;
72
- try {
73
- await next();
74
- } catch (error) {
75
- reject(error);
76
- }
77
- })();
78
- };
79
- (async ()=>{
80
- for(let index = 0; index < concurrency; index++){
81
- try {
82
- await next();
83
- } catch (error) {
84
- reject(error);
85
- break;
86
- }
87
- if (isIterableDone || isRejected) break;
88
- }
89
- })();
90
- });
91
- }
92
- const pMapSkip = Symbol('skip');
93
- async function closeIterator(iterator) {
94
- try {
95
- await iterator.return?.();
96
- } catch {}
97
- }
98
- export { getDefaultDarkModeValue, isDarkModeSwitchEnabled } from "@rspress/shared";
99
- export { createRequire } from "node:module";
100
- export { default as node_path, isAbsolute, posix, relative, resolve as external_node_path_resolve } from "node:path";
101
- export { pathToFileURL } from "node:url";
102
- export { logger } from "@rspress/shared/logger";
103
- export { createHead, transformHtmlTemplate } from "@unhead/react/server";
104
- export { pMap, package_namespaceObject };
@@ -1,101 +0,0 @@
1
- import type { ComponentProps } from 'react';
2
-
3
- export function Bun(props: ComponentProps<'svg'>) {
4
- return (
5
- <svg id="Bun" width="1.2em" height="1.2em" viewBox="0 0 80 70" {...props}>
6
- <path
7
- id="Shadow"
8
- d="M71.09,20.74c-.16-.17-.33-.34-.5-.5s-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5A26.46,26.46,0,0,1,75.5,35.7c0,16.57-16.82,30.05-37.5,30.05-11.58,0-21.94-4.23-28.83-10.86l.5.5.5.5.5.5.5.5.5.5.5.5.5.5C19.55,65.3,30.14,69.75,42,69.75c20.68,0,37.5-13.48,37.5-30C79.5,32.69,76.46,26,71.09,20.74Z"
9
- />
10
- <g id="Body">
11
- <path
12
- id="Background"
13
- d="M73,35.7c0,15.21-15.67,27.54-35,27.54S3,50.91,3,35.7C3,26.27,9,17.94,18.22,13S33.18,3,38,3s8.94,4.13,19.78,10C67,17.94,73,26.27,73,35.7Z"
14
- style={{ fill: '#fbf0df' }}
15
- />
16
- <path
17
- id="Bottom_Shadow"
18
- data-name="Bottom Shadow"
19
- d="M73,35.7a21.67,21.67,0,0,0-.8-5.78c-2.73,33.3-43.35,34.9-59.32,24.94A40,40,0,0,0,38,63.24C57.3,63.24,73,50.89,73,35.7Z"
20
- style={{ fill: '#f6dece' }}
21
- />
22
- <path
23
- id="Light_Shine"
24
- data-name="Light Shine"
25
- d="M24.53,11.17C29,8.49,34.94,3.46,40.78,3.45A9.29,9.29,0,0,0,38,3c-2.42,0-5,1.25-8.25,3.13-1.13.66-2.3,1.39-3.54,2.15-2.33,1.44-5,3.07-8,4.7C8.69,18.13,3,26.62,3,35.7c0,.4,0,.8,0,1.19C9.06,15.48,20.07,13.85,24.53,11.17Z"
26
- style={{ fill: '#fffefc' }}
27
- />
28
- <path
29
- id="Top"
30
- d="M35.12,5.53A16.41,16.41,0,0,1,29.49,18c-.28.25-.06.73.3.59,3.37-1.31,7.92-5.23,6-13.14C35.71,5,35.12,5.12,35.12,5.53Zm2.27,0A16.24,16.24,0,0,1,39,19c-.12.35.31.65.55.36C41.74,16.56,43.65,11,37.93,5,37.64,4.74,37.19,5.14,37.39,5.49Zm2.76-.17A16.42,16.42,0,0,1,47,17.12a.33.33,0,0,0,.65.11c.92-3.49.4-9.44-7.17-12.53C40.08,4.54,39.82,5.08,40.15,5.32ZM21.69,15.76a16.94,16.94,0,0,0,10.47-9c.18-.36.75-.22.66.18-1.73,8-7.52,9.67-11.12,9.45C21.32,16.4,21.33,15.87,21.69,15.76Z"
31
- style={{ fill: '#ccbea7', fillRule: 'evenodd' }}
32
- />
33
- <path
34
- id="Outline"
35
- d="M38,65.75C17.32,65.75.5,52.27.5,35.7c0-10,6.18-19.33,16.53-24.92,3-1.6,5.57-3.21,7.86-4.62,1.26-.78,2.45-1.51,3.6-2.19C32,1.89,35,.5,38,.5s5.62,1.2,8.9,3.14c1,.57,2,1.19,3.07,1.87,2.49,1.54,5.3,3.28,9,5.27C69.32,16.37,75.5,25.69,75.5,35.7,75.5,52.27,58.68,65.75,38,65.75ZM38,3c-2.42,0-5,1.25-8.25,3.13-1.13.66-2.3,1.39-3.54,2.15-2.33,1.44-5,3.07-8,4.7C8.69,18.13,3,26.62,3,35.7,3,50.89,18.7,63.25,38,63.25S73,50.89,73,35.7C73,26.62,67.31,18.13,57.78,13,54,11,51.05,9.12,48.66,7.64c-1.09-.67-2.09-1.29-3-1.84C42.63,4,40.42,3,38,3Z"
36
- />
37
- </g>
38
- <g id="Mouth">
39
- <g id="Background-2" data-name="Background">
40
- <path
41
- d="M45.05,43a8.93,8.93,0,0,1-2.92,4.71,6.81,6.81,0,0,1-4,1.88A6.84,6.84,0,0,1,34,47.71,8.93,8.93,0,0,1,31.12,43a.72.72,0,0,1,.8-.81H44.26A.72.72,0,0,1,45.05,43Z"
42
- style={{ fill: '#b71422' }}
43
- />
44
- </g>
45
- <g id="Tongue">
46
- <path
47
- id="Background-3"
48
- data-name="Background"
49
- d="M34,47.79a6.91,6.91,0,0,0,4.12,1.9,6.91,6.91,0,0,0,4.11-1.9,10.63,10.63,0,0,0,1-1.07,6.83,6.83,0,0,0-4.9-2.31,6.15,6.15,0,0,0-5,2.78C33.56,47.4,33.76,47.6,34,47.79Z"
50
- style={{ fill: '#ff6164' }}
51
- />
52
- <path
53
- id="Outline-2"
54
- data-name="Outline"
55
- d="M34.16,47a5.36,5.36,0,0,1,4.19-2.08,6,6,0,0,1,4,1.69c.23-.25.45-.51.66-.77a7,7,0,0,0-4.71-1.93,6.36,6.36,0,0,0-4.89,2.36A9.53,9.53,0,0,0,34.16,47Z"
56
- />
57
- </g>
58
- <path
59
- id="Outline-3"
60
- data-name="Outline"
61
- d="M38.09,50.19a7.42,7.42,0,0,1-4.45-2,9.52,9.52,0,0,1-3.11-5.05,1.2,1.2,0,0,1,.26-1,1.41,1.41,0,0,1,1.13-.51H44.26a1.44,1.44,0,0,1,1.13.51,1.19,1.19,0,0,1,.25,1h0a9.52,9.52,0,0,1-3.11,5.05A7.42,7.42,0,0,1,38.09,50.19Zm-6.17-7.4c-.16,0-.2.07-.21.09a8.29,8.29,0,0,0,2.73,4.37A6.23,6.23,0,0,0,38.09,49a6.28,6.28,0,0,0,3.65-1.73,8.3,8.3,0,0,0,2.72-4.37.21.21,0,0,0-.2-.09Z"
62
- />
63
- </g>
64
- <g id="Face">
65
- <ellipse
66
- id="Right_Blush"
67
- data-name="Right Blush"
68
- cx="53.22"
69
- cy="40.18"
70
- rx="5.85"
71
- ry="3.44"
72
- style={{
73
- fill: '#febbd0',
74
- }}
75
- />
76
- <ellipse
77
- id="Left_Bluch"
78
- data-name="Left Bluch"
79
- cx="22.95"
80
- cy="40.18"
81
- rx="5.85"
82
- ry="3.44"
83
- style={{ fill: '#febbd0' }}
84
- />
85
- <path
86
- id="Eyes"
87
- d="M25.7,38.8a5.51,5.51,0,1,0-5.5-5.51A5.51,5.51,0,0,0,25.7,38.8Zm24.77,0A5.51,5.51,0,1,0,45,33.29,5.5,5.5,0,0,0,50.47,38.8Z"
88
- style={{ fillRule: 'evenodd' }}
89
- />
90
- <path
91
- id="Iris"
92
- d="M24,33.64a2.07,2.07,0,1,0-2.06-2.07A2.07,2.07,0,0,0,24,33.64Zm24.77,0a2.07,2.07,0,1,0-2.06-2.07A2.07,2.07,0,0,0,48.75,33.64Z"
93
- style={{
94
- fill: '#fff',
95
- fillRule: 'evenodd',
96
- }}
97
- />
98
- </g>
99
- </svg>
100
- );
101
- }
@@ -1,18 +0,0 @@
1
- import type { ComponentProps } from 'react';
2
-
3
- export function Deno(props: ComponentProps<'svg'>) {
4
- return (
5
- <svg
6
- xmlns="http://www.w3.org/2000/svg"
7
- width="1em"
8
- height="1em"
9
- viewBox="0 0 24 24"
10
- {...props}
11
- >
12
- <path
13
- fill="currentColor"
14
- d="M1.105 18.02A11.9 11.9 0 0 1 0 12.985q0-.698.078-1.376a12 12 0 0 1 .231-1.34A12 12 0 0 1 4.025 4.02a12 12 0 0 1 5.46-2.771a12 12 0 0 1 3.428-.23c1.452.112 2.825.477 4.077 1.05a12 12 0 0 1 2.78 1.774a12.02 12.02 0 0 1 4.053 7.078A12 12 0 0 1 24 12.985q0 .454-.036.914a12 12 0 0 1-.728 3.305a12 12 0 0 1-2.38 3.875c-1.33 1.357-3.02 1.962-4.43 1.936a4.4 4.4 0 0 1-2.724-1.024c-.99-.853-1.391-1.83-1.53-2.919a5 5 0 0 1 .128-1.518c.105-.38.37-1.116.76-1.437c-.455-.197-1.04-.624-1.226-.829c-.045-.05-.04-.13 0-.183a.155.155 0 0 1 .177-.053c.392.134.869.267 1.372.35c.66.111 1.484.25 2.317.292c2.03.1 4.153-.813 4.812-2.627s.403-3.609-1.96-4.685s-3.454-2.356-5.363-3.128c-1.247-.505-2.636-.205-4.06.582c-3.838 2.121-7.277 8.822-5.69 15.032a.191.191 0 0 1-.315.19a12 12 0 0 1-1.25-1.634a12 12 0 0 1-.769-1.404M11.57 6.087c.649-.051 1.214.501 1.31 1.236c.13.979-.228 1.99-1.41 2.013c-1.01.02-1.315-.997-1.248-1.614c.066-.616.574-1.575 1.35-1.635"
15
- />
16
- </svg>
17
- );
18
- }
@@ -1,16 +0,0 @@
1
- import type { ComponentProps } from 'react';
2
-
3
- export function Npm(props: ComponentProps<'svg'>) {
4
- return (
5
- <svg
6
- xmlns="http://www.w3.org/2000/svg"
7
- width="1em"
8
- height="1em"
9
- viewBox="0 0 256 256"
10
- {...props}
11
- >
12
- <path fill="#C12127" d="M0 256V0h256v256z"></path>
13
- <path fill="#FFF" d="M48 48h160v160h-32V80h-48v128H48z"></path>
14
- </svg>
15
- );
16
- }
@@ -1,22 +0,0 @@
1
- import type { ComponentProps } from 'react';
2
-
3
- export function Pnpm(props: ComponentProps<'svg'>) {
4
- return (
5
- <svg
6
- xmlns="http://www.w3.org/2000/svg"
7
- width="1em"
8
- height="1em"
9
- viewBox="0 0 128 128"
10
- {...props}
11
- >
12
- <path
13
- fill="#f8ab00"
14
- d="M0 .004V40h39.996V.004Zm43.996 0V40h40V.004Zm44.008 0V40H128V.004Zm0 43.996v39.996H128V44Z"
15
- ></path>
16
- <path
17
- fill="#4c4c4c"
18
- d="M43.996 44v39.996h40V44ZM0 87.996v40h39.996v-40Zm43.996 0v40h40v-40Zm44.008 0v40H128v-40Z"
19
- ></path>
20
- </svg>
21
- );
22
- }
@@ -1,18 +0,0 @@
1
- import type { ComponentProps } from 'react';
2
-
3
- export function Yarn(props: ComponentProps<'svg'>) {
4
- return (
5
- <svg
6
- xmlns="http://www.w3.org/2000/svg"
7
- width="1em"
8
- height="1em"
9
- viewBox="0 0 128 128"
10
- {...props}
11
- >
12
- <g fill="#2c8ebb">
13
- <path d="M99.24 80.71C94.9 80.76 91.1 83 87.89 85c-6 3.71-9 3.47-9 3.47l-.1-.17c-.41-.67 1.92-6.68-.69-13.84c-2.82-7.83-7.3-9.72-6.94-10.32c1.53-2.59 5.36-6.7 6.89-14.36c.91-4.64.67-12.28-1.39-16.28c-.38-.74-3.78 1.24-3.78 1.24s-3.18-7.09-4.07-7.66c-2.87-1.84-6 7.61-6 7.61a14 14 0 0 0-11.71 4.5a9.64 9.64 0 0 1-3.85 2.27c-.41.14-.91.12-2.15 3.47c-1.9 5.07 3.24 10.81 3.24 10.81s-6.13 4.33-8.4 9.72a24.78 24.78 0 0 0-1.75 11.68s-4.36 3.78-4.64 7.68a12.87 12.87 0 0 0 1.77 7.83a1.94 1.94 0 0 0 2.63.91s-2.9 3.38-.19 4.81c2.47 1.29 6.63 2 8.83-.19c1.6-1.6 1.92-5.17 2.51-6.63c.14-.34.62.57 1.08 1a10 10 0 0 0 1.36 1s-3.9 1.68-2.3 5.51c.53 1.27 2.42 2.08 5.51 2.06c1.15 0 13.76-.72 17.12-1.53a4.33 4.33 0 0 0 2.61-1.46a63 63 0 0 0 15.49-7c4.74-3.09 6.68-3.93 10.51-4.84c3.16-.75 2.95-5.65-1.24-5.58z"></path>
14
- <path d="M64 2a62 62 0 1 0 62 62A62 62 0 0 0 64 2zm37.3 87.83c-3.35.81-4.91 1.44-9.41 4.36a67 67 0 0 1-15.56 7.18a8.71 8.71 0 0 1-3.64 1.77c-3.81.93-16.88 1.63-17.91 1.63h-.24c-4 0-6.27-1.24-7.49-2.54c-3.4 1.7-7.8 1-11-.69a5.55 5.55 0 0 1-3-3.9a6 6 0 0 1 0-2.06a6.66 6.66 0 0 1-.79-1A16.38 16.38 0 0 1 30 84.52c.29-3.73 2.87-7.06 4.55-8.83A28.56 28.56 0 0 1 36.61 64a26.82 26.82 0 0 1 6.82-9c-1.65-2.78-3.33-7.06-1.7-11.42c1.17-3.11 2.13-4.84 4.24-5.58a6.84 6.84 0 0 0 2.51-1.34A17.65 17.65 0 0 1 60.34 31c.19-.48.41-1 .65-1.46c1.6-3.4 3.3-5.31 5.29-6a4.88 4.88 0 0 1 4.4.5c.65.43 1.48 1 3.9 6a4.69 4.69 0 0 1 2.85-.1a3.81 3.81 0 0 1 2.39 1.94c2.47 4.74 2.8 13.19 1.72 18.62a33.8 33.8 0 0 1-5.84 13.31a25.73 25.73 0 0 1 5.77 9.43a25.42 25.42 0 0 1 1.41 10.41A28.7 28.7 0 0 0 86 81.91c3.06-1.89 7.68-4.74 13.19-4.81a6.62 6.62 0 0 1 7 5.7a6.35 6.35 0 0 1-4.89 7.03z"></path>
15
- </g>
16
- </svg>
17
- );
18
- }
@@ -1,8 +0,0 @@
1
- import type { UserConfig } from '@rspress/shared';
2
- import type { PluginDriver } from '../PluginDriver.js';
3
- import { type VirtualModulePlugin } from './types.js';
4
- export declare function getI18nData(docConfig: UserConfig, pluginDriver?: PluginDriver): Promise<Record<string, Record<string, string>>>;
5
- /**
6
- * Generate i18n text for client runtime
7
- */
8
- export declare const i18nVMPlugin: VirtualModulePlugin;
@@ -1,2 +0,0 @@
1
- import type { ComponentProps } from 'react';
2
- export declare function Bun(props: ComponentProps<'svg'>): import("react").JSX.Element;