mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-17 05:26:47 +03:00
refactor(site): keep dev-only code out of production pages and group small shared chunks (#62964)
This commit is contained in:
@@ -953,7 +953,6 @@
|
||||
"@textjs/react": "1.6.1",
|
||||
"fuzzysort": "3.1.0",
|
||||
"nitro": "3.0.260903-beta",
|
||||
"number-flow": "0.6.2",
|
||||
"react": "19.3.1",
|
||||
"react-dom": "19.3.1",
|
||||
"solid-js": "catalog:",
|
||||
@@ -3237,8 +3236,6 @@
|
||||
|
||||
"escape-string-regexp": ["escape-string-regexp@4.0.0", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="],
|
||||
|
||||
"esm-env": ["esm-env@1.2.2", "", {}, "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA=="],
|
||||
|
||||
"esprima": ["esprima@4.0.1", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="],
|
||||
|
||||
"estree-util-attach-comments": ["estree-util-attach-comments@3.0.0", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-cKUwm/HUcTDsYh/9FgnuFqpfquUbwIqwKM26BVCGDPVgvaCl/nDCCjUfiLlx6lsEZ3Z4RFxNbOQ60pkaEwFxGw=="],
|
||||
@@ -4035,8 +4032,6 @@
|
||||
|
||||
"nth-check": ["nth-check@2.1.1", "", { "dependencies": { "boolbase": "^1.0.0" } }, "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w=="],
|
||||
|
||||
"number-flow": ["number-flow@0.6.2", "", { "dependencies": { "esm-env": "^1.1.4" } }, "sha512-MCnImG4Q5vPwhSXnov56nOuyyKn6LC+Qd7II1UiKc+ACRtug5iAtn0+CwXNxM38AC5lSowEY+oYEtZX2qMnUyw=="],
|
||||
|
||||
"object-assign": ["object-assign@4.1.1", "", {}, "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="],
|
||||
|
||||
"object-hash": ["object-hash@2.2.0", "", {}, "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw=="],
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
"@textjs/react": "1.6.1",
|
||||
"fuzzysort": "3.1.0",
|
||||
"nitro": "3.0.260903-beta",
|
||||
"number-flow": "0.6.2",
|
||||
"react": "19.3.1",
|
||||
"react-dom": "19.3.1",
|
||||
"solid-js": "catalog:",
|
||||
|
||||
@@ -64,29 +64,36 @@ console.log(
|
||||
// Each page's budget in kB, gzipped: what it was when last measured, plus a kB of room. Lower a
|
||||
// budget when a page gets lighter; a page without one fails until it has one.
|
||||
const budgets: Record<string, number> = {
|
||||
"[...404].tsx": 103.1,
|
||||
"brand/index.tsx": 106.9,
|
||||
"changelog/[tag].tsx": 100.1,
|
||||
"changelog/index.tsx": 99.3,
|
||||
"desktop.tsx": 126.9,
|
||||
"devices.tsx": 50.6,
|
||||
"product/browse.tsx": 105.7,
|
||||
"font/index.tsx": 120.2,
|
||||
"ide.tsx": 126.9,
|
||||
"index.tsx": 117.2,
|
||||
"legal/index.tsx": 150.7,
|
||||
"legal/privacy-policy/index.tsx": 140.3,
|
||||
"legal/terms-of-service/index.tsx": 135.6,
|
||||
"mini.tsx": 126.9,
|
||||
"mobile.tsx": 126.9,
|
||||
"press/index.tsx": 111.6,
|
||||
"product/index.tsx": 114.3,
|
||||
"sdk.tsx": 126.9,
|
||||
"terminal.tsx": 126.9,
|
||||
"video-editor/index.tsx": 49,
|
||||
"[...404].tsx": 100.3,
|
||||
"brand/index.tsx": 103.7,
|
||||
"changelog/[tag].tsx": 97.2,
|
||||
"changelog/index.tsx": 96.4,
|
||||
"desktop.tsx": 125.7,
|
||||
"devices.tsx": 53.1,
|
||||
"product/browse.tsx": 102.1,
|
||||
"font/index.tsx": 118,
|
||||
"ide.tsx": 125.7,
|
||||
"index.tsx": 112.8,
|
||||
"legal/index.tsx": 147.6,
|
||||
"legal/privacy-policy/index.tsx": 137.1,
|
||||
"legal/terms-of-service/index.tsx": 132.4,
|
||||
"mini.tsx": 125.7,
|
||||
"mobile.tsx": 125.7,
|
||||
"press/index.tsx": 111.1,
|
||||
"product/index.tsx": 110.4,
|
||||
"sdk.tsx": 125.7,
|
||||
"terminal.tsx": 125.7,
|
||||
"video-editor/index.tsx": 51.5,
|
||||
}
|
||||
type Chunk = { file: string; imports?: string[] }
|
||||
type Chunk = { file: string; name?: string; imports?: string[]; css?: string[] }
|
||||
const manifest: Record<string, Chunk> = await Bun.file(path.join(root, ".vite/manifest.json")).json()
|
||||
// Most pages load the shared "common" chunk (vite.config.ts), so a stylesheet in it would block
|
||||
// their first paint too.
|
||||
const commonCss = Object.values(manifest).flatMap((chunk) => (chunk.name === "common" ? (chunk.css ?? []) : []))
|
||||
if (commonCss.length) {
|
||||
console.error(`check-client-bundle: the common chunk brings stylesheets to every page: ${commonCss.join(", ")}`)
|
||||
process.exit(1)
|
||||
}
|
||||
const sizes = new Map<string, number>()
|
||||
const gzipped = async (file: string) => {
|
||||
const known = sizes.get(file)
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
// reads every `siteSettings.<key>` as the default's literal, `designMode()` as false and
|
||||
// `import.meta.env.DEV` as false, then folds what that decides (`<Show>`, `<Switch>`/`<Match>`,
|
||||
// ternaries, `&&`/`||`, `if`), so the branches production never takes, and everything only they
|
||||
// import, leave the bundle. The server and the browser builds fold the same way, so hydration keys
|
||||
// import, leave the bundle. It also drops the data-design and data-design-copy attributes, which
|
||||
// only Design mode reads. The server and the browser builds fold the same way, so hydration keys
|
||||
// still match. The development server is untouched.
|
||||
import { existsSync } from "node:fs"
|
||||
import { mkdir, readFile, writeFile } from "node:fs/promises"
|
||||
@@ -41,7 +42,7 @@ const designModules = [
|
||||
const ogModule = path.join(root, "lib/og.ts")
|
||||
const ogCards = path.join(root, "lib/og-images.json")
|
||||
const candidate =
|
||||
/\b(siteSettings|siteSettingsDefaults|setSiteSetting|designMode|designEditing|designCopy|ogImage|import\.meta\.env\.(DEV|PROD))\b/
|
||||
/\b(siteSettings|siteSettingsDefaults|setSiteSetting|designMode|designEditing|designCopy|ogImage|data-design|import\.meta\.env\.(DEV|PROD))\b/
|
||||
|
||||
export function foldSettingsForProduction(): Plugin {
|
||||
let cards: Record<string, unknown> = {}
|
||||
@@ -154,6 +155,11 @@ function foldSettings(file: string, cards: Record<string, unknown>, trimImports:
|
||||
let liveStore: types.Identifier | undefined
|
||||
const store = () => (liveStore ??= program.scope.generateUidIdentifier("live"))
|
||||
program.traverse({
|
||||
JSXAttribute(attribute) {
|
||||
const name = attribute.node.name
|
||||
if (types.isJSXIdentifier(name) && ["data-design", "data-design-copy"].includes(name.name))
|
||||
attribute.remove()
|
||||
},
|
||||
MetaProperty(meta) {
|
||||
const env = meta.parentPath.parentPath
|
||||
if (!env?.isMemberExpression() || !meta.parentPath.isMemberExpression()) return
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
import NumberFlow from "number-flow"
|
||||
import { continuous } from "number-flow/plugins"
|
||||
import { createEffect, onCleanup, onMount } from "solid-js"
|
||||
|
||||
export function RollingNumber(props: {
|
||||
value: number
|
||||
target: number
|
||||
timing: () => { duration: number; easing: string; spinEasing: string }
|
||||
}) {
|
||||
let root!: HTMLSpanElement
|
||||
// Keep the server-rendered text stable while the custom element owns its contents.
|
||||
const initial = props.value.toLocaleString()
|
||||
const growing = props.target.toLocaleString().length > initial.length
|
||||
|
||||
onMount(() => {
|
||||
if (new Intl.NumberFormat().resolvedOptions().numberingSystem !== "latn") {
|
||||
createEffect(() => {
|
||||
root.textContent = props.value.toLocaleString()
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const flow = new NumberFlow()
|
||||
flow.format = { useGrouping: true, maximumFractionDigits: 0 }
|
||||
flow.trend = 1
|
||||
if (growing) flow.plugins = [continuous]
|
||||
flow.opacityTiming = { duration: 180, easing: "ease-out" }
|
||||
const motion = window.matchMedia("(prefers-reduced-motion: reduce)")
|
||||
const updateMotion = () => {
|
||||
flow.animated = !motion.matches
|
||||
}
|
||||
updateMotion()
|
||||
motion.addEventListener("change", updateMotion)
|
||||
onCleanup(() => motion.removeEventListener("change", updateMotion))
|
||||
root.replaceChildren(flow)
|
||||
createEffect(() => {
|
||||
const value = props.value
|
||||
if (flow.value === value) return
|
||||
const timing = props.timing()
|
||||
flow.transformTiming = { duration: timing.duration, easing: timing.easing }
|
||||
flow.spinTiming = {
|
||||
duration: timing.duration,
|
||||
easing: growing ? "cubic-bezier(0.45, 0, 0.55, 1)" : timing.spinEasing,
|
||||
}
|
||||
flow.update(value)
|
||||
})
|
||||
})
|
||||
|
||||
return (
|
||||
<span
|
||||
data-value
|
||||
ref={root}
|
||||
style={{ "min-width": `${props.target.toLocaleString().length}ch`, "text-align": "right" }}
|
||||
>
|
||||
{initial}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
@@ -13,11 +13,11 @@ import { ogImage } from "~/lib/og"
|
||||
* The not-found page: the real 404 route and its previews render this same tree, so the preview's
|
||||
* HTML (which the dev server serves for bad URLs) hydrates cleanly as the 404 route. Settings ›
|
||||
* 404 arcade › Mode picks the version (layers by default; settings.ts loads the saved mode after
|
||||
* hydration, so the server's layers markup always hydrates); `only3D` (the /dev/404-3d preview)
|
||||
* always shows the three.js one. Phones get the layers stack with its still light and the
|
||||
* hybrid's phone flow (arcade/phone.ts), which loads no WebGL there.
|
||||
* hydration, so the server's layers markup always hydrates). Phones get the layers stack with its
|
||||
* still light and the hybrid's phone flow (arcade/phone.ts), which loads no WebGL there. Each mode's
|
||||
* setting comes first in its `when`, so production folds the modes it never shows out of the bundle.
|
||||
*/
|
||||
export function NotFoundPage(props: { title: string; status: number; only3D?: boolean }) {
|
||||
export function NotFoundPage(props: { title: string; status: number }) {
|
||||
const [phone, setPhone] = createSignal(false)
|
||||
onMount(() => setPhone(isPhone()))
|
||||
return (
|
||||
@@ -36,13 +36,13 @@ export function NotFoundPage(props: { title: string; status: number; only3D?: bo
|
||||
{/* Before anything is parsed, so the saved tone applies from the first paint. */}
|
||||
<script innerHTML={toneScript} />
|
||||
<Switch fallback={<Arcade404 mode="layers" />}>
|
||||
<Match when={!phone() && (props.only3D || siteSettings.arcadeMode === "3D")}>
|
||||
<Match when={siteSettings.arcadeMode === "3D" && !phone()}>
|
||||
<Arcade3D />
|
||||
</Match>
|
||||
<Match when={!phone() && siteSettings.arcadeMode === "image"}>
|
||||
<Match when={siteSettings.arcadeMode === "image" && !phone()}>
|
||||
<Arcade404 />
|
||||
</Match>
|
||||
<Match when={!phone() && siteSettings.arcadeMode === "hybrid"}>
|
||||
<Match when={siteSettings.arcadeMode === "hybrid" && !phone()}>
|
||||
<Arcade404 mode="hybrid" />
|
||||
</Match>
|
||||
</Switch>
|
||||
|
||||
@@ -180,7 +180,7 @@ export const copyVariants = {
|
||||
// "Normal" is also the page's own label now; it keeps its place so saved choices still match.
|
||||
options: ["All systems normal", "All good", "Online", "Normal", "Up", "Operational"],
|
||||
},
|
||||
// Product page intros; the page's own text (product-data.ts) is the first option.
|
||||
// Product page intros; the page's own text (product-details.ts) is the first option.
|
||||
"product.desktop.intro": {
|
||||
label: "Desktop intro",
|
||||
lines: 1,
|
||||
|
||||
@@ -128,6 +128,8 @@ function write(order: readonly string[]) {
|
||||
|
||||
/** Keeps the page's section order in step with Settings (call once from the home page). */
|
||||
export function useHomeOrder() {
|
||||
// Production keeps no saved order: the server's style element already holds the default's rules.
|
||||
if (!import.meta.env.DEV) return
|
||||
onMount(() => {
|
||||
createEffect(() => write(draft() ?? siteSettings.homeOrder))
|
||||
})
|
||||
|
||||
@@ -22,7 +22,9 @@ export const monoFontLatin = regularLatin
|
||||
export const monoFontDefault = "OpenTUI Mono"
|
||||
export const monoFontsBuiltIn = [monoFontDefault, "IBM Plex Mono"] as const
|
||||
|
||||
export const monoFontPreloads: Partial<Record<string, string>> = { "IBM Plex Mono": plexMonoLatin }
|
||||
export const monoFontPreloads: Partial<Record<string, string>> = import.meta.env.PROD
|
||||
? {}
|
||||
: { "IBM Plex Mono": plexMonoLatin }
|
||||
|
||||
/**
|
||||
* OpenTUI Mono's faces (font-display: swap), and its stand-ins while it loads: the system's
|
||||
|
||||
@@ -3,7 +3,6 @@ import { rich } from "~/i18n/rich"
|
||||
import { useI18n } from "~/context/i18n"
|
||||
import "./open-source-fork.css"
|
||||
import { createSignal, For, onCleanup } from "solid-js"
|
||||
import { config } from "~/config"
|
||||
import { docsUrl } from "~/lib/docs"
|
||||
import { designCopy } from "./design-copy"
|
||||
import { createWash, revealMotion } from "./reveal"
|
||||
@@ -24,11 +23,6 @@ const transcript = [
|
||||
{ kind: "comment", text: "# runs the CLI and TUI from your fork" },
|
||||
] as const
|
||||
|
||||
const commands = transcript
|
||||
.filter((line) => line.kind === "command")
|
||||
.map((line) => line.text)
|
||||
.join("\n")
|
||||
|
||||
/**
|
||||
* Settings › Open source variant "fork": a "fork it" block under the open source proof. A short
|
||||
* terminal transcript of forking and running OpenCode types in, line by line, the first time it
|
||||
@@ -46,7 +40,8 @@ export function OpenSourceFork() {
|
||||
onCleanup(() => clearTimeout(timer))
|
||||
|
||||
const copy = () => {
|
||||
void navigator.clipboard.writeText(commands).then(() => {
|
||||
const commands = transcript.filter((line) => line.kind === "command").map((line) => line.text)
|
||||
void navigator.clipboard.writeText(commands.join("\n")).then(() => {
|
||||
clearTimeout(timer)
|
||||
setCopied(true)
|
||||
timer = setTimeout(() => setCopied(false), 1500)
|
||||
@@ -131,6 +126,3 @@ export function OpenSourceFork() {
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/** "Fork on GitHub", beside "Star on GitHub" in the open source proof (fork variant only). */
|
||||
export const forkUrl = `${config.github.repoUrl}/fork`
|
||||
|
||||
@@ -5,7 +5,6 @@ import { useI18n } from "~/context/i18n"
|
||||
import { rich } from "~/i18n/rich"
|
||||
import type { Contributor, RepoStats } from "~/lib/github"
|
||||
import { ExternalArrow, NewTab } from "./icons"
|
||||
import { forkUrl } from "./open-source-fork"
|
||||
import { createWash, revealMotion, washStep } from "./reveal"
|
||||
import { siteSettings } from "./settings"
|
||||
|
||||
@@ -14,6 +13,7 @@ const links = {
|
||||
license: `${repo}/blob/HEAD/LICENSE`,
|
||||
contributing: `${repo}/blob/HEAD/CONTRIBUTING.md`,
|
||||
contributors: `${repo}/graphs/contributors`,
|
||||
fork: `${repo}/fork`,
|
||||
anomaly: "https://anoma.ly",
|
||||
}
|
||||
|
||||
@@ -87,19 +87,22 @@ export function OpenSourceProof(props: {
|
||||
<span data-slot="sr-only">{i18n.t("home.openSource.starCount", { count: stars() })}</span>
|
||||
<NewTab />
|
||||
</a>
|
||||
{/* Shown only in Settings › Open source variant "fork" (open-source-fork.css). */}
|
||||
<a
|
||||
href={forkUrl}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
data-component="site-button"
|
||||
data-variant="neutral"
|
||||
data-slot="fork-button"
|
||||
>
|
||||
{i18n.t("home.fork.button")}
|
||||
<ExternalArrow />
|
||||
<NewTab />
|
||||
</a>
|
||||
{/* Shown only in Settings › Open source variant "fork" (open-source-fork.css), like the fork
|
||||
block in index.tsx. */}
|
||||
<Show when={import.meta.env.DEV || siteSettings.ossVariant === "fork"}>
|
||||
<a
|
||||
href={links.fork}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
data-component="site-button"
|
||||
data-variant="neutral"
|
||||
data-slot="fork-button"
|
||||
>
|
||||
{i18n.t("home.fork.button")}
|
||||
<ExternalArrow />
|
||||
<NewTab />
|
||||
</a>
|
||||
</Show>
|
||||
<a href={links.contributing} target="_blank" rel="noopener" data-component="site-button" data-variant="neutral">
|
||||
{i18n.t("home.openSource.contribute")}
|
||||
<ExternalArrow />
|
||||
|
||||
@@ -157,226 +157,6 @@ export const mobileStores = [
|
||||
},
|
||||
] as const
|
||||
|
||||
/**
|
||||
* The product page below the intro: the showcase clips (the fourth only with Settings › Feature
|
||||
* clips count "4"), then short feature points (none on Desktop and Mobile).
|
||||
*/
|
||||
export const productDetails: Record<
|
||||
PageSlug,
|
||||
{
|
||||
/** The page's `<title>`, 50–60 characters. */
|
||||
title: string
|
||||
/** The meta and share description, 120–160 characters. */
|
||||
description: string
|
||||
/** For the page's structured data. */
|
||||
operatingSystem: string
|
||||
// The longer description under the product page title; the carousel card keeps the short one.
|
||||
intro: string
|
||||
features: { title: string; body: string }[]
|
||||
showcase: { title: string; body: string; clip?: string }[]
|
||||
/** False shows the showcase as text, its clips neither shown nor loaded. */
|
||||
showcaseMedia?: false
|
||||
}
|
||||
> = {
|
||||
desktop: {
|
||||
title: "OpenCode | Desktop app for macOS, Windows and Linux",
|
||||
description:
|
||||
"Run as many OpenCode agents as you want in parallel, see every change in a browser beside them and pick them up on any device. For macOS, Windows and Linux.",
|
||||
operatingSystem: "macOS, Windows, Linux",
|
||||
intro:
|
||||
"Run several agents at once, each session in its own tab. Review every change as a diff, comment on any line, and check the result in the built-in browser. For macOS, Windows and Linux.",
|
||||
// The page shows only its four key features (6 Nov 2026), with no feature points below them.
|
||||
features: [],
|
||||
showcase: [
|
||||
{
|
||||
title: "Parallel agents",
|
||||
clip: "/product-videos/features/desktop-1",
|
||||
body: "Start as many agents as you want and let them all work in parallel. Jump between them as they finish.",
|
||||
},
|
||||
{
|
||||
title: "See it in the browser",
|
||||
clip: "/product-videos/features/desktop-3",
|
||||
body: "Your app opens in a browser beside the agent, so you both see every change land.",
|
||||
},
|
||||
{
|
||||
title: "On every device",
|
||||
clip: "/product-videos/features/desktop-4",
|
||||
body: "Start agents across all your devices, and pick them up from the desktop app, the terminal or your phone.",
|
||||
},
|
||||
// No footage yet: the row shows a placeholder until its clip lands.
|
||||
{
|
||||
title: "Extend it",
|
||||
body: "Connect your tools and services so the agent can work with anything. Or have OpenCode build plugins for itself, with their own UI in the sidebar.",
|
||||
},
|
||||
],
|
||||
},
|
||||
terminal: {
|
||||
title: "OpenCode | Terminal UI for the open source coding agent",
|
||||
description:
|
||||
"A fast terminal UI for OpenCode that works in any shell, editor or remote server. Describe what you want, see each edit as a diff and approve commands.",
|
||||
operatingSystem: "macOS, Linux, Windows",
|
||||
intro:
|
||||
"A fast terminal UI that works in any shell, editor or remote server. Describe what you want in plain words, watch each edit land as a diff, and choose which commands run on their own.",
|
||||
features: [
|
||||
{ title: "Any terminal", body: "Works in any shell, in your editor's terminal or on a remote server." },
|
||||
{ title: "Diffs in the timeline", body: "See each edit as a diff in the timeline, as the agent makes it." },
|
||||
{ title: "Pick up later", body: "Continue the last session with -c, or any with -s." },
|
||||
{ title: "One-off runs", body: "opencode run sends one message and prints the reply." },
|
||||
{ title: "Agents and commands", body: "Switch agents with shift+tab and open every command with ctrl+p." },
|
||||
{ title: "Auto-approve", body: "Run with --auto to allow every action you haven't denied." },
|
||||
{ title: "Any server", body: "Connect to an OpenCode server by URL with --server." },
|
||||
{ title: "Usage stats", body: "opencode stats shows shareable usage statistics." },
|
||||
],
|
||||
showcase: [
|
||||
{
|
||||
title: "Ask in plain words",
|
||||
clip: "/product-videos/features/terminal-1",
|
||||
body: "Type what you want, and the agent shows its plan as it works.",
|
||||
},
|
||||
{
|
||||
title: "Approve what runs",
|
||||
clip: "/product-videos/features/terminal-2",
|
||||
body: "Edits show as diffs, and commands wait for your permission.",
|
||||
},
|
||||
{
|
||||
title: "Make it yours",
|
||||
clip: "/product-videos/features/terminal-3",
|
||||
body: "Switch themes in a keystroke, from the default to tokyonight and more.",
|
||||
},
|
||||
{
|
||||
title: "Mini",
|
||||
clip: "/product-videos/features/terminal-4",
|
||||
body: "Run opencode mini and replies print into your own scrollback.",
|
||||
},
|
||||
],
|
||||
},
|
||||
mobile: {
|
||||
title: "OpenCode | Mobile, your coding sessions on your phone",
|
||||
description:
|
||||
"Start and steer OpenCode sessions from your phone. Talk to the agent while it runs on your computer.",
|
||||
// Android joins when it is available (androidStatus).
|
||||
operatingSystem: androidSoon ? "iOS" : "iOS, Android",
|
||||
intro:
|
||||
"Start and steer sessions from your phone, wherever you are. Call a session and talk to the agent, or open any session to pick up where you left off, all on OpenCode running on your own computer.",
|
||||
// The page shows only its four clips for now (5 Nov 2026). The grid's points, checked against
|
||||
// the iOS app's What's New entries (anomalyco/opencode-ios), are kept here to bring back:
|
||||
// "Every computer" takes two taps (the drawer title, then the server), and muting leaves
|
||||
// notifications on (it skips Catch Up, the unread dot and the badge), so both need new copy.
|
||||
// { title: "Notify when done", body: "Get a short summary when a session you started finishes." },
|
||||
// { title: "Pair from anywhere", body: "Connect from any network with opencode pair --remote." },
|
||||
// { title: "Every computer", body: "Switch between the computers you've paired in one tap." },
|
||||
// { title: "Siri and Shortcuts", body: "Start a call or a session from Siri or Control Center." },
|
||||
// { title: "Follow along", body: "Watch the timeline update as the agent works." },
|
||||
// { title: "Your computer", body: "Connects to OpenCode running on your own machine." },
|
||||
// { title: "Share sheet", body: "Share anything to a session without opening the app." },
|
||||
// { title: "Mute sessions", body: "Keep a session in your list without getting its notifications." },
|
||||
features: [],
|
||||
showcase: [
|
||||
{
|
||||
title: "Voice",
|
||||
clip: "/product-videos/features/mobile-1",
|
||||
body: "Call a session and say what you need. The agent answers out loud.",
|
||||
},
|
||||
{
|
||||
title: "Sessions",
|
||||
clip: "/product-videos/features/mobile-3",
|
||||
body: "Open any session to see where it is, then pick up where you left off.",
|
||||
},
|
||||
// Steer is true (Steer While It Works, 11 Oct 2026) but has no footage yet; it returns here
|
||||
// with a capture of a follow-up sent mid-run.
|
||||
// {
|
||||
// title: "Steer",
|
||||
// body: "Send a follow-up to change direction mid-session.",
|
||||
// },
|
||||
{
|
||||
title: "Results",
|
||||
clip: "/product-videos/features/mobile-4",
|
||||
body: "The call tells you what changed once the work you asked for is done.",
|
||||
},
|
||||
],
|
||||
},
|
||||
sdk: {
|
||||
title: "OpenCode | TypeScript SDK for scripts, CI jobs and tools",
|
||||
description:
|
||||
"Drive OpenCode from your own scripts, CI jobs and tools. The typed TypeScript client creates sessions, sends prompts and streams every event as it happens.",
|
||||
operatingSystem: "macOS, Linux, Windows",
|
||||
intro:
|
||||
"Drive OpenCode from your own scripts, CI jobs and tools. The SDK runs OpenCode inside your process, with your config and models, and its typed client creates sessions, sends prompts and streams every event.",
|
||||
features: [
|
||||
{ title: "TypeScript client", body: "Typed requests and events, the same values as @opencode/client." },
|
||||
{ title: "Sessions from code", body: "Create sessions and send prompts from any script." },
|
||||
{ title: "Any model", body: "Uses whichever models your OpenCode setup has." },
|
||||
{ title: "npm or bun", body: "Install it with npm i @opencode/sdk or bun add @opencode/sdk." },
|
||||
{ title: "In-process host", body: "Runs OpenCode in memory, with no network hop." },
|
||||
{ title: "Your plugins", body: "Pass your own plugins in when you create the in-process host." },
|
||||
{ title: "Promise or Effect", body: "A Promise API and an Effect API with the same values." },
|
||||
{ title: "Cloudflare Workers", body: "Run OpenCode inside a Cloudflare Durable Object on Workers." },
|
||||
],
|
||||
// Text only: the four points without their clips, so the page loads no video for them.
|
||||
showcaseMedia: false,
|
||||
showcase: [
|
||||
{
|
||||
title: "Fix CI from code",
|
||||
clip: "/product-videos/features/sdk-1",
|
||||
body: "A short script asks OpenCode to fix failing tests, then runs them again.",
|
||||
},
|
||||
{
|
||||
title: "Follow every step",
|
||||
clip: "/product-videos/features/sdk-2",
|
||||
body: "Stream events to see each tool the agent calls, as it happens.",
|
||||
},
|
||||
{
|
||||
title: "Build your own tools",
|
||||
clip: "/product-videos/features/sdk-3",
|
||||
body: "Wire OpenCode into bots, dashboards and workflows with a few lines.",
|
||||
},
|
||||
{
|
||||
title: "In your process",
|
||||
clip: "/product-videos/features/sdk-4",
|
||||
body: "Runs OpenCode inside your process, with your config and models.",
|
||||
},
|
||||
],
|
||||
},
|
||||
ide: {
|
||||
title: "OpenCode | Editor integrations for VS Code, Cursor and Zed",
|
||||
description:
|
||||
"Use OpenCode inside your editor, with the extension for VS Code, Cursor, Windsurf and VSCodium, and opencode acp for Zed, JetBrains IDEs and other ACP editors.",
|
||||
operatingSystem: "macOS, Windows, Linux",
|
||||
intro:
|
||||
"Use OpenCode inside your editor. In VS Code, Cursor, Windsurf and VSCodium, run opencode in the integrated terminal and the extension installs itself. Zed, JetBrains IDEs and other editors that support the Agent Client Protocol run OpenCode with opencode acp.",
|
||||
features: [
|
||||
{ title: "Quick launch", body: "Cmd+Esc or Ctrl+Esc opens OpenCode in a split terminal." },
|
||||
{ title: "New session", body: "Cmd+Shift+Esc or Ctrl+Shift+Esc starts another session." },
|
||||
{ title: "Context", body: "Shares your current selection or tab with OpenCode." },
|
||||
{ title: "File references", body: "Cmd+Option+K or Alt+Ctrl+K inserts @File#L37-42." },
|
||||
{ title: "Installs itself", body: "Run opencode in the integrated terminal to add it." },
|
||||
{ title: "ACP editors", body: "Zed, JetBrains IDEs, Avante.nvim and CodeCompanion.nvim." },
|
||||
{ title: "Open VSX", body: "Also on Open VSX for Cursor, Windsurf and VSCodium." },
|
||||
{ title: "Same agent", body: "The OpenCode you run in the terminal, beside your code." },
|
||||
],
|
||||
showcase: [],
|
||||
},
|
||||
mini: {
|
||||
title: "OpenCode | Mini, a minimal terminal interface for the agent",
|
||||
description:
|
||||
"Mini runs OpenCode in a minimal terminal interface. Replies print into your terminal's own scrollback, and only a prompt and a status line stay below.",
|
||||
operatingSystem: "macOS, Linux, Windows",
|
||||
intro:
|
||||
"A minimal terminal interface for OpenCode. Run opencode mini and replies print straight into your terminal's own scrollback, so you scroll, search and copy them like any other output. Only the prompt and a status line stay at the bottom.",
|
||||
features: [
|
||||
{ title: "Your scrollback", body: "Replies become ordinary terminal history." },
|
||||
{ title: "One prompt", body: "Agent, model, context and cost on one status line." },
|
||||
{ title: "Permissions", body: "Allow edits and commands from the prompt area." },
|
||||
{ title: "How much shows", body: "Quiet, default or everything, for thinking and tool output." },
|
||||
{ title: "Pick up later", body: "Continue the last session with -c, or any with -s." },
|
||||
{ title: "Same OpenCode", body: "The same server, agents and models as the other apps." },
|
||||
{ title: "Agents", body: "Switch agents right from the prompt." },
|
||||
{ title: "Compact", body: "Shrink a long session with /compact." },
|
||||
],
|
||||
showcase: [],
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* The changelog areas (keys in `/changelog?area=`) for each product: its product page lists the
|
||||
* newest entries with notes there and links to the changelog with the same filter. Core notes (the
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
// The product pages' own copy, apart from product-data.ts so the pages that only list the products
|
||||
// (every page loads the nav and the carousel's data) don't download it.
|
||||
|
||||
import { androidSoon, type PageSlug } from "./product-data"
|
||||
|
||||
/**
|
||||
* The product page below the intro: the showcase clips (the fourth only with Settings › Feature
|
||||
* clips count "4"), then short feature points (none on Desktop and Mobile).
|
||||
*/
|
||||
export const productDetails: Record<
|
||||
PageSlug,
|
||||
{
|
||||
/** The page's `<title>`, 50–60 characters. */
|
||||
title: string
|
||||
/** The meta and share description, 120–160 characters. */
|
||||
description: string
|
||||
/** For the page's structured data. */
|
||||
operatingSystem: string
|
||||
// The longer description under the product page title; the carousel card keeps the short one.
|
||||
intro: string
|
||||
features: { title: string; body: string }[]
|
||||
showcase: { title: string; body: string; clip?: string }[]
|
||||
/** False shows the showcase as text, its clips neither shown nor loaded. */
|
||||
showcaseMedia?: false
|
||||
}
|
||||
> = {
|
||||
desktop: {
|
||||
title: "OpenCode | Desktop app for macOS, Windows and Linux",
|
||||
description:
|
||||
"Run as many OpenCode agents as you want in parallel, see every change in a browser beside them and pick them up on any device. For macOS, Windows and Linux.",
|
||||
operatingSystem: "macOS, Windows, Linux",
|
||||
intro:
|
||||
"Run several agents at once, each session in its own tab. Review every change as a diff, comment on any line, and check the result in the built-in browser. For macOS, Windows and Linux.",
|
||||
// The page shows only its four key features (6 Nov 2026), with no feature points below them.
|
||||
features: [],
|
||||
showcase: [
|
||||
{
|
||||
title: "Parallel agents",
|
||||
clip: "/product-videos/features/desktop-1",
|
||||
body: "Start as many agents as you want and let them all work in parallel. Jump between them as they finish.",
|
||||
},
|
||||
{
|
||||
title: "See it in the browser",
|
||||
clip: "/product-videos/features/desktop-3",
|
||||
body: "Your app opens in a browser beside the agent, so you both see every change land.",
|
||||
},
|
||||
{
|
||||
title: "On every device",
|
||||
clip: "/product-videos/features/desktop-4",
|
||||
body: "Start agents across all your devices, and pick them up from the desktop app, the terminal or your phone.",
|
||||
},
|
||||
// No footage yet: the row shows a placeholder until its clip lands.
|
||||
{
|
||||
title: "Extend it",
|
||||
body: "Connect your tools and services so the agent can work with anything. Or have OpenCode build plugins for itself, with their own UI in the sidebar.",
|
||||
},
|
||||
],
|
||||
},
|
||||
terminal: {
|
||||
title: "OpenCode | Terminal UI for the open source coding agent",
|
||||
description:
|
||||
"A fast terminal UI for OpenCode that works in any shell, editor or remote server. Describe what you want, see each edit as a diff and approve commands.",
|
||||
operatingSystem: "macOS, Linux, Windows",
|
||||
intro:
|
||||
"A fast terminal UI that works in any shell, editor or remote server. Describe what you want in plain words, watch each edit land as a diff, and choose which commands run on their own.",
|
||||
features: [
|
||||
{ title: "Any terminal", body: "Works in any shell, in your editor's terminal or on a remote server." },
|
||||
{ title: "Diffs in the timeline", body: "See each edit as a diff in the timeline, as the agent makes it." },
|
||||
{ title: "Pick up later", body: "Continue the last session with -c, or any with -s." },
|
||||
{ title: "One-off runs", body: "opencode run sends one message and prints the reply." },
|
||||
{ title: "Agents and commands", body: "Switch agents with shift+tab and open every command with ctrl+p." },
|
||||
{ title: "Auto-approve", body: "Run with --auto to allow every action you haven't denied." },
|
||||
{ title: "Any server", body: "Connect to an OpenCode server by URL with --server." },
|
||||
{ title: "Usage stats", body: "opencode stats shows shareable usage statistics." },
|
||||
],
|
||||
showcase: [
|
||||
{
|
||||
title: "Ask in plain words",
|
||||
clip: "/product-videos/features/terminal-1",
|
||||
body: "Type what you want, and the agent shows its plan as it works.",
|
||||
},
|
||||
{
|
||||
title: "Approve what runs",
|
||||
clip: "/product-videos/features/terminal-2",
|
||||
body: "Edits show as diffs, and commands wait for your permission.",
|
||||
},
|
||||
{
|
||||
title: "Make it yours",
|
||||
clip: "/product-videos/features/terminal-3",
|
||||
body: "Switch themes in a keystroke, from the default to tokyonight and more.",
|
||||
},
|
||||
{
|
||||
title: "Mini",
|
||||
clip: "/product-videos/features/terminal-4",
|
||||
body: "Run opencode mini and replies print into your own scrollback.",
|
||||
},
|
||||
],
|
||||
},
|
||||
mobile: {
|
||||
title: "OpenCode | Mobile, your coding sessions on your phone",
|
||||
description: "Start and steer OpenCode sessions from your phone. Talk to the agent while it runs on your computer.",
|
||||
// Android joins when it is available (androidStatus).
|
||||
operatingSystem: androidSoon ? "iOS" : "iOS, Android",
|
||||
intro:
|
||||
"Start and steer sessions from your phone, wherever you are. Call a session and talk to the agent, or open any session to pick up where you left off, all on OpenCode running on your own computer.",
|
||||
// The page shows only its four clips for now (5 Nov 2026). The grid's points, checked against
|
||||
// the iOS app's What's New entries (anomalyco/opencode-ios), are kept here to bring back:
|
||||
// "Every computer" takes two taps (the drawer title, then the server), and muting leaves
|
||||
// notifications on (it skips Catch Up, the unread dot and the badge), so both need new copy.
|
||||
// { title: "Notify when done", body: "Get a short summary when a session you started finishes." },
|
||||
// { title: "Pair from anywhere", body: "Connect from any network with opencode pair --remote." },
|
||||
// { title: "Every computer", body: "Switch between the computers you've paired in one tap." },
|
||||
// { title: "Siri and Shortcuts", body: "Start a call or a session from Siri or Control Center." },
|
||||
// { title: "Follow along", body: "Watch the timeline update as the agent works." },
|
||||
// { title: "Your computer", body: "Connects to OpenCode running on your own machine." },
|
||||
// { title: "Share sheet", body: "Share anything to a session without opening the app." },
|
||||
// { title: "Mute sessions", body: "Keep a session in your list without getting its notifications." },
|
||||
features: [],
|
||||
showcase: [
|
||||
{
|
||||
title: "Voice",
|
||||
clip: "/product-videos/features/mobile-1",
|
||||
body: "Call a session and say what you need. The agent answers out loud.",
|
||||
},
|
||||
{
|
||||
title: "Sessions",
|
||||
clip: "/product-videos/features/mobile-3",
|
||||
body: "Open any session to see where it is, then pick up where you left off.",
|
||||
},
|
||||
// Steer is true (Steer While It Works, 11 Oct 2026) but has no footage yet; it returns here
|
||||
// with a capture of a follow-up sent mid-run.
|
||||
// {
|
||||
// title: "Steer",
|
||||
// body: "Send a follow-up to change direction mid-session.",
|
||||
// },
|
||||
{
|
||||
title: "Results",
|
||||
clip: "/product-videos/features/mobile-4",
|
||||
body: "The call tells you what changed once the work you asked for is done.",
|
||||
},
|
||||
],
|
||||
},
|
||||
sdk: {
|
||||
title: "OpenCode | TypeScript SDK for scripts, CI jobs and tools",
|
||||
description:
|
||||
"Drive OpenCode from your own scripts, CI jobs and tools. The typed TypeScript client creates sessions, sends prompts and streams every event as it happens.",
|
||||
operatingSystem: "macOS, Linux, Windows",
|
||||
intro:
|
||||
"Drive OpenCode from your own scripts, CI jobs and tools. The SDK runs OpenCode inside your process, with your config and models, and its typed client creates sessions, sends prompts and streams every event.",
|
||||
features: [
|
||||
{ title: "TypeScript client", body: "Typed requests and events, the same values as @opencode/client." },
|
||||
{ title: "Sessions from code", body: "Create sessions and send prompts from any script." },
|
||||
{ title: "Any model", body: "Uses whichever models your OpenCode setup has." },
|
||||
{ title: "npm or bun", body: "Install it with npm i @opencode/sdk or bun add @opencode/sdk." },
|
||||
{ title: "In-process host", body: "Runs OpenCode in memory, with no network hop." },
|
||||
{ title: "Your plugins", body: "Pass your own plugins in when you create the in-process host." },
|
||||
{ title: "Promise or Effect", body: "A Promise API and an Effect API with the same values." },
|
||||
{ title: "Cloudflare Workers", body: "Run OpenCode inside a Cloudflare Durable Object on Workers." },
|
||||
],
|
||||
// Text only: the four points without their clips, so the page loads no video for them.
|
||||
showcaseMedia: false,
|
||||
showcase: [
|
||||
{
|
||||
title: "Fix CI from code",
|
||||
clip: "/product-videos/features/sdk-1",
|
||||
body: "A short script asks OpenCode to fix failing tests, then runs them again.",
|
||||
},
|
||||
{
|
||||
title: "Follow every step",
|
||||
clip: "/product-videos/features/sdk-2",
|
||||
body: "Stream events to see each tool the agent calls, as it happens.",
|
||||
},
|
||||
{
|
||||
title: "Build your own tools",
|
||||
clip: "/product-videos/features/sdk-3",
|
||||
body: "Wire OpenCode into bots, dashboards and workflows with a few lines.",
|
||||
},
|
||||
{
|
||||
title: "In your process",
|
||||
clip: "/product-videos/features/sdk-4",
|
||||
body: "Runs OpenCode inside your process, with your config and models.",
|
||||
},
|
||||
],
|
||||
},
|
||||
ide: {
|
||||
title: "OpenCode | Editor integrations for VS Code, Cursor and Zed",
|
||||
description:
|
||||
"Use OpenCode inside your editor, with the extension for VS Code, Cursor, Windsurf and VSCodium, and opencode acp for Zed, JetBrains IDEs and other ACP editors.",
|
||||
operatingSystem: "macOS, Windows, Linux",
|
||||
intro:
|
||||
"Use OpenCode inside your editor. In VS Code, Cursor, Windsurf and VSCodium, run opencode in the integrated terminal and the extension installs itself. Zed, JetBrains IDEs and other editors that support the Agent Client Protocol run OpenCode with opencode acp.",
|
||||
features: [
|
||||
{ title: "Quick launch", body: "Cmd+Esc or Ctrl+Esc opens OpenCode in a split terminal." },
|
||||
{ title: "New session", body: "Cmd+Shift+Esc or Ctrl+Shift+Esc starts another session." },
|
||||
{ title: "Context", body: "Shares your current selection or tab with OpenCode." },
|
||||
{ title: "File references", body: "Cmd+Option+K or Alt+Ctrl+K inserts @File#L37-42." },
|
||||
{ title: "Installs itself", body: "Run opencode in the integrated terminal to add it." },
|
||||
{ title: "ACP editors", body: "Zed, JetBrains IDEs, Avante.nvim and CodeCompanion.nvim." },
|
||||
{ title: "Open VSX", body: "Also on Open VSX for Cursor, Windsurf and VSCodium." },
|
||||
{ title: "Same agent", body: "The OpenCode you run in the terminal, beside your code." },
|
||||
],
|
||||
showcase: [],
|
||||
},
|
||||
mini: {
|
||||
title: "OpenCode | Mini, a minimal terminal interface for the agent",
|
||||
description:
|
||||
"Mini runs OpenCode in a minimal terminal interface. Replies print into your terminal's own scrollback, and only a prompt and a status line stay below.",
|
||||
operatingSystem: "macOS, Linux, Windows",
|
||||
intro:
|
||||
"A minimal terminal interface for OpenCode. Run opencode mini and replies print straight into your terminal's own scrollback, so you scroll, search and copy them like any other output. Only the prompt and a status line stay at the bottom.",
|
||||
features: [
|
||||
{ title: "Your scrollback", body: "Replies become ordinary terminal history." },
|
||||
{ title: "One prompt", body: "Agent, model, context and cost on one status line." },
|
||||
{ title: "Permissions", body: "Allow edits and commands from the prompt area." },
|
||||
{ title: "How much shows", body: "Quiet, default or everything, for thinking and tool output." },
|
||||
{ title: "Pick up later", body: "Continue the last session with -c, or any with -s." },
|
||||
{ title: "Same OpenCode", body: "The same server, agents and models as the other apps." },
|
||||
{ title: "Agents", body: "Switch agents right from the prompt." },
|
||||
{ title: "Compact", body: "Shrink a long session with /compact." },
|
||||
],
|
||||
showcase: [],
|
||||
},
|
||||
}
|
||||
@@ -15,7 +15,8 @@ import { productDetailsSource } from "~/i18n/content/areas/product-details"
|
||||
import { productsSource } from "~/i18n/content/areas/products"
|
||||
import { ChangelogSettings, ChangelogTimeline, ChangelogUnavailable } from "./changelog-entry"
|
||||
import { Companions } from "./companions"
|
||||
import { moreProducts, productAreas, productDetails, type PageSlug } from "./product-data"
|
||||
import { moreProducts, productAreas, type PageSlug } from "./product-data"
|
||||
import { productDetails } from "./product-details"
|
||||
import { orderedProducts } from "./products-order"
|
||||
import { designCopy, designEditing } from "./design-copy"
|
||||
import { CardVideo, InstallTabs, ProductAction, useCardShrink } from "./products"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import "./products-order.css"
|
||||
import "./products-order.dev.css"
|
||||
import { createEffect, createSignal, onCleanup, onMount } from "solid-js"
|
||||
import { designMode } from "./design-copy"
|
||||
import { productPages, type PageSlug } from "./product-data"
|
||||
|
||||
@@ -1130,7 +1130,7 @@ const defaults = siteSettingsDefaults
|
||||
*/
|
||||
// Production reads every setting as its default's constant (script/fold-settings.ts, which fails the
|
||||
// build on any other read), so its store starts empty and the defaults stay out of the bundle.
|
||||
export const [siteSettings, setStore] = createStore<SiteSettings>(
|
||||
export const [siteSettings, setStore] = /* @__PURE__ */ createStore<SiteSettings>(
|
||||
import.meta.env.DEV ? structuredClone(defaults) : ({} as SiteSettings),
|
||||
)
|
||||
|
||||
|
||||
@@ -1372,7 +1372,7 @@ html:has([data-site][data-theme="dark"]) {
|
||||
}
|
||||
|
||||
/* The label (Design mode can swap in longer wording) stays on one line beside the bars. */
|
||||
[data-component="status"] [data-design-copy] {
|
||||
[data-component="status"] [data-slot="status-label"] {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { createEffect, on } from "solid-js"
|
||||
import { createStore } from "solid-js/store"
|
||||
import { createEffect, createSignal, on } from "solid-js"
|
||||
import { getRequestEvent } from "solid-js/web"
|
||||
import { useLocation } from "@solidjs/router"
|
||||
import { createSimpleContext } from "@opencode/ui/context"
|
||||
@@ -42,9 +41,7 @@ function initial() {
|
||||
export const { use: useLanguage, provider: LanguageProvider } = createSimpleContext({
|
||||
name: "Language",
|
||||
init: () => {
|
||||
const [store, setStore] = createStore({
|
||||
locale: initial(),
|
||||
})
|
||||
const [current, setCurrent] = createSignal(initial())
|
||||
|
||||
// Back and forward switch to the address's language, as a fresh load would: its locale prefix,
|
||||
// else English (an address that never takes a locale, such as the changelog, keeps the current
|
||||
@@ -54,11 +51,11 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont
|
||||
on(
|
||||
() => location.pathname,
|
||||
(pathname) => {
|
||||
const next = fromPathname(pathname) ?? (localized(pathname) ? "en" : store.locale)
|
||||
if (next === store.locale) return
|
||||
const next = fromPathname(pathname) ?? (localized(pathname) ? "en" : current())
|
||||
if (next === current()) return
|
||||
void loadLanguage(next).then(
|
||||
() => {
|
||||
setStore("locale", next)
|
||||
setCurrent(next)
|
||||
document.cookie = cookie(next)
|
||||
},
|
||||
() => window.location.reload(),
|
||||
@@ -70,22 +67,22 @@ export const { use: useLanguage, provider: LanguageProvider } = createSimpleCont
|
||||
|
||||
createEffect(() => {
|
||||
if (typeof document !== "object") return
|
||||
document.documentElement.lang = localeTag(store.locale)
|
||||
document.documentElement.dir = localeDir(store.locale)
|
||||
document.documentElement.dataset.locale = store.locale
|
||||
document.documentElement.lang = localeTag(current())
|
||||
document.documentElement.dir = localeDir(current())
|
||||
document.documentElement.dataset.locale = current()
|
||||
})
|
||||
|
||||
return {
|
||||
locale: () => store.locale,
|
||||
locale: current,
|
||||
locales: LOCALES,
|
||||
label: localeLabel,
|
||||
tag: localeTag,
|
||||
dir: localeDir,
|
||||
route(pathname: string) {
|
||||
return localeRoute(store.locale, pathname)
|
||||
return localeRoute(current(), pathname)
|
||||
},
|
||||
setLocale(next: Locale) {
|
||||
setStore("locale", next)
|
||||
setCurrent(next)
|
||||
if (typeof document !== "object") return
|
||||
document.cookie = cookie(next)
|
||||
},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { productDetails, type PageSlug } from "~/component/site/product-data"
|
||||
import type { PageSlug } from "~/component/site/product-data"
|
||||
import { productDetails } from "~/component/site/product-details"
|
||||
|
||||
/** The product pages' English copy, by product. */
|
||||
export const productDetailsSource = Object.fromEntries(
|
||||
|
||||
@@ -40,7 +40,8 @@ function stats(live: Live): RepoStats {
|
||||
.toSorted(
|
||||
(a, b) => group(a.id) - group(b.id) || position(a.id) - position(b.id) || b.contributions - a.contributions,
|
||||
)
|
||||
.slice(0, 72)
|
||||
// The most the open source proof's two rows show at any width: 21 columns, at 1248px wide.
|
||||
.slice(0, 42)
|
||||
.map((face) => ({
|
||||
login: face.login,
|
||||
avatar: face.avatar ?? `https://avatars.githubusercontent.com/u/${face.id}?v=4`,
|
||||
|
||||
@@ -15,7 +15,8 @@ import { markdownDocument, type MarkdownContext } from "~/lib/markdown"
|
||||
import { pressMarkdown } from "~/lib/press-content"
|
||||
import { extensionMarkdown, productMarkdown, productsMarkdown } from "~/lib/product-markdown"
|
||||
import { extensionPages } from "~/component/site/extension-data"
|
||||
import { allProductPages, productAreas, productDetails } from "~/component/site/product-data"
|
||||
import { allProductPages, productAreas } from "~/component/site/product-data"
|
||||
import { productDetails } from "~/component/site/product-details"
|
||||
|
||||
type PageMarkdown = {
|
||||
title: string
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { productDetails, products, type ProductSlug } from "~/component/site/product-data"
|
||||
import { products, type ProductSlug } from "~/component/site/product-data"
|
||||
import { productDetails } from "~/component/site/product-details"
|
||||
import { config } from "~/config"
|
||||
import type { Translate } from "~/i18n"
|
||||
import { brandAssets } from "~/lib/media"
|
||||
@@ -316,7 +317,7 @@ export function pressReleases(releases: ChangelogRelease[], route: (path: string
|
||||
}
|
||||
|
||||
// Longer than the carousel copy in product-data.ts, and tuned to wrap to exactly three lines at
|
||||
// 1280 and 1440 wide (378 and 330px columns); re-measure after changing it. Sources: productDetails in product-data.ts
|
||||
// 1280 and 1440 wide (378 and 330px columns); re-measure after changing it. Sources: productDetails in product-details.ts
|
||||
// (desktop tabs, diffs and built-in browser; terminal shells, remote servers and permissions; mobile
|
||||
// voice calls and approvals; SDK typed client, sessions, prompts and event stream).
|
||||
const productPress: Record<ProductSlug, string> = {
|
||||
|
||||
@@ -6,13 +6,13 @@ import {
|
||||
installs,
|
||||
mobileStores,
|
||||
productAreas,
|
||||
productDetails,
|
||||
allProductPages,
|
||||
productPages,
|
||||
sdkDocs,
|
||||
sdkSnippet,
|
||||
type PageSlug,
|
||||
} from "~/component/site/product-data"
|
||||
import { productDetails } from "~/component/site/product-details"
|
||||
import { changelogEntryMarkdown } from "~/lib/changelog-markdown"
|
||||
import { downloadSectionsMarkdown, productDownloadMarkdown, storeMarkdown } from "~/lib/download-content"
|
||||
import { changelogQuery } from "~/lib/changelog-notes"
|
||||
|
||||
@@ -66,10 +66,16 @@ import { repoStats, type RepoStats } from "~/lib/github"
|
||||
import { inlineKey } from "~/lib/direction"
|
||||
import { copyOnClick } from "~/lib/clipboard"
|
||||
|
||||
// Settings › Hero text and Stats pick these in development; production shows the static title and
|
||||
// the slot stats, so the rolling chunk isn't built.
|
||||
const HeroTitle = import.meta.env.DEV
|
||||
? lazy(() => import("~/component/site/rolling").then((module) => ({ default: module.HeroTitle })))
|
||||
: () => undefined
|
||||
const RollingStat = import.meta.env.DEV
|
||||
? lazy(() => import("~/component/site/rolling").then((module) => ({ default: module.RollingStat })))
|
||||
: () => undefined
|
||||
// Only rendered inside the settings panel, so it loads with it.
|
||||
// Settings rows are a development tool (component/site/settings-panel.tsx), left out of production.
|
||||
const HeroTitle = lazy(() => import("~/component/site/rolling").then((module) => ({ default: module.HeroTitle })))
|
||||
const RollingStat = lazy(() => import("~/component/site/rolling").then((module) => ({ default: module.RollingStat })))
|
||||
const PageSettings = import.meta.env.DEV ? lazy(() => import("~/component/site/page-settings")) : () => undefined
|
||||
|
||||
export default function Home() {
|
||||
|
||||
@@ -106,6 +106,26 @@ export default defineConfig({
|
||||
// strobe builds with STROBE_SOURCEMAP=hidden: maps beside the scripts without a
|
||||
// sourceMappingURL comment, so the scripts stay byte for byte and profiles name source lines.
|
||||
sourcemap: process.env.STROBE_SOURCEMAP === "hidden" ? "hidden" : undefined,
|
||||
rolldownOptions: {
|
||||
output: {
|
||||
// Rolldown gives the code that pages share one chunk per set of pages sharing it, which
|
||||
// had the home page preload 29 files, most under 3 kB. Plain modules (not components,
|
||||
// which may bring their stylesheet to every page that loads the chunk) of up to 4 kB
|
||||
// that 12 or more of the bundle's entries (page routes and lazily loaded modules)
|
||||
// import go in one chunk instead: fewer requests and a little less code on most pages.
|
||||
// Each language's strings keep their own files (script/i18n-plugin.ts).
|
||||
codeSplitting: {
|
||||
groups: [
|
||||
{
|
||||
name: "common",
|
||||
test: (id) => !/\.(tsx|jsx|css)(\?|$)/.test(id) && !id.startsWith("\0virtual:i18n"),
|
||||
minShareCount: 12,
|
||||
maxModuleSize: 4000,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user