@raven.js/cli 1.2.2 → 1.2.3
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/dist/registry.json
CHANGED
|
@@ -7,8 +7,9 @@ To understand the architecture, concepts, API, and usage, read:
|
|
|
7
7
|
|
|
8
8
|
# OPTIONAL READING
|
|
9
9
|
|
|
10
|
-
| Document
|
|
11
|
-
|
|
12
|
-
| [PLUGIN.md](./PLUGIN.md)
|
|
13
|
-
| [router.ts](./router.ts)
|
|
14
|
-
| [standard-schema.ts](./standard-schema.ts)
|
|
10
|
+
| Document | Read when… |
|
|
11
|
+
| ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
12
|
+
| [PLUGIN.md](./PLUGIN.md) | You are creating a plugin — covers `definePlugin`, all three state patterns, and plugin-specific gotchas. |
|
|
13
|
+
| [router.ts](./router.ts) | You need to understand or extend route matching (Radix tree, path params, wildcards). |
|
|
14
|
+
| [standard-schema.ts](./standard-schema.ts) | You need to integrate validation (Zod, Valibot) or implement Standard Schema–compatible validation. |
|
|
15
|
+
| [Bun Full Stack Documentation](https://bun.com/docs/bundler/fullstack.md) | If you need to understand how to use Bun's full stack features |
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
RavenJS Core is a lightweight, high-performance Web framework reference implementation for Bun.
|
|
4
4
|
|
|
5
5
|
**Features**:
|
|
6
|
+
|
|
6
7
|
- Logic layer: `app.handle` (FetchHandler)
|
|
7
8
|
- Radix tree router (path parameters)
|
|
8
9
|
- Dependency injection (DI) via AsyncLocalStorage (ScopedState)
|
|
@@ -70,6 +71,24 @@ app.get("/", () => new Response("Hello"));
|
|
|
70
71
|
Bun.serve({ fetch: (req) => app.handle(req) });
|
|
71
72
|
```
|
|
72
73
|
|
|
74
|
+
Because Raven is a logic layer, you can combine it with [Bun's Fullstack Dev Server](https://bun.com/docs/bundler/fullstack.md) to serve HTML routes and bundled frontend assets alongside API routes:
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { Raven } from "@raven.js/core";
|
|
78
|
+
import homepage from "./index.html";
|
|
79
|
+
|
|
80
|
+
const app = new Raven();
|
|
81
|
+
|
|
82
|
+
app.get("/api/hello", () => Response.json({ message: "Hello" }));
|
|
83
|
+
|
|
84
|
+
Bun.serve({
|
|
85
|
+
routes: {
|
|
86
|
+
"/": homepage,
|
|
87
|
+
"/api/*": (req) => app.handle(req),
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
```
|
|
91
|
+
|
|
73
92
|
## Context
|
|
74
93
|
|
|
75
94
|
The per-request context object, exposing `request`, `params`, `query`, `url`, `method`, `headers`, and `body`.
|
|
@@ -190,13 +209,15 @@ const dbState = createAppState<DB>({ name: "db" });
|
|
|
190
209
|
dbState.set(db);
|
|
191
210
|
|
|
192
211
|
// ✓ Correct: called inside plugin load()
|
|
193
|
-
await app.register(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
212
|
+
await app.register(
|
|
213
|
+
definePlugin({
|
|
214
|
+
name: "db",
|
|
215
|
+
states: [],
|
|
216
|
+
load(app) {
|
|
217
|
+
dbState.set(db);
|
|
218
|
+
},
|
|
219
|
+
}),
|
|
220
|
+
);
|
|
200
221
|
```
|
|
201
222
|
|
|
202
223
|
## 4. `BodyState` only parses JSON
|