@rsc-kit/mcp 0.30.46 → 0.30.48
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 +18 -5
- package/dist/recipes.js.map +1 -1
- package/guides/caching.md +2 -1
- package/guides/coming-from-next.md +4 -3
- package/guides/deployment.md +3 -3
- package/guides/edge-caching.md +51 -6
- package/guides/go.md +16 -0
- package/guides/index.json +8 -3
- package/guides/installation.md +0 -1
- package/guides/isr.md +174 -0
- package/guides/laravel.md +16 -0
- package/guides/public-forms.md +167 -5
- package/guides/your-own-backend.md +10 -1
- package/package.json +2 -2
package/dist/recipes.js
CHANGED
|
@@ -690,13 +690,17 @@ CDN that purges by tag. changed(tag) calls the purge installed with
|
|
|
690
690
|
installPurge(async ({ tags }) => ...) from @rsc-kit/core/purge, after the
|
|
691
691
|
answer has gone - one hook, any CDN's API; a failure is logged, never fails
|
|
692
692
|
the change. On Homeport (HOMEPORT_PURGE_URL set) it is homeportPurge() with
|
|
693
|
-
nothing to install. Rsc::changed() and
|
|
693
|
+
nothing to install. Rsc::changed() and reg.Changed() post their own purge
|
|
694
694
|
there, since a backend's change never passes through the engine. The host also keeps the page itself - ISR on every host: a
|
|
695
695
|
repeat request is answered from the kept copy (X-RSC-Kit: cached, Age); past
|
|
696
696
|
revalidate the stale copy goes out at once while one render replaces it;
|
|
697
697
|
changed(tag) makes the next request for a page that read that tag render, on
|
|
698
698
|
every instance, never stale. Kept in installCacheStore's store or 64 MB of
|
|
699
|
-
memory; off in dev, on Homeport, and with pageCache: false.
|
|
699
|
+
memory; off in dev, on Homeport, and with pageCache: false. Whether a CDN answered is its own
|
|
700
|
+
entry in Cache-Status (hit), never X-RSC-Kit, which is stored with the copy. Homeport's entry, named
|
|
701
|
+
homeport and last, comes with its next engine release: look for hit in that entry, not anywhere in
|
|
702
|
+
the header; stored is no proof, the next request's hit is. A static page, shell or asset hit has no
|
|
703
|
+
entry and says X-Homeport-Edge: page, shell or asset. A revalidate page calls its backend as nobody: no cookie, no
|
|
700
704
|
Authorization, and a cookie the backend sets is dropped - do NOT export it on
|
|
701
705
|
a page that shows who is signed in. Otherwise the page is sent private,
|
|
702
706
|
no-store with Cache-Status: rsc-kit; fwd=bypass; detail=<reason> (cookies,
|
|
@@ -2909,13 +2913,22 @@ passed. A refusal handle() decides goes under its field:
|
|
|
2909
2913
|
import { fieldErrors } from '@rsc-kit/core/action'
|
|
2910
2914
|
if (await subscribed(email)) fieldErrors({ email: 'Already on the list.' })
|
|
2911
2915
|
|
|
2912
|
-
A BACKEND
|
|
2913
|
-
|
|
2916
|
+
A BACKEND, WITH NO SCHEMA: defineForm({ name, action: 'Contact.send', theme }) -
|
|
2917
|
+
no form, no handle, no zod. Fields and browser checks come from what the backend
|
|
2918
|
+
says the function takes (rsc-host.json): a Laravel FormRequest's rules(), or a
|
|
2919
|
+
Go struct, whose validate tags are read as hints and never run, so the Go
|
|
2920
|
+
function must still check. The function takes one object; a file needs form and
|
|
2921
|
+
handle. A 422 from Laravel (a FormRequest type-hinted on the method, whose
|
|
2922
|
+
authorize() returns true) or Go (rsckit.InvalidField) lands under the same
|
|
2923
|
+
fields, uncaught. To check in TypeScript first, keep a schema and
|
|
2924
|
+
handle: (values) => rpc('Contact.send', values).
|
|
2914
2925
|
|
|
2915
2926
|
THE BOT TRAP: every form carries a hidden field named homepage. Filled in, the
|
|
2916
2927
|
submission is answered as a success and dropped - handle() never runs. So a
|
|
2917
2928
|
form cannot have a field named homepage. It is not a CAPTCHA; rate-limit a form
|
|
2918
|
-
worth attacking
|
|
2929
|
+
worth attacking, at the CDN or proxy: a backend sees the renderer's address on
|
|
2930
|
+
an rpc(), so Laravel's throttle on a method puts every logged-out visitor in one
|
|
2931
|
+
bucket. To limit in the backend, key on the submitted email.
|
|
2919
2932
|
|
|
2920
2933
|
A THEME draws it with one component, PublicForm (type FormsTheme from
|
|
2921
2934
|
@rsc-kit/press/forms); replace it with theme: { ...shadcn, PublicForm: Mine }.
|