@farm.js/core 0.1.51-beta.1 → 0.1.51-beta.2
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/{agent-mcp.d-ZuuNgrkQ.d.ts → agent-mcp.d-CR5Ov83o.d.ts} +1 -1
- package/dist/{agent-mcp.d-BPzpKBHQ.d.mts → agent-mcp.d-Z5DuwrqW.d.mts} +1 -1
- package/dist/agent-runtime.d.mts +2 -2
- package/dist/agent-runtime.d.ts +2 -2
- package/dist/{analyzer-AZULAOPL.cjs → analyzer-T76CN3S7.cjs} +70 -21
- package/dist/{analyzer-V74FTD2F.mjs → analyzer-Z6TNEAET.mjs} +70 -21
- package/dist/api/route-manager.d.mts +4 -4
- package/dist/api/route-manager.d.ts +4 -4
- package/dist/api/runtime.d.mts +3 -3
- package/dist/api/runtime.d.ts +3 -3
- package/dist/api.d.mts +4 -4
- package/dist/api.d.ts +4 -4
- package/dist/{app-manifest.d-BJDcZn3W.d.mts → app-manifest.d-CAHkOBFa.d.mts} +1 -1
- package/dist/{app-manifest.d-HWhqbP2X.d.ts → app-manifest.d-DiWr_Jfx.d.ts} +1 -1
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/{app.d-DOGW1KI8.d.mts → app.d-BfgJCsTQ.d.mts} +4 -4
- package/dist/{app.d-B5EWdob-.d.ts → app.d-DmapqkbV.d.ts} +4 -4
- package/dist/{chunk-5A5GAZ75.mjs → chunk-4SSRBCBR.mjs} +57 -22
- package/dist/{chunk-EOSFVNXZ.mjs → chunk-6CYQQQGR.mjs} +1 -1
- package/dist/{chunk-BSEKNTMS.mjs → chunk-74Z5KX4A.mjs} +4 -4
- package/dist/chunk-7FVVQEVL.cjs +541 -0
- package/dist/chunk-C3BOESDW.mjs +541 -0
- package/dist/{chunk-KMB5BMFX.mjs → chunk-CTM4SPB3.mjs} +5 -0
- package/dist/{chunk-XY4DYGSU.cjs → chunk-DTU4PX7V.cjs} +177 -142
- package/dist/{chunk-KU7MBLDZ.mjs → chunk-E6LTONL4.mjs} +1 -1
- package/dist/{chunk-QAIAFCRZ.mjs → chunk-E73PGHSR.mjs} +1 -1
- package/dist/{chunk-I3EFXUAR.mjs → chunk-FM2UEKS2.mjs} +1 -1
- package/dist/{chunk-JVBNKWLV.cjs → chunk-GNJIYJMS.cjs} +2 -2
- package/dist/{chunk-AGR7VJH2.cjs → chunk-GUJTVM36.cjs} +1 -1
- package/dist/{chunk-SCRC5AMM.mjs → chunk-IBSAYAWB.mjs} +1 -1
- package/dist/{chunk-RMPNYUGT.cjs → chunk-J3LBO2O4.cjs} +2 -2
- package/dist/{chunk-VITZRYW3.cjs → chunk-NPQLMP7M.cjs} +5 -0
- package/dist/{chunk-TT66CP3P.cjs → chunk-NXBHYO7S.cjs} +2 -2
- package/dist/{chunk-EWC76P5D.mjs → chunk-PMKUU273.mjs} +2 -2
- package/dist/{chunk-IFBINMI4.cjs → chunk-QXPSWMUD.cjs} +3 -3
- package/dist/{chunk-X2M4XN4V.cjs → chunk-WZW6LEHM.cjs} +5 -5
- package/dist/{chunk-2756SHCI.cjs → chunk-YU42A5MA.cjs} +52 -52
- package/dist/{client-plugins.d-C_3CdALC.d.mts → client-plugins.d-Bx3FXpqm.d.mts} +18 -5
- package/dist/{client-plugins.d-C0n8Yhh-.d.ts → client-plugins.d-TiLbS5j4.d.ts} +18 -5
- package/dist/client-plugins.d.mts +2 -2
- package/dist/client-plugins.d.ts +2 -2
- package/dist/client.d.mts +7 -7
- package/dist/client.d.ts +7 -7
- package/dist/{config.d-CnhyvvmT.d.mts → config.d-iRPI16ku.d.mts} +6 -2
- package/dist/{config.d-CnhyvvmT.d.ts → config.d-iRPI16ku.d.ts} +6 -2
- package/dist/config.d.mts +2 -2
- package/dist/config.d.ts +2 -2
- package/dist/desktop.d.mts +3 -3
- package/dist/desktop.d.ts +3 -3
- package/dist/{devtools-KJFUE5FO.cjs → devtools-6XWCZIGO.cjs} +2 -2
- package/dist/{devtools-BU5IT2PD.mjs → devtools-UQLDAOEI.mjs} +1 -1
- package/dist/docs.cjs +3 -3
- package/dist/docs.d.mts +3 -3
- package/dist/docs.d.ts +3 -3
- package/dist/docs.mjs +2 -2
- package/dist/index.cjs +9 -8
- package/dist/{index.d-CsGxS-hZ.d.mts → index.d-YxJ2AiDF.d.mts} +1 -1
- package/dist/{index.d-B6M_8kmo.d.ts → index.d-yueUNipJ.d.ts} +1 -1
- package/dist/index.d.mts +17 -17
- package/dist/index.d.ts +17 -17
- package/dist/index.mjs +8 -7
- package/dist/integrations.d.mts +2 -2
- package/dist/integrations.d.ts +2 -2
- package/dist/internal/app-markdown-runtime.d.mts +3 -3
- package/dist/internal/app-markdown-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.cjs +10 -9
- package/dist/internal/build-runtime.d.mts +4 -4
- package/dist/internal/build-runtime.d.ts +4 -4
- package/dist/internal/build-runtime.mjs +9 -8
- package/dist/internal/cli-runtime.cjs +2 -2
- package/dist/internal/cli-runtime.mjs +1 -1
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.d.mts +5 -5
- package/dist/internal/client-runtime.d.ts +5 -5
- package/dist/internal/compression-runtime.d.mts +2 -2
- package/dist/internal/compression-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.cjs +3 -3
- package/dist/internal/config-runtime.d.mts +16 -79
- package/dist/internal/config-runtime.d.ts +16 -79
- package/dist/internal/config-runtime.mjs +2 -2
- package/dist/internal/infra-analytics-runtime.cjs +5 -5
- package/dist/internal/infra-analytics-runtime.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +7 -3
- package/dist/internal/production-runtime.d.mts +35 -12
- package/dist/internal/production-runtime.d.ts +35 -12
- package/dist/internal/production-runtime.mjs +6 -2
- package/dist/markdown.d.mts +2 -2
- package/dist/markdown.d.ts +2 -2
- package/dist/middleware.d.mts +4 -4
- package/dist/middleware.d.ts +4 -4
- package/dist/mobile.d.mts +4 -4
- package/dist/mobile.d.ts +4 -4
- package/dist/{navigation-delegate.d-jArRF0ZP.d.ts → navigation-delegate.d-BY1e_Xrh.d.ts} +1 -1
- package/dist/{navigation-delegate.d-C0BbdUgN.d.mts → navigation-delegate.d-HnDXhlyP.d.mts} +1 -1
- package/dist/navigation.d.mts +5 -5
- package/dist/navigation.d.ts +5 -5
- package/dist/plugin.cjs +5 -5
- package/dist/plugin.d.mts +4 -4
- package/dist/plugin.d.ts +4 -4
- package/dist/plugin.mjs +4 -4
- package/dist/{production-runtime.d-DFaQ1qaV.d.mts → production-runtime.d-BpJUDzP8.d.mts} +1 -1
- package/dist/{production-runtime.d-UnXmSS_S.d.ts → production-runtime.d-lMjvE9cf.d.ts} +1 -1
- package/dist/{programmatic-routes-client.d-BIowUXQC.d.mts → programmatic-routes-client.d-6CGQ3TCk.d.mts} +2 -2
- package/dist/{programmatic-routes-client.d-VZ0qcbH4.d.ts → programmatic-routes-client.d-BlFp5hv4.d.ts} +2 -2
- package/dist/{render-plan.d-BNeqyPyJ.d.mts → render-plan.d-BH9edqKs.d.mts} +1 -1
- package/dist/{render-plan.d-BB6KrYjP.d.ts → render-plan.d-DhP0mTHF.d.ts} +1 -1
- package/dist/renderer-client.d.mts +5 -5
- package/dist/renderer-client.d.ts +5 -5
- package/dist/{request.d-Bxhghm76.d.ts → request.d-BVZrsR1v.d.ts} +1 -1
- package/dist/{request.d-BV1munmx.d.mts → request.d-DJFRdKi8.d.mts} +1 -1
- package/dist/request.d.mts +3 -3
- package/dist/request.d.ts +3 -3
- package/dist/{route-rendering.d-BIf7zE9d.d.ts → route-rendering.d-B00JtK_-.d.ts} +1 -1
- package/dist/{route-rendering.d-DShqKlgK.d.mts → route-rendering.d-Bpmw7PED.d.mts} +1 -1
- package/dist/{router.d-Bw3K3b0a.d.ts → router.d-Bd1x9XxQ.d.ts} +1 -1
- package/dist/{router.d-BE7i84fb.d.mts → router.d-e0jQ3jQ-.d.mts} +1 -1
- package/dist/{routes.d-_5tBQexL.d.mts → routes.d-Cmv8TgVq.d.mts} +89 -2
- package/dist/{routes.d-DVZQL0-H.d.ts → routes.d-D96Dq9lz.d.ts} +89 -2
- package/dist/routes.d.mts +2 -2
- package/dist/routes.d.ts +2 -2
- package/dist/{rsc-pipeline-IQI5XQLS.cjs → rsc-pipeline-DX4OC5FN.cjs} +3 -3
- package/dist/{rsc-pipeline-FBM6NFYY.mjs → rsc-pipeline-ZQ4CTVEG.mjs} +2 -2
- package/dist/{runtime-2JYIDUON.mjs → runtime-NPDRDV6R.mjs} +64 -15
- package/dist/{runtime-DXEVFYLE.cjs → runtime-NQ3EDSA7.cjs} +73 -24
- package/dist/{runtime.d-CQgoYR0Q.d.mts → runtime.d-CgB3IJDq.d.mts} +1 -1
- package/dist/{runtime.d-CfhaLPl-.d.ts → runtime.d-D-td-RR3.d.ts} +1 -1
- package/dist/server-plugins.d.mts +3 -3
- package/dist/server-plugins.d.ts +3 -3
- package/dist/server.cjs +22 -22
- package/dist/server.d.mts +10 -10
- package/dist/server.d.ts +10 -10
- package/dist/server.mjs +7 -7
- package/dist/session-AAU7RNRO.cjs +23 -0
- package/dist/session-IGEDQ5PY.mjs +23 -0
- package/dist/{spa-router.d-D63jb6nX.d.mts → spa-router.d-BWDhS0FK.d.mts} +2 -2
- package/dist/{spa-router.d-C5opIgXg.d.ts → spa-router.d-CO01mVOM.d.ts} +2 -2
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/{utils.d-CkpTqTsC.d.ts → utils.d-B77__yh8.d.ts} +1 -1
- package/dist/{utils.d-CO-U4OVZ.d.mts → utils.d-DRDazhCA.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +5 -5
- package/dist/vite.d.mts +5 -5
- package/dist/vite.d.ts +5 -5
- package/dist/vite.mjs +4 -4
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
import { FarmRouterRouteInput } from './router.js';
|
|
3
|
-
import { F as FarmNavigationBlockerContext, a as FarmNavigationState } from './spa-router.d-
|
|
3
|
+
import { F as FarmNavigationBlockerContext, a as FarmNavigationState } from './spa-router.d-CO01mVOM.js';
|
|
4
4
|
|
|
5
5
|
interface UseRouterOptions {
|
|
6
6
|
basePath?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
import { FarmRouterRouteInput } from './router.mjs';
|
|
3
|
-
import { F as FarmNavigationBlockerContext, a as FarmNavigationState } from './spa-router.d-
|
|
3
|
+
import { F as FarmNavigationBlockerContext, a as FarmNavigationState } from './spa-router.d-BWDhS0FK.mjs';
|
|
4
4
|
|
|
5
5
|
interface UseRouterOptions {
|
|
6
6
|
basePath?: string;
|
|
@@ -1,7 +1,89 @@
|
|
|
1
1
|
import { g as FarmI18nRouting } from './types.d-C41ePjvP.mjs';
|
|
2
|
-
import { l as FarmMobileScreen, j as FarmMobilePresentation, i as FarmMobilePrefetch, h as FarmMobilePageConfig, F as FarmMobileOS, R as ResolvedFarmMobileConfig, m as FarmMobileTab } from './config.d-
|
|
2
|
+
import { l as FarmMobileScreen, j as FarmMobilePresentation, i as FarmMobilePrefetch, h as FarmMobilePageConfig, F as FarmMobileOS, R as ResolvedFarmMobileConfig, m as FarmMobileTab } from './config.d-iRPI16ku.mjs';
|
|
3
3
|
import { P as PlatformRouteFiles } from './generate-route-types.d-BoVDU8qX.mjs';
|
|
4
4
|
|
|
5
|
+
type FarmUiNodeKind = "View" | "Text" | "Image" | "Pressable" | "TextInput" | "List";
|
|
6
|
+
/** A minimal, platform-neutral UI tree for a portable component. No emitter reads it yet. */
|
|
7
|
+
interface FarmUiNode {
|
|
8
|
+
kind: FarmUiNodeKind | "Component" | "Fragment";
|
|
9
|
+
/** The JSX tag it came from, such as `"button"` or `"Card"`. */
|
|
10
|
+
tag: string;
|
|
11
|
+
/** Static props, such as `href`, `src`, `alt`, `placeholder`. Expressions are `"{expr}"`. */
|
|
12
|
+
props?: Record<string, string | number | boolean>;
|
|
13
|
+
/** Tailwind classes and inline style keys that map to native style. */
|
|
14
|
+
style?: string[];
|
|
15
|
+
/** Event props, such as `["onClick"]`. */
|
|
16
|
+
events?: string[];
|
|
17
|
+
/** Static text children. */
|
|
18
|
+
text?: string;
|
|
19
|
+
children?: FarmUiNode[];
|
|
20
|
+
}
|
|
21
|
+
interface FarmMobileBlocker {
|
|
22
|
+
/** App-root-relative POSIX path. */
|
|
23
|
+
file: string;
|
|
24
|
+
line: number;
|
|
25
|
+
column: number;
|
|
26
|
+
rule: FarmMobileBlockerRule;
|
|
27
|
+
message: string;
|
|
28
|
+
/** Internal: the one tier this blocks. Reported blockers are split by tier instead. */
|
|
29
|
+
only?: Exclude<FarmMobileTier, "web">;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* What a route can become on mobile. `"native"`: the server renders the page into a tree of
|
|
33
|
+
* native views, with no JavaScript on the device (no hooks, event handlers, or client
|
|
34
|
+
* components). `"react-native"`: a React Native screen ported from the page. `"web"`: a WebView.
|
|
35
|
+
*/
|
|
36
|
+
type FarmMobileTier = "native" | "react-native" | "web";
|
|
37
|
+
type FarmMobileBlockerRule = "parse-error" | "markdown-page" | "programmatic-route" | "server-component" | "async-component" | "unmapped-element" | "dangerously-set-inner-html" | "content-editable" | "dom-ref" | "dom-event" | "spread-props" | "form-action" | "dynamic-component" | "runtime-class-name" | "class-name" | "runtime-style" | "style" | "browser-global" | "layout-effect" | "create-element" | "css-import" | "dom-package" | "unknown-package" | "unmapped-import" | "unresolved-import" | "dynamic-import" | "node-builtin" | "client-logic";
|
|
38
|
+
type FarmMobileWin = "list" | "input" | "timer";
|
|
39
|
+
interface FarmMobileElementCounts {
|
|
40
|
+
/** JSX elements in the route's modules, intrinsic and imported components. */
|
|
41
|
+
total: number;
|
|
42
|
+
/** Elements with a native mapping. */
|
|
43
|
+
mapped: number;
|
|
44
|
+
byKind: Partial<Record<FarmUiNodeKind, number>>;
|
|
45
|
+
}
|
|
46
|
+
interface FarmMobileRouteAnalysis {
|
|
47
|
+
route: string;
|
|
48
|
+
/** The first tier no blocker rules out: `"native"`, then `"react-native"`, then `"web"`. */
|
|
49
|
+
tier: FarmMobileTier;
|
|
50
|
+
/**
|
|
51
|
+
* `"port"`: portable and native would help (lists, input, timers). `"web"`: blocked, or
|
|
52
|
+
* portable with no win. Any doubt is web.
|
|
53
|
+
*/
|
|
54
|
+
decision: "port" | "web";
|
|
55
|
+
portable: boolean;
|
|
56
|
+
/** What keeps a React Native port out: the page's module graph first, then its layouts'. */
|
|
57
|
+
blockers: FarmMobileBlocker[];
|
|
58
|
+
/**
|
|
59
|
+
* What keeps the server-rendered native tier out. The page's graph only: a native screen shows
|
|
60
|
+
* the page without its layouts, since the shell draws the chrome.
|
|
61
|
+
*/
|
|
62
|
+
nativeBlockers: FarmMobileBlocker[];
|
|
63
|
+
wins: FarmMobileWin[];
|
|
64
|
+
elements: FarmMobileElementCounts;
|
|
65
|
+
/** `mapped / total`, rounded, 100 for a route with no elements. */
|
|
66
|
+
portablePercent: number;
|
|
67
|
+
/** App modules in the route's graph, page and layouts. */
|
|
68
|
+
modules: number;
|
|
69
|
+
/** Byte size of `ir` as JSON. Portable routes only. */
|
|
70
|
+
irBytes?: number;
|
|
71
|
+
ir?: FarmMobileRouteIR;
|
|
72
|
+
}
|
|
73
|
+
interface FarmMobileRouteIR {
|
|
74
|
+
/** The page component, as `"<file>#default"`. */
|
|
75
|
+
root: string;
|
|
76
|
+
components: Record<string, FarmUiNode>;
|
|
77
|
+
}
|
|
78
|
+
interface FarmMobileAnalyzerStats {
|
|
79
|
+
/** Distinct app modules read. */
|
|
80
|
+
modules: number;
|
|
81
|
+
/** Modules parsed in this run; the rest came from the content-hash cache. */
|
|
82
|
+
parsed: number;
|
|
83
|
+
cached: number;
|
|
84
|
+
ms: number;
|
|
85
|
+
}
|
|
86
|
+
|
|
5
87
|
type FarmMobileScreenSource = "page" | "config" | "file" | "analyzer" | "default";
|
|
6
88
|
interface FarmMobileScreenDecision {
|
|
7
89
|
screen: FarmMobileScreen;
|
|
@@ -33,6 +115,11 @@ interface FarmMobileScreensOptions {
|
|
|
33
115
|
analyzerPorts?: ReadonlySet<string>;
|
|
34
116
|
/** Why the analyzer cannot port a route, for config routes that ask for a port. */
|
|
35
117
|
analyzerBlockers?: ReadonlyMap<string, readonly string[]>;
|
|
118
|
+
/** Each analyzed route's tier, and what rules out the native tier. */
|
|
119
|
+
analyzerTiers?: ReadonlyMap<string, {
|
|
120
|
+
tier: FarmMobileTier;
|
|
121
|
+
nativeBlockers: readonly string[];
|
|
122
|
+
}>;
|
|
36
123
|
}
|
|
37
124
|
interface FarmMobileScreens {
|
|
38
125
|
screens: Record<string, FarmMobileScreenDecision>;
|
|
@@ -118,4 +205,4 @@ declare function createFarmMobileRoutePattern(pattern: string, options?: Pick<Fa
|
|
|
118
205
|
*/
|
|
119
206
|
declare function createFarmMobileRouteManifest(mobile: ResolvedFarmMobileConfig, options: FarmMobileRouteManifestOptions): FarmMobileRouteManifest;
|
|
120
207
|
|
|
121
|
-
export { type FarmMobileRouteManifest as F, type FarmMobileRouteRule as a, type
|
|
208
|
+
export { type FarmMobileRouteManifest as F, type FarmMobileRouteRule as a, type FarmMobileTier as b, type FarmMobileScreenSource as c, type FarmMobileRouteAnalysis as d, type FarmMobileScreenDecision as e, type FarmMobileAnalyzerStats as f, type FarmMobileBlocker as g, type FarmMobileBlockerRule as h, type FarmMobilePageExport as i, type FarmMobileRouteManifestOptions as j, type FarmMobileScreens as k, type FarmMobileScreensOptions as l, type FarmUiNode as m, createFarmMobileModuleId as n, createFarmMobileRouteManifest as o, createFarmMobileRoutePattern as p, resolveFarmMobileScreens as q, readFarmMobilePageExport as r };
|
|
@@ -1,7 +1,89 @@
|
|
|
1
1
|
import { g as FarmI18nRouting } from './types.d-C41ePjvP.js';
|
|
2
|
-
import { l as FarmMobileScreen, j as FarmMobilePresentation, i as FarmMobilePrefetch, h as FarmMobilePageConfig, F as FarmMobileOS, R as ResolvedFarmMobileConfig, m as FarmMobileTab } from './config.d-
|
|
2
|
+
import { l as FarmMobileScreen, j as FarmMobilePresentation, i as FarmMobilePrefetch, h as FarmMobilePageConfig, F as FarmMobileOS, R as ResolvedFarmMobileConfig, m as FarmMobileTab } from './config.d-iRPI16ku.js';
|
|
3
3
|
import { P as PlatformRouteFiles } from './generate-route-types.d-BL2pq6xC.js';
|
|
4
4
|
|
|
5
|
+
type FarmUiNodeKind = "View" | "Text" | "Image" | "Pressable" | "TextInput" | "List";
|
|
6
|
+
/** A minimal, platform-neutral UI tree for a portable component. No emitter reads it yet. */
|
|
7
|
+
interface FarmUiNode {
|
|
8
|
+
kind: FarmUiNodeKind | "Component" | "Fragment";
|
|
9
|
+
/** The JSX tag it came from, such as `"button"` or `"Card"`. */
|
|
10
|
+
tag: string;
|
|
11
|
+
/** Static props, such as `href`, `src`, `alt`, `placeholder`. Expressions are `"{expr}"`. */
|
|
12
|
+
props?: Record<string, string | number | boolean>;
|
|
13
|
+
/** Tailwind classes and inline style keys that map to native style. */
|
|
14
|
+
style?: string[];
|
|
15
|
+
/** Event props, such as `["onClick"]`. */
|
|
16
|
+
events?: string[];
|
|
17
|
+
/** Static text children. */
|
|
18
|
+
text?: string;
|
|
19
|
+
children?: FarmUiNode[];
|
|
20
|
+
}
|
|
21
|
+
interface FarmMobileBlocker {
|
|
22
|
+
/** App-root-relative POSIX path. */
|
|
23
|
+
file: string;
|
|
24
|
+
line: number;
|
|
25
|
+
column: number;
|
|
26
|
+
rule: FarmMobileBlockerRule;
|
|
27
|
+
message: string;
|
|
28
|
+
/** Internal: the one tier this blocks. Reported blockers are split by tier instead. */
|
|
29
|
+
only?: Exclude<FarmMobileTier, "web">;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* What a route can become on mobile. `"native"`: the server renders the page into a tree of
|
|
33
|
+
* native views, with no JavaScript on the device (no hooks, event handlers, or client
|
|
34
|
+
* components). `"react-native"`: a React Native screen ported from the page. `"web"`: a WebView.
|
|
35
|
+
*/
|
|
36
|
+
type FarmMobileTier = "native" | "react-native" | "web";
|
|
37
|
+
type FarmMobileBlockerRule = "parse-error" | "markdown-page" | "programmatic-route" | "server-component" | "async-component" | "unmapped-element" | "dangerously-set-inner-html" | "content-editable" | "dom-ref" | "dom-event" | "spread-props" | "form-action" | "dynamic-component" | "runtime-class-name" | "class-name" | "runtime-style" | "style" | "browser-global" | "layout-effect" | "create-element" | "css-import" | "dom-package" | "unknown-package" | "unmapped-import" | "unresolved-import" | "dynamic-import" | "node-builtin" | "client-logic";
|
|
38
|
+
type FarmMobileWin = "list" | "input" | "timer";
|
|
39
|
+
interface FarmMobileElementCounts {
|
|
40
|
+
/** JSX elements in the route's modules, intrinsic and imported components. */
|
|
41
|
+
total: number;
|
|
42
|
+
/** Elements with a native mapping. */
|
|
43
|
+
mapped: number;
|
|
44
|
+
byKind: Partial<Record<FarmUiNodeKind, number>>;
|
|
45
|
+
}
|
|
46
|
+
interface FarmMobileRouteAnalysis {
|
|
47
|
+
route: string;
|
|
48
|
+
/** The first tier no blocker rules out: `"native"`, then `"react-native"`, then `"web"`. */
|
|
49
|
+
tier: FarmMobileTier;
|
|
50
|
+
/**
|
|
51
|
+
* `"port"`: portable and native would help (lists, input, timers). `"web"`: blocked, or
|
|
52
|
+
* portable with no win. Any doubt is web.
|
|
53
|
+
*/
|
|
54
|
+
decision: "port" | "web";
|
|
55
|
+
portable: boolean;
|
|
56
|
+
/** What keeps a React Native port out: the page's module graph first, then its layouts'. */
|
|
57
|
+
blockers: FarmMobileBlocker[];
|
|
58
|
+
/**
|
|
59
|
+
* What keeps the server-rendered native tier out. The page's graph only: a native screen shows
|
|
60
|
+
* the page without its layouts, since the shell draws the chrome.
|
|
61
|
+
*/
|
|
62
|
+
nativeBlockers: FarmMobileBlocker[];
|
|
63
|
+
wins: FarmMobileWin[];
|
|
64
|
+
elements: FarmMobileElementCounts;
|
|
65
|
+
/** `mapped / total`, rounded, 100 for a route with no elements. */
|
|
66
|
+
portablePercent: number;
|
|
67
|
+
/** App modules in the route's graph, page and layouts. */
|
|
68
|
+
modules: number;
|
|
69
|
+
/** Byte size of `ir` as JSON. Portable routes only. */
|
|
70
|
+
irBytes?: number;
|
|
71
|
+
ir?: FarmMobileRouteIR;
|
|
72
|
+
}
|
|
73
|
+
interface FarmMobileRouteIR {
|
|
74
|
+
/** The page component, as `"<file>#default"`. */
|
|
75
|
+
root: string;
|
|
76
|
+
components: Record<string, FarmUiNode>;
|
|
77
|
+
}
|
|
78
|
+
interface FarmMobileAnalyzerStats {
|
|
79
|
+
/** Distinct app modules read. */
|
|
80
|
+
modules: number;
|
|
81
|
+
/** Modules parsed in this run; the rest came from the content-hash cache. */
|
|
82
|
+
parsed: number;
|
|
83
|
+
cached: number;
|
|
84
|
+
ms: number;
|
|
85
|
+
}
|
|
86
|
+
|
|
5
87
|
type FarmMobileScreenSource = "page" | "config" | "file" | "analyzer" | "default";
|
|
6
88
|
interface FarmMobileScreenDecision {
|
|
7
89
|
screen: FarmMobileScreen;
|
|
@@ -33,6 +115,11 @@ interface FarmMobileScreensOptions {
|
|
|
33
115
|
analyzerPorts?: ReadonlySet<string>;
|
|
34
116
|
/** Why the analyzer cannot port a route, for config routes that ask for a port. */
|
|
35
117
|
analyzerBlockers?: ReadonlyMap<string, readonly string[]>;
|
|
118
|
+
/** Each analyzed route's tier, and what rules out the native tier. */
|
|
119
|
+
analyzerTiers?: ReadonlyMap<string, {
|
|
120
|
+
tier: FarmMobileTier;
|
|
121
|
+
nativeBlockers: readonly string[];
|
|
122
|
+
}>;
|
|
36
123
|
}
|
|
37
124
|
interface FarmMobileScreens {
|
|
38
125
|
screens: Record<string, FarmMobileScreenDecision>;
|
|
@@ -118,4 +205,4 @@ declare function createFarmMobileRoutePattern(pattern: string, options?: Pick<Fa
|
|
|
118
205
|
*/
|
|
119
206
|
declare function createFarmMobileRouteManifest(mobile: ResolvedFarmMobileConfig, options: FarmMobileRouteManifestOptions): FarmMobileRouteManifest;
|
|
120
207
|
|
|
121
|
-
export { type FarmMobileRouteManifest as F, type FarmMobileRouteRule as a, type
|
|
208
|
+
export { type FarmMobileRouteManifest as F, type FarmMobileRouteRule as a, type FarmMobileTier as b, type FarmMobileScreenSource as c, type FarmMobileRouteAnalysis as d, type FarmMobileScreenDecision as e, type FarmMobileAnalyzerStats as f, type FarmMobileBlocker as g, type FarmMobileBlockerRule as h, type FarmMobilePageExport as i, type FarmMobileRouteManifestOptions as j, type FarmMobileScreens as k, type FarmMobileScreensOptions as l, type FarmUiNode as m, createFarmMobileModuleId as n, createFarmMobileRouteManifest as o, createFarmMobileRoutePattern as p, resolveFarmMobileScreens as q, readFarmMobilePageExport as r };
|
package/dist/routes.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as FarmAppContext, w as PageProps, x as FarmSearchParams, y as PluginContextProps, f as FarmRouteRuntimeConfig, M as Metadata, i as RouteModule, L as LayoutProps, z as FarmRouteRuntime, A as FarmRouteRegions, C as FarmRouteMaxDuration, P as ParsedRoute } from './client-plugins.d-
|
|
1
|
+
import { v as FarmAppContext, w as PageProps, x as FarmSearchParams, y as PluginContextProps, f as FarmRouteRuntimeConfig, M as Metadata, i as RouteModule, L as LayoutProps, z as FarmRouteRuntime, A as FarmRouteRegions, C as FarmRouteMaxDuration, P as ParsedRoute } from './client-plugins.d-Bx3FXpqm.mjs';
|
|
2
2
|
import { ComponentType } from 'react';
|
|
3
3
|
import { RouteDataCacheKey } from './cache.mjs';
|
|
4
4
|
import { ServerFn } from './server-fn.mjs';
|
|
@@ -27,7 +27,7 @@ import 'rolldown/utils';
|
|
|
27
27
|
import 'rolldown';
|
|
28
28
|
import './image-config.d-CeDgNyX4.mjs';
|
|
29
29
|
import './types.d-C41ePjvP.mjs';
|
|
30
|
-
import './config.d-
|
|
30
|
+
import './config.d-iRPI16ku.mjs';
|
|
31
31
|
import './types.d-DQnyD3VD.mjs';
|
|
32
32
|
import './font.mjs';
|
|
33
33
|
import './deployment.mjs';
|
package/dist/routes.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as FarmAppContext, w as PageProps, x as FarmSearchParams, y as PluginContextProps, f as FarmRouteRuntimeConfig, M as Metadata, i as RouteModule, L as LayoutProps, z as FarmRouteRuntime, A as FarmRouteRegions, C as FarmRouteMaxDuration, P as ParsedRoute } from './client-plugins.d-
|
|
1
|
+
import { v as FarmAppContext, w as PageProps, x as FarmSearchParams, y as PluginContextProps, f as FarmRouteRuntimeConfig, M as Metadata, i as RouteModule, L as LayoutProps, z as FarmRouteRuntime, A as FarmRouteRegions, C as FarmRouteMaxDuration, P as ParsedRoute } from './client-plugins.d-TiLbS5j4.js';
|
|
2
2
|
import { ComponentType } from 'react';
|
|
3
3
|
import { RouteDataCacheKey } from './cache.js';
|
|
4
4
|
import { ServerFn } from './server-fn.js';
|
|
@@ -27,7 +27,7 @@ import 'rolldown/utils';
|
|
|
27
27
|
import 'rolldown';
|
|
28
28
|
import './image-config.d-CeDgNyX4.js';
|
|
29
29
|
import './types.d-C41ePjvP.js';
|
|
30
|
-
import './config.d-
|
|
30
|
+
import './config.d-iRPI16ku.js';
|
|
31
31
|
import './types.d-DQnyD3VD.js';
|
|
32
32
|
import './font.js';
|
|
33
33
|
import './deployment.js';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkNXBHYO7Scjs = require('./chunk-NXBHYO7S.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ var _chunkTT66CP3Pcjs = require('./chunk-TT66CP3P.cjs');
|
|
|
11
11
|
|
|
12
12
|
var _chunkSJ23LJ3Ncjs = require('./chunk-SJ23LJ3N.cjs');
|
|
13
13
|
require('./chunk-XPMC4E2G.cjs');
|
|
14
|
-
require('./chunk-
|
|
14
|
+
require('./chunk-NPQLMP7M.cjs');
|
|
15
15
|
require('./chunk-OZC2JPW6.cjs');
|
|
16
16
|
require('./chunk-65Y5SIBH.cjs');
|
|
17
17
|
require('./chunk-LNM57D3H.cjs');
|
|
@@ -80,4 +80,4 @@ require('./chunk-BTZ5O6VM.cjs');
|
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
|
|
83
|
-
exports.FARM_RSC_PACKAGES = _chunkSJ23LJ3Ncjs.FARM_RSC_PACKAGES; exports.buildFarmRsc =
|
|
83
|
+
exports.FARM_RSC_PACKAGES = _chunkSJ23LJ3Ncjs.FARM_RSC_PACKAGES; exports.buildFarmRsc = _chunkNXBHYO7Scjs.buildFarmRsc; exports.createFarmRscDevServer = _chunkNXBHYO7Scjs.createFarmRscDevServer; exports.createFarmRscViteConfig = _chunkNXBHYO7Scjs.createFarmRscViteConfig; exports.farmAppUsesRscPipeline = _chunkSJ23LJ3Ncjs.farmAppUsesRscPipeline; exports.farmConfigUsesServerComponents = _chunkSJ23LJ3Ncjs.farmConfigUsesServerComponents; exports.inspectFarmServerComponents = _chunkSJ23LJ3Ncjs.inspectFarmServerComponents; exports.resolveFarmRscCheckConfig = _chunkSJ23LJ3Ncjs.resolveFarmRscCheckConfig;
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
buildFarmRsc,
|
|
3
3
|
createFarmRscDevServer,
|
|
4
4
|
createFarmRscViteConfig
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-IBSAYAWB.mjs";
|
|
6
6
|
import {
|
|
7
7
|
FARM_RSC_PACKAGES,
|
|
8
8
|
farmAppUsesRscPipeline,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
resolveFarmRscCheckConfig
|
|
12
12
|
} from "./chunk-SHS6KXOZ.mjs";
|
|
13
13
|
import "./chunk-LMFJCXDD.mjs";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-CTM4SPB3.mjs";
|
|
15
15
|
import "./chunk-VISQDC6W.mjs";
|
|
16
16
|
import "./chunk-QOSDWGKT.mjs";
|
|
17
17
|
import "./chunk-PIHKO25G.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadConfig,
|
|
3
3
|
resolveConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CTM4SPB3.mjs";
|
|
5
5
|
import "./chunk-VISQDC6W.mjs";
|
|
6
6
|
import {
|
|
7
7
|
createPlatformBlockChecker,
|
|
@@ -241,10 +241,8 @@ function validateFarmMobilePageConfig(value, where, context) {
|
|
|
241
241
|
checkKeys(value, PAGE_KEYS, `${where}: mobile.`);
|
|
242
242
|
checkPresentation(value.presentation, `${where}: mobile`, check);
|
|
243
243
|
checkPrefetch(value.prefetch, `${where}: mobile.`, check);
|
|
244
|
-
if (value.native !== void 0 && value.native !==
|
|
245
|
-
fail(
|
|
246
|
-
`${where}: mobile.native can only be false. A native screen comes from a page.native.tsx next to the page.`
|
|
247
|
-
);
|
|
244
|
+
if (value.native !== void 0 && typeof value.native !== "boolean") {
|
|
245
|
+
fail(`${where}: mobile.native must be true or false.`);
|
|
248
246
|
}
|
|
249
247
|
return value;
|
|
250
248
|
}
|
|
@@ -455,7 +453,15 @@ function resolveFarmMobileBlock(input, context, cache) {
|
|
|
455
453
|
|
|
456
454
|
// src/mobile/report.ts
|
|
457
455
|
function createFarmMobileNativeReport(options) {
|
|
458
|
-
const summary = {
|
|
456
|
+
const summary = {
|
|
457
|
+
routes: 0,
|
|
458
|
+
analyzed: 0,
|
|
459
|
+
port: 0,
|
|
460
|
+
portableNoWin: 0,
|
|
461
|
+
blocked: 0,
|
|
462
|
+
native: 0,
|
|
463
|
+
tiers: { native: 0, "react-native": 0, web: 0 }
|
|
464
|
+
};
|
|
459
465
|
const routes = options.routes.map((route) => {
|
|
460
466
|
const decision = options.screens[route];
|
|
461
467
|
const analyzed = options.analysis[route];
|
|
@@ -463,6 +469,7 @@ function createFarmMobileNativeReport(options) {
|
|
|
463
469
|
if (decision.screen !== "web") summary.native += 1;
|
|
464
470
|
if (analyzed) {
|
|
465
471
|
summary.analyzed += 1;
|
|
472
|
+
summary.tiers[analyzed.tier] += 1;
|
|
466
473
|
if (analyzed.decision === "port") summary.port += 1;
|
|
467
474
|
else if (analyzed.portable) summary.portableNoWin += 1;
|
|
468
475
|
else summary.blocked += 1;
|
|
@@ -489,17 +496,20 @@ function createFarmMobileNativeReport(options) {
|
|
|
489
496
|
function reasonFor(entry) {
|
|
490
497
|
const analysis = entry.analysis;
|
|
491
498
|
if (!analysis) {
|
|
492
|
-
if (entry.source === "page")
|
|
499
|
+
if (entry.source === "page") {
|
|
500
|
+
return `${entry.file}: mobile.native ${entry.requested ? "true" : "false"}`;
|
|
501
|
+
}
|
|
493
502
|
if (entry.source === "file") return entry.file;
|
|
494
503
|
if (entry.source === "config") {
|
|
495
504
|
return entry.file ? `native.routes, ${entry.file}` : "native.routes";
|
|
496
505
|
}
|
|
497
506
|
return "";
|
|
498
507
|
}
|
|
508
|
+
if (analysis.tier === "native") return "renders natively, no JavaScript on the device";
|
|
499
509
|
if (analysis.portable) {
|
|
500
510
|
return analysis.wins.length > 0 ? `portable; ${analysis.wins.join(", ")}` : `portable; no win (${analysis.elements.total} elements)`;
|
|
501
511
|
}
|
|
502
|
-
const [first, ...rest] = analysis.blockers;
|
|
512
|
+
const [first, ...rest] = analysis.nativeBlockers.length ? analysis.nativeBlockers : analysis.blockers;
|
|
503
513
|
const where = first.file ? `${first.file}:${first.line}:${first.column} ` : "";
|
|
504
514
|
return `${where}${first.message}${rest.length > 0 ? ` (+${rest.length} more)` : ""}`;
|
|
505
515
|
}
|
|
@@ -507,12 +517,13 @@ function formatFarmMobileNativeReport(report, options = {}) {
|
|
|
507
517
|
const rows = report.routes.map((entry) => [
|
|
508
518
|
entry.route,
|
|
509
519
|
entry.screen,
|
|
520
|
+
entry.analysis ? entry.analysis.tier : "-",
|
|
510
521
|
entry.analysis ? entry.analysis.decision : "-",
|
|
511
522
|
entry.analysis ? `${entry.analysis.elements.mapped}/${entry.analysis.elements.total}` : "",
|
|
512
523
|
entry.analysis ? `${entry.analysis.portablePercent}%` : "",
|
|
513
524
|
reasonFor(entry)
|
|
514
525
|
]);
|
|
515
|
-
const header = ["route", "screen", "decision", "mapped", "portable", "reason"];
|
|
526
|
+
const header = ["route", "screen", "tier", "decision", "mapped", "portable", "reason"];
|
|
516
527
|
const widths = header.map(
|
|
517
528
|
(title, column) => Math.min(
|
|
518
529
|
column === 0 ? 40 : 12,
|
|
@@ -529,7 +540,8 @@ function formatFarmMobileNativeReport(report, options = {}) {
|
|
|
529
540
|
line(header),
|
|
530
541
|
...rows.map(line),
|
|
531
542
|
"",
|
|
532
|
-
`${summary.routes} routes: ${summary.port} port, ${summary.portableNoWin} portable without a win, ${summary.blocked} blocked, ${summary.native} native from files or config
|
|
543
|
+
`${summary.routes} routes: ${summary.port} port, ${summary.portableNoWin} portable without a win, ${summary.blocked} blocked, ${summary.native} native from files or config`,
|
|
544
|
+
`tiers: ${summary.tiers.native} native, ${summary.tiers["react-native"]} react-native, ${summary.tiers.web} web`
|
|
533
545
|
];
|
|
534
546
|
if (options.stats) {
|
|
535
547
|
const { modules, parsed, cached, ms } = options.stats;
|
|
@@ -604,6 +616,38 @@ function resolveFarmMobileScreens(options) {
|
|
|
604
616
|
screens[route] = { screen: "web", source: "page", file: page.file, ...base };
|
|
605
617
|
continue;
|
|
606
618
|
}
|
|
619
|
+
if (page?.config.native === true) {
|
|
620
|
+
if (tier !== void 0 && tier !== "native") {
|
|
621
|
+
warnings.push(`${page.file}: mobile.native true overrides ${where}.${tierKey} "${tier}".`);
|
|
622
|
+
}
|
|
623
|
+
const file2 = reactFile ?? platformFile;
|
|
624
|
+
if (file2) {
|
|
625
|
+
screens[route] = {
|
|
626
|
+
screen: reactFile ? "native" : "platform",
|
|
627
|
+
source: "page",
|
|
628
|
+
file: relativeFile(root, file2),
|
|
629
|
+
module,
|
|
630
|
+
...base
|
|
631
|
+
};
|
|
632
|
+
continue;
|
|
633
|
+
}
|
|
634
|
+
const analysis = options.analyzerTiers?.get(route);
|
|
635
|
+
if (analysis && analysis.tier !== "native") {
|
|
636
|
+
throw new TypeError(
|
|
637
|
+
`${prefix}: ${page.file} sets mobile.native to true, but "${route}" cannot render as a native screen:
|
|
638
|
+
${analysis.nativeBlockers.map((blocker) => ` - ${blocker}`).join("\n")}
|
|
639
|
+
` + (analysis.tier === "react-native" ? "It needs JavaScript on the device: add page.native.tsx next to the page, or " : "Remove the blockers, add page.native.tsx next to the page, or ") + "remove mobile.native."
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
screens[route] = {
|
|
643
|
+
screen: "web",
|
|
644
|
+
source: "page",
|
|
645
|
+
file: page.file,
|
|
646
|
+
requested: "native",
|
|
647
|
+
...base
|
|
648
|
+
};
|
|
649
|
+
continue;
|
|
650
|
+
}
|
|
607
651
|
if (tier === "web") {
|
|
608
652
|
screens[route] = { screen: "web", source: "config", ...base };
|
|
609
653
|
continue;
|
|
@@ -822,6 +866,9 @@ function getFarmMobileOutputDirs(distDir) {
|
|
|
822
866
|
};
|
|
823
867
|
}
|
|
824
868
|
var SCRIPT_PAGE = /\.(?:tsx|ts|jsx|js)$/;
|
|
869
|
+
function describe(blocker) {
|
|
870
|
+
return `${blocker.file ? `${blocker.file}:${blocker.line}:${blocker.column} ` : ""}${blocker.message}`;
|
|
871
|
+
}
|
|
825
872
|
function scriptLang(file) {
|
|
826
873
|
return file.endsWith(".tsx") ? "tsx" : file.endsWith(".ts") ? "ts" : "jsx";
|
|
827
874
|
}
|
|
@@ -894,13 +941,14 @@ async function resolveFarmMobileApp(options = {}) {
|
|
|
894
941
|
let { screens, warnings } = resolveFarmMobileScreens(screenOptions);
|
|
895
942
|
let report;
|
|
896
943
|
let analyzerStats;
|
|
897
|
-
const
|
|
944
|
+
const asserted = [...pageExports.values()].some((page) => page.config.native === true);
|
|
945
|
+
const analyze = options.analyze === "always" || asserted || options.analyze === true && mobile.native.auto !== "off";
|
|
898
946
|
if (analyze) {
|
|
899
947
|
const candidates = routes.filter((route) => {
|
|
900
948
|
const decision = screens[route];
|
|
901
949
|
return decision.source === "default" || decision.requested !== void 0;
|
|
902
950
|
});
|
|
903
|
-
const { analyzeFarmMobileRoutes } = await import("./analyzer-
|
|
951
|
+
const { analyzeFarmMobileRoutes } = await import("./analyzer-Z6TNEAET.mjs");
|
|
904
952
|
const result = await analyzeFarmMobileRoutes({
|
|
905
953
|
root,
|
|
906
954
|
srcDir: config.srcDir,
|
|
@@ -916,11 +964,12 @@ async function resolveFarmMobileApp(options = {}) {
|
|
|
916
964
|
Object.values(result.routes).filter((route) => route.decision === "port").map((route) => route.route)
|
|
917
965
|
),
|
|
918
966
|
analyzerBlockers: new Map(
|
|
967
|
+
Object.values(result.routes).map((route) => [route.route, route.blockers.map(describe)])
|
|
968
|
+
),
|
|
969
|
+
analyzerTiers: new Map(
|
|
919
970
|
Object.values(result.routes).map((route) => [
|
|
920
971
|
route.route,
|
|
921
|
-
route.
|
|
922
|
-
(blocker) => `${blocker.file ? `${blocker.file}:${blocker.line}:${blocker.column} ` : ""}${blocker.message}`
|
|
923
|
-
)
|
|
972
|
+
{ tier: route.tier, nativeBlockers: route.nativeBlockers.map(describe) }
|
|
924
973
|
])
|
|
925
974
|
)
|
|
926
975
|
}));
|