Prechádzať zdrojové kódy

Convert to SvelteKit setup

With an SPA
Alessandro Pignotti 9 mesiacov pred
rodič
commit
0d60f79c99
9 zmenil súbory, kde vykonal 144 pridanie a 348 odobranie
  1. 84 66
      package-lock.json
  2. 7 3
      package.json
  3. 22 0
      postcss.config.js
  4. 0 95
      rollup.config.js
  5. 0 154
      src/App.svelte
  6. 0 17
      src/global.css
  7. 0 7
      src/main.js
  8. 5 6
      svelte.config.js
  9. 26 0
      vite.config.js

+ 84 - 66
package-lock.json

@@ -16,7 +16,9 @@
 				"@rollup/plugin-node-resolve": "^15.0.0",
 				"@rollup/plugin-terser": "^0.4.0",
 				"@sveltejs/adapter-auto": "^3.0.0",
+				"@sveltejs/adapter-static": "^3.0.5",
 				"@sveltejs/kit": "^2.0.0",
+				"@sveltejs/vite-plugin-svelte": "^3.0.0",
 				"@xterm/addon-fit": "^0.10.0",
 				"@xterm/addon-web-links": "^0.11.0",
 				"@xterm/xterm": "^5.5.0",
@@ -29,7 +31,9 @@
 				"rollup-plugin-postcss": "^4.0.2",
 				"rollup-plugin-svelte": "^7.1.2",
 				"svelte": "^4.2.7",
