aboutsummaryrefslogtreecommitdiff
path: root/source/server
diff options
context:
space:
mode:
Diffstat (limited to 'source/server')
-rw-r--r--source/server/index.ts14
-rw-r--r--source/server/room.ts2
2 files changed, 7 insertions, 9 deletions
diff --git a/source/server/index.ts b/source/server/index.ts
index 3fc32ce..f77d8a5 100644
--- a/source/server/index.ts
+++ b/source/server/index.ts
@@ -1,12 +1,10 @@
-import { Application, Router, RouterContext, send } from "https://deno.land/x/oak/mod.ts";
+import { Application, Router, RouterContext, send } from "https://deno.land/x/oak@v10.4.0/mod.ts";
import { api } from "./room.ts";
+import { bundle } from "https://deno.land/x/emit@0.1.1/mod.ts";
const app = new Application()
-
const root = new Router()
-let bundleFiles: Record<string, string> = {}
-
root.get("/", async c => { await c.send({ path: "index.html", root: `${Deno.cwd()}/public` }) })
root.get("/room/:id", async c => { await c.send({ path: "index.html", root: `${Deno.cwd()}/public` }) })
@@ -25,8 +23,8 @@ function respondWithType(mimeType: string, f: () => string): (c: RouterContext<a
}
}
-root.get("/bundle.js", respondWithType("application/javascript", () => bundleFiles["deno:///bundle.js"]))
-root.get("/bundle.js.map", respondWithType("application/javascript", () => bundleFiles["deno:///bundle.js.map"]))
+let bundle_code = ""
+root.get("/bundle.js", respondWithType("application/javascript", () => bundle_code))
function mountFilesystem(r: Router, route: string, path: string) {
r.get(route + "/(.*)", async (context) => {
@@ -62,8 +60,8 @@ async function refresh() {
refresh_pending = true
try {
- const { files } = await Deno.emit("source/client/index.ts", { bundle: "module", check: false })
- bundleFiles = files
+ const { code } = await bundle("source/client/index.ts", { compilerOptions: { checkJs: false } })
+ bundle_code = code
} catch (e) { console.error(e) }
refresh_pending = false
diff --git a/source/server/room.ts b/source/server/room.ts
index 0fa8c74..d9c1a25 100644
--- a/source/server/room.ts
+++ b/source/server/room.ts
@@ -1,4 +1,4 @@
-import { Router } from "https://deno.land/x/oak@v10.1.0/router.ts";
+import { Router } from "https://deno.land/x/oak@v10.4.0/router.ts";
import { PacketC, PacketS } from "../packets.ts";
export const api = new Router()