Dough Git

commit

Full deno migration

commit
a5d48448b5d441bdb2a0839b9964d2e88bfe66ff
author
Clove Twilight <[email protected]>
date
2026-11-15 18:38

diff --git a/.gitignore b/.gitignore
index d853db0..456c4b0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,4 +22,6 @@ Thumbs.db
 vite.config.js.timestamp-*
 vite.config.ts.timestamp-*
 
-api/
\ No newline at end of file
+api/
+# Deno adapter output
+/.deno-deploy
diff --git a/.prettierignore b/.prettierignore
index cf704e3..17fad67 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -10,3 +10,6 @@ bun.lockb
 
 # Keeps single-quoted strings with escaped apostrophes
 src/routes/languages/+page.svelte
+
+# Build output
+/.deno-deploy
diff --git a/deno.json b/deno.json
index 3c3e50e..6e57156 100644
--- a/deno.json
+++ b/deno.json
@@ -1,7 +1,44 @@
 {
-  "overrides": {
-    "@icons-pack/svelte-simple-icons": {
-      "@sveltejs/kit": "3.1.0"
-    }
-  }
+	"nodeModulesDir": "auto",
+
+	"tasks": {
+		"dev": "vite dev",
+		"build": "vite build",
+		"preview": "deno run --allow-net --allow-env --allow-read=. deploy/server.ts",
+		"prepare": "svelte-kit sync || echo ''",
+		"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
+		"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
+		"lint": "prettier --check . && eslint .",
+		"format": "prettier --write ."
+	},
+
+	"imports": {
+		"@deno/svelte-adapter": "npm:@deno/svelte-adapter@^0.2.2",
+		"@eslint/js": "npm:@eslint/js@^10.0.1",
+		"@giscus/svelte": "npm:@giscus/svelte@^3.1.0",
+		"@iconify-json/ic": "npm:@iconify-json/ic@^1.2.4",
+		"@iconify-json/simple-icons": "npm:@iconify-json/simple-icons@^1.2.101",
+		"@sveltejs/kit": "npm:@sveltejs/kit@^3.1.1",
+		"@sveltejs/vite-plugin-svelte": "npm:@sveltejs/vite-plugin-svelte@^7.3.1",
+		"@types/node": "npm:@types/node@^24.19.2",
+		"eslint": "npm:eslint@^10.14.0",
+		"eslint-config-prettier": "npm:eslint-config-prettier@^10.1.8",
+		"eslint-plugin-svelte": "npm:eslint-plugin-svelte@^3.24.0",
+		"globals": "npm:globals@^17.14.0",
+		"prettier": "npm:prettier@^3.9.10",
+		"prettier-plugin-svelte": "npm:prettier-plugin-svelte@^4.1.1",
+		"svelte": "npm:svelte@^5.57.3",
+		"svelte-check": "npm:svelte-check@^4.7.8",
+		"typescript": "npm:typescript@^6.0.3",
+		"typescript-eslint": "npm:typescript-eslint@^8.72.1",
+		"unplugin-icons": "npm:unplugin-icons@^24.0.0",
+		"vite": "npm:vite@^8.3.6",
+		"yaml": "npm:yaml@^2.9.1"
+	},
+
+	"overrides": {
+		"@icons-pack/svelte-simple-icons": {
+			"@sveltejs/kit": "3.1.0"
+		}
+	}
 }
diff --git a/deno.lock b/deno.lock
index bad22b6..d85eee4 100644
--- a/deno.lock
+++ b/deno.lock
@@ -2,19 +2,21 @@
   "version": "5",
   "specifiers": {
     "jsr:@deno/installer-shell-setup@*": "0.3.4",
+    "npm:@deno/svelte-adapter@~0.2.2": "0.2.2_@[email protected]",
     "npm:@eslint/js@^10.0.1": "[email protected]",
     "npm:@giscus/svelte@^3.1.0": "[email protected]",
     "npm:@iconify-json/ic@^1.2.4": "1.2.4",
     "npm:@iconify-json/simple-icons@^1.2.101": "1.2.101",
-    "npm:@sveltejs/adapter-node@^6.0.1": "6.0.1_@[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected][email protected]",
     "npm:@sveltejs/kit@^3.1.1": "3.1.1_@[email protected][email protected][email protected][email protected]_@[email protected][email protected]",
     "npm:@sveltejs/vite-plugin-svelte@^7.3.1": "[email protected][email protected]_@[email protected][email protected]",
     "npm:@types/node@^24.19.2": "24.19.2",
     "npm:eslint-config-prettier@^10.1.8": "[email protected]",
     "npm:eslint-plugin-svelte@^3.24.0": "[email protected][email protected]",
+    "npm:eslint@*": "10.14.0",
     "npm:eslint@^10.14.0": "10.14.0",
     "npm:globals@^17.14.0": "17.14.0",
     "npm:prettier-plugin-svelte@^4.1.1": "[email protected][email protected]",
+    "npm:prettier@*": "3.9.10",
     "npm:prettier@^3.9.10": "3.9.10",
     "npm:svelte-check@^4.7.8": "[email protected][email protected]",
     "npm:svelte@^5.57.3": "5.57.3",
@@ -60,6 +62,19 @@
         "keyv"
       ]
     },
+    "@deno/[email protected]": {
+      "integrity": "sha512-0PN4qij3sC3Qm8WbiOBGlOQz8WtB0AENGkzsTHOYyPenf40iW7OGFid8QT3L8lGApnz3t6ufET0c2XgagV8Jjw==",
+      "dependencies": [
+        "urlpattern-polyfill"
+      ]
+    },
+    "@deno/[email protected]_@[email protected]": {
+      "integrity": "sha512-gskRCtFrgQSFvsMNqIHOsYNu1dRTs/jnMte9RYA+mVfu2Yh+yPv+mFh8F4BZBCRs/jyB35VN3CDxUQGenJeGsg==",
+      "dependencies": [
+        "@deno/experimental-route-config",
+        "@sveltejs/kit"
+      ]
+    },
     "@eslint-community/[email protected][email protected]": {
       "integrity": "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==",
       "dependencies": [
@@ -302,12 +317,6 @@
         "acorn"
       ]
     },
-    "@sveltejs/[email protected]_@[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected][email protected]": {
-      "integrity": "sha512-Pt/YcMakEkTjdQXaAvxrjrDnoGX4zU7pAZICnoLfpI+CawLGigq5upjFW9rVK2QY7yfpR1xeRG/kgI+syzPB3w==",
-      "dependencies": [
-        "@sveltejs/kit"
-      ]
-    },
     "@sveltejs/[email protected]_@[email protected][email protected][email protected][email protected]_@[email protected][email protected]": {
       "integrity": "sha512-BiEMvekYXE9Gu/YhWJ/yJ0WDLH1PX/dmjuAeFp5rrtdmgdzkjt7DvimlSP+/U4tgposl7pkE20luHpcnc6BgRw==",
       "dependencies": [
@@ -1287,6 +1296,9 @@
         "punycode"
       ]
     },
+    "[email protected]": {
+      "integrity": "sha512-IGjKp/o0NL3Bso1PymYURCJxMPNAf/ILOpendP9f5B6e1rTJgdgiOvgfoT8VxCAdY+Wisb9uhGaJJf3yZ2V9nw=="
+    },
     "[email protected]": {
       "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
     },
@@ -1347,30 +1359,28 @@
     }
   },
   "workspace": {
-    "packageJson": {
-      "dependencies": [
-        "npm:@eslint/js@^10.0.1",
-        "npm:@giscus/svelte@^3.1.0",
-        "npm:@iconify-json/ic@^1.2.4",
-        "npm:@iconify-json/simple-icons@^1.2.101",
-        "npm:@sveltejs/adapter-node@^6.0.1",
-        "npm:@sveltejs/kit@^3.1.1",
-        "npm:@sveltejs/vite-plugin-svelte@^7.3.1",
-        "npm:@types/node@^24.19.2",
-        "npm:eslint-config-prettier@^10.1.8",
-        "npm:eslint-plugin-svelte@^3.24.0",
-        "npm:eslint@^10.14.0",
-        "npm:globals@^17.14.0",
-        "npm:prettier-plugin-svelte@^4.1.1",
-        "npm:prettier@^3.9.10",
-        "npm:svelte-check@^4.7.8",
-        "npm:svelte@^5.57.3",
-        "npm:typescript-eslint@^8.72.1",
-        "npm:typescript@^6.0.3",
-        "npm:unplugin-icons@24",
-        "npm:vite@^8.3.6",
-        "npm:yaml@^2.9.1"
-      ]
-    }
+    "dependencies": [
+      "npm:@deno/svelte-adapter@~0.2.2",
+      "npm:@eslint/js@^10.0.1",
+      "npm:@giscus/svelte@^3.1.0",
+      "npm:@iconify-json/ic@^1.2.4",
+      "npm:@iconify-json/simple-icons@^1.2.101",
+      "npm:@sveltejs/kit@^3.1.1",
+      "npm:@sveltejs/vite-plugin-svelte@^7.3.1",
+      "npm:@types/node@^24.19.2",
+      "npm:eslint-config-prettier@^10.1.8",
+      "npm:eslint-plugin-svelte@^3.24.0",
+      "npm:eslint@^10.14.0",
+      "npm:globals@^17.14.0",
+      "npm:prettier-plugin-svelte@^4.1.1",
+      "npm:prettier@^3.9.10",
+      "npm:svelte-check@^4.7.8",
+      "npm:svelte@^5.57.3",
+      "npm:typescript-eslint@^8.72.1",
+      "npm:typescript@^6.0.3",
+      "npm:unplugin-icons@24",
+      "npm:vite@^8.3.6",
+      "npm:yaml@^2.9.1"
+    ]
   }
 }
diff --git a/deploy/run b/deploy/run
index 43c6c62..fb38329 100755
--- a/deploy/run
+++ b/deploy/run
@@ -21,4 +21,4 @@ exec chpst -u clove /usr/bin/deno run \
 	--allow-env \
 	--allow-read=. \
 	--env-file=.env \
