@rsc-kit/mcp 0.33.0 → 0.35.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
@@ -716,6 +716,17 @@ 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 }], middleware: false }. Serve exactly the listed files from
725
+ root, a .br/.gz/.zst sibling with Content-Encoding when accepted, with the
726
+ headers whose match is the path or a /** prefix of it. No middleware.ts,
727
+ route.ts or rscKit({ headers }) applies to a file. Do NOT derive the list from
728
+ the directory or hard-code /assets/ immutable and forget /sw.js.
729
+
719
730
  FOR AN EDGE THAT CACHES PAGES: rsc-kit implements the edge contract (v2,
720
731
  docs: reference/edge-contract). Every server build writes .output/edge.json -
721
732
  { v: 2, build, shells, static, bypass } (+ nonceShells under a
@@ -1621,11 +1632,15 @@ Full guide: read_guide({ slug: 'seo-files' }).`,
1621
1632
  topic: 'domains',
1622
1633
  summary: 'Subdomains and custom domains as route segments - admin.example.com reaches app/admin, a tenant host binds [domain], no rewrite',
1623
1634
  body: `A request from a host that is not the site's own is matched with the host
1624
- in FRONT of the path. The site's own hosts: the root layout's metadataBase,
1625
- www. of it, and rscKit({ hosts: [...] }) - which is ONLY for a name that is
1626
- neither the apex nor a subdomain of it (a staging/internal name, a second
1627
- brand domain); a normal setup needs no config beyond metadataBase. localhost
1628
- and ips are always own.
1635
+ in FRONT of the path. The site's own hosts: the root layout's metadataBase
1636
+ (a literal - a computed one is not read for routing), www. of it, and
1637
+ rscKit({ hosts: [...] }). ONE of the two must name the site, or a subdomain
1638
+ is a foreign host whose segment is the whole name and is served by path,
1639
+ silently. With the address in the environment (Laravel's APP_URL), use
1640
+ hosts: loadEnv in vite.config.ts and hosts: [new URL(env.APP_URL).host] -
1641
+ that also names the local example.test under Herd, which a production
1642
+ metadataBase does not. hosts also takes a staging/internal name or a second
1643
+ brand domain. localhost and ips are always own.
1629
1644
 
1630
1645
  example.com/admin -> /admin app/admin/page.tsx
1631
1646
  admin.example.com/ -> /admin the same file (subdomain of an own host = its label)
@@ -1642,13 +1657,27 @@ stores one shell for all values, so a layout awaiting params above every
1642
1657
  boundary fails the build: read them under <Suspense> in the layout, or list
1643
1658
  the urls with generateStaticParams. A tenant check that should 404 goes in
1644
1659
  [domain]/middleware.ts - its argument is the params, and notFound() there is
1645
- a real 404. Otherwise [domain] is an ordinary dynamic segment: params.domain in every page/layout under it, typed
1646
- route('/[domain]/settings', { domain }), loading/error files as usual. A
1660
+ a real 404. Otherwise [domain] is an ordinary dynamic segment: params.domain in every page/layout under it, loading/error files
1661
+ as usual. A
1647
1662
  directory named for a host (app/admin/) wins over [domain]. A subdomain with no
1648
1663
  directory of its name (no app/merchant/) is served by path - the home page on
1649
1664
  merchant.example.com/ - and the dev server says "has no app/merchant/ - served
1650
1665
  by path" once per host. Add the directory; no config.
1651
1666
 
1667
+ Links to another host: a typed href is the FOLDER path (/merchant/orders =
1668
+ example.com/merchant/orders - both addresses work, nothing redirects). To link
1669
+ to the subdomain or a tenant use hostUrl from '@rsc-kit/core/routes':
1670
+ hostUrl('merchant', '/orders') -> //merchant.example.com/orders (path typed
1671
+ as the pages under app/merchant, folder taken off); hostUrl(tenant.slug,
1672
+ '/settings') -> //testbrand.example.com/settings (host autocompletes to the
1673
+ top-level folders but takes any string; path typed by the tenant tree);
1674
+ hostUrl('acme.com', '/settings') -> //acme.com/settings (a dot = whole
1675
+ domain); hostUrl('/pricing') -> //example.com/pricing (back to the site from
1676
+ a subdomain). The site's host is the first rscKit({ hosts }) entry, port
1677
+ kept; with none named a folder's url is its path. Same string on server and
1678
+ browser; works in <Link>, visit() and redirect(). Do NOT build
1679
+ \`//\${slug}.\${host}\` by hand or read the request host for links.
1680
+
1652
1681
  \`\`\`tsx
1653
1682
  // src/app/[domain]/layout.tsx
1654
1683
  export default async function TenantLayout({ params, children }) {
@@ -3103,6 +3132,10 @@ worth attacking. Every host call carries the visitor's address
3103
3132
  visitor ($request->ip()), as Go's rsckit.ClientIP(ctx) does. Behind a load
3104
3133
  balancer or Cloudflare set RSC_TRUST_FORWARDED=1 on the renderer, or every
3105
3134
  visitor arrives as the balancer.
3135
+ The visitor's User-Agent rides along too (X-Rsc-Client-User-Agent):
3136
+ Laravel's $request->userAgent() and Go's rsckit.ClientUserAgent(ctx) are the
3137
+ visitor's browser, for a log or an audit entry - never r.UserAgent() in Go,
3138
+ which is the renderer's runtime.
3106
3139
 
3107
3140
  A THEME draws it with one component, BlueprintForm (type FormsTheme from
3108
3141
  @rsc-kit/press/forms), given action, fields, values, submit, done and