@jasonshimmy/vite-plugin-cer-app 0.1.0
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/.github/copilot-instructions.md +130 -0
- package/.github/workflows/publish.yml +206 -0
- package/.nvmrc +1 -0
- package/CHANGELOG.md +10 -0
- package/IMPLEMENTATION_PLAN.md +391 -0
- package/README.md +231 -0
- package/VITE_PLUGIN_FRAMEWORK_PLAN.md +594 -0
- package/commits.txt +3 -0
- package/dist/__tests__/plugin/path-utils.test.d.ts +2 -0
- package/dist/__tests__/plugin/path-utils.test.d.ts.map +1 -0
- package/dist/__tests__/plugin/path-utils.test.js +305 -0
- package/dist/__tests__/plugin/path-utils.test.js.map +1 -0
- package/dist/__tests__/plugin/scanner.test.d.ts +2 -0
- package/dist/__tests__/plugin/scanner.test.d.ts.map +1 -0
- package/dist/__tests__/plugin/scanner.test.js +143 -0
- package/dist/__tests__/plugin/scanner.test.js.map +1 -0
- package/dist/__tests__/plugin/transforms/auto-import.test.d.ts +2 -0
- package/dist/__tests__/plugin/transforms/auto-import.test.d.ts.map +1 -0
- package/dist/__tests__/plugin/transforms/auto-import.test.js +151 -0
- package/dist/__tests__/plugin/transforms/auto-import.test.js.map +1 -0
- package/dist/__tests__/plugin/transforms/head-inject.test.d.ts +2 -0
- package/dist/__tests__/plugin/transforms/head-inject.test.d.ts.map +1 -0
- package/dist/__tests__/plugin/transforms/head-inject.test.js +151 -0
- package/dist/__tests__/plugin/transforms/head-inject.test.js.map +1 -0
- package/dist/__tests__/plugin/virtual/components.test.d.ts +2 -0
- package/dist/__tests__/plugin/virtual/components.test.d.ts.map +1 -0
- package/dist/__tests__/plugin/virtual/components.test.js +47 -0
- package/dist/__tests__/plugin/virtual/components.test.js.map +1 -0
- package/dist/__tests__/plugin/virtual/composables.test.d.ts +2 -0
- package/dist/__tests__/plugin/virtual/composables.test.d.ts.map +1 -0
- package/dist/__tests__/plugin/virtual/composables.test.js +48 -0
- package/dist/__tests__/plugin/virtual/composables.test.js.map +1 -0
- package/dist/__tests__/plugin/virtual/layouts.test.d.ts +2 -0
- package/dist/__tests__/plugin/virtual/layouts.test.d.ts.map +1 -0
- package/dist/__tests__/plugin/virtual/layouts.test.js +59 -0
- package/dist/__tests__/plugin/virtual/layouts.test.js.map +1 -0
- package/dist/__tests__/plugin/virtual/middleware.test.d.ts +2 -0
- package/dist/__tests__/plugin/virtual/middleware.test.d.ts.map +1 -0
- package/dist/__tests__/plugin/virtual/middleware.test.js +58 -0
- package/dist/__tests__/plugin/virtual/middleware.test.js.map +1 -0
- package/dist/__tests__/plugin/virtual/plugins.test.d.ts +2 -0
- package/dist/__tests__/plugin/virtual/plugins.test.d.ts.map +1 -0
- package/dist/__tests__/plugin/virtual/plugins.test.js +73 -0
- package/dist/__tests__/plugin/virtual/plugins.test.js.map +1 -0
- package/dist/__tests__/plugin/virtual/routes.test.d.ts +2 -0
- package/dist/__tests__/plugin/virtual/routes.test.d.ts.map +1 -0
- package/dist/__tests__/plugin/virtual/routes.test.js +167 -0
- package/dist/__tests__/plugin/virtual/routes.test.js.map +1 -0
- package/dist/__tests__/plugin/virtual/server-api.test.d.ts +2 -0
- package/dist/__tests__/plugin/virtual/server-api.test.d.ts.map +1 -0
- package/dist/__tests__/plugin/virtual/server-api.test.js +72 -0
- package/dist/__tests__/plugin/virtual/server-api.test.js.map +1 -0
- package/dist/__tests__/runtime/use-head.test.d.ts +2 -0
- package/dist/__tests__/runtime/use-head.test.d.ts.map +1 -0
- package/dist/__tests__/runtime/use-head.test.js +202 -0
- package/dist/__tests__/runtime/use-head.test.js.map +1 -0
- package/dist/__tests__/runtime/use-page-data.test.d.ts +2 -0
- package/dist/__tests__/runtime/use-page-data.test.d.ts.map +1 -0
- package/dist/__tests__/runtime/use-page-data.test.js +41 -0
- package/dist/__tests__/runtime/use-page-data.test.js.map +1 -0
- package/dist/cli/commands/build.d.ts +3 -0
- package/dist/cli/commands/build.d.ts.map +1 -0
- package/dist/cli/commands/build.js +103 -0
- package/dist/cli/commands/build.js.map +1 -0
- package/dist/cli/commands/dev.d.ts +3 -0
- package/dist/cli/commands/dev.d.ts.map +1 -0
- package/dist/cli/commands/dev.js +92 -0
- package/dist/cli/commands/dev.js.map +1 -0
- package/dist/cli/commands/generate.d.ts +7 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/generate.js +72 -0
- package/dist/cli/commands/generate.js.map +1 -0
- package/dist/cli/commands/preview.d.ts +3 -0
- package/dist/cli/commands/preview.d.ts.map +1 -0
- package/dist/cli/commands/preview.js +191 -0
- package/dist/cli/commands/preview.js.map +1 -0
- package/dist/cli/create/index.d.ts +3 -0
- package/dist/cli/create/index.d.ts.map +1 -0
- package/dist/cli/create/index.js +184 -0
- package/dist/cli/create/index.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +17 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin/build-ssg.d.ts +12 -0
- package/dist/plugin/build-ssg.d.ts.map +1 -0
- package/dist/plugin/build-ssg.js +212 -0
- package/dist/plugin/build-ssg.js.map +1 -0
- package/dist/plugin/build-ssr.d.ts +10 -0
- package/dist/plugin/build-ssr.d.ts.map +1 -0
- package/dist/plugin/build-ssr.js +139 -0
- package/dist/plugin/build-ssr.js.map +1 -0
- package/dist/plugin/dev-server.d.ts +46 -0
- package/dist/plugin/dev-server.d.ts.map +1 -0
- package/dist/plugin/dev-server.js +194 -0
- package/dist/plugin/dev-server.js.map +1 -0
- package/dist/plugin/dts-generator.d.ts +27 -0
- package/dist/plugin/dts-generator.d.ts.map +1 -0
- package/dist/plugin/dts-generator.js +180 -0
- package/dist/plugin/dts-generator.js.map +1 -0
- package/dist/plugin/index.d.ts +13 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +298 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/path-utils.d.ts +57 -0
- package/dist/plugin/path-utils.d.ts.map +1 -0
- package/dist/plugin/path-utils.js +160 -0
- package/dist/plugin/path-utils.js.map +1 -0
- package/dist/plugin/scanner.d.ts +17 -0
- package/dist/plugin/scanner.d.ts.map +1 -0
- package/dist/plugin/scanner.js +54 -0
- package/dist/plugin/scanner.js.map +1 -0
- package/dist/plugin/transforms/auto-import.d.ts +14 -0
- package/dist/plugin/transforms/auto-import.d.ts.map +1 -0
- package/dist/plugin/transforms/auto-import.js +154 -0
- package/dist/plugin/transforms/auto-import.js.map +1 -0
- package/dist/plugin/transforms/head-inject.d.ts +29 -0
- package/dist/plugin/transforms/head-inject.d.ts.map +1 -0
- package/dist/plugin/transforms/head-inject.js +127 -0
- package/dist/plugin/transforms/head-inject.js.map +1 -0
- package/dist/plugin/virtual/components.d.ts +6 -0
- package/dist/plugin/virtual/components.d.ts.map +1 -0
- package/dist/plugin/virtual/components.js +22 -0
- package/dist/plugin/virtual/components.js.map +1 -0
- package/dist/plugin/virtual/composables.d.ts +6 -0
- package/dist/plugin/virtual/composables.d.ts.map +1 -0
- package/dist/plugin/virtual/composables.js +22 -0
- package/dist/plugin/virtual/composables.js.map +1 -0
- package/dist/plugin/virtual/error.d.ts +13 -0
- package/dist/plugin/virtual/error.d.ts.map +1 -0
- package/dist/plugin/virtual/error.js +32 -0
- package/dist/plugin/virtual/error.js.map +1 -0
- package/dist/plugin/virtual/layouts.d.ts +6 -0
- package/dist/plugin/virtual/layouts.d.ts.map +1 -0
- package/dist/plugin/virtual/layouts.js +33 -0
- package/dist/plugin/virtual/layouts.js.map +1 -0
- package/dist/plugin/virtual/loading.d.ts +11 -0
- package/dist/plugin/virtual/loading.d.ts.map +1 -0
- package/dist/plugin/virtual/loading.js +30 -0
- package/dist/plugin/virtual/loading.js.map +1 -0
- package/dist/plugin/virtual/middleware.d.ts +6 -0
- package/dist/plugin/virtual/middleware.d.ts.map +1 -0
- package/dist/plugin/virtual/middleware.js +36 -0
- package/dist/plugin/virtual/middleware.js.map +1 -0
- package/dist/plugin/virtual/plugins.d.ts +6 -0
- package/dist/plugin/virtual/plugins.d.ts.map +1 -0
- package/dist/plugin/virtual/plugins.js +30 -0
- package/dist/plugin/virtual/plugins.js.map +1 -0
- package/dist/plugin/virtual/routes.d.ts +16 -0
- package/dist/plugin/virtual/routes.d.ts.map +1 -0
- package/dist/plugin/virtual/routes.js +131 -0
- package/dist/plugin/virtual/routes.js.map +1 -0
- package/dist/plugin/virtual/server-api.d.ts +6 -0
- package/dist/plugin/virtual/server-api.d.ts.map +1 -0
- package/dist/plugin/virtual/server-api.js +41 -0
- package/dist/plugin/virtual/server-api.js.map +1 -0
- package/dist/plugin/virtual/server-middleware.d.ts +6 -0
- package/dist/plugin/virtual/server-middleware.d.ts.map +1 -0
- package/dist/plugin/virtual/server-middleware.js +36 -0
- package/dist/plugin/virtual/server-middleware.js.map +1 -0
- package/dist/runtime/app-template.d.ts +10 -0
- package/dist/runtime/app-template.d.ts.map +1 -0
- package/dist/runtime/app-template.js +143 -0
- package/dist/runtime/app-template.js.map +1 -0
- package/dist/runtime/composables/index.d.ts +4 -0
- package/dist/runtime/composables/index.d.ts.map +1 -0
- package/dist/runtime/composables/index.js +3 -0
- package/dist/runtime/composables/index.js.map +1 -0
- package/dist/runtime/composables/use-head.d.ts +30 -0
- package/dist/runtime/composables/use-head.d.ts.map +1 -0
- package/dist/runtime/composables/use-head.js +182 -0
- package/dist/runtime/composables/use-head.js.map +1 -0
- package/dist/runtime/composables/use-page-data.d.ts +32 -0
- package/dist/runtime/composables/use-page-data.d.ts.map +1 -0
- package/dist/runtime/composables/use-page-data.js +41 -0
- package/dist/runtime/composables/use-page-data.js.map +1 -0
- package/dist/runtime/entry-client-template.d.ts +8 -0
- package/dist/runtime/entry-client-template.d.ts.map +1 -0
- package/dist/runtime/entry-client-template.js +18 -0
- package/dist/runtime/entry-client-template.js.map +1 -0
- package/dist/runtime/entry-server-template.d.ts +9 -0
- package/dist/runtime/entry-server-template.d.ts.map +1 -0
- package/dist/runtime/entry-server-template.js +72 -0
- package/dist/runtime/entry-server-template.js.map +1 -0
- package/dist/types/api.d.ts +16 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/api.js +2 -0
- package/dist/types/api.js.map +1 -0
- package/dist/types/config.d.ts +32 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +4 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/middleware.d.ts +6 -0
- package/dist/types/middleware.d.ts.map +1 -0
- package/dist/types/middleware.js +2 -0
- package/dist/types/middleware.js.map +1 -0
- package/dist/types/page.d.ts +21 -0
- package/dist/types/page.d.ts.map +1 -0
- package/dist/types/page.js +2 -0
- package/dist/types/page.js.map +1 -0
- package/dist/types/plugin.d.ts +12 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/plugin.js +2 -0
- package/dist/types/plugin.js.map +1 -0
- package/docs/cli.md +233 -0
- package/docs/components.md +114 -0
- package/docs/composables.md +99 -0
- package/docs/configuration.md +270 -0
- package/docs/data-loading.md +165 -0
- package/docs/getting-started.md +235 -0
- package/docs/head-management.md +206 -0
- package/docs/layouts.md +112 -0
- package/docs/middleware.md +140 -0
- package/docs/plugins.md +138 -0
- package/docs/rendering-modes.md +251 -0
- package/docs/routing.md +180 -0
- package/docs/server-api.md +172 -0
- package/docs/testing.md +462 -0
- package/package.json +75 -0
- package/src/__tests__/plugin/path-utils.test.ts +399 -0
- package/src/__tests__/plugin/scanner.test.ts +172 -0
- package/src/__tests__/plugin/transforms/auto-import.test.ts +229 -0
- package/src/__tests__/plugin/transforms/head-inject.test.ts +178 -0
- package/src/__tests__/plugin/virtual/components.test.ts +56 -0
- package/src/__tests__/plugin/virtual/composables.test.ts +57 -0
- package/src/__tests__/plugin/virtual/layouts.test.ts +70 -0
- package/src/__tests__/plugin/virtual/middleware.test.ts +68 -0
- package/src/__tests__/plugin/virtual/plugins.test.ts +84 -0
- package/src/__tests__/plugin/virtual/routes.test.ts +202 -0
- package/src/__tests__/plugin/virtual/server-api.test.ts +85 -0
- package/src/__tests__/runtime/use-head.test.ts +243 -0
- package/src/__tests__/runtime/use-page-data.test.ts +45 -0
- package/src/cli/commands/build.ts +114 -0
- package/src/cli/commands/dev.ts +101 -0
- package/src/cli/commands/generate.ts +81 -0
- package/src/cli/commands/preview.ts +218 -0
- package/src/cli/create/index.ts +250 -0
- package/src/cli/create/templates/spa/app/app.ts.tpl +74 -0
- package/src/cli/create/templates/spa/app/layouts/default.ts.tpl +15 -0
- package/src/cli/create/templates/spa/app/pages/index.ts.tpl +8 -0
- package/src/cli/create/templates/spa/cer.config.ts.tpl +6 -0
- package/src/cli/create/templates/spa/index.html.tpl +12 -0
- package/src/cli/create/templates/spa/package.json.tpl +18 -0
- package/src/cli/create/templates/ssg/app/app.ts.tpl +74 -0
- package/src/cli/create/templates/ssg/app/layouts/default.ts.tpl +15 -0
- package/src/cli/create/templates/ssg/app/pages/index.ts.tpl +17 -0
- package/src/cli/create/templates/ssg/cer.config.ts.tpl +13 -0
- package/src/cli/create/templates/ssg/index.html.tpl +12 -0
- package/src/cli/create/templates/ssg/package.json.tpl +19 -0
- package/src/cli/create/templates/ssr/app/app.ts.tpl +74 -0
- package/src/cli/create/templates/ssr/app/layouts/default.ts.tpl +15 -0
- package/src/cli/create/templates/ssr/app/pages/index.ts.tpl +8 -0
- package/src/cli/create/templates/ssr/cer.config.ts.tpl +10 -0
- package/src/cli/create/templates/ssr/index.html.tpl +12 -0
- package/src/cli/create/templates/ssr/package.json.tpl +18 -0
- package/src/cli/index.ts +20 -0
- package/src/index.ts +13 -0
- package/src/plugin/build-ssg.ts +259 -0
- package/src/plugin/build-ssr.ts +147 -0
- package/src/plugin/dev-server.ts +266 -0
- package/src/plugin/dts-generator.ts +214 -0
- package/src/plugin/index.ts +330 -0
- package/src/plugin/path-utils.ts +186 -0
- package/src/plugin/scanner.ts +65 -0
- package/src/plugin/transforms/auto-import.ts +190 -0
- package/src/plugin/transforms/head-inject.ts +161 -0
- package/src/plugin/virtual/components.ts +28 -0
- package/src/plugin/virtual/composables.ts +28 -0
- package/src/plugin/virtual/error.ts +34 -0
- package/src/plugin/virtual/layouts.ts +41 -0
- package/src/plugin/virtual/loading.ts +33 -0
- package/src/plugin/virtual/middleware.ts +45 -0
- package/src/plugin/virtual/plugins.ts +36 -0
- package/src/plugin/virtual/routes.ts +147 -0
- package/src/plugin/virtual/server-api.ts +52 -0
- package/src/plugin/virtual/server-middleware.ts +44 -0
- package/src/runtime/app-template.ts +142 -0
- package/src/runtime/composables/index.ts +3 -0
- package/src/runtime/composables/use-head.ts +204 -0
- package/src/runtime/composables/use-page-data.ts +39 -0
- package/src/runtime/entry-client-template.ts +17 -0
- package/src/runtime/entry-server-template.ts +71 -0
- package/src/types/api.ts +19 -0
- package/src/types/config.ts +39 -0
- package/src/types/index.ts +6 -0
- package/src/types/middleware.ts +16 -0
- package/src/types/page.ts +29 -0
- package/src/types/plugin.ts +13 -0
- package/tsconfig.build.json +10 -0
- package/tsconfig.json +19 -0
- package/vitest.config.ts +29 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Server API Routes
|
|
2
|
+
|
|
3
|
+
Files in `server/api/` define HTTP endpoint handlers. The same file-to-path rules used for pages apply here, with an `/api/` prefix prepended to every route.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Defining handlers
|
|
8
|
+
|
|
9
|
+
Export one function per HTTP method. Method names must be uppercase:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
// server/api/users/index.ts → GET /api/users, POST /api/users
|
|
13
|
+
import type { ApiHandler } from 'vite-plugin-cer-app/types'
|
|
14
|
+
|
|
15
|
+
export const GET: ApiHandler = async (req, res) => {
|
|
16
|
+
const users = await db.user.findAll()
|
|
17
|
+
res.json(users)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const POST: ApiHandler = async (req, res) => {
|
|
21
|
+
const user = await db.user.create(req.body)
|
|
22
|
+
res.status(201).json(user)
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
// server/api/users/[id].ts → GET/PUT/DELETE /api/users/:id
|
|
28
|
+
export const GET: ApiHandler = async (req, res) => {
|
|
29
|
+
const user = await db.user.findById(req.params.id)
|
|
30
|
+
if (!user) return res.status(404).json({ error: 'Not found' })
|
|
31
|
+
res.json(user)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const PUT: ApiHandler = async (req, res) => {
|
|
35
|
+
const updated = await db.user.update(req.params.id, req.body)
|
|
36
|
+
res.json(updated)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const DELETE: ApiHandler = async (req, res) => {
|
|
40
|
+
await db.user.delete(req.params.id)
|
|
41
|
+
res.status(204).end()
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## File → path mapping
|
|
48
|
+
|
|
49
|
+
| File | API path |
|
|
50
|
+
|---|---|
|
|
51
|
+
| `server/api/health.ts` | `/api/health` |
|
|
52
|
+
| `server/api/users/index.ts` | `/api/users` |
|
|
53
|
+
| `server/api/users/[id].ts` | `/api/users/:id` |
|
|
54
|
+
| `server/api/posts/[postId]/comments.ts` | `/api/posts/:postId/comments` |
|
|
55
|
+
|
|
56
|
+
The same transformation rules as page routing apply: `[param]` → `:param`, `index.ts` → strip segment.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## `ApiHandler` signature
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
type ApiHandler = (req: ApiRequest, res: ApiResponse) => void | Promise<void>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### `ApiRequest` (extends `IncomingMessage`)
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
interface ApiRequest extends IncomingMessage {
|
|
70
|
+
params: Record<string, string> // URL path params, e.g. { id: '42' }
|
|
71
|
+
query: Record<string, string> // Parsed query string, e.g. { page: '1' }
|
|
72
|
+
body: unknown // Parsed JSON body (POST/PUT/PATCH only)
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### `ApiResponse` (extends `ServerResponse`)
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
interface ApiResponse extends ServerResponse {
|
|
80
|
+
json(data: unknown): void // Set Content-Type: application/json and send
|
|
81
|
+
status(code: number): ApiResponse // Set status code, chainable
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Error handling
|
|
88
|
+
|
|
89
|
+
Unhandled errors thrown inside a handler are caught and return a 500 JSON response:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{ "error": "Internal Server Error" }
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
For custom error responses, handle errors yourself:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
export const GET: ApiHandler = async (req, res) => {
|
|
99
|
+
try {
|
|
100
|
+
const result = await riskyOperation()
|
|
101
|
+
res.json(result)
|
|
102
|
+
} catch (err) {
|
|
103
|
+
res.status(503).json({ error: 'Service unavailable', message: String(err) })
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Reading the request body
|
|
111
|
+
|
|
112
|
+
For `POST`, `PUT`, and `PATCH` requests with `Content-Type: application/json`, the body is automatically parsed and available as `req.body`:
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
export const POST: ApiHandler = async (req, res) => {
|
|
116
|
+
const { name, email } = req.body as { name: string; email: string }
|
|
117
|
+
// ...
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
For other content types, `req.body` is the raw `Buffer`.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Query parameters
|
|
126
|
+
|
|
127
|
+
Query string parameters are parsed and available as `req.query`:
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
// GET /api/users?page=2&limit=10
|
|
131
|
+
export const GET: ApiHandler = async (req, res) => {
|
|
132
|
+
const page = parseInt(req.query.page ?? '1')
|
|
133
|
+
const limit = parseInt(req.query.limit ?? '20')
|
|
134
|
+
// ...
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Default handler (method-agnostic)
|
|
141
|
+
|
|
142
|
+
Export a `default` function to handle any HTTP method that does not have a named handler:
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
// server/api/webhook.ts
|
|
146
|
+
export default async function handler(req, res) {
|
|
147
|
+
// Handles any method not explicitly exported
|
|
148
|
+
res.json({ received: true })
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Where API routes are registered
|
|
155
|
+
|
|
156
|
+
| Environment | Registration |
|
|
157
|
+
|---|---|
|
|
158
|
+
| **Dev** | Vite `configureServer` middleware — active immediately, hot-reloaded |
|
|
159
|
+
| **SSR production** | Exported from `dist/server/server.js` alongside the SSR handler |
|
|
160
|
+
| **SPA production** | Not included — deploy API routes separately or use a proxy |
|
|
161
|
+
| **SSG production** | Optionally called at build time for data; otherwise deployed separately |
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Virtual module
|
|
166
|
+
|
|
167
|
+
The route map is available via `virtual:cer-server-api`:
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
import apiRoutes from 'virtual:cer-server-api'
|
|
171
|
+
// [{ path: '/api/users', handlers: { get: [Function], post: [Function] } }, ...]
|
|
172
|
+
```
|
package/docs/testing.md
ADDED
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
# Manual Testing Guide
|
|
2
|
+
|
|
3
|
+
This guide walks through how to manually test every major feature of the framework end-to-end.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
Build the plugin first:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
cd /path/to/vite-plugin-cer-app
|
|
13
|
+
npm install
|
|
14
|
+
npm run build
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
All examples below assume the plugin is built and either globally installed or linked.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 1. Scaffold and verify all three modes
|
|
22
|
+
|
|
23
|
+
### Create one app per mode
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
node dist/cli/create/index.js my-spa --mode spa
|
|
27
|
+
node dist/cli/create/index.js my-ssr --mode ssr
|
|
28
|
+
node dist/cli/create/index.js my-ssg --mode ssg
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
In each directory, install dependencies and link the plugin:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
cd my-spa && npm install && npm link /path/to/vite-plugin-cer-app
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Start the dev server
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
npm run dev # opens http://localhost:3000
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Expected:** Browser shows the scaffolded welcome page with the project name. No console errors.
|
|
44
|
+
|
|
45
|
+
### Build and preview
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
npm run build
|
|
49
|
+
npm run preview
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
| Mode | Preview URL | Expected |
|
|
53
|
+
|---|---|---|
|
|
54
|
+
| SPA | `http://localhost:4173` | Index page loads, client-side routing works |
|
|
55
|
+
| SSR | `http://localhost:4173` | Full HTML in `view-source:` (no empty `<div>`) |
|
|
56
|
+
| SSG | `http://localhost:4173` | Same as SSR; `dist/index.html` exists on disk |
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 2. Test file-based routing
|
|
61
|
+
|
|
62
|
+
In any scaffolded app, add pages incrementally and verify route registration.
|
|
63
|
+
|
|
64
|
+
### Static route
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
echo "component('page-about', () => html\`<h1>About</h1>\`)" > app/pages/about.ts
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
1. While dev server is running, open `http://localhost:3000/about`
|
|
71
|
+
2. **Expected:** Page renders. HMR full-reloads automatically when the file is created.
|
|
72
|
+
|
|
73
|
+
### Dynamic route
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
mkdir -p app/pages/blog
|
|
77
|
+
cat > app/pages/blog/[slug].ts << 'EOF'
|
|
78
|
+
component('page-blog-slug', () => {
|
|
79
|
+
const props = useProps({ slug: '' })
|
|
80
|
+
return html`<h1>Post: ${props.slug}</h1>`
|
|
81
|
+
})
|
|
82
|
+
EOF
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
1. Navigate to `http://localhost:3000/blog/hello-world`
|
|
86
|
+
2. **Expected:** Page renders with `Post: hello-world`
|
|
87
|
+
|
|
88
|
+
### Catch-all / 404
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
echo "component('page-all', () => html\`<h1>404</h1>\`)" > app/pages/\[...all\].ts
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
1. Navigate to `http://localhost:3000/this-does-not-exist`
|
|
95
|
+
2. **Expected:** 404 page renders
|
|
96
|
+
|
|
97
|
+
### Route group
|
|
98
|
+
|
|
99
|
+
```sh
|
|
100
|
+
mkdir -p "app/pages/(auth)"
|
|
101
|
+
echo "component('page-login', () => html\`<h1>Login</h1>\`)" > "app/pages/(auth)/login.ts"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
1. Navigate to `http://localhost:3000/login` (not `/auth/login`)
|
|
105
|
+
2. **Expected:** Login page renders at the correct URL
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 3. Test layouts
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
cat > app/layouts/minimal.ts << 'EOF'
|
|
113
|
+
component('layout-minimal', () => {
|
|
114
|
+
return html`<div class="minimal"><slot></slot></div>`
|
|
115
|
+
})
|
|
116
|
+
EOF
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Add to a page:
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
// app/pages/about.ts
|
|
123
|
+
component('page-about', () => html`<h1>About</h1>`)
|
|
124
|
+
|
|
125
|
+
export const meta = { layout: 'minimal' }
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Expected:** The about page is wrapped in `.minimal` without the default header/footer.
|
|
129
|
+
|
|
130
|
+
To verify layout switching works:
|
|
131
|
+
1. Navigate between a page using `default` layout and one using `minimal`
|
|
132
|
+
2. **Expected:** No full-page flash; only the `<slot>` content changes
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 4. Test auto-imports
|
|
137
|
+
|
|
138
|
+
Create a page that uses runtime identifiers without any import statement:
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
// app/pages/counter.ts
|
|
142
|
+
component('page-counter', () => {
|
|
143
|
+
const count = ref(0)
|
|
144
|
+
|
|
145
|
+
return html`
|
|
146
|
+
<div>
|
|
147
|
+
<p>Count: ${count}</p>
|
|
148
|
+
<button @click="${() => count.value++}">+</button>
|
|
149
|
+
</div>
|
|
150
|
+
`
|
|
151
|
+
})
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Expected:** Page works without any `import` statement at the top. The dev server transforms the file to inject imports automatically.
|
|
155
|
+
|
|
156
|
+
To inspect the injection, check the network tab in DevTools — the transformed file will have `import { component, html, ref, ... }` prepended.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## 5. Test components
|
|
161
|
+
|
|
162
|
+
```sh
|
|
163
|
+
cat > app/components/my-badge.ts << 'EOF'
|
|
164
|
+
component('my-badge', () => {
|
|
165
|
+
const props = useProps({ text: '', color: 'blue' })
|
|
166
|
+
return html`<span style="background:${props.color};color:white;padding:2px 6px;border-radius:4px">${props.text}</span>`
|
|
167
|
+
})
|
|
168
|
+
EOF
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Use it in any page (no import needed):
|
|
172
|
+
|
|
173
|
+
```ts
|
|
174
|
+
// app/pages/index.ts
|
|
175
|
+
component('page-index', () => {
|
|
176
|
+
return html`<h1>Hello <my-badge text="World" color="green"></my-badge></h1>`
|
|
177
|
+
})
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Expected:** Badge renders inline on the home page.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## 6. Test composables
|
|
185
|
+
|
|
186
|
+
```sh
|
|
187
|
+
cat > app/composables/useGreeting.ts << 'EOF'
|
|
188
|
+
export function useGreeting(name: string) {
|
|
189
|
+
return `Hello, ${name}!`
|
|
190
|
+
}
|
|
191
|
+
EOF
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
```ts
|
|
195
|
+
// app/pages/index.ts
|
|
196
|
+
import { useGreeting } from 'virtual:cer-composables'
|
|
197
|
+
|
|
198
|
+
component('page-index', () => {
|
|
199
|
+
const greeting = useGreeting('World')
|
|
200
|
+
return html`<h1>${greeting}</h1>`
|
|
201
|
+
})
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Expected:** Page shows "Hello, World!"
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## 7. Test plugins
|
|
209
|
+
|
|
210
|
+
```sh
|
|
211
|
+
cat > app/plugins/01.greeting.ts << 'EOF'
|
|
212
|
+
export default {
|
|
213
|
+
name: 'greeting',
|
|
214
|
+
setup(app) {
|
|
215
|
+
app.provide('greeting', 'Hello from a plugin!')
|
|
216
|
+
},
|
|
217
|
+
}
|
|
218
|
+
EOF
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Use in a page:
|
|
222
|
+
|
|
223
|
+
```ts
|
|
224
|
+
// app/pages/index.ts
|
|
225
|
+
component('page-index', () => {
|
|
226
|
+
const greeting = inject('greeting')
|
|
227
|
+
return html`<p>${greeting}</p>`
|
|
228
|
+
})
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**Expected:** Page shows the injected string.
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## 8. Test route middleware
|
|
236
|
+
|
|
237
|
+
```sh
|
|
238
|
+
cat > app/middleware/auth.ts << 'EOF'
|
|
239
|
+
export default (to, from, next) => {
|
|
240
|
+
const isLoggedIn = !!localStorage.getItem('token')
|
|
241
|
+
if (!isLoggedIn) {
|
|
242
|
+
next('/login')
|
|
243
|
+
} else {
|
|
244
|
+
next()
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
EOF
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Assign to a page:
|
|
251
|
+
|
|
252
|
+
```ts
|
|
253
|
+
// app/pages/dashboard.ts
|
|
254
|
+
component('page-dashboard', () => html`<h1>Dashboard</h1>`)
|
|
255
|
+
export const meta = { middleware: ['auth'] }
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**Testing steps:**
|
|
259
|
+
|
|
260
|
+
1. Navigate to `http://localhost:3000/dashboard` without a `token` in localStorage
|
|
261
|
+
2. **Expected:** Redirected to `/login`
|
|
262
|
+
3. In DevTools console: `localStorage.setItem('token', 'abc')`
|
|
263
|
+
4. Navigate back to `/dashboard`
|
|
264
|
+
5. **Expected:** Dashboard page renders
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## 9. Test server API routes
|
|
269
|
+
|
|
270
|
+
```sh
|
|
271
|
+
mkdir -p server/api
|
|
272
|
+
cat > server/api/health.ts << 'EOF'
|
|
273
|
+
export const GET = (req, res) => {
|
|
274
|
+
res.json({ status: 'ok', time: new Date().toISOString() })
|
|
275
|
+
}
|
|
276
|
+
EOF
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
1. Start the dev server: `npm run dev`
|
|
280
|
+
2. Open `http://localhost:3000/api/health`
|
|
281
|
+
3. **Expected:** `{"status":"ok","time":"..."}` in the browser
|
|
282
|
+
|
|
283
|
+
Test a dynamic route:
|
|
284
|
+
|
|
285
|
+
```sh
|
|
286
|
+
cat > server/api/echo/[msg].ts << 'EOF'
|
|
287
|
+
export const GET = (req, res) => {
|
|
288
|
+
res.json({ echo: req.params.msg, query: req.query })
|
|
289
|
+
}
|
|
290
|
+
EOF
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
1. Open `http://localhost:3000/api/echo/hello?foo=bar`
|
|
294
|
+
2. **Expected:** `{"echo":"hello","query":{"foo":"bar"}}`
|
|
295
|
+
|
|
296
|
+
Test a POST handler:
|
|
297
|
+
|
|
298
|
+
```sh
|
|
299
|
+
curl -X POST http://localhost:3000/api/health \
|
|
300
|
+
-H "Content-Type: application/json" \
|
|
301
|
+
-d '{"name":"test"}'
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
(If no POST handler is defined, nothing responds — add one to verify.)
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## 10. Test server middleware
|
|
309
|
+
|
|
310
|
+
```sh
|
|
311
|
+
cat > server/middleware/cors.ts << 'EOF'
|
|
312
|
+
export default (req, res, next) => {
|
|
313
|
+
res.setHeader('X-Test-Header', 'middleware-works')
|
|
314
|
+
next()
|
|
315
|
+
}
|
|
316
|
+
EOF
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
1. Make any request (e.g. `curl -i http://localhost:3000/api/health`)
|
|
320
|
+
2. **Expected:** Response headers include `X-Test-Header: middleware-works`
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## 11. Test `useHead()`
|
|
325
|
+
|
|
326
|
+
```ts
|
|
327
|
+
// app/pages/about.ts
|
|
328
|
+
import { useHead } from 'vite-plugin-cer-app/composables'
|
|
329
|
+
|
|
330
|
+
component('page-about', () => {
|
|
331
|
+
useHead({
|
|
332
|
+
title: 'About — My App',
|
|
333
|
+
meta: [
|
|
334
|
+
{ name: 'description', content: 'About page description' },
|
|
335
|
+
],
|
|
336
|
+
})
|
|
337
|
+
return html`<h1>About</h1>`
|
|
338
|
+
})
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**Client mode (SPA/dev):**
|
|
342
|
+
1. Navigate to `/about`
|
|
343
|
+
2. **Expected:** Browser tab title changes to "About — My App"; DevTools → Elements → `<head>` contains the meta tag
|
|
344
|
+
|
|
345
|
+
**SSR mode:**
|
|
346
|
+
1. View source of the SSR response (`curl http://localhost:3000/about | head -30`)
|
|
347
|
+
2. **Expected:** `<title>About — My App</title>` and `<meta name="description">` appear inside `<head>` in the raw HTML
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## 12. Test SSR mode end-to-end
|
|
352
|
+
|
|
353
|
+
```sh
|
|
354
|
+
cd my-ssr
|
|
355
|
+
npm run build
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
Inspect the output:
|
|
359
|
+
|
|
360
|
+
```sh
|
|
361
|
+
ls dist/
|
|
362
|
+
# client/ server/
|
|
363
|
+
|
|
364
|
+
node -e "
|
|
365
|
+
const { handler } = await import('./dist/server/server.js')
|
|
366
|
+
const http = await import('node:http')
|
|
367
|
+
http.createServer(handler).listen(3001, () => console.log('http://localhost:3001'))
|
|
368
|
+
" --input-type=module
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
1. Open `http://localhost:3001`
|
|
372
|
+
2. **Expected:** Full page HTML served (view-source shows rendered content, not empty shell)
|
|
373
|
+
3. JavaScript hydrates client-side after load
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
## 13. Test SSG mode
|
|
378
|
+
|
|
379
|
+
```sh
|
|
380
|
+
cd my-ssg
|
|
381
|
+
npm run generate
|
|
382
|
+
# or: npm run build (SSG mode)
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
Inspect output:
|
|
386
|
+
|
|
387
|
+
```sh
|
|
388
|
+
ls dist/
|
|
389
|
+
# index.html client/ server/ ssg-manifest.json
|
|
390
|
+
|
|
391
|
+
cat dist/ssg-manifest.json
|
|
392
|
+
# { "generatedAt": "...", "paths": ["/"], "errors": [] }
|
|
393
|
+
|
|
394
|
+
cat dist/index.html | head -20
|
|
395
|
+
# Full rendered HTML
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
Add a dynamic page with `ssg.paths`:
|
|
399
|
+
|
|
400
|
+
```ts
|
|
401
|
+
// app/pages/items/[id].ts
|
|
402
|
+
component('page-items-id', () => {
|
|
403
|
+
const props = useProps({ id: '' })
|
|
404
|
+
return html`<h1>Item ${props.id}</h1>`
|
|
405
|
+
})
|
|
406
|
+
|
|
407
|
+
export const meta = {
|
|
408
|
+
ssg: {
|
|
409
|
+
paths: async () => [
|
|
410
|
+
{ params: { id: '1' } },
|
|
411
|
+
{ params: { id: '2' } },
|
|
412
|
+
{ params: { id: '3' } },
|
|
413
|
+
],
|
|
414
|
+
},
|
|
415
|
+
}
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Run `npm run generate` again:
|
|
419
|
+
|
|
420
|
+
```sh
|
|
421
|
+
ls dist/items/
|
|
422
|
+
# 1/ 2/ 3/
|
|
423
|
+
|
|
424
|
+
cat dist/items/1/index.html # should contain "Item 1"
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
---
|
|
428
|
+
|
|
429
|
+
## 14. Run the automated test suite
|
|
430
|
+
|
|
431
|
+
The framework ships with 211 unit and integration tests:
|
|
432
|
+
|
|
433
|
+
```sh
|
|
434
|
+
cd /path/to/vite-plugin-cer-app
|
|
435
|
+
npm test
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
Run with coverage report:
|
|
439
|
+
|
|
440
|
+
```sh
|
|
441
|
+
npm run test:coverage
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
Run in watch mode during development:
|
|
445
|
+
|
|
446
|
+
```sh
|
|
447
|
+
npm run test:watch
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
---
|
|
451
|
+
|
|
452
|
+
## Common issues
|
|
453
|
+
|
|
454
|
+
| Symptom | Likely cause | Fix |
|
|
455
|
+
|---|---|---|
|
|
456
|
+
| `Cannot find module 'virtual:cer-routes'` | Plugin not in Vite config | Add `cerApp()` to `vite.config.ts` plugins |
|
|
457
|
+
| Page not found after adding a file | HMR did not trigger | Save the file again or restart dev server |
|
|
458
|
+
| `component is not defined` | Auto-import not running | Check `autoImports.runtime: true` in config; ensure file is in `app/pages/` |
|
|
459
|
+
| SSR renders blank page | `entry-server.ts` not found | Ensure `app/entry-server.ts` exists or let the framework generate it |
|
|
460
|
+
| API route returns 404 in dev | File not in `server/api/` | Confirm path is `server/api/` (at project root, not inside `app/`) |
|
|
461
|
+
| SSG build skips dynamic routes | `meta.ssg.paths` not exported | Export `meta.ssg.paths` from the page file |
|
|
462
|
+
| Layout not applied | `meta.layout` name mismatch | Ensure the value matches the layout filename without extension |
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jasonshimmy/vite-plugin-cer-app",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Nuxt-style meta-framework for @jasonshimmy/custom-elements-runtime",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"web-components",
|
|
8
|
+
"custom-elements",
|
|
9
|
+
"meta-framework",
|
|
10
|
+
"reactive",
|
|
11
|
+
"typescript",
|
|
12
|
+
"frontend",
|
|
13
|
+
"ui"
|
|
14
|
+
],
|
|
15
|
+
"author": "Jason Shimkoski <https://jasonshimmy.com>",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/jshimkoski/vite-plugin-cer-app.git"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/jshimkoski/vite-plugin-cer-app#readme",
|
|
22
|
+
"main": "dist/index.cjs",
|
|
23
|
+
"module": "dist/index.js",
|
|
24
|
+
"types": "dist/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"import": "./dist/index.js",
|
|
28
|
+
"require": "./dist/index.cjs",
|
|
29
|
+
"types": "./dist/index.d.ts"
|
|
30
|
+
},
|
|
31
|
+
"./composables": {
|
|
32
|
+
"import": "./dist/runtime/composables/index.js",
|
|
33
|
+
"require": "./dist/runtime/composables/index.cjs",
|
|
34
|
+
"types": "./dist/runtime/composables/index.d.ts"
|
|
35
|
+
},
|
|
36
|
+
"./types": {
|
|
37
|
+
"import": "./dist/types/index.js",
|
|
38
|
+
"require": "./dist/types/index.cjs",
|
|
39
|
+
"types": "./dist/types/index.d.ts"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"bin": {
|
|
43
|
+
"cer-app": "./dist/cli/index.js",
|
|
44
|
+
"create-cer-app": "./dist/cli/create/index.js"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsc -p tsconfig.build.json",
|
|
48
|
+
"dev": "tsc -p tsconfig.build.json --watch",
|
|
49
|
+
"test": "vitest run",
|
|
50
|
+
"test:watch": "vitest",
|
|
51
|
+
"test:coverage": "vitest run --coverage"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"@jasonshimmy/custom-elements-runtime": ">=3.0.0",
|
|
55
|
+
"vite": ">=5.0.0"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"commander": "^14.0.3",
|
|
59
|
+
"fast-glob": "^3.3.2",
|
|
60
|
+
"magic-string": "^0.30.10",
|
|
61
|
+
"pathe": "^2.0.3"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@jasonshimmy/custom-elements-runtime": "^3.1.3",
|
|
65
|
+
"@types/node": "^25.5.0",
|
|
66
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
67
|
+
"happy-dom": "^20.8.4",
|
|
68
|
+
"typescript": "^5.4.0",
|
|
69
|
+
"vite": "^8.0.0",
|
|
70
|
+
"vitest": "^4.1.0"
|
|
71
|
+
},
|
|
72
|
+
"publishConfig": {
|
|
73
|
+
"access": "public"
|
|
74
|
+
}
|
|
75
|
+
}
|