@farm.js/core 0.1.0-beta.21 → 0.1.0-beta.22
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/after.d.mts +25 -0
- package/dist/after.d.ts +25 -0
- package/dist/agent-runtime.d.mts +96 -0
- package/dist/agent-runtime.d.ts +96 -0
- package/dist/api/route-manager.d.mts +68 -0
- package/dist/api/route-manager.d.ts +68 -0
- package/dist/api/runtime.d.mts +3 -0
- package/dist/api/runtime.d.ts +3 -0
- package/dist/api.cjs +22 -19
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.mts +50 -0
- package/dist/api.d.ts +50 -0
- package/dist/api.mjs +2 -1
- package/dist/app-BB8GCH1g.d.ts +306 -0
- package/dist/app-DwsTpyNZ.d.mts +306 -0
- package/dist/app-markdown.d.mts +24 -0
- package/dist/app-markdown.d.ts +24 -0
- package/dist/cache.d.mts +192 -0
- package/dist/cache.d.ts +192 -0
- package/dist/{chunk-MIUW47JX.mjs → chunk-2PEJGY5V.mjs} +15 -20
- package/dist/chunk-2PEJGY5V.mjs.map +1 -0
- package/dist/{chunk-RIXKJPGI.mjs → chunk-42325TLU.mjs} +2 -2
- package/dist/{chunk-I3UWA2P2.mjs → chunk-DAUR3WUZ.mjs} +2 -2
- package/dist/{chunk-I3UWA2P2.mjs.map → chunk-DAUR3WUZ.mjs.map} +1 -1
- package/dist/chunk-GIELMNBG.mjs +15 -0
- package/dist/chunk-GIELMNBG.mjs.map +1 -0
- package/dist/{chunk-4EATUJFO.mjs → chunk-ICTGDDV4.mjs} +20 -22
- package/dist/chunk-ICTGDDV4.mjs.map +1 -0
- package/dist/{chunk-FKKM7HVF.mjs → chunk-XBKXKJX5.mjs} +30 -35
- package/dist/chunk-XBKXKJX5.mjs.map +1 -0
- package/dist/{chunk-VIC7NJ77.mjs → chunk-ZP73P4VR.mjs} +2 -2
- package/dist/chunk-recovery-lnQFzcQP.d.mts +26 -0
- package/dist/chunk-recovery-lnQFzcQP.d.ts +26 -0
- package/dist/client-BT1mFQas.d.mts +447 -0
- package/dist/client-Nn0q4eO4.d.ts +447 -0
- package/dist/client-cache-CIlyBlmx.d.ts +6 -0
- package/dist/client-cache-D-EZ7XVW.d.mts +6 -0
- package/dist/client-plugins-CbRum1fj.d.ts +2088 -0
- package/dist/client-plugins-QQntVkrv.d.mts +2088 -0
- package/dist/client-plugins.d.mts +24 -0
- package/dist/client-plugins.d.ts +24 -0
- package/dist/client.d.mts +452 -0
- package/dist/client.d.ts +452 -0
- package/dist/config.d.mts +31 -0
- package/dist/config.d.ts +31 -0
- package/dist/cron.d.mts +78 -0
- package/dist/cron.d.ts +78 -0
- package/dist/deferred.d.mts +42 -0
- package/dist/deferred.d.ts +42 -0
- package/dist/deployment.d.mts +36 -0
- package/dist/deployment.d.ts +36 -0
- package/dist/docs.d.mts +80 -0
- package/dist/docs.d.ts +80 -0
- package/dist/env-types.d.mts +12 -0
- package/dist/env-types.d.ts +12 -0
- package/dist/env.d.mts +45 -0
- package/dist/env.d.ts +45 -0
- package/dist/environment/vite.d.mts +22 -0
- package/dist/environment/vite.d.ts +22 -0
- package/dist/environment.d.mts +18 -0
- package/dist/environment.d.ts +18 -0
- package/dist/font.d.mts +95 -0
- package/dist/font.d.ts +95 -0
- package/dist/headers.d.mts +22 -0
- package/dist/headers.d.ts +22 -0
- package/dist/i18n/client.d.mts +32 -0
- package/dist/i18n/client.d.ts +32 -0
- package/dist/i18n/index.d.mts +20 -0
- package/dist/i18n/index.d.ts +20 -0
- package/dist/i18n/server.d.mts +30 -0
- package/dist/i18n/server.d.ts +30 -0
- package/dist/image/server.d.mts +37 -0
- package/dist/image/server.d.ts +37 -0
- package/dist/image/sharp.d.mts +7 -0
- package/dist/image/sharp.d.ts +7 -0
- package/dist/image-config-Duob7wER.d.mts +50 -0
- package/dist/image-config-Duob7wER.d.ts +50 -0
- package/dist/image.d.mts +39 -0
- package/dist/image.d.ts +39 -0
- package/dist/index.cjs +66 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +477 -0
- package/dist/index.d.ts +477 -0
- package/dist/index.mjs +7 -6
- package/dist/index.mjs.map +1 -1
- package/dist/integration-api-CHT2OKAf.d.mts +93 -0
- package/dist/integration-api-CHT2OKAf.d.ts +93 -0
- package/dist/integrations.d.mts +24 -0
- package/dist/integrations.d.ts +24 -0
- package/dist/internal/build-runtime.cjs +50 -50
- package/dist/internal/build-runtime.cjs.map +1 -1
- package/dist/internal/build-runtime.d.mts +41 -0
- package/dist/internal/build-runtime.d.ts +41 -0
- package/dist/internal/build-runtime.mjs +5 -4
- package/dist/internal/client-runtime.d.mts +17 -0
- package/dist/internal/client-runtime.d.ts +17 -0
- package/dist/internal/config-runtime.d.mts +41 -0
- package/dist/internal/config-runtime.d.ts +41 -0
- package/dist/internal/metadata-image-runtime.d.mts +25 -0
- package/dist/internal/metadata-image-runtime.d.ts +25 -0
- package/dist/internal/production-node-env.d.mts +12 -0
- package/dist/internal/production-node-env.d.ts +12 -0
- package/dist/internal/production-runtime.d.mts +66 -0
- package/dist/internal/production-runtime.d.ts +66 -0
- package/dist/island-CfGru1MO.d.mts +9 -0
- package/dist/island-CfGru1MO.d.ts +9 -0
- package/dist/markdown.d.mts +60 -0
- package/dist/markdown.d.ts +60 -0
- package/dist/metadata-B5jBJHq1.d.ts +22 -0
- package/dist/metadata-BxOJ4FJl.d.mts +22 -0
- package/dist/middleware.cjs +17 -17
- package/dist/middleware.cjs.map +1 -1
- package/dist/middleware.d.mts +171 -0
- package/dist/middleware.d.ts +171 -0
- package/dist/middleware.mjs +3 -2
- package/dist/navigation-errors-Dvwpzaer.d.mts +13 -0
- package/dist/navigation-errors-Dvwpzaer.d.ts +13 -0
- package/dist/navigation.d.mts +14 -0
- package/dist/navigation.d.ts +14 -0
- package/dist/observability.d.mts +335 -0
- package/dist/observability.d.ts +335 -0
- package/dist/params-BALtrRim.d.ts +15 -0
- package/dist/params-ry-lxqmy.d.mts +15 -0
- package/dist/plugin-BJDf43dc.d.mts +165 -0
- package/dist/plugin-BJDf43dc.d.ts +165 -0
- package/dist/plugin.cjs +42 -48
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.mts +24 -0
- package/dist/plugin.d.ts +24 -0
- package/dist/plugin.mjs +4 -3
- package/dist/production-runtime-Bxua86uR.d.mts +81 -0
- package/dist/production-runtime-CZqXjRVi.d.ts +81 -0
- package/dist/query/client.d.mts +61 -0
- package/dist/query/client.d.ts +61 -0
- package/dist/query/index.d.mts +90 -0
- package/dist/query/index.d.ts +90 -0
- package/dist/query/parsers.d.mts +25 -0
- package/dist/query/parsers.d.ts +25 -0
- package/dist/query/server.d.mts +55 -0
- package/dist/query/server.d.ts +55 -0
- package/dist/request-7V0GaZK_.d.mts +6 -0
- package/dist/request-B5XYBv5a.d.ts +6 -0
- package/dist/request.d.mts +25 -0
- package/dist/request.d.ts +25 -0
- package/dist/resolver-DJqjLMg_.d.mts +14 -0
- package/dist/resolver-IH4RmPEl.d.ts +14 -0
- package/dist/route-runtime-DoOHzCAD.d.mts +38 -0
- package/dist/route-runtime-DoOHzCAD.d.ts +38 -0
- package/dist/router.d.mts +36 -0
- package/dist/router.d.ts +36 -0
- package/dist/routes.d.mts +226 -0
- package/dist/routes.d.ts +226 -0
- package/dist/runtime-Bpp-c28k.d.ts +231 -0
- package/dist/runtime-Cxpq6xZN.d.mts +27 -0
- package/dist/runtime-Q3u74Nbq.d.mts +231 -0
- package/dist/runtime-bv63eUiO.d.ts +27 -0
- package/dist/server-action-security.d.mts +45 -0
- package/dist/server-action-security.d.ts +45 -0
- package/dist/server-fn-client.d.mts +33 -0
- package/dist/server-fn-client.d.ts +33 -0
- package/dist/server-fn-error-DDh14a0V.d.mts +26 -0
- package/dist/server-fn-error-DDh14a0V.d.ts +26 -0
- package/dist/server-fn.d.mts +121 -0
- package/dist/server-fn.d.ts +121 -0
- package/dist/server-plugins.d.mts +57 -0
- package/dist/server-plugins.d.ts +57 -0
- package/dist/server-query-client.d.mts +51 -0
- package/dist/server-query-client.d.ts +51 -0
- package/dist/server-query.d.mts +37 -0
- package/dist/server-query.d.ts +37 -0
- package/dist/server.cjs +45 -67
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.mts +51 -0
- package/dist/server.d.ts +51 -0
- package/dist/server.mjs +8 -22
- package/dist/server.mjs.map +1 -1
- package/dist/storage.d.mts +52 -0
- package/dist/storage.d.ts +52 -0
- package/dist/testing.d.mts +103 -0
- package/dist/testing.d.ts +103 -0
- package/dist/transport-BmbGTXA5.d.mts +49 -0
- package/dist/transport-BmbGTXA5.d.ts +49 -0
- package/dist/types-BMxWr97v.d.mts +81 -0
- package/dist/types-BMxWr97v.d.ts +81 -0
- package/dist/types-D1A6-XvH.d.mts +73 -0
- package/dist/types-D1A6-XvH.d.ts +73 -0
- package/dist/types-DTzm4TCl.d.mts +78 -0
- package/dist/types-DTzm4TCl.d.ts +78 -0
- package/dist/utils-s9pN0Yep.d.mts +23 -0
- package/dist/utils-xTFxzu47.d.ts +23 -0
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.mts +3 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +44 -50
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.mts +24 -0
- package/dist/vite.d.ts +24 -0
- package/dist/vite.mjs +4 -3
- package/dist/workflows-CusFV6mn.d.mts +153 -0
- package/dist/workflows-CusFV6mn.d.ts +153 -0
- package/dist/workflows.d.mts +1 -0
- package/dist/workflows.d.ts +1 -0
- package/package.json +1 -1
- package/dist/chunk-4EATUJFO.mjs.map +0 -1
- package/dist/chunk-FKKM7HVF.mjs.map +0 -1
- package/dist/chunk-MIUW47JX.mjs.map +0 -1
- /package/dist/{chunk-RIXKJPGI.mjs.map → chunk-42325TLU.mjs.map} +0 -0
- /package/dist/{chunk-VIC7NJ77.mjs.map → chunk-ZP73P4VR.mjs.map} +0 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { F as FarmConfig, C as ParsedRoute, s as RouteModule, v as LayoutModule, I as SSGCollectionResult, x as FarmRequest, y as FarmResponse, a8 as FarmMdxResolvedConfig, a9 as ResolvedFarmDevtoolsConfig, aa as ResolvedFarmAuthConfig, ab as ResolvedFarmPerformanceConfig, ac as ResolvedFarmSecurityConfig } from './client-plugins-QQntVkrv.mjs';
|
|
2
|
+
import { F as FarmDocsResolvedConfig } from './types-DTzm4TCl.mjs';
|
|
3
|
+
import { FarmMarkdownResolvedConfig } from './markdown.mjs';
|
|
4
|
+
import { F as FarmWorkflowsResolvedConfig } from './workflows-CusFV6mn.mjs';
|
|
5
|
+
import { FarmCronResolvedConfig } from './cron.mjs';
|
|
6
|
+
import { R as ResolvedFarmImageConfig } from './image-config-Duob7wER.mjs';
|
|
7
|
+
import { ProgrammaticRedirectRoute, ProgrammaticRouteSearchClientOptions } from './routes.mjs';
|
|
8
|
+
import { ViteDevServer } from 'vite';
|
|
9
|
+
import { M as MetadataImageKind } from './metadata-BxOJ4FJl.mjs';
|
|
10
|
+
import { F as FarmIslandStrategy } from './island-CfGru1MO.mjs';
|
|
11
|
+
import { R as ResolvedFarmRouteRuntimeConfig } from './route-runtime-DoOHzCAD.mjs';
|
|
12
|
+
import { R as ResolvedFarmI18nConfig } from './types-BMxWr97v.mjs';
|
|
13
|
+
import { F as FarmI18nRuntime } from './runtime-Cxpq6xZN.mjs';
|
|
14
|
+
|
|
15
|
+
declare const STATIC_METADATA_IMAGE_EXTENSIONS: readonly ["png", "jpg", "jpeg", "gif", "webp"];
|
|
16
|
+
type StaticMetadataImageExtension = (typeof STATIC_METADATA_IMAGE_EXTENSIONS)[number];
|
|
17
|
+
interface StaticMetadataImageInfo {
|
|
18
|
+
extension: StaticMetadataImageExtension;
|
|
19
|
+
contentType: string;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
alt?: string;
|
|
23
|
+
hash: string;
|
|
24
|
+
byteLength: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface RouteEntry {
|
|
28
|
+
route: ParsedRoute;
|
|
29
|
+
modulePath: string;
|
|
30
|
+
markdownSourcePath?: string;
|
|
31
|
+
pattern: string;
|
|
32
|
+
source?: "file" | "programmatic";
|
|
33
|
+
sourceRoot: string;
|
|
34
|
+
}
|
|
35
|
+
interface RouteSlotEntry extends RouteEntry {
|
|
36
|
+
name: string;
|
|
37
|
+
ownerPattern: string;
|
|
38
|
+
interception: boolean;
|
|
39
|
+
fallback: boolean;
|
|
40
|
+
containerId: string;
|
|
41
|
+
}
|
|
42
|
+
interface MatchedRouteSlot {
|
|
43
|
+
name: string;
|
|
44
|
+
ownerPattern: string;
|
|
45
|
+
containerId: string;
|
|
46
|
+
interception: boolean;
|
|
47
|
+
fallback: boolean;
|
|
48
|
+
route: RouteSlotEntry;
|
|
49
|
+
params: Record<string, string>;
|
|
50
|
+
}
|
|
51
|
+
interface MetadataImageEntry extends RouteEntry {
|
|
52
|
+
kind: MetadataImageKind;
|
|
53
|
+
fileName: "opengraph-image" | "twitter-image";
|
|
54
|
+
sourceType: "module" | "static";
|
|
55
|
+
staticInfo?: StaticMetadataImageInfo;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Manages route discovery and matching for the Farm.js application
|
|
59
|
+
*/
|
|
60
|
+
declare class RouteManager {
|
|
61
|
+
private config;
|
|
62
|
+
private routes;
|
|
63
|
+
private layouts;
|
|
64
|
+
private routeSlots;
|
|
65
|
+
private loadings;
|
|
66
|
+
private errors;
|
|
67
|
+
private metadataImages;
|
|
68
|
+
private redirects;
|
|
69
|
+
private programmaticPages;
|
|
70
|
+
private programmaticLayouts;
|
|
71
|
+
private viteServer?;
|
|
72
|
+
constructor(config: Required<FarmConfig>, viteServer?: ViteDevServer);
|
|
73
|
+
/**
|
|
74
|
+
* Discover all routes in the app directory
|
|
75
|
+
*/
|
|
76
|
+
discoverRoutes(): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Find matching route for a given URL path
|
|
79
|
+
*/
|
|
80
|
+
matchRoute(pathname: string, options?: {
|
|
81
|
+
interceptFrom?: string;
|
|
82
|
+
}): {
|
|
83
|
+
route: RouteEntry | null;
|
|
84
|
+
params: Record<string, string>;
|
|
85
|
+
layouts: RouteEntry[];
|
|
86
|
+
slots: MatchedRouteSlot[];
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Get all registered routes
|
|
90
|
+
*/
|
|
91
|
+
getRoutes(): Map<string, RouteEntry>;
|
|
92
|
+
/**
|
|
93
|
+
* Get all registered layouts
|
|
94
|
+
*/
|
|
95
|
+
getLayouts(): Map<string, RouteEntry>;
|
|
96
|
+
getRouteSlots(): Map<string, RouteSlotEntry>;
|
|
97
|
+
/** Resolve route rules, inherited layouts, and the page export in precedence order. */
|
|
98
|
+
resolveRouteRuntimeConfig(pattern: string): Promise<ResolvedFarmRouteRuntimeConfig>;
|
|
99
|
+
/**
|
|
100
|
+
* Get all route-level loading boundaries.
|
|
101
|
+
*/
|
|
102
|
+
getLoadings(): Map<string, RouteEntry>;
|
|
103
|
+
/**
|
|
104
|
+
* Get all route-level error boundaries.
|
|
105
|
+
*/
|
|
106
|
+
getErrors(): Map<string, RouteEntry>;
|
|
107
|
+
getMetadataImages(): Map<string, MetadataImageEntry>;
|
|
108
|
+
getRedirects(): ProgrammaticRedirectRoute[];
|
|
109
|
+
matchRedirect(pathname: string): {
|
|
110
|
+
redirect: ProgrammaticRedirectRoute;
|
|
111
|
+
destination: string;
|
|
112
|
+
statusCode: number;
|
|
113
|
+
params: Record<string, string>;
|
|
114
|
+
} | null;
|
|
115
|
+
/**
|
|
116
|
+
* Return the nearest matching loading boundary for a pathname.
|
|
117
|
+
*/
|
|
118
|
+
getMatchingLoading(pathname: string): RouteEntry | null;
|
|
119
|
+
/**
|
|
120
|
+
* Return the nearest matching error boundary for a pathname.
|
|
121
|
+
*/
|
|
122
|
+
getMatchingError(pathname: string): RouteEntry | null;
|
|
123
|
+
matchMetadataImage(pathname: string): {
|
|
124
|
+
image: MetadataImageEntry;
|
|
125
|
+
params: Record<string, string>;
|
|
126
|
+
pagePath: string;
|
|
127
|
+
} | null;
|
|
128
|
+
getMatchingMetadataImage(pathname: string, kind: MetadataImageKind): {
|
|
129
|
+
image: MetadataImageEntry;
|
|
130
|
+
params: Record<string, string>;
|
|
131
|
+
} | null;
|
|
132
|
+
resolveMetadataImagePath(image: MetadataImageEntry, params?: Record<string, string>): string;
|
|
133
|
+
/**
|
|
134
|
+
* Generate a client-side route manifest for SPA navigation
|
|
135
|
+
* This eliminates the need for server requests during navigation
|
|
136
|
+
*/
|
|
137
|
+
generateClientManifest(projectRoot: string): {
|
|
138
|
+
routes: Array<{
|
|
139
|
+
pattern: string;
|
|
140
|
+
modulePath: string;
|
|
141
|
+
shouldHydrate: boolean;
|
|
142
|
+
isClientComponent: boolean;
|
|
143
|
+
islandStrategy: FarmIslandStrategy | null;
|
|
144
|
+
search?: ProgrammaticRouteSearchClientOptions;
|
|
145
|
+
segments: Array<{
|
|
146
|
+
segment: string;
|
|
147
|
+
isDynamic: boolean;
|
|
148
|
+
isCatchAll?: boolean;
|
|
149
|
+
isOptional?: boolean;
|
|
150
|
+
}>;
|
|
151
|
+
}>;
|
|
152
|
+
layouts: Array<{
|
|
153
|
+
pattern: string;
|
|
154
|
+
modulePath: string;
|
|
155
|
+
}>;
|
|
156
|
+
slots: Array<{
|
|
157
|
+
name: string;
|
|
158
|
+
ownerPattern: string;
|
|
159
|
+
pattern: string;
|
|
160
|
+
modulePath: string;
|
|
161
|
+
containerId: string;
|
|
162
|
+
interception: boolean;
|
|
163
|
+
fallback: boolean;
|
|
164
|
+
shouldHydrate: boolean;
|
|
165
|
+
isClientComponent: boolean;
|
|
166
|
+
segments: RouteEntry["route"]["segments"];
|
|
167
|
+
}>;
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* Load a route module dynamically
|
|
171
|
+
*/
|
|
172
|
+
loadRouteModule(modulePath: string): Promise<RouteModule>;
|
|
173
|
+
/**
|
|
174
|
+
* Load a layout module dynamically
|
|
175
|
+
*/
|
|
176
|
+
loadLayoutModule(modulePath: string): Promise<LayoutModule>;
|
|
177
|
+
/**
|
|
178
|
+
* Create a route pattern from parsed route
|
|
179
|
+
*/
|
|
180
|
+
private createRoutePattern;
|
|
181
|
+
private discoverFileRoutes;
|
|
182
|
+
private discoverProgrammaticRoutes;
|
|
183
|
+
private loadProgrammaticRoutesModule;
|
|
184
|
+
/**
|
|
185
|
+
* Find all layouts that should wrap a given path
|
|
186
|
+
*/
|
|
187
|
+
private findMatchingLayouts;
|
|
188
|
+
private findMatchingRouteSlots;
|
|
189
|
+
private matchesRoutePrefix;
|
|
190
|
+
private findNearestBoundary;
|
|
191
|
+
/**
|
|
192
|
+
* Log discovered routes for debugging
|
|
193
|
+
*/
|
|
194
|
+
private logRoutes;
|
|
195
|
+
/**
|
|
196
|
+
* Collect SSG pages for static generation
|
|
197
|
+
*
|
|
198
|
+
* Returns all pages marked with `export const ssg = true` along with
|
|
199
|
+
* their pre-computed paths (for dynamic routes using getStaticPaths)
|
|
200
|
+
*/
|
|
201
|
+
collectSSGPages(): Promise<SSGCollectionResult>;
|
|
202
|
+
private toRoutePathname;
|
|
203
|
+
private localizeRedirectDestination;
|
|
204
|
+
private getI18nConfig;
|
|
205
|
+
/**
|
|
206
|
+
* Check if a route is SSG
|
|
207
|
+
*/
|
|
208
|
+
isRouteSSG(modulePath: string): Promise<boolean>;
|
|
209
|
+
/**
|
|
210
|
+
* Check if a route has ISR (Incremental Static Regeneration)
|
|
211
|
+
*/
|
|
212
|
+
hasRouteISR(modulePath: string): Promise<boolean>;
|
|
213
|
+
/**
|
|
214
|
+
* Get revalidation interval for a route
|
|
215
|
+
*/
|
|
216
|
+
getRouteRevalidateInterval(modulePath: string): Promise<number | undefined>;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
declare class ServerRenderer {
|
|
220
|
+
private config;
|
|
221
|
+
private routeManager;
|
|
222
|
+
private ssgManifest;
|
|
223
|
+
private dataCache;
|
|
224
|
+
private i18nRuntime?;
|
|
225
|
+
constructor(config: Required<FarmConfig>, routeManager: RouteManager, i18nRuntime?: FarmI18nRuntime);
|
|
226
|
+
runWithRequestContext<T>(request: Request, fn: () => T | Promise<T>): Promise<T>;
|
|
227
|
+
resolveRouteContext(input: {
|
|
228
|
+
request: Request;
|
|
229
|
+
rawRequest?: FarmRequest;
|
|
230
|
+
params: Record<string, string>;
|
|
231
|
+
search: Record<string, string | string[] | undefined>;
|
|
232
|
+
path: string;
|
|
233
|
+
}): Promise<unknown>;
|
|
234
|
+
/**
|
|
235
|
+
* Load SSG manifest from build output
|
|
236
|
+
*/
|
|
237
|
+
private loadSSGManifest;
|
|
238
|
+
/**
|
|
239
|
+
* Check if a path should be served from SSG cache
|
|
240
|
+
*/
|
|
241
|
+
private shouldServeSSG;
|
|
242
|
+
private getSSGCacheKey;
|
|
243
|
+
private getPPRCacheKey;
|
|
244
|
+
private getCachedSSGPage;
|
|
245
|
+
private cacheSSGPage;
|
|
246
|
+
private getCachedPPRShell;
|
|
247
|
+
private cachePPRShell;
|
|
248
|
+
private getPPRShellBypassReason;
|
|
249
|
+
private getPPRHeaders;
|
|
250
|
+
private serveCachedPPRShell;
|
|
251
|
+
/**
|
|
252
|
+
* Regenerate an SSG page in the background (ISR)
|
|
253
|
+
*/
|
|
254
|
+
private regenerateSSGPage;
|
|
255
|
+
/**
|
|
256
|
+
* Serve a pre-rendered SSG page
|
|
257
|
+
*/
|
|
258
|
+
private serveSSGPage;
|
|
259
|
+
renderPage(req: FarmRequest, res: FarmResponse): Promise<void>;
|
|
260
|
+
private renderPageInContext;
|
|
261
|
+
private wrapWithIntegrationProviders;
|
|
262
|
+
private resolveRouteMetadata;
|
|
263
|
+
private resolveMetadataImageReference;
|
|
264
|
+
private renderMetadataImage;
|
|
265
|
+
private writeMetadataImageResponse;
|
|
266
|
+
private writeStaticMetadataImageResponse;
|
|
267
|
+
private renderRouteErrorBoundary;
|
|
268
|
+
private renderWithSSR;
|
|
269
|
+
private render404;
|
|
270
|
+
private render500;
|
|
271
|
+
private createFullHTML;
|
|
272
|
+
private applyDeploymentHeaders;
|
|
273
|
+
private getDeploymentId;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
type NormalizedFarmConfig = Omit<Required<FarmConfig>, "devtools" | "images" | "i18n" | "performance" | "security"> & {
|
|
277
|
+
docs: FarmDocsResolvedConfig;
|
|
278
|
+
md: FarmMarkdownResolvedConfig;
|
|
279
|
+
mdx: FarmMdxResolvedConfig;
|
|
280
|
+
cron: FarmCronResolvedConfig;
|
|
281
|
+
workflows: FarmWorkflowsResolvedConfig;
|
|
282
|
+
devtools: ResolvedFarmDevtoolsConfig;
|
|
283
|
+
images: ResolvedFarmImageConfig;
|
|
284
|
+
i18n: ResolvedFarmI18nConfig;
|
|
285
|
+
auth: ResolvedFarmAuthConfig;
|
|
286
|
+
performance: ResolvedFarmPerformanceConfig;
|
|
287
|
+
security: ResolvedFarmSecurityConfig;
|
|
288
|
+
};
|
|
289
|
+
declare class FarmApp {
|
|
290
|
+
private config;
|
|
291
|
+
private routeManager;
|
|
292
|
+
private serverRenderer;
|
|
293
|
+
private i18nRuntime;
|
|
294
|
+
private viteServer?;
|
|
295
|
+
constructor(config?: FarmConfig, viteServer?: ViteDevServer);
|
|
296
|
+
initialize(): Promise<void>;
|
|
297
|
+
getRouteManager(): RouteManager;
|
|
298
|
+
getServerRenderer(): ServerRenderer;
|
|
299
|
+
getI18nRuntime(): FarmI18nRuntime;
|
|
300
|
+
getConfig(): NormalizedFarmConfig;
|
|
301
|
+
private normalizeConfig;
|
|
302
|
+
private verifyAppStructure;
|
|
303
|
+
}
|
|
304
|
+
declare function createFarmApp(config?: FarmConfig, viteServer?: ViteDevServer): FarmApp;
|
|
305
|
+
|
|
306
|
+
export { FarmApp as F, RouteManager as R, ServerRenderer as S, createFarmApp as c };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
export { df as FarmMarkdownPageModuleInput, de as FarmMarkdownPageSource, db as FarmMdxComponent, dc as FarmMdxComponents, a8 as FarmMdxResolvedConfig, dd as FarmMdxUserConfig, dm as createFarmMarkdownRouteModule, dn as createFarmMarkdownRouteModuleFromFile, dq as createFarmMarkdownSourceResponse, dl as createMarkdownMetadata, dh as isFarmMarkdownPageFile, dp as loadFarmMdxComponents, di as normalizeFarmMarkdownRoutePath, dj as parseMarkdownFrontmatter, dg as resolveMdxConfig, dk as titleFromMarkdown } from './client-plugins-QQntVkrv.mjs';
|
|
3
|
+
import './plugin-BJDf43dc.mjs';
|
|
4
|
+
import 'http';
|
|
5
|
+
import './types-D1A6-XvH.mjs';
|
|
6
|
+
import 'db0';
|
|
7
|
+
import 'unstorage';
|
|
8
|
+
import './integration-api-CHT2OKAf.mjs';
|
|
9
|
+
import '@farming-labs/orm';
|
|
10
|
+
import './types-DTzm4TCl.mjs';
|
|
11
|
+
import '@farming-labs/docs';
|
|
12
|
+
import './markdown.mjs';
|
|
13
|
+
import './observability.mjs';
|
|
14
|
+
import 'vite';
|
|
15
|
+
import './workflows-CusFV6mn.mjs';
|
|
16
|
+
import './cron.mjs';
|
|
17
|
+
import './env.mjs';
|
|
18
|
+
import './server-action-security.mjs';
|
|
19
|
+
import './server-fn-error-DDh14a0V.mjs';
|
|
20
|
+
import './image-config-Duob7wER.mjs';
|
|
21
|
+
import './types-BMxWr97v.mjs';
|
|
22
|
+
import './cache.mjs';
|
|
23
|
+
import './route-runtime-DoOHzCAD.mjs';
|
|
24
|
+
import './font.mjs';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
export { df as FarmMarkdownPageModuleInput, de as FarmMarkdownPageSource, db as FarmMdxComponent, dc as FarmMdxComponents, a8 as FarmMdxResolvedConfig, dd as FarmMdxUserConfig, dm as createFarmMarkdownRouteModule, dn as createFarmMarkdownRouteModuleFromFile, dq as createFarmMarkdownSourceResponse, dl as createMarkdownMetadata, dh as isFarmMarkdownPageFile, dp as loadFarmMdxComponents, di as normalizeFarmMarkdownRoutePath, dj as parseMarkdownFrontmatter, dg as resolveMdxConfig, dk as titleFromMarkdown } from './client-plugins-CbRum1fj.js';
|
|
3
|
+
import './plugin-BJDf43dc.js';
|
|
4
|
+
import 'http';
|
|
5
|
+
import './types-D1A6-XvH.js';
|
|
6
|
+
import 'db0';
|
|
7
|
+
import 'unstorage';
|
|
8
|
+
import './integration-api-CHT2OKAf.js';
|
|
9
|
+
import '@farming-labs/orm';
|
|
10
|
+
import './types-DTzm4TCl.js';
|
|
11
|
+
import '@farming-labs/docs';
|
|
12
|
+
import './markdown.js';
|
|
13
|
+
import './observability.js';
|
|
14
|
+
import 'vite';
|
|
15
|
+
import './workflows-CusFV6mn.js';
|
|
16
|
+
import './cron.js';
|
|
17
|
+
import './env.js';
|
|
18
|
+
import './server-action-security.js';
|
|
19
|
+
import './server-fn-error-DDh14a0V.js';
|
|
20
|
+
import './image-config-Duob7wER.js';
|
|
21
|
+
import './types-BMxWr97v.js';
|
|
22
|
+
import './cache.js';
|
|
23
|
+
import './route-runtime-DoOHzCAD.js';
|
|
24
|
+
import './font.js';
|
package/dist/cache.d.mts
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
declare function applyFarmCacheInvalidations(keys: unknown): void;
|
|
2
|
+
|
|
3
|
+
type RevalidateTagProfile = "max" | "default" | "seconds" | "minutes" | "hours" | "days" | "weeks" | "months" | {
|
|
4
|
+
expire?: number;
|
|
5
|
+
};
|
|
6
|
+
interface FarmCacheOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Tag cached data so it can be invalidated with revalidateTag/updateTag.
|
|
9
|
+
*/
|
|
10
|
+
tags?: readonly string[];
|
|
11
|
+
/**
|
|
12
|
+
* Path tags let revalidatePath invalidate data tied to a route.
|
|
13
|
+
*/
|
|
14
|
+
paths?: readonly string[];
|
|
15
|
+
/**
|
|
16
|
+
* Time in seconds before the entry becomes stale. False means no TTL.
|
|
17
|
+
*/
|
|
18
|
+
revalidate?: number | false;
|
|
19
|
+
}
|
|
20
|
+
interface FarmCacheSetOptions extends FarmCacheOptions {
|
|
21
|
+
createdAt?: number;
|
|
22
|
+
}
|
|
23
|
+
type RouteDataCacheKey = string | readonly unknown[];
|
|
24
|
+
type FarmCacheInvalidationTarget = {
|
|
25
|
+
key: RouteDataCacheKey;
|
|
26
|
+
} | {
|
|
27
|
+
path: string;
|
|
28
|
+
} | {
|
|
29
|
+
tag: string;
|
|
30
|
+
};
|
|
31
|
+
declare const FARM_DEFINED_CACHE_KEY_DATA: unique symbol;
|
|
32
|
+
/**
|
|
33
|
+
* A regular Farm cache key carrying the data shape stored under that key.
|
|
34
|
+
*
|
|
35
|
+
* The brand exists only in TypeScript. At runtime the value remains the
|
|
36
|
+
* original string or structured array, so all existing cache APIs continue to
|
|
37
|
+
* accept untyped keys.
|
|
38
|
+
*/
|
|
39
|
+
type DefinedCacheKey<TData, TKey extends RouteDataCacheKey = RouteDataCacheKey> = TKey & {
|
|
40
|
+
readonly [FARM_DEFINED_CACHE_KEY_DATA]: TData;
|
|
41
|
+
};
|
|
42
|
+
type CacheKeyFactory<TData, TArguments extends readonly unknown[], TKey extends RouteDataCacheKey = RouteDataCacheKey> = (...args: TArguments) => DefinedCacheKey<TData, TKey>;
|
|
43
|
+
type InferCacheKeyData<TKey> = TKey extends DefinedCacheKey<infer TData, RouteDataCacheKey> ? TData : unknown;
|
|
44
|
+
/**
|
|
45
|
+
* Optionally add a data type to an existing string/array cache-key factory.
|
|
46
|
+
*
|
|
47
|
+
* This helper does not introduce a new runtime key representation. Calling the
|
|
48
|
+
* returned factory produces the exact key returned by `factory`.
|
|
49
|
+
*/
|
|
50
|
+
declare function defineCacheKey<TData>(): <const TArguments extends readonly unknown[], const TKey extends RouteDataCacheKey>(factory: (...args: TArguments) => TKey) => CacheKeyFactory<TData, TArguments, TKey>;
|
|
51
|
+
interface FarmCacheEntry<T = unknown> {
|
|
52
|
+
key: string;
|
|
53
|
+
value: T;
|
|
54
|
+
tags: readonly string[];
|
|
55
|
+
/**
|
|
56
|
+
* Adapter tag versions captured before the cached value was produced.
|
|
57
|
+
* A later version makes the entry stale across every server instance.
|
|
58
|
+
*/
|
|
59
|
+
tagVersions?: Readonly<Record<string, number>>;
|
|
60
|
+
createdAt: number;
|
|
61
|
+
createdVersion?: number;
|
|
62
|
+
revalidate?: number | false;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Asynchronous persistence contract used by distributed Farm caches.
|
|
66
|
+
*
|
|
67
|
+
* Implementations are responsible for serializing cache entries and making
|
|
68
|
+
* tag version updates atomic when the backing service supports it.
|
|
69
|
+
*/
|
|
70
|
+
interface FarmCacheAdapter {
|
|
71
|
+
readonly name?: string;
|
|
72
|
+
get<T = unknown>(key: string): Promise<FarmCacheEntry<T> | null | undefined>;
|
|
73
|
+
set<T = unknown>(key: string, entry: FarmCacheEntry<T>): Promise<void>;
|
|
74
|
+
delete(key: string): Promise<void>;
|
|
75
|
+
clear?(): Promise<void>;
|
|
76
|
+
getTagVersions?(tags: readonly string[]): Promise<Readonly<Record<string, number>>>;
|
|
77
|
+
invalidateTags?(tags: readonly string[]): Promise<void>;
|
|
78
|
+
/** Atomically acquire a short-lived regeneration lease. */
|
|
79
|
+
acquireLease?(key: string, ttlMs: number): Promise<string | null | undefined>;
|
|
80
|
+
/** Release the lease only when the supplied ownership token still matches. */
|
|
81
|
+
releaseLease?(key: string, token: string): Promise<void>;
|
|
82
|
+
}
|
|
83
|
+
interface FarmCacheUserConfig {
|
|
84
|
+
/** Shared cache implementation, for example a Redis-backed adapter. */
|
|
85
|
+
adapter?: FarmCacheAdapter;
|
|
86
|
+
/** Prefix isolating applications and deployments sharing one adapter. */
|
|
87
|
+
namespace?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Coordinate cache fills across processes when the adapter implements
|
|
90
|
+
* acquireLease/releaseLease. Set false to disable.
|
|
91
|
+
*/
|
|
92
|
+
lease?: false | {
|
|
93
|
+
ttlMs?: number;
|
|
94
|
+
waitTimeoutMs?: number;
|
|
95
|
+
pollIntervalMs?: number;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
interface FarmCacheStorage {
|
|
99
|
+
getItem<T = unknown>(key: string): Promise<T | null>;
|
|
100
|
+
setItem<T = unknown>(key: string, value: T): Promise<unknown>;
|
|
101
|
+
removeItem(key: string): Promise<unknown>;
|
|
102
|
+
clear?(base?: string): Promise<unknown>;
|
|
103
|
+
}
|
|
104
|
+
interface StorageFarmCacheAdapterOptions {
|
|
105
|
+
/** Prefix used inside the supplied storage client. */
|
|
106
|
+
base?: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Adapt a Farm/unstorage-compatible key-value client to the cache contract.
|
|
110
|
+
*
|
|
111
|
+
* This is a portable baseline adapter. Provider-specific adapters should use
|
|
112
|
+
* their atomic increment/transaction primitives for tag invalidation.
|
|
113
|
+
*/
|
|
114
|
+
declare function storageCacheAdapter(storage: FarmCacheStorage, options?: StorageFarmCacheAdapterOptions): FarmCacheAdapter;
|
|
115
|
+
interface GetFarmCacheEntryOptions {
|
|
116
|
+
allowStale?: boolean;
|
|
117
|
+
now?: number;
|
|
118
|
+
}
|
|
119
|
+
interface FarmCacheStaleEntry {
|
|
120
|
+
tags: Iterable<string>;
|
|
121
|
+
createdAt: number;
|
|
122
|
+
createdVersion?: number;
|
|
123
|
+
revalidate?: number | false;
|
|
124
|
+
}
|
|
125
|
+
declare class FarmDataCache {
|
|
126
|
+
private entries;
|
|
127
|
+
private inflight;
|
|
128
|
+
private invalidatedTagVersions;
|
|
129
|
+
private version;
|
|
130
|
+
private adapter?;
|
|
131
|
+
private namespace;
|
|
132
|
+
private local;
|
|
133
|
+
private lease;
|
|
134
|
+
constructor(config?: FarmCacheUserConfig);
|
|
135
|
+
configure(config?: FarmCacheUserConfig): void;
|
|
136
|
+
get adapterName(): string;
|
|
137
|
+
get hasAdapter(): boolean;
|
|
138
|
+
get size(): number;
|
|
139
|
+
get<T>(key: string, options?: GetFarmCacheEntryOptions): T | undefined;
|
|
140
|
+
getEntry<T = unknown>(key: string, options?: GetFarmCacheEntryOptions): FarmCacheEntry<T> | undefined;
|
|
141
|
+
getEntryAsync<T = unknown>(key: string, options?: GetFarmCacheEntryOptions): Promise<FarmCacheEntry<T> | undefined>;
|
|
142
|
+
set<T>(key: string, value: T, options?: FarmCacheSetOptions): FarmCacheEntry<T>;
|
|
143
|
+
setAsync<T>(key: string, value: T, options?: FarmCacheSetOptions, tagVersions?: Readonly<Record<string, number>>): Promise<FarmCacheEntry<T>>;
|
|
144
|
+
delete(key: string): boolean;
|
|
145
|
+
deleteAsync(key: string): Promise<boolean>;
|
|
146
|
+
clear(): void;
|
|
147
|
+
clearAsync(): Promise<void>;
|
|
148
|
+
isStale(entry: FarmCacheStaleEntry, now?: number): boolean;
|
|
149
|
+
isStaleAsync(entry: FarmCacheEntry, now?: number): Promise<boolean>;
|
|
150
|
+
revalidateTag(tag: string, options?: {
|
|
151
|
+
source?: "revalidateTag" | "updateTag";
|
|
152
|
+
profile?: RevalidateTagProfile;
|
|
153
|
+
}): number;
|
|
154
|
+
revalidateTagAsync(tag: string, options?: {
|
|
155
|
+
source?: "revalidateTag" | "updateTag";
|
|
156
|
+
profile?: RevalidateTagProfile;
|
|
157
|
+
}): Promise<number>;
|
|
158
|
+
revalidatePath(routePath: string): number;
|
|
159
|
+
revalidatePathAsync(routePath: string): Promise<number>;
|
|
160
|
+
getOrSet<T>(key: string, producer: () => Promise<T> | T, options?: FarmCacheOptions): Promise<T>;
|
|
161
|
+
private fillCacheEntry;
|
|
162
|
+
private waitForAdapterEntry;
|
|
163
|
+
private countEntriesForTag;
|
|
164
|
+
private countEntriesForTags;
|
|
165
|
+
private invalidateTag;
|
|
166
|
+
private toPublicEntry;
|
|
167
|
+
private hydrateLocalEntry;
|
|
168
|
+
private createAdapterKey;
|
|
169
|
+
private createAdapterTag;
|
|
170
|
+
private getAdapterTagVersions;
|
|
171
|
+
private isAdapterEntryStale;
|
|
172
|
+
}
|
|
173
|
+
declare function getFarmDataCache(): FarmDataCache;
|
|
174
|
+
declare function configureFarmCache(config: FarmCacheUserConfig | undefined): void;
|
|
175
|
+
declare function unstable_cache<Args extends unknown[], Result>(fn: (...args: Args) => Result | Promise<Result>, keyParts?: readonly unknown[], options?: FarmCacheOptions): (...args: Args) => Promise<Result>;
|
|
176
|
+
declare function revalidateTag(_tag: string, _profile?: RevalidateTagProfile): void | Promise<void>;
|
|
177
|
+
declare function updateTag(tag: string): void | Promise<void>;
|
|
178
|
+
declare function revalidatePath(routePath: string): void | Promise<void>;
|
|
179
|
+
declare function invalidate(key: RouteDataCacheKey): void | Promise<void>;
|
|
180
|
+
declare function invalidateRouteData(key: RouteDataCacheKey): void | Promise<void>;
|
|
181
|
+
/**
|
|
182
|
+
* Apply a normalized set of invalidation targets and return browser cache keys
|
|
183
|
+
* that should be carried with an action/endpoint response.
|
|
184
|
+
*/
|
|
185
|
+
declare function applyFarmCacheInvalidationTargets(targets: readonly FarmCacheInvalidationTarget[]): Promise<readonly string[]>;
|
|
186
|
+
declare function createPathCacheTag(routePath: string): string;
|
|
187
|
+
declare function createRouteDataCacheTag(key: RouteDataCacheKey): string;
|
|
188
|
+
declare function createRouteDataCacheKey(key: RouteDataCacheKey): string;
|
|
189
|
+
declare function normalizeRevalidatePath(routePath: string): string;
|
|
190
|
+
declare function createFarmCacheKey(parts: readonly unknown[]): string;
|
|
191
|
+
|
|
192
|
+
export { type CacheKeyFactory, type DefinedCacheKey, type FarmCacheAdapter, type FarmCacheEntry, type FarmCacheInvalidationTarget, type FarmCacheOptions, type FarmCacheSetOptions, type FarmCacheStorage, type FarmCacheUserConfig, FarmDataCache, type GetFarmCacheEntryOptions, type InferCacheKeyData, type RevalidateTagProfile, type RouteDataCacheKey, type StorageFarmCacheAdapterOptions, applyFarmCacheInvalidationTargets, applyFarmCacheInvalidations, configureFarmCache, createFarmCacheKey, createPathCacheTag, createRouteDataCacheKey, createRouteDataCacheTag, defineCacheKey, getFarmDataCache, invalidate, invalidateRouteData, normalizeRevalidatePath, revalidatePath, revalidateTag, storageCacheAdapter, unstable_cache, updateTag };
|