@rsc-kit/mcp 0.38.0 → 0.40.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 CHANGED
@@ -98,6 +98,22 @@ A field is checked when it is LEFT, not as it is typed (the form listens for
98
98
  focusout, so uncontrolled fields are covered), and on submit. So error() has
99
99
  nothing for a field nobody reached - there is no "touched" to check first.
100
100
 
101
+ CHECKED BY THE SERVER BEFORE SUBMIT: when a field is left having CHANGED, the
102
+ form also asks the action - marked as a check, so its guards and validation run
103
+ and its body does NOT. Automatic; nothing to opt into, and NO hook to add. It
104
+ asks only an action that can stop before its body: createActionClient() with
105
+ .input(schema), or a backend function listed in rsc-host.json "validates"
106
+ (Laravel: one whose first parameter is a FormRequest - Precognition's rules,
107
+ filtered to the field). A plain "use server" function is never called to check.
108
+ For a wizard step or any other moment, the render prop / useForm() has:
109
+ validate('email', 'name') ask now about these (none = every field); resolves
110
+ true when they pass. '*' is one segment: 'items.*.sku'.
111
+ validating true while a check is out
112
+ valid('email') a check passed and the field is unchanged since
113
+ A wizard keeps every step's fields in the form (hidden, not unmounted) and does
114
+ \`onClick={async () => (await validate('email')) && setStep(2)}\`. Checking as
115
+ it is typed is validate() in onChange - debounce it yourself.
116
+
101
117
  Values are uncontrolled, so an initial one is React's own \`defaultValue\`. A
102
118
  refused submit keeps what was typed, because the DOM kept it.
103
119
 
@@ -691,7 +707,11 @@ stale-if-error=86400 and CDN-Cache-Control: max-age=60,
691
707
  stale-while-revalidate=86400, stale-if-error=86400 with an ETag only if the
692
708
  render read nothing of the visitor; a 404 is kept a minute at most. A CDN that
693
709
  reads CDN-Cache-Control caches on it (Homeport's edge reads nothing else, and
694
- strips it, so it is not visible in a browser there). stale-if-error lets the CDN serve the
710
+ strips it, so it is not visible in a browser there). CDN-Cache-Control is sent
711
+ ONLY when a purge can reach the CDN (CDN_PURGE_URL set, or installPurge()), so
712
+ an edge never keeps a page changed() cannot take back; s-maxage still says the
713
+ lifetime. purge({ paths }) also sends a subdomain folder's path as visitors use
714
+ it: /merchant/orders purges /orders too. stale-if-error lets the CDN serve the
695
715
  kept copy while the origin is down or deploying. The tags of every
696
716
  cache(fn, { tags }) answer it used go out as Cache-Tag: posts,post:1, for a
697
717
  CDN that purges by tag. changed(tag) calls the purge installed with
@@ -989,6 +1009,11 @@ before the handler runs (Sec-Fetch-Site, else Origin against the host - Go's
989
1009
  http.CrossOriginProtection rule; actions and forms too). No CSRF token: do NOT
990
1010
  add one. A webhook or server sends neither header and is never refused. Another
991
1011
  origin that should post: rscKit({ trustedOrigins: ['https://admin.example.com'] }).
1012
+ An api ANY site posts to from the browser (an embedded widget, its origins in a
1013
+ database): export const crossOrigin = true in that route.ts (a literal). Another
1014
+ site's request then reaches the handler WITHOUT the visitor's cookies (cookies(),
1015
+ headers(), request and backend calls see none) - authenticate with a key the
1016
+ caller sends, check Origin yourself, and export OPTIONS for the CORS preflight.
992
1017
 
993
1018
  They run their directory's \`middleware.ts\`, so an endpoint under a guarded
994
1019
  path is guarded.
@@ -1689,7 +1714,10 @@ browser; works in <Link>, visit() and redirect(). Do NOT build
1689
1714
 
1690
1715
  A folder only ever seen on its subdomain: rscKit({ hosts: [...], subdomains:
1691
1716
  ['merchant'] }). Then example.com/merchant/orders is a 301 to
1692
- merchant.example.com/orders (not on localhost); <Link href="/merchant/orders">,
1717
+ merchant.example.com/orders (only on the site's own host - not localhost, a
1718
+ preview or <app>.homeport.run, where the path form renders and links keep it;
1719
+ edge.json leaves the folder out; a backendPaths entry under it stops the
1720
+ build); <Link href="/merchant/orders">,
1693
1721
  visit() and redirect() go to the subdomain with no hostUrl; on the subdomain
1694
1722
  href="/pricing" goes to the site; Laravel's route('merchant.orders') is the
1695
1723
  subdomain url. example.com/merchant is then the subdomain's home - a landing
@@ -2222,6 +2250,11 @@ server, build, prerender - under NODE, and an app importing 'bun' or
2222
2250
  on a Bun app: dev "bun --bun vite", build "bun --bun vite build". createTestApp
2223
2251
  runs the project's build script on the runtime the tests use.
2224
2252
 
2253
+ Nitro is pinned EXACTLY in package.json: "nitro": "3.0.261103-rc" - never ^3.0.0,
2254
+ which npm resolves to an older plain 3.0.0 that 404s every route. That version is
2255
+ also the OLDEST rsc-kit runs on: an older one (3.0.0 included) stops the build
2256
+ with "nitro X is older than 3.0.261103-rc"; fix the pin and install again.
2257
+
2225
2258
  Native dependencies (sharp, bcrypt, better-sqlite3, @prisma/client, puppeteer,
2226
2259
  ...) are external to the server bundles by default; Nitro traces them into
2227
2260
  .output/server/node_modules with their binaries. Add one: