Use devinxi-ed Solid Start (#4635)

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Dax Raad <d@ironbay.co>
This commit is contained in:
Brendan Allan
2025-11-22 23:39:25 +08:00
committed by GitHub
parent 7f183f7404
commit 85d99198b5
22 changed files with 705 additions and 511 deletions

1069
bun.lock

File diff suppressed because it is too large Load Diff

View File

@@ -48,7 +48,7 @@
"vite": "7.1.4", "vite": "7.1.4",
"@solidjs/meta": "0.29.4", "@solidjs/meta": "0.29.4",
"@solidjs/router": "0.15.4", "@solidjs/router": "0.15.4",
"@solidjs/start": "1.2.0", "@solidjs/start": "https://pkg.pr.new/@solidjs/start@dbff19d",
"solid-js": "1.9.10", "solid-js": "1.9.10",
"vite-plugin-solid": "2.11.10" "vite-plugin-solid": "2.11.10"
} }

View File

@@ -3,7 +3,6 @@ dist
.output .output
.vercel .vercel
.netlify .netlify
.vinxi
app.config.timestamp_*.js app.config.timestamp_*.js
# Environment # Environment

View File

@@ -1,23 +0,0 @@
import { defineConfig } from "@solidjs/start/config"
export default defineConfig({
middleware: "./src/middleware.ts",
vite: {
server: {
allowedHosts: true,
},
build: {
rollupOptions: {
external: ["cloudflare:workers"],
},
minify: false,
},
},
server: {
compatibilityDate: "2024-09-19",
preset: "cloudflare_module",
cloudflare: {
nodeCompat: true,
},
},
})

View File

