Compare commits

...

2 commits

Author SHA1 Message Date
Leon Grünewald
520508ef28 Add .gitignore 2024-12-29 16:23:28 +01:00
Leon Grünewald
d7e4d20888 Upgrade to SvelteKit and try inlining 2024-12-29 16:05:34 +01:00
11 changed files with 639 additions and 534 deletions

2
.gitignore vendored
View file

@ -11,6 +11,8 @@ node_modules
dist dist
dist-ssr dist-ssr
*.local *.local
build
.svelte-kit
# Editor directories and files # Editor directories and files
.vscode/* .vscode/*

View file

@ -1,13 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="./src/app.css" />
<title>Homo Streams</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="./src/main.js"></script>
</body>
</html>

View file

@ -1,33 +1,19 @@
{ {
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": { "compilerOptions": {
"moduleResolution": "bundler", "allowJs": true,
"target": "ESNext", "checkJs": true,
"module": "ESNext",
/**
* svelte-preprocess cannot figure out whether you have
* a value or a type, so tell TypeScript to enforce using
* `import type` instead of `import` for Types.
*/
"verbatimModuleSyntax": true,
"isolatedModules": true,
"resolveJsonModule": true,
/**
* To have warnings / errors of the Svelte compiler at the
* correct position, enable source maps by default.
*/
"sourceMap": true,
"esModuleInterop": true, "esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true, "skipLibCheck": true,
/** "sourceMap": true,
* Typecheck JS in `.svelte` and `.js` files by default. "strict": true,
* Disable this if you'd like to use dynamic types. "moduleResolution": "bundler"
*/ }
"checkJs": true // Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
}, // except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
/** //
* Use global.d.ts instead of compilerOptions.types // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
* to avoid limiting type declarations. // from the referenced tsconfig.json - TypeScript does not merge them in
*/
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
} }

View file

@ -12,9 +12,12 @@
}, },
"devDependencies": { "devDependencies": {
"@cloudflare/kv-asset-handler": "^0.3.4", "@cloudflare/kv-asset-handler": "^0.3.4",
"@sveltejs/vite-plugin-svelte": "4.0.0", "@sveltejs/adapter-auto": "^3.3.1",
"svelte": "5.0.2", "@sveltejs/adapter-static": "^3.0.8",
"vite": "^5.4.9", "@sveltejs/kit": "^2.15.1",
"wrangler": "^3.81.0" "@sveltejs/vite-plugin-svelte": "5.0.3",
"svelte": "5.16.0",
"vite": "^6.0.6",
"wrangler": "^3.99.0"
} }
} }

File diff suppressed because it is too large Load diff

13
src/app.d.ts vendored Normal file
View file

@ -0,0 +1,13 @@
// See https://svelte.dev/docs/kit/types#app.d.ts
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}
export {};

12
src/app.html Normal file
View file

@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>

View file

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

View file

@ -1,9 +1,9 @@
<script> <script>
import { onMount } from "svelte"; import { onMount } from "svelte";
import Header from "./lib/Header.svelte"; import Header from "$lib/Header.svelte";
import Stream from "./lib/Stream.svelte"; import Stream from "$lib/Stream.svelte";
import AddStreamDialog from "./lib/AddStreamDialog.svelte"; import AddStreamDialog from "$lib/AddStreamDialog.svelte";
import ManageStreamDialog from "./lib/ManageStreamDialog.svelte"; import ManageStreamDialog from "$lib/ManageStreamDialog.svelte";
let streams = $state([]); let streams = $state([]);
let fracsX = $state(0); let fracsX = $state(0);

View file

@ -1,7 +1,18 @@
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' import adapter from '@sveltejs/adapter-static';
export default { /** @type {import('@sveltejs/kit').Config} */
// Consult https://svelte.dev/docs#compile-time-svelte-preprocess const config = {
// for more information about preprocessors kit: {
preprocess: vitePreprocess(), // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
} // If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
adapter: adapter({
fallback: 'index.html' // may differ from host to host
}),
output: {
bundleStrategy: "inline"
}
}
};
export default config;

View file

@ -1,8 +1,6 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [sveltekit()]
svelte({})
]
}); });