@mrmt/vite
Composable Vite plugins that handle the boring parts of building a TypeScript library: entry discovery, type declarations, externals, an embedded documentation site and a generated API reference.
sh
npm install --save-dev @mrmt/vite vite typescriptts
// vite.config.ts
import { defineConfig } from "vite";
import { Lib } from "@mrmt/vite/lib";
export default defineConfig({ plugins: Lib() });What's inside
| Import path | What it gives you | Read |
|---|---|---|
@mrmt/vite/lib | Lib(), LibConfig(): build an ESM TypeScript library | Building a library |
@mrmt/vite/docs | Docs(): a VitePress site embedded in your Vite server (included in Lib) | Documentation plugin |
@mrmt/vite/dts | dts(), getDTSPlugin(): declaration files | API reference |
@mrmt/vite/lib/context | VitePluginContext, contextFactory(): path resolution for your own plugins | API reference |
@mrmt/vite/codegen | registerCommentTypeResolver(): teach generated-file headers new comment syntaxes | API reference |
@mrmt/vite/base-config | BaseConfig(), BaseBundle(): the shared baseline | API reference |
@mrmt/vite/package-meta | PackageMeta(): injects the package name and version | API reference |
Lib() is a bundle of lower-level plugins, including the TypeDoc plugin from @mrmt/unplugin-typedoc. Vue and Vuetify projects use @mrmt/vite-ui instead.
The api/ pages are generated by the build (vp run build): they don't exist on a fresh checkout.