-
Notifications
You must be signed in to change notification settings - Fork 409
/
astro.config.ts
81 lines (80 loc) · 2.21 KB
/
astro.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import { execSync } from "node:child_process";
import path from "node:path";
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";
// @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";
// https://astro.build/config
export default defineConfig({
output: "hybrid",
adapter: node({
mode: "middleware",
}),
integrations: [tailwind({ applyBaseStyles: false })],
prefetch: {
defaultStrategy: "viewport",
prefetchAll: false,
},
image: {
remotePatterns: [
{
protocol: "https",
hostname: "raw.githubusercontent.com",
pathname: "/UseInterstellar/**",
},
],
},
vite: {
define: {
__COMMIT_DATE__: JSON.stringify(
execSync("git show --no-patch --format=%ci").toString().trim(),
),
},
resolve: {
alias: {
"@": path.resolve("./src"),
},
},
plugins: [
{
name: "vite-wisp-server",
configureServer(server) {
server.httpServer?.on("upgrade", (req, socket, head) =>
req.url?.startsWith("/f")
? wisp.routeRequest(req, socket, head)
: undefined,
);
},
},
viteStaticCopy({
targets: [
{
src: `${epoxyPath}/**/*.mjs`.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`,
},
],
}),
],
},
});