@k8ordo/framework 1.2.0 → 1.3.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/README.md +2 -2
- package/dist/runtime/app-router.d.mts +3 -2
- package/dist/runtime/app-router.mjs +31 -21
- package/dist/runtime/browser-payloads.mjs +3 -2
- package/dist/runtime/client-ready.d.mts +12 -8
- package/dist/runtime/client-ready.mjs +25 -14
- package/dist/runtime/entry.browser.mjs +1 -1
- package/dist/runtime/entry.rsc.mjs +17 -4
- package/dist/runtime/entry.ssr.d.mts +2 -1
- package/dist/runtime/entry.ssr.mjs +67 -13
- package/dist/runtime/payload.d.mts +37 -0
- package/dist/runtime/payload.mjs +27 -1
- package/dist/runtime/tree-pathname.d.mts +4 -0
- package/dist/runtime/tree-pathname.mjs +12 -0
- package/dist/vite.mjs +259 -51
- package/docs/llms.txt +9 -5
- package/docs/references/boundaries.md +5 -2
- package/docs/references/csp.md +29 -2
- package/docs/references/errors.md +34 -0
- package/docs/references/routing.md +41 -2
- package/package.json +4 -4
|
@@ -101,12 +101,26 @@ as it checks every route file's.
|
|
|
101
101
|
**Each page loads its own.** `page.tsx`, `not-found.tsx`, `route.ts` and
|
|
102
102
|
`fallback.tsx` are imported when a request reaches them, so the client
|
|
103
103
|
components each renders and the CSS each imports — its Server Components'
|
|
104
|
-
CSS Modules included —
|
|
104
|
+
CSS Modules included — are loaded only once a page renders it, or, for a
|
|
105
|
+
client component, once a link to such a page is fetched ahead
|
|
106
|
+
([Fetching the next page ahead](#fetching-the-next-page-ahead)). What a
|
|
105
107
|
`layout.tsx`, `error.tsx` or `loading.tsx` imports, every page below it
|
|
106
108
|
loads: import CSS every page needs in the root layout. A route file imported
|
|
107
109
|
from anywhere else — a layout importing an export of a page — is in every
|
|
108
110
|
page again, and the build warns, naming it.
|
|
109
111
|
|
|
112
|
+
**What every page loads comes in at most two files.** The client entry's —
|
|
113
|
+
React, the router and the framework's own code — and the frame's: the
|
|
114
|
+
client components of every `layout.tsx`, `error.tsx` and `loading.tsx`, and
|
|
115
|
+
the framework's own boundaries, with everything they import. A module a page
|
|
116
|
+
shares with the entry or the frame is in that file, since every page loads
|
|
117
|
+
it anyway; what pages share only among themselves stays in files of their
|
|
118
|
+
own, loaded by the pages that render it. The framework sets the client
|
|
119
|
+
build's `build.rolldownOptions.output.codeSplitting` to do this, so in the
|
|
120
|
+
client environment an application's own `manualChunks` is ignored, and a
|
|
121
|
+
`codeSplitting` group of its own takes a module from the entry or the frame
|
|
122
|
+
only with a `priority` above `2`.
|
|
123
|
+
|
|
110
124
|
**Under `mode: 'server'` an async page answers, then streams.** The document
|
|
111
125
|
waits for the page's own component — its data — before anything is sent,
|
|
112
126
|
because the page may still say `notFound()`
|
|
@@ -127,6 +141,28 @@ it arrives.
|
|
|
127
141
|
`<Suspense>` boundary on the page and writes each in place, so a file never
|
|
128
142
|
carries a hole for a script to fill after hydration has started.
|
|
129
143
|
|
|
144
|
+
**A Server Component's stylesheet comes before a client component's.** In
|
|
145
|
+
`<head>`, every stylesheet Server Components import — the root layout's
|
|
146
|
+
first — comes before every one client components import, however the page
|
|
147
|
+
was reached: loaded as a document, by a client navigation, or streamed after
|
|
148
|
+
the shell under `mode: 'server'`. Where two rules of equal specificity set
|
|
149
|
+
the same property on one element, the client component's wins. To have a
|
|
150
|
+
Server Component's win, give it a higher specificity, or put the two in
|
|
151
|
+
cascade layers and declare their order at the top of the CSS the root layout
|
|
152
|
+
imports, the first file in `<head>` to name them:
|
|
153
|
+
|
|
154
|
+
```css
|
|
155
|
+
/* src/styles/globals.css */
|
|
156
|
+
@layer base, components, overrides;
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
No order is kept among client components' stylesheets: a file lists them in
|
|
160
|
+
the order the render named them, and a client navigation adds each as it
|
|
161
|
+
loads. Nor is one taken out: a stylesheet a page loaded, or a link fetched
|
|
162
|
+
ahead, applies to every page after it in the tab. Keep the selectors of the
|
|
163
|
+
CSS a page or a client component imports to its own elements — a CSS
|
|
164
|
+
Module's classes — and import what every page needs in the root layout.
|
|
165
|
+
|
|
130
166
|
## What the build refuses
|
|
131
167
|
|
|
132
168
|
Every problem is reported, not just the first, and each names the file:
|
|
@@ -509,7 +545,10 @@ The client runtime listens on the whole document for a pointer moving onto a
|
|
|
509
545
|
link, a link taking focus, and a press starting on one — `pointerover`,
|
|
510
546
|
`focusin` and `pointerdown` — and fetches that page's payload there and then,
|
|
511
547
|
so a click often finds the page already in hand. Nothing needs wiring: any
|
|
512
|
-
`<a>` counts, the ones a component library renders included.
|
|
548
|
+
`<a>` counts, the ones a component library renders included. The fetch
|
|
549
|
+
loads the client components that page renders, as a navigation would, and
|
|
550
|
+
with them their stylesheets, which apply to the page on screen from then on
|
|
551
|
+
([How a page is sent](#how-a-page-is-sent)).
|
|
513
552
|
|
|
514
553
|
Only a link a click would load in place is fetched: the same origin and below
|
|
515
554
|
Vite's `base`, no `download`, no `target` other than `_self`, and not the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k8ordo/framework",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "The k8ordo framework: routes/ compiled into React Server Components, run with or without a server.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"k8ordo",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@arethetypeswrong/cli": "0.18.5",
|
|
78
78
|
"@k8ordo/framework-engine": "^0.1.1",
|
|
79
|
-
"@k8ordo/router": "^1.
|
|
79
|
+
"@k8ordo/router": "^1.3.0",
|
|
80
80
|
"@types/compressible": "2.0.3",
|
|
81
81
|
"@types/fresh": "0.5.3",
|
|
82
82
|
"@types/mime-types": "3.0.1",
|
|
@@ -92,11 +92,11 @@
|
|
|
92
92
|
"vitest": "5.0.5"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
|
-
"@k8ordo/router": "^1.
|
|
95
|
+
"@k8ordo/router": "^1.3.0",
|
|
96
96
|
"oxc-transform-react": "^0.152.0",
|
|
97
97
|
"react": ">=19.3.0",
|
|
98
98
|
"react-dom": ">=19.3.0",
|
|
99
|
-
"vite": ">=8.
|
|
99
|
+
"vite": ">=8.1.0"
|
|
100
100
|
},
|
|
101
101
|
"peerDependenciesMeta": {
|
|
102
102
|
"oxc-transform-react": {
|