@rspress/core 2.0.7 → 2.0.9

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 (107) hide show
  1. package/dist/0~execa.js +32 -41
  2. package/dist/0~rslib-runtime.js +38 -0
  3. package/dist/0~tinypool.js +828 -0
  4. package/dist/{8311.js → 1688.js} +1 -7
  5. package/dist/{7397.js → 2240.js} +4 -2
  6. package/dist/{1361.js → 3294.js} +1 -1
  7. package/dist/{1965.js → 3425.js} +0 -1
  8. package/dist/740.js +2470 -0
  9. package/dist/8006.js +77 -0
  10. package/dist/8857.js +4827 -0
  11. package/dist/8857.js.LICENSE.txt +41 -0
  12. package/dist/cli/index.js +7 -3
  13. package/dist/config/loadConfigFile.js +1 -1
  14. package/dist/eject-theme/components/CodeBlock/index.scss +4 -0
  15. package/dist/eject-theme/components/CodeBlock/index.tsx +14 -6
  16. package/dist/eject-theme/components/CodeButtonGroup/CopyCodeButton.scss +1 -1
  17. package/dist/eject-theme/components/CodeButtonGroup/index.scss +1 -1
  18. package/dist/eject-theme/components/DocContent/doc.scss +2 -0
  19. package/dist/eject-theme/components/FallbackHeading/index.tsx +1 -1
  20. package/dist/eject-theme/components/Link/useLinkNavigate.ts +4 -1
  21. package/dist/eject-theme/components/Llms/LlmsCopyButton.scss +3 -3
  22. package/dist/eject-theme/components/Search/SearchPanel.tsx +1 -1
  23. package/dist/eject-theme/components/Steps/index.scss +32 -13
  24. package/dist/node/PluginDriver.js +2 -2
  25. package/dist/node/auto-nav-sidebar/index.js +2 -2
  26. package/dist/node/auto-nav-sidebar/locales.js +1 -1
  27. package/dist/node/auto-nav-sidebar/normalize.js +9 -5
  28. package/dist/node/auto-nav-sidebar/utils.js +8 -2
  29. package/dist/node/auto-nav-sidebar/walk.js +2 -8
  30. package/dist/node/constants.js +1 -1
  31. package/dist/node/eject.js +14 -8
  32. package/dist/node/initRsbuild.js +6 -6
  33. package/dist/node/logger/hint.js +9 -6
  34. package/dist/node/mdx/options.js +15 -4
  35. package/dist/node/mdx/processor.js +1 -1
  36. package/dist/node/mdx/rehypePlugins/codeMeta.js +1 -1
  37. package/dist/node/mdx/rehypePlugins/headerAnchor.js +3 -2
  38. package/dist/node/mdx/rehypePlugins/shiki.d.ts +4 -1
  39. package/dist/node/mdx/rehypePlugins/shiki.js +5 -3
  40. package/dist/node/mdx/rehypePlugins/transformers/add-fold.d.ts +7 -1
  41. package/dist/node/mdx/rehypePlugins/transformers/add-fold.js +23 -6
  42. package/dist/node/mdx/rehypePlugins/transformers/index.js +6 -6
  43. package/dist/node/mdx/remarkPlugins/builtin.js +1 -1
  44. package/dist/node/mdx/remarkPlugins/containerSyntax.js +7 -1
  45. package/dist/node/mdx/remarkPlugins/fileCodeBlock.js +6 -2
  46. package/dist/node/mdx/remarkPlugins/image.d.ts +7 -2
  47. package/dist/node/mdx/remarkPlugins/image.js +51 -2
  48. package/dist/node/mdx/remarkPlugins/link.js +7 -3
  49. package/dist/node/mdx/remarkPlugins/toc.js +1 -1
  50. package/dist/node/route/RoutePage.js +1 -1
  51. package/dist/node/route/RouteService.js +1 -1
  52. package/dist/node/route/extractPageData.js +77 -27
  53. package/dist/node/route/normalizeRoutePath.js +1 -1
  54. package/dist/node/runtimeModule/i18n.js +10 -6
  55. package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
  56. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
  57. package/dist/node/runtimeModule/searchHooks.js +1 -1
  58. package/dist/node/runtimeModule/siteData/createSiteData.js +1 -1
  59. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +1 -1
  60. package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +1 -1
  61. package/dist/node/serve.js +1 -1
  62. package/dist/node/ssg/renderPage.js +8 -4
  63. package/dist/node/ssg/renderPageWorker.js +1 -1
  64. package/dist/node/ssg/renderPages.js +9 -5
  65. package/dist/node/ssg/rsbuildPluginSSG.js +20 -7
  66. package/dist/node/ssg/ssgEnv.js +1 -1
  67. package/dist/node/ssg-md/llms/emitLlmsTxt.js +1 -1
  68. package/dist/node/ssg-md/llms/llmsTxt.js +3 -2
  69. package/dist/node/ssg-md/remarkSplitMdx.js +1 -1
  70. package/dist/node/ssg-md/renderPage.js +8 -4
  71. package/dist/node/ssg-md/renderPages.js +7 -3
  72. package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
  73. package/dist/node/utils/checkLanguageParity.js +1 -1
  74. package/dist/node/utils/createHash.js +1 -1
  75. package/dist/node/utils/error.js +5 -2
  76. package/dist/node/utils/flattenMdxContent.js +3 -2
  77. package/dist/node/utils/fs.js +1 -1
  78. package/dist/node/utils/getPageKey.js +1 -1
  79. package/dist/node/utils/normalizePath.js +3 -2
  80. package/dist/node/utils/reactAlias.js +7 -3
  81. package/dist/runtime/App.js +4 -1
  82. package/dist/runtime/hooks/useWindowSize.test.js +10 -10
  83. package/dist/runtime/index.d.ts +2 -1
  84. package/dist/runtime/index.js +2 -1
  85. package/dist/runtime/initPageData.d.ts +3 -0
  86. package/dist/runtime/initPageData.js +37 -2
  87. package/dist/runtime/ssrClientEntry.js +4 -2
  88. package/dist/theme/assets/success.js +1 -1
  89. package/dist/theme/assets/wrapped.js +1 -1
  90. package/dist/theme/components/CodeBlock/index.css +4 -0
  91. package/dist/theme/components/CodeBlock/index.d.ts +0 -3
  92. package/dist/theme/components/CodeBlock/index.js +8 -3
  93. package/dist/theme/components/CodeButtonGroup/CopyCodeButton.css +3 -3
  94. package/dist/theme/components/CodeButtonGroup/index.css +3 -3
  95. package/dist/theme/components/DocContent/doc.css +1 -0
  96. package/dist/theme/components/FallbackHeading/index.js +1 -1
  97. package/dist/theme/components/Link/useLinkNavigate.js +3 -2
  98. package/dist/theme/components/Llms/LlmsCopyButton.css +9 -9
  99. package/dist/theme/components/Llms/LlmsViewOptions.css +2 -2
  100. package/dist/theme/components/Search/SearchPanel.js +1 -1
  101. package/dist/theme/components/Steps/index.css +23 -12
  102. package/dist/theme/logic/useThemeState.js +1 -1
  103. package/package.json +14 -17
  104. package/dist/4454.js +0 -8
  105. package/dist/4524.js +0 -71
  106. package/dist/8885.js +0 -4
  107. package/dist/rslib-runtime.js +0 -18
