@rsc-kit/mcp 0.34.0 → 0.36.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/dist/recipes.js +31 -2
- package/dist/recipes.js.map +1 -1
- package/guides/deployment.md +66 -0
- package/guides/go.md +5 -0
- package/guides/laravel.md +12 -0
- package/guides/static-generation.md +5 -0
- package/guides/where-it-runs.md +5 -0
- package/guides/your-own-backend.md +8 -0
- package/package.json +2 -2
package/dist/recipes.js
CHANGED
|
@@ -716,6 +716,24 @@ headers, request, connection, host-middleware, set-cookie, nonce, status,
|
|
|
716
716
|
failed-render, payload-url) and a log line naming what read the visitor. It is
|
|
717
717
|
not prerendered.
|
|
718
718
|
|
|
719
|
+
FOR A SERVER IN FRONT THAT SERVES THE FILES (nginx, a CDN, a PHP front
|
|
720
|
+
controller): every server build writes .output/files.json - { v: 1, root:
|
|
721
|
+
"public", files: ["/assets/…", "/sw.js", …], precompressed: ["br", "gzip",
|
|
722
|
+
"zstd"], headers: [{ match: "/assets/**", headers: { "cache-control":
|
|
723
|
+
"public, max-age=31536000, immutable" } }, { match: "/sw.js", … max-age=0,
|
|
724
|
+
must-revalidate }, the same for /sw-app.js, /manifest.webmanifest and
|
|
725
|
+
/_app/**], middleware: false }. Serve exactly the listed files from
|
|
726
|
+
root, a .br/.gz/.zst sibling with Content-Encoding when accepted, with the
|
|
727
|
+
headers whose match is the path or a /** prefix of it, every match in order
|
|
728
|
+
(a later one wins a header name). Paths are raw, not percent-encoded: decode
|
|
729
|
+
the request path first. It fails closed: a file under a route rule it cannot
|
|
730
|
+
state (a /:name.js pattern, redirect, cors, proxy) is left out, and its
|
|
731
|
+
request goes to the app. On Vercel it is .vercel/output/files.json - Nitro's
|
|
732
|
+
output dir. No middleware.ts, route.ts or rscKit({ headers }) applies to a
|
|
733
|
+
file. Do NOT derive the list from the directory or hard-code /assets/
|
|
734
|
+
immutable and forget /sw.js. A file no entry matches (the app's own
|
|
735
|
+
public/ files) gets no Cache-Control: do not add one.
|
|
736
|
+
|
|
719
737
|
FOR AN EDGE THAT CACHES PAGES: rsc-kit implements the edge contract (v2,
|
|
720
738
|
docs: reference/edge-contract). Every server build writes .output/edge.json -
|
|
721
739
|
{ v: 2, build, shells, static, bypass } (+ nonceShells under a
|
|
@@ -1921,7 +1939,10 @@ They run against the page's request, not the host call's: signed checks the
|
|
|
1921
1939
|
link the visitor followed, throttle counts per visitor and once per page load,
|
|
1922
1940
|
and can:update,post gets the {post} the route bound - bind it with
|
|
1923
1941
|
Route::bind or Route::model, since a page has no controller signature for
|
|
1924
|
-
implicit binding.
|
|
1942
|
+
implicit binding. auth sends a guest to route('login'); an app with no route
|
|
1943
|
+
of that name fails with "Route [login] not defined" - set
|
|
1944
|
+
$middleware->redirectGuestsTo('/login') in bootstrap/app.php (a full url when
|
|
1945
|
+
login is on another host). In Go, a guard reads rsckit.PageFrom(ctx) (URL, and Params:
|
|
1925
1946
|
only the route's own, never the query) and rsckit.ClientIP(ctx).
|
|
1926
1947
|
|
|
1927
1948
|
Make one: php artisan make:rsc-action Orders --method=cancel --auth
|
|
@@ -2140,7 +2161,11 @@ Full guide: read_guide({ slug: 'commands' }).`,
|
|
|
2140
2161
|
{
|
|
2141
2162
|
topic: 'workers',
|
|
2142
2163
|
summary: 'Cloudflare Workers: bindings (D1, R2, KV) from cloudflare:workers',
|
|
2143
|
-
body: `
|
|
2164
|
+
body: `On Cloudflare the preset is cloudflare_module (Workers), never
|
|
2165
|
+
cloudflare_pages: a Pages build answers every page with a bare 500, and
|
|
2166
|
+
Cloudflare is moving Pages projects to Workers.
|
|
2167
|
+
|
|
2168
|
+
A D1 database, an R2 bucket or a KV namespace named in wrangler.jsonc is
|
|
2144
2169
|
read from \`cloudflare:workers\`, the runtime's own module: the bundle leaves
|
|
2145
2170
|
it external, like bun:sqlite. \`vite dev\` under Bun or Node has no such module,
|
|
2146
2171
|
so import it lazily, behind a runtime check - never at the top of a module a
|
|
@@ -3121,6 +3146,10 @@ worth attacking. Every host call carries the visitor's address
|
|
|
3121
3146
|
visitor ($request->ip()), as Go's rsckit.ClientIP(ctx) does. Behind a load
|
|
3122
3147
|
balancer or Cloudflare set RSC_TRUST_FORWARDED=1 on the renderer, or every
|
|
3123
3148
|
visitor arrives as the balancer.
|
|
3149
|
+
The visitor's User-Agent rides along too (X-Rsc-Client-User-Agent):
|
|
3150
|
+
Laravel's $request->userAgent() and Go's rsckit.ClientUserAgent(ctx) are the
|
|
3151
|
+
visitor's browser, for a log or an audit entry - never r.UserAgent() in Go,
|
|
3152
|
+
which is the renderer's runtime.
|
|
3124
3153
|
|
|
3125
3154
|
A THEME draws it with one component, BlueprintForm (type FormsTheme from
|
|
3126
3155
|
@rsc-kit/press/forms), given action, fields, values, submit, done and
|