mirror of
https://github.com/NebulaServices/Nebula.git
synced 2025-05-14 12:20:01 -04:00
configure UV & bare
This commit is contained in:
parent
4aae71dbdb
commit
118c3d8949
7 changed files with 859 additions and 115 deletions
12
index.html
12
index.html
|
@ -6,9 +6,17 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="color-scheme" content="light dark" />
|
||||
<title>Nebula</title>
|
||||
<script src="/ultra/ultra.config.js"></script>
|
||||
<script src="/ultra/ultra.bundle.js"></script>
|
||||
<script src="/sw.js"></script>
|
||||
<script src="/ultra/ultra.config.js"></script>
|
||||
<script>
|
||||
if ("serviceWorker" in navigator) {
|
||||
window.addEventListener("load", () => {
|
||||
navigator.serviceWorker.register("/sw.js", {
|
||||
scope: __uv$config.prefix
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
|
906
package-lock.json
generated
906
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -2,12 +2,13 @@
|
|||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"dev": "concurrently \"vite\" \"bare-server-node --port 8080\"",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"format": "prettier --write ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@titaniumnetwork-dev/ultraviolet": "^2.0.0",
|
||||
"@tomphttp/bare-server-node": "^2.0.1",
|
||||
"i18next": "^23.7.9",
|
||||
"i18next-browser-languagedetector": "^7.2.0",
|
||||
|
@ -22,6 +23,7 @@
|
|||
"devDependencies": {
|
||||
"@preact/preset-vite": "^2.5.0",
|
||||
"autoprefixer": "^10.4.16",
|
||||
"concurrently": "^8.2.2",
|
||||
"eslint": "^8.55.0",
|
||||
"eslint-config-preact": "^1.3.0",
|
||||
"postcss": "^8.4.32",
|
||||
|
@ -29,6 +31,7 @@
|
|||
"prettier-plugin-tailwindcss": "^0.5.9",
|
||||
"tailwindcss": "^3.3.6",
|
||||
"typescript": "^5.3.3",
|
||||
"vite": "^4.3.2"
|
||||
"vite": "^5.0.9",
|
||||
"vite-plugin-static-copy": "^1.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// @ts-nocheck
|
||||
importScripts("/ultra/ultra.bundle.js");
|
||||
importScripts("/ultra/ultra.config.js");
|
||||
importScripts(__uv$config.sw || "/ultra/ultra.sw.js");
|
||||
|
|
11
public/ultra/ultra.config.js
Normal file
11
public/ultra/ultra.config.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
self.__uv$config = {
|
||||
prefix: "/service/",
|
||||
bare: "/bare/",
|
||||
encodeUrl: Ultraviolet.codec.xor.encode,
|
||||
decodeUrl: Ultraviolet.codec.xor.decode,
|
||||
handler: "/ultra/ultra.handler.js",
|
||||
client: "/ultra/ultra.client.js",
|
||||
bundle: "/ultra/ultra.bundle.js",
|
||||
config: "/ultra/ultra.config.js",
|
||||
sw: "/ultra/ultra.sw.js"
|
||||
};
|
|
@ -4,10 +4,6 @@
|
|||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"noEmit": true,
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
|
||||
/* Preact Config */
|
||||
"jsx": "react-jsx",
|
||||
"jsxImportSource": "preact",
|
||||
"skipLibCheck": true,
|
||||
|
@ -15,6 +11,5 @@
|
|||
"react": ["./node_modules/preact/compat/"],
|
||||
"react-dom": ["./node_modules/preact/compat/"]
|
||||
}
|
||||
},
|
||||
"include": ["node_modules/vite/client.d.ts", "**/*"]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,34 @@
|
|||
import million from "million/compiler";
|
||||
import { defineConfig } from "vite";
|
||||
import preact from "@preact/preset-vite";
|
||||
import { viteStaticCopy } from "vite-plugin-static-copy";
|
||||
import { uvPath } from "@titaniumnetwork-dev/ultraviolet";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [million.vite({ auto: true }), preact()]
|
||||
plugins: [
|
||||
viteStaticCopy({
|
||||
targets: [
|
||||
{
|
||||
// .replace fixes weird paths on Windows
|
||||
src: `${uvPath}/uv.*.js`.replace(/\\/g, "/"),
|
||||
rename: (name) => {
|
||||
return `${name.replace(/^uv\./, "ultra.")}.js`;
|
||||
},
|
||||
dest: "ultra",
|
||||
overwrite: false
|
||||
}
|
||||
]
|
||||
}),
|
||||
million.vite({ auto: true }),
|
||||
preact()
|
||||
],
|
||||
server: {
|
||||
proxy: {
|
||||
"/bare": {
|
||||
target: "http://localhost:8080/",
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/bare/, "")
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue