@rspress/plugin-playground 2.0.0-alpha.7 → 2.0.0-alpha.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.
- package/dist/cli/cjs/{301.js → 52.js} +3 -3
- package/dist/cli/cjs/index.js +58 -36
- package/dist/cli/esm/{301.mjs → 52.mjs} +3 -3
- package/dist/cli/esm/index.mjs +66 -50
- package/dist/web/cjs/index.js +16 -10
- package/dist/web/esm/index.mjs +5 -7
- package/package.json +14 -14
- package/static/global-components/Playground.tsx +7 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.ids = [
|
|
3
|
-
'
|
|
3
|
+
'52'
|
|
4
4
|
];
|
|
5
5
|
exports.modules = {
|
|
6
|
-
"../../node_modules/.pnpm/unist-util-visit@
|
|
6
|
+
"../../node_modules/.pnpm/unist-util-visit@5.0.0/node_modules/unist-util-visit/index.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
7
7
|
__webpack_require__.d(__webpack_exports__, {
|
|
8
8
|
visit: ()=>_lib_index_js__WEBPACK_IMPORTED_MODULE_0__.Vn
|
|
9
9
|
});
|
|
10
|
-
var _lib_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/unist-util-visit@
|
|
10
|
+
var _lib_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/unist-util-visit@5.0.0/node_modules/unist-util-visit/lib/index.js");
|
|
11
11
|
}
|
|
12
12
|
};
|
package/dist/cli/cjs/index.js
CHANGED
|
@@ -6,15 +6,15 @@ var __webpack_modules__ = {
|
|
|
6
6
|
"remark-gfm": function(module) {
|
|
7
7
|
module.exports = import("remark-gfm");
|
|
8
8
|
},
|
|
9
|
-
"../../node_modules/.pnpm/unist-util-visit@
|
|
9
|
+
"../../node_modules/.pnpm/unist-util-visit@5.0.0/node_modules/unist-util-visit/lib/index.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
10
10
|
__webpack_require__.d(__webpack_exports__, {
|
|
11
11
|
Vn: ()=>lib_visit
|
|
12
12
|
});
|
|
13
13
|
const convert = function(test) {
|
|
14
14
|
if (null == test) return ok;
|
|
15
|
-
if ('string' == typeof test) return typeFactory(test);
|
|
16
|
-
if ('object' == typeof test) return Array.isArray(test) ? anyFactory(test) : propsFactory(test);
|
|
17
15
|
if ('function' == typeof test) return castFactory(test);
|
|
16
|
+
if ('object' == typeof test) return Array.isArray(test) ? anyFactory(test) : propsFactory(test);
|
|
17
|
+
if ('string' == typeof test) return typeFactory(test);
|
|
18
18
|
throw new Error('Expected function, string, or object as test');
|
|
19
19
|
};
|
|
20
20
|
function anyFactory(tests) {
|
|
@@ -24,15 +24,17 @@ var __webpack_modules__ = {
|
|
|
24
24
|
return castFactory(any);
|
|
25
25
|
function any(...parameters) {
|
|
26
26
|
let index = -1;
|
|
27
|
-
while(++index < checks.length)if (checks[index].
|
|
27
|
+
while(++index < checks.length)if (checks[index].apply(this, parameters)) return true;
|
|
28
28
|
return false;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
function propsFactory(check) {
|
|
32
|
+
const checkAsRecord = check;
|
|
32
33
|
return castFactory(all);
|
|
33
34
|
function all(node) {
|
|
35
|
+
const nodeAsRecord = node;
|
|
34
36
|
let key;
|
|
35
|
-
for(key in check)if (
|
|
37
|
+
for(key in check)if (nodeAsRecord[key] !== checkAsRecord[key]) return false;
|
|
36
38
|
return true;
|
|
37
39
|
}
|
|
38
40
|
}
|
|
@@ -42,28 +44,32 @@ var __webpack_modules__ = {
|
|
|
42
44
|
return node && node.type === check;
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
|
-
function castFactory(
|
|
46
|
-
return
|
|
47
|
-
function
|
|
48
|
-
return Boolean(
|
|
47
|
+
function castFactory(testFunction) {
|
|
48
|
+
return check;
|
|
49
|
+
function check(value, index, parent) {
|
|
50
|
+
return Boolean(looksLikeANode(value) && testFunction.call(this, value, 'number' == typeof index ? index : void 0, parent || void 0));
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
function ok() {
|
|
52
54
|
return true;
|
|
53
55
|
}
|
|
56
|
+
function looksLikeANode(value) {
|
|
57
|
+
return null !== value && 'object' == typeof value && 'type' in value;
|
|
58
|
+
}
|
|
54
59
|
function color(d) {
|
|
55
60
|
return '\u001B[33m' + d + '\u001B[39m';
|
|
56
61
|
}
|
|
62
|
+
const empty = [];
|
|
57
63
|
const CONTINUE = true;
|
|
58
64
|
const EXIT = false;
|
|
59
65
|
const SKIP = 'skip';
|
|
60
|
-
|
|
66
|
+
function visitParents(tree, test, visitor, reverse) {
|
|
67
|
+
let check;
|
|
61
68
|
if ('function' == typeof test && 'function' != typeof visitor) {
|
|
62
69
|
reverse = visitor;
|
|
63
70
|
visitor = test;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const is = convert(test);
|
|
71
|
+
} else check = test;
|
|
72
|
+
const is = convert(check);
|
|
67
73
|
const step = reverse ? -1 : 1;
|
|
68
74
|
factory(tree, void 0, [])();
|
|
69
75
|
function factory(node, index, parents) {
|
|
@@ -76,49 +82,61 @@ var __webpack_modules__ = {
|
|
|
76
82
|
}
|
|
77
83
|
return visit;
|
|
78
84
|
function visit() {
|
|
79
|
-
let result =
|
|
85
|
+
let result = empty;
|
|
80
86
|
let subresult;
|
|
81
87
|
let offset;
|
|
82
88
|
let grandparents;
|
|
83
|
-
if (!test || is(node, index, parents[parents.length - 1] ||
|
|
89
|
+
if (!test || is(node, index, parents[parents.length - 1] || void 0)) {
|
|
84
90
|
result = toResult(visitor(node, parents));
|
|
85
91
|
if (result[0] === EXIT) return result;
|
|
86
92
|
}
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
if ('children' in node && node.children) {
|
|
94
|
+
const nodeAsParent = node;
|
|
95
|
+
if (nodeAsParent.children && result[0] !== SKIP) {
|
|
96
|
+
offset = (reverse ? nodeAsParent.children.length : -1) + step;
|
|
97
|
+
grandparents = parents.concat(nodeAsParent);
|
|
98
|
+
while(offset > -1 && offset < nodeAsParent.children.length){
|
|
99
|
+
const child = nodeAsParent.children[offset];
|
|
100
|
+
subresult = factory(child, offset, grandparents)();
|
|
101
|
+
if (subresult[0] === EXIT) return subresult;
|
|
102
|
+
offset = 'number' == typeof subresult[1] ? subresult[1] : offset + step;
|
|
103
|
+
}
|
|
94
104
|
}
|
|
95
105
|
}
|
|
96
106
|
return result;
|
|
97
107
|
}
|
|
98
108
|
}
|
|
99
|
-
}
|
|
109
|
+
}
|
|
100
110
|
function toResult(value) {
|
|
101
111
|
if (Array.isArray(value)) return value;
|
|
102
112
|
if ('number' == typeof value) return [
|
|
103
113
|
CONTINUE,
|
|
104
114
|
value
|
|
105
115
|
];
|
|
106
|
-
return [
|
|
116
|
+
return null == value ? empty : [
|
|
107
117
|
value
|
|
108
118
|
];
|
|
109
119
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
120
|
+
function lib_visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
|
|
121
|
+
let reverse;
|
|
122
|
+
let test;
|
|
123
|
+
let visitor;
|
|
124
|
+
if ('function' == typeof testOrVisitor && 'function' != typeof visitorOrReverse) {
|
|
125
|
+
test = void 0;
|
|
126
|
+
visitor = testOrVisitor;
|
|
127
|
+
reverse = visitorOrReverse;
|
|
128
|
+
} else {
|
|
129
|
+
test = testOrVisitor;
|
|
130
|
+
visitor = visitorOrReverse;
|
|
131
|
+
reverse = maybeReverse;
|
|
115
132
|
}
|
|
116
133
|
visitParents(tree, test, overload, reverse);
|
|
117
134
|
function overload(node, parents) {
|
|
118
135
|
const parent = parents[parents.length - 1];
|
|
119
|
-
|
|
136
|
+
const index = parent ? parent.children.indexOf(node) : void 0;
|
|
137
|
+
return visitor(node, index, parent);
|
|
120
138
|
}
|
|
121
|
-
}
|
|
139
|
+
}
|
|
122
140
|
}
|
|
123
141
|
};
|
|
124
142
|
var __webpack_module_cache__ = {};
|
|
@@ -205,7 +223,7 @@ var __webpack_exports__ = {};
|
|
|
205
223
|
return u.replace(/\/\//g, '/');
|
|
206
224
|
}
|
|
207
225
|
const staticPath = external_node_path_default().join(__dirname, '../../../static');
|
|
208
|
-
var lib = __webpack_require__("../../node_modules/.pnpm/unist-util-visit@
|
|
226
|
+
var lib = __webpack_require__("../../node_modules/.pnpm/unist-util-visit@5.0.0/node_modules/unist-util-visit/lib/index.js");
|
|
209
227
|
const napi_namespaceObject = require("@oxidation-compiler/napi");
|
|
210
228
|
var napi_default = /*#__PURE__*/ __webpack_require__.n(napi_namespaceObject);
|
|
211
229
|
const parseImports = (code, sourceExt)=>{
|
|
@@ -341,7 +359,7 @@ var __webpack_exports__ = {};
|
|
|
341
359
|
const isMdxFile = /\.mdx?$/.test(filepath);
|
|
342
360
|
if (!isMdxFile) return;
|
|
343
361
|
const { createProcessor } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "@mdx-js/mdx"));
|
|
344
|
-
const { visit } = await __webpack_require__.e("
|
|
362
|
+
const { visit } = await __webpack_require__.e("52").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/unist-util-visit@5.0.0/node_modules/unist-util-visit/index.js"));
|
|
345
363
|
const { default: remarkGFM } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "remark-gfm"));
|
|
346
364
|
try {
|
|
347
365
|
const processor = createProcessor({
|
|
@@ -470,8 +488,12 @@ var __webpack_exports__ = {};
|
|
|
470
488
|
};
|
|
471
489
|
}
|
|
472
490
|
})();
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
491
|
+
exports.pluginPlayground = __webpack_exports__.pluginPlayground;
|
|
492
|
+
exports.routeMeta = __webpack_exports__.routeMeta;
|
|
493
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
494
|
+
"pluginPlayground",
|
|
495
|
+
"routeMeta"
|
|
496
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
497
|
+
Object.defineProperty(exports, '__esModule', {
|
|
476
498
|
value: true
|
|
477
499
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export const __webpack_ids__ = [
|
|
2
|
-
'
|
|
2
|
+
'52'
|
|
3
3
|
];
|
|
4
4
|
export const __webpack_modules__ = {
|
|
5
|
-
"../../node_modules/.pnpm/unist-util-visit@
|
|
5
|
+
"../../node_modules/.pnpm/unist-util-visit@5.0.0/node_modules/unist-util-visit/index.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
6
6
|
__webpack_require__.d(__webpack_exports__, {
|
|
7
7
|
visit: ()=>_lib_index_js__WEBPACK_IMPORTED_MODULE_0__.Vn
|
|
8
8
|
});
|
|
9
|
-
var _lib_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/unist-util-visit@
|
|
9
|
+
var _lib_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("../../node_modules/.pnpm/unist-util-visit@5.0.0/node_modules/unist-util-visit/lib/index.js");
|
|
10
10
|
}
|
|
11
11
|
};
|
package/dist/cli/esm/index.mjs
CHANGED
|
@@ -6,15 +6,15 @@ import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_node_utils_78947ce6__ from
|
|
|
6
6
|
import * as __WEBPACK_EXTERNAL_MODULE_rspack_plugin_virtual_module_609978fd__ from "rspack-plugin-virtual-module";
|
|
7
7
|
import * as __WEBPACK_EXTERNAL_MODULE__oxidation_compiler_napi_5e24345a__ from "@oxidation-compiler/napi";
|
|
8
8
|
var __webpack_modules__ = {
|
|
9
|
-
"../../node_modules/.pnpm/unist-util-visit@
|
|
9
|
+
"../../node_modules/.pnpm/unist-util-visit@5.0.0/node_modules/unist-util-visit/lib/index.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
10
10
|
__webpack_require__.d(__webpack_exports__, {
|
|
11
11
|
Vn: ()=>lib_visit
|
|
12
12
|
});
|
|
13
13
|
const convert = function(test) {
|
|
14
14
|
if (null == test) return ok;
|
|
15
|
-
if ('string' == typeof test) return typeFactory(test);
|
|
16
|
-
if ('object' == typeof test) return Array.isArray(test) ? anyFactory(test) : propsFactory(test);
|
|
17
15
|
if ('function' == typeof test) return castFactory(test);
|
|
16
|
+
if ('object' == typeof test) return Array.isArray(test) ? anyFactory(test) : propsFactory(test);
|
|
17
|
+
if ('string' == typeof test) return typeFactory(test);
|
|
18
18
|
throw new Error('Expected function, string, or object as test');
|
|
19
19
|
};
|
|
20
20
|
function anyFactory(tests) {
|
|
@@ -24,15 +24,17 @@ var __webpack_modules__ = {
|
|
|
24
24
|
return castFactory(any);
|
|
25
25
|
function any(...parameters) {
|
|
26
26
|
let index = -1;
|
|
27
|
-
while(++index < checks.length)if (checks[index].
|
|
27
|
+
while(++index < checks.length)if (checks[index].apply(this, parameters)) return true;
|
|
28
28
|
return false;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
function propsFactory(check) {
|
|
32
|
+
const checkAsRecord = check;
|
|
32
33
|
return castFactory(all);
|
|
33
34
|
function all(node) {
|
|
35
|
+
const nodeAsRecord = node;
|
|
34
36
|
let key;
|
|
35
|
-
for(key in check)if (
|
|
37
|
+
for(key in check)if (nodeAsRecord[key] !== checkAsRecord[key]) return false;
|
|
36
38
|
return true;
|
|
37
39
|
}
|
|
38
40
|
}
|
|
@@ -42,28 +44,32 @@ var __webpack_modules__ = {
|
|
|
42
44
|
return node && node.type === check;
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
|
-
function castFactory(
|
|
46
|
-
return
|
|
47
|
-
function
|
|
48
|
-
return Boolean(
|
|
47
|
+
function castFactory(testFunction) {
|
|
48
|
+
return check;
|
|
49
|
+
function check(value, index, parent) {
|
|
50
|
+
return Boolean(looksLikeANode(value) && testFunction.call(this, value, 'number' == typeof index ? index : void 0, parent || void 0));
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
function ok() {
|
|
52
54
|
return true;
|
|
53
55
|
}
|
|
56
|
+
function looksLikeANode(value) {
|
|
57
|
+
return null !== value && 'object' == typeof value && 'type' in value;
|
|
58
|
+
}
|
|
54
59
|
function color(d) {
|
|
55
60
|
return '\u001B[33m' + d + '\u001B[39m';
|
|
56
61
|
}
|
|
62
|
+
const empty = [];
|
|
57
63
|
const CONTINUE = true;
|
|
58
64
|
const EXIT = false;
|
|
59
65
|
const SKIP = 'skip';
|
|
60
|
-
|
|
66
|
+
function visitParents(tree, test, visitor, reverse) {
|
|
67
|
+
let check;
|
|
61
68
|
if ('function' == typeof test && 'function' != typeof visitor) {
|
|
62
69
|
reverse = visitor;
|
|
63
70
|
visitor = test;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const is = convert(test);
|
|
71
|
+
} else check = test;
|
|
72
|
+
const is = convert(check);
|
|
67
73
|
const step = reverse ? -1 : 1;
|
|
68
74
|
factory(tree, void 0, [])();
|
|
69
75
|
function factory(node, index, parents) {
|
|
@@ -76,49 +82,61 @@ var __webpack_modules__ = {
|
|
|
76
82
|
}
|
|
77
83
|
return visit;
|
|
78
84
|
function visit() {
|
|
79
|
-
let result =
|
|
85
|
+
let result = empty;
|
|
80
86
|
let subresult;
|
|
81
87
|
let offset;
|
|
82
88
|
let grandparents;
|
|
83
|
-
if (!test || is(node, index, parents[parents.length - 1] ||
|
|
89
|
+
if (!test || is(node, index, parents[parents.length - 1] || void 0)) {
|
|
84
90
|
result = toResult(visitor(node, parents));
|
|
85
91
|
if (result[0] === EXIT) return result;
|
|
86
92
|
}
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
if ('children' in node && node.children) {
|
|
94
|
+
const nodeAsParent = node;
|
|
95
|
+
if (nodeAsParent.children && result[0] !== SKIP) {
|
|
96
|
+
offset = (reverse ? nodeAsParent.children.length : -1) + step;
|
|
97
|
+
grandparents = parents.concat(nodeAsParent);
|
|
98
|
+
while(offset > -1 && offset < nodeAsParent.children.length){
|
|
99
|
+
const child = nodeAsParent.children[offset];
|
|
100
|
+
subresult = factory(child, offset, grandparents)();
|
|
101
|
+
if (subresult[0] === EXIT) return subresult;
|
|
102
|
+
offset = 'number' == typeof subresult[1] ? subresult[1] : offset + step;
|
|
103
|
+
}
|
|
94
104
|
}
|
|
95
105
|
}
|
|
96
106
|
return result;
|
|
97
107
|
}
|
|
98
108
|
}
|
|
99
|
-
}
|
|
109
|
+
}
|
|
100
110
|
function toResult(value) {
|
|
101
111
|
if (Array.isArray(value)) return value;
|
|
102
112
|
if ('number' == typeof value) return [
|
|
103
113
|
CONTINUE,
|
|
104
114
|
value
|
|
105
115
|
];
|
|
106
|
-
return [
|
|
116
|
+
return null == value ? empty : [
|
|
107
117
|
value
|
|
108
118
|
];
|
|
109
119
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
120
|
+
function lib_visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
|
|
121
|
+
let reverse;
|
|
122
|
+
let test;
|
|
123
|
+
let visitor;
|
|
124
|
+
if ('function' == typeof testOrVisitor && 'function' != typeof visitorOrReverse) {
|
|
125
|
+
test = void 0;
|
|
126
|
+
visitor = testOrVisitor;
|
|
127
|
+
reverse = visitorOrReverse;
|
|
128
|
+
} else {
|
|
129
|
+
test = testOrVisitor;
|
|
130
|
+
visitor = visitorOrReverse;
|
|
131
|
+
reverse = maybeReverse;
|
|
115
132
|
}
|
|
116
133
|
visitParents(tree, test, overload, reverse);
|
|
117
134
|
function overload(node, parents) {
|
|
118
135
|
const parent = parents[parents.length - 1];
|
|
119
|
-
|
|
136
|
+
const index = parent ? parent.children.indexOf(node) : void 0;
|
|
137
|
+
return visitor(node, index, parent);
|
|
120
138
|
}
|
|
121
|
-
}
|
|
139
|
+
}
|
|
122
140
|
}
|
|
123
141
|
};
|
|
124
142
|
var __webpack_module_cache__ = {};
|
|
@@ -172,23 +190,21 @@ __webpack_require__.m = __webpack_modules__;
|
|
|
172
190
|
};
|
|
173
191
|
__webpack_require__.f.j = function(chunkId, promises) {
|
|
174
192
|
var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : void 0;
|
|
175
|
-
if (0 !== installedChunkData)
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
promises.push(installedChunkData[1] = promise);
|
|
191
|
-
}
|
|
193
|
+
if (0 !== installedChunkData) if (installedChunkData) promises.push(installedChunkData[1]);
|
|
194
|
+
else {
|
|
195
|
+
var promise = import("./" + __webpack_require__.u(chunkId)).then(installChunk, (e)=>{
|
|
196
|
+
if (0 !== installedChunks[chunkId]) installedChunks[chunkId] = void 0;
|
|
197
|
+
throw e;
|
|
198
|
+
});
|
|
199
|
+
var promise = Promise.race([
|
|
200
|
+
promise,
|
|
201
|
+
new Promise((resolve)=>{
|
|
202
|
+
installedChunkData = installedChunks[chunkId] = [
|
|
203
|
+
resolve
|
|
204
|
+
];
|
|
205
|
+
})
|
|
206
|
+
]);
|
|
207
|
+
promises.push(installedChunkData[1] = promise);
|
|
192
208
|
}
|
|
193
209
|
};
|
|
194
210
|
})();
|
|
@@ -199,7 +215,7 @@ function normalizeUrl(u) {
|
|
|
199
215
|
}
|
|
200
216
|
var constant_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));
|
|
201
217
|
const staticPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(constant_dirname, '../../../static');
|
|
202
|
-
var lib = __webpack_require__("../../node_modules/.pnpm/unist-util-visit@
|
|
218
|
+
var lib = __webpack_require__("../../node_modules/.pnpm/unist-util-visit@5.0.0/node_modules/unist-util-visit/lib/index.js");
|
|
203
219
|
const parseImports = (code, sourceExt)=>{
|
|
204
220
|
const parsed = __WEBPACK_EXTERNAL_MODULE__oxidation_compiler_napi_5e24345a__["default"].parseSync(code, {
|
|
205
221
|
sourceType: 'module',
|
|
@@ -334,7 +350,7 @@ function pluginPlayground(options) {
|
|
|
334
350
|
const isMdxFile = /\.mdx?$/.test(filepath);
|
|
335
351
|
if (!isMdxFile) return;
|
|
336
352
|
const { createProcessor } = await import("@mdx-js/mdx");
|
|
337
|
-
const { visit } = await __webpack_require__.e("
|
|
353
|
+
const { visit } = await __webpack_require__.e("52").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/unist-util-visit@5.0.0/node_modules/unist-util-visit/index.js"));
|
|
338
354
|
const { default: remarkGFM } = await import("remark-gfm");
|
|
339
355
|
try {
|
|
340
356
|
const processor = createProcessor({
|
package/dist/web/cjs/index.js
CHANGED
|
@@ -246,13 +246,11 @@ class Runner extends external_react_namespaceObject.Component {
|
|
|
246
246
|
if ('React' === specifier.local.name) this.hasReactImported = true;
|
|
247
247
|
if ('ImportDefaultSpecifier' === specifier.type) code.push(createVariableDeclaration(specifier.local.name, createGetImport(pkg, true)));
|
|
248
248
|
if ('ImportNamespaceSpecifier' === specifier.type) code.push(createVariableDeclaration(specifier.local.name, createGetImport(pkg)));
|
|
249
|
-
if ('ImportSpecifier' === specifier.type)
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
else specifiers.push(specifier.local.name);
|
|
255
|
-
}
|
|
249
|
+
if ('ImportSpecifier' === specifier.type) if ('name' in specifier.imported && specifier.imported.name !== specifier.local.name) specifiers.push([
|
|
250
|
+
specifier.imported.name,
|
|
251
|
+
specifier.local.name
|
|
252
|
+
]);
|
|
253
|
+
else specifiers.push(specifier.local.name);
|
|
256
254
|
}
|
|
257
255
|
if (specifiers.length > 0) code.push(createVariableDeclaration(createObjectPattern(specifiers), createGetImport(pkg)));
|
|
258
256
|
path.replaceWithMultiple(code);
|
|
@@ -316,8 +314,16 @@ class Runner extends external_react_namespaceObject.Component {
|
|
|
316
314
|
this.waitCompile = this.waitCompile.bind(this);
|
|
317
315
|
}
|
|
318
316
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
317
|
+
exports.Editor = __webpack_exports__.Editor;
|
|
318
|
+
exports.MonacoEditor = __webpack_exports__.MonacoEditor;
|
|
319
|
+
exports.MonacoEditorLoader = __webpack_exports__.MonacoEditorLoader;
|
|
320
|
+
exports.Runner = __webpack_exports__.Runner;
|
|
321
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
322
|
+
"Editor",
|
|
323
|
+
"MonacoEditor",
|
|
324
|
+
"MonacoEditorLoader",
|
|
325
|
+
"Runner"
|
|
326
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
327
|
+
Object.defineProperty(exports, '__esModule', {
|
|
322
328
|
value: true
|
|
323
329
|
});
|
package/dist/web/esm/index.mjs
CHANGED
|
@@ -206,13 +206,11 @@ class Runner extends __WEBPACK_EXTERNAL_MODULE_react__.Component {
|
|
|
206
206
|
if ('React' === specifier.local.name) this.hasReactImported = true;
|
|
207
207
|
if ('ImportDefaultSpecifier' === specifier.type) code.push(createVariableDeclaration(specifier.local.name, createGetImport(pkg, true)));
|
|
208
208
|
if ('ImportNamespaceSpecifier' === specifier.type) code.push(createVariableDeclaration(specifier.local.name, createGetImport(pkg)));
|
|
209
|
-
if ('ImportSpecifier' === specifier.type)
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
else specifiers.push(specifier.local.name);
|
|
215
|
-
}
|
|
209
|
+
if ('ImportSpecifier' === specifier.type) if ('name' in specifier.imported && specifier.imported.name !== specifier.local.name) specifiers.push([
|
|
210
|
+
specifier.imported.name,
|
|
211
|
+
specifier.local.name
|
|
212
|
+
]);
|
|
213
|
+
else specifiers.push(specifier.local.name);
|
|
216
214
|
}
|
|
217
215
|
if (specifiers.length > 0) code.push(createVariableDeclaration(createObjectPattern(specifiers), createGetImport(pkg)));
|
|
218
216
|
path.replaceWithMultiple(code);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/plugin-playground",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.9",
|
|
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": {
|
|
@@ -29,34 +29,34 @@
|
|
|
29
29
|
"static"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@mdx-js/mdx": "
|
|
32
|
+
"@mdx-js/mdx": "^3.1.0",
|
|
33
33
|
"@monaco-editor/react": "~4.7.0",
|
|
34
34
|
"@oxidation-compiler/napi": "^0.2.0",
|
|
35
|
-
"remark-gfm": "
|
|
35
|
+
"remark-gfm": "^4.0.1",
|
|
36
36
|
"rspack-plugin-virtual-module": "0.1.13",
|
|
37
|
-
"@rspress/shared": "2.0.0-alpha.
|
|
37
|
+
"@rspress/shared": "2.0.0-alpha.9"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@babel/types": "^7.
|
|
40
|
+
"@babel/types": "^7.27.0",
|
|
41
41
|
"@rsbuild/plugin-react": "~1.1.1",
|
|
42
|
-
"@rslib/core": "0.
|
|
42
|
+
"@rslib/core": "0.6.1",
|
|
43
43
|
"@types/babel__core": "^7.20.5",
|
|
44
44
|
"@types/babel__standalone": "^7.1.9",
|
|
45
|
-
"@types/babel__traverse": "^7.20.
|
|
46
|
-
"@types/mdast": "^
|
|
45
|
+
"@types/babel__traverse": "^7.20.7",
|
|
46
|
+
"@types/mdast": "^4.0.4",
|
|
47
47
|
"@types/node": "^18.11.17",
|
|
48
|
-
"@types/react": "^18.3.
|
|
49
|
-
"@types/react-dom": "^18.3.
|
|
50
|
-
"mdast-util-mdx-jsx": "^2.
|
|
48
|
+
"@types/react": "^18.3.20",
|
|
49
|
+
"@types/react-dom": "^18.3.6",
|
|
50
|
+
"mdast-util-mdx-jsx": "^3.2.0",
|
|
51
51
|
"react": "^18.3.1",
|
|
52
52
|
"react-dom": "^18.3.1",
|
|
53
53
|
"react-router-dom": "^6.29.0",
|
|
54
54
|
"typescript": "^5.8.2",
|
|
55
|
-
"unified": "^
|
|
56
|
-
"unist-util-visit": "^
|
|
55
|
+
"unified": "^11.0.5",
|
|
56
|
+
"unist-util-visit": "^5.0.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@rspress/core": "^2.0.0-alpha.
|
|
59
|
+
"@rspress/core": "^2.0.0-alpha.9",
|
|
60
60
|
"react": ">=17.0.0",
|
|
61
61
|
"react-router-dom": "^6.8.1"
|
|
62
62
|
},
|
|
@@ -92,6 +92,13 @@ export default function Playground(props: PlaygroundProps) {
|
|
|
92
92
|
value={code}
|
|
93
93
|
onChange={handleCodeChange}
|
|
94
94
|
language={monacoLanguage}
|
|
95
|
+
beforeMount={monaco => {
|
|
96
|
+
monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
|
|
97
|
+
noSemanticValidation: true,
|
|
98
|
+
noSyntaxValidation: true,
|
|
99
|
+
noSuggestionDiagnostics: true,
|
|
100
|
+
});
|
|
101
|
+
}}
|
|
95
102
|
/>
|
|
96
103
|
{renderChildren?.(props, code, direction)}
|
|
97
104
|
</div>
|