@alxia/react-router 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +289 -2
- package/dist/assets.d.ts +12 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/chunks/index-kfekhvgr.js +31 -0
- package/dist/chunks/index-kfekhvgr.js.map +10 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +160 -0
- package/dist/cli/index.js.map +13 -0
- package/dist/cli/main.d.ts +9 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/reveal.d.ts +18 -0
- package/dist/cli/reveal.d.ts.map +1 -0
- package/dist/cli/template.d.ts +8 -0
- package/dist/cli/template.d.ts.map +1 -0
- package/dist/context.d.ts +70 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +166 -0
- package/dist/index.js.map +13 -0
- package/dist/react-router.d.ts +61 -0
- package/dist/react-router.d.ts.map +1 -0
- package/dist/server.d.ts +99 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/vite/config.d.ts +33 -0
- package/dist/vite/config.d.ts.map +1 -0
- package/dist/vite/dev.d.ts +23 -0
- package/dist/vite/dev.d.ts.map +1 -0
- package/dist/vite/entry.d.ts +20 -0
- package/dist/vite/entry.d.ts.map +1 -0
- package/dist/vite/index.d.ts +33 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +391 -0
- package/dist/vite/index.js.map +16 -0
- package/dist/vite/node.d.ts +16 -0
- package/dist/vite/node.d.ts.map +1 -0
- package/dist/vite/preview.d.ts +8 -0
- package/dist/vite/preview.d.ts.map +1 -0
- package/dist/vite/runtime.d.ts +8 -0
- package/dist/vite/runtime.d.ts.map +1 -0
- package/dist/vite/socket.d.ts +68 -0
- package/dist/vite/socket.d.ts.map +1 -0
- package/docs/README.md +12 -0
- package/docs/guide.md +843 -0
- package/docs/roadmap.md +96 -0
- package/docs/troubleshooting.md +832 -0
- package/package.json +77 -5
package/docs/roadmap.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Roadmap
|
|
2
|
+
|
|
3
|
+
What `@alxia/react-router` gives an app, and what is coming. This page is
|
|
4
|
+
a direction, not a commitment: the version something shipped in is the only
|
|
5
|
+
number on it. Every release, with each change it made, is in
|
|
6
|
+
[`CHANGELOG.md`](https://github.com/softistx/alxia/blob/develop/packages/react-router/CHANGELOG.md).
|
|
7
|
+
|
|
8
|
+
## Now
|
|
9
|
+
|
|
10
|
+
Nothing scheduled yet.
|
|
11
|
+
|
|
12
|
+
## Next
|
|
13
|
+
|
|
14
|
+
- **A per-request CSP nonce.** `@alxia/secure-headers` and React Router's
|
|
15
|
+
`<Scripts nonce>` sharing one nonce, so a page's policy needs no
|
|
16
|
+
`'unsafe-inline'`.
|
|
17
|
+
|
|
18
|
+
## Later
|
|
19
|
+
|
|
20
|
+
- **`ctx.server` under `react-router dev`.** An HTTP request reaches the
|
|
21
|
+
app through `app.fetch`, so `ctx.server` and `page()` wait for the build;
|
|
22
|
+
a socket's upgrade already has its server.
|
|
23
|
+
- **The logger's duration of a streamed page**, to its last byte rather
|
|
24
|
+
than its first.
|
|
25
|
+
- **A React Router `basename`**, the app served under a path.
|
|
26
|
+
- **One file**, `bun build --compile`, holding the server and the build.
|
|
27
|
+
|
|
28
|
+
## Not planned
|
|
29
|
+
|
|
30
|
+
- **React Router 7.** Its loaders' context is a `RouterContextProvider`
|
|
31
|
+
only behind `future.v8_middleware`, and the line is in maintenance.
|
|
32
|
+
- **Node or Cloudflare.** alxia is a Bun framework; React Router's own
|
|
33
|
+
adapters serve those runtimes.
|
|
34
|
+
- **The pages in the route table.** Documents and single-fetch data are not
|
|
35
|
+
something the typed client calls, so the catch-all stays out of
|
|
36
|
+
`RoutesOf`.
|
|
37
|
+
- **A runtime dependency.** The package declares none: `@alxia/core` and
|
|
38
|
+
`react-router` are peers.
|
|
39
|
+
- **A `react-router-serve` of its own.** `bun build/server/index.js` is the
|
|
40
|
+
server; there is no separate command to serve a build.
|
|
41
|
+
- **A `reveal folder` target.** react-router-hono-server's `reveal folder`
|
|
42
|
+
writes `app/server/index.ts`. Here the plugin reads `app/server.ts` or
|
|
43
|
+
the file `alxia({ entry })` names, and `reveal` writes that file:
|
|
44
|
+
`alxia({ entry: 'app/server/index.ts' })` gives the folder form.
|
|
45
|
+
- **Several runtimes from one plugin.** react-router-hono-server picks Node,
|
|
46
|
+
Bun, Deno or Cloudflare with a `runtime` option; alxia is Bun's.
|
|
47
|
+
|
|
48
|
+
## Shipped
|
|
49
|
+
|
|
50
|
+
### 0.1.0
|
|
51
|
+
|
|
52
|
+
- **React Router as a catch-all.** `reactRouter(app, { build })` serves
|
|
53
|
+
documents, single-fetch data, actions, redirects with every cookie, lazy
|
|
54
|
+
route discovery and the error pages, behind every hook declared before
|
|
55
|
+
it, streamed as React renders them.
|
|
56
|
+
- **The context, typed.** `alxiaOf<App>(context)` reads what alxia's hooks
|
|
57
|
+
built in any loader, action or middleware, through a key that is one
|
|
58
|
+
object however the server was built; `getLoadContext` sets the app's own
|
|
59
|
+
keys.
|
|
60
|
+
- **The client's files.** `client` serves `assets/` immutable and the
|
|
61
|
+
copies of `public/` with an hour's cache, through the core's `static` and
|
|
62
|
+
`file`.
|
|
63
|
+
- **`HEAD` with headers.** A `HEAD` is answered as its `GET`, less the
|
|
64
|
+
body.
|
|
65
|
+
- **OpenAPI.** `isReactRouterRoute` leaves the catch-all and the client's
|
|
66
|
+
files out of `@alxia/openapi`'s document.
|
|
67
|
+
- **Zero config, with Vite.** `@alxia/react-router/vite`'s `alxia()`,
|
|
68
|
+
anywhere in `plugins`, is all an app from the official template needs.
|
|
69
|
+
Without `app/server.ts` a default server serves the pages; with it,
|
|
70
|
+
`createServer({ beforeAll, configure, getLoadContext, … })` customises
|
|
71
|
+
the app, and the plugin wires React Router's build, the mode and the
|
|
72
|
+
client folder. Under `react-router dev` the server is loaded through
|
|
73
|
+
Vite's SSR runner, with HMR, its own edits live and the app's context keys
|
|
74
|
+
shared. `react-router build` makes `build/server/index.js` the server,
|
|
75
|
+
prerendering included: run, it listens on `PORT` and `HOST` and stops on
|
|
76
|
+
`SIGTERM`; imported, it starts nothing.
|
|
77
|
+
- **`vite preview` serves the built server.** After `react-router build`,
|
|
78
|
+
`bunx --bun vite preview` hands every request to `build/server/index.js`,
|
|
79
|
+
as `bun run start` would answer it: the pages, `/api`, the client's files
|
|
80
|
+
and the app's hooks. React Router's prerendering runs on the same
|
|
81
|
+
server, so a prerendered page's loader reads `alxiaOf`.
|
|
82
|
+
- **`bunx alxia-react-router reveal`.** The package's bin writes the
|
|
83
|
+
default server into the app, `app/server.ts` or `alxia({ entry })`'s
|
|
84
|
+
file: `createServer()` with `beforeAll`, `configure` and
|
|
85
|
+
`getLoadContext` commented, and the `Register` declaration. It refuses
|
|
86
|
+
to overwrite a file already there unless given `--force`, and runs under
|
|
87
|
+
Bun with no Node.
|
|
88
|
+
- **WebSockets in dev and preview.** An alxia `ws` route connects under
|
|
89
|
+
`react-router dev` and `vite preview` as from the build, with nothing to
|
|
90
|
+
configure: the plugin relays each upgrade Vite does not claim (HMR, its
|
|
91
|
+
proxy) to a `Bun.serve` of the app, so its hooks, refusals,
|
|
92
|
+
`socket.data` and handlers run as `listen` runs them, and in dev an edit
|
|
93
|
+
to the server is used from the next connection.
|
|
94
|
+
- **Loaders typed with no type argument.** A `Register` declaration beside
|
|
95
|
+
the server types `alxiaOf(context)`; `alxiaOf<typeof server>` and an app
|
|
96
|
+
still work, and with neither it is `BaseContext`.
|