@rspress/plugin-preview 2.0.0-beta.1 → 2.0.0-beta.11
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/README.md +1 -1
- package/dist/index.js +1 -14
- package/package.json +13 -13
- package/static/global-styles/entry.css +22 -5
package/README.md
CHANGED
package/dist/index.js
CHANGED
@@ -7,7 +7,6 @@ import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_plugin_solid_0a0a2645__ from "@rs
|
|
7
7
|
import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__ from "@rspress/shared";
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
|
9
9
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
10
|
-
import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__ from "@rspress/shared/node-utils";
|
11
10
|
const staticPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(__dirname, '..', 'static');
|
12
11
|
const demoBlockComponentPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(staticPath, 'global-components', 'DemoBlock.tsx');
|
13
12
|
const virtualDir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(process.cwd(), 'node_modules', __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.RSPRESS_TEMP_DIR, 'virtual-demo');
|
@@ -316,7 +315,6 @@ const remarkCodeToDemo = function({ getRouteMeta, previewMode, defaultRenderMode
|
|
316
315
|
remarkPlugin_demos[pageName] = [];
|
317
316
|
let title = pageName;
|
318
317
|
let index = 1;
|
319
|
-
let externalDemoIndex = 0;
|
320
318
|
function constructDemoNode(demoId, demoPath, currentNode, isMobileMode, externalDemoIndex) {
|
321
319
|
if (isMobileMode) {
|
322
320
|
const relativePathReg = new RegExp(/^\.\.?\/.*$/);
|
@@ -365,18 +363,6 @@ const remarkCodeToDemo = function({ getRouteMeta, previewMode, defaultRenderMode
|
|
365
363
|
title = firstChild && 'value' in firstChild && firstChild.value || title;
|
366
364
|
}
|
367
365
|
});
|
368
|
-
lib_visit(tree, 'mdxJsxFlowElement', (node)=>{
|
369
|
-
if ('code' === node.name) {
|
370
|
-
const src = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__.getNodeAttribute)(node, 'src');
|
371
|
-
if ('string' != typeof src) return;
|
372
|
-
const currentMode = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__.getNodeAttribute)(node, 'previewMode') ?? previewMode;
|
373
|
-
const isMobileAttr = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__.getNodeAttribute)(node, 'isMobile');
|
374
|
-
let isMobileMode = false;
|
375
|
-
isMobileMode = void 0 === isMobileAttr ? 'iframe' === currentMode : null === isMobileAttr ? true : 'object' == typeof isMobileAttr ? 'false' !== isMobileAttr.value : 'false' !== isMobileAttr;
|
376
|
-
const id = generateId(pageName, index++);
|
377
|
-
constructDemoNode(id, src, node, isMobileMode, externalDemoIndex++);
|
378
|
-
}
|
379
|
-
});
|
380
366
|
lib_visit(tree, 'code', (node)=>{
|
381
367
|
if ('hasVisited' in node) return;
|
382
368
|
if (node.lang && previewLanguages.includes(node.lang)) {
|
@@ -486,6 +472,7 @@ function pluginPreview(options) {
|
|
486
472
|
plugins: config?.builderPlugins
|
487
473
|
}, builderConfig);
|
488
474
|
const rsbuildInstance = await (0, __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.createRsbuild)({
|
475
|
+
callerName: 'rspress',
|
489
476
|
rsbuildConfig
|
490
477
|
});
|
491
478
|
const { pluginSass } = await import("@rsbuild/plugin-sass");
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rspress/plugin-preview",
|
3
|
-
"version": "2.0.0-beta.
|
3
|
+
"version": "2.0.0-beta.11",
|
4
4
|
"description": "A plugin for rspress to preview the code block in markdown/mdx file.",
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
6
6
|
"repository": {
|
@@ -23,36 +23,36 @@
|
|
23
23
|
"static"
|
24
24
|
],
|
25
25
|
"dependencies": {
|
26
|
-
"@rsbuild/core": "1.3.
|
26
|
+
"@rsbuild/core": "~1.3.21",
|
27
27
|
"@rsbuild/plugin-babel": "~1.0.5",
|
28
|
-
"@rsbuild/plugin-less": "~1.2.
|
29
|
-
"@rsbuild/plugin-react": "~1.
|
28
|
+
"@rsbuild/plugin-less": "~1.2.4",
|
29
|
+
"@rsbuild/plugin-react": "~1.3.1",
|
30
30
|
"@rsbuild/plugin-sass": "~1.3.1",
|
31
31
|
"@rsbuild/plugin-solid": "~1.0.5",
|
32
32
|
"lodash": "4.17.21",
|
33
33
|
"qrcode.react": "^4.2.0",
|
34
|
-
"@rspress/shared": "2.0.0-beta.
|
35
|
-
"@rspress/theme-default": "2.0.0-beta.
|
34
|
+
"@rspress/shared": "2.0.0-beta.11",
|
35
|
+
"@rspress/theme-default": "2.0.0-beta.11"
|
36
36
|
},
|
37
37
|
"devDependencies": {
|
38
|
-
"@rslib/core": "0.
|
39
|
-
"@types/lodash": "^4.17.
|
38
|
+
"@rslib/core": "0.8.0",
|
39
|
+
"@types/lodash": "^4.17.17",
|
40
40
|
"@types/mdast": "^4.0.4",
|
41
|
-
"@types/node": "^
|
42
|
-
"@types/react": "^
|
43
|
-
"@types/react-dom": "^
|
41
|
+
"@types/node": "^22.8.1",
|
42
|
+
"@types/react": "^19.1.6",
|
43
|
+
"@types/react-dom": "^19.1.6",
|
44
44
|
"mdast-util-mdx-jsx": "^3.2.0",
|
45
45
|
"mdast-util-mdxjs-esm": "^2.0.1",
|
46
46
|
"react": "^19.1.0",
|
47
47
|
"react-dom": "^19.1.0",
|
48
48
|
"react-router-dom": "^6.29.0",
|
49
|
-
"rsbuild-plugin-publint": "^0.3.
|
49
|
+
"rsbuild-plugin-publint": "^0.3.2",
|
50
50
|
"typescript": "^5.8.2",
|
51
51
|
"unified": "^11.0.5",
|
52
52
|
"unist-util-visit": "^5.0.0"
|
53
53
|
},
|
54
54
|
"peerDependencies": {
|
55
|
-
"@rspress/core": "^2.0.0-beta.
|
55
|
+
"@rspress/core": "^2.0.0-beta.11",
|
56
56
|
"react": ">=18.0.0",
|
57
57
|
"react-router-dom": "^6.8.1"
|
58
58
|
},
|
@@ -1,12 +1,29 @@
|
|
1
|
-
@import url(@rspress/theme-default/bundle.css);
|
2
|
-
|
3
1
|
:root {
|
4
|
-
--rp-iframe-bg:
|
2
|
+
--rp-iframe-bg: #f6f8fa;
|
3
|
+
--rp-iframe-nav-bg: #ffffff;
|
5
4
|
}
|
6
5
|
|
6
|
+
/* TODO: support dark mode */
|
7
|
+
/* .dark {
|
8
|
+
--rp-iframe-bg: #242424;
|
9
|
+
--rp-iframe-nav-bg: #191d24;
|
10
|
+
} */
|
11
|
+
|
7
12
|
body {
|
8
|
-
background-color: var(--rp-iframe-bg);
|
13
|
+
background-color: var(--rp-iframe-bg) !important;
|
14
|
+
margin: 0px; /* copied from preflight.css */
|
15
|
+
}
|
16
|
+
|
17
|
+
/* #region copied from preflight.css */
|
18
|
+
*,
|
19
|
+
::before,
|
20
|
+
::after {
|
21
|
+
box-sizing: border-box; /* 1 */
|
22
|
+
border-width: 0; /* 2 */
|
23
|
+
border-style: solid; /* 2 */
|
24
|
+
border-color: theme('borderColor.DEFAULT', currentColor); /* 2 */
|
9
25
|
}
|
26
|
+
/* #endregion copied from preflight.css */
|
10
27
|
|
11
28
|
.preview-nav {
|
12
29
|
position: relative;
|
@@ -14,7 +31,7 @@ body {
|
|
14
31
|
align-items: center;
|
15
32
|
justify-content: center;
|
16
33
|
height: 56px;
|
17
|
-
background-color: var(--rp-
|
34
|
+
background-color: var(--rp-iframe-nav-bg) !important;
|
18
35
|
font-weight: 600;
|
19
36
|
font-size: 17px;
|
20
37
|
}
|