@rsc-kit/mcp 0.30.45 → 0.30.47
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 +11 -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 +18 -7
- package/guides/go.md +15 -0
- package/guides/index.json +7 -2
- package/guides/isr.md +172 -0
- package/guides/laravel.md +16 -0
- package/guides/public-forms.md +124 -7
- package/guides/your-own-backend.md +5 -4
- package/package.json +2 -2
package/dist/recipes.js
CHANGED
|
@@ -679,15 +679,18 @@ TO LET A CDN KEEP A PAGE RENDERED PER REQUEST: export const revalidate = 60
|
|
|
679
679
|
(seconds, a number literal; a layout may export it too and the smallest wins,
|
|
680
680
|
0 anywhere turns it off). The page is rendered whole, then sent Cache-Control:
|
|
681
681
|
public, max-age=0, s-maxage=60, stale-while-revalidate=86400,
|
|
682
|
-
stale-if-error=86400
|
|
683
|
-
|
|
682
|
+
stale-if-error=86400 and CDN-Cache-Control: max-age=60,
|
|
683
|
+
stale-while-revalidate=86400, stale-if-error=86400 with an ETag only if the
|
|
684
|
+
render read nothing of the visitor; a 404 is kept a minute at most. A CDN that
|
|
685
|
+
reads CDN-Cache-Control caches on it (Homeport's edge reads nothing else, and
|
|
686
|
+
strips it, so it is not visible in a browser there). stale-if-error lets the CDN serve the
|
|
684
687
|
kept copy while the origin is down or deploying. The tags of every
|
|
685
688
|
cache(fn, { tags }) answer it used go out as Cache-Tag: posts,post:1, for a
|
|
686
689
|
CDN that purges by tag. changed(tag) calls the purge installed with
|
|
687
690
|
installPurge(async ({ tags }) => ...) from @rsc-kit/core/purge, after the
|
|
688
691
|
answer has gone - one hook, any CDN's API; a failure is logged, never fails
|
|
689
692
|
the change. On Homeport (HOMEPORT_PURGE_URL set) it is homeportPurge() with
|
|
690
|
-
nothing to install. Rsc::changed() and
|
|
693
|
+
nothing to install. Rsc::changed() and reg.Changed() post their own purge
|
|
691
694
|
there, since a backend's change never passes through the engine. The host also keeps the page itself - ISR on every host: a
|
|
692
695
|
repeat request is answered from the kept copy (X-RSC-Kit: cached, Age); past
|
|
693
696
|
revalidate the stale copy goes out at once while one render replaces it;
|
|
@@ -2907,12 +2910,15 @@ passed. A refusal handle() decides goes under its field:
|
|
|
2907
2910
|
if (await subscribed(email)) fieldErrors({ email: 'Already on the list.' })
|
|
2908
2911
|
|
|
2909
2912
|
A BACKEND: handle: (values) => rpc('Contact.send', values). A 422 from Laravel
|
|
2910
|
-
|
|
2913
|
+
(a FormRequest type-hinted on the method, whose authorize() returns true) or Go
|
|
2914
|
+
(rsckit.InvalidField) lands under the same fields, uncaught.
|
|
2911
2915
|
|
|
2912
2916
|
THE BOT TRAP: every form carries a hidden field named homepage. Filled in, the
|
|
2913
2917
|
submission is answered as a success and dropped - handle() never runs. So a
|
|
2914
2918
|
form cannot have a field named homepage. It is not a CAPTCHA; rate-limit a form
|
|
2915
|
-
worth attacking
|
|
2919
|
+
worth attacking, at the CDN or proxy: a backend sees the renderer's address on
|
|
2920
|
+
an rpc(), so Laravel's throttle on a method puts every logged-out visitor in one
|
|
2921
|
+
bucket. To limit in the backend, key on the submitted email.
|
|
2916
2922
|
|
|
2917
2923
|
A THEME draws it with one component, PublicForm (type FormsTheme from
|
|
2918
2924
|
@rsc-kit/press/forms); replace it with theme: { ...shadcn, PublicForm: Mine }.
|