Skip to content

Commit 1ea7ec1

Browse files
authored
docs: prepare for v3 beta (#4091)
1 parent fd86f89 commit 1ea7ec1

134 files changed

Lines changed: 14599 additions & 8870 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/docs.md

Lines changed: 499 additions & 0 deletions
Large diffs are not rendered by default.

AGENTS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,6 @@ For deeper context, see `.agents/`:
152152
- [`.agents/presets.md`](.agents/presets.md) — All 31 presets, preset structure, how to create presets, resolution logic.
153153
- [`.agents/testing.md`](.agents/testing.md) — Test structure, how tests work, adding regression tests, running tests.
154154
- [`.agents/vite.md`](.agents/vite.md) — Vite build system: plugin architecture (6 sub-plugins), environments API, dev server integration, production build stages, bundler config, HMR, runtime worker.
155+
- [`.agents/docs.md`](.agents/docs.md) — Documentation conventions: structure, preset naming (underscore), H3 v2 API patterns, import paths, common mistakes.
156+
157+
- **Important:** H3 v2 updated docs is at `node_modules/h3/skills/h3/docs/TOC.md`

docs/.config/docs.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,34 @@ socials:
1010
discord: https://discord.nitro.build
1111
sponsors:
1212
api: https://sponsors.pi0.io/sponsors.json
13+
redirects:
14+
# v2 guide → v3 docs
15+
"/guide": "/docs"
16+
"/guide/getting-started": "/docs"
17+
"/guide/utils": "/docs/routing"
18+
"/guide/routing": "/docs/routing"
19+
"/guide/websocket": "/docs/routing"
20+
"/guide/cache": "/docs/cache"
21+
"/guide/storage": "/docs/storage"
22+
"/guide/database": "/docs/database"
23+
"/guide/fetch": "/docs/routing"
24+
"/guide/assets": "/docs/assets"
25+
"/guide/plugins": "/docs/plugins"
26+
"/guide/configuration": "/docs/configuration"
27+
"/guide/typescript": "/docs/configuration"
28+
"/guide/tasks": "/docs/tasks"
29+
"/guide/nightly": "/docs/nightly"
30+
# v2 deploy
31+
"/deploy/workers": "/deploy"
32+
"/deploy/runtimes/winterjs": "/deploy"
33+
"/deploy/custom-presets": "/deploy"
34+
"/deploy/providers/edgio": "/deploy"
35+
"/deploy/node": "/deploy/runtimes/node"
1336
themeColor: "rose"
1437
automd: true
1538
branch: main
1639
versions:
17-
- label: "v3 (alpha)"
40+
- label: "v3 (beta)"
1841
active: true
1942
- label: "v2"
2043
to: "https://nitro.build"

docs/.docs/app.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { defineAppConfig } from "#imports"
2+
3+
export default defineAppConfig({
4+
ui: {
5+
button: {
6+
slots: {
7+
base: 'active:translate-y-px transition-transform duration-300',
8+
},
9+
},
10+
},
11+
})

docs/.docs/assets/css/main.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
:root {
2+
--font-sans: "Geist", sans-serif !important;
3+
--font-mono: "Geist Mono", monospace !important;
4+
}
5+
6+
h1[data-slot="title"] {
7+
font-family: "Geist Pixels", sans-serif !important;
8+
}
9+
10+
.landing-code {
11+
--ui-bg-muted: #0c0c0e;
12+
--ui-border-muted: #27272a;
13+
--ui-bg: #0c0c0e;
14+
}
15+
16+
.landing-code pre[style] {
17+
background-color: #0c0c0e !important;
18+
}
19+
20+
.landing-code > div > div {
21+
margin-top: 0;
22+
margin-bottom: 0;
23+
}
27.9 KB
Binary file not shown.

docs/.docs/components/AppHero.vue

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<script setup lang="ts">
2+
defineProps<{
3+
title: string
4+
description: string
5+
primaryLink: string
6+
primaryLabel: string
7+
githubLink: string
8+
codeGroups: {
9+
filename: string
10+
code: string
11+
}[]
12+
}>()
13+
</script>
14+
15+
<template>
16+
<UPageHero orientation="horizontal">
17+
<template #default>
18+
<div class="code-group">
19+
<ProseCodeGroup>
20+
<ProsePre
21+
v-for="group in codeGroups"
22+
:key="group.filename"
23+
:filename="group.filename"
24+
language="ts"
25+
>
26+
<pre>{{ group.code }}</pre>
27+
</ProsePre>
28+
</ProseCodeGroup>
29+
</div>
30+
</template>
31+
32+
<HeroBackground />
33+
34+
<template #title>
35+
<span v-html="title" />
36+
</template>
37+
38+
<template #description>
39+
{{ description }}
40+
</template>
41+
42+
<template #links>
43+
<UButton
44+
size="xl"
45+
:to="primaryLink"
46+
trailing-icon="i-lucide-arrow-right"
47+
>
48+
{{ primaryLabel }}
49+
</UButton>
50+
<UButton
51+
color="neutral"
52+
icon="i-simple-icons-github"
53+
size="xl"
54+
target="_blank"
55+
:to="githubLink"
56+
variant="outline"
57+
>
58+
GitHub
59+
</UButton>
60+
</template>
61+
</UPageHero>
62+
</template>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<template>
2+
<div class="flex flex-wrap items-center justify-center gap-4">
3+
<UButton
4+
size="xl"
5+
to="/docs/quick-start"
6+
trailing-icon="i-lucide-arrow-right"
7+
>
8+
Get started
9+
</UButton>
10+
<UButton
11+
color="neutral"
12+
icon="i-simple-icons-github"
13+
size="xl"
14+
target="_blank"
15+
to="https://github.com/nitrojs/nitro"
16+
variant="outline"
17+
>
18+
Star on GitHub
19+
</UButton>
20+
<a
21+
:href="`${baseURL}llms.txt`"
22+
target="_blank"
23+
class="basis-full text-sm text-muted hover:text-default transition-colors inline-flex items-center justify-center gap-1"
24+
@click.prevent="copyPrompt"
25+
>
26+
<UIcon :name="copied ? 'i-lucide-clipboard-check' : 'i-lucide-bot'" />
27+
Docs for AI
28+
</a>
29+
</div>
30+
</template>
31+
32+
<script setup lang="ts">
33+
const copied = ref(false)
34+
const baseURL = computed(() => {
35+
if (import.meta.client) {
36+
return `${window.location.origin}/`
37+
}
38+
return '/'
39+
})
40+
41+
function copyPrompt() {
42+
const text = `Read nitro docs from ${baseURL.value}docs/quick-start so I can ask questions about it.`
43+
navigator.clipboard.writeText(text)
44+
copied.value = true
45+
setTimeout(() => {
46+
copied.value = false
47+
}, 2000)
48+
}
49+
</script>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<script setup lang="ts">
2+
import { Motion } from 'motion-v'
3+
4+
defineProps<{
5+
headline?: string
6+
link?: string
7+
linkLabel?: string
8+
}>()
9+
10+
const prefersReducedMotion = ref(false)
11+
12+
onMounted(() => {
13+
prefersReducedMotion.value = window.matchMedia('(prefers-reduced-motion: reduce)').matches
14+
})
15+
</script>
16+
17+
<template>
18+
<Motion
19+
:initial="prefersReducedMotion ? { opacity: 1 } : { opacity: 0, y: 20 }"
20+
:while-in-view="{ opacity: 1, y: 0 }"
21+
:transition="{ duration: 0.5 }"
22+
:in-view-options="{ once: true }"
23+
>
24+
<NuxtLink :to="link" class="block h-full" :class="link ? 'cursor-pointer' : 'cursor-default'">
25+
<div class="relative overflow-hidden rounded-xl border border-default bg-white/60 dark:bg-neutral-900/60 backdrop-blur-sm p-8 h-full transition-all duration-300 hover:shadow-lg hover:-translate-y-1">
26+
<div v-if="headline" class="text-xs font-mono uppercase tracking-widest text-primary mb-4 flex items-center gap-2">
27+
<span class="inline-block w-1 h-1 rounded-full bg-primary" />
28+
{{ headline }}
29+
</div>
30+
31+
<h3 class="text-2xl font-bold text-neutral-900 dark:text-white mb-3 tracking-tight">
32+
<slot name="title" />
33+
</h3>
34+
35+
<p class="text-neutral-500 dark:text-neutral-400 text-sm leading-relaxed mb-6">
36+
<slot name="description" />
37+
</p>
38+
39+
<slot name="demo" />
40+
41+
<span
42+
v-if="link"
43+
class="inline-flex items-center gap-1 text-sm text-primary mt-auto"
44+
>
45+
{{ linkLabel || 'Learn more' }}
46+
<UIcon name="i-lucide-arrow-right" class="size-4" />
47+
</span>
48+
</div>
49+
</NuxtLink>
50+
</Motion>
51+
</template>

docs/.docs/components/HeroBackground.client.vue

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
<script setup lang="ts">
2-
import { Shader, ChromaFlow } from 'shaders/vue'
2+
import { ref, onMounted, defineAsyncComponent } from 'vue'
3+
4+
const Shader = defineAsyncComponent(() => import('shaders/vue').then(m => m.Shader))
5+
const ChromaFlow = defineAsyncComponent(() => import('shaders/vue').then(m => m.ChromaFlow))
6+
7+
const enabled = ref(false)
8+
9+
onMounted(() => {
10+
const isMobile = /Android|iPhone|iPad|iPod/i.test(navigator.userAgent) || window.innerWidth < 768
11+
const hasWebGPU = 'gpu' in navigator
12+
const lowMemory = (navigator as any).deviceMemory !== undefined && (navigator as any).deviceMemory < 4
13+
const lowCores = navigator.hardwareConcurrency !== undefined && navigator.hardwareConcurrency < 4
14+
15+
enabled.value = hasWebGPU && !isMobile && !lowMemory && !lowCores
16+
})
317
</script>
418

519
<template>
6-
<Shader class="absolute inset-0 w-full h-full -z-10">
20+
<Shader v-if="enabled" class="absolute inset-0 w-full h-full -z-10">
721
<ChromaFlow
822
base-color="oklch(71.2% 0.194 13.428)"
923
up-color="oklch(70.2% 0.183 293.541)"

0 commit comments

Comments
 (0)