Initial commit (via bun create)

This commit is contained in:
Samantha Becker 2023-07-13 15:44:10 +02:00
commit 55a1623393
10 changed files with 125 additions and 0 deletions

29
package.json Normal file
View file

@ -0,0 +1,29 @@
{
"name": "evilthings",
"version": "0.0.41",
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig tsconfig.json --watch"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^1.0.0",
"@sveltejs/kit": "^1.0.12",
"svelte": "^3.55.1",
"svelte-check": "^2.10.2",
"svelte-preprocess": "^5.0.0",
"tslib": "^2.4.1",
"typescript": "^4.9.4",
"vite": "^4.0.4"
},
"type": "module",
"dependencies": {
"@bun-community/sveltekit-adapter-bun": "^0.0.6",
"@rollup/plugin-commonjs": "^24.0.0",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"rollup": "^3.7.5"
}
}

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

@ -0,0 +1,9 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
// and what to do when importing types
declare namespace App {
// interface Locals {}
// interface PageData {}
// interface Error {}
// interface Platform {}
}

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.png" />
<meta name="viewport" content="width=device-width" />
%sveltekit.head%
</head>
<body>
<div>%sveltekit.body%</div>
</body>
</html>

View file

@ -0,0 +1 @@
<div style="background: #CCC"><slot /></div>

12
src/routes/+page.svelte Normal file
View file

@ -0,0 +1,12 @@
<script>
let counter = 0;
</script>
<style>
button {
background: green;
color:#FFF;
}
</style>
I'm counting ... {counter}
<button on:click={() => {counter++}}>Count up</button>

20
src/routes/+server.ts Normal file
View file

@ -0,0 +1,20 @@
import { error } from "@sveltejs/kit";
/** @type {import('./$types').RequestHandler} */
export function GET({ url }: { url: URL }) {
const min = Number(url.searchParams.get("min") ?? "0");
const max = Number(url.searchParams.get("max") ?? "11");
const d = max - min;
if (isNaN(d) || d < 0) {
throw error(
400,
"min and max must be numbers, and min must be less than max"
);
}
const random = min + Math.random() * d;
return new Response(String(random));
}

BIN
static/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

17
svelte.config.js Normal file
View file

@ -0,0 +1,17 @@
import adapter from "@bun-community/sveltekit-adapter-bun";
import preprocess from "svelte-preprocess";
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://github.com/sveltejs/svelte-preprocess
// for more information about preprocessors
preprocess: preprocess(),
kit: {
adapter: adapter({
dynamic_origin: true,
}),
},
};
export default config;

17
tsconfig.json Normal file
View file

@ -0,0 +1,17 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}

8
vite.config.ts Normal file
View file

@ -0,0 +1,8 @@
import { sveltekit } from "@sveltejs/kit/vite";
import type { UserConfig } from "vite";
const config: UserConfig = {
plugins: [sveltekit()],
};
export default config;