@farm.js/plugin 0.1.51-beta.3 → 0.1.60

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.51-beta.3";
42
+ export declare const version = "0.1.60";
43
43
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,eAAO,MAAM,OAAO,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,eAAO,MAAM,OAAO,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -39,7 +39,7 @@
39
39
  * })
40
40
  * ```
41
41
  */
42
- export const version = "0.1.51-beta.3";
42
+ export const version = "0.1.60";
43
43
  // Note: Import plugins from their respective subpaths:
44
44
  // - @farm.js/plugin/rsc
45
45
  // - @farm.js/plugin/middleware
@@ -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;AAEhD,eAAO,MAAM,mCAAmC,62BA6B9C,CAAC;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAsU7D"}
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;AAGhD,eAAO,MAAM,mCAAmC,62BA6B9C,CAAC;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CA+X7D"}
@@ -1,3 +1,4 @@
1
+ import { generateMobileShellNavigation } from "../mobile-client.js";
1
2
  export const serverFnTransportErrorClientRuntime = `function createFarmServerFnTransportError(value) {
2
3
  const message = value && typeof value === 'object' && typeof value.message === 'string'
3
4
  ? value.message
@@ -60,7 +61,12 @@ import {
60
61
  createFarmDeploymentRequestHeaders,
61
62
  isFarmDeploymentMismatchResponse,
62
63
  } from '@farm.js/core/deployment';
64
+ import { runFarmNavigationDelegates } from '@farm.js/core/internal/client-runtime';
63
65
  `;
66
+ // farm dev --mobile: every page runs in the shell's WebView, so this entry is the mobile client.
67
+ if (ctx.mobileClient === "inline") {
68
+ imports += generateMobileShellNavigation();
69
+ }
64
70
  if (ctx.actionsEnabled) {
65
71
  imports += `import { setServerCallback, encodeReply, createTemporaryReferenceSet } from '@vitejs/plugin-rsc/browser';
66
72
  import { applyFarmCacheInvalidations } from '@farm.js/core/internal/client-runtime';
@@ -137,8 +143,7 @@ setServerCallback(async (id, args) => {
137
143
  // router performs the navigation here.
138
144
  if (p.returnValue?.redirect?.url) {
139
145
  debug('Server action redirected:', p.returnValue.redirect.url);
140
- history.pushState(null, '', p.returnValue.redirect.url);
141
- await farmNavigateRef.current?.(location.href);
146
+ await farmNavigateRef.current?.(p.returnValue.redirect.url, 'push');
142
147
  return;
143
148
  }
144
149
  debug('Server action failed:', id);
@@ -171,6 +176,34 @@ function debug(...args) {
171
176
  ${debugLog}
172
177
  }
173
178
 
179
+ // A server component that fails while a client navigation renders it: a redirect() becomes a
180
+ // client navigation to its target, and anything else loads the URL as a document, so the server
181
+ // answers with its status and error.tsx. Errors in the first render are left to React.
182
+ class FarmNavigationErrorBoundary extends React.Component {
183
+ constructor(props) {
184
+ super(props);
185
+ this.state = { error: null, payload: props.payload };
186
+ }
187
+ static getDerivedStateFromProps(props, state) {
188
+ return props.payload === state.payload ? null : { error: null, payload: props.payload };
189
+ }
190
+ static getDerivedStateFromError(error) {
191
+ return { error };
192
+ }
193
+ componentDidCatch(error) {
194
+ const digest = error && typeof error.digest === 'string' ? error.digest : '';
195
+ if (digest.startsWith('FARM_REDIRECT;')) {
196
+ farmNavigateRef.current?.(digest.split(';').slice(2).join(';'), 'replace');
197
+ return;
198
+ }
199
+ location.reload();
200
+ }
201
+ render() {
202
+ if (this.state.error && !this.props.navigated) throw this.state.error;
203
+ return this.state.error ? null : this.props.children;
204
+ }
205
+ }
206
+
174
207
  async function main() {
175
208
  // Prevent double execution (e.g. script loaded twice)
176
209
  if (globalThis.__FARM_RSC_HYDRATED) return;
@@ -252,8 +285,8 @@ async function main() {
252
285
  }
253
286
 
254
287
  e.preventDefault();
255
- history.pushState(null, '', a.href);
256
- nav();
288
+ // Link replace marks its anchor; a plain anchor pushes.
289
+ navigate(a.href, a.hasAttribute('data-replace') ? 'replace' : 'push');
257
290
  }
258
291
  };
259
292
 
@@ -272,11 +305,35 @@ async function main() {
272
305
  if (payload.root != null) console.warn('[Farm.js] payload.rootContent missing; not using payload.root to avoid duplicate block. Keys:', Object.keys(payload));
273
306
  return null;
274
307
  }
275
- return content;
308
+ return React.createElement(
309
+ FarmNavigationErrorBoundary,
310
+ { payload, navigated: payload !== initial },
311
+ content,
312
+ );
276
313
  }
277
314
 
315
+ // An in-app navigation (a link click, a redirect after a server action). Navigation delegates
316
+ // get it first, after the router's own checks, as Farm's other routers offer it: one that takes
317
+ // it (a native shell showing the URL on its own screen) leaves the page and URL as they are.
318
+ // Back/forward, refreshes and same-page moves are not offered; other origins load as documents.
319
+ async function navigate(href, action) {
320
+ const url = new URL(href, location.href);
321
+ if (url.origin !== location.origin) {
322
+ location.assign(url.href);
323
+ return;
324
+ }
325
+ const from = location.pathname + location.search;
326
+ const to = url.pathname + url.search;
327
+ if (to !== from && (await runFarmNavigationDelegates({ url: url.href, from, to, action }))) {
328
+ return;
329
+ }
330
+ if (action === 'replace') history.replaceState(null, '', url.href);
331
+ else history.pushState(null, '', url.href);
332
+ await refetch(location.href);
333
+ }
334
+ farmNavigateRef.current = navigate;
335
+
278
336
  // Fetch new RSC payload for a URL
279
- farmNavigateRef.current = (url) => refetch(url);
280
337
  async function refetch(url) {
281
338
  debug('Fetching RSC for:', url);
282
339
 
@@ -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;AAYhD;;;GAGG;AACH,wBAAgB,mCAAmC,IAAI,MAAM,CAe5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAu+C1D"}
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;AAahD;;;GAGG;AACH,wBAAgB,mCAAmC,IAAI,MAAM,CAe5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAigD1D"}
@@ -1,4 +1,5 @@
1
1
  import { createRequire } from "node:module";
2
+ import { FARM_RSC_MOBILE_SHELL_CLIENT_PLACEHOLDER } from "../mobile-client.js";
2
3
  const require_ = createRequire(import.meta.url);
3
4
  /** Core's production source for the \`mcp\` plugin, so both servers merge config the same way. */
4
5
  function generateMCPPluginSource() {
@@ -90,7 +91,7 @@ import {
90
91
  createProductionMiddlewareRunner,
91
92
  } from '@farm.js/core/middleware';
92
93
  import { _withFarmGuardedResponseCache } from '@farm.js/core/internal/production-runtime';
93
- import {
94
+ ${ctx.mobileClient === "entry" ? "import { _applyFarmMobileShellClient } from '@farm.js/core/internal/production-runtime';\n" : ""}import {
94
95
  getAllowedAPIRouteMethods,
95
96
  invokeAPIRouteEndpoint,
96
97
  isFarmAPIPathname,
@@ -764,6 +765,14 @@ function getLayoutModules(pageFilePath) {
764
765
  return getRouteModules(pageFilePath, layouts, 'layout');
765
766
  }
766
767
 
768
+ // Flight keeps only the digest onError returns for a server error. A notFound() or redirect() keeps
769
+ // its own, so the request handler still answers 404 or the redirect; other errors are logged as
770
+ // React's default handler logs them.
771
+ function farmRscOnError(error) {
772
+ if (getFarmRedirectError(error) || isFarmNotFoundError(error)) return error.digest;
773
+ console.error(error);
774
+ }
775
+
767
776
  function getMatchingBoundary(pageFilePath, modules, kind) {
768
777
  // Before page selection (for example, middleware failure), only the root
769
778
  // boundary applies. Do not guess a route from a partially processed URL.
@@ -983,12 +992,13 @@ async function resolveFarmRequest(farmCacheGuard, request, context) {
983
992
  return new Response(null, { status: 499, headers: { 'Cache-Control': 'no-store' } });
984
993
  }
985
994
  // No client router here, so the redirect has to be a real HTTP
986
- // redirect the browser follows on its own.
995
+ // redirect the browser follows on its own. 303 makes it a GET, as islands mode
996
+ // answers: a 307 or 308 would post the form again to the target.
987
997
  const formRedirect = getFarmRedirectError(e);
988
998
  if (formRedirect) {
989
999
  debug('Form action redirected:', formRedirect.url);
990
1000
  return new Response(null, {
991
- status: formRedirect.status,
1001
+ status: 303,
992
1002
  headers: { location: formRedirect.url, 'Cache-Control': 'no-store' },
993
1003
  });
994
1004
  }
@@ -1151,7 +1161,7 @@ async function resolveFarmRequest(farmCacheGuard, request, context) {
1151
1161
  // Full RSC mode with streaming
1152
1162
  debug('Using RSC streaming mode');
1153
1163
 
1154
- const rscStream = renderToReadableStream(payload${ctx.actionsEnabled ? ", { temporaryReferences }" : ""});
1164
+ const rscStream = renderToReadableStream(payload, { onError: farmRscOnError${ctx.actionsEnabled ? ", temporaryReferences" : ""} });
1155
1165
 
1156
1166
  if (acceptHeader.includes('text/x-component')) {
1157
1167
  debug('Returning RSC stream for client navigation');
@@ -1263,7 +1273,7 @@ async function resolveFarmRequest(farmCacheGuard, request, context) {
1263
1273
  rootContent: rootInner,
1264
1274
  metadata: { title: 'Error' },
1265
1275
  };
1266
- const rscStream = renderToReadableStream(payload);
1276
+ const rscStream = renderToReadableStream(payload, { onError: farmRscOnError });
1267
1277
  const headers = new Headers(errorHeaders);
1268
1278
  headers.set('cache-control', 'private, no-store');
1269
1279
  headers.set('x-content-type-options', 'nosniff');
@@ -1470,8 +1480,23 @@ async function handler(request, context) {
1470
1480
  headers.set('x-nitro-prerender', encodeURIComponent(farmPayloadPath(new URL(request.url).pathname)));
1471
1481
  return new Response(response.body, { status: response.status, statusText: response.statusText, headers });
1472
1482
  }
1473
- return response;
1483
+ return ${ctx.mobileClient === "entry" ? "_applyFarmMobileShellClient(request, response, farmMobileShellClient)" : "response"};
1474
1484
  }
1485
+ ${ctx.mobileClient === "entry"
1486
+ ? `
1487
+ // The mobile client (RFC 0004): the documents a mobile shell asks for (X-Farm-Shell) load its
1488
+ // entry instead of the web one, privately, and every HTML response varies on the header. The
1489
+ // Nitro build fills this in once the client is built; null leaves responses as they are.
1490
+ function readFarmMobileShellClient() {
1491
+ try {
1492
+ return JSON.parse("${FARM_RSC_MOBILE_SHELL_CLIENT_PLACEHOLDER}");
1493
+ } catch {
1494
+ return null;
1495
+ }
1496
+ }
1497
+ const farmMobileShellClient = readFarmMobileShellClient();
1498
+ `
1499
+ : ""}
1475
1500
 
1476
1501
  async function handleFarmRequestWithRuntime(request, context) {
1477
1502
  return _runWithAPIRequestRuntime({
@@ -22,7 +22,7 @@
22
22
  * ```
23
23
  */
24
24
  import { type Plugin, type UserConfig } from "vite";
25
- import type { FarmRscPluginOptions, EntryContext } from "./types.js";
25
+ import type { FarmRscPluginOptions, EntryContext, FarmRscMobileClient } from "./types.js";
26
26
  import type { FarmServerActionsConfig } from "@farm.js/core/server-action-security";
27
27
  import type { FarmAPIConfig } from "@farm.js/core/api";
28
28
  import type { FarmMiddlewareConfig } from "@farm.js/core/middleware";
@@ -110,6 +110,8 @@ export interface FarmRscConfig {
110
110
  * `oauth` is not supported in RSC apps yet.
111
111
  */
112
112
  mcp?: FarmMCPUserConfig;
113
+ /** @internal See `FarmRscPluginOptions.mobileClient`; set by `farm dev` and `farm build`. */
114
+ mobileClient?: FarmRscMobileClient;
113
115
  }
114
116
  /**
115
117
  * Define a Farm.js RSC configuration
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rsc/index.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAIL,KAAK,MAAM,EACX,KAAK,UAAU,EAChB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAI9E,OAAO,EAML,sBAAsB,EAIvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAyB,KAAK,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC5F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAoBvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAmD9D,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAExF,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,wBAAwB,CAAC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,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE;QACR,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,gHAAgH;IAChH,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IAChB;;;;OAIG;IACH,EAAE,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC;IACtC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,GAAG,qBAAqB,CAAA;KAAE,CAAC;IACtD;;;;;OAKG;IACH,GAAG,CAAC,EAAE,iBAAiB,CAAC;IACxB,6FAA6F;IAC7F,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,GAAE,aAAkB,GAAG,UAAU,CA0EnE;AAsbD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,OAAO,GAAE,oBAAyB,GAAG,MAAM,EAAE,CAqsC5E"}
package/dist/rsc/index.js CHANGED
@@ -35,6 +35,7 @@ import { transformFarmRouteActionClients } from "./route-action-transform.js";
35
35
  import { createFarmServerFnBoundaryModule, isFarmServerFnBoundaryId, transformFarmServerFns, } from "./server-fn-transform.js";
36
36
  import { transformAutomaticOptimizedBoundaries } from "./automatic-optimized-boundary.js";
37
37
  import { resolveRscBuildOutputPath } from "./build-paths.js";
38
+ import { FARM_RSC_MOBILE_CLIENT_ENTRY_NAME, createFarmRscMobileClientManifestPlugin, generateMobileClientEntry, removeFarmRscMobileClientManifest, } from "./mobile-client.js";
38
39
  import { rscPrivateClientSourcemaps } from "./client-sourcemaps.js";
39
40
  import { findDocumentLayouts, findRouteFiles } from "./document-layouts.js";
40
41
  import { assertRscPackageCompatibility } from "./compatibility.js";
@@ -129,6 +130,7 @@ export function defineConfig(config = {}) {
129
130
  deploymentId: config.deploymentId,
130
131
  routesDir: config.routesDir,
131
132
  entries: config.entries,
133
+ mobileClient: config.mobileClient,
132
134
  }),
133
135
  ...(Array.isArray(config.plugins) ? config.plugins : []),
134
136
  ],
@@ -198,6 +200,11 @@ const VIRTUAL_PREFIX = "\0";
198
200
  const VIRTUAL_RSC_ENTRY = "virtual:@farm.js/rsc/entry-rsc";
199
201
  const VIRTUAL_SSR_ENTRY = "virtual:@farm.js/rsc/entry-ssr";
200
202
  const VIRTUAL_CLIENT_ENTRY = "virtual:@farm.js/rsc/entry-client";
203
+ const VIRTUAL_MOBILE_CLIENT_ENTRY = "virtual:@farm.js/rsc/entry-mobile";
204
+ /** The browser entry, as the client build's `index` input names it. */
205
+ const RSC_CLIENT_ENTRY = "./.farm/rsc-entries/entry.browser.tsx";
206
+ /** The mobile client entry a build of an app with a `mobile` block adds. */
207
+ const RSC_MOBILE_CLIENT_ENTRY = "./.farm/rsc-entries/entry.mobile.tsx";
201
208
  const VIRTUAL_HYDRATE_ENTRY = "virtual:@farm.js/rsc/hydrate";
202
209
  const OPTIMIZED_BOUNDARY_ADAPTER = "@farm.js/plugin/rsc/optimized-boundary";
203
210
  const STRATA_PACKAGE = "@farming-labs/strata";
@@ -521,6 +528,8 @@ export default function farmRsc(options = {}) {
521
528
  // Context passed to entry generators
522
529
  let entryContext;
523
530
  let rscBuildRoot;
531
+ /** The app root, when this build adds the mobile client entry. */
532
+ let mobileClientRoot;
524
533
  const middlewareConfigModules = new Map();
525
534
  let mcpConfigCandidates = null;
526
535
  // Store for debugging
@@ -613,6 +622,7 @@ export default function farmRsc(options = {}) {
613
622
  return [
614
623
  farmEnvironmentFunctionsPlugin(),
615
624
  rscPrivateClientSourcemaps(),
625
+ createFarmRscMobileClientManifestPlugin(() => mobileClientRoot),
616
626
  {
617
627
  name: "@farm.js/plugin/rsc:middleware-config",
618
628
  enforce: "pre",
@@ -821,6 +831,18 @@ export default function farmRsc(options = {}) {
821
831
  dev: env.command === "serve",
822
832
  }));
823
833
  const publicImageConfig = getPublicFarmImageConfig(imageConfig);
834
+ // An app with a `mobile` block (RFC 0004): a build adds the mobile entry, and
835
+ // `farm dev --mobile` makes the browser entry itself the mobile client.
836
+ const mobileClient = options.mobileClient === "entry" && env.command === "build"
837
+ ? "entry"
838
+ : options.mobileClient === "inline" && env.command === "serve"
839
+ ? "inline"
840
+ : undefined;
841
+ mobileClientRoot = mobileClient === "entry" ? root : undefined;
842
+ // A mobile client from an earlier build must not outlive the `mobile` block.
843
+ if (env.command === "build" && mobileClient !== "entry") {
844
+ removeFarmRscMobileClientManifest(root);
845
+ }
824
846
  // Development always optimizes with Sharp, as core's dev server does.
825
847
  const imageRuntime = env.command === "serve"
826
848
  ? imageConfig.provider === "none"
@@ -866,6 +888,7 @@ export default function farmRsc(options = {}) {
866
888
  debug,
867
889
  development: env.command === "serve",
868
890
  clientCachePersistence: generateClientCachePersistenceCode(resolveFarmClientCacheAdapterEntry(root, c.cache)),
891
+ mobileClient,
869
892
  };
870
893
  logInfo(`srcDir: ${entryContext.srcDir}, outDir: ${entryContext.outDir}`);
871
894
  // Write real entry files so @vitejs/plugin-rsc can use file-based entries.
@@ -876,6 +899,9 @@ export default function farmRsc(options = {}) {
876
899
  await fs.writeFile(entryRscPath, generateRscEntry(entryContext));
877
900
  await fs.writeFile(entrySsrPath, generateSsrEntry(entryContext));
878
901
  await fs.writeFile(entryClientPath, generateClientEntry(entryContext));
902
+ if (mobileClient === "entry") {
903
+ await fs.writeFile(path.join(entriesDir, "entry.mobile.tsx"), generateMobileClientEntry(RSC_CLIENT_ENTRY));
904
+ }
879
905
  await fs.writeFile(path.join(entriesDir, "error-fallback.tsx"), generateErrorFallbackEntry());
880
906
  logInfo(`Wrote RSC entries to ${entriesDir}`);
881
907
  // User must add rsc({ entries: { rsc, ssr, client } }) to config.plugins so the RSC plugin
@@ -883,7 +909,7 @@ export default function farmRsc(options = {}) {
883
909
  // Entry paths (relative to root) so Vite runs rsc/ssr/client builds (not index.html).
884
910
  const entryRsc = "./.farm/rsc-entries/entry.rsc.tsx";
885
911
  const entrySsr = "./.farm/rsc-entries/entry.ssr.tsx";
886
- const entryClient = "./.farm/rsc-entries/entry.browser.tsx";
912
+ const entryClient = RSC_CLIENT_ENTRY;
887
913
  // Resolve @farm.js/core so Vite (and rsc/ssr envs) can load it when app code imports it (fixes "Failed to resolve entry" in dev).
888
914
  let farmCorePath = null;
889
915
  try {
@@ -1027,7 +1053,14 @@ export default function farmRsc(options = {}) {
1027
1053
  client: {
1028
1054
  build: {
1029
1055
  outDir: `${outDir}/client`,
1030
- rollupOptions: { input: { index: entryClient } },
1056
+ rollupOptions: {
1057
+ input: {
1058
+ index: entryClient,
1059
+ ...(mobileClient === "entry"
1060
+ ? { [FARM_RSC_MOBILE_CLIENT_ENTRY_NAME]: RSC_MOBILE_CLIENT_ENTRY }
1061
+ : {}),
1062
+ },
1063
+ },
1031
1064
  },
1032
1065
  resolve: { conditions: ["browser", "import"] },
1033
1066
  // Optimize what the browser entry needs up front. A dependency first
@@ -1193,6 +1226,9 @@ export default function farmRsc(options = {}) {
1193
1226
  if (source.includes("rsc-entries") && source.includes("entry.browser.tsx")) {
1194
1227
  return VIRTUAL_PREFIX + VIRTUAL_CLIENT_ENTRY;
1195
1228
  }
1229
+ if (source.includes("rsc-entries") && source.includes("entry.mobile.tsx")) {
1230
+ return VIRTUAL_PREFIX + VIRTUAL_MOBILE_CLIENT_ENTRY;
1231
+ }
1196
1232
  if (source.includes("rsc-entries") && source.includes("entry.rsc.tsx")) {
1197
1233
  return VIRTUAL_PREFIX + VIRTUAL_RSC_ENTRY;
1198
1234
  }
@@ -1223,6 +1259,9 @@ export default function farmRsc(options = {}) {
1223
1259
  logInfo("Generating client entry");
1224
1260
  return generateClientEntry(entryContext);
1225
1261
  }
1262
+ if (id === VIRTUAL_PREFIX + VIRTUAL_MOBILE_CLIENT_ENTRY) {
1263
+ return generateMobileClientEntry(RSC_CLIENT_ENTRY);
1264
+ }
1226
1265
  // Handle dynamic hydration entries
1227
1266
  if (id.startsWith(VIRTUAL_PREFIX + "/@rsc-hydrate/")) {
1228
1267
  const pagePath = id.replace(VIRTUAL_PREFIX + "/@rsc-hydrate", "");
@@ -0,0 +1,67 @@
1
+ /** The client build's input name, and so the entry file's name: `assets/farm-mobile-client-<hash>.js`. */
2
+ export declare const FARM_RSC_MOBILE_CLIENT_ENTRY_NAME = "farm-mobile-client";
3
+ /** The server entry's stand-in for the shell client, replaced once the client is built. */
4
+ export declare const FARM_RSC_MOBILE_SHELL_CLIENT_PLACEHOLDER = "__farm_mobile_shell_client__";
5
+ /** What the server needs to point a document at the mobile client (core's `FarmMobileShellClient`). */
6
+ export interface FarmRscMobileShellClient {
7
+ webEntry: string;
8
+ entry: string;
9
+ webOnly: string[];
10
+ }
11
+ /** Core's `FarmMobileClientManifest`, with the directory its files are in. */
12
+ export interface FarmRscMobileClientManifest {
13
+ version: 1;
14
+ webEntry: string;
15
+ entry: string;
16
+ stylesheet: string;
17
+ files: string[];
18
+ /** The client output, relative to the app root: the RSC pipeline builds outside `.farm/client`. */
19
+ clientDir: string;
20
+ }
21
+ export declare function farmRscMobileClientManifestPath(root: string): string;
22
+ /** A build without the mobile entry removes the record an earlier build left. */
23
+ export declare function removeFarmRscMobileClientManifest(root: string): void;
24
+ /**
25
+ * Inside the native shell, whose bridge script runs before the page, hand in-app navigations to
26
+ * the shell's navigator, as core's `farmMobileShellClient` does; in a browser it does nothing. It
27
+ * is written into the entry module rather than imported from a core module the browser entry also
28
+ * imports: the bundler places a shared module's code in the web client's chunks.
29
+ */
30
+ export declare function generateMobileShellNavigation(): string;
31
+ /** The mobile entry's source: install the shell's navigation delegate, then run the browser entry. */
32
+ export declare function generateMobileClientEntry(browserEntry: string): string;
33
+ /** Client build plugin: records the mobile entry and every file the client build wrote. */
34
+ export declare function createFarmRscMobileClientManifestPlugin(getRoot: () => string | undefined): {
35
+ name: string;
36
+ enforce: "post";
37
+ apply: "build";
38
+ generateBundle(this: {
39
+ environment?: {
40
+ name?: string;
41
+ };
42
+ }, _output: unknown, bundle: Record<string, {
43
+ type: string;
44
+ name?: string;
45
+ isEntry?: boolean;
46
+ }>): void;
47
+ };
48
+ /**
49
+ * Finish `.farm/mobile-client.json` once the web entry and the stylesheet are known, and return
50
+ * what the server needs. Null when the build recorded no mobile entry, or its file is missing.
51
+ */
52
+ export declare function finalizeFarmRscMobileClient(options: {
53
+ root: string;
54
+ clientDir: string;
55
+ /** The web entry the bootstrap script imports, such as `/assets/index-<hash>.js`. */
56
+ webEntry: string;
57
+ /** The stylesheet documents link, or "". */
58
+ stylesheet: string;
59
+ }): FarmRscMobileShellClient | null;
60
+ /** The shell client as the contents of a JavaScript string literal of any quote. */
61
+ export declare function encodeFarmRscMobileShellClient(client: FarmRscMobileShellClient | null): string;
62
+ /**
63
+ * Fill in the shell client wherever the RSC server bundle has the placeholder, which only a build
64
+ * with the mobile entry has. `resolve` runs only then, once: a patched bundle has none left.
65
+ */
66
+ export declare function patchFarmRscMobileShellClient(rscDir: string, resolve: () => FarmRscMobileShellClient | null): void;
67
+ //# sourceMappingURL=mobile-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mobile-client.d.ts","sourceRoot":"","sources":["../../src/rsc/mobile-client.ts"],"names":[],"mappings":"AAqBA,0GAA0G;AAC1G,eAAO,MAAM,iCAAiC,uBAAuB,CAAC;AAEtE,2FAA2F;AAC3F,eAAO,MAAM,wCAAwC,iCAAiC,CAAC;AAKvF,uGAAuG;AACvG,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,8EAA8E;AAC9E,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,CAAC,CAAC;IACX,QA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,IAAI,CAsBN"}
@@ -0,0 +1,148 @@
1
+ /**
2
+ * The mobile client of an RSC app with a `mobile` block (RFC 0004, 7.2), the RSC pipeline's
3
+ * counterpart of core's `nitro/mobile-client.ts`.
4
+ *
5
+ * The build adds one client entry, `farm-mobile-client`: it hands in-app navigations to the native
6
+ * shell and then runs the browser entry, so it shares every chunk with the web client. The server
7
+ * points the documents a shell asks for (`X-Farm-Shell`) at it, with core's
8
+ * `_applyFarmMobileShellClient`. `.farm/mobile-client.json` records it in core's format, which
9
+ * `farm build --mobile` reads to bundle the client's files into the app.
10
+ */
11
+ import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync, } from "fs";
12
+ import path from "path";
13
+ /** The client build's input name, and so the entry file's name: `assets/farm-mobile-client-<hash>.js`. */
14
+ export const FARM_RSC_MOBILE_CLIENT_ENTRY_NAME = "farm-mobile-client";
15
+ /** The server entry's stand-in for the shell client, replaced once the client is built. */
16
+ export const FARM_RSC_MOBILE_SHELL_CLIENT_PLACEHOLDER = "__farm_mobile_shell_client__";
17
+ /** Next to the RSC entries, as core writes it to its build directory (`.farm/`); never served. */
18
+ const MANIFEST_FILE = "mobile-client.json";
19
+ /** Vite names every client output file `name-<hash>.ext`, the hash taken from its content. */
20
+ const HASHED_FILE = /-[A-Za-z0-9_-]{8,}\.[A-Za-z0-9]+$/;
21
+ export function farmRscMobileClientManifestPath(root) {
22
+ return path.join(root, ".farm", MANIFEST_FILE);
23
+ }
24
+ /** A build without the mobile entry removes the record an earlier build left. */
25
+ export function removeFarmRscMobileClientManifest(root) {
26
+ rmSync(farmRscMobileClientManifestPath(root), { force: true });
27
+ }
28
+ /**
29
+ * Inside the native shell, whose bridge script runs before the page, hand in-app navigations to
30
+ * the shell's navigator, as core's `farmMobileShellClient` does; in a browser it does nothing. It
31
+ * is written into the entry module rather than imported from a core module the browser entry also
32
+ * imports: the bundler places a shared module's code in the web client's chunks.
33
+ */
34
+ export function generateMobileShellNavigation() {
35
+ return `import { delegateNavigation as farmDelegateNavigation } from '@farm.js/core/client';
36
+ const farmMobileShellBridge = globalThis.__farmBridge;
37
+ const farmOfferNavigation = farmMobileShellBridge?.offerNavigation;
38
+ if (typeof farmOfferNavigation === 'function') {
39
+ farmDelegateNavigation((context) => farmOfferNavigation.call(farmMobileShellBridge, context) === true);
40
+ }
41
+ `;
42
+ }
43
+ /** The mobile entry's source: install the shell's navigation delegate, then run the browser entry. */
44
+ export function generateMobileClientEntry(browserEntry) {
45
+ // The browser entry hydrates asynchronously, so the delegate is in place before any click.
46
+ return `import ${JSON.stringify(browserEntry)};
47
+ ${generateMobileShellNavigation()}`;
48
+ }
49
+ /** Client build plugin: records the mobile entry and every file the client build wrote. */
50
+ export function createFarmRscMobileClientManifestPlugin(getRoot) {
51
+ return {
52
+ name: "@farm.js/plugin/rsc:mobile-client-manifest",
53
+ enforce: "post",
54
+ apply: "build",
55
+ generateBundle(_output, bundle) {
56
+ const root = getRoot();
57
+ if (!root || this.environment?.name !== "client")
58
+ return;
59
+ const entry = Object.entries(bundle).find(([, output]) => output.type === "chunk" &&
60
+ output.isEntry &&
61
+ output.name === FARM_RSC_MOBILE_CLIENT_ENTRY_NAME)?.[0];
62
+ const record = entry
63
+ ? {
64
+ entry,
65
+ files: Object.keys(bundle)
66
+ .filter((file) => !file.endsWith(".map"))
67
+ .sort(),
68
+ }
69
+ : null;
70
+ const manifestPath = farmRscMobileClientManifestPath(root);
71
+ mkdirSync(path.dirname(manifestPath), { recursive: true });
72
+ writeFileSync(manifestPath, JSON.stringify(record));
73
+ },
74
+ };
75
+ }
76
+ function readRecord(root) {
77
+ try {
78
+ const record = JSON.parse(readFileSync(farmRscMobileClientManifestPath(root), "utf8"));
79
+ return record && typeof record.entry === "string" && Array.isArray(record.files)
80
+ ? record
81
+ : null;
82
+ }
83
+ catch {
84
+ return null;
85
+ }
86
+ }
87
+ /**
88
+ * Finish `.farm/mobile-client.json` once the web entry and the stylesheet are known, and return
89
+ * what the server needs. Null when the build recorded no mobile entry, or its file is missing.
90
+ */
91
+ export function finalizeFarmRscMobileClient(options) {
92
+ const record = readRecord(options.root);
93
+ if (!record || !options.webEntry)
94
+ return null;
95
+ const entryFile = path.join(options.clientDir, record.entry);
96
+ if (!existsSync(entryFile) || statSync(entryFile).size === 0)
97
+ return null;
98
+ const files = new Set(record.files.filter((file) => HASHED_FILE.test(file)).map((file) => `/${file}`));
99
+ const manifest = {
100
+ version: 1,
101
+ webEntry: options.webEntry,
102
+ entry: `/${record.entry}`,
103
+ stylesheet: options.stylesheet,
104
+ files: [...files].sort(),
105
+ clientDir: path.relative(options.root, options.clientDir).split(path.sep).join("/"),
106
+ };
107
+ writeFileSync(farmRscMobileClientManifestPath(options.root), `${JSON.stringify(manifest, null, 2)}\n`);
108
+ // The mobile entry loads the web entry, so every web chunk is the mobile client's too.
109
+ return { webEntry: options.webEntry, entry: manifest.entry, webOnly: [] };
110
+ }
111
+ /** The shell client as the contents of a JavaScript string literal of any quote. */
112
+ export function encodeFarmRscMobileShellClient(client) {
113
+ return JSON.stringify(JSON.stringify(client))
114
+ .slice(1, -1)
115
+ .replace(/'/g, "\\u0027")
116
+ .replace(/`/g, "\\u0060")
117
+ .replace(/\$/g, "\\u0024")
118
+ .replace(/\u2028/g, "\\u2028")
119
+ .replace(/\u2029/g, "\\u2029");
120
+ }
121
+ /**
122
+ * Fill in the shell client wherever the RSC server bundle has the placeholder, which only a build
123
+ * with the mobile entry has. `resolve` runs only then, once: a patched bundle has none left.
124
+ */
125
+ export function patchFarmRscMobileShellClient(rscDir, resolve) {
126
+ const files = [];
127
+ const visit = (dir) => {
128
+ if (!existsSync(dir))
129
+ return;
130
+ for (const name of readdirSync(dir)) {
131
+ const file = path.join(dir, name);
132
+ if (statSync(file).isDirectory())
133
+ visit(file);
134
+ else if (/\.(?:m|c)?js$/.test(name) &&
135
+ readFileSync(file, "utf8").includes(FARM_RSC_MOBILE_SHELL_CLIENT_PLACEHOLDER)) {
136
+ files.push(file);
137
+ }
138
+ }
139
+ };
140
+ visit(rscDir);
141
+ if (files.length === 0)
142
+ return;
143
+ const encoded = encodeFarmRscMobileShellClient(resolve());
144
+ for (const file of files) {
145
+ const code = readFileSync(file, "utf8");
146
+ writeFileSync(file, code.split(FARM_RSC_MOBILE_SHELL_CLIENT_PLACEHOLDER).join(encoded));
147
+ }
148
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"nitro-build.d.ts","sourceRoot":"","sources":["../../src/rsc/nitro-build.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA+BH;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,IAAI,CAKN;AAcD,gBAAgB;AAChB,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAqCrF;AAuGD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GACxD,OAAO,CAAC,IAAI,CAAC,CA0Bf;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GACxD,OAAO,CAAC,IAAI,CAAC,CAgCf;AA8FD,MAAM,MAAM,oBAAoB,GAAG;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,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AO,CAAC,IAAI,CAAC,CAwIhF"}
@@ -8,6 +8,7 @@ import { createRequire } from "node:module";
8
8
  import { writeFileSync, readFileSync, mkdirSync, copyFileSync, existsSync, readdirSync, lstatSync, rmSync, statSync, symlinkSync, } from "fs";
9
9
  import { FARM_NODE_ENV_MODULE_FILE, FARM_NODE_ENV_MODULE_SOURCE, } from "@farm.js/core/internal/production-node-env";
10
10
  import { resolveRscBuildOutputPath } from "./build-paths.js";
11
+ import { finalizeFarmRscMobileClient, patchFarmRscMobileShellClient } from "./mobile-client.js";
11
12
  const MANIFEST_FILENAME = "__vite_rsc_assets_manifest.js";
12
13
  const MIN_MANIFEST_BYTES = 100; // real manifest is ~500+, stub is 64
13
14
  const POLL_INTERVAL_MS = 50;
@@ -362,7 +363,7 @@ async function traceRscBundleDependencies(root, serverDir, rscDir, ssrDir) {
362
363
  * and hydrates. Runs on the Vite output before Nitro, so the prerender pass and the copies in the
363
364
  * server output render the same document. Only placeholders are replaced, so it is idempotent.
364
365
  */
365
- function patchRscServerBundles(rscDir, ssrDir, publicDir, assetsDir) {
366
+ function patchRscServerBundles(root, rscDir, ssrDir, publicDir, assetsDir) {
366
367
  // Patch SSR bundle: inject production client CSS href and bootstrap script so HTML has styles and hydration works
367
368
  const ssrIndexPath = path.join(ssrDir, "index.js");
368
369
  const manifestPath = path.join(rscDir, MANIFEST_FILENAME);
@@ -404,16 +405,24 @@ function patchRscServerBundles(rscDir, ssrDir, publicDir, assetsDir) {
404
405
  // ignore
405
406
  }
406
407
  }
408
+ const assetsDirName = assetsDir ?? "assets";
409
+ const assetsRoot = path.join(publicDir, assetsDirName);
410
+ let clientCssHref = "";
411
+ if (existsSync(assetsRoot)) {
412
+ const files = readdirSync(assetsRoot);
413
+ const cssFile = files.find((f) => f.endsWith(".css"));
414
+ if (cssFile)
415
+ clientCssHref = `/${assetsDirName}/${cssFile}`;
416
+ }
417
+ // An app with a `mobile` block: the server learns the mobile entry its shell documents load.
418
+ // Only a build with the mobile entry has the placeholder, so other apps are left as they are.
419
+ patchFarmRscMobileShellClient(rscDir, () => finalizeFarmRscMobileClient({
420
+ root,
421
+ clientDir: publicDir,
422
+ webEntry: clientEntryHref,
423
+ stylesheet: clientCssHref,
424
+ }));
407
425
  if (existsSync(ssrIndexPath)) {
408
- const assetsDirName = assetsDir ?? "assets";
409
- const assetsRoot = path.join(publicDir, assetsDirName);
410
- let clientCssHref = "";
411
- if (existsSync(assetsRoot)) {
412
- const files = readdirSync(assetsRoot);
413
- const cssFile = files.find((f) => f.endsWith(".css"));
414
- if (cssFile)
415
- clientCssHref = `/${assetsDirName}/${cssFile}`;
416
- }
417
426
  try {
418
427
  let ssrCode = readFileSync(ssrIndexPath, "utf-8");
419
428
  // Only the assignment: the bundle also compares against the placeholder, and a second
@@ -577,7 +586,7 @@ export async function buildRscNitro(options) {
577
586
  minify: true,
578
587
  };
579
588
  if (ssrPath) {
580
- patchRscServerBundles(path.dirname(path.resolve(rendererPath)), path.dirname(path.resolve(ssrPath)), publicDir, assetsDir);
589
+ patchRscServerBundles(path.resolve(root), path.dirname(path.resolve(rendererPath)), path.dirname(path.resolve(ssrPath)), publicDir, assetsDir);
581
590
  }
582
591
  const nitro = await createNitro(config);
583
592
  const serverDir = nitro.options.output.serverDir;
@@ -45,7 +45,16 @@ export interface FarmRscPluginOptions {
45
45
  * @default false
46
46
  */
47
47
  debug?: boolean;
48
+ /**
49
+ * @internal Set by `farm dev` and `farm build` for an app with a `mobile` block (RFC 0004).
50
+ * `"entry"`: the build adds a mobile client entry, which the server points the documents a
51
+ * mobile shell asks for (`X-Farm-Shell`) at. `"inline"`: the browser entry itself hands in-app
52
+ * navigations to the shell (`farm dev --mobile`).
53
+ */
54
+ mobileClient?: FarmRscMobileClient;
48
55
  }
56
+ /** @internal See `FarmRscPluginOptions.mobileClient`. */
57
+ export type FarmRscMobileClient = "entry" | "inline";
49
58
  /**
50
59
  * Internal context passed to entry generators.
51
60
  * Contains resolved configuration values needed to generate entry files.
@@ -129,6 +138,8 @@ export interface EntryContext {
129
138
  imports: string;
130
139
  init: string;
131
140
  };
141
+ /** The mobile client of an app with a `mobile` block (see `FarmRscPluginOptions`). */
142
+ mobileClient?: FarmRscMobileClient;
132
143
  }
133
144
  /**
134
145
  * Matched route information from the file-based router.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/rsc/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AAC3F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,EACV,uBAAuB,EACvB,+BAA+B,EAChC,MAAM,sCAAsC,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,yDAAyD;IACzD,aAAa,CAAC,EAAE,uBAAuB,CAAC;IAExC,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,OAAO,CAAC,EAAE;QACR,wCAAwC;QACxC,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,wCAAwC;QACxC,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,2CAA2C;QAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IAEf,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IAEf,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,C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-1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm.js/plugin",
3
- "version": "0.1.51-beta.3",
3
+ "version": "0.1.60",
4
4
  "description": "Official plugins for Farm.js framework",
5
5
  "license": "MIT",
6
6
  "author": "Farm.js Team",
@@ -63,7 +63,7 @@
63
63
  "nitro": "3.0.260903-beta",
64
64
  "picocolors": "^1.0.0",
65
65
  "rsc-html-stream": "^0.0.4",
66
- "@farm.js/core": "0.1.51-beta.3"
66
+ "@farm.js/core": "0.1.60"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@types/node": "^22.20.5",
@@ -84,7 +84,7 @@
84
84
  "react-dom": "19.2.8",
85
85
  "react-server-dom-webpack": "19.2.8",
86
86
  "vite": ">=6.0.0",
87
- "@farm.js/core": "0.1.51-beta.3"
87
+ "@farm.js/core": "0.1.60"
88
88
  },
89
89
  "peerDependenciesMeta": {
90
90
  "@vitejs/plugin-rsc": {