@farm.js/plugin 0.1.68 → 0.1.70

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/index.d.ts CHANGED
@@ -39,5 +39,5 @@
39
39
  * })
40
40
  * ```
41
41
  */
42
- export declare const version = "0.1.68";
42
+ export declare const version = "0.1.70";
43
43
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -39,7 +39,7 @@
39
39
  * })
40
40
  * ```
41
41
  */
42
- export const version = "0.1.68";
42
+ export const version = "0.1.70";
43
43
  // Note: Import plugins from their respective subpaths:
44
44
  // - @farm.js/plugin/rsc
45
45
  // - @farm.js/plugin/middleware
@@ -0,0 +1,53 @@
1
+ import type { ResolvedFarmI18nConfig } from "@farm.js/core/i18n";
2
+ import type { Connect } from "vite";
3
+ import type { HeaderConfig, RedirectConfig, RewriteConfig } from "./types.js";
4
+ /** A config `redirects`, `rewrites` or `headers` value: an array, or a function returning one. */
5
+ export type RscConfigRouteList<T> = readonly T[] | (() => readonly T[] | Promise<readonly T[]>);
6
+ export interface RscConfigRoutes {
7
+ redirects: RedirectConfig[];
8
+ rewrites: RewriteConfig[];
9
+ headers: HeaderConfig[];
10
+ }
11
+ /**
12
+ * The config `redirects()`, `rewrites()` and `headers()`, called once as core's config resolution
13
+ * calls them. `undefined` when none has an entry, so such an app generates the same entries.
14
+ */
15
+ export declare function resolveRscConfigRoutes(config: {
16
+ redirects?: RscConfigRouteList<RedirectConfig>;
17
+ rewrites?: RscConfigRouteList<RewriteConfig>;
18
+ headers?: RscConfigRouteList<HeaderConfig>;
19
+ }): Promise<RscConfigRoutes | undefined>;
20
+ type ConfigRouteMatchers = Pick<typeof import("@farm.js/core/internal/production-runtime"), "createConfigHeadersMatcher" | "createConfigRedirectMatcher" | "createConfigRewriteMatcher">;
21
+ export interface RscDevConfigRoutes {
22
+ redirect: ReturnType<ConfigRouteMatchers["createConfigRedirectMatcher"]>;
23
+ rewrite: ReturnType<ConfigRouteMatchers["createConfigRewriteMatcher"]>;
24
+ headers: ReturnType<ConfigRouteMatchers["createConfigHeadersMatcher"]>;
25
+ hasRewrites: boolean;
26
+ }
27
+ /**
28
+ * Core's matchers for the resolved config routes. Creating them checks each source and redirect
29
+ * status as core does, so `farm dev` and `farm build` fail on the same config.
30
+ */
31
+ export declare function createRscConfigRouteMatchers(routes: RscConfigRoutes, options: {
32
+ i18n: ResolvedFarmI18nConfig;
33
+ basePath: string;
34
+ }): RscDevConfigRoutes;
35
+ export interface RscConfigRoutesMiddlewareOptions {
36
+ routes: () => RscDevConfigRoutes | undefined;
37
+ root: string;
38
+ publicDir: string | false;
39
+ isApiPathname: (pathname: string) => boolean;
40
+ /** Whether the RSC entry answers the URL itself, which a config rewrite yields to. */
41
+ hasLocalRoute: (url: URL) => Promise<boolean>;
42
+ bodySizeLimit: number;
43
+ }
44
+ /**
45
+ * The config `headers()`, `redirects()` and `rewrites()` under `farm dev`, ahead of Vite, the API
46
+ * routes and the RSC entry, as core's dev server applies them: headers and redirects see the URL
47
+ * as requested, and a rewrite applies when no route answers it, once. Requests the running app
48
+ * makes for Vite's modules and files, and public files, stay Vite's (#2685). A payload request
49
+ * ('<page>.rsc') matches as its page, as in production.
50
+ */
51
+ export declare function createRscConfigRoutesMiddleware(options: RscConfigRoutesMiddlewareOptions): Connect.NextHandleFunction;
52
+ export {};
53
+ //# sourceMappingURL=config-routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-routes.d.ts","sourceRoot":"","sources":["../../src/rsc/config-routes.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAI9E,kGAAkG;AAClG,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,SAAS,CAAC,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;AAEhG,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAaD;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE;IACnD,SAAS,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAC/C,QAAQ,CAAC,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;CAC5C,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAQvC;AAED,KAAK,mBAAmB,GAAG,IAAI,CAC7B,cAAc,2CAA2C,CAAC,EAC1D,4BAA4B,GAAG,6BAA6B,GAAG,4BAA4B,CAC5F,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,UAAU,CAAC,mBAAmB,CAAC,6BAA6B,CAAC,CAAC,CAAC;IACzE,OAAO,EAAE,UAAU,CAAC,mBAAmB,CAAC,4BAA4B,CAAC,CAAC,CAAC;IACvE,OAAO,EAAE,UAAU,CAAC,mBAAmB,CAAC,4BAA4B,CAAC,CAAC,CAAC;IACvE,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE;IAAE,IAAI,EAAE,sBAAsB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC1D,kBAAkB,CASpB;AAOD,MAAM,WAAW,gCAAgC;IAC/C,MAAM,EAAE,MAAM,kBAAkB,GAAG,SAAS,CAAC;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,GAAG,KAAK,CAAC;IAC1B,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IAC7C,sFAAsF;IACtF,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9C,aAAa,EAAE,MAAM,CAAC;CACvB;AAcD;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,gCAAgC,GACxC,OAAO,CAAC,kBAAkB,CA6F5B"}
@@ -0,0 +1,136 @@
1
+ import { createRequire } from "node:module";
2
+ import { devServableFileExists } from "../dev-static.js";
3
+ import { createDevRequestHeaders, resolveDevRequestURL } from "../dev-request.js";
4
+ import { sendRscDevelopmentResponse } from "./dev-response.js";
5
+ const require_ = createRequire(import.meta.url);
6
+ async function resolveRscConfigRouteList(value, field) {
7
+ const list = typeof value === "function" ? await value() : (value ?? []);
8
+ if (!Array.isArray(list)) {
9
+ throw new TypeError(`[Farm.js] ${field} must be an array or a function that returns one.`);
10
+ }
11
+ return [...list];
12
+ }
13
+ /**
14
+ * The config `redirects()`, `rewrites()` and `headers()`, called once as core's config resolution
15
+ * calls them. `undefined` when none has an entry, so such an app generates the same entries.
16
+ */
17
+ export async function resolveRscConfigRoutes(config) {
18
+ const [redirects, rewrites, headers] = await Promise.all([
19
+ resolveRscConfigRouteList(config.redirects, "redirects"),
20
+ resolveRscConfigRouteList(config.rewrites, "rewrites"),
21
+ resolveRscConfigRouteList(config.headers, "headers"),
22
+ ]);
23
+ if (redirects.length === 0 && rewrites.length === 0 && headers.length === 0)
24
+ return undefined;
25
+ return { redirects, rewrites, headers };
26
+ }
27
+ /**
28
+ * Core's matchers for the resolved config routes. Creating them checks each source and redirect
29
+ * status as core does, so `farm dev` and `farm build` fail on the same config.
30
+ */
31
+ export function createRscConfigRouteMatchers(routes, options) {
32
+ const { createConfigHeadersMatcher, createConfigRedirectMatcher, createConfigRewriteMatcher } = require_("@farm.js/core/internal/production-runtime");
33
+ return {
34
+ redirect: createConfigRedirectMatcher(routes.redirects, options),
35
+ rewrite: createConfigRewriteMatcher(routes.rewrites, options),
36
+ headers: createConfigHeadersMatcher(routes.headers, options),
37
+ hasRewrites: routes.rewrites.length > 0,
38
+ };
39
+ }
40
+ /** The page a '<page>.rsc' payload request is for, as the RSC entry reads it. */
41
+ function toPayloadPageUrl(url) {
42
+ const pageUrl = new URL(url);
43
+ const page = url.pathname.slice(0, -".rsc".length);
44
+ pageUrl.pathname = page.endsWith("/index") ? page.slice(0, -"index".length) : page;
45
+ return pageUrl;
46
+ }
47
+ function toPayloadPath(pathname) {
48
+ return pathname.endsWith("/") ? `${pathname}index.rsc` : `${pathname}.rsc`;
49
+ }
50
+ /**
51
+ * The config `headers()`, `redirects()` and `rewrites()` under `farm dev`, ahead of Vite, the API
52
+ * routes and the RSC entry, as core's dev server applies them: headers and redirects see the URL
53
+ * as requested, and a rewrite applies when no route answers it, once. Requests the running app
54
+ * makes for Vite's modules and files, and public files, stay Vite's (#2685). A payload request
55
+ * ('<page>.rsc') matches as its page, as in production.
56
+ */
57
+ export function createRscConfigRoutesMiddleware(options) {
58
+ let helpers;
59
+ return async (req, res, next) => {
60
+ const routes = options.routes();
61
+ if (!routes)
62
+ return next();
63
+ helpers ??= require_("@farm.js/core/vite");
64
+ let url;
65
+ try {
66
+ url = resolveDevRequestURL(req);
67
+ }
68
+ catch {
69
+ return next();
70
+ }
71
+ const method = (req.method || "GET").toUpperCase();
72
+ const rawUrl = req.url || "/";
73
+ const viteOwned = rawUrl.startsWith("/@") ||
74
+ rawUrl.startsWith("/node_modules/") ||
75
+ rawUrl.startsWith("/__farm/") ||
76
+ helpers.isViteModuleRequest(url, req.headers) ||
77
+ ((method === "GET" || method === "HEAD") &&
78
+ url.pathname.includes(".") &&
79
+ (devServableFileExists(url.pathname, [options.publicDir || undefined]) ||
80
+ (helpers.isViteDevClientRequest(url, req.headers) &&
81
+ devServableFileExists(url.pathname, [options.root]))));
82
+ if (viteOwned)
83
+ return next();
84
+ const payloadRequested = (method === "GET" || method === "HEAD") &&
85
+ url.pathname.endsWith(".rsc") &&
86
+ !options.isApiPathname(url.pathname);
87
+ const routeUrl = payloadRequested ? toPayloadPageUrl(url) : url;
88
+ try {
89
+ helpers.installConfigResponseHeaders(res, routes.headers(routeUrl));
90
+ const redirect = routes.redirect(routeUrl);
91
+ if (redirect) {
92
+ let location = redirect.destination;
93
+ if (payloadRequested) {
94
+ const target = new URL(location, url);
95
+ if (target.origin === url.origin)
96
+ location = toPayloadPath(target.pathname) + target.search;
97
+ }
98
+ await sendRscDevelopmentResponse(res, new Response(`Redirecting to ${location}`, {
99
+ status: redirect.statusCode,
100
+ headers: { Location: location },
101
+ }));
102
+ return;
103
+ }
104
+ if (routes.hasRewrites) {
105
+ const destination = routes.rewrite(routeUrl);
106
+ if (destination && !(await options.hasLocalRoute(routeUrl))) {
107
+ if (destination.origin !== url.origin) {
108
+ const { readNodeRequestBody, fetchFarmExternalRewrite } = require_("@farm.js/core/internal/production-runtime");
109
+ const body = method === "GET" || method === "HEAD"
110
+ ? undefined
111
+ : await readNodeRequestBody(req, options.bodySizeLimit);
112
+ await sendRscDevelopmentResponse(res, await fetchFarmExternalRewrite(new Request(destination, {
113
+ method,
114
+ headers: createDevRequestHeaders(req.headers),
115
+ body: body && body.length > 0 ? new Uint8Array(body) : undefined,
116
+ })));
117
+ return;
118
+ }
119
+ req.url =
120
+ (payloadRequested ? toPayloadPath(destination.pathname) : destination.pathname) +
121
+ destination.search;
122
+ }
123
+ }
124
+ }
125
+ catch (error) {
126
+ console.error("[Farm.js] Config route failed:", error);
127
+ if (!res.headersSent) {
128
+ res.statusCode = 500;
129
+ res.setHeader("Content-Type", "text/plain; charset=utf-8");
130
+ }
131
+ res.end("Internal Server Error");
132
+ return;
133
+ }
134
+ next();
135
+ };
136
+ }
@@ -1,5 +1,7 @@
1
1
  import type { EntryContext } from "../types.js";
