@rsc-kit/mcp 0.20.10 → 0.20.12
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/guides/getting-started.md +1 -1
- package/guides/installation.md +1 -1
- package/guides/metadata.md +3 -3
- package/guides/ppr.md +52 -0
- package/guides/seo-files.md +2 -2
- package/guides/where-it-runs.md +17 -2
- package/package.json +1 -1
|
@@ -58,7 +58,7 @@ generation](/guides/static-generation).
|
|
|
58
58
|
With the Bun preset the whole application ends up in one file:
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
|
-
npm run compile # builds, then bun build --compile
|
|
61
|
+
npm run compile # builds, then bun build --compile --keep-names
|
|
62
62
|
./dist/app
|
|
63
63
|
```
|
|
64
64
|
|
package/guides/installation.md
CHANGED
|
@@ -170,7 +170,7 @@ runs](/hosts/where-it-runs).
|
|
|
170
170
|
"dev": "bun --bun vite",
|
|
171
171
|
"build": "bun --bun vite build",
|
|
172
172
|
"start": "bun .output/server/index.mjs",
|
|
173
|
-
"compile": "bun --bun vite build && bun build --compile .output/server/compile.mjs --outfile dist/app"
|
|
173
|
+
"compile": "bun --bun vite build && bun build --compile --keep-names .output/server/compile.mjs --outfile dist/app"
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
```
|
package/guides/metadata.md
CHANGED
|
@@ -176,14 +176,14 @@ app already has.
|
|
|
176
176
|
|
|
177
177
|
```tsx title="src/app/layout.tsx"
|
|
178
178
|
export const metadata: Metadata = {
|
|
179
|
-
metadataBase: new URL('https://
|
|
179
|
+
metadataBase: new URL('https://example.com'),
|
|
180
180
|
openGraph: {
|
|
181
|
-
siteName: '
|
|
181
|
+
siteName: 'Example',
|
|
182
182
|
type: 'website',
|
|
183
183
|
},
|
|
184
184
|
twitter: {
|
|
185
185
|
card: 'summary_large_image',
|
|
186
|
-
site: '@
|
|
186
|
+
site: '@example',
|
|
187
187
|
},
|
|
188
188
|
};
|
|
189
189
|
```
|
package/guides/ppr.md
CHANGED
|
@@ -51,6 +51,58 @@ the page's title and description into the head when it serves the shell for
|
|
|
51
51
|
a url it does know; the client sets the title again after hydration. Static
|
|
52
52
|
`metadata` on the page and the layouts is in the shell as always.
|
|
53
53
|
|
|
54
|
+
## A shell and the server that finishes it are one build
|
|
55
|
+
|
|
56
|
+
A postponed state names the components React has to find when it replays, and
|
|
57
|
+
a name is whatever that build's minifier assigned. Resumed against a different
|
|
58
|
+
bundle, the same component answers to something else:
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
Expected the resume to render <J> in this slot but instead it rendered <J2>.
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Two names for one component is the fingerprint of two builds. Every shell is
|
|
65
|
+
stamped with the build that froze it, and a host that finds a shell from
|
|
66
|
+
another build serves it but renders the page whole instead of resuming it,
|
|
67
|
+
with a line in the log saying so.
|
|
68
|
+
|
|
69
|
+
How they drift apart in practice: a Docker layer, a CI cache or a volume that
|
|
70
|
+
keeps a previous prerender output while the server bundle is rebuilt. Build
|
|
71
|
+
both together, or clear the output directory between builds.
|
|
72
|
+
|
|
73
|
+
## A shell for a pattern is one shape
|
|
74
|
+
|
|
75
|
+
A route with params that listed no urls is frozen **once**, for the pattern —
|
|
76
|
+
the build has no url, so every param is a placeholder and anything that reads
|
|
77
|
+
one postpones. What resumes it renders the tree the shell froze and fills the
|
|
78
|
+
holes with the real values.
|
|
79
|
+
|
|
80
|
+
So the shape above a boundary cannot depend on a param:
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
// Refuses to resume: two different components in one slot
|
|
84
|
+
const { id } = await params
|
|
85
|
+
return id === 'new' ? <CreateForm /> : <Record />
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
React replays the postponed tree by position and type. A different component
|
|
89
|
+
in a slot ends the replay:
|
|
90
|
+
|
|
91
|
+
```text
|
|
92
|
+
Expected the resume to render <Record> in this slot but instead it
|
|
93
|
+
rendered <CreateForm>. The tree doesn't match so React will fallback
|
|
94
|
+
to client rendering.
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Every hole then falls back to client rendering, which arrives as a page whose
|
|
98
|
+
buttons do nothing.
|
|
99
|
+
|
|
100
|
+
The engine holds up its end: the resume is given the placeholders the shell
|
|
101
|
+
was frozen with, and the real params separately, so a component that reads
|
|
102
|
+
them is inside a hole by construction. What an app must not do is branch on a
|
|
103
|
+
param **above** its boundary. Put the branch inside the `<Suspense>`, or give
|
|
104
|
+
the route a `generateStaticParams` so each url is frozen as itself.
|
|
105
|
+
|
|
54
106
|
## What makes a page dynamic
|
|
55
107
|
|
|
56
108
|
Anything the build cannot know:
|
package/guides/seo-files.md
CHANGED
|
@@ -49,8 +49,8 @@ import type { MetadataRoute } from '@rsc-kit/core/metadata';
|
|
|
49
49
|
|
|
50
50
|
export default function llms(): MetadataRoute.Llms {
|
|
51
51
|
return {
|
|
52
|
-
title: '
|
|
53
|
-
summary: '
|
|
52
|
+
title: 'Example',
|
|
53
|
+
summary: 'What the site is, in one sentence.',
|
|
54
54
|
sections: [
|
|
55
55
|
{ title: 'Pages', links: [{ title: 'Pricing', url: '/pricing', description: 'Per restoration, no subscription' }] },
|
|
56
56
|
],
|
package/guides/where-it-runs.md
CHANGED
|
@@ -65,7 +65,7 @@ Bun only, and the whole application ends up inside one file — engine, route
|
|
|
65
65
|
tree, frozen pages and assets, the precompressed variants included:
|
|
66
66
|
|
|
67
67
|
```bash
|
|
68
|
-
npm run compile # builds, then bun build --compile .output/server/compile.mjs
|
|
68
|
+
npm run compile # builds, then bun build --compile --keep-names .output/server/compile.mjs
|
|
69
69
|
./dist/app
|
|
70
70
|
```
|
|
71
71
|
|
|
@@ -82,7 +82,22 @@ a binary one version behind the source with nothing to say so — and on a
|
|
|
82
82
|
project that has never been built, an `ENOENT` naming a path the app did not
|
|
83
83
|
write.
|
|
84
84
|
|
|
85
|
-
`--compile` implies `--production
|
|
85
|
+
**`--keep-names` is not optional.** `--compile` implies `--production`, which
|
|
86
|
+
minifies — and minifying renames every function. A partially prerendered page
|
|
87
|
+
is finished by replaying a tree the build recorded by component *name*, so a
|
|
88
|
+
binary that renamed them finds the wrong name in every slot:
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
Expected the resume to render <J> in this slot but instead it rendered <J2>.
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
React then falls back to client rendering for every hole, and the page arrives
|
|
95
|
+
looking finished with nothing wired up. `--keep-names` preserves the names the
|
|
96
|
+
build recorded, and costs a few kilobytes. A build with no PPR route never
|
|
97
|
+
notices; one with them fails only on a cold load, in production, which is the
|
|
98
|
+
worst way to find out.
|
|
99
|
+
|
|
100
|
+
`--target bun` is the default. `--bytecode`
|
|
86
101
|
compiles the JavaScript ahead of time for a faster cold start at the cost
|
|
87
102
|
of a larger binary — a production port measured 275 ms → 72 ms to the first
|
|
88
103
|
healthy response for 81 MB → 117 MB, and left it out, since on a pod the
|
package/package.json
CHANGED