@rspress/plugin-playground 2.0.0-alpha.7 → 2.0.0-alpha.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.
@@ -470,8 +470,12 @@ var __webpack_exports__ = {};
470
470
  };
471
471
  }
472
472
  })();
473
- var __webpack_export_target__ = exports;
474
- for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
475
- if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
473
+ exports.pluginPlayground = __webpack_exports__.pluginPlayground;
474
+ exports.routeMeta = __webpack_exports__.routeMeta;
475
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
476
+ "pluginPlayground",
477
+ "routeMeta"
478
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
479
+ Object.defineProperty(exports, '__esModule', {
476
480
  value: true
477
481
  });
@@ -172,23 +172,21 @@ __webpack_require__.m = __webpack_modules__;
172
172
  };
173
173
  __webpack_require__.f.j = function(chunkId, promises) {
174
174
  var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : void 0;
175
- if (0 !== installedChunkData) {
176
- if (installedChunkData) promises.push(installedChunkData[1]);
177
- else {
178
- var promise = import("./" + __webpack_require__.u(chunkId)).then(installChunk, (e)=>{
179
- if (0 !== installedChunks[chunkId]) installedChunks[chunkId] = void 0;
180
- throw e;
181
- });
182
- var promise = Promise.race([
183
- promise,
184
- new Promise((resolve)=>{
185
- installedChunkData = installedChunks[chunkId] = [
186
- resolve
187
- ];
188
- })
189
- ]);
190
- promises.push(installedChunkData[1] = promise);
191
- }
175
+ if (0 !== installedChunkData) if (installedChunkData) promises.push(installedChunkData[1]);
176
+ else {
177
+ var promise = import("./" + __webpack_require__.u(chunkId)).then(installChunk, (e)=>{
178
+ if (0 !== installedChunks[chunkId]) installedChunks[chunkId] = void 0;
179
+ throw e;
180
+ });
181
+ var promise = Promise.race([
182
+ promise,
183
+ new Promise((resolve)=>{
184
+ installedChunkData = installedChunks[chunkId] = [
185
+ resolve
186
+ ];
187
+ })
188
+ ]);
189
+ promises.push(installedChunkData[1] = promise);
192
190
  }
193
191
  };
194
192
  })();
@@ -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
- if ('name' in specifier.imported && specifier.imported.name !== specifier.local.name) specifiers.push([
251
- specifier.imported.name,
252
- specifier.local.name
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
- var __webpack_export_target__ = exports;
320
- for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
321
- if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
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
  });
@@ -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
- if ('name' in specifier.imported && specifier.imported.name !== specifier.local.name) specifiers.push([
211
- specifier.imported.name,
212
- specifier.local.name
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.7",
3
+ "version": "2.0.0-alpha.8",
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": {
@@ -34,18 +34,18 @@
34
34
  "@oxidation-compiler/napi": "^0.2.0",
35
35
  "remark-gfm": "3.0.1",
36
36
  "rspack-plugin-virtual-module": "0.1.13",
37
- "@rspress/shared": "2.0.0-alpha.7"
37
+ "@rspress/shared": "2.0.0-alpha.8"
38
38
  },
39
39
  "devDependencies": {
40
- "@babel/types": "^7.26.10",
40
+ "@babel/types": "^7.27.0",
41
41
  "@rsbuild/plugin-react": "~1.1.1",
42
- "@rslib/core": "0.5.5",
42
+ "@rslib/core": "0.6.0",
43
43
  "@types/babel__core": "^7.20.5",
44
44
  "@types/babel__standalone": "^7.1.9",
45
- "@types/babel__traverse": "^7.20.6",
45
+ "@types/babel__traverse": "^7.20.7",
46
46
  "@types/mdast": "^3.0.15",
47
47
  "@types/node": "^18.11.17",
48
- "@types/react": "^18.3.19",
48
+ "@types/react": "^18.3.20",
49
49
  "@types/react-dom": "^18.3.5",
50
50
  "mdast-util-mdx-jsx": "^2.1.4",
51
51
  "react": "^18.3.1",
@@ -56,7 +56,7 @@
56
56
  "unist-util-visit": "^4.1.2"
57
57
  },
58
58
  "peerDependencies": {
59
- "@rspress/core": "^2.0.0-alpha.7",
59
+ "@rspress/core": "^2.0.0-alpha.8",
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>