mirror of
https://github.com/MercuryWorkshop/adrift.git
synced 2025-05-13 06:10:01 -04:00
fix single-file bundle
This commit is contained in:
parent
932858d6e7
commit
a5840d54dc
5 changed files with 181 additions and 23 deletions
|
@ -13,18 +13,19 @@
|
|||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@rollup/browser": "^3.28.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^2.4.5",
|
||||
"bare-client-custom": "file:../bare-client-custom",
|
||||
"client": "workspace:*",
|
||||
"corium": "file:../corium",
|
||||
"firebase": "^10.1.0",
|
||||
"firebase-config": "workspace:*",
|
||||
"protocol": "workspace:*",
|
||||
"svelte": "^4.2.0",
|
||||
"svelte-preprocess": "^5.0.4",
|
||||
"typescript": "^5.1.6",
|
||||
"vite": "^4.4.9",
|
||||
"vite-plugin-singlefile": "^0.13.5",
|
||||
"vite-plugin-svelte": "^3.0.1",
|
||||
"bare-client-custom": "file:../bare-client-custom",
|
||||
"firebase-config": "workspace:*",
|
||||
"client": "workspace:*",
|
||||
"protocol": "workspace:*"
|
||||
},
|
||||
"devDependencies": {}
|
||||
}
|
||||
"vite-plugin-singlefile": "git://github.com/CoolElectronics/vite-plugin-singlefile.git",
|
||||
"vite-plugin-svelte": "^3.0.1"
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
<script lang="ts">
|
||||
import {
|
||||
BareClient,
|
||||
registerRemoteListener,
|
||||
setBareClientImplementation,
|
||||
} from "bare-client-custom";
|
||||
|
@ -15,6 +16,8 @@
|
|||
import { getDatabase, onValue, ref, set } from "firebase/database";
|
||||
import type { Transport } from "protocol";
|
||||
|
||||
import { openWindow } from "../../corium";
|
||||
|
||||
let transport: Transport;
|
||||
|
||||
let wstransport: DevWsTransport | undefined;
|
||||
|
@ -23,6 +26,11 @@
|
|||
let email = "test@test.com";
|
||||
let password = "123456";
|
||||
|
||||
let ready = false;
|
||||
|
||||
let url: string;
|
||||
let proxyIframe: HTMLIFrameElement;
|
||||
|
||||
if (import.meta.env.VITE_ADRIFT_DEV) {
|
||||
console.log(
|
||||
"%cADRIFT RUNNING IN DEVELOPMENT MODE",
|
||||
|
@ -46,6 +54,7 @@
|
|||
let connection = new Connection(transport);
|
||||
let bare = new AdriftBareClient(connection);
|
||||
setBareClientImplementation(bare);
|
||||
ready = true;
|
||||
}
|
||||
|
||||
function onTransportClose() {
|
||||
|
@ -114,6 +123,15 @@
|
|||
console.log("onclose")
|
||||
);
|
||||
}
|
||||
|
||||
function visitURL() {
|
||||
if (!import.meta.env.VITE_ADRIFT_SINGLEFILE) {
|
||||
alert("TODO");
|
||||
} else {
|
||||
let bare = new BareClient();
|
||||
openWindow(new Request(url), "_self", bare, "replace");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if !import.meta.env.VITE_ADRIFT_DEV}
|
||||
|
@ -131,6 +149,12 @@
|
|||
<button on:click={connectDevWS}>Connect with dev websocket</button>
|
||||
{/if}
|
||||
|
||||
{#if ready}
|
||||
<input bind:value={url} type="text" />
|
||||
<button on:click={visitURL}>Go!</button>
|
||||
<iframe bind:this={proxyIframe} />
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.container {
|
||||
display: flex;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue