Uses npm for website, hosts playground runner on https://isolated-playground.github.io for better isolation. (#5034)

This commit is contained in:
Henning Dieterichs 2025-10-09 19:05:34 +02:00 committed by GitHub
parent e2764eac56
commit a30f4f9920
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 6523 additions and 3629 deletions

6492
website/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -25,7 +25,7 @@
"mini-css-extract-plugin": "^2.6.1",
"mobx": "^5.15.4",
"mobx-react": "^6.2.2",
"monaco-editor": "^0.53.0",
"monaco-editor": "^0.55.0-dev-20251008",
"react": "^17.0.2",
"react-bootstrap": "^2.4.0",
"react-dom": "^17.0.2",

View file

@ -9,6 +9,30 @@ import {
} from "../../../shared";
import { Button } from "react-bootstrap";
const jsSrc = `
try {
const baseUrl = ${JSON.stringify(document.baseURI.toString())};
const base = document.createElement('base');
base.href = baseUrl;
document.head.appendChild(base);
const scriptRuntime = document.createElement('script');
scriptRuntime.src = './runtime.js';
document.head.appendChild(scriptRuntime);
const script = document.createElement('script');
script.src = './playgroundRunner.js';
document.head.appendChild(script);
const link = document.createElement('link');
link.href = './playgroundRunner.css';
link.rel = 'stylesheet';
document.head.appendChild(link);
} catch (e) {
console.error(e);
}
`;
@observer
export class Preview extends React.Component<{
model: PlaygroundModel;
@ -54,7 +78,9 @@ export class Preview extends React.Component<{
sandbox="allow-scripts allow-modals"
frameBorder={0}
ref={this.handleIframe}
src="./playgroundRunner.html"
src={`https://isolated-playground.github.io/?jsSrcBase64=${btoa(
jsSrc
)}`}
/>
</div>
);

View file

@ -90,11 +90,6 @@ module.exports = {
filename: "playground.html",
templateContent: getHtml(),
}),
new HtmlWebpackPlugin({
chunks: ["playgroundRunner"],
filename: "playgroundRunner.html",
templateContent: getHtml(),
}),
new HtmlWebpackPlugin({
chunks: ["index"],
filename: "docs.html",

File diff suppressed because it is too large Load diff