-				"tailwindcss": "^3.4.9"
+				"tailwindcss": "^3.4.9",
+				"vite": "^5.0.3",
+				"vite-plugin-static-copy": "^1.0.6"
 			}
 		},
 		"node_modules/@alloc/quick-lru": {
@@ -69,7 +73,6 @@
 			"os": [
 				"aix"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -86,7 +89,6 @@
 			"os": [
 				"android"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -103,7 +105,6 @@
 			"os": [
 				"android"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -120,7 +121,6 @@
 			"os": [
 				"android"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -137,7 +137,6 @@
 			"os": [
 				"darwin"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -154,7 +153,6 @@
 			"os": [
 				"darwin"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -171,7 +169,6 @@
 			"os": [
 				"freebsd"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -188,7 +185,6 @@
 			"os": [
 				"freebsd"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -205,7 +201,6 @@
 			"os": [
 				"linux"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -222,7 +217,6 @@
 			"os": [
 				"linux"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -239,7 +233,6 @@
 			"os": [
 				"linux"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -256,7 +249,6 @@
 			"os": [
 				"linux"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -273,7 +265,6 @@
 			"os": [
 				"linux"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -290,7 +281,6 @@
 			"os": [
 				"linux"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -307,7 +297,6 @@
 			"os": [
 				"linux"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -324,7 +313,6 @@
 			"os": [
 				"linux"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -341,7 +329,6 @@
 			"os": [
 				"linux"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -358,7 +345,6 @@
 			"os": [
 				"netbsd"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -375,7 +361,6 @@
 			"os": [
 				"openbsd"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -392,7 +377,6 @@
 			"os": [
 				"sunos"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -409,7 +393,6 @@
 			"os": [
 				"win32"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -426,7 +409,6 @@
 			"os": [
 				"win32"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -443,7 +425,6 @@
 			"os": [
 				"win32"
 			],
-			"peer": true,
 			"engines": {
 				"node": ">=12"
 			}
@@ -790,8 +771,7 @@
 			"optional": true,
 			"os": [
 				"android"
-			],
-			"peer": true
+			]
 		},
 		"node_modules/@rollup/rollup-android-arm64": {
 			"version": "4.22.5",
@@ -804,8 +784,7 @@
 			"optional": true,
 			"os": [
 				"android"
-			],
-			"peer": true
+			]
 		},
 		"node_modules/@rollup/rollup-darwin-arm64": {
 			"version": "4.22.5",
@@ -818,8 +797,7 @@
 			"optional": true,
 			"os": [
 				"darwin"
-			],
-			"peer": true
+			]
 		},
 		"node_modules/@rollup/rollup-darwin-x64": {
 			"version": "4.22.5",
@@ -832,8 +810,7 @@
 			"optional": true,
 			"os": [
 				"darwin"
-			],
-			"peer": true
+			]
 		},
 		"node_modules/@rollup/rollup-linux-arm-gnueabihf": {
 			"version": "4.22.5",
@@ -846,8 +823,7 @@
 			"optional": true,
 			"os": [
 				"linux"
-			],
-			"peer": true
+			]
 		},
 		"node_modules/@rollup/rollup-linux-arm-musleabihf": {
 			"version": "4.22.5",
@@ -860,8 +836,7 @@
 			"optional": true,
 			"os": [
 				"linux"
-			],
-			"peer": true
+			]
 		},
 		"node_modules/@rollup/rollup-linux-arm64-gnu": {
 			"version": "4.22.5",
@@ -874,8 +849,7 @@
 			"optional": true,
 			"os": [
 				"linux"
-			],
-			"peer": true
+			]
 		},
 		"node_modules/@rollup/rollup-linux-arm64-musl": {
 			"version": "4.22.5",
@@ -888,8 +862,7 @@
 			"optional": true,
 			"os": [
 				"linux"
-			],
-			"peer": true
+			]
 		},
 		"node_modules/@rollup/rollup-linux-powerpc64le-gnu": {
 			"version": "4.22.5",
@@ -902,8 +875,7 @@
 			"optional": true,
 			"os": [
 				"linux"
-			],
-			"peer": true
+			]
 		},
 		"node_modules/@rollup/rollup-linux-riscv64-gnu": {
 			"version": "4.22.5",
@@ -916,8 +888,7 @@
 			"optional": true,
 			"os": [
 				"linux"
-			],
-			"peer": true
+			]
 		},
 		"node_modules/@rollup/rollup-linux-s390x-gnu": {
 			"version": "4.22.5",
@@ -930,8 +901,7 @@
 			"optional": true,
 			"os": [
 				"linux"
-			],
-			"peer": true
+			]
 		},
 		"node_modules/@rollup/rollup-linux-x64-gnu": {
 			"version": "4.22.5",
@@ -944,8 +914,7 @@
 			"optional": true,
 			"os": [
 				"linux"
-			],
-			"peer": true
+			]
 		},
 		"node_modules/@rollup/rollup-linux-x64-musl": {
 			"version": "4.22.5",
@@ -958,8 +927,7 @@
 			"optional": true,
 			"os": [
 				"linux"
-			],
-			"peer": true
+			]
 		},
 		"node_modules/@rollup/rollup-win32-arm64-msvc": {
 			"version": "4.22.5",
@@ -972,8 +940,7 @@
 			"optional": true,
 			"os": [
 				"win32"
-			],
-			"peer": true
+			]
 		},
 		"node_modules/@rollup/rollup-win32-ia32-msvc": {
 			"version": "4.22.5",
@@ -986,8 +953,7 @@
 			"optional": true,
 			"os": [
 				"win32"
-			],
-			"peer": true
+			]
 		},
 		"node_modules/@rollup/rollup-win32-x64-msvc": {
 			"version": "4.22.5",
@@ -1000,8 +966,7 @@
 			"optional": true,
 			"os": [
 				"win32"
-			],
-			"peer": true
+			]
 		},
 		"node_modules/@sveltejs/adapter-auto": {
 			"version": "3.2.5",
@@ -1015,6 +980,15 @@
 				"@sveltejs/kit": "^2.0.0"
 			}
 		},
+		"node_modules/@sveltejs/adapter-static": {
+			"version": "3.0.5",
+			"resolved": "https://registry.npmjs.org/@sveltejs/adapter-static/-/adapter-static-3.0.5.tgz",
+			"integrity": "sha512-kFJR7RxeB6FBvrKZWAEzIALatgy11ISaaZbcPup8JdWUdrmmfUHHTJ738YHJTEfnCiiXi6aX8Q6ePY7tnSMD6Q==",
+			"dev": true,
+			"peerDependencies": {
+				"@sveltejs/kit": "^2.0.0"
+			}
+		},
 		"node_modules/@sveltejs/kit": {
 			"version": "2.6.0",
 			"resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-2.6.0.tgz",
@@ -1052,7 +1026,6 @@
 			"resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-3.1.2.tgz",
 			"integrity": "sha512-Txsm1tJvtiYeLUVRNqxZGKR/mI+CzuIQuc2gn+YCs9rMTowpNZ2Nqt53JdL8KF9bLhAf2ruR/dr9eZCwdTriRA==",
 			"dev": true,
-			"peer": true,
 			"dependencies": {
 				"@sveltejs/vite-plugin-svelte-inspector": "^2.1.0",
 				"debug": "^4.3.4",
@@ -1075,7 +1048,6 @@
 			"resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte-inspector/-/vite-plugin-svelte-inspector-2.1.0.tgz",
 			"integrity": "sha512-9QX28IymvBlSCqsCll5t0kQVxipsfhFFL+L2t3nTWfXnddYwxBuAEtTtlaVQpRz9c37BhJjltSeY4AJSC03SSg==",
 			"dev": true,
-			"peer": true,
 			"dependencies": {
 				"debug": "^4.3.4"
 			},
@@ -1759,7 +1731,6 @@
 			"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
 			"integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
 			"dev": true,
-			"peer": true,
 			"dependencies": {
 				"ms": "^2.1.3"
 			},
@@ -1899,7 +1870,6 @@
 			"integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==",
 			"dev": true,
 			"hasInstallScript": true,
-			"peer": true,
 			"bin": {
 				"esbuild": "bin/esbuild"
 			},
@@ -2591,8 +2561,7 @@
 			"version": "2.1.3",
 			"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
 			"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
-			"dev": true,
-			"peer": true
+			"dev": true
 		},
 		"node_modules/mz": {
 			"version": "2.7.0",
@@ -4140,7 +4109,6 @@
 			"resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.16.0.tgz",
 			"integrity": "sha512-Gyc7cOS3VJzLlfj7wKS0ZnzDVdv3Pn2IuVeJPk9m2skfhcu5bq3wtIZyQGggr7/Iim5rH5cncyQft/kRLupcnA==",
 			"dev": true,
-			"peer": true,
 			"engines": {
 				"node": "^12.20 || ^14.13.1 || >= 16"
 			},
@@ -4425,7 +4393,6 @@
 			"resolved": "https://registry.npmjs.org/vite/-/vite-5.4.8.tgz",
 			"integrity": "sha512-FqrItQ4DT1NC4zCUqMB4c4AZORMKIa0m8/URVCZ77OZ/QSNeJ54bU1vrFADbDsuwfIPcgknRkmqakQcgnL4GiQ==",
 			"dev": true,
-			"peer": true,
 			"dependencies": {
 				"esbuild": "^0.21.3",
 				"postcss": "^8.4.43",
@@ -4480,12 +4447,64 @@
 				}
 			}
 		},
+		"node_modules/vite-plugin-static-copy": {
+			"version": "1.0.6",
+			"resolved": "https://registry.npmjs.org/vite-plugin-static-copy/-/vite-plugin-static-copy-1.0.6.tgz",
+			"integrity": "sha512-3uSvsMwDVFZRitqoWHj0t4137Kz7UynnJeq1EZlRW7e25h2068fyIZX4ORCCOAkfp1FklGxJNVJBkBOD+PZIew==",
+			"dev": true,
+			"dependencies": {
+				"chokidar": "^3.5.3",
+				"fast-glob": "^3.2.11",
+				"fs-extra": "^11.1.0",
+				"picocolors": "^1.0.0"
+			},
+			"engines": {
+				"node": "^18.0.0 || >=20.0.0"
+			},
+			"peerDependencies": {
+				"vite": "^5.0.0"
+			}
+		},
+		"node_modules/vite-plugin-static-copy/node_modules/fs-extra": {
+			"version": "11.2.0",
+			"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz",
+			"integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==",
+			"dev": true,
+			"dependencies": {
+				"graceful-fs": "^4.2.0",
+				"jsonfile": "^6.0.1",
+				"universalify": "^2.0.0"
+			},
+			"engines": {
+				"node": ">=14.14"
+			}
+		},
+		"node_modules/vite-plugin-static-copy/node_modules/jsonfile": {
+			"version": "6.1.0",
+			"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
+			"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
+			"dev": true,
+			"dependencies": {
+				"universalify": "^2.0.0"
+			},
+			"optionalDependencies": {
+				"graceful-fs": "^4.1.6"
+			}
+		},
+		"node_modules/vite-plugin-static-copy/node_modules/universalify": {
+			"version": "2.0.1",
+			"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
+			"integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==",
+			"dev": true,
+			"engines": {
+				"node": ">= 10.0.0"
+			}
+		},
 		"node_modules/vite/node_modules/rollup": {
 			"version": "4.22.5",
 			"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.22.5.tgz",
 			"integrity": "sha512-WoinX7GeQOFMGznEcWA1WrTQCd/tpEbMkc3nuMs9BT0CPjMdSjPMTVClwWd4pgSQwJdP65SK9mTCNvItlr5o7w==",
 			"dev": true,
-			"peer": true,
 			"dependencies": {
 				"@types/estree": "1.0.6"
 			},
@@ -4521,7 +4540,6 @@
 			"resolved": "https://registry.npmjs.org/vitefu/-/vitefu-0.2.5.tgz",
 			"integrity": "sha512-SgHtMLoqaeeGnd2evZ849ZbACbnwQCIwRH57t18FxcXoZop0uQu0uzlIhJBlF/eWVzuce0sHeqPcDo+evVcg8Q==",
 			"dev": true,
-			"peer": true,
 			"peerDependencies": {
 				"vite": "^3.0.0 || ^4.0.0 || ^5.0.0"
 			},

+ 7 - 3
package.json

@@ -3,8 +3,8 @@
 	"version": "0.0.1",
 	"private": true,
 	"scripts": {
-		"dev": "rollup -c -w",
-		"build": "rollup -c"
+		"dev": "vite dev",
+		"build": "vite build"
 	},
 	"devDependencies": {
 		"@fortawesome/fontawesome-free": "^6.6.0",
@@ -15,7 +15,9 @@
 		"@rollup/plugin-node-resolve": "^15.0.0",
 		"@rollup/plugin-terser": "^0.4.0",
 		"@sveltejs/adapter-auto": "^3.0.0",
+		"@sveltejs/adapter-static": "^3.0.5",
 		"@sveltejs/kit": "^2.0.0",
+		"@sveltejs/vite-plugin-svelte": "^3.0.0",
 		"@xterm/addon-fit": "^0.10.0",
 		"@xterm/addon-web-links": "^0.11.0",
 		"@xterm/xterm": "^5.5.0",
@@ -28,7 +30,9 @@
 		"rollup-plugin-postcss": "^4.0.2",
 		"rollup-plugin-svelte": "^7.1.2",
 		"svelte": "^4.2.7",
-		"tailwindcss": "^3.4.9"
+		"tailwindcss": "^3.4.9",
+		"vite": "^5.0.3",
+		"vite-plugin-static-copy": "^1.0.6"
 	},
 	"type": "module"
 }

+ 22 - 0
postcss.config.js

@@ -0,0 +1,22 @@
+export default {
+	plugins: {
+		tailwindcss: {},
+		autoprefixer: {},
+		'postcss-discard': {rule: function(node, value)
+		{
+			if(!value.startsWith('.fa-') || !value.endsWith(":before"))
+				return false;
+			switch(value)
+			{
+				case '.fa-info-circle:before':
+				case '.fa-wifi:before':
+				case '.fa-microchip:before':
+				case '.fa-compact-disc:before':
+				case '.fa-discord:before':
+				case '.fa-github:before':
+					return false;
+			}
+			return true;
+		}}
+	},
+}

+ 0 - 95
rollup.config.js

@@ -1,95 +0,0 @@
-import copy from 'rollup-plugin-copy';
-import svelte from 'rollup-plugin-svelte';
-import postcss from 'rollup-plugin-postcss';
-import alias from '@rollup/plugin-alias'
-import commonjs from '@rollup/plugin-commonjs';
-import terser from '@rollup/plugin-terser';
-import resolve from '@rollup/plugin-node-resolve';
-import css from 'rollup-plugin-css-only';
-import autoprefixer from 'autoprefixer';
-import discard from 'postcss-discard';
-import path from 'path';
-import url from 'url';
-import tailwindcss from 'tailwindcss';
-
-const production = !process.env.ROLLUP_WATCH;
-
-const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
-
-export default {
-	input: 'src/main.js',
-	output: {
-		sourcemap: !production,
-		format: 'esm',
-		name: 'app',
-		file: 'build/bundle.js'
-	},
-	plugins: [
-		alias({
-			entries: {
-				'diskConfig': path.resolve(__dirname, 'diskConfig.cloud.js')
-			}
-		}),
-		svelte({
-			compilerOptions: {
-				// enable run-time checks when not in production
-				dev: !production
-			}
-		}),
-		// we'll extract any component CSS out into
-		// a separate file - better for performance
-		postcss({
-			extract: true,
-			minimize: production,
-			plugins: [
-				tailwindcss,
-				autoprefixer,
-				discard({rule: function(node, value)
-				{
-					if(!value.startsWith('.fa-') || !value.endsWith(":before"))
-						return false;
-					switch(value)
-					{
-						case '.fa-info-circle:before':
-						case '.fa-wifi:before':
-						case '.fa-microchip:before':
-						case '.fa-compact-disc:before':
-						case '.fa-discord:before':
-						case '.fa-github:before':
-							return false;
-					}
-					return true;
-				}})
-			],
-		}),
-
-		// Copy required font files
-		copy({
-			targets: [
-				{
-					src: 'node_modules/@fortawesome/fontawesome-free/webfonts',
-					dest: '.'
-				}
-			]
-		}),
-
-		// If you have external dependencies installed from
-		// npm, you'll most likely need these plugins. In
-		// some cases you'll need additional configuration -
-		// consult the documentation for details:
-		// https://github.com/rollup/plugins/tree/master/packages/commonjs
-		resolve({
-			browser: true,
-			dedupe: ['svelte'],
-			exportConditions: ['svelte']
-		}),
-		commonjs(),
-
-		// If we're building for production (npm run build
-		// instead of npm run dev), minify
-		production && terser()
-	],
-	watch: {
-		clearScreen: false
-	}
-};

+ 0 - 154
src/App.svelte

@@ -1,154 +0,0 @@
-<script>
-	import { onMount } from 'svelte';
-	import { Terminal } from '@xterm/xterm';
-	import { FitAddon } from '@xterm/addon-fit';
-	import { WebLinksAddon } from '@xterm/addon-web-links';
-	import Nav from 'labs/packages/global-navbar/src/Nav.svelte';
-	import SideBar from './lib/SideBar.svelte';
-	import * as CheerpX from '@leaningtech/cheerpx';
-	import { diskImageUrl, diskImageType } from 'diskConfig'
-	import './global.css';
-	import '@xterm/xterm/css/xterm.css'
-	import '@fortawesome/fontawesome-free/css/all.min.css'
-
-	var term = new Terminal({cursorBlink:true, convertEol:true, fontFamily:"monospace", fontWeight: 400, fontWeightBold: 700});
-	var fitAddon = new FitAddon();
-	term.loadAddon(fitAddon);
-	var linkAddon = new WebLinksAddon();
-	term.loadAddon(linkAddon);
-	var cxReadFunc = null;
-	function writeData(buf)
-	{
-		term.write(new Uint8Array(buf));
-	}
-	function readData(str)
-	{
-		if(cxReadFunc == null)
-			return;
-		for(var i=0;i<str.length;i++)
-			cxReadFunc(str.charCodeAt(i));
-	}
-	term.onData(readData);
-	function initTerminal()
-	{
-		const consoleDiv = document.getElementById("console");
-		term.open(consoleDiv);
-		term.scrollToTop();
-		fitAddon.fit();
-		window.addEventListener("resize", function(ev){ fitAddon.fit(); });
-		term.focus();
-		// Avoid undesired default DnD handling
-		function preventDefaults (e) {
-			e.preventDefault()
-			e.stopPropagation()
-		}
-		consoleDiv.addEventListener("dragover", preventDefaults, false);
-		consoleDiv.addEventListener("dragenter", preventDefaults, false);
-		consoleDiv.addEventListener("dragleave", preventDefaults, false);
-		consoleDiv.addEventListener("drop", preventDefaults, false);
-		initCheerpX();
-	}
-	async function initCheerpX()
-	{
-		// TODO: Check for SAB support
-		// TODO: Initialize network
-		var blockDevice = null;
-		switch(diskImageType)
-		{
-			case "cloud":
-				try
-				{
-					blockDevice = await CheerpX.CloudDevice.create(diskImageUrl);
-				}
-				catch(e)
-				{
-					// Report the failure and try again with plain HTTP
-					var wssProtocol = "wss:";
-					if(diskImageUrl.startsWith(wssProtocol))
-					{
-						// WebSocket protocol failed, try agin using plain HTTP
-						plausible("WS Disk failure");
-						blockDevice = await CheerpX.CloudDevice.create("https:" + diskImageUrl.substr(wssProtocol.length));
-					}
-					else
-					{
-						// No other recovery option
-						throw e;
-					}
-				}
-				break;
-			case "bytes":
-				blockDevice = await CheerpX.HttpBytesDevice.create(diskImageUrl);
-				break;
-			case "github":
-				blockDevice = await CheerpX.GitHubDevice.create(diskImageUrl);
-				break;
-			default:
-				throw new Error("Unrecognized device type");
-		}
-		var overlayDevice = await CheerpX.OverlayDevice.create(blockDevice, await CheerpX.IDBDevice.create("block1"));
-		var webDevice = await CheerpX.WebDevice.create("");
-		var dataDevice = await CheerpX.DataDevice.create();
-		var mountPoints = [
-			// The root filesystem, as an Ext2 image
-			{type:"ext2", dev:overlayDevice, path:"/"},
-			// Access to files on the Web server, relative to the current page
-			{type:"dir", dev:webDevice, path:"/web"},
-			// Access to read-only data coming from JavaScript
-			{type:"dir", dev:dataDevice, path:"/data"},
-			// Automatically created device files
-			{type:"devs", path:"/dev"},
-			// The Linux 'proc' filesystem which provides information about running processes
-			{type:"proc", path:"/proc"}
-		];
-		var cx = null;
-		try
-		{
-			cx = await CheerpX.Linux.create({mounts: mountPoints});
-		}
-		catch(e)
-		{
-			// TODO: Print error message on console
-			throw e;
-		}
-		// TODO: Register activity callbacks
-		term.scrollToBottom();
-		cxReadFunc = cx.setCustomConsole(writeData, term.cols, term.rows);
-		// Reasonable defaults for local deployments
-		// var cmd = "/bin/bash";
-		// var args = ["--login"];
-		// var env = ["HOME=/home/user", "TERM=xterm", "USER=user", "SHELL=/bin/bash", "EDITOR=vim", "LANG=en_US.UTF-8", "LC_ALL=C"];
-		// var cwd = "/home/user";
-		// Executable full path (Required)
-		var cmd = "/bin/bash";
-		// Arguments, as an array (Required)
-		var args = ["--login"]
-		// Optional extra parameters
-		var opts = {
-			// Environment variables
-			env: ["HOME=/home/user", "TERM=xterm", "USER=user", "SHELL=/bin/bash", "EDITOR=vim", "LANG=en_US.UTF-8", "LC_ALL=C"],
-			// Current working directory
-			cwd: "/home/user",
-			// User id
-			uid: 1000,
-			// Group id
-			gid: 1000
-		};
-		// Run the command in a loop, in case the user exits
-		while (true)
-		{
-			await cx.run(cmd, args, opts);
-		}
-	}
-	onMount(initTerminal);
-</script>
-
-<main class="flex flex-col w-full h-full">
-	<Nav />
-	<div class="flex flex-row flex-grow">
-		<SideBar />
-		<div class="grow h-full p-1 scrollbar" id="console">
-		</div>
-	</div>
-</main>
-

+ 0 - 17
src/global.css

@@ -1,17 +0,0 @@
-@import url('https://fonts.googleapis.com/css2?family=Archivo:ital,wght@0,100..900;1,100..900&display=swap');
-
-@tailwind base;
-@tailwind utilities;
-
-body
-{
-	font-family: Archivo, sans-serif;
-	margin: 0;
-	height: 100%;
-	background: black;
-}
-
-html
-{
-	height: 100%;
-}

+ 0 - 7
src/main.js

@@ -1,7 +0,0 @@
-import App from './App.svelte';
-
-const app = new App({
-	target: document.body
-});
-
-export default app;

+ 5 - 6
svelte.config.js

@@ -1,13 +1,12 @@
-import adapter from '@sveltejs/adapter-auto';
+import adapter from '@sveltejs/adapter-static';
+import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
 
 /** @type {import('@sveltejs/kit').Config} */
 const config = {
 	kit: {
-		// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
-		// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
-		// See https://kit.svelte.dev/docs/adapters for more information about adapters.
-		adapter: adapter()
-	}
+		adapter: adapter({fallback: 'index.html'})
+	},
+	preprocess: vitePreprocess()
 };
 
 export default config;

+ 26 - 0
vite.config.js

@@ -0,0 +1,26 @@
+import { sveltekit } from '@sveltejs/kit/vite';
+import { defineConfig } from 'vite';
+import { viteStaticCopy } from 'vite-plugin-static-copy';
+
+export default defineConfig({
+	resolve: {
+		alias: {
+			'diskConfig': 'diskConfig.cloud.js'
+		}
+	},
+	build: {
+		target: "es2022"
+	},
+	plugins: [
+		sveltekit(),
+		viteStaticCopy({
+			targets: [
+				{ src: 'tower.ico', dest: '' },
+				{ src: 'scrollbar.css', dest: '' },
+				{ src: 'network.js', dest: '' },
+				{ src: 'serviceWorker.js', dest: '' },
+				{ src: 'assets/', dest: '' }
+			]
+		})
+	]
+});