@rspress/core 2.0.11 → 2.0.13

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 (119) hide show
  1. package/dist/0~execa.js +1 -1
  2. package/dist/{8857.js → 5580.js} +2 -2
  3. package/dist/{1688.js → 7275.js} +6 -1
  4. package/dist/{8006.js → 7986.js} +1 -6
  5. package/dist/cli/index.js +4 -4
  6. package/dist/config/loadConfigFile.js +1 -1
  7. package/dist/eject-theme/components/CodeBlock/index.test.tsx +49 -0
  8. package/dist/eject-theme/components/CodeBlock/index.tsx +1 -1
  9. package/dist/eject-theme/components/CodeButtonGroup/index.tsx +5 -2
  10. package/dist/eject-theme/components/FallbackHeading/index.test.tsx +45 -0
  11. package/dist/eject-theme/components/FallbackHeading/index.tsx +1 -1
  12. package/dist/eject-theme/components/Link/useLinkNavigate.ts +2 -2
  13. package/dist/eject-theme/components/Overview/index.test.tsx +57 -0
  14. package/dist/eject-theme/components/Overview/index.tsx +1 -1
  15. package/dist/eject-theme/components/OverviewGroup/index.test.tsx +61 -0
  16. package/dist/eject-theme/components/OverviewGroup/index.tsx +1 -1
  17. package/dist/eject-theme/components/PackageManagerTabs/index.test.tsx +54 -0
  18. package/dist/eject-theme/components/PackageManagerTabs/index.tsx +17 -18
  19. package/dist/eject-theme/components/Search/SearchPanel.tsx +1 -6
  20. package/dist/eject-theme/components/Sidebar/SidebarItem.tsx +1 -1
  21. package/dist/eject-theme/components/Steps/index.scss +6 -4
  22. package/dist/eject-theme/components/Tabs/index.test.tsx +51 -0
  23. package/dist/eject-theme/components/Tabs/index.tsx +49 -42
  24. package/dist/index.js +1 -1
  25. package/dist/node/PluginDriver.js +1 -1
  26. package/dist/node/auto-nav-sidebar/index.js +1 -1
  27. package/dist/node/auto-nav-sidebar/locales.js +1 -1
  28. package/dist/node/auto-nav-sidebar/normalize.d.ts +1 -1
  29. package/dist/node/auto-nav-sidebar/normalize.js +3 -4
  30. package/dist/node/auto-nav-sidebar/utils.js +1 -1
  31. package/dist/node/auto-nav-sidebar/walk.js +1 -1
  32. package/dist/node/constants.js +3 -3
  33. package/dist/node/eject.js +2 -2
  34. package/dist/node/initRsbuild.js +5 -8
  35. package/dist/node/logger/hint.js +1 -1
  36. package/dist/node/mdx/options.js +1 -1
  37. package/dist/node/mdx/processor.js +1 -1
  38. package/dist/node/mdx/rehypePlugins/codeMeta.js +1 -1
  39. package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -1
  40. package/dist/node/mdx/rehypePlugins/shiki.js +1 -1
  41. package/dist/node/mdx/rehypePlugins/transformers/add-title.js +3 -6
  42. package/dist/node/mdx/remarkPlugins/builtin.js +1 -1
  43. package/dist/node/mdx/remarkPlugins/containerSyntax.d.ts +1 -1
  44. package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +2 -2
  45. package/dist/node/mdx/remarkPlugins/image.d.ts +1 -1
  46. package/dist/node/mdx/remarkPlugins/image.js +4 -4
  47. package/dist/node/mdx/remarkPlugins/link.d.ts +1 -1
  48. package/dist/node/mdx/remarkPlugins/link.js +2 -2
  49. package/dist/node/mdx/remarkPlugins/toc.js +1 -1
  50. package/dist/node/medium-zoom/index.js +1 -1
  51. package/dist/node/route/RoutePage.js +1 -1
  52. package/dist/node/route/RouteService.js +2 -3
  53. package/dist/node/route/extractPageData.js +1 -1
  54. package/dist/node/route/normalizeRoutePath.js +1 -1
  55. package/dist/node/runtimeModule/DEFAULT_I18N_TEXT.d.ts +147 -140
  56. package/dist/node/runtimeModule/DEFAULT_I18N_TEXT.js +7 -0
  57. package/dist/node/runtimeModule/i18n.js +2 -2
  58. package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
  59. package/dist/node/runtimeModule/pageData/rsbuildPlugin.d.ts +1 -1
  60. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
  61. package/dist/node/runtimeModule/searchHooks.js +1 -1
  62. package/dist/node/runtimeModule/siteData/createSiteData.js +1 -1
  63. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +1 -1
  64. package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +1 -1
  65. package/dist/node/serve.js +1 -1
  66. package/dist/node/ssg/renderPage.js +2 -2
  67. package/dist/node/ssg/renderPageWorker.js +2 -2
  68. package/dist/node/ssg/renderPages.js +3 -3
  69. package/dist/node/ssg/rsbuildPluginSSG.js +1 -1
  70. package/dist/node/ssg/ssgEnv.js +1 -1
  71. package/dist/node/ssg-md/llms/emitLlmsTxt.js +1 -1
  72. package/dist/node/ssg-md/llms/llmsTxt.js +1 -1
  73. package/dist/node/ssg-md/remarkSplitMdx.js +1 -1
  74. package/dist/node/ssg-md/renderPage.js +2 -2
  75. package/dist/node/ssg-md/renderPages.js +3 -3
  76. package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
  77. package/dist/node/utils/checkLanguageParity.js +1 -1
  78. package/dist/node/utils/createHash.js +1 -1
  79. package/dist/node/utils/error.js +1 -1
  80. package/dist/node/utils/flattenMdxContent.js +1 -1
  81. package/dist/node/utils/fs.js +1 -1
  82. package/dist/node/utils/getPageKey.js +1 -1
  83. package/dist/node/utils/normalizePath.js +1 -1
  84. package/dist/node/utils/reactAlias.js +2 -2
  85. package/dist/runtime/App.js +1 -1
  86. package/dist/theme/components/CodeBlock/index.js +1 -1
  87. package/dist/theme/components/CodeButtonGroup/index.js +4 -2
  88. package/dist/theme/components/DocContent/docComponents/a.d.ts +1 -1
  89. package/dist/theme/components/DocContent/docComponents/hr.d.ts +1 -1
  90. package/dist/theme/components/DocContent/docComponents/img.d.ts +1 -1
  91. package/dist/theme/components/DocContent/docComponents/index.d.ts +18 -18
  92. package/dist/theme/components/DocContent/docComponents/list.d.ts +3 -3
  93. package/dist/theme/components/DocContent/docComponents/paragraph.d.ts +3 -3
  94. package/dist/theme/components/DocContent/docComponents/table.d.ts +3 -3
  95. package/dist/theme/components/DocContent/docComponents/title.d.ts +6 -6
  96. package/dist/theme/components/FallbackHeading/index.js +1 -1
  97. package/dist/theme/components/Link/useLinkNavigate.js +2 -2
  98. package/dist/theme/components/Nav/hooks.d.ts +1 -1
  99. package/dist/theme/components/Overview/index.js +1 -1
  100. package/dist/theme/components/OverviewGroup/index.js +1 -1
  101. package/dist/theme/components/PackageManagerTabs/index.js +18 -18
  102. package/dist/theme/components/Search/SearchPanel.js +1 -2
  103. package/dist/theme/components/Sidebar/SidebarItem.js +1 -0
  104. package/dist/theme/components/Steps/index.css +6 -4
  105. package/dist/theme/components/Tabs/index.d.ts +8 -4
  106. package/dist/theme/components/Tabs/index.js +20 -20
  107. package/dist/theme/layout/DocLayout/index.js +1 -1
  108. package/dist/theme/layout/HomeLayout/index.js +1 -1
  109. package/dist/theme/layout/Layout/index.js +1 -1
  110. package/package.json +9 -9
  111. package/dist/runtime/BrowserOnly.test.d.ts +0 -1
  112. /package/dist/{0~1402.js → 0~8787.js} +0 -0
  113. /package/dist/{5810.js → 2633.js} +0 -0
  114. /package/dist/{3323.js → 3358.js} +0 -0
  115. /package/dist/{8857.js.LICENSE.txt → 5580.js.LICENSE.txt} +0 -0
  116. /package/dist/{9224.js → 559.js} +0 -0
  117. /package/dist/{3294.js → 8005.js} +0 -0
  118. /package/dist/{6162.js → 9283.js} +0 -0
  119. /package/dist/{8474.js → 9882.js} +0 -0