@@ -4,12 +4,13 @@
"type": "module", "type": "module",
"scripts": { "scripts": {
"typecheck": "tsgo --noEmit", "typecheck": "tsgo --noEmit",
"dev": "vinxi dev --host 0.0.0.0", "dev": "vite dev --host 0.0.0.0",
"dev:remote": "VITE_AUTH_URL=https://auth.dev.opencode.ai bun sst shell --stage=dev bun dev", "dev:remote": "VITE_AUTH_URL=https://auth.dev.opencode.ai bun sst shell --stage=dev bun dev",
"build": "./script/generate-sitemap.ts && vinxi build && ../../opencode/script/schema.ts ./.output/public/config.json", "build": "./script/generate-sitemap.ts && vite build && ../../opencode/script/schema.ts ./.output/public/config.json",
"start": "vinxi start" "start": "vite start"
}, },
"dependencies": { "dependencies": {
"@cloudflare/vite-plugin": "1.15.2",
"@ibm/plex": "6.4.1", "@ibm/plex": "6.4.1",
"@jsx-email/render": "1.1.1", "@jsx-email/render": "1.1.1",
"@kobalte/core": "catalog:", "@kobalte/core": "catalog:",
@@ -21,13 +22,15 @@
"@solidjs/router": "catalog:", "@solidjs/router": "catalog:",
"@solidjs/start": "catalog:", "@solidjs/start": "catalog:",
"chart.js": "4.5.1", "chart.js": "4.5.1",
"nitro": "3.0.1-alpha.1",
"solid-js": "catalog:", "solid-js": "catalog:",
"vinxi": "^0.5.7", "vite": "catalog:",
"zod": "catalog:" "zod": "catalog:"
}, },
"devDependencies": { "devDependencies": {
"@typescript/native-preview": "catalog:",
"typescript": "catalog:", "typescript": "catalog:",
"@typescript/native-preview": "catalog:" "wrangler": "4.50.0"
}, },
"engines": { "engines": {
"node": ">=22" "node": ">=22"

View File

@@ -1,4 +1,4 @@
import { useSession } from "vinxi/http" import { useSession } from "@solidjs/start/http"
export interface AuthSession { export interface AuthSession {
account?: Record< account?: Record<

View File

@@ -1 +1,5 @@
/// <reference types="@solidjs/start/env" /> /// <reference types="@solidjs/start/env" />
export declare module "@solidjs/start/server" {
export type APIEvent = { request: Request }
}

View File

@@ -1,5 +1,5 @@
import { defineMiddleware } from "vinxi/http" import { createMiddleware } from "@solidjs/start/middleware"
export default defineMiddleware({ export default createMiddleware({
onBeforeResponse() {}, onBeforeResponse() {},
}) })

View File

@@ -1,6 +1,6 @@
import "./index.css" import "./index.css"
import { Title, Meta, Link } from "@solidjs/meta" import { Title, Meta, Link } from "@solidjs/meta"
import { HttpHeader } from "@solidjs/start" // import { HttpHeader } from "@solidjs/start"
import video from "../asset/lander/opencode-min.mp4" import video from "../asset/lander/opencode-min.mp4"
import videoPoster from "../asset/lander/opencode-poster.png" import videoPoster from "../asset/lander/opencode-poster.png"
import { IconCopy, IconCheck } from "../component/icon" import { IconCopy, IconCheck } from "../component/icon"
@@ -42,7 +42,7 @@ export default function Home() {
return ( return (
<main data-page="opencode"> <main data-page="opencode">
<HttpHeader name="Cache-Control" value="public, max-age=1, s-maxage=3600, stale-while-revalidate=86400" /> {/*<HttpHeader name="Cache-Control" value="public, max-age=1, s-maxage=3600, stale-while-revalidate=86400" />*/}
<Title>OpenCode | The AI coding agent built for the terminal</Title> <Title>OpenCode | The AI coding agent built for the terminal</Title>
<Link rel="canonical" href={config.baseUrl} /> <Link rel="canonical" href={config.baseUrl} />
<Link rel="icon" type="image/svg+xml" href="/favicon.svg" /> <Link rel="icon" type="image/svg+xml" href="/favicon.svg" />

View File

@@ -1,7 +1,7 @@
import "./index.css" import "./index.css"
import { createAsync, query, redirect } from "@solidjs/router" import { createAsync, query, redirect } from "@solidjs/router"
import { Title, Meta, Link } from "@solidjs/meta" import { Title, Meta, Link } from "@solidjs/meta"
import { HttpHeader } from "@solidjs/start" // import { HttpHeader } from "@solidjs/start"
import zenLogoLight from "../../asset/zen-ornate-light.svg" import zenLogoLight from "../../asset/zen-ornate-light.svg"
import { config } from "~/config" import { config } from "~/config"
import zenLogoDark from "../../asset/zen-ornate-dark.svg" import zenLogoDark from "../../asset/zen-ornate-dark.svg"
@@ -29,7 +29,7 @@ export default function Home() {
createAsync(() => checkLoggedIn()) createAsync(() => checkLoggedIn())
return ( return (
<main data-page="zen"> <main data-page="zen">
<HttpHeader name="Cache-Control" value="public, max-age=1, s-maxage=3600, stale-while-revalidate=86400" /> {/*<HttpHeader name="Cache-Control" value="public, max-age=1, s-maxage=3600, stale-while-revalidate=86400" />*/}
<Title>OpenCode Zen | A curated set of reliable optimized models for coding agents</Title> <Title>OpenCode Zen | A curated set of reliable optimized models for coding agents</Title>
<Link rel="canonical" href={`${config.baseUrl}/zen`} /> <Link rel="canonical" href={`${config.baseUrl}/zen`} />
<Link rel="icon" type="image/svg+xml" href="/favicon-zen.svg" /> <Link rel="icon" type="image/svg+xml" href="/favicon-zen.svg" />

View File

@@ -12,7 +12,7 @@
"allowJs": true, "allowJs": true,
"strict": true, "strict": true,
"noEmit": true, "noEmit": true,
"types": ["vinxi/types/client"], "types": ["vite/client"],
"isolatedModules": true, "isolatedModules": true,
"paths": { "paths": {
"~/*": ["./src/*"] "~/*": ["./src/*"]

View File

@@ -0,0 +1,25 @@
import { defineConfig, PluginOption } from "vite"
import { solidStart } from "@solidjs/start/config"
import { nitro } from "nitro/vite"
export default defineConfig({
plugins: [
solidStart() as PluginOption,
nitro({
compatibilityDate: "2024-09-19",
preset: "cloudflare_module",
cloudflare: {
nodeCompat: true,
},
}),
],
server: {
allowedHosts: true,
},
build: {
rollupOptions: {
external: ["cloudflare:workers"],
},
minify: false,
},
})

View File

@@ -9,7 +9,7 @@ export default defineConfig({
"@": path.resolve(__dirname, "./src"), "@": path.resolve(__dirname, "./src"),
}, },
}, },
plugins: [tailwindcss(), solidPlugin()], plugins: [tailwindcss(), solidPlugin()] as any,
server: { server: {
host: "0.0.0.0", host: "0.0.0.0",
allowedHosts: true, allowedHosts: true,

View File

@@ -3,8 +3,6 @@ dist
.output .output
.vercel .vercel
.netlify .netlify
.vinxi
app.config.timestamp_*.js
# Environment # Environment
.env .env

View File

@@ -1,12 +0,0 @@
import { defineConfig } from "@solidjs/start/config"
import tailwindcss from "@tailwindcss/vite"
export default defineConfig({
vite: {
plugins: [tailwindcss() as any],
server: {
host: "0.0.0.0",
allowedHosts: true,
},
},
})

View File

@@ -5,9 +5,10 @@
"type": "module", "type": "module",
"scripts": { "scripts": {
"typecheck": "tsgo --noEmit", "typecheck": "tsgo --noEmit",
"dev": "vinxi dev", "dev": "vite dev",
"build": "vinxi build", "build": "vite build",
"start": "vinxi start" "build:cloudflare": "OPENCODE_DEPLOYMENT_TARGET=cloudflare vite build",
"start": "vite start"
}, },
"dependencies": { "dependencies": {
"@opencode-ai/util": "workspace:*", "@opencode-ai/util": "workspace:*",
@@ -18,8 +19,8 @@
"hono": "catalog:", "hono": "catalog:",
"hono-openapi": "catalog:", "hono-openapi": "catalog:",
"luxon": "catalog:", "luxon": "catalog:",
"nitro": "3.0.1-alpha.1",
"solid-js": "catalog:", "solid-js": "catalog:",
"vinxi": "^0.5.7",
"zod": "catalog:" "zod": "catalog:"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -1 +1,5 @@
/// <reference types="@solidjs/start/env" /> /// <reference types="@solidjs/start/env" />
export declare module "@solidjs/start/server" {
export type APIEvent = { request: Request }
}

View File

@@ -11,7 +11,7 @@
"allowJs": true, "allowJs": true,
"noEmit": true, "noEmit": true,
"strict": true, "strict": true,
"types": ["vinxi/types/client"], "types": ["vite/client"],
"isolatedModules": true, "isolatedModules": true,
"paths": { "paths": {
"~/*": ["./src/*"] "~/*": ["./src/*"]

View File

@@ -0,0 +1,26 @@
import { defineConfig, PluginOption } from "vite"
import { solidStart } from "@solidjs/start/config"
import { nitro } from "nitro/vite"
import tailwindcss from "@tailwindcss/vite"
const nitroConfig = (() => {
const target = process.env.OPENCODE_DEPLOYMENT_TARGET
if (target === "cloudflare") {
return {
compatibilityDate: "2024-09-19",
preset: "cloudflare_module",
cloudflare: {
nodeCompat: true,
},
}
}
return {}
})()
export default defineConfig({
plugins: [tailwindcss(), solidStart() as PluginOption, nitro(nitroConfig)],
server: {
host: "0.0.0.0",
allowedHosts: true,
},
})

View File

@@ -24,4 +24,4 @@
"typescript": "catalog:", "typescript": "catalog:",
"@typescript/native-preview": "catalog:" "@typescript/native-preview": "catalog:"
} }
} }

View File

@@ -26,4 +26,4 @@
"publishConfig": { "publishConfig": {
"directory": "dist" "directory": "dist"
} }
} }

View File

@@ -3,8 +3,6 @@ dist
.output .output
.vercel .vercel
.netlify .netlify
.vinxi
app.config.timestamp_*.js
# Environment # Environment
.env .env