chore: added support for preview
All checks were successful
Docs / build (push) Successful in 2m31s

This commit is contained in:
alina 🌸 2025-01-21 00:05:53 +03:00
parent 2a3d7f1b7e
commit efbb7c0b11
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI
5 changed files with 14 additions and 9 deletions

View file

@ -7,7 +7,8 @@
"scripts": {
"dev": "pnpm -r --parallel dev",
"build": "tsc -b && pnpm -r build",
"build:vendor": "cd vendor && bash build-patched-chobitsu.sh"
"build:vendor": "cd vendor && bash build-patched-chobitsu.sh",
"preview": "pnpm run -r --parallel preview"
},
"devDependencies": {
"@antfu/eslint-config": "^3.13.0",

View file

@ -48,6 +48,12 @@ const HTML = `
border-left: 0;
border-right: 0;
}
.tabbed-pane-left-toolbar,
.tabbed-pane-right-toolbar,
.tabbed-pane-tab-slider,
.tabbed-pane-header-tab:not(#tab-console, #tab-sources) {
display: none;
}
</style>
`
@ -89,10 +95,6 @@ async function focusConsole(tabbedPane) {
const tabbedPane = await waitForElement('.tabbed-pane', document.body);
await focusConsole(tabbedPane);
await waitForElement('.tabbed-pane-right-toolbar', tabbedPane.shadowRoot);
hideBySelectorAll(tabbedPane.shadowRoot, '.tabbed-pane-left-toolbar, .tabbed-pane-right-toolbar, .tabbed-pane-tab-slider');
hideBySelectorAll(tabbedPane.shadowRoot, '.tabbed-pane-header-tab:not(#tab-console, #tab-sources)');
tabbedPane.shadowRoot.appendChild(document.querySelector('#inject-css-tab-pane'));
const consoleToolbar = await waitForElement('.console-main-toolbar', document.body);

View file

@ -13,6 +13,9 @@ export default defineConfig((env): UserConfig => {
optimizeDeps: {
exclude: ['@mtcute/wasm'],
},
preview: {
port: 3000,
},
build: {
rollupOptions: {
external: ['node:fs/promises', 'node:crypto'],

View file

@ -9,10 +9,6 @@ if (!window.parent || window.parent === window) {
throw new Error('Not in iframe')
}
if (new URL(document.referrer).origin !== import.meta.env.VITE_HOST_ORIGIN) {
throw new Error(`Invalid origin: this page must be loaded in an iframe from ${import.meta.env.VITE_HOST_ORIGIN}`)
}
const worker = new ReplWorker()
registerWorker(worker)

View file

@ -12,6 +12,9 @@ export default defineConfig((env): UserConfig => {
server: {
port: 3001,
},
preview: {
port: 3001,
},
optimizeDeps: {
exclude: ['@mtcute/wasm'],
},