@@ -13,17 +13,25 @@ import {
13
13
  import './index.scss';
14
14
 
15
15
  type TabItem = {
16
- label?: string | ReactNode;
16
+ label: ReactNode;
17
+ value: string;
18
+ disabled?: boolean;
19
+ };
20
+
21
+ type ResolvedTabItem = {
22
+ label?: ReactNode;
23
+ value?: string;
17
24
  disabled?: boolean;
18
25
  content?: ReactNode;
19
26
  };
20
27
 
21
28
  export interface TabsProps {
22
- values?: ReactNode[] | ReadonlyArray<ReactNode> | TabItem[];
29
+ values?: ReadonlyArray<TabItem>;
23
30
  /**
24
31
  * @default 0
25
32
  */
26
33
  defaultIndex?: number;
34
+ defaultValue?: string;
27
35
  onChange?: (index: number) => void;
28
36
  children: ReactNode;
29
37
  /**
@@ -45,56 +53,41 @@ export interface TabsProps {
45
53
 
46
54
  function getTabValuesFromChildren(
47
55
  children: ReactElement<TabProps>[],
48
- defaultValues: ReactNode[] | ReadonlyArray<ReactNode> | TabItem[] | undefined,
49
- ): TabItem[] {
50
- // 0. only values, values contain label and content
51
- // <Tabs values={[{}, {}]}/>
52
- if (defaultValues?.every(item => isTabItem(item) && item.content)) {
53
- return defaultValues as TabItem[];
54
- }
55
-
56
- // 1. values only contain label
57
- // <Tabs values={['Tab1', 'Tab2']}><Tab label="Tab1"/></Tab><Tab label="Tab2"/></Tab></Tabs>
58
- if (defaultValues && defaultValues.length > 0) {
59
- return defaultValues.map((item, index) => {
60
- if (isTabItem(item)) {
61
- return item;
62
- }
56
+ values: ReadonlyArray<TabItem> | undefined,
57
+ ): ResolvedTabItem[] {
58
+ if (values && values.length > 0) {
59
+ return values.map((item, index) => {
60
+ const content =
61
+ children.find(child => child.props?.value === item.value) ??
62
+ children[index];
63
63
 
64
64
  return {
65
- label: item,
66
- content: children[index],
67
- } satisfies TabItem;
65
+ ...item,
66
+ content,
67
+ } satisfies ResolvedTabItem;
68
68
  });
69
69
  }
70
70
 
71
- // 2. no values
72
- // <Tabs><Tab label="Tab1"/></Tab><Tab label="Tab2"/></Tab></Tabs>
73
- return Children.map<TabItem, ReactElement<TabProps>>(
71
+ return Children.map<ResolvedTabItem, ReactElement<TabProps>>(
74
72
  children,
75
73
  (child, index) => {
76
74
  if (isValidElement(child)) {
77
75
  return {
78
76
  label: child.props?.label || undefined,
77
+ value: child.props?.value,
78
+ disabled: child.props?.disabled,
79
79
  content: children[index],
80
- } satisfies TabItem;
80
+ } satisfies ResolvedTabItem;
81
81
  }
82
82
 
83
83
  return {
84
84
  label: index,
85
85
  content: children[index],
86
- } satisfies TabItem;
86
+ } satisfies ResolvedTabItem;
87
87
  },
88
88
  );
89
89
  }
90
90
 
91
- function isTabItem(item: unknown): item is TabItem {
92
- if (item && typeof item === 'object' && 'label' in item) {
93
- return true;
94
- }
95
- return false;
96
- }
97
-
98
91
  const groupIdPrefix = 'rspress.tabs.';
99
92
 
100
93
  export const Tabs = forwardRef(
@@ -102,6 +95,7 @@ export const Tabs = forwardRef(
102
95
  const {
103
96
  values,
104
97
  defaultIndex,
98
+ defaultValue,
105
99
  onChange,
106
100
  children: rawChildren,
107
101
  groupId,
@@ -118,11 +112,11 @@ export const Tabs = forwardRef(
118
112
  isValidElement(child),
119
113
  ) as unknown as ReactElement<TabProps>[];
120
114
 
121
- const tabValues: TabItem[] = useMemo(() => {
115
+ const tabValues: ResolvedTabItem[] = useMemo(() => {
122
116
  return getTabValuesFromChildren(children, values);
123
- }, [values, children]);
117
+ }, [children, values]);
124
118
 
125
- if (process.env.__SSR_MD__) {
119
+ if (import.meta.env.SSG_MD) {
126
120
  return (
127
121
  <>
128
122
  {tabValues.map(({ label, content }) => {
@@ -138,11 +132,18 @@ export const Tabs = forwardRef(
138
132
  );
139
133
  }
140
134
 
141
- const [activeIndex, setActiveIndex] = useState(defaultIndex ?? 0);
135
+ const defaultValueIndex =
136
+ defaultValue !== undefined
137
+ ? tabValues.findIndex(item => item.value === defaultValue)
138
+ : -1;
139
+ const initialActiveIndex =
140
+ defaultValueIndex === -1 ? (defaultIndex ?? 0) : defaultValueIndex;
141
+
142
+ const [activeIndex, setActiveIndex] = useState(initialActiveIndex);
142
143
 
143
144
  const [storageIndex, setStorageIndex] = useStorageValue<string>(
144
145
  `${groupIdPrefix}${groupId}`,
145
- activeIndex.toString(),
146
+ initialActiveIndex.toString(),
146
147
  );
147
148
 
148
149
  const currentIndex: number = groupId ? Number(storageIndex) : activeIndex;
@@ -157,11 +158,11 @@ export const Tabs = forwardRef(
157
158
  tabPosition === 'center' ? 'center' : 'flex-start',
158
159
  }}
159
160
  >
160
- {tabValues.map(({ label }, index) => {
161
+ {tabValues.map(({ label, value, disabled }, index) => {
161
162
  const isActive = index === currentIndex;
162
163
  return (
163
164
  <div
164
- key={typeof label === 'string' ? label : index}
165
+ key={value ?? index}
165
166
  className={clsx(
166
167
  'rp-tabs__label__item',
167
168
  isActive
@@ -171,6 +172,9 @@ export const Tabs = forwardRef(
171
172
  )}
172
173
  data-index={index}
173
174
  onClick={() => {
175
+ if (disabled) {
176
+ return;
177
+ }
174
178
  onChange?.(index);
175
179
  if (groupId) {
176
180
  setStorageIndex(index.toString());
@@ -186,7 +190,7 @@ export const Tabs = forwardRef(
186
190
  </div>
187
191
  ) : null}
188
192
  <div className="rp-tabs__content">
189
- {tabValues.map(({ label, content }, index) => {
193
+ {tabValues.map(({ value, content }, index) => {
190
194
  const isActive = index === currentIndex;
191
195
  if (!keepDOM && !isActive) {
192
196
  return null;
@@ -194,7 +198,7 @@ export const Tabs = forwardRef(
194
198
 
195
199
  return (
196
200
  <div
197
- key={typeof label === 'string' ? label : index}
201
+ key={value ?? index}
198
202
  className={clsx(
199
203
  'rp-tabs__content__item',
200
204
  isActive
@@ -217,7 +221,10 @@ export const Tabs = forwardRef(
217
221
 
218
222
  Tabs.displayName = 'Tabs';
219
223
 
220
- export type TabProps = Pick<TabItem, 'label' | 'disabled'> & {
224
+ export type TabProps = {
225
+ label?: ReactNode;
226
+ value?: string;
227
+ disabled?: boolean;
221
228
  children: ReactNode;
222
229
  };
223
230
 
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { PluginDriver } from "./node/PluginDriver.js";
2
- export { RSPRESS_TEMP_DIR, getIconUrlPath, getNodeAttribute, getSidebarDataGroup, logger, matchPath, mergeDocConfig, normalizeHref, normalizePosixPath, removeTrailingSlash, withBase } from "./8474.js";
2
+ export { RSPRESS_TEMP_DIR, getIconUrlPath, getNodeAttribute, getSidebarDataGroup, logger, matchPath, mergeDocConfig, normalizeHref, normalizePosixPath, removeTrailingSlash, withBase } from "./9882.js";
3
3
  export { RouteService } from "./node/route/RouteService.js";
4
4
  export { build } from "./node/build.js";
5
5
  export { defineConfig } from "./config/defineConfig.js";
@@ -1,4 +1,4 @@
1
- import { addTrailingSlash, node_path, addLeadingSlash } from "../5810.js";
1
+ import { addTrailingSlash, node_path, addLeadingSlash } from "../2633.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 "../../5810.js";
1
+ import { DEFAULT_PAGE_EXTENSIONS, node_path } from "../../2633.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,4 +1,4 @@
1
- import { node_path } from "../../5810.js";
1
+ import { node_path } from "../../2633.js";
2
2
  import { walk } from "./walk.js";
3
3
  function combineWalkResult(walks, versions) {
4
4
  return walks.reduce((acc, cur, curIndex)=>({
@@ -1,3 +1,3 @@
1
1
  import { type SidebarDivider, type SidebarGroup, type SidebarItem, type SidebarSectionHeader } from '@rspress/shared';
2
- declare function scanSideMeta(workDir: string, docsDir: string, extensions: string[], metaFileSet: Set<string>, mdFileSet: Set<string>): Promise<(SidebarItem | SidebarGroup | SidebarDivider | SidebarSectionHeader)[]>;
2
+ declare function scanSideMeta(workDir: string, docsDir: string, extensions: string[], metaFileSet: Set<string>, mdFileSet: Set<string>): Promise<(SidebarDivider | SidebarGroup | SidebarItem | SidebarSectionHeader)[]>;
3
3
  export { scanSideMeta };
@@ -1,8 +1,7 @@
1
1
  import { __webpack_require__ } from "../../0~rslib-runtime.js";
2
- import "../../8006.js";
3
- import { extname, logger, promises_readdir, external_node_path_relative, isExternalUrl, slash, promises_stat, join } from "../../5810.js";
2
+ import "../../7986.js";
3
+ import { extname, logger, promises_readdir, external_node_path_relative, isExternalUrl, slash, promises_stat, join } from "../../2633.js";
4
4
  import { createError } from "../utils/error.js";
5
- import { PUBLIC_DIR } from "../constants.js";
6
5
  import { pathExists, extractInfoFromFrontmatterWithAbsolutePath, readJson } from "./utils.js";
7
6
  import { absolutePathToRoutePath, addRoutePrefix } from "../route/RoutePage.js";
8
7
  import { RouteService } from "../route/RouteService.js";
@@ -37,7 +36,7 @@ async function fsDirToMetaItems(workDir, docsDir, extensions) {
37
36
  if ('_meta.json' === item) return null;
38
37
  const stat = await promises_stat(join(workDir, item));
39
38
  if (stat.isDirectory()) {
40
- if (item === PUBLIC_DIR && workDir === docsDir) return null;
39
+ if ("public" === item && workDir === docsDir) return null;
41
40
  return {
42
41
  type: 'dir',
43
42
  name: item
@@ -1,4 +1,4 @@
1
- import { node_path, extractTextAndId, promises, loadFrontMatter } from "../../5810.js";
1
+ import { node_path, extractTextAndId, promises, loadFrontMatter } from "../../2633.js";
2
2
  import { createError } from "../utils/error.js";
3
3
  async function pathExists(path) {
4
4
  try {
@@ -1,4 +1,4 @@
1
- import { isExternalUrl, node_path, promises } from "../../5810.js";
1
+ import { isExternalUrl, node_path, promises } from "../../2633.js";
2
2
  import { pathExists } from "../utils/fs.js";
3
3
  import { readJson } from "./utils.js";
4
4
  import { addRoutePrefix } from "../route/RoutePage.js";
@@ -1,4 +1,4 @@
1
- import { createRequire, node_path, package_namespaceObject } from "../8006.js";
1
+ import { createRequire, node_path, package_namespaceObject } from "../7275.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';
@@ -25,9 +25,9 @@ const APP_HTML_MARKER = '<!--<?- DOC_CONTENT ?>-->';
25
25
  const HEAD_MARKER = '<!--<?- HEAD ?>-->';
26
26
  const META_GENERATOR = '<!--<?- GENERATOR ?>-->';
27
27
  const DEFAULT_TITLE = 'Rspress';
28
- const PUBLIC_DIR = 'public';
29
28
  const NODE_SSG_BUNDLE_FOLDER = '__ssg__';
30
29
  const NODE_SSG_BUNDLE_NAME = 'rspress-ssg-entry.cjs';
31
30
  const NODE_SSG_MD_BUNDLE_FOLDER = '__ssg_md__';
32
31
  const NODE_SSG_MD_BUNDLE_NAME = 'rspress-ssg-md-entry.cjs';
33
- export { APP_HTML_MARKER, CSR_CLIENT_ENTRY, DEFAULT_THEME, DEFAULT_TITLE, EJECTED_THEME, HEAD_MARKER, META_GENERATOR, NODE_SSG_BUNDLE_FOLDER, NODE_SSG_BUNDLE_NAME, NODE_SSG_MD_BUNDLE_FOLDER, NODE_SSG_MD_BUNDLE_NAME, OUTPUT_DIR, PACKAGE_ROOT, PUBLIC_DIR, RSPRESS_VERSION, SSG_MD_SERVER_ENTRY, SSR_CLIENT_ENTRY, SSR_SERVER_ENTRY, TEMPLATE_PATH, importStatementRegex, inlineThemeScript, isProduction };
32
+ var constants_PUBLIC_DIR = "public";
33
+ export { APP_HTML_MARKER, CSR_CLIENT_ENTRY, DEFAULT_THEME, DEFAULT_TITLE, EJECTED_THEME, HEAD_MARKER, META_GENERATOR, NODE_SSG_BUNDLE_FOLDER, NODE_SSG_BUNDLE_NAME, NODE_SSG_MD_BUNDLE_FOLDER, NODE_SSG_MD_BUNDLE_NAME, OUTPUT_DIR, PACKAGE_ROOT, RSPRESS_VERSION, SSG_MD_SERVER_ENTRY, SSR_CLIENT_ENTRY, SSR_SERVER_ENTRY, TEMPLATE_PATH, constants_PUBLIC_DIR as PUBLIC_DIR, importStatementRegex, inlineThemeScript, isProduction };
@@ -1,6 +1,6 @@
1
1
  import { __webpack_require__ } from "../0~rslib-runtime.js";
2
- import "../8006.js";
3
- import { node_path, logger, promises } from "../8857.js";
2
+ import "../7986.js";
3
+ import { node_path, logger, promises } from "../5580.js";
4
4
  import { EJECTED_THEME } from "./constants.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 { external_node_process_cwd, node_path, external_node_url_fileURLToPath, addTrailingSlash, PLUGIN_REACT_NAME, external_node_module_createRequire, removeTrailingSlash, pluginVirtualModule, pluginReact, MDX_OR_MD_REGEXP } from "../5810.js";
1
+ import { external_node_process_cwd, node_path, external_node_url_fileURLToPath, addTrailingSlash, PLUGIN_REACT_NAME, external_node_module_createRequire, removeTrailingSlash, pluginVirtualModule, pluginReact, MDX_OR_MD_REGEXP } from "../2633.js";
2
2
  import { createError } from "./utils/error.js";
3
- import { PUBLIC_DIR, CSR_CLIENT_ENTRY, SSR_CLIENT_ENTRY, OUTPUT_DIR, SSG_MD_SERVER_ENTRY, inlineThemeScript, NODE_SSG_BUNDLE_FOLDER, isProduction, PACKAGE_ROOT, SSR_SERVER_ENTRY, TEMPLATE_PATH, NODE_SSG_MD_BUNDLE_FOLDER, DEFAULT_THEME, NODE_SSG_MD_BUNDLE_NAME, DEFAULT_TITLE, NODE_SSG_BUNDLE_NAME } from "./constants.js";
3
+ import { CSR_CLIENT_ENTRY, SSR_CLIENT_ENTRY, OUTPUT_DIR, SSG_MD_SERVER_ENTRY, inlineThemeScript, NODE_SSG_BUNDLE_FOLDER, isProduction, PACKAGE_ROOT, SSR_SERVER_ENTRY, TEMPLATE_PATH, NODE_SSG_MD_BUNDLE_FOLDER, DEFAULT_THEME, NODE_SSG_MD_BUNDLE_NAME, DEFAULT_TITLE, NODE_SSG_BUNDLE_NAME } from "./constants.js";
4
4
  import { hintBuilderPluginsBreakingChange, hintThemeBreakingChange } from "./logger/hint.js";
5
5
  import { resolveReactRouterDomAlias, resolveReactRenderToMarkdownAlias, resolveReactAlias } from "./utils/reactAlias.js";
6
6
  import { rsbuildPluginDocVM } from "./runtimeModule/pageData/rsbuildPlugin.js";
@@ -14,7 +14,7 @@ import { siteDataVMPlugin } from "./runtimeModule/siteData/rsbuildPlugin.js";
14
14
  import { rsbuildPluginSSG } from "./ssg/rsbuildPluginSSG.js";
15
15
  import { rsbuildPluginCSR } from "./ssg/rsbuildPluginCSR.js";
16
16
  import { rsbuildPluginSSGMD } from "./ssg-md/rsbuildPluginSSGMD.js";
17
- import { package_namespaceObject } from "../8006.js";
17
+ import { package_namespaceObject } from "../7275.js";
18
18
  function isPluginIncluded(config, pluginName) {
19
19
  return Boolean(config.builderConfig?.plugins?.some((plugin)=>plugin && plugin.name === pluginName));
20
20
  }
@@ -37,7 +37,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
37
37
  if (!icon) return;
38
38
  icon = icon.toString();
39
39
  if (icon.startsWith('file://')) icon = external_node_url_fileURLToPath(icon);
40
- else if (node_path.isAbsolute(icon)) return node_path.join(userDocRoot, PUBLIC_DIR, icon);
40
+ else if (node_path.isAbsolute(icon)) return node_path.join(userDocRoot, "public", icon);
41
41
  return icon;
42
42
  };
43
43
  await hintThemeBreakingChange(CUSTOM_THEME_DIR);
@@ -92,7 +92,7 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
92
92
  server: {
93
93
  port: !isProduction() && process.env.PORT ? Number(process.env.PORT) : void 0,
94
94
  publicDir: {
95
- name: node_path.join(userDocRoot, PUBLIC_DIR)
95
+ name: node_path.join(userDocRoot, "public")
96
96
  },
97
97
  ...base.length > 0 ? {
98
98
  base: removeTrailingSlash(base)
@@ -250,7 +250,6 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
250
250
  define: {
251
251
  'process.env.__SSR__': JSON.stringify(false),
252
252
  'process.env.__SSR_MD__': JSON.stringify(false),
253
- 'import.meta.env.SSR': JSON.stringify(false),
254
253
  'import.meta.env.SSG_MD': JSON.stringify(false)
255
254
  }
256
255
  },
@@ -284,7 +283,6 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
284
283
  define: {
285
284
  'process.env.__SSR__': JSON.stringify(true),
286
285
  'process.env.__SSR_MD__': JSON.stringify(false),
287
- 'import.meta.env.SSR': JSON.stringify(true),
288
286
  'import.meta.env.SSG_MD': JSON.stringify(false)
289
287
  }
290
288
  },
@@ -325,7 +323,6 @@ async function createInternalBuildConfig(userDocRoot, config, enableSSG, routeSe
325
323
  define: {
326
324
  'process.env.__SSR__': JSON.stringify(true),
327
325
  'process.env.__SSR_MD__': JSON.stringify(true),
328
- 'import.meta.env.SSR': JSON.stringify(true),
329
326
  'import.meta.env.SSG_MD': JSON.stringify(true)
330
327
  }
331
328
  },
@@ -1,5 +1,5 @@
1
1
  import { __webpack_require__ } from "../../0~rslib-runtime.js";
2
- import { relative, logger, join, readFile } from "../../8006.js";
2
+ import { relative, logger, join, readFile } from "../../7986.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);
@@ -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 "../../6162.js";
1
+ import { node_path, rehype_external_links, rehype_raw, remark_cjk_friendly, nodeTypes, remark_gfm, rehype, remark_cjk_friendly_gfm_strikethrough } from "../../9283.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 "../../6162.js";
1
+ import { node_path, extractTextAndId, createProcessor, loadFrontMatter } from "../../9283.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 "../../../6162.js";
1
+ import { visit } from "../../../9283.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 "../../../6162.js";
1
+ import { visit, extractTextAndId, github_slugger, headingRank } from "../../../9283.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 "../../../6162.js";
1
+ import { transformerAddLang, transformerAddLineNumbers, transformerAddTitle, transformerAddFold, createCssVariablesTheme, transformerAddWrapCode } from "../../../9283.js";
2
2
  const cssVariablesTheme = createCssVariablesTheme({
3
3
  name: 'css-variables',
4
4
  variablePrefix: '--shiki-',
@@ -1,12 +1,9 @@
1
1
  const SHIKI_TRANSFORMER_ADD_TITLE = 'shiki-transformer:add-title';
2
+ const TITLE_META_REGEX = /(?:^|\s)title=(?:"([^"]*)"|'([^']*)'|`([^`]*)`|([^\s]+))(?=\s|$)/;
2
3
  function parseTitleFromMeta(meta) {
3
4
  if (!meta) return '';
4
- const kvList = meta.split(' ').filter(Boolean);
5
- for (const item of kvList){
6
- const [k, v = ''] = item.split('=').filter(Boolean);
7
- if ('title' === k && v.length > 0) return v.replace(/["'`]/g, '');
8
- }
9
- return '';
5
+ const matched = meta.match(TITLE_META_REGEX);
6
+ return matched?.slice(1).find(Boolean) ?? '';
10
7
  }
11
8
  function transformerAddTitle() {
12
9
  return {
@@ -1,4 +1,4 @@
1
- import { node_path } from "../../../6162.js";
1
+ import { node_path } from "../../../9283.js";
2
2
  import { getDefaultImportAstNode } from "../../utils/getImportAstNode.js";
3
3
  const remarkBuiltin = ({ globalComponents })=>(tree)=>{
4
4
  const demos = globalComponents.map((componentPath)=>{
@@ -13,7 +13,7 @@
13
13
  */
14
14
  import type { Root } from 'mdast';
15
15
  import type { Plugin } from 'unified';
16
- export declare const DIRECTIVE_TYPES: readonly ["tip", "note", "warning", "caution", "danger", "info", "details"];
16
+ export declare const DIRECTIVE_TYPES: readonly ['tip', 'note', 'warning', 'caution', 'danger', 'info', 'details'];
17
17
  export declare const REGEX_BEGIN: RegExp;
18
18
  export declare const REGEX_END: RegExp;
19
19
  export declare const REGEX_GH_BEGIN: RegExp;
@@ -1,6 +1,6 @@
1
1
  import { __webpack_require__ } from "../../../0~rslib-runtime.js";
2
- import "../../../8006.js";
3
- import { visit, node_path, logger, cwd, readFile } from "../../../3323.js";
2
+ import "../../../7986.js";
3
+ import { visit, node_path, logger, cwd, readFile } from "../../../3358.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);
@@ -3,6 +3,6 @@ import type { Root } from 'mdast';
3
3
  import type { VFile } from 'vfile';
4
4
  export declare const remarkImage: ({ docDirectory, remarkImageOptions, lint, }: {
5
5
  docDirectory: string;
6
- remarkImageOptions?: MarkdownOptions["image"];
6
+ remarkImageOptions?: MarkdownOptions['image'];
7
7
  lint?: boolean;
8
8
  }) => (tree: Root, file: VFile) => void;
@@ -1,8 +1,7 @@
1
1
  import { __webpack_require__ } from "../../../0~rslib-runtime.js";
2
- import "../../../8006.js";
3
- import { visit, node_path, logger, isDataUrl, existsSync, getNodeAttribute, isExternalUrl, isProduction, parseUrl } from "../../../3323.js";
2
+ import "../../../7986.js";
3
+ import { visit, node_path, logger, isDataUrl, existsSync, getNodeAttribute, isExternalUrl, isProduction, parseUrl } from "../../../3358.js";
4
4
  import { createError } from "../../utils/error.js";
5
- import { PUBLIC_DIR } from "../../constants.js";
6
5
  import { getDefaultImportAstNode } from "../../utils/getImportAstNode.js";
7
6
  const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
8
7
  var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
@@ -41,7 +40,7 @@ function resolveImage(imageUrl, filePath, docDirectory, deadImages) {
41
40
  if (isDataUrl(imageUrl)) return;
42
41
  const { url } = parseUrl(imageUrl);
43
42
  if (url.startsWith('/')) {
44
- const resolvedPath = node_path.join(docDirectory, PUBLIC_DIR, url);
43
+ const resolvedPath = node_path.join(docDirectory, "public", url);
45
44
  if (!existsSync(resolvedPath)) deadImages.set(imageUrl, resolvedPath);
46
45
  } else {
47
46
  const resolvedPath = node_path.resolve(node_path.dirname(filePath), url);
@@ -79,6 +78,7 @@ const remarkImage = ({ docDirectory, remarkImageOptions, lint })=>(tree, file)=>
79
78
  const { alt, url } = node;
80
79
  if (!url) return;
81
80
  if (shouldCheckDeadImages) resolveImage(url, file.path, docDirectory, deadImages);
81
+ if (lint) return;
82
82
  const imagePath = normalizeImageUrl(url);
83
83
  if (!imagePath) return;
84
84
  const tempVariableName = `image${images.length}`;
@@ -10,7 +10,7 @@ import type { RouteService } from '../../route/RouteService.js';
10
10
  export declare const remarkLink: ({ cleanUrls, routeService, remarkLinkOptions, lint, __base, }: {
11
11
  cleanUrls: boolean | string;
12
12
  routeService: RouteService | null;
13
- remarkLinkOptions?: MarkdownOptions["link"];
13
+ remarkLinkOptions?: MarkdownOptions['link'];
14
14
  lint?: boolean;
15
15
  __base?: string;
16
16
  }) => (tree: Root, file: VFile) => void;
@@ -1,6 +1,6 @@
1
1
  import { __webpack_require__ } from "../../../0~rslib-runtime.js";
2
- import "../../../8006.js";
3
- import { normalizeHref, node_path, addLeadingSlash, logger, visit, isExternalUrl, isProduction, parseUrl, withBase } from "../../../3323.js";
2
+ import "../../../7986.js";
3
+ import { normalizeHref, node_path, addLeadingSlash, logger, visit, isExternalUrl, isProduction, parseUrl, withBase } from "../../../3358.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 { github_slugger, visitChildren, extractTextAndId } from "../../../3294.js";
1
+ import { github_slugger, visitChildren, extractTextAndId } from "../../../8005.js";
2
2
  const extractChildText = (child)=>{
3
3
  if ('link' === child.type) return child.children?.map(extractChildText).join('') ?? '';
4
4
  if ('strong' === child.type) return `**${child.children?.map(extractChildText).join('') ?? ''}**`;
@@ -1,4 +1,4 @@
1
- import { node_path } from "../../0~1402.js";
1
+ import { node_path } from "../../0~8787.js";
2
2
  import { PACKAGE_ROOT } from "../constants.js";
3
3
  function pluginMediumZoom(options = {}) {
4
4
  return {
@@ -1,4 +1,4 @@
1
- import { node_path } from "../../5810.js";
1
+ import { node_path } from "../../2633.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";
@@ -1,5 +1,4 @@
1
- import { RSPRESS_TEMP_DIR, node_path, removeTrailingSlash, promises, addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, glob } from "../../5810.js";
2
- import { PUBLIC_DIR } from "../constants.js";
1
+ import { RSPRESS_TEMP_DIR, node_path, removeTrailingSlash, promises, addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, glob } from "../../2633.js";
3
2
  import { RoutePage, absolutePathToRoutePath, absolutePathToRelativePath } from "./RoutePage.js";
4
3
  import { createError } from "../utils/error.js";
5
4
  import { getRoutePathParts, normalizeRoutePath, splitRoutePathParts } from "./normalizeRoutePath.js";
@@ -73,7 +72,7 @@ class RouteService {
73
72
  '**/node_modules/**',
74
73
  '**/.eslintrc.js',
75
74
  '**/.nx/**',
76
- `./${PUBLIC_DIR}/**`,
75
+ "./public/**",
77
76
  '**/*.d.ts'
78
77
  ]
79
78
  })).sort();
@@ -1,4 +1,4 @@
1
- import { unified, node_path, promises, loadFrontMatter, remove, remark_gfm, MDX_OR_MD_REGEXP, remark_parse } from "../../5810.js";
1
+ import { unified, node_path, promises, loadFrontMatter, remove, remark_gfm, MDX_OR_MD_REGEXP, remark_parse } from "../../2633.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 "../../5810.js";
1
+ import { addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, addLeadingSlash } from "../../2633.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 [