-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathastro.config.ts
More file actions
94 lines (91 loc) · 2.37 KB
/
astro.config.ts
File metadata and controls
94 lines (91 loc) · 2.37 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
import { execFileSync } from "node:child_process";
import path from "node:path";
import node from "@astrojs/node";
import react from "@astrojs/react";
import tailwind from "@astrojs/tailwind";
import { baremuxPath } from "@mercuryworkshop/bare-mux/node";
import { epoxyPath } from "@mercuryworkshop/epoxy-transport";
import { server as wisp } from "@mercuryworkshop/wisp-js/server";
import compress from "@playform/compress";
import { defineConfig } from "astro/config";
import { viteStaticCopy } from "vite-plugin-static-copy";
import INConfig from "./config";
const integrations = [react(), tailwind({ applyBaseStyles: false })];
if (INConfig.server?.compress !== false) {
integrations.push(
compress({
CSS: false,
HTML: true,
Image: false,
JavaScript: true,
SVG: true,
Logger: 0,
}),
);
}
export default defineConfig({
output: "server",
adapter: node({
mode: "middleware",
}),
integrations,
prefetch: {
defaultStrategy: "viewport",
prefetchAll: false,
},
image: {
remotePatterns: [
{
protocol: "https",
hostname: "raw.githubusercontent.com",
pathname: "/UseInterstellar/**",
},
],
},
vite: {
logLevel: "warn",
define: {
__COMMIT_DATE__: JSON.stringify(
(() => {
try {
return execFileSync("git", ["show", "--no-patch", "--format=%ci"])
.toString()
.trim()
.replace(/[<>"'&]/g, "");
} catch {
return new Date().toISOString();
}
})(),
),
},
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`,
},
],
}),
],
},
});