@finesoft/front 0.1.0 → 0.1.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 +76 -0
- package/dist/index.cjs +1429 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1395 -4
- package/dist/index.d.ts +1395 -4
- package/dist/index.js +1360 -19
- package/dist/index.js.map +1 -1
- package/package.json +21 -8
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# @finesoft/front
|
|
2
|
+
|
|
3
|
+
Full-stack framework for building content-driven web applications with SSR support.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Router** — file-system-style route definitions with intent-driven navigation
|
|
8
|
+
- **DI Container** — lightweight dependency injection for controllers and services
|
|
9
|
+
- **Actions & Intents** — declarative navigation model (FlowAction, ExternalUrlAction)
|
|
10
|
+
- **SSR** — server-side rendering pipeline with data serialization
|
|
11
|
+
- **Server** — one-shot factory for Hono + Vite + SSR (Node / Deno / Bun)
|
|
12
|
+
- **Browser Runtime** — app bootstrap, action handlers, history management
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @finesoft/front
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
### Server
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { createServer } from "@finesoft/front";
|
|
26
|
+
|
|
27
|
+
const { app } = await createServer({
|
|
28
|
+
locales: ["en-US", "zh-CN"],
|
|
29
|
+
defaultLocale: "en-US",
|
|
30
|
+
ssrEntry: "./src/ssr.ts",
|
|
31
|
+
setup(app) {
|
|
32
|
+
// register custom routes on the Hono app
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Browser
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { startBrowserApp, Framework, defineRoutes } from "@finesoft/front";
|
|
41
|
+
|
|
42
|
+
const routes = defineRoutes([
|
|
43
|
+
{ path: "/", intent: "home-page" },
|
|
44
|
+
{ path: "/app/:id", intent: "product-page" },
|
|
45
|
+
]);
|
|
46
|
+
|
|
47
|
+
const framework = new Framework({ routes });
|
|
48
|
+
startBrowserApp({ framework });
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### SSR Entry
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { createSSRRender, serializeServerData } from "@finesoft/front";
|
|
55
|
+
|
|
56
|
+
export const render = createSSRRender({
|
|
57
|
+
/* ... */
|
|
58
|
+
});
|
|
59
|
+
export { serializeServerData };
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## API Overview
|
|
63
|
+
|
|
64
|
+
| Category | Key Exports |
|
|
65
|
+
| -------- | ------------------------------------------------------------------------------- |
|
|
66
|
+
| Core | `Framework`, `Router`, `Container`, `defineRoutes`, `BaseController` |
|
|
67
|
+
| Actions | `ActionDispatcher`, `isFlowAction`, `isExternalUrlAction`, `makeFlowAction` |
|
|
68
|
+
| HTTP | `HttpClient`, `HttpError` |
|
|
69
|
+
| Browser | `startBrowserApp`, `History`, `registerActionHandlers`, `deserializeServerData` |
|
|
70
|
+
| SSR | `createSSRRender`, `ssrRender`, `serializeServerData`, `injectSSRContent` |
|
|
71
|
+
| Server | `createServer`, `createSSRApp`, `startServer`, `parseAcceptLanguage` |
|
|
72
|
+
| Utils | `LruMap`, `buildUrl`, `pipe`, `pipeAsync`, `mapEach` |
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
MIT
|