@rsc-kit/mcp 0.36.0 → 0.38.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 +28 -5
- package/dist/recipes.js.map +1 -1
- package/guides/backend-answered-pages.md +3 -1
- package/guides/deployment.md +4 -1
- package/guides/domains.md +29 -2
- package/guides/edge-caching.md +7 -7
- package/guides/go.md +1 -1
- package/guides/laravel.md +30 -6
- package/guides/typed-routes.md +4 -0
- package/guides/your-own-backend.md +3 -3
- package/package.json +2 -2
package/dist/recipes.js
CHANGED
|
@@ -697,8 +697,8 @@ cache(fn, { tags }) answer it used go out as Cache-Tag: posts,post:1, for a
|
|
|
697
697
|
CDN that purges by tag. changed(tag) calls the purge installed with
|
|
698
698
|
installPurge(async ({ tags }) => ...) from @rsc-kit/core/purge, after the
|
|
699
699
|
answer has gone - one hook, any CDN's API; a failure is logged, never fails
|
|
700
|
-
the change. With
|
|
701
|
-
|
|
700
|
+
the change. With CDN_PURGE_URL set it is cdnPurge() with nothing to install;
|
|
701
|
+
CDN_PURGE_URL is the ONLY name read (RSC_PURGE_URL and HOMEPORT_PURGE_URL no longer are; homeportPurge() is now cdnPurge(), no alias). Rsc::changed() and reg.Changed() post their own purge
|
|
702
702
|
there, since a backend's change never passes through the engine. The host also keeps the page itself - ISR on every host: a
|
|
703
703
|
repeat request is answered from the kept copy (X-RSC-Kit: cached, Age); past
|
|
704
704
|
revalidate the stale copy goes out at once while one render replaces it;
|
|
@@ -748,7 +748,9 @@ Headers fixed for every page go in rscKit({ headers: { 'X-Frame-Options':
|
|
|
748
748
|
'DENY' } }) instead: set on every response, sent to the edge as the page's
|
|
749
749
|
headers, and the page stays listed. Only the contract's allow list is
|
|
750
750
|
accepted (no Cache-Control or Link); anything else is a build error. GET
|
|
751
|
-
/_edge/page?path= answers a shell, or a static page whole with complete: true
|
|
751
|
+
/_edge/page?path= answers a shell, or a static page whole with complete: true
|
|
752
|
+
and, in its headers, the Cache-Control its document goes out with (public,
|
|
753
|
+
max-age=0, must-revalidate) - a shell names none, its document is per request;
|
|
752
754
|
POST /_edge/resume?url= answers a shell's holes. Both answer only a request
|
|
753
755
|
whose Edge-Token header holds the EDGE_TOKEN env var; unset, both are a 404. A
|
|
754
756
|
static page's payload is copied to /assets/_rsc/<hash>.rsc (immutable) and
|
|
@@ -1685,6 +1687,15 @@ kept; with none named a folder's url is its path. Same string on server and
|
|
|
1685
1687
|
browser; works in <Link>, visit() and redirect(). Do NOT build
|
|
1686
1688
|
\`//\${slug}.\${host}\` by hand or read the request host for links.
|
|
1687
1689
|
|
|
1690
|
+
A folder only ever seen on its subdomain: rscKit({ hosts: [...], subdomains:
|
|
1691
|
+
['merchant'] }). Then example.com/merchant/orders is a 301 to
|
|
1692
|
+
merchant.example.com/orders (not on localhost); <Link href="/merchant/orders">,
|
|
1693
|
+
visit() and redirect() go to the subdomain with no hostUrl; on the subdomain
|
|
1694
|
+
href="/pricing" goes to the site; Laravel's route('merchant.orders') is the
|
|
1695
|
+
subdomain url. example.com/merchant is then the subdomain's home - a landing
|
|
1696
|
+
page goes in its own folder (app/sell/). Needs hosts and app/merchant/, or dev
|
|
1697
|
+
and the build stop.
|
|
1698
|
+
|
|
1688
1699
|
\`\`\`tsx
|
|
1689
1700
|
// src/app/[domain]/layout.tsx
|
|
1690
1701
|
export default async function TenantLayout({ params, children }) {
|
|
@@ -1890,8 +1901,16 @@ when the renderer is in front. Name the backend's prefixes, and they are
|
|
|
1890
1901
|
forwarded BEFORE any page is asked: rscKit({ backendPaths: ['/auth', '/github',
|
|
1891
1902
|
'/gitlab'] }). A prefix at a segment boundary (/auth, not /authors), every
|
|
1892
1903
|
method; '/', /_rsc and the host-call endpoint (/__rsc/host-call) are refused; a
|
|
1893
|
-
team called auth is then unreachable.
|
|
1894
|
-
|
|
1904
|
+
team called auth is then unreachable. A whole segment in brackets is any one
|
|
1905
|
+
segment: backendPaths: ['/login/[provider]'] is /login/google and what is under
|
|
1906
|
+
it, NOT /login, which stays the page - for a backend route with a parameter
|
|
1907
|
+
under a url that is a page. A page it would cover (login/forgot/page.tsx) stops
|
|
1908
|
+
dev and the build, since it would never render; a dynamic FIRST segment and a
|
|
1909
|
+
catch-all are refused; nothing is checked per request. Prefer a prefix of the
|
|
1910
|
+
backend's own ('/auth') when the urls can move. The build lists the plain
|
|
1911
|
+
prefixes as backendPaths in
|
|
1912
|
+
.output/rsc-kit.json ([] when none; a dynamic one is left out and goes through
|
|
1913
|
+
the renderer), so a proxy in front sends them straight to
|
|
1895
1914
|
the backend instead of through the renderer. The renderer never forwards a
|
|
1896
1915
|
browser's request for the host-call endpoint: it answers with its not-found page. Do NOT
|
|
1897
1916
|
write catch-all route.ts files that forward by hand: that copies the forwarding.
|
|
@@ -1952,6 +1971,10 @@ Billing/Invoices). Do NOT hand-write the attributes from memory; the command
|
|
|
1952
1971
|
writes the ones the registry reads, and it writes the manifest
|
|
1953
1972
|
(rsc-host.json) too - a running dev server restarts on its own when it
|
|
1954
1973
|
changes, so the export is importable when the command returns.
|
|
1974
|
+
One dev server per app: a second vite names the one already running (composer
|
|
1975
|
+
dev, Herd's artisan dev or an editor may have started it) - use that one. In a
|
|
1976
|
+
terminal the second exits, naming the pid to stop; under a runner it waits and
|
|
1977
|
+
starts when the first stops. A vite that sits waiting is not hung.
|
|
1955
1978
|
Server actions are classes in app/Rsc/Actions, found by reflection in PHP;
|
|
1956
1979
|
\`php artisan rsc:host-manifest\` writes rsc-host.json - { actions,
|
|
1957
1980
|
functions } - and vite.config.ts runs it as dev and every build start:
|