@rspress/core 2.0.7 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/0~execa.js +25 -34
- package/dist/{4524.js → 7319.js} +17 -0
- package/dist/8311.js +1 -1
- package/dist/eject-theme/components/CodeBlock/index.scss +4 -0
- package/dist/eject-theme/components/CodeBlock/index.tsx +14 -6
- package/dist/node/PluginDriver.js +2 -2
- package/dist/node/auto-nav-sidebar/index.js +2 -2
- 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/eject.js +3 -1
- package/dist/node/initRsbuild.js +1 -1
- package/dist/node/mdx/options.js +2 -2
- package/dist/node/mdx/rehypePlugins/headerAnchor.js +2 -1
- package/dist/node/mdx/rehypePlugins/shiki.d.ts +4 -1
- package/dist/node/mdx/rehypePlugins/shiki.js +4 -2
- package/dist/node/mdx/rehypePlugins/transformers/add-fold.d.ts +7 -1
- package/dist/node/mdx/rehypePlugins/transformers/add-fold.js +23 -6
- package/dist/node/mdx/rehypePlugins/transformers/index.js +6 -6
- package/dist/node/mdx/remarkPlugins/containerSyntax.js +7 -1
- package/dist/node/route/RoutePage.js +1 -1
- package/dist/node/route/RouteService.js +1 -1
- package/dist/node/route/extractPageData.js +3 -2
- 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/renderPages.js +1 -1
- package/dist/node/ssg/rsbuildPluginSSG.js +20 -7
- 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 +3 -2
- package/dist/node/ssg-md/renderPage.js +1 -1
- package/dist/node/ssg-md/renderPages.js +1 -1
- 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 +3 -2
- package/dist/node/utils/getPageKey.js +1 -1
- package/dist/node/utils/normalizePath.js +2 -1
- package/dist/node/utils/reactAlias.js +1 -1
- package/dist/runtime/hooks/useWindowSize.test.js +10 -10
- package/dist/theme/components/CodeBlock/index.css +4 -0
- package/dist/theme/components/CodeBlock/index.d.ts +0 -3
- package/dist/theme/components/CodeBlock/index.js +8 -3
- package/dist/theme/components/CodeButtonGroup/CopyCodeButton.css +2 -2
- package/dist/theme/components/CodeButtonGroup/index.css +2 -2
- package/dist/theme/components/Llms/LlmsCopyButton.css +4 -4
- package/dist/theme/components/Llms/LlmsViewOptions.css +2 -2
- package/package.json +6 -6
- /package/dist/{rslib-runtime.js → 0~rslib-runtime.js} +0 -0
package/dist/0~execa.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import * as __rspack_external_child_process from "child_process";
|
|
2
|
-
import * as __rspack_external_fs from "fs";
|
|
3
|
-
import * as __rspack_external_path from "path";
|
|
4
|
-
import * as __rspack_external_stream from "stream";
|
|
5
|
-
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
6
1
|
import { Buffer } from "node:buffer";
|
|
7
2
|
import node_path from "node:path";
|
|
8
3
|
import node_child_process, { ChildProcess } from "node:child_process";
|
|
9
4
|
import node_process from "node:process";
|
|
10
|
-
import
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
11
6
|
import node_os, { constants } from "node:os";
|
|
12
7
|
import { createReadStream, createWriteStream, readFileSync } from "node:fs";
|
|
13
8
|
import { setTimeout as promises_setTimeout } from "node:timers/promises";
|
|
14
9
|
import { debuglog } from "node:util";
|
|
10
|
+
import { __webpack_require__ } from "./0~rslib-runtime.js";
|
|
11
|
+
import "./7319.js";
|
|
15
12
|
__webpack_require__.add({
|
|
16
13
|
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
17
14
|
const cp = __webpack_require__("child_process");
|
|
@@ -442,18 +439,6 @@ __webpack_require__.add({
|
|
|
442
439
|
};
|
|
443
440
|
module.exports = which;
|
|
444
441
|
which.sync = whichSync;
|
|
445
|
-
},
|
|
446
|
-
child_process (module) {
|
|
447
|
-
module.exports = __rspack_external_child_process;
|
|
448
|
-
},
|
|
449
|
-
fs (module) {
|
|
450
|
-
module.exports = __rspack_external_fs;
|
|
451
|
-
},
|
|
452
|
-
path (module) {
|
|
453
|
-
module.exports = __rspack_external_path;
|
|
454
|
-
},
|
|
455
|
-
stream (module) {
|
|
456
|
-
module.exports = __rspack_external_stream;
|
|
457
442
|
}
|
|
458
443
|
});
|
|
459
444
|
function stripFinalNewline(input) {
|
|
@@ -468,34 +453,40 @@ function pathKey(options = {}) {
|
|
|
468
453
|
if ('win32' !== platform) return 'PATH';
|
|
469
454
|
return Object.keys(env).reverse().find((key)=>'PATH' === key.toUpperCase()) || 'Path';
|
|
470
455
|
}
|
|
471
|
-
|
|
472
|
-
const
|
|
473
|
-
|
|
474
|
-
const cwdString = cwd instanceof URL ? node_url.fileURLToPath(cwd) : cwd;
|
|
475
|
-
let cwdPath = node_path.resolve(cwdString);
|
|
456
|
+
const npmRunPath = ({ cwd = node_process.cwd(), path: pathOption = node_process.env[pathKey()], preferLocal = true, execPath = node_process.execPath, addExecPath = true } = {})=>{
|
|
457
|
+
const cwdString = cwd instanceof URL ? fileURLToPath(cwd) : cwd;
|
|
458
|
+
const cwdPath = node_path.resolve(cwdString);
|
|
476
459
|
const result = [];
|
|
460
|
+
if (preferLocal) applyPreferLocal(result, cwdPath);
|
|
461
|
+
if (addExecPath) applyExecPath(result, execPath, cwdPath);
|
|
462
|
+
return [
|
|
463
|
+
...result,
|
|
464
|
+
pathOption
|
|
465
|
+
].join(node_path.delimiter);
|
|
466
|
+
};
|
|
467
|
+
const applyPreferLocal = (result, cwdPath)=>{
|
|
468
|
+
let previous;
|
|
477
469
|
while(previous !== cwdPath){
|
|
478
470
|
result.push(node_path.join(cwdPath, 'node_modules/.bin'));
|
|
479
471
|
previous = cwdPath;
|
|
480
472
|
cwdPath = node_path.resolve(cwdPath, '..');
|
|
481
473
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
}
|
|
488
|
-
function npmRunPathEnv({ env = node_process.env, ...options } = {}) {
|
|
474
|
+
};
|
|
475
|
+
const applyExecPath = (result, execPath, cwdPath)=>{
|
|
476
|
+
const execPathString = execPath instanceof URL ? fileURLToPath(execPath) : execPath;
|
|
477
|
+
result.push(node_path.resolve(cwdPath, execPathString, '..'));
|
|
478
|
+
};
|
|
479
|
+
const npmRunPathEnv = ({ env = node_process.env, ...options } = {})=>{
|
|
489
480
|
env = {
|
|
490
481
|
...env
|
|
491
482
|
};
|
|
492
|
-
const
|
|
483
|
+
const pathName = pathKey({
|
|
493
484
|
env
|
|
494
485
|
});
|
|
495
|
-
options.path = env[
|
|
496
|
-
env[
|
|
486
|
+
options.path = env[pathName];
|
|
487
|
+
env[pathName] = npmRunPath(options);
|
|
497
488
|
return env;
|
|
498
|
-
}
|
|
489
|
+
};
|
|
499
490
|
const copyProperty = (to, from, property, ignoreNonConfigurable)=>{
|
|
500
491
|
if ('length' === property || 'prototype' === property) return;
|
|
501
492
|
if ('arguments' === property || 'caller' === property) return;
|
package/dist/{4524.js → 7319.js}
RENAMED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
import node_path, { extname, join, relative } from "node:path";
|
|
2
|
+
import { __webpack_require__ } from "./0~rslib-runtime.js";
|
|
3
|
+
import { createRequire as __rspack_createRequire } from "node:module";
|
|
4
|
+
const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
|
|
5
|
+
__webpack_require__.add({
|
|
6
|
+
child_process (module) {
|
|
7
|
+
module.exports = __rspack_createRequire_require("child_process");
|
|
8
|
+
},
|
|
9
|
+
fs (module) {
|
|
10
|
+
module.exports = __rspack_createRequire_require("fs");
|
|
11
|
+
},
|
|
12
|
+
path (module) {
|
|
13
|
+
module.exports = __rspack_createRequire_require("path");
|
|
14
|
+
},
|
|
15
|
+
stream (module) {
|
|
16
|
+
module.exports = __rspack_createRequire_require("stream");
|
|
17
|
+
}
|
|
18
|
+
});
|
|
2
19
|
const PLUGIN_VIRTUAL_MODULE_NAME = 'rsbuild:virtual-module';
|
|
3
20
|
const pluginVirtualModule = (pluginOptions = {})=>({
|
|
4
21
|
name: PLUGIN_VIRTUAL_MODULE_NAME,
|
package/dist/8311.js
CHANGED
|
@@ -9,6 +9,8 @@ import clsx from 'clsx';
|
|
|
9
9
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
10
10
|
import './index.scss';
|
|
11
11
|
|
|
12
|
+
const DEFAULT_FOLD_HEIGHT = 300;
|
|
13
|
+
|
|
12
14
|
export type CodeBlockProps = {
|
|
13
15
|
title?: string;
|
|
14
16
|
lang?: string;
|
|
@@ -24,9 +26,6 @@ export type CodeBlockProps = {
|
|
|
24
26
|
* @default false
|
|
25
27
|
*/
|
|
26
28
|
fold?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* @default 300
|
|
29
|
-
*/
|
|
30
29
|
height?: number;
|
|
31
30
|
containerElementClassName?: string;
|
|
32
31
|
codeButtonGroupProps?: Omit<
|
|
@@ -78,7 +77,7 @@ export function CodeBlock({
|
|
|
78
77
|
wrapCode: wrapCodeProp = false,
|
|
79
78
|
lineNumbers: lineNumbersProp = false,
|
|
80
79
|
fold = false,
|
|
81
|
-
height
|
|
80
|
+
height,
|
|
82
81
|
codeButtonGroupProps,
|
|
83
82
|
children,
|
|
84
83
|
}: CodeBlockProps) {
|
|
@@ -93,6 +92,7 @@ export function CodeBlock({
|
|
|
93
92
|
} = useCodeButtonGroup(wrapCodeProp);
|
|
94
93
|
const [expanded, setExpanded] = useState(false);
|
|
95
94
|
const [needFold, setNeedFold] = useState(false);
|
|
95
|
+
const hasScroll = !fold && height !== undefined;
|
|
96
96
|
const codeBlockRef = useRef<HTMLDivElement>(null);
|
|
97
97
|
const contentRef = useRef<HTMLDivElement>(null);
|
|
98
98
|
|
|
@@ -101,8 +101,9 @@ export function CodeBlock({
|
|
|
101
101
|
setNeedFold(false);
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
+
const foldHeight = height ?? DEFAULT_FOLD_HEIGHT;
|
|
104
105
|
const realHeight = contentRef.current.scrollHeight;
|
|
105
|
-
setNeedFold(realHeight >
|
|
106
|
+
setNeedFold(realHeight > foldHeight);
|
|
106
107
|
}, [fold, height]);
|
|
107
108
|
|
|
108
109
|
const handleFoldToggle = useCallback(() => {
|
|
@@ -140,8 +141,15 @@ export function CodeBlock({
|
|
|
140
141
|
wrapCodeState && 'rp-codeblock__content--wrap-code',
|
|
141
142
|
lineNumbersProp && 'rp-codeblock__content--line-numbers',
|
|
142
143
|
needFold && !expanded && 'rp-codeblock__content--fold',
|
|
144
|
+
hasScroll && 'rp-codeblock__content--scroll',
|
|
143
145
|
)}
|
|
144
|
-
style={
|
|
146
|
+
style={
|
|
147
|
+
needFold && !expanded
|
|
148
|
+
? { maxHeight: `${height ?? DEFAULT_FOLD_HEIGHT}px` }
|
|
149
|
+
: hasScroll
|
|
150
|
+
? { maxHeight: `${height}px` }
|
|
151
|
+
: undefined
|
|
152
|
+
}
|
|
145
153
|
ref={contentRef}
|
|
146
154
|
>
|
|
147
155
|
<div
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { addTrailingSlash, node_path, addLeadingSlash } from "../
|
|
1
|
+
import { addTrailingSlash, node_path, addLeadingSlash } from "../7319.js";
|
|
2
2
|
import { createError } from "./utils/error.js";
|
|
3
|
-
import { auto_nav_sidebar_haveNavSidebarConfig } from "./auto-nav-sidebar/index.js";
|
|
3
|
+
import { haveNavSidebarConfig as auto_nav_sidebar_haveNavSidebarConfig } from "./auto-nav-sidebar/index.js";
|
|
4
4
|
class PluginDriver {
|
|
5
5
|
#config;
|
|
6
6
|
#configFilePath;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_PAGE_EXTENSIONS, node_path } from "../../
|
|
1
|
+
import { DEFAULT_PAGE_EXTENSIONS, node_path } from "../../7319.js";
|
|
2
2
|
import { processLocales, combineWalkResult } from "./locales.js";
|
|
3
3
|
import { walk } from "./walk.js";
|
|
4
4
|
async function runAutoNavSide(config, metaFileSet, mdFileSet) {
|
|
@@ -40,4 +40,4 @@ async function modifyConfigWithAutoNavSide(config, metaFileSet = new Set(), mdFi
|
|
|
40
40
|
config.themeConfig.nav = autoNavSide.nav;
|
|
41
41
|
config.themeConfig.sidebar = autoNavSide.sidebar;
|
|
42
42
|
}
|
|
43
|
-
export { auto_nav_sidebar_haveNavSidebarConfig, modifyConfigWithAutoNavSide };
|
|
43
|
+
export { auto_nav_sidebar_haveNavSidebarConfig as haveNavSidebarConfig, modifyConfigWithAutoNavSide };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extname, stat as promises_stat, logger, picocolors, readdir, isExternalUrl, relative, slash, join } from "../../
|
|
1
|
+
import { extname, stat as promises_stat, logger, picocolors, readdir, isExternalUrl, relative, slash, join } from "../../7319.js";
|
|
2
2
|
import { createError } from "../utils/error.js";
|
|
3
3
|
import { PUBLIC_DIR } from "../constants.js";
|
|
4
4
|
import { pathExists, extractInfoFromFrontmatterWithAbsolutePath, readJson } from "./utils.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isExternalUrl, node_path, promises } from "../../
|
|
1
|
+
import { isExternalUrl, node_path, promises } from "../../7319.js";
|
|
2
2
|
import { pathExists } from "../utils/fs.js";
|
|
3
3
|
import { readJson } from "./utils.js";
|
|
4
4
|
import { createError } from "../utils/error.js";
|
package/dist/node/eject.js
CHANGED
|
@@ -106,4 +106,6 @@ async function listComponents() {
|
|
|
106
106
|
});
|
|
107
107
|
logger.info(`💡 Usage: ${picocolors.dim('rspress eject <ComponentName>')}\n`);
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
var eject__setThemeComponentsPathForTesting = void 0;
|
|
110
|
+
var eject_getAvailableComponents = void 0;
|
|
111
|
+
export { ejectComponent, eject__setThemeComponentsPathForTesting as __setThemeComponentsPathForTesting, eject_getAvailableComponents as getAvailableComponents, listComponents };
|
package/dist/node/initRsbuild.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addTrailingSlash, node_path, fileURLToPath, cwd, PLUGIN_REACT_NAME, removeTrailingSlash, pluginVirtualModule, pluginReact, createRequire, MDX_OR_MD_REGEXP } from "../
|
|
1
|
+
import { addTrailingSlash, node_path, fileURLToPath, cwd, PLUGIN_REACT_NAME, removeTrailingSlash, pluginVirtualModule, pluginReact, createRequire, MDX_OR_MD_REGEXP } from "../7319.js";
|
|
2
2
|
import { createError } from "./utils/error.js";
|
|
3
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";
|
|
4
4
|
import { hintBuilderPluginsBreakingChange, hintThemeBreakingChange } from "./logger/hint.js";
|
package/dist/node/mdx/options.js
CHANGED
|
@@ -13,7 +13,7 @@ async function createMDXOptions(options) {
|
|
|
13
13
|
const { docDirectory, config, routeService, filepath, pluginDriver, addDependency, isSsgMd = false } = options;
|
|
14
14
|
const remarkLinkOptions = config?.markdown?.link;
|
|
15
15
|
const format = node_path.extname(filepath).slice(1);
|
|
16
|
-
const { remarkPlugins: remarkPluginsFromConfig = [], rehypePlugins: rehypePluginsFromConfig = [], globalComponents: globalComponentsFromConfig = [], showLineNumbers = false, defaultWrapCode = false, shiki, cjkFriendlyEmphasis = true } = config?.markdown || {};
|
|
16
|
+
const { remarkPlugins: remarkPluginsFromConfig = [], rehypePlugins: rehypePluginsFromConfig = [], globalComponents: globalComponentsFromConfig = [], showLineNumbers = false, defaultWrapCode = false, defaultCodeOverflow, shiki, cjkFriendlyEmphasis = true } = config?.markdown || {};
|
|
17
17
|
const rspressPlugins = pluginDriver?.getPlugins() ?? [];
|
|
18
18
|
const remarkPluginsFromPlugins = rspressPlugins.flatMap((plugin)=>plugin.markdown?.remarkPlugins || []);
|
|
19
19
|
const rehypePluginsFromPlugins = rspressPlugins.flatMap((plugin)=>plugin.markdown?.rehypePlugins || []);
|
|
@@ -85,7 +85,7 @@ async function createMDXOptions(options) {
|
|
|
85
85
|
] : [],
|
|
86
86
|
[
|
|
87
87
|
rehype,
|
|
88
|
-
createRehypeShikiOptions(showLineNumbers, defaultWrapCode, shiki)
|
|
88
|
+
createRehypeShikiOptions(showLineNumbers, defaultWrapCode, defaultCodeOverflow, shiki)
|
|
89
89
|
],
|
|
90
90
|
[
|
|
91
91
|
rehype_external_links,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { RehypeShikiOptions } from '@shikijs/rehype';
|
|
2
2
|
import rehypeShiki from '@shikijs/rehype';
|
|
3
|
-
declare function createRehypeShikiOptions(showLineNumbers: boolean, defaultWrapCode: boolean,
|
|
3
|
+
declare function createRehypeShikiOptions(showLineNumbers: boolean, defaultWrapCode: boolean, defaultCodeOverflow?: {
|
|
4
|
+
height?: number;
|
|
5
|
+
behavior?: 'fold' | 'scroll';
|
|
6
|
+
}, options?: Partial<RehypeShikiOptions>): RehypeShikiOptions;
|
|
4
7
|
export { createRehypeShikiOptions, rehypeShiki };
|
|
@@ -5,7 +5,7 @@ const cssVariablesTheme = createCssVariablesTheme({
|
|
|
5
5
|
variableDefaults: {},
|
|
6
6
|
fontStyle: true
|
|
7
7
|
});
|
|
8
|
-
function createRehypeShikiOptions(showLineNumbers, defaultWrapCode, options) {
|
|
8
|
+
function createRehypeShikiOptions(showLineNumbers, defaultWrapCode, defaultCodeOverflow, options) {
|
|
9
9
|
const { transformers = [], ...restOptions } = options || {};
|
|
10
10
|
const newTransformers = [
|
|
11
11
|
transformerAddTitle(),
|
|
@@ -16,7 +16,9 @@ function createRehypeShikiOptions(showLineNumbers, defaultWrapCode, options) {
|
|
|
16
16
|
transformerAddWrapCode({
|
|
17
17
|
defaultWrapCode
|
|
18
18
|
}),
|
|
19
|
-
transformerAddFold(
|
|
19
|
+
transformerAddFold({
|
|
20
|
+
defaultCodeOverflow
|
|
21
|
+
}),
|
|
20
22
|
...transformers
|
|
21
23
|
];
|
|
22
24
|
return {
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { ShikiTransformer } from 'shiki';
|
|
2
2
|
export declare const SHIKI_TRANSFORMER_ADD_FOLD = "shiki-transformer:add-fold";
|
|
3
|
+
export interface ITransformerAddFoldOptions {
|
|
4
|
+
defaultCodeOverflow?: {
|
|
5
|
+
height?: number;
|
|
6
|
+
behavior?: 'fold' | 'scroll';
|
|
7
|
+
};
|
|
8
|
+
}
|
|
3
9
|
/**
|
|
4
10
|
* @private compile-time only
|
|
5
11
|
*/
|
|
6
|
-
export declare function transformerAddFold(): ShikiTransformer;
|
|
12
|
+
export declare function transformerAddFold(options?: ITransformerAddFoldOptions): ShikiTransformer;
|
|
@@ -17,18 +17,35 @@ function parseHeightFromMeta(meta) {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
function transformerAddFold() {
|
|
20
|
+
function transformerAddFold(options = {}) {
|
|
21
|
+
const { defaultCodeOverflow } = options;
|
|
21
22
|
return {
|
|
22
23
|
name: SHIKI_TRANSFORMER_ADD_FOLD,
|
|
23
24
|
pre (pre) {
|
|
24
25
|
const meta = this.options.meta?.__raw;
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const metaFold = hasFoldInMeta(meta);
|
|
27
|
+
const metaHeight = parseHeightFromMeta(meta);
|
|
28
|
+
const hasExplicitMeta = void 0 !== metaFold || void 0 !== metaHeight;
|
|
29
|
+
if (hasExplicitMeta) {
|
|
30
|
+
if (metaFold) pre.properties = {
|
|
29
31
|
...pre.properties,
|
|
30
32
|
fold: true,
|
|
31
|
-
height
|
|
33
|
+
height: metaHeight ?? DEFAULT_FOLD_HEIGHT
|
|
34
|
+
};
|
|
35
|
+
else if (void 0 !== metaHeight) pre.properties = {
|
|
36
|
+
...pre.properties,
|
|
37
|
+
height: metaHeight
|
|
38
|
+
};
|
|
39
|
+
} else if (defaultCodeOverflow?.height !== void 0) {
|
|
40
|
+
const behavior = defaultCodeOverflow.behavior ?? 'scroll';
|
|
41
|
+
if ('fold' === behavior) pre.properties = {
|
|
42
|
+
...pre.properties,
|
|
43
|
+
fold: true,
|
|
44
|
+
height: defaultCodeOverflow.height
|
|
45
|
+
};
|
|
46
|
+
else pre.properties = {
|
|
47
|
+
...pre.properties,
|
|
48
|
+
height: defaultCodeOverflow.height
|
|
32
49
|
};
|
|
33
50
|
}
|
|
34
51
|
return pre;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export { SHIKI_TRANSFORMER_ADD_FOLD, transformerAddFold } from "./add-fold.js";
|
|
2
|
+
export { SHIKI_TRANSFORMER_ADD_LANG, transformerAddLang } from "./add-lang.js";
|
|
3
|
+
export { SHIKI_TRANSFORMER_ADD_LINE_NUMBERS, transformerAddLineNumbers } from "./add-line-numbers.js";
|
|
4
|
+
export { SHIKI_TRANSFORMER_ADD_TITLE, transformerAddTitle } from "./add-title.js";
|
|
5
|
+
export { SHIKI_TRANSFORMER_ADD_WRAP_CODE, transformerAddWrapCode } from "./add-wrap-code.js";
|
|
6
|
+
export { SHIKI_TRANSFORMER_META_HIGHLIGHT, transformerCompatibleMetaHighlight } from "./meta-highlight.js";
|
|
@@ -187,4 +187,10 @@ const remarkContainerSyntax = ()=>{
|
|
|
187
187
|
tree.children.unshift(getNamedImportAstNode('Callout', CALLOUT_COMPONENT, '@theme'));
|
|
188
188
|
};
|
|
189
189
|
};
|
|
190
|
-
|
|
190
|
+
var containerSyntax_DIRECTIVE_TYPES = void 0;
|
|
191
|
+
var containerSyntax_REGEX_BEGIN = void 0;
|
|
192
|
+
var containerSyntax_REGEX_END = void 0;
|
|
193
|
+
var containerSyntax_REGEX_GH_BEGIN = void 0;
|
|
194
|
+
var containerSyntax_TITLE_REGEX_IN_MD = void 0;
|
|
195
|
+
var containerSyntax_TITLE_REGEX_IN_MDX = void 0;
|
|
196
|
+
export { containerSyntax_DIRECTIVE_TYPES as DIRECTIVE_TYPES, containerSyntax_REGEX_BEGIN as REGEX_BEGIN, containerSyntax_REGEX_END as REGEX_END, containerSyntax_REGEX_GH_BEGIN as REGEX_GH_BEGIN, containerSyntax_TITLE_REGEX_IN_MD as TITLE_REGEX_IN_MD, containerSyntax_TITLE_REGEX_IN_MDX as TITLE_REGEX_IN_MDX, remarkContainerSyntax };
|
|
@@ -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 "../../7319.js";
|
|
2
2
|
import { PUBLIC_DIR } from "../constants.js";
|
|
3
3
|
import { RoutePage, absolutePathToRoutePath, absolutePathToRelativePath } from "./RoutePage.js";
|
|
4
4
|
import { createError } from "../utils/error.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unified, node_path, visit, promises, loadFrontMatter, remark_stringify, remove, remark_gfm, MDX_OR_MD_REGEXP, remark_parse } from "../../
|
|
1
|
+
import { unified, node_path, visit, promises, loadFrontMatter, remark_stringify, remove, remark_gfm, MDX_OR_MD_REGEXP, remark_parse } from "../../7319.js";
|
|
2
2
|
import { applyReplaceRules } from "../utils/applyReplaceRules.js";
|
|
3
3
|
import { flattenMdxContent } from "../utils/flattenMdxContent.js";
|
|
4
4
|
import { importStatementRegex } from "../constants.js";
|
|
@@ -158,4 +158,5 @@ async function extractPageData(routeService, options) {
|
|
|
158
158
|
}));
|
|
159
159
|
return pageData;
|
|
160
160
|
}
|
|
161
|
-
|
|
161
|
+
var extractPageData_getPageIndexInfoByRoute = void 0;
|
|
162
|
+
export { extractPageData, extractPageData_getPageIndexInfoByRoute as getPageIndexInfoByRoute };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, addLeadingSlash } from "../../
|
|
1
|
+
import { addTrailingSlash, DEFAULT_PAGE_EXTENSIONS, addLeadingSlash } from "../../7319.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,4 +1,4 @@
|
|
|
1
|
-
import { logger, createRequire, join, picocolors } from "../../
|
|
1
|
+
import { logger, createRequire, join, picocolors } from "../../7319.js";
|
|
2
2
|
import { DEFAULT_I18N_TEXT } from "./DEFAULT_I18N_TEXT.js";
|
|
3
3
|
import { createError } from "../utils/error.js";
|
|
4
4
|
import { pathExists } from "../utils/fs.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SEARCH_INDEX_NAME, groupBy } from "../../../
|
|
1
|
+
import { SEARCH_INDEX_NAME, groupBy } from "../../../7319.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 "../../../7319.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 "../../../7319.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 "../../../7319.js";
|
|
2
2
|
import { getI18nData } from "../i18n.js";
|
|
3
3
|
import { applyReplaceRules } from "../../utils/applyReplaceRules.js";
|
|
4
4
|
async function normalizeThemeConfig(docConfig) {
|
package/dist/node/serve.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! LICENSE: renderPages.js.LICENSE.txt */
|
|
2
|
-
import { chunk, logger, picocolors } from "../../
|
|
2
|
+
import { chunk, logger, picocolors } from "../../7319.js";
|
|
3
3
|
import { SSGWorkerThreadTaskSize, getNumberOfThreads, SSGWorkerThreadRecyclerMaxMemory, SSGConcurrency } from "./ssgEnv.js";
|
|
4
4
|
import { pMap } from "../../8311.js";
|
|
5
5
|
import { renderPage } from "./renderPage.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { logger, writeFile, mkdir, rm, join, isDebugMode } from "../../
|
|
1
|
+
import { logger, writeFile, mkdir, rm, join, isDebugMode } from "../../7319.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 })=>({
|
|
@@ -7,7 +7,19 @@ const rsbuildPluginSSG = ({ routeService, config })=>({
|
|
|
7
7
|
api.onBeforeBuild(()=>{
|
|
8
8
|
let htmlTemplate = '';
|
|
9
9
|
let hasError = false;
|
|
10
|
+
const missingIndexHtmlMessage = 'SSG requires an `index.html` as entry, but this file is not emitted successfully in the web target.';
|
|
10
11
|
const indexHtmlEmittedInWeb = new Promise((resolve, reject)=>{
|
|
12
|
+
let settled = false;
|
|
13
|
+
const resolveOnce = ()=>{
|
|
14
|
+
if (settled) return;
|
|
15
|
+
settled = true;
|
|
16
|
+
resolve();
|
|
17
|
+
};
|
|
18
|
+
const rejectOnce = ()=>{
|
|
19
|
+
if (settled) return;
|
|
20
|
+
settled = true;
|
|
21
|
+
reject(new Error(missingIndexHtmlMessage));
|
|
22
|
+
};
|
|
11
23
|
api.processAssets({
|
|
12
24
|
stage: 'report',
|
|
13
25
|
environments: [
|
|
@@ -16,20 +28,20 @@ const rsbuildPluginSSG = ({ routeService, config })=>({
|
|
|
16
28
|
}, ({ assets, compilation })=>{
|
|
17
29
|
if (compilation.errors.length > 0) {
|
|
18
30
|
hasError = true;
|
|
31
|
+
resolveOnce();
|
|
19
32
|
return;
|
|
20
33
|
}
|
|
21
34
|
for (const [assetName, assetSource] of Object.entries(assets))if ('index.html' === assetName) {
|
|
22
35
|
htmlTemplate = assetSource.source().toString();
|
|
23
36
|
compilation.deleteAsset(assetName);
|
|
24
|
-
|
|
25
|
-
|
|
37
|
+
resolveOnce();
|
|
38
|
+
return;
|
|
26
39
|
}
|
|
27
|
-
|
|
40
|
+
rejectOnce();
|
|
28
41
|
});
|
|
29
42
|
}).catch(()=>{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const error = new Error(message);
|
|
43
|
+
logger.error(missingIndexHtmlMessage);
|
|
44
|
+
const error = new Error(missingIndexHtmlMessage);
|
|
33
45
|
throw error;
|
|
34
46
|
});
|
|
35
47
|
api.processAssets({
|
|
@@ -60,6 +72,7 @@ const rsbuildPluginSSG = ({ routeService, config })=>({
|
|
|
60
72
|
}
|
|
61
73
|
}));
|
|
62
74
|
await indexHtmlEmittedInWeb;
|
|
75
|
+
if (hasError) return;
|
|
63
76
|
await renderPages(routeService, config, mainCjsAbsolutePath, htmlTemplate, emitAsset);
|
|
64
77
|
if (!isDebugMode()) await rm(ssgFolderPath, {
|
|
65
78
|
recursive: true
|
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 "../../7319.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 "../../../7319.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, logger, withBase } from "../../../
|
|
1
|
+
import { normalizeHref, logger, withBase } from "../../../7319.js";
|
|
2
2
|
import { extractInfoFromFrontmatterWithAbsolutePath } from "../../auto-nav-sidebar/utils.js";
|
|
3
3
|
function routePathToMdPath(routePath, base) {
|
|
4
4
|
let url = routePath;
|
|
@@ -75,4 +75,5 @@ url: ${routePathToMdPath(routePath, base)}
|
|
|
75
75
|
}
|
|
76
76
|
return lines.join('\n');
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
var llmsTxt_routePathToMdPath = void 0;
|
|
79
|
+
export { generateLlmsFullTxt, generateLlmsTxt, llmsTxt_routePathToMdPath as routePathToMdPath };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createHead, logger, pathToFileURL, picocolors } from "../../
|
|
1
|
+
import { createHead, logger, pathToFileURL, picocolors } from "../../7319.js";
|
|
2
2
|
import { hintSSGFailed } from "../logger/hint.js";
|
|
3
3
|
async function renderPage(route, ssrBundlePath) {
|
|
4
4
|
let render;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { writeFile, mkdir, rm, join, isDebugMode } from "../../
|
|
1
|
+
import { writeFile, mkdir, rm, join, isDebugMode } from "../../7319.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 "../../7319.js";
|
|
2
2
|
function createHash(str) {
|
|
3
3
|
return external_node_crypto_createHash('sha256').update(str).digest('hex').slice(0, 8);
|
|
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 "../../7319.js";
|
|
2
2
|
import { createError } from "./error.js";
|
|
3
3
|
import { importStatementRegex } from "../constants.js";
|
|
4
4
|
const RspackResolveFactory = core_rspack.experiments.resolver.ResolverFactory;
|
|
@@ -68,4 +68,5 @@ async function flattenMdxContent(content, basePath, alias) {
|
|
|
68
68
|
deps
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
var flattenMdxContent_resolveDepPath = void 0;
|
|
72
|
+
export { flattenMdxContent, flattenMdxContent_resolveDepPath as resolveDepPath };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { node_path, core_rspack, logger, picocolors } from "../../
|
|
1
|
+
import { node_path, core_rspack, logger, picocolors } from "../../7319.js";
|
|
2
2
|
import { pathExists, readJson } from "./fs.js";
|
|
3
3
|
import { PACKAGE_ROOT } from "../constants.js";
|
|
4
4
|
import { hintReactVersion } from "../logger/hint.js";
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
1
|
import { describe, expect, it } from "@rstest/core";
|
|
2
|
+
import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
|
|
3
|
+
import * as __rspack_external_node_path_c5b9b54f from "node:path";
|
|
4
4
|
describe('useWindowSize', ()=>{
|
|
5
5
|
it('should have debounce implementation with RESIZE_DEBOUNCE_MS constant', ()=>{
|
|
6
|
-
const filePath = join(__dirname, 'useWindowSize.ts');
|
|
7
|
-
const fileContent = readFileSync(filePath, 'utf-8');
|
|
6
|
+
const filePath = __rspack_external_node_path_c5b9b54f.join(__dirname, 'useWindowSize.ts');
|
|
7
|
+
const fileContent = __rspack_external_node_fs_5ea92f0c.readFileSync(filePath, 'utf-8');
|
|
8
8
|
expect(fileContent).toContain('const RESIZE_DEBOUNCE_MS = 150');
|
|
9
9
|
expect(fileContent).toContain('setTimeout');
|
|
10
10
|
expect(fileContent).toContain('RESIZE_DEBOUNCE_MS');
|
|
11
11
|
});
|
|
12
12
|
it('should clear timeout with conditional check', ()=>{
|
|
13
|
-
const filePath = join(__dirname, 'useWindowSize.ts');
|
|
14
|
-
const fileContent = readFileSync(filePath, 'utf-8');
|
|
13
|
+
const filePath = __rspack_external_node_path_c5b9b54f.join(__dirname, 'useWindowSize.ts');
|
|
14
|
+
const fileContent = __rspack_external_node_fs_5ea92f0c.readFileSync(filePath, 'utf-8');
|
|
15
15
|
expect(fileContent).toContain('if (timeoutId) clearTimeout(timeoutId)');
|
|
16
16
|
expect(fileContent).not.toContain('clearTimeout(timeoutId!)');
|
|
17
17
|
});
|
|
18
18
|
it('should register and cleanup resize event listener', ()=>{
|
|
19
|
-
const filePath = join(__dirname, 'useWindowSize.ts');
|
|
20
|
-
const fileContent = readFileSync(filePath, 'utf-8');
|
|
19
|
+
const filePath = __rspack_external_node_path_c5b9b54f.join(__dirname, 'useWindowSize.ts');
|
|
20
|
+
const fileContent = __rspack_external_node_fs_5ea92f0c.readFileSync(filePath, 'utf-8');
|
|
21
21
|
expect(fileContent).toContain("addEventListener('resize'");
|
|
22
22
|
expect(fileContent).toContain("removeEventListener('resize'");
|
|
23
23
|
});
|
|
24
24
|
it('should set initial size immediately', ()=>{
|
|
25
|
-
const filePath = join(__dirname, 'useWindowSize.ts');
|
|
26
|
-
const fileContent = readFileSync(filePath, 'utf-8');
|
|
25
|
+
const filePath = __rspack_external_node_path_c5b9b54f.join(__dirname, 'useWindowSize.ts');
|
|
26
|
+
const fileContent = __rspack_external_node_fs_5ea92f0c.readFileSync(filePath, 'utf-8');
|
|
27
27
|
const setStateMatch = fileContent.match(/setSize\(\{[^}]+\}\)/g);
|
|
28
28
|
expect(setStateMatch).toBeTruthy();
|
|
29
29
|
expect(setStateMatch?.length).toBeGreaterThanOrEqual(2);
|
|
@@ -15,9 +15,6 @@ export type CodeBlockProps = {
|
|
|
15
15
|
* @default false
|
|
16
16
|
*/
|
|
17
17
|
fold?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* @default 300
|
|
20
|
-
*/
|
|
21
18
|
height?: number;
|
|
22
19
|
containerElementClassName?: string;
|
|
23
20
|
codeButtonGroupProps?: Omit<CodeButtonGroupProps, 'preElementRef' | 'wrapCode' | 'toggleWrapCode'>;
|
|
@@ -3,19 +3,22 @@ import { CodeButtonGroup, IconArrowDown, SvgWrapper, useCodeButtonGroup } from "
|
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
5
|
import "./index.css";
|
|
6
|
-
|
|
6
|
+
const DEFAULT_FOLD_HEIGHT = 300;
|
|
7
|
+
function CodeBlock({ containerElementClassName, title, lang = 'txt', wrapCode: wrapCodeProp = false, lineNumbers: lineNumbersProp = false, fold = false, height, codeButtonGroupProps, children }) {
|
|
7
8
|
if (process.env.__SSR_MD__) return /*#__PURE__*/ jsx(Fragment, {
|
|
8
9
|
children: children
|
|
9
10
|
});
|
|
10
11
|
const { wrapCode: wrapCodeState, toggleWrapCode, copyElementRef } = useCodeButtonGroup(wrapCodeProp);
|
|
11
12
|
const [expanded, setExpanded] = useState(false);
|
|
12
13
|
const [needFold, setNeedFold] = useState(false);
|
|
14
|
+
const hasScroll = !fold && void 0 !== height;
|
|
13
15
|
const codeBlockRef = useRef(null);
|
|
14
16
|
const contentRef = useRef(null);
|
|
15
17
|
useEffect(()=>{
|
|
16
18
|
if (!fold || !contentRef.current) return void setNeedFold(false);
|
|
19
|
+
const foldHeight = height ?? DEFAULT_FOLD_HEIGHT;
|
|
17
20
|
const realHeight = contentRef.current.scrollHeight;
|
|
18
|
-
setNeedFold(realHeight >
|
|
21
|
+
setNeedFold(realHeight > foldHeight);
|
|
19
22
|
}, [
|
|
20
23
|
fold,
|
|
21
24
|
height
|
|
@@ -45,8 +48,10 @@ function CodeBlock({ containerElementClassName, title, lang = 'txt', wrapCode: w
|
|
|
45
48
|
children: title
|
|
46
49
|
}),
|
|
47
50
|
/*#__PURE__*/ jsxs("div", {
|
|
48
|
-
className: clsx('rp-codeblock__content', wrapCodeState && 'rp-codeblock__content--wrap-code', lineNumbersProp && 'rp-codeblock__content--line-numbers', needFold && !expanded && 'rp-codeblock__content--fold'),
|
|
51
|
+
className: clsx('rp-codeblock__content', wrapCodeState && 'rp-codeblock__content--wrap-code', lineNumbersProp && 'rp-codeblock__content--line-numbers', needFold && !expanded && 'rp-codeblock__content--fold', hasScroll && 'rp-codeblock__content--scroll'),
|
|
49
52
|
style: needFold && !expanded ? {
|
|
53
|
+
maxHeight: `${height ?? DEFAULT_FOLD_HEIGHT}px`
|
|
54
|
+
} : hasScroll ? {
|
|
50
55
|
maxHeight: `${height}px`
|
|
51
56
|
} : void 0,
|
|
52
57
|
ref: contentRef,
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
position: absolute;
|
|
9
9
|
top: 50%;
|
|
10
10
|
left: 50%;
|
|
11
|
-
transform: translate(-50%, -50%)scale(0);
|
|
11
|
+
transform: translate(-50%, -50%) scale(0);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
.rp-code-copy-button--copied .rp-code-copy-button__icon--copy {
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
.rp-code-copy-button--copied .rp-code-copy-button__icon--success {
|
|
20
20
|
opacity: 1;
|
|
21
21
|
transition-delay: 75ms;
|
|
22
|
-
transform: translate(-50%, -50%)scale(1);
|
|
22
|
+
transform: translate(-50%, -50%) scale(1);
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
position: absolute;
|
|
50
50
|
top: 50%;
|
|
51
51
|
left: 50%;
|
|
52
|
-
transform: translate(-50%, -50%)scale(0);
|
|
52
|
+
transform: translate(-50%, -50%) scale(0);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
.rp-code-wrap-button--wrapped .rp-code-button-group__icon--wrap {
|
|
@@ -60,6 +60,6 @@
|
|
|
60
60
|
.rp-code-wrap-button--wrapped .rp-code-button-group__icon--wrapped {
|
|
61
61
|
opacity: 1;
|
|
62
62
|
transition-delay: 75ms;
|
|
63
|
-
transform: translate(-50%, -50%)scale(1);
|
|
63
|
+
transform: translate(-50%, -50%) scale(1);
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -17,13 +17,13 @@
|
|
|
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,7 +39,7 @@
|
|
|
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 {
|
|
@@ -52,6 +52,6 @@
|
|
|
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
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "The Rspress Documentation Framework",
|
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
|
6
6
|
"repository": {
|
|
@@ -60,7 +60,7 @@
|
|
|
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.
|
|
63
|
+
"@rsbuild/core": "2.0.0-beta.11",
|
|
64
64
|
"@rsbuild/plugin-react": "~1.4.6",
|
|
65
65
|
"@shikijs/rehype": "^4.0.2",
|
|
66
66
|
"@types/unist": "^3.0.3",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"react-lazy-with-preload": "^2.2.1",
|
|
86
86
|
"react-reconciler": "0.33.0",
|
|
87
87
|
"react-render-to-markdown": "19.0.1",
|
|
88
|
-
"react-router-dom": "^7.13.
|
|
88
|
+
"react-router-dom": "^7.13.2",
|
|
89
89
|
"rehype-external-links": "^3.0.0",
|
|
90
90
|
"rehype-raw": "^7.0.0",
|
|
91
91
|
"remark-cjk-friendly": "^2.0.1",
|
|
@@ -102,13 +102,13 @@
|
|
|
102
102
|
"unist-util-remove": "^4.0.0",
|
|
103
103
|
"unist-util-visit": "^5.0.0",
|
|
104
104
|
"unist-util-visit-children": "^3.0.0",
|
|
105
|
-
"@rspress/shared": "2.0.
|
|
105
|
+
"@rspress/shared": "2.0.8"
|
|
106
106
|
},
|
|
107
107
|
"devDependencies": {
|
|
108
108
|
"@microsoft/api-extractor": "^7.57.7",
|
|
109
109
|
"@rsbuild/plugin-sass": "~1.5.1",
|
|
110
110
|
"@rsbuild/plugin-svgr": "^1.3.1",
|
|
111
|
-
"@rslib/core": "0.20.
|
|
111
|
+
"@rslib/core": "0.20.2",
|
|
112
112
|
"@types/body-scroll-lock": "^3.1.2",
|
|
113
113
|
"@types/hast": "^3.0.4",
|
|
114
114
|
"@types/lodash-es": "^4.17.12",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"@types/react": "^19.2.14",
|
|
119
119
|
"@types/react-dom": "^19.2.3",
|
|
120
120
|
"@types/react-reconciler": "^0.33.0",
|
|
121
|
-
"@types/web": "^0.0.
|
|
121
|
+
"@types/web": "^0.0.345",
|
|
122
122
|
"execa": "8.0.1",
|
|
123
123
|
"mdast-util-directive": "^3.1.0",
|
|
124
124
|
"mdast-util-mdx-expression": "^2.0.1",
|
|
File without changes
|