-	build/index.js
+	deploy/server.ts
diff --git a/deploy/server.ts b/deploy/server.ts
new file mode 100644
index 0000000..deffaaa
--- /dev/null
+++ b/deploy/server.ts
@@ -0,0 +1,21 @@
+/* deploy/server.ts
+ * DASL-1.2 — (c) Clove Twilight
+ */
+
+import rawDeployConfig from '../.deno-deploy/deploy.json' with { type: 'json' };
+import rawSvelteData from '../.deno-deploy/svelte.json' with { type: 'json' };
+import { prepareServer } from '../.deno-deploy/handler.ts';
+
+// The adapter's own server.ts binds 0.0.0.0:8000, so this one honours HOST and PORT
+const hostname = Deno.env.get('HOST') ?? '127.0.0.1';
+const port = Number(Deno.env.get('PORT') ?? '3000');
+
+const handler = prepareServer(rawSvelteData, rawDeployConfig, Deno.cwd());
+
+Deno.serve(
+	{
+		hostname,
+		port
+	},
+	handler
+);
diff --git a/package.json b/package.json
deleted file mode 100644
index acb35a5..0000000
--- a/package.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
-	"name": "testing-site",
-	"private": true,
-	"version": "0.0.1",
-	"type": "module",
-	"scripts": {
-		"dev": "vite dev",
-		"build": "vite build",
-		"preview": "node build",
-		"prepare": "svelte-kit sync || echo ''",
-		"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
-		"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
-		"lint": "prettier --check . && eslint .",
-		"format": "prettier --write ."
-	},
-	"devDependencies": {
-		"@eslint/js": "^10.0.1",
-		"@iconify-json/ic": "^1.2.4",
-		"@iconify-json/simple-icons": "^1.2.101",
-		"@sveltejs/adapter-node": "^6.0.1",
-		"@sveltejs/kit": "^3.1.1",
-		"@sveltejs/vite-plugin-svelte": "^7.3.1",
-		"@types/node": "^24.19.2",
-		"eslint": "^10.14.0",
-		"eslint-config-prettier": "^10.1.8",
-		"eslint-plugin-svelte": "^3.24.0",
-		"globals": "^17.14.0",
-		"prettier": "^3.9.10",
-		"prettier-plugin-svelte": "^4.1.1",
-		"svelte": "^5.57.3",
-		"svelte-check": "^4.7.8",
-		"typescript": "^6.0.3",
-		"typescript-eslint": "^8.72.1",
-		"unplugin-icons": "^24.0.0",
-		"vite": "^8.3.6"
-	},
-	"imports": {
-		"#lib": "./src/lib/index.js",
-		"#lib/*": "./src/lib/*"
-	},
-	"dependencies": {
-		"@giscus/svelte": "^3.1.0",
-		"yaml": "^2.9.1"
-	}
-}
diff --git a/tsconfig.json b/tsconfig.json
index cfbafa5..94f2570 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -3,7 +3,13 @@
 	"compilerOptions": {
 		// worker-configuration.d.ts imports the built Worker, so without this
 		// svelte-check type-checks the whole compiled bundle after a build
-		"checkJs": false
+		"checkJs": false,
+
+		// Mirrors the `#lib` alias in vite.config.ts, since there is no package.json imports field
+		"paths": {
+			"#lib": ["./src/lib/index.ts"],
+			"#lib/*": ["./src/lib/*"]
+		}
 	},
 	"include": ["src", "test", "*"],
 	"exclude": ["src/service-worker"]
diff --git a/vite.config.ts b/vite.config.ts
index 1c73839..0ddc2a8 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -2,12 +2,52 @@
  * DASL-1.2 — (c) Clove Twilight
  */
 
-import adapter from '@sveltejs/adapter-node';
+import denoAdapter from '@deno/svelte-adapter';
+import type { Adapter } from '@sveltejs/kit';
 import { sveltekit } from '@sveltejs/kit/vite';
+import { readFile, writeFile } from 'node:fs/promises';
+import { fileURLToPath } from 'node:url';
 import { defineConfig } from 'vite';
 import Icons from 'unplugin-icons/vite';
 
+// The Deno adapter writes prerendered endpoints (sitemap.xml, search.json) but never routes them
+function adapter(): Adapter {
+	const base = denoAdapter();
+
+	return {
+		...base,
+		async adapt(builder) {
+			await base.adapt(builder);
+
+			const deployFile = '.deno-deploy/deploy.json';
+			const deployConfig = JSON.parse(await readFile(deployFile, 'utf8'));
+
+			for (const pathname of builder.prerendered.assets.keys()) {
+				deployConfig.staticFiles.push({
+					source: pathname,
+					destination: `.deno-deploy/static${pathname}`
+				});
+			}
+
+			await writeFile(deployFile, JSON.stringify(deployConfig, null, 2));
+		}
+	};
+}
+
 export default defineConfig({
+	resolve: {
+		// Kit 3 only reads `#lib` from package.json imports, which this project no longer has
+		alias: [
+			{
+				find: /^#lib$/,
+				replacement: fileURLToPath(new URL('./src/lib/index.ts', import.meta.url))
+			},
+			{
+				find: /^#lib\//,
+				replacement: fileURLToPath(new URL('./src/lib/', import.meta.url))
+			}
+		]
+	},
 	plugins: [
 		sveltekit({
 			compilerOptions: {