@rspress/plugin-playground 1.43.10 → 2.0.0-alpha-canary-202504162001
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 +74 -62
- package/dist/cli/esm/{301.mjs → 52.mjs} +5 -5
- package/dist/cli/esm/index.mjs +88 -78
- package/dist/web/cjs/index.js +26 -29
- package/dist/web/esm/index.mjs +9 -14
- package/package.json +17 -17
- 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__ = {};
|
|
@@ -133,12 +151,8 @@ function __webpack_require__(moduleId) {
|
|
|
133
151
|
}
|
|
134
152
|
__webpack_require__.m = __webpack_modules__;
|
|
135
153
|
(()=>{
|
|
136
|
-
__webpack_require__.n =
|
|
137
|
-
var getter = module && module.__esModule ?
|
|
138
|
-
return module['default'];
|
|
139
|
-
} : function() {
|
|
140
|
-
return module;
|
|
141
|
-
};
|
|
154
|
+
__webpack_require__.n = (module)=>{
|
|
155
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
142
156
|
__webpack_require__.d(getter, {
|
|
143
157
|
a: getter
|
|
144
158
|
});
|
|
@@ -146,7 +160,7 @@ __webpack_require__.m = __webpack_modules__;
|
|
|
146
160
|
};
|
|
147
161
|
})();
|
|
148
162
|
(()=>{
|
|
149
|
-
__webpack_require__.d =
|
|
163
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
150
164
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
151
165
|
enumerable: true,
|
|
152
166
|
get: definition[key]
|
|
@@ -155,25 +169,19 @@ __webpack_require__.m = __webpack_modules__;
|
|
|
155
169
|
})();
|
|
156
170
|
(()=>{
|
|
157
171
|
__webpack_require__.f = {};
|
|
158
|
-
__webpack_require__.e =
|
|
159
|
-
return Promise.all(Object.keys(__webpack_require__.f).reduce(function(promises, key) {
|
|
172
|
+
__webpack_require__.e = (chunkId)=>Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key)=>{
|
|
160
173
|
__webpack_require__.f[key](chunkId, promises);
|
|
161
174
|
return promises;
|
|
162
175
|
}, []));
|
|
163
|
-
};
|
|
164
176
|
})();
|
|
165
177
|
(()=>{
|
|
166
|
-
__webpack_require__.u =
|
|
167
|
-
return "" + chunkId + ".js";
|
|
168
|
-
};
|
|
178
|
+
__webpack_require__.u = (chunkId)=>"" + chunkId + ".js";
|
|
169
179
|
})();
|
|
170
180
|
(()=>{
|
|
171
|
-
__webpack_require__.o =
|
|
172
|
-
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
173
|
-
};
|
|
181
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
174
182
|
})();
|
|
175
183
|
(()=>{
|
|
176
|
-
__webpack_require__.r =
|
|
184
|
+
__webpack_require__.r = (exports1)=>{
|
|
177
185
|
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
178
186
|
value: 'Module'
|
|
179
187
|
});
|
|
@@ -186,13 +194,13 @@ __webpack_require__.m = __webpack_modules__;
|
|
|
186
194
|
var installedChunks = {
|
|
187
195
|
980: 1
|
|
188
196
|
};
|
|
189
|
-
var installChunk =
|
|
197
|
+
var installChunk = (chunk)=>{
|
|
190
198
|
var moreModules = chunk.modules, chunkIds = chunk.ids, runtime = chunk.runtime;
|
|
191
199
|
for(var moduleId in moreModules)if (__webpack_require__.o(moreModules, moduleId)) __webpack_require__.m[moduleId] = moreModules[moduleId];
|
|
192
200
|
if (runtime) runtime(__webpack_require__);
|
|
193
201
|
for(var i = 0; i < chunkIds.length; i++)installedChunks[chunkIds[i]] = 1;
|
|
194
202
|
};
|
|
195
|
-
__webpack_require__.f.require =
|
|
203
|
+
__webpack_require__.f.require = (chunkId, promises)=>{
|
|
196
204
|
if (!installedChunks[chunkId]) installChunk(require("./" + __webpack_require__.u(chunkId)));
|
|
197
205
|
};
|
|
198
206
|
})();
|
|
@@ -201,7 +209,7 @@ var __webpack_exports__ = {};
|
|
|
201
209
|
__webpack_require__.r(__webpack_exports__);
|
|
202
210
|
__webpack_require__.d(__webpack_exports__, {
|
|
203
211
|
pluginPlayground: ()=>pluginPlayground,
|
|
204
|
-
routeMeta: ()=>
|
|
212
|
+
routeMeta: ()=>cli_routeMeta
|
|
205
213
|
});
|
|
206
214
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
207
215
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
@@ -215,7 +223,7 @@ var __webpack_exports__ = {};
|
|
|
215
223
|
return u.replace(/\/\//g, '/');
|
|
216
224
|
}
|
|
217
225
|
const staticPath = external_node_path_default().join(__dirname, '../../../static');
|
|
218
|
-
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");
|
|
219
227
|
const napi_namespaceObject = require("@oxidation-compiler/napi");
|
|
220
228
|
var napi_default = /*#__PURE__*/ __webpack_require__.n(napi_namespaceObject);
|
|
221
229
|
const parseImports = (code, sourceExt)=>{
|
|
@@ -287,8 +295,8 @@ var __webpack_exports__ = {};
|
|
|
287
295
|
(0, lib.Vn)(tree, 'code', (node)=>{
|
|
288
296
|
if ('jsx' === node.lang || 'tsx' === node.lang) {
|
|
289
297
|
var _node_meta, _node_meta1;
|
|
290
|
-
const hasPureMeta = null
|
|
291
|
-
const hasPlaygroundMeta = null
|
|
298
|
+
const hasPureMeta = null == (_node_meta = node.meta) ? void 0 : _node_meta.includes('pure');
|
|
299
|
+
const hasPlaygroundMeta = null == (_node_meta1 = node.meta) ? void 0 : _node_meta1.includes('playground');
|
|
292
300
|
let noTransform;
|
|
293
301
|
switch(defaultRenderMode){
|
|
294
302
|
case 'pure':
|
|
@@ -324,15 +332,15 @@ var __webpack_exports__ = {};
|
|
|
324
332
|
});
|
|
325
333
|
};
|
|
326
334
|
};
|
|
327
|
-
let
|
|
335
|
+
let cli_routeMeta;
|
|
328
336
|
function pluginPlayground(options) {
|
|
329
337
|
var _monacoLoader_paths;
|
|
330
338
|
const { render = '', include, defaultDirection = 'horizontal', editorPosition = 'left', babelUrl = DEFAULT_BABEL_URL, monacoLoader = {}, monacoOptions = {}, defaultRenderMode = 'playground' } = options || {};
|
|
331
339
|
const playgroundVirtualModule = new external_rspack_plugin_virtual_module_namespaceObject.RspackVirtualModulePlugin({});
|
|
332
|
-
const getRouteMeta = ()=>
|
|
340
|
+
const getRouteMeta = ()=>cli_routeMeta;
|
|
333
341
|
if (render && !/Playground\.(jsx?|tsx?)$/.test(render)) throw new Error('[Playground]: render should ends with Playground.(jsx?|tsx?)');
|
|
334
342
|
const preloads = [];
|
|
335
|
-
const monacoPrefix = (null
|
|
343
|
+
const monacoPrefix = (null == (_monacoLoader_paths = monacoLoader.paths) ? void 0 : _monacoLoader_paths.vs) || DEFAULT_MONACO_URL;
|
|
336
344
|
preloads.push(normalizeUrl(`${monacoPrefix}/loader.js`));
|
|
337
345
|
preloads.push(normalizeUrl(`${monacoPrefix}/editor/editor.main.js`));
|
|
338
346
|
return {
|
|
@@ -344,14 +352,14 @@ var __webpack_exports__ = {};
|
|
|
344
352
|
return config;
|
|
345
353
|
},
|
|
346
354
|
async routeGenerated (routes) {
|
|
347
|
-
|
|
355
|
+
cli_routeMeta = routes;
|
|
348
356
|
const files = routes.map((route)=>route.absolutePath);
|
|
349
357
|
const imports = {};
|
|
350
358
|
await Promise.all(files.map(async (filepath, _index)=>{
|
|
351
359
|
const isMdxFile = /\.mdx?$/.test(filepath);
|
|
352
360
|
if (!isMdxFile) return;
|
|
353
361
|
const { createProcessor } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "@mdx-js/mdx"));
|
|
354
|
-
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"));
|
|
355
363
|
const { default: remarkGFM } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "remark-gfm"));
|
|
356
364
|
try {
|
|
357
365
|
const processor = createProcessor({
|
|
@@ -480,8 +488,12 @@ var __webpack_exports__ = {};
|
|
|
480
488
|
};
|
|
481
489
|
}
|
|
482
490
|
})();
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
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', {
|
|
486
498
|
value: true
|
|
487
499
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export const
|
|
2
|
-
'
|
|
1
|
+
export const __webpack_ids__ = [
|
|
2
|
+
'52'
|
|
3
3
|
];
|
|
4
|
-
export const
|
|
5
|
-
"../../node_modules/.pnpm/unist-util-visit@
|
|
4
|
+
export const __webpack_modules__ = {
|
|
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__ = {};
|
|
@@ -133,7 +151,7 @@ function __webpack_require__(moduleId) {
|
|
|
133
151
|
}
|
|
134
152
|
__webpack_require__.m = __webpack_modules__;
|
|
135
153
|
(()=>{
|
|
136
|
-
__webpack_require__.d =
|
|
154
|
+
__webpack_require__.d = (exports, definition)=>{
|
|
137
155
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
138
156
|
enumerable: true,
|
|
139
157
|
get: definition[key]
|
|
@@ -142,59 +160,51 @@ __webpack_require__.m = __webpack_modules__;
|
|
|
142
160
|
})();
|
|
143
161
|
(()=>{
|
|
144
162
|
__webpack_require__.f = {};
|
|
145
|
-
__webpack_require__.e =
|
|
146
|
-
return Promise.all(Object.keys(__webpack_require__.f).reduce(function(promises, key) {
|
|
163
|
+
__webpack_require__.e = (chunkId)=>Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key)=>{
|
|
147
164
|
__webpack_require__.f[key](chunkId, promises);
|
|
148
165
|
return promises;
|
|
149
166
|
}, []));
|
|
150
|
-
};
|
|
151
167
|
})();
|
|
152
168
|
(()=>{
|
|
153
|
-
__webpack_require__.u =
|
|
154
|
-
return "" + chunkId + ".mjs";
|
|
155
|
-
};
|
|
169
|
+
__webpack_require__.u = (chunkId)=>"" + chunkId + ".mjs";
|
|
156
170
|
})();
|
|
157
171
|
(()=>{
|
|
158
|
-
__webpack_require__.o =
|
|
159
|
-
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
160
|
-
};
|
|
172
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
161
173
|
})();
|
|
162
174
|
(()=>{
|
|
163
175
|
var installedChunks = {
|
|
164
176
|
980: 0
|
|
165
177
|
};
|
|
166
|
-
var installChunk =
|
|
167
|
-
var
|
|
168
|
-
var
|
|
169
|
-
var
|
|
178
|
+
var installChunk = (data)=>{
|
|
179
|
+
var __webpack_ids__ = data.__webpack_ids__;
|
|
180
|
+
var __webpack_modules__ = data.__webpack_modules__;
|
|
181
|
+
var __webpack_runtime__ = data.__webpack_runtime__;
|
|
170
182
|
var moduleId, chunkId, i = 0;
|
|
171
|
-
for(moduleId in
|
|
172
|
-
if (
|
|
173
|
-
for(; i <
|
|
174
|
-
chunkId =
|
|
183
|
+
for(moduleId in __webpack_modules__)if (__webpack_require__.o(__webpack_modules__, moduleId)) __webpack_require__.m[moduleId] = __webpack_modules__[moduleId];
|
|
184
|
+
if (__webpack_runtime__) __webpack_runtime__(__webpack_require__);
|
|
185
|
+
for(; i < __webpack_ids__.length; i++){
|
|
186
|
+
chunkId = __webpack_ids__[i];
|
|
175
187
|
if (__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) installedChunks[chunkId][0]();
|
|
176
|
-
installedChunks[
|
|
188
|
+
installedChunks[__webpack_ids__[i]] = 0;
|
|
177
189
|
}
|
|
178
190
|
};
|
|
179
191
|
__webpack_require__.f.j = function(chunkId, promises) {
|
|
180
192
|
var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : void 0;
|
|
181
|
-
if (0 !== installedChunkData)
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
promises.push(installedChunkData[1] = promise);
|
|
197
|
-
}
|
|
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);
|
|
198
208
|
}
|
|
199
209
|
};
|
|
200
210
|
})();
|
|
@@ -205,7 +215,7 @@ function normalizeUrl(u) {
|
|
|
205
215
|
}
|
|
206
216
|
var constant_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));
|
|
207
217
|
const staticPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(constant_dirname, '../../../static');
|
|
208
|
-
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");
|
|
209
219
|
const parseImports = (code, sourceExt)=>{
|
|
210
220
|
const parsed = __WEBPACK_EXTERNAL_MODULE__oxidation_compiler_napi_5e24345a__["default"].parseSync(code, {
|
|
211
221
|
sourceType: 'module',
|
|
@@ -275,8 +285,8 @@ const remarkPlugin = ({ getRouteMeta, editorPosition, defaultRenderMode })=>{
|
|
|
275
285
|
(0, lib.Vn)(tree, 'code', (node)=>{
|
|
276
286
|
if ('jsx' === node.lang || 'tsx' === node.lang) {
|
|
277
287
|
var _node_meta, _node_meta1;
|
|
278
|
-
const hasPureMeta = null
|
|
279
|
-
const hasPlaygroundMeta = null
|
|
288
|
+
const hasPureMeta = null == (_node_meta = node.meta) ? void 0 : _node_meta.includes('pure');
|
|
289
|
+
const hasPlaygroundMeta = null == (_node_meta1 = node.meta) ? void 0 : _node_meta1.includes('playground');
|
|
280
290
|
let noTransform;
|
|
281
291
|
switch(defaultRenderMode){
|
|
282
292
|
case 'pure':
|
|
@@ -312,16 +322,16 @@ const remarkPlugin = ({ getRouteMeta, editorPosition, defaultRenderMode })=>{
|
|
|
312
322
|
});
|
|
313
323
|
};
|
|
314
324
|
};
|
|
315
|
-
var
|
|
316
|
-
let
|
|
325
|
+
var cli_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));
|
|
326
|
+
let cli_routeMeta;
|
|
317
327
|
function pluginPlayground(options) {
|
|
318
328
|
var _monacoLoader_paths;
|
|
319
329
|
const { render = '', include, defaultDirection = 'horizontal', editorPosition = 'left', babelUrl = DEFAULT_BABEL_URL, monacoLoader = {}, monacoOptions = {}, defaultRenderMode = 'playground' } = options || {};
|
|
320
330
|
const playgroundVirtualModule = new __WEBPACK_EXTERNAL_MODULE_rspack_plugin_virtual_module_609978fd__.RspackVirtualModulePlugin({});
|
|
321
|
-
const getRouteMeta = ()=>
|
|
331
|
+
const getRouteMeta = ()=>cli_routeMeta;
|
|
322
332
|
if (render && !/Playground\.(jsx?|tsx?)$/.test(render)) throw new Error('[Playground]: render should ends with Playground.(jsx?|tsx?)');
|
|
323
333
|
const preloads = [];
|
|
324
|
-
const monacoPrefix = (null
|
|
334
|
+
const monacoPrefix = (null == (_monacoLoader_paths = monacoLoader.paths) ? void 0 : _monacoLoader_paths.vs) || DEFAULT_MONACO_URL;
|
|
325
335
|
preloads.push(normalizeUrl(`${monacoPrefix}/loader.js`));
|
|
326
336
|
preloads.push(normalizeUrl(`${monacoPrefix}/editor/editor.main.js`));
|
|
327
337
|
return {
|
|
@@ -333,14 +343,14 @@ function pluginPlayground(options) {
|
|
|
333
343
|
return config;
|
|
334
344
|
},
|
|
335
345
|
async routeGenerated (routes) {
|
|
336
|
-
|
|
346
|
+
cli_routeMeta = routes;
|
|
337
347
|
const files = routes.map((route)=>route.absolutePath);
|
|
338
348
|
const imports = {};
|
|
339
349
|
await Promise.all(files.map(async (filepath, _index)=>{
|
|
340
350
|
const isMdxFile = /\.mdx?$/.test(filepath);
|
|
341
351
|
if (!isMdxFile) return;
|
|
342
352
|
const { createProcessor } = await import("@mdx-js/mdx");
|
|
343
|
-
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"));
|
|
344
354
|
const { default: remarkGFM } = await import("remark-gfm");
|
|
345
355
|
try {
|
|
346
356
|
const processor = createProcessor({
|
|
@@ -428,7 +438,7 @@ function pluginPlayground(options) {
|
|
|
428
438
|
__PLAYGROUND_BABEL_URL__: JSON.stringify(babelUrl)
|
|
429
439
|
},
|
|
430
440
|
include: [
|
|
431
|
-
(0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(
|
|
441
|
+
(0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(cli_dirname, '..', '..', '..')
|
|
432
442
|
]
|
|
433
443
|
},
|
|
434
444
|
html: {
|
|
@@ -468,4 +478,4 @@ function pluginPlayground(options) {
|
|
|
468
478
|
globalStyles: __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(staticPath, 'global-styles', 'web.css')
|
|
469
479
|
};
|
|
470
480
|
}
|
|
471
|
-
export { pluginPlayground,
|
|
481
|
+
export { pluginPlayground, cli_routeMeta as routeMeta };
|
package/dist/web/cjs/index.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.n =
|
|
5
|
-
var getter = module && module.__esModule ?
|
|
6
|
-
return module['default'];
|
|
7
|
-
} : function() {
|
|
8
|
-
return module;
|
|
9
|
-
};
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
10
6
|
__webpack_require__.d(getter, {
|
|
11
7
|
a: getter
|
|
12
8
|
});
|
|
@@ -14,7 +10,7 @@ var __webpack_require__ = {};
|
|
|
14
10
|
};
|
|
15
11
|
})();
|
|
16
12
|
(()=>{
|
|
17
|
-
__webpack_require__.d =
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
18
14
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
19
15
|
enumerable: true,
|
|
20
16
|
get: definition[key]
|
|
@@ -22,12 +18,10 @@ var __webpack_require__ = {};
|
|
|
22
18
|
};
|
|
23
19
|
})();
|
|
24
20
|
(()=>{
|
|
25
|
-
__webpack_require__.o =
|
|
26
|
-
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
27
|
-
};
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
28
22
|
})();
|
|
29
23
|
(()=>{
|
|
30
|
-
__webpack_require__.r =
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
31
25
|
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
32
26
|
value: 'Module'
|
|
33
27
|
});
|
|
@@ -39,8 +33,8 @@ var __webpack_require__ = {};
|
|
|
39
33
|
var __webpack_exports__ = {};
|
|
40
34
|
__webpack_require__.r(__webpack_exports__);
|
|
41
35
|
__webpack_require__.d(__webpack_exports__, {
|
|
42
|
-
Editor: ()=>Editor,
|
|
43
36
|
MonacoEditor: ()=>react_default(),
|
|
37
|
+
Editor: ()=>Editor,
|
|
44
38
|
MonacoEditorLoader: ()=>react_namespaceObject.loader,
|
|
45
39
|
Runner: ()=>Runner
|
|
46
40
|
});
|
|
@@ -252,13 +246,11 @@ class Runner extends external_react_namespaceObject.Component {
|
|
|
252
246
|
if ('React' === specifier.local.name) this.hasReactImported = true;
|
|
253
247
|
if ('ImportDefaultSpecifier' === specifier.type) code.push(createVariableDeclaration(specifier.local.name, createGetImport(pkg, true)));
|
|
254
248
|
if ('ImportNamespaceSpecifier' === specifier.type) code.push(createVariableDeclaration(specifier.local.name, createGetImport(pkg)));
|
|
255
|
-
if ('ImportSpecifier' === specifier.type)
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
else specifiers.push(specifier.local.name);
|
|
261
|
-
}
|
|
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);
|
|
262
254
|
}
|
|
263
255
|
if (specifiers.length > 0) code.push(createVariableDeclaration(createObjectPattern(specifiers), createGetImport(pkg)));
|
|
264
256
|
path.replaceWithMultiple(code);
|
|
@@ -274,13 +266,10 @@ class Runner extends external_react_namespaceObject.Component {
|
|
|
274
266
|
const runExports = {};
|
|
275
267
|
const func = new Function('__get_import', 'exports', result.code);
|
|
276
268
|
func(getImport, runExports);
|
|
277
|
-
if (runExports.default) {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
});
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
269
|
+
if (runExports.default) return void this.setState({
|
|
270
|
+
error: void 0,
|
|
271
|
+
comp: /*#__PURE__*/ external_react_default().createElement(runExports.default)
|
|
272
|
+
});
|
|
284
273
|
this.setState({
|
|
285
274
|
error: new Error('No default export')
|
|
286
275
|
});
|
|
@@ -322,8 +311,16 @@ class Runner extends external_react_namespaceObject.Component {
|
|
|
322
311
|
this.waitCompile = this.waitCompile.bind(this);
|
|
323
312
|
}
|
|
324
313
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
314
|
+
exports.Editor = __webpack_exports__.Editor;
|
|
315
|
+
exports.MonacoEditor = __webpack_exports__.MonacoEditor;
|
|
316
|
+
exports.MonacoEditorLoader = __webpack_exports__.MonacoEditorLoader;
|
|
317
|
+
exports.Runner = __webpack_exports__.Runner;
|
|
318
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
319
|
+
"Editor",
|
|
320
|
+
"MonacoEditor",
|
|
321
|
+
"MonacoEditorLoader",
|
|
322
|
+
"Runner"
|
|
323
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
324
|
+
Object.defineProperty(exports, '__esModule', {
|
|
328
325
|
value: true
|
|
329
326
|
});
|
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);
|
|
@@ -228,13 +226,10 @@ class Runner extends __WEBPACK_EXTERNAL_MODULE_react__.Component {
|
|
|
228
226
|
const runExports = {};
|
|
229
227
|
const func = new Function('__get_import', 'exports', result.code);
|
|
230
228
|
func(getImport, runExports);
|
|
231
|
-
if (runExports.default) {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
});
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
229
|
+
if (runExports.default) return void this.setState({
|
|
230
|
+
error: void 0,
|
|
231
|
+
comp: /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement(runExports.default)
|
|
232
|
+
});
|
|
238
233
|
this.setState({
|
|
239
234
|
error: new Error('No default export')
|
|
240
235
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/plugin-playground",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha-canary-202504162001",
|
|
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": "
|
|
33
|
-
"@monaco-editor/react": "~4.
|
|
32
|
+
"@mdx-js/mdx": "^3.1.0",
|
|
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": "
|
|
37
|
+
"@rspress/shared": "2.0.0-alpha-canary-202504162001"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@babel/types": "^7.
|
|
41
|
-
"@rsbuild/plugin-react": "~1.1.
|
|
42
|
-
"@rslib/core": "0.
|
|
40
|
+
"@babel/types": "^7.27.0",
|
|
41
|
+
"@rsbuild/plugin-react": "~1.1.1",
|
|
42
|
+
"@rslib/core": "0.6.3",
|
|
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
|
-
"typescript": "^5.
|
|
55
|
-
"unified": "^
|
|
56
|
-
"unist-util-visit": "^
|
|
54
|
+
"typescript": "^5.8.2",
|
|
55
|
+
"unified": "^11.0.5",
|
|
56
|
+
"unist-util-visit": "^5.0.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@rspress/core": "^
|
|
59
|
+
"@rspress/core": "^2.0.0-alpha-canary-202504162001",
|
|
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>
|