@rspress/plugin-preview 0.0.0-next-20230824072138 → 0.0.0-next-20230925114748
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/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/virtual-demo.js +2 -3
- package/package.json +5 -5
- package/static/global-components/Container.scss +7 -8
- package/static/global-components/Container.tsx +9 -9
- package/static/global-components/DemoBlock.scss +4 -4
- package/static/global-components/DemoBlock.tsx +3 -3
- package/static/global-components/Device.scss +19 -17
- package/static/global-components/Device.tsx +7 -8
- package/static/global-components/common/mobile-operation.tsx +5 -5
- package/static/global-components/icons/Code.tsx +19 -0
- package/static/global-components/icons/Launch.tsx +18 -0
- package/static/global-components/icons/Qrcode.tsx +19 -0
- package/static/global-components/icons/Refresh.tsx +19 -0
- package/static/global-styles/mobile.css +14 -14
- package/static/global-styles/web.css +4 -4
- package/static/global-components/svg/code.svg +0 -3
- package/static/global-components/svg/launch.svg +0 -5
- package/static/global-components/svg/qrcode.svg +0 -3
- package/static/global-components/svg/refresh.svg +0 -3
package/dist/index.js
CHANGED
@@ -2415,9 +2415,9 @@ var require_lib = __commonJS({
|
|
2415
2415
|
}
|
2416
2416
|
});
|
2417
2417
|
|
2418
|
-
// ../../node_modules/.pnpm/rspack-plugin-virtual-module@0.1.
|
2418
|
+
// ../../node_modules/.pnpm/rspack-plugin-virtual-module@0.1.11/node_modules/rspack-plugin-virtual-module/dist/index.js
|
2419
2419
|
var require_dist = __commonJS({
|
2420
|
-
"../../node_modules/.pnpm/rspack-plugin-virtual-module@0.1.
|
2420
|
+
"../../node_modules/.pnpm/rspack-plugin-virtual-module@0.1.11/node_modules/rspack-plugin-virtual-module/dist/index.js"(exports) {
|
2421
2421
|
"use strict";
|
2422
2422
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
2423
2423
|
if (k2 === void 0)
|
@@ -2489,7 +2489,7 @@ var require_dist = __commonJS({
|
|
2489
2489
|
if (!fs_extra_1.default.existsSync(nodeModulesDir)) {
|
2490
2490
|
fs_extra_1.default.mkdirSync(nodeModulesDir);
|
2491
2491
|
}
|
2492
|
-
const hash = crypto_1.default.createHash("
|
2492
|
+
const hash = crypto_1.default.createHash("md5").update(JSON.stringify(__classPrivateFieldGet(this, _RspackVirtualModulePlugin_staticModules, "f"))).digest("hex").slice(0, 8);
|
2493
2493
|
__classPrivateFieldSet(this, _RspackVirtualModulePlugin_tempDir, path_1.default.join(nodeModulesDir, `rspack-virtual-module-${hash}`), "f");
|
2494
2494
|
if (!fs_extra_1.default.existsSync(__classPrivateFieldGet(this, _RspackVirtualModulePlugin_tempDir, "f"))) {
|
2495
2495
|
fs_extra_1.default.mkdirSync(__classPrivateFieldGet(this, _RspackVirtualModulePlugin_tempDir, "f"));
|
@@ -2769,11 +2769,13 @@ __export(src_exports, {
|
|
2769
2769
|
module.exports = __toCommonJS(src_exports);
|
2770
2770
|
var import_path3 = __toESM(require("path"));
|
2771
2771
|
var import_rspack_plugin_virtual_module = __toESM(require_dist());
|
2772
|
+
var import_shared2 = require("@rspress/shared");
|
2772
2773
|
|
2773
2774
|
// src/codeToDemo.ts
|
2774
2775
|
var import_path2 = require("path");
|
2775
2776
|
init_unist_util_visit();
|
2776
2777
|
var import_fs_extra = __toESM(require("@modern-js/utils/fs-extra"));
|
2778
|
+
var import_shared = require("@rspress/shared");
|
2777
2779
|
|
2778
2780
|
// src/utils.ts
|
2779
2781
|
var toValidVarName = (str) => {
|
@@ -2811,7 +2813,7 @@ var remarkCodeToDemo = ({ isMobile, getRouteMeta, iframePosition }) => {
|
|
2811
2813
|
return (tree, vfile) => {
|
2812
2814
|
const demos = [];
|
2813
2815
|
const route = routeMeta2.find(
|
2814
|
-
(meta) => meta.absolutePath === (vfile.path || vfile.history[0])
|
2816
|
+
(meta) => (0, import_shared.normalizePosixPath)(meta.absolutePath) === (0, import_shared.normalizePosixPath)(vfile.path || vfile.history[0])
|
2815
2817
|
);
|
2816
2818
|
if (!route) {
|
2817
2819
|
return;
|
@@ -2895,7 +2897,7 @@ var remarkCodeToDemo = ({ isMobile, getRouteMeta, iframePosition }) => {
|
|
2895
2897
|
const demoDir = (0, import_path2.join)(
|
2896
2898
|
process.cwd(),
|
2897
2899
|
"node_modules",
|
2898
|
-
|
2900
|
+
import_shared.RSPRESS_TEMP_DIR,
|
2899
2901
|
`virtual-demo`
|
2900
2902
|
);
|
2901
2903
|
const id = `${toValidVarName(pageName)}_${index++}`;
|
@@ -3029,7 +3031,7 @@ import Demo from ${JSON.stringify(demoComponentPath)}
|
|
3029
3031
|
const ast = processor.parse(source);
|
3030
3032
|
let index = 1;
|
3031
3033
|
const { pageName } = routeMeta.find(
|
3032
|
-
(meta) => meta.absolutePath === filepath
|
3034
|
+
(meta) => (0, import_shared2.normalizePosixPath)(meta.absolutePath) === (0, import_shared2.normalizePosixPath)(filepath)
|
3033
3035
|
);
|
3034
3036
|
const registerDemo = (demoId, demoPath, isMobileMode) => {
|
3035
3037
|
if (isMobileMode) {
|
@@ -3077,13 +3079,13 @@ import Demo from ${JSON.stringify(demoComponentPath)}
|
|
3077
3079
|
}
|
3078
3080
|
const isMobileMode = node?.meta?.includes("mobile") || !node?.meta?.includes("web") && isMobile;
|
3079
3081
|
const { pageName: pageName2 } = routeMeta.find(
|
3080
|
-
(meta) => meta.absolutePath === filepath
|
3082
|
+
(meta) => (0, import_shared2.normalizePosixPath)(meta.absolutePath) === (0, import_shared2.normalizePosixPath)(filepath)
|
3081
3083
|
);
|
3082
3084
|
const id = `${toValidVarName(pageName2)}_${index++}`;
|
3083
3085
|
const demoDir = (0, import_path3.join)(
|
3084
3086
|
process.cwd(),
|
3085
3087
|
"node_modules",
|
3086
|
-
|
3088
|
+
import_shared2.RSPRESS_TEMP_DIR,
|
3087
3089
|
`virtual-demo`
|
3088
3090
|
);
|
3089
3091
|
const virtualModulePath = (0, import_path3.join)(demoDir, `${id}.tsx`);
|