@@ -10,11 +10,13 @@ Nitro is a framework-agnostic and deployment-agnostic server framework powered b
1010
1111## Key Scripts
1212
13- - ` pnpm build --stub ` — Fast stub build for development.
14- - ` pnpm lint ` — Lint and format code.
15- - ` pnpm fmt ` — Automatically fix lint and formatting issues.
16- - ` pnpm test ` — Run all tests.
17- - ` pnpm typecheck ` — Run type tests.
13+ - ` pnpm build --stub ` — Fast stub build (` obuild --stub ` ) for development.
14+ - ` pnpm build ` — Full build (` pnpm gen-presets && obuild ` ).
15+ - ` pnpm lint ` — Check lint and formatting (` oxlint ` + ` oxfmt --check ` ).
16+ - ` pnpm fmt ` — Auto-fix lint and formatting (` automd ` + ` oxlint --fix ` + ` oxfmt ` ).
17+ - ` pnpm test ` — Full pipeline: ` lint && build && typecheck && test:rollup && test:rolldown ` (runs vitest against both the rollup and rolldown builders).
18+ - ` pnpm test:rollup ` / ` pnpm test:rolldown ` — Run vitest against a single builder (` NITRO_BUILDER ` ).
19+ - ` pnpm typecheck ` — Type-check with the TypeScript native-preview compiler (` tsgo --noEmit --skipLibCheck ` ).
1820
1921** Always run** ` pnpm fmt ` and ` pnpm typecheck ` after making changes.
2022
@@ -30,10 +32,10 @@ Nitro is a framework-agnostic and deployment-agnostic server framework powered b
3032
3133Project source is centralized under ` src/ ` :
3234
33- - ` src/build ` — Build logic (Vite | Rolldown | Rollup config, virtual templates, plugins).
35+ - ` src/build ` — Build logic (Vite | Rolldown | Rollup config, virtual templates in ` src/build/virtual/ ` , plugins in ` src/build/plugins/ ` ).
3436- ` src/cli ` — ` nitro ` CLI subcommands (each file in ` src/cli/commands ` is a command).
3537- ` src/config/ ` — Config defaults (` src/config/defaults.ts ` ) and resolvers/normalizers (` src/config/resolvers ` ).
36- - ` src/dev ` and ` src/runner ` — Development server logic.
38+ - ` src/dev ` — Development server logic ( ` app.ts ` , ` server.ts ` , ` vfs.ts ` ) .
3739- ` src/prerender ` — Prerender logic.
3840- ` src/presets ` — Deployment presets and runtime entry.
3941- ` src/types ` — Shared types.
@@ -96,11 +98,11 @@ Each preset in `src/presets/` defines deployment target behavior:
9698### Making Changes
9799
981001 . Make changes in ` src/ ` .
99- 2 . Run ` pnpm build -- stub ` if you changed build logic.
101+ 2 . Run ` pnpm stub ` if you changed build logic.
1001023 . Test with ` pnpm test ` .
1011034 . Run ` pnpm fmt ` .
1021045 . Run ` pnpm typecheck ` .
103- 6 . Run ` pnpm vitest run ` .
105+ 6 . Run ` pnpm test:rollup ` and/or ` pnpm test:rolldown ` to run vitest against a specific builder .
104106
105107## Contribution Principles
106108
@@ -115,7 +117,7 @@ Each preset in `src/presets/` defines deployment target behavior:
115117## Common Gotchas
116118
117119- ** Don't use Node.js-specific APIs in ` src/runtime/ ` ** — Code runs in multiple runtimes (Node, workers, edge).
118- - ** Virtual modules must be registered** in ` src/build/virtual.ts ` .
120+ - ** Virtual modules must be registered** in ` src/build/virtual/_all .ts ` (one template per file under ` src/build/virtual/ ` ) .
119121- ** CLI commands** are in ` src/cli/commands/ ` — Each file exports a command definition.
120122- ** Runtime size matters** — Check bundle impact with ` pnpm build ` .
121123- ** Use ` pathe ` not ` node:path ` ** — Ensures cross-platform compatibility.
@@ -160,7 +162,7 @@ Each preset in `src/presets/` defines deployment target behavior:
160162For deeper context, see ` .agents/ ` :
161163
162164- [ ` .agents/architecture.md ` ] ( .agents/architecture.md ) — Full architecture: core instance, build system, config resolution, virtual modules, runtime internals, dev server, routing, key libraries.
163- - [ ` .agents/presets.md ` ] ( .agents/presets.md ) — All 31 presets, preset structure, how to create presets, resolution logic.
165+ - [ ` .agents/presets.md ` ] ( .agents/presets.md ) — All presets (multiple deployment targets + internal ` _nitro ` / ` _static ` ) , preset structure, how to create presets, resolution logic.
164166- [ ` .agents/testing.md ` ] ( .agents/testing.md ) — Test structure, how tests work, adding regression tests, running tests.
165167- [ ` .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.
166168- [ ` .agents/docs.md ` ] ( .agents/docs.md ) — Documentation conventions: structure, preset naming (underscore), H3 v2 API patterns, import paths, common mistakes.
0 commit comments