Skip to content

Commit

Permalink
chore(deps/proxy): update uv abd baremux
Browse files Browse the repository at this point in the history
  • Loading branch information
IncognitoTGT committed Jul 23, 2024
1 parent e618b0f commit 77c3303
Show file tree
Hide file tree
Showing 19 changed files with 786 additions and 887 deletions.
38 changes: 24 additions & 14 deletions astro.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import node from "@astrojs/node";
import tailwind from "@astrojs/tailwind";
import { baremuxPath } from "@mercuryworkshop/bare-mux/node";
// @ts-expect-error shut
import { epoxyPath } from "@mercuryworkshop/epoxy-transport";
import { createBareServer } from "@tomphttp/bare-server-node";
// @ts-expect-error shut
import { server as wisp } from "@mercuryworkshop/wisp-js/server";
import { uvPath } from "@titaniumnetwork-dev/ultraviolet";
import { defineConfig } from "astro/config";
import { viteStaticCopy } from "vite-plugin-static-copy";
import wisp from "wisp-server-node";
// https://astro.build/config
export default defineConfig({
output: "server",
output: "hybrid",
adapter: node({
mode: "middleware",
}),
Expand All @@ -32,25 +34,33 @@ export default defineConfig({
{
name: "vite-wisp-server",
configureServer(server) {
const bare = createBareServer("/o/");
server.httpServer?.on("upgrade", (req, socket, head) =>
bare.shouldRoute(req)
? bare.routeUpgrade(req, socket, head)
: req.url?.startsWith("/f")
? wisp.routeRequest(req, socket, head)
: undefined,
);
server.middlewares.use((req, res, next) =>
bare.shouldRoute(req) ? bare.routeRequest(req, res) : next(),
req.url?.startsWith("/f")
? wisp.routeRequest(req, socket, head)
: undefined,
);
},
},
viteStaticCopy({
targets: [
{
src: `${epoxyPath}/**/*`.replace(/\\/g, "/"),
dest: "assets/ex",
src: `${epoxyPath}/**/*.js`.replace(/\\/g, "/"),
dest: "assets/bundled",
overwrite: false,
rename: (name) => `ex-${name}.mjs`,
},
{
src: `${baremuxPath}/**/*.js`.replace(/\\/g, "/"),
dest: "assets/bundled",
overwrite: false,
rename: (name) => `bm-${name}.js`,
},
{
src: `${uvPath}/**/*.js`.replace(/\\/g, "/"),
dest: "assets/bundled",
overwrite: false,
rename: (name) =>
`${name.replace("uv", "v").replace(/[aeiou]/gi, "")}.js`,
},
],
}),
Expand Down
29 changes: 0 additions & 29 deletions failed.html

This file was deleted.

24 changes: 10 additions & 14 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,18 @@ import type { Socket } from "node:net";
import path from "node:path";
import fastifyMiddie from "@fastify/middie";
import fastifyStatic from "@fastify/static";
import { createBareServer } from "@tomphttp/bare-server-node";
// @ts-expect-error shut
import { server as wisp } from "@mercuryworkshop/wisp-js/server";
import { build } from "astro";
import Fastify from "fastify";
import wisp from "wisp-server-node";
const port = Number.parseInt(process.env.PORT as string) || 8080;
const bare = createBareServer("/o/");
const app = Fastify({
serverFactory: (handler) =>
createServer()
.on("request", (req, res) =>
bare.shouldRoute(req) ? bare.routeRequest(req, res) : handler(req, res),
)
.on("upgrade", (req, socket: Socket, head) =>
bare.shouldRoute(req)
? bare.routeUpgrade(req, socket, head)
: req.url?.startsWith("/f")
? wisp.routeRequest(req, socket, head)
: socket.destroy(),
),
createServer(handler).on("upgrade", (req, socket: Socket, head) =>
req.url?.startsWith("/f")
? wisp.routeRequest(req, socket, head)
: socket.destroy(),
),
});
if (!fs.existsSync("dist")) {
console.log("Interstellar's not built yet! Building now...");
Expand All @@ -31,6 +24,9 @@ if (!fs.existsSync("dist")) {
process.exit(1);
});
}
await app.register(import("@fastify/compress"), {
encodings: ["br", "gzip", "deflate"],
});
// @ts-ignore
const { handler } = await import("./dist/server/entry.mjs");
await app
Expand Down
29 changes: 15 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,29 @@
"preview": "astro preview",
"typecheck": "astro check",
"astro": "astro",
"precommit": "pnpm lint && pnpm format && biome check --write . && pnpm typecheck",
"lint": "biome lint --write .",
"format": "prettier --write . && biome format --write ."
"precommit": "pnpm check && pnpm typecheck",
"check": "prettier --write . && biome check --write ."
},
"dependencies": {
"@astrojs/check": "^0.8.1",
"@astrojs/check": "^0.8.2",
"@astrojs/node": "^8.3.2",
"@astrojs/tailwind": "^5.1.0",
"@fastify/compress": "^7.0.3",
"@fastify/middie": "^8.3.1",
"@fastify/static": "^7.0.4",
"@mercuryworkshop/bare-mux": "^1.1.0",
"@mercuryworkshop/epoxy-transport": "^2.1.0",
"@tomphttp/bare-server-node": "^2.0.3",
"astro": "^4.11.5",
"fastify": "^4.28.0",
"@mercuryworkshop/bare-mux": "^2.0.3",
"@mercuryworkshop/epoxy-transport": "^2.1.3",
"@mercuryworkshop/wisp-js": "^0.1.1",
"@titaniumnetwork-dev/ultraviolet": "^3.2.6",
"astro": "^4.12.2",
"fastify": "^4.28.1",
"lucide-astro": "^0.408.0",
"mime": "^4.0.4",
"tailwindcss": "^3.4.4",
"tsx": "^4.15.7",
"typescript": "^5.5.2",
"vite-plugin-static-copy": "^1.0.5",
"wisp-server-node": "^1.1.0"
"sharp": "^0.33.4",
"tailwindcss": "^3.4.6",
"tsx": "^4.16.2",
"typescript": "^5.5.4",
"vite-plugin-static-copy": "^1.0.6"
},
"devDependencies": {
"@biomejs/biome": "1.8.3",
Expand Down
Loading

0 comments on commit 77c3303

Please sign in to comment.