一键导入
zod-to-form-vite
Documentation site for zod-to-form (Docusaurus 3 + TypeDoc) Use when: You want `import SignupForm from './signup.schema?z2f'` to Just Work in a....
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Documentation site for zod-to-form (Docusaurus 3 + TypeDoc) Use when: You want `import SignupForm from './signup.schema?z2f'` to Just Work in a....
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Configuration for zod-to-form code generation (defineConfig / z2f.config.ts): component library, generation defaults, file selection, and per-schema overrides. Also: zod, zod-v4, forms, form-generation, schema, schema-walker, processor-registry, react-hook-form, schema-driven, form-schema, zod-registry.
Documentation site for zod-to-form (Docusaurus 3 + TypeDoc) Use when: Building a custom codegen pipeline that assembles `FormField[]` and needs the....
Documentation site for zod-to-form (Docusaurus 3 + TypeDoc) Use when: You need programmatic codegen from a Node.js script or build tool (not just....
Documentation site for zod-to-form (Docusaurus 3 + TypeDoc) Use when: You want per-field validation instead of whole-form validation.
Documentation site for zod-to-form (Docusaurus 3 + TypeDoc) Use when: You need form rendering in storybook, playgrounds, or low-traffic admin UIs —....
Use when working with zod-to-form (core, react, cli, codegen, vite).
| description | Documentation site for zod-to-form (Docusaurus 3 + TypeDoc) Use when: You want `import SignupForm from './signup.schema?z2f'` to Just Work in a.... |
| name | zod-to-form-vite |
Documentation site for zod-to-form (Docusaurus 3 + TypeDoc)
Two modes: ?z2f query imports (transform per-import, HMR works) vs generate mode
(static JSX rewriting, no HMR integration). Use ?z2f for new forms, generate for
migrating existing <ZodForm> call sites.
Use this skill when:
import SignupForm from './signup.schema?z2f' to Just Work in a Vite app → use z2fVite — the plugin intercepts the import and compiles the form on demandz2fVite — only the affected virtual modules are invalidated<ZodForm> call sites → use z2fVite — opt in via generate: {} in plugin optionsexpect(fn).toThrow(/Z2F_VITE_/)) → use Z2FViteErrorZ2FViteErrorDo NOT use when:
@zod-to-form/cli instead (z2fVite)z2fVite)z2fVite)Error or your own error hierarchy for application errors (Z2FViteError)API surface: 2 functions, 1 classes, 6 types
?z2f on schemas with cyclic type references — the schema walker recurses on Zod's internal type graph and hangs with no error or timeout; FIX: break cycles with z.lazy() before using the ?z2f importgenerate mode and then rely on HMR without testing — the generate-mode transform cache does not integrate with Vite's standard HMR module invalidation for rewritten JSX files; FIX: disable generate mode during development and only enable it in production buildsconfigPath to point outside the Vite root — the plugin uses ssrLoadModule with a dev server scoped to root, so files outside that boundary may fail to resolve their own imports; FIX: move the config into the Vite root or set root to include it — produces Z2F_VITE_SCHEMA_OUTSIDE_ROOT errorerror.message to detect error type — the [Z2F_VITE_...] prefix in the message is an implementation detail and may change; FIX: always check error.code (e.g. error.code === 'Z2F_VITE_SCHEMA_NOT_FOUND') for stable, semver-stable matching4 configuration interfaces — see references/config.md for details.
Plugin: z2fVite (Vite plugin factory for @zod-to-form/vite)
Errors: formatZ2FViteError (Format a Z2FViteError for inclusion in a Vite error overlay or terminal output), Z2FViteError (Structured error thrown by the @zod-to-form/vite plugin), Z2FViteErrorLocation (Source location attached to a Z2FViteError for IDE navigation and Vite overlay display)
types: GenerationTarget (A single (schema, variant, config) triple that produces exactly one
generated form), CompilationEntry (One cached compilation result), GenerateSite (A single <ZodForm> JSX element matched by generate mode), HMRInvalidationMap (The graph edges that handleHotUpdate walks when a watched file changes)
errors: Z2FViteErrorCode (Plugin error classes)
Load these on demand — do NOT read all at once:
references/functions.md for full signatures, parameters, and return typesreferences/classes.md for properties, methods, and inheritancereferences/types.mdreferences/config.md for all settings and defaults