@@ -10,20 +10,20 @@
10
10
  }
11
11
 
12
12
  .rp-llms-copy-button--success.rp-llms-copy-button {
13
- color: var(--rp-c-green-1, #10b981);
14
- border-color: var(--rp-c-green-1, #10b981);
13
+ color: #10b981;
15
14
  background: var(--rp-c-bg-soft);
15
+ border-color: #10b981;
16
16
  }
17
17
 
18
18
  .rp-llms-copy-button--success .rp-llms-copy-button__icon-copy {
19
19
  opacity: 0;
20
- transform: translate(-50%, -50%)scale(.5);
20
+ transform: translate(-50%, -50%) scale(.5);
21
21
  }
22
22
 
23
23
  .rp-llms-copy-button--success .rp-llms-copy-button__icon-success {
24
24
  opacity: 1;
25
25
  visibility: visible;
26
- transform: translate(-50%, -50%)scale(1);
26
+ transform: translate(-50%, -50%) scale(1);
27
27
  }
28
28
 
29
29
  .rp-llms-copy-button__icon-wrapper {
@@ -39,19 +39,19 @@
39
39
  position: absolute;
40
40
  top: 50%;
41
41
  left: 50%;
42
- transform: translate(-50%, -50%)scale(1);
42
+ transform: translate(-50%, -50%) scale(1);
43
43
  }
44
44
 
45
45
  .rp-llms-copy-button__icon-success {
46
- width: 16px;
47
- height: 16px;
48
- color: var(--rp-c-green-1, #10b981);
46
+ color: #10b981;
49
47
  visibility: hidden;
50
48
  opacity: 0;
49
+ width: 16px;
50
+ height: 16px;
51
51
  transition: all .2s cubic-bezier(.18, .89, .32, 1.28);
52
52
  position: absolute;
53
53
  top: 50%;
54
54
  left: 50%;
55
- transform: translate(-50%, -50%)scale(.5);
55
+ transform: translate(-50%, -50%) scale(.5);
56
56
  }
57
57
 
@@ -39,12 +39,12 @@
39
39
  @keyframes dropdownIn {
40
40
  from {
41
41
  opacity: 0;
42
- transform: translateY(-8px)scale(.96);
42
+ transform: translateY(-8px) scale(.96);
43
43
  }
44
44
 
45
45
  to {
46
46
  opacity: 1;
47
- transform: translateY(0)scale(1);
47
+ transform: translateY(0) scale(1);
48
48
  }
49
49
  }
50
50
 
@@ -1,7 +1,7 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useI18n, usePageData } from "@rspress/core/runtime";
3
3
  import { IconClose, IconLoading, IconSearch, SvgWrapper, Tab, Tabs, useLinkNavigate } from "@rspress/core/theme";
4
- import { debounce } from "lodash-es";
4
+ import { debounce } from "@rspress/shared/lodash-es";
5
5
  import { useCallback, useEffect, useRef, useState } from "react";
6
6
  import { createPortal } from "react-dom";
7
7
  import * as __rspack_external_virtual_search_hooks_9d01d01f from "virtual-search-hooks";
@@ -1,36 +1,47 @@
1
+ :root {
2
+ --rp-steps-gap: 24px;
3
+ --rp-steps-size: 30px;
4
+ }
5
+
1
6
  .rp-steps {
2
7
  border-left: 1px solid var(--rp-c-text-3);
8
+ padding-left: var(--rp-steps-gap);
3
9
  counter-reset: step;
4
- margin-bottom: 44px;
5
- margin-left: 16px;
6
- padding-left: 24px;
10
+ margin-bottom: 2.5rem;
11
+ margin-left: 1rem;
7
12
  }
8
13
 
9
14
  .rp-steps h3 {
10
15
  counter-increment: step;
11
- margin-top: 3px;
16
+ align-items: center;
17
+ min-height: 30px;
18
+ margin-top: 0;
19
+ display: flex;
12
20
  position: relative;
13
21
  }
14
22
 
15
23
  .rp-steps h3:before {
16
24
  content: counter(step);
17
- width: 30px;
18
- height: 30px;
25
+ left: calc(-1*var(--rp-steps-gap));
26
+ width: var(--rp-steps-size);
27
+ height: var(--rp-steps-size);
28
+ line-height: var(--rp-steps-size);
19
29
  color: var(--rp-c-text-1);
20
- background-color: var(--rp-code-block-bg);
30
+ background-color: var(--rp-c-bg);
31
+ outline: 6px solid var(--rp-c-bg);
21
32
  border: 1.5px solid var(--rp-c-text-3);
22
33
  border-radius: 50%;
23
34
  justify-content: center;
24
35
  align-items: center;
25
36
  font-size: 1.1rem;
26
- font-weight: 400;
27
- line-height: 30px;
37
+ font-weight: 500;
28
38
  display: flex;
29
39
  position: absolute;
30
- left: -41px;
40
+ transform: translate(-50%);
31
41
  }
32
42
 
33
- .rp-steps p {
34
- color: var(--rp-c-text-1);
43
+ .rp-steps h3 .rp-header-anchor {
44
+ left: calc(-1*var(--rp-steps-gap) - var(--rp-steps-size)/2);
45
+ position: absolute;
35
46
  }
36
47
 
@@ -5,7 +5,7 @@ import { useStorageValue } from "./useStorageValue.js";
5
5
  const APPEARANCE_KEY = 'rspress-theme-appearance';
6
6
  const MEDIA_QUERY = '(prefers-color-scheme: dark)';
7
7
  const applyThemeToDOM = (theme)=>{
8
- if (!document || !document.documentElement) return;
8
+ if (!document?.documentElement) return;
9
9
  const root = document.documentElement;
10
10
  root.classList.toggle('dark', 'dark' === theme);
11
11
  root.classList.toggle('rp-dark', 'dark' === theme);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/core",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "description": "The Rspress Documentation Framework",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -60,32 +60,27 @@
60
60
  "dependencies": {
61
61
  "@mdx-js/mdx": "^3.1.1",
62
62
  "@mdx-js/react": "^3.1.1",
63
- "@rsbuild/core": "2.0.0-beta.10",
63
+ "@rsbuild/core": "2.0.0-rc.1",
64
64
  "@rsbuild/plugin-react": "~1.4.6",
65
65
  "@shikijs/rehype": "^4.0.2",
66
66
  "@types/unist": "^3.0.3",
67
- "@unhead/react": "^2.1.12",
67
+ "@unhead/react": "^2.1.13",
68
68
  "body-scroll-lock": "4.0.0-beta.0",
69
- "cac": "^7.0.0",
70
- "chokidar": "^3.6.0",
71
69
  "clsx": "2.1.1",
72
70
  "copy-to-clipboard": "^3.3.3",
73
71
  "flexsearch": "0.8.212",
74
- "github-slugger": "^2.0.0",
75
72
  "hast-util-heading-rank": "^3.0.0",
76
73
  "hast-util-to-jsx-runtime": "^2.3.6",
77
- "lodash-es": "^4.17.23",
78
74
  "mdast-util-mdx": "^3.0.0",
79
75
  "mdast-util-mdxjs-esm": "^2.0.1",
80
76
  "medium-zoom": "1.1.0",
81
77
  "nprogress": "^0.2.0",
82
- "picocolors": "^1.1.1",
83
78
  "react": "^19.2.4",
84
79
  "react-dom": "^19.2.4",
85
80
  "react-lazy-with-preload": "^2.2.1",
86
81
  "react-reconciler": "0.33.0",
87
82
  "react-render-to-markdown": "19.0.1",
88
- "react-router-dom": "^7.13.1",
83
+ "react-router-dom": "^7.13.2",
89
84
  "rehype-external-links": "^3.0.0",
90
85
  "rehype-raw": "^7.0.0",
91
86
  "remark-cjk-friendly": "^2.0.1",
@@ -96,40 +91,42 @@
96
91
  "remark-stringify": "^11.0.0",
97
92
  "scroll-into-view-if-needed": "^3.1.0",
98
93
  "shiki": "^4.0.2",
99
- "tinyglobby": "^0.2.15",
100
- "tinypool": "^1.1.1",
101
94
  "unified": "^11.0.5",
102
95
  "unist-util-remove": "^4.0.0",
103
- "unist-util-visit": "^5.0.0",
96
+ "unist-util-visit": "^5.1.0",
104
97
  "unist-util-visit-children": "^3.0.0",
105
- "@rspress/shared": "2.0.7"
98
+ "@rspress/shared": "2.0.9"
106
99
  },
107
100
  "devDependencies": {
108
101
  "@microsoft/api-extractor": "^7.57.7",
109
102
  "@rsbuild/plugin-sass": "~1.5.1",
110
103
  "@rsbuild/plugin-svgr": "^1.3.1",
111
- "@rslib/core": "0.20.0",
104
+ "@rslib/core": "0.21.0",
112
105
  "@types/body-scroll-lock": "^3.1.2",
113
106
  "@types/hast": "^3.0.4",
114
- "@types/lodash-es": "^4.17.12",
115
107
  "@types/mdast": "^4.0.4",
116
108
  "@types/node": "^22.8.1",
117
109
  "@types/nprogress": "^0.2.3",
118
110
  "@types/react": "^19.2.14",
119
111
  "@types/react-dom": "^19.2.3",
120
112
  "@types/react-reconciler": "^0.33.0",
121
- "@types/web": "^0.0.344",
113
+ "@types/web": "^0.0.345",
114
+ "cac": "^7.0.0",
115
+ "chokidar": "^3.6.0",
122
116
  "execa": "8.0.1",
123
117
  "mdast-util-directive": "^3.1.0",
124
118
  "mdast-util-mdx-expression": "^2.0.1",
125
119
  "memfs": "^4.57.1",
126
120
  "p-map": "^7.0.4",
121
+ "picocolors": "^1.1.1",
127
122
  "postcss": "8.5.8",
128
123
  "remark-directive": "^4.0.0",
129
124
  "rsbuild-plugin-publint": "^0.3.4",
130
125
  "rsbuild-plugin-virtual-module": "0.4.1",
131
126
  "tailwindcss": "^3.4.19",
132
- "ts-json-schema-generator": "^2.4.0",
127
+ "tinyglobby": "^0.2.15",
128
+ "tinypool": "^1.1.1",
129
+ "ts-json-schema-generator": "^2.9.0",
133
130
  "typescript": "^5.8.2",
134
131
  "vfile": "^6.0.3",
135
132
  "@rspress/config": "1.0.0"
package/dist/4454.js DELETED
@@ -1,8 +0,0 @@
1
- export { default as node_path, join } from "node:path";
2
- export { logger } from "@rspress/shared/logger";
3
- export { cac } from "cac";
4
- export { default as chokidar } from "chokidar";
5
- export { default as picocolors } from "picocolors";
6
- export { default as node_fs } from "node:fs";
7
- export { DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME } from "@rspress/shared/constants";
8
- export { default as promises } from "node:fs/promises";
package/dist/4524.js DELETED
@@ -1,71 +0,0 @@
1
- import node_path, { extname, join, relative } from "node:path";
2
- const PLUGIN_VIRTUAL_MODULE_NAME = 'rsbuild:virtual-module';
3
- const pluginVirtualModule = (pluginOptions = {})=>({
4
- name: PLUGIN_VIRTUAL_MODULE_NAME,
5
- async setup (api) {
6
- const { virtualModules = {}, tempDir: virtualFolderName = '.rsbuild-virtual-module' } = pluginOptions;
7
- const TEMP_DIR = join(api.context.rootPath, virtualFolderName);
8
- const virtualFileAbsolutePaths = Object.keys(virtualModules).map((i)=>{
9
- let absolutePath = join(TEMP_DIR, i);
10
- if (!extname(absolutePath)) absolutePath = `${absolutePath}.js`;
11
- return [
12
- i,
13
- absolutePath
14
- ];
15
- });
16
- api.modifyBundlerChain((chain, { rspack })=>{
17
- const pluginId = 'RSBUILD_VIRTUAL_MODULE_PLUGIN';
18
- const virtualModules = Object.fromEntries(virtualFileAbsolutePaths.map((i)=>[
19
- i[1],
20
- ''
21
- ]));
22
- if (chain.plugins.has(pluginId)) chain.plugin(pluginId).tap((options)=>{
23
- const existingPaths = new Set(Object.keys(options[0] ?? {}));
24
- const conflictPath = virtualFileAbsolutePaths.find(([, path])=>existingPaths.has(path));
25
- if (conflictPath) throw new Error(`Virtual module name conflicted: ${conflictPath[0]}`);
26
- return [
27
- {
28
- ...options[0],
29
- ...virtualModules
30
- }
31
- ];
32
- });
33
- else chain.plugin(pluginId).use(rspack.experiments.VirtualModulesPlugin, [
34
- virtualModules
35
- ]);
36
- chain.resolve.alias.merge(Object.fromEntries(virtualFileAbsolutePaths));
37
- });
38
- for (const [moduleName, absolutePath] of virtualFileAbsolutePaths){
39
- const handler = virtualModules[moduleName];
40
- if (handler) api.transform({
41
- test: absolutePath
42
- }, handler);
43
- }
44
- }
45
- });
46
- export { DEFAULT_PAGE_EXTENSIONS } from "@rspress/shared/constants";
47
- export { default as promises, mkdir, readdir, rm, stat, writeFile } from "node:fs/promises";
48
- export { MDX_OR_MD_REGEXP, RSPRESS_TEMP_DIR, SEARCH_INDEX_NAME, addLeadingSlash, addTrailingSlash, getSidebarDataGroup, isDebugMode, isExternalUrl, normalizeHref, removeLeadingSlash, removeTrailingSlash, slash, withBase } from "@rspress/shared";
49
- export { glob } from "tinyglobby";
50
- export { logger } from "@rspress/shared/logger";
51
- export { default as picocolors } from "picocolors";
52
- export { extractTextAndId, getIconUrlPath, loadFrontMatter } from "@rspress/shared/node-utils";
53
- export { createRequire } from "node:module";
54
- export { cwd } from "node:process";
55
- export { fileURLToPath, pathToFileURL } from "node:url";
56
- export { PLUGIN_REACT_NAME, pluginReact } from "@rsbuild/plugin-react";
57
- export { chunk, groupBy } from "lodash-es";
58
- export { default as remark_gfm } from "remark-gfm";
59
- export { default as remark_parse } from "remark-parse";
60
- export { default as remark_stringify } from "remark-stringify";
61
- export { unified } from "unified";
62
- export { remove } from "unist-util-remove";
63
- export { visit } from "unist-util-visit";
64
- export { default as node_fs } from "node:fs";
65
- export { createProcessor } from "@mdx-js/mdx";
66
- export { mergeRsbuildConfig, rspack as core_rspack } from "@rsbuild/core";
67
- export { createHash } from "node:crypto";
68
- export { default as node_os } from "node:os";
69
- export { matchPath } from "react-router-dom";
70
- export { createHead } from "@unhead/react/server";
71
- export { extname, join, node_path, pluginVirtualModule, relative };
package/dist/8885.js DELETED
@@ -1,4 +0,0 @@
1
- export { default as promises, readFile } from "node:fs/promises";
2
- export { join, relative } from "node:path";
3
- export { logger } from "@rspress/shared/logger";
4
- export { default as picocolors } from "picocolors";
@@ -1,18 +0,0 @@
1
- var __webpack_modules__ = {};
2
- var __webpack_module_cache__ = {};
3
- function __webpack_require__(moduleId) {
4
- var cachedModule = __webpack_module_cache__[moduleId];
5
- if (void 0 !== cachedModule) return cachedModule.exports;
6
- var module = __webpack_module_cache__[moduleId] = {
7
- exports: {}
8
- };
9
- __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
10
- return module.exports;
11
- }
12
- __webpack_require__.m = __webpack_modules__;
13
- (()=>{
14
- __webpack_require__.add = function(modules) {
15
- Object.assign(__webpack_require__.m, modules);
16
- };
17
- })();
18
- export { __webpack_require__ };