@catmint/vite 0.0.0-prealpha.1 → 0.0.0-prealpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @catmint/vite
|
|
2
|
+
|
|
3
|
+
Vite plugin for the [Catmint](https://github.com/darylcecile/catmint) framework.
|
|
4
|
+
|
|
5
|
+
Handles server/client boundary enforcement, server function transforms, MDX compilation, environment variable injection, route type generation, middleware composition, and RSC dev server with streaming.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add -D @catmint/vite
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
// vite.config.ts
|
|
17
|
+
import { defineConfig } from "vite";
|
|
18
|
+
import catmint from "@catmint/vite";
|
|
19
|
+
|
|
20
|
+
export default defineConfig({
|
|
21
|
+
plugins: [catmint()],
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Options
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
catmint({
|
|
29
|
+
configPath: "./catmint.config.ts", // Path to config file
|
|
30
|
+
appDir: "app", // Application source directory
|
|
31
|
+
mdx: true, // Enable MDX support (default: true)
|
|
32
|
+
rsc: true, // Enable React Server Components (default: true)
|
|
33
|
+
softNavigation: true, // Enable client-side navigation (default: true)
|
|
34
|
+
optimizeMiddleware: true, // Compose middleware at build time
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## What It Does
|
|
39
|
+
|
|
40
|
+
- **Boundary enforcement** -- validates `"use client"` / `"use server"` directives, auto-injects directives for `*.client.tsx` and `error.tsx` files, blocks `env.private` access in client code
|
|
41
|
+
- **Server function transforms** -- rewrites `createServerFn` calls to fetch stubs on the client while preserving the handler on the server
|
|
42
|
+
- **Environment variable transforms** -- replaces `env.public.*` with literal values and `env.location` with the current mode
|
|
43
|
+
- **Route type generation** -- scans `app/` and generates `.catmint/routes.d.ts` for type-safe routing
|
|
44
|
+
- **Middleware composition** -- optionally composes middleware chains into single functions at build time
|
|
45
|
+
- **MDX support** -- compiles `.mdx` files to React components via `@mdx-js/mdx`
|
|
46
|
+
- **Dev server** -- RSC streaming, SSR hydration, HMR
|
|
47
|
+
|
|
48
|
+
## Requirements
|
|
49
|
+
|
|
50
|
+
- Vite 6
|
|
51
|
+
- Node.js >= 20
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
GNU General Public License v2
|