@forinda/kickjs-vite 2.1.0 → 2.2.1
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 +85 -0
- package/dist/index.mjs +1 -1
- package/package.json +30 -7
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# @forinda/kickjs-vite
|
|
2
|
+
|
|
3
|
+
Vite plugin for KickJS — single-port dev server, HMR, virtual modules, and
|
|
4
|
+
`http.Server` piping for adapters (WebSocket, GraphQL subscriptions, etc.).
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pnpm add -D @forinda/kickjs-vite vite unplugin-swc
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`vite` (>=6) and `express` (^5) are peer dependencies.
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
// vite.config.ts
|
|
18
|
+
import { defineConfig } from 'vite'
|
|
19
|
+
import { kickjsVitePlugin } from '@forinda/kickjs-vite'
|
|
20
|
+
import swc from 'unplugin-swc'
|
|
21
|
+
|
|
22
|
+
export default defineConfig({
|
|
23
|
+
plugins: [
|
|
24
|
+
swc.vite({ tsconfigFile: 'tsconfig.json' }),
|
|
25
|
+
kickjsVitePlugin({ entry: 'src/index.ts' }),
|
|
26
|
+
],
|
|
27
|
+
})
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
// src/index.ts
|
|
32
|
+
import { bootstrap } from '@forinda/kickjs'
|
|
33
|
+
import express from 'express'
|
|
34
|
+
import { UserModule } from './modules/users/user.module'
|
|
35
|
+
|
|
36
|
+
// Export the app — Vite serves it in dev, you start it in prod
|
|
37
|
+
export const app = bootstrap({
|
|
38
|
+
modules: [UserModule],
|
|
39
|
+
middleware: [express.json()],
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
if (process.env.NODE_ENV === 'production') {
|
|
43
|
+
app.start()
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Then run `vite` (or `kick dev`) and the Express app is mounted on Vite's HTTP
|
|
48
|
+
server. Edits trigger selective HMR — only the affected modules re-register in
|
|
49
|
+
the DI container, so DB pools, Redis clients, and WebSocket connections stay
|
|
50
|
+
alive across reloads.
|
|
51
|
+
|
|
52
|
+
## What you get
|
|
53
|
+
|
|
54
|
+
- **Single-port dev server** — Express is mounted on Vite's HTTP server, so
|
|
55
|
+
one URL serves both your API and any Vite-managed assets.
|
|
56
|
+
- **Selective HMR** — only changed modules re-register in the KickJS
|
|
57
|
+
container; DB pools, Redis clients, and WebSocket connections stay alive
|
|
58
|
+
across reloads.
|
|
59
|
+
- **Adapter-friendly** — KickJS adapters (`WsAdapter`, GraphQL subscriptions,
|
|
60
|
+
etc.) attach to the dev `http.Server` through the standard
|
|
61
|
+
`afterStart({ server })` hook with zero extra wiring.
|
|
62
|
+
- **Auto-generated entry** — discovered modules are wired into the app
|
|
63
|
+
automatically; no manual entry boilerplate.
|
|
64
|
+
|
|
65
|
+
## Options
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
interface KickJSPluginOptions {
|
|
69
|
+
/** Path to app entry file, relative to Vite root. Default: 'src/index.ts' */
|
|
70
|
+
entry?: string
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## With the CLI
|
|
75
|
+
|
|
76
|
+
If you use `kick dev` from `@forinda/kickjs-cli`, this plugin is wired up
|
|
77
|
+
automatically — no manual `vite.config.ts` is required for typical projects.
|
|
78
|
+
|
|
79
|
+
## Documentation
|
|
80
|
+
|
|
81
|
+
[Full documentation](https://github.com/forinda/kick-js)
|
|
82
|
+
|
|
83
|
+
## License
|
|
84
|
+
|
|
85
|
+
MIT
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,19 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forinda/kickjs-vite",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Vite plugin for KickJS — dev server integration, HMR, virtual modules, httpServer piping",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kickjs",
|
|
7
|
+
"nodejs",
|
|
8
|
+
"typescript",
|
|
9
|
+
"express",
|
|
10
|
+
"decorators",
|
|
11
|
+
"dependency-injection",
|
|
12
|
+
"backend",
|
|
13
|
+
"api",
|
|
14
|
+
"framework",
|
|
7
15
|
"vite",
|
|
8
16
|
"vite-plugin",
|
|
9
17
|
"hmr",
|
|
10
18
|
"hot-module-replacement",
|
|
11
19
|
"dev-server",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
20
|
+
"@forinda/kickjs",
|
|
21
|
+
"@forinda/kickjs-auth",
|
|
22
|
+
"@forinda/kickjs-cli",
|
|
23
|
+
"@forinda/kickjs-config",
|
|
24
|
+
"@forinda/kickjs-core",
|
|
25
|
+
"@forinda/kickjs-cron",
|
|
26
|
+
"@forinda/kickjs-devtools",
|
|
27
|
+
"@forinda/kickjs-drizzle",
|
|
28
|
+
"@forinda/kickjs-graphql",
|
|
29
|
+
"@forinda/kickjs-http",
|
|
30
|
+
"@forinda/kickjs-mailer",
|
|
31
|
+
"@forinda/kickjs-multi-tenant",
|
|
32
|
+
"@forinda/kickjs-notifications",
|
|
33
|
+
"@forinda/kickjs-otel",
|
|
34
|
+
"@forinda/kickjs-prisma",
|
|
35
|
+
"@forinda/kickjs-queue",
|
|
36
|
+
"@forinda/kickjs-swagger",
|
|
37
|
+
"@forinda/kickjs-testing",
|
|
38
|
+
"@forinda/kickjs-vite",
|
|
39
|
+
"@forinda/kickjs-ws"
|
|
17
40
|
],
|
|
18
41
|
"type": "module",
|
|
19
42
|
"main": "dist/index.mjs",
|
|
@@ -45,7 +68,7 @@
|
|
|
45
68
|
}
|
|
46
69
|
},
|
|
47
70
|
"dependencies": {
|
|
48
|
-
"@forinda/kickjs": "2.1
|
|
71
|
+
"@forinda/kickjs": "2.2.1"
|
|
49
72
|
},
|
|
50
73
|
"peerDependencies": {
|
|
51
74
|
"vite": ">=6.0.0",
|