2
2
  export declare const CLIENT_ENTRY_CORE_IMPORTS: readonly ["@farm.js/core/client", "@farm.js/core/deployment", "@farm.js/core/internal/client-runtime", "@farm.js/core/server-query/client"];
3
+ /** What the browser entry of an app with i18n imports as well. */
4
+ export declare const CLIENT_ENTRY_I18N_IMPORTS: readonly ["@farm.js/core/i18n", "@farm.js/core/i18n/client"];
3
5
  export declare const serverFnTransportErrorClientRuntime = "function createFarmServerFnTransportError(value) {\n const message = value && typeof value === 'object' && typeof value.message === 'string'\n ? value.message\n : 'Server function failed';\n const error = new Error(message);\n\n if (\n value &&\n typeof value === 'object' &&\n value.name === 'ServerFnFailure' &&\n typeof value.code === 'string' &&\n Number.isInteger(value.status) &&\n value.status >= 400 &&\n value.status <= 599 &&\n Object.prototype.hasOwnProperty.call(value, 'data')\n ) {\n error.name = 'ServerFnFailure';\n error.code = value.code;\n error.status = value.status;\n error.data = value.data;\n Object.defineProperty(error, Symbol.for('farm.server-fn.failure'), {\n value: true,\n enumerable: false,\n });\n return error;\n }\n\n error.name = 'ServerActionError';\n return error;\n}";
4
6
  /**
5
7
  * Generates the browser entry file.
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/rsc/entries/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD,eAAO,MAAM,yBAAyB,6IAK5B,CAAC;AAEX,eAAO,MAAM,mCAAmC,62BA6B9C,CAAC;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CA6gB7D"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/rsc/entries/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD,eAAO,MAAM,yBAAyB,6IAK5B,CAAC;AAEX,kEAAkE;AAClE,eAAO,MAAM,yBAAyB,8DAG5B,CAAC;AAEX,eAAO,MAAM,mCAAmC,62BA6B9C,CAAC;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CA6jB7D"}
@@ -6,6 +6,11 @@ export const CLIENT_ENTRY_CORE_IMPORTS = [
6
6
  "@farm.js/core/internal/client-runtime",
7
7
  "@farm.js/core/server-query/client",
8
8
  ];
9
+ /** What the browser entry of an app with i18n imports as well. */
10
+ export const CLIENT_ENTRY_I18N_IMPORTS = [
11
+ "@farm.js/core/i18n",
12
+ "@farm.js/core/i18n/client",
13
+ ];
9
14
  export const serverFnTransportErrorClientRuntime = `function createFarmServerFnTransportError(value) {
10
15
  const message = value && typeof value === 'object' && typeof value.message === 'string'
11
16
  ? value.message
@@ -68,8 +73,49 @@ import {
68
73
  createFarmDeploymentRequestHeaders,
69
74
  isFarmDeploymentMismatchResponse,
70
75
  } from '@farm.js/core/deployment';
71
- import { createFarmRouteAnnouncer, runFarmNavigationDelegates } from '@farm.js/core/internal/client-runtime';
76
+ import {
77
+ createFarmMetadataHeadReconciler,
78
+ createFarmRouteAnnouncer,
79
+ runFarmNavigationDelegates,
80
+ } from '@farm.js/core/internal/client-runtime';
72
81
  `;
82
+ // <Link href="/about"> renders /console/about under basePath "/console", as the RSC server
83
+ // rendered it, so the page hydrates with the same href.
84
+ if (!["", "/"].includes(ctx.basePath.trim())) {
85
+ imports += `import { setFarmBasePath } from '@farm.js/core/internal/client-runtime';
86
+ setFarmBasePath(${JSON.stringify(ctx.basePath)});
87
+ `;
88
+ }
89
+ // trailingSlash: <Link href="/about"> renders /about/, as the RSC server rendered it.
90
+ if (ctx.trailingSlash) {
91
+ imports += `import { setFarmTrailingSlashPreference } from '@farm.js/core/internal/client-runtime';
92
+ setFarmTrailingSlashPreference(true);
93
+ `;
94
+ }
95
+ const i18n = ctx.i18n?.enabled === true;
96
+ if (i18n) {
97
+ imports += `import { localizeFarmHref, resolveFarmLocalePath } from '@farm.js/core/i18n';
98
+ import { _setFarmI18nClientSnapshot } from '@farm.js/core/i18n/client';
99
+
100
+ // A link to another locale loads as a document, as Farm's <Link> does in other apps, so the page
101
+ // and the catalog its client components read change together.
102
+ function farmIsLocaleChange(url) {
103
+ const snapshot = window.__FARM_I18N__;
104
+ if (!snapshot || snapshot.routing === 'none') return false;
105
+ const target = resolveFarmLocalePath(url.pathname, snapshot);
106
+ return (target.locale || snapshot.defaultLocale) !== snapshot.locale;
107
+ }
108
+
109
+ // A redirect() thrown while a navigation renders goes to its target in the page's locale, as the
110
+ // server localizes the redirects it answers.
111
+ function farmLocalizeRedirect(url) {
112
+ const snapshot = window.__FARM_I18N__;
113
+ return snapshot && url.startsWith('/') && !url.startsWith('//')
114
+ ? localizeFarmHref(url, snapshot.locale, snapshot)
115
+ : url;
116
+ }
117
+ `;
118
+ }
73
119
  // farm dev --mobile: every page runs in the shell's WebView, so this entry is the mobile client.
74
120
  if (ctx.mobileClient === "inline") {
75
121
  imports += generateMobileShellNavigation();
@@ -264,7 +310,7 @@ class FarmNavigationErrorBoundary extends React.Component {
264
310
  componentDidCatch(error) {
265
311
  const digest = error && typeof error.digest === 'string' ? error.digest : '';
266
312
  if (digest.startsWith('FARM_REDIRECT;')) {
267
- farmNavigateRef.current?.(digest.split(';').slice(2).join(';'), 'replace');
313
+ farmNavigateRef.current?.(${i18n ? "farmLocalizeRedirect(digest.split(';').slice(2).join(';'))" : "digest.split(';').slice(2).join(';')"}, 'replace');
268
314
  return;
269
315
  }
270
316
  location.reload();
@@ -299,10 +345,16 @@ async function main() {
299
345
  console.error('[Farm.js] Failed to deserialize RSC payload:', e);
300
346
  return;
301
347
  }
302
-
348
+
303
349
  // The page the document loaded with is the baseline: it is never announced.
304
350
  const announceRoute = createFarmRouteAnnouncer();
305
-
351
+ // The head tags the server rendered from the page's metadata, which navigations replace.
352
+ const applyMetadataHead = createFarmMetadataHeadReconciler(initial.metadataHead ?? '');
353
+ ${i18n
354
+ ? ` // The locale the server rendered with, before anything hydrates (window.__FARM_I18N__).
355
+ if (initial.i18n) _setFarmI18nClientSnapshot(initial.i18n);
356
+ `
357
+ : ""}
306
358
  // Root component that manages RSC state
307
359
  function BrowserRoot() {
308
360
  const [payload, set] = React.useState(initial);
@@ -318,26 +370,22 @@ async function main() {
318
370
  : "(p) => React.startTransition(() => set(p));"}
319
371
  }, []);
320
372
 
321
- // Keep document metadata in sync when an RSC navigation swaps only #root.
373
+ // Keep the document head in sync when an RSC navigation swaps only #root: the title, and the
374
+ // tags the server renders from the route's metadata (description, canonical, alternates,
375
+ // robots, Open Graph...), replaced as a page load of the route renders them.
322
376
  React.useEffect(() => {
323
- if (typeof payload.metadata?.title === 'string') {
324
- document.title = payload.metadata.title;
325
- } else {
326
- document.title = '';
327
- }
328
- let description = document.querySelector('meta[name="description"]');
329
- if (typeof payload.metadata?.description === 'string') {
330
- if (!description) {
331
- description = document.createElement('meta');
332
- description.setAttribute('name', 'description');
333
- document.head.appendChild(description);
334
- }
335
- description.setAttribute('content', payload.metadata.description);
336
- } else {
337
- description?.remove();
338
- }
339
- }, [payload.metadata?.title, payload.metadata?.description]);
340
-
377
+ document.title = typeof payload.metadata?.title === 'string' ? payload.metadata.title : '';
378
+ applyMetadataHead(payload.metadataHead ?? '');
379
+ }, [payload]);
380
+ ${i18n
381
+ ? `
382
+ // A payload from back/forward or a refresh carries its locale (and, in development, edited
383
+ // messages): client components re-read it before the browser paints.
384
+ React.useLayoutEffect(() => {
385
+ if (payload !== initial && payload.i18n) _setFarmI18nClientSnapshot(payload.i18n);
386
+ }, [payload]);
387
+ `
388
+ : ""}
341
389
  // Announce a client navigation to screen readers once its page and title are in place.
342
390
  React.useEffect(() => {
343
391
  if (payload !== initial) announceRoute();
@@ -411,7 +459,7 @@ ${withPlugins(`
411
459
  // Back/forward, refreshes and same-page moves are not offered; other origins load as documents.
412
460
  async function navigate(href, action) {
413
461
  const url = new URL(href, location.href);
414
- if (url.origin !== location.origin) {
462
+ if (url.origin !== location.origin${i18n ? " || farmIsLocaleChange(url)" : ""}) {
415
463
  location.assign(url.href);
416
464
  return;
417
465
  }
@@ -1,4 +1,18 @@
1
1
  import type { EntryContext } from "../types.js";
2
+ /**
3
+ * The import query the entry globs static `opengraph-image`/`twitter-image` files with. The
4
+ * plugin's loader answers it with the file's info and bytes (index.ts).
5
+ */
6
+ export declare const FARM_METADATA_IMAGE_QUERY = "?farm-metadata-image";
7
+ /**
8
+ * The config `redirects()`, `rewrites()` and `headers()` in the production server, with core's
9
+ * matchers: sources match the path below the basePath and locale, a redirect keeps the query and
10
+ * an internal destination stays below the basePath (in the request's locale under i18n), and a
11
+ * rewrite keeps the query when its destination names none. A payload request ('<page>.rsc')
12
+ * matches as its page and is sent to the destination's payload. Development gets only the check
13
+ * for a local route, which its dev server asks before a rewrite.
14
+ */
15
+ export declare function generateConfigRoutesRuntime(ctx: EntryContext, configRoutes: EntryContext["configRoutes"], localRouteCheck: boolean): string;
2
16
  /**
3
17
  * Generates the terminal middleware-result handling shared by the RSC entry
4
18
  * and its executable contract tests.
@@ -1 +1 @@
1
- {"version":3,"file":"rsc.d.ts","sourceRoot":"","sources":["../../../src/rsc/entries/rsc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAgBhD;;;GAGG;AACH,wBAAgB,mCAAmC,IAAI,MAAM,CAe5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CA0lD1D"}
1
+ {"version":3,"file":"rsc.d.ts","sourceRoot":"","sources":["../../../src/rsc/entries/rsc.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQhD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,yBAAyB,CAAC;AAgKhE;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,YAAY,EACjB,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC,EAC1C,eAAe,EAAE,OAAO,GACvB,MAAM,CAqGR;AAED;;;GAGG;AACH,wBAAgB,mCAAmC,IAAI,MAAM,CAe5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAo+E1D"}