@farm.js/core 0.1.0-beta.14 → 0.1.0-beta.16
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/api/route-manager.cjs.map +1 -1
- package/dist/api/route-manager.mjs +2 -2
- package/dist/api/runtime.cjs.map +1 -1
- package/dist/api/runtime.mjs +1 -1
- package/dist/api.cjs +18 -10
- package/dist/api.cjs.map +1 -1
- package/dist/api.mjs +3 -3
- package/dist/{chunk-B232I2GP.mjs → chunk-3HIVDX7J.mjs} +12 -1
- package/dist/chunk-3HIVDX7J.mjs.map +1 -0
- package/dist/{chunk-JDEOUK5V.mjs → chunk-6YXKHAFU.mjs} +3 -3
- package/dist/{chunk-VUL55IAX.mjs → chunk-AN3PQVKH.mjs} +14 -16
- package/dist/{chunk-VUL55IAX.mjs.map → chunk-AN3PQVKH.mjs.map} +1 -1
- package/dist/{chunk-Z5CQMP54.mjs → chunk-ARRYKOI5.mjs} +2 -2
- package/dist/{chunk-KLA67WKG.mjs → chunk-B3FFOIWS.mjs} +2 -2
- package/dist/{chunk-ARCGE2VT.mjs → chunk-BWJC5ZOD.mjs} +2 -2
- package/dist/{chunk-ARCGE2VT.mjs.map → chunk-BWJC5ZOD.mjs.map} +1 -1
- package/dist/{chunk-PFE6GMNE.mjs → chunk-HMRFYJK6.mjs} +19 -11
- package/dist/chunk-HMRFYJK6.mjs.map +1 -0
- package/dist/{chunk-32W4QEJP.mjs → chunk-KFTGPFRD.mjs} +1 -1
- package/dist/chunk-KFTGPFRD.mjs.map +1 -0
- package/dist/{chunk-PNFQQSRA.mjs → chunk-OSWV5IJB.mjs} +114 -35
- package/dist/chunk-OSWV5IJB.mjs.map +1 -0
- package/dist/{chunk-OPHK6OJN.mjs → chunk-SLDBGSC3.mjs} +2 -2
- package/dist/{chunk-L2PE36GQ.mjs → chunk-T2KL7VEL.mjs} +3 -3
- package/dist/{chunk-WDU6QXNK.mjs → chunk-UCYWGN2P.mjs} +1 -1
- package/dist/chunk-UCYWGN2P.mjs.map +1 -0
- package/dist/{chunk-65A7QIKI.mjs → chunk-UMVLB3PN.mjs} +3 -3
- package/dist/chunk-UMVLB3PN.mjs.map +1 -0
- package/dist/{chunk-VY2UYN5R.mjs → chunk-VPCFICID.mjs} +82 -3
- package/dist/chunk-VPCFICID.mjs.map +1 -0
- package/dist/{chunk-H3TE3LOV.mjs → chunk-XMFTIVJH.mjs} +2 -2
- package/dist/{chunk-UB5UOSHB.mjs → chunk-ZVMV3THA.mjs} +71 -2
- package/dist/chunk-ZVMV3THA.mjs.map +1 -0
- package/dist/client.cjs.map +1 -1
- package/dist/client.mjs +3 -3
- package/dist/deployment.cjs +12 -0
- package/dist/deployment.cjs.map +1 -1
- package/dist/deployment.mjs +3 -1
- package/dist/{devtools-GAZ7F3KL.mjs → devtools-E4YNCY5J.mjs} +4 -4
- package/dist/docs.cjs.map +1 -1
- package/dist/docs.mjs +4 -4
- package/dist/index.cjs +306 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +28 -16
- package/dist/index.mjs.map +1 -1
- package/dist/internal/build-runtime.cjs +133 -40
- package/dist/internal/build-runtime.cjs.map +1 -1
- package/dist/internal/build-runtime.mjs +11 -11
- package/dist/internal/config-runtime.cjs.map +1 -1
- package/dist/internal/config-runtime.mjs +3 -3
- package/dist/navigation.cjs.map +1 -1
- package/dist/navigation.mjs +3 -3
- package/dist/plugin.cjs +115 -28
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.mjs +8 -8
- package/dist/server-action-security.cjs +23 -1
- package/dist/server-action-security.cjs.map +1 -1
- package/dist/server-action-security.mjs +1 -1
- package/dist/server-fn-client.cjs.map +1 -1
- package/dist/server-fn-client.mjs +1 -1
- package/dist/server-fn.cjs +140 -3
- package/dist/server-fn.cjs.map +1 -1
- package/dist/server-fn.mjs +14 -3
- package/dist/server-query.cjs +99 -1
- package/dist/server-query.cjs.map +1 -1
- package/dist/server-query.mjs +3 -3
- package/dist/server.cjs +234 -31
- package/dist/server.cjs.map +1 -1
- package/dist/server.mjs +11 -11
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.mjs +3 -3
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +116 -29
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +8 -8
- package/package.json +1 -1
- package/dist/chunk-32W4QEJP.mjs.map +0 -1
- package/dist/chunk-65A7QIKI.mjs.map +0 -1
- package/dist/chunk-B232I2GP.mjs.map +0 -1
- package/dist/chunk-PFE6GMNE.mjs.map +0 -1
- package/dist/chunk-PNFQQSRA.mjs.map +0 -1
- package/dist/chunk-UB5UOSHB.mjs.map +0 -1
- package/dist/chunk-VY2UYN5R.mjs.map +0 -1
- package/dist/chunk-WDU6QXNK.mjs.map +0 -1
- /package/dist/{chunk-JDEOUK5V.mjs.map → chunk-6YXKHAFU.mjs.map} +0 -0
- /package/dist/{chunk-Z5CQMP54.mjs.map → chunk-ARRYKOI5.mjs.map} +0 -0
- /package/dist/{chunk-KLA67WKG.mjs.map → chunk-B3FFOIWS.mjs.map} +0 -0
- /package/dist/{chunk-OPHK6OJN.mjs.map → chunk-SLDBGSC3.mjs.map} +0 -0
- /package/dist/{chunk-L2PE36GQ.mjs.map → chunk-T2KL7VEL.mjs.map} +0 -0
- /package/dist/{chunk-H3TE3LOV.mjs.map → chunk-XMFTIVJH.mjs.map} +0 -0
- /package/dist/{devtools-GAZ7F3KL.mjs.map → devtools-E4YNCY5J.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
} from "./chunk-VCANOYFI.mjs";
|
|
10
10
|
import {
|
|
11
11
|
build
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-AN3PQVKH.mjs";
|
|
13
13
|
import "./chunk-4S3ORGFA.mjs";
|
|
14
14
|
import "./chunk-SL6HTIOK.mjs";
|
|
15
15
|
import {
|
|
16
16
|
useServerFn
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-KFTGPFRD.mjs";
|
|
18
18
|
import {
|
|
19
19
|
cookies,
|
|
20
20
|
headers
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
isFarmDocsRequest,
|
|
31
31
|
loadFarmDocsPage,
|
|
32
32
|
resolveFarmDocsContentDir
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-SLDBGSC3.mjs";
|
|
34
34
|
import "./chunk-V7RBCSDJ.mjs";
|
|
35
35
|
import {
|
|
36
36
|
farmMiddlewarePlugin,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
} from "./chunk-EJ7T4TPB.mjs";
|
|
47
47
|
import {
|
|
48
48
|
farmApiPlugin
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-6YXKHAFU.mjs";
|
|
50
50
|
import {
|
|
51
51
|
FarmEnvironmentError,
|
|
52
52
|
createClientOnlyFn,
|
|
@@ -56,13 +56,13 @@ import {
|
|
|
56
56
|
import {
|
|
57
57
|
FARM_SERVER_QUERY_SYMBOL,
|
|
58
58
|
createServerQuery
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-UMVLB3PN.mjs";
|
|
60
60
|
import {
|
|
61
61
|
FARM_SERVER_FN_SYMBOL,
|
|
62
62
|
_parseServerFnSchema,
|
|
63
63
|
createServerFn,
|
|
64
64
|
createServerMiddleware
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-VPCFICID.mjs";
|
|
66
66
|
import {
|
|
67
67
|
getDeployTargetForPreset,
|
|
68
68
|
getPresetForDeployTarget,
|
|
@@ -72,7 +72,7 @@ import {
|
|
|
72
72
|
resolveDeployConfig,
|
|
73
73
|
resolveDeployOutputPath,
|
|
74
74
|
resolveMigrationsConfig
|
|
75
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-T2KL7VEL.mjs";
|
|
76
76
|
import {
|
|
77
77
|
defineConfig,
|
|
78
78
|
defineFarmConfig
|
|
@@ -96,7 +96,7 @@ import {
|
|
|
96
96
|
createStore,
|
|
97
97
|
useFetcher,
|
|
98
98
|
useMutation
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-UCYWGN2P.mjs";
|
|
100
100
|
import {
|
|
101
101
|
installChunkErrorRecovery,
|
|
102
102
|
isChunkLoadError
|
|
@@ -148,7 +148,7 @@ import {
|
|
|
148
148
|
parseRouteRenderingDirective,
|
|
149
149
|
resolveRouteRenderingConfig,
|
|
150
150
|
resolveRouteRenderingConfigFromFile
|
|
151
|
-
} from "./chunk-
|
|
151
|
+
} from "./chunk-OSWV5IJB.mjs";
|
|
152
152
|
import {
|
|
153
153
|
APITypeGenerator
|
|
154
154
|
} from "./chunk-LGHEOHBU.mjs";
|
|
@@ -170,7 +170,7 @@ import "./chunk-USWZZUEH.mjs";
|
|
|
170
170
|
import {
|
|
171
171
|
usePathname,
|
|
172
172
|
useSearchParams
|
|
173
|
-
} from "./chunk-
|
|
173
|
+
} from "./chunk-XMFTIVJH.mjs";
|
|
174
174
|
import {
|
|
175
175
|
getFarmRedirectError,
|
|
176
176
|
isFarmNotFoundError,
|
|
@@ -203,17 +203,22 @@ import "./chunk-7ZVN3YZI.mjs";
|
|
|
203
203
|
import "./chunk-GY2STC2S.mjs";
|
|
204
204
|
import {
|
|
205
205
|
DEFAULT_SERVER_ACTION_BODY_SIZE_LIMIT,
|
|
206
|
+
FARM_SERVER_FN_FAILURE_SYMBOL,
|
|
207
|
+
ServerActionError,
|
|
206
208
|
ServerActionRequestError,
|
|
209
|
+
ServerFnFailure,
|
|
207
210
|
createServerActionRequestErrorResponse,
|
|
211
|
+
createServerFnTransportError,
|
|
208
212
|
getServerActionExecutionContext,
|
|
209
213
|
getServerActionInvalidations,
|
|
210
214
|
getServerActionSignal,
|
|
215
|
+
isServerFnFailure,
|
|
211
216
|
prepareServerActionRequest,
|
|
212
217
|
resolveServerActionsConfig,
|
|
213
218
|
runWithServerActionRequest,
|
|
214
219
|
sanitizeServerActionError,
|
|
215
220
|
validateServerActionRequest
|
|
216
|
-
} from "./chunk-
|
|
221
|
+
} from "./chunk-ZVMV3THA.mjs";
|
|
217
222
|
import {
|
|
218
223
|
createFarmMarkdownRouteModule,
|
|
219
224
|
createFarmMarkdownRouteModuleFromFile,
|
|
@@ -332,7 +337,7 @@ import "./chunk-QGOHVJ6J.mjs";
|
|
|
332
337
|
import {
|
|
333
338
|
APIRouteManager,
|
|
334
339
|
API_ROUTE_METHODS
|
|
335
|
-
} from "./chunk-
|
|
340
|
+
} from "./chunk-ARRYKOI5.mjs";
|
|
336
341
|
import "./chunk-2ED5Q2GH.mjs";
|
|
337
342
|
import "./chunk-GN72QAIH.mjs";
|
|
338
343
|
import "./chunk-FQYDHKKU.mjs";
|
|
@@ -389,12 +394,12 @@ import {
|
|
|
389
394
|
isWebResponse,
|
|
390
395
|
matchAPIRoute,
|
|
391
396
|
normalizeRouteResponse
|
|
392
|
-
} from "./chunk-
|
|
397
|
+
} from "./chunk-HMRFYJK6.mjs";
|
|
393
398
|
import {
|
|
394
399
|
getCurrentRequest
|
|
395
400
|
} from "./chunk-RHIFZZUI.mjs";
|
|
396
401
|
import "./chunk-LM2YNO4U.mjs";
|
|
397
|
-
import "./chunk-
|
|
402
|
+
import "./chunk-BWJC5ZOD.mjs";
|
|
398
403
|
import {
|
|
399
404
|
SPARouter,
|
|
400
405
|
getRouter,
|
|
@@ -408,7 +413,7 @@ import {
|
|
|
408
413
|
usePageState,
|
|
409
414
|
useRouter,
|
|
410
415
|
useScrollRestoration
|
|
411
|
-
} from "./chunk-
|
|
416
|
+
} from "./chunk-B3FFOIWS.mjs";
|
|
412
417
|
import "./chunk-ITN462YM.mjs";
|
|
413
418
|
import {
|
|
414
419
|
FARM_DEPLOYMENT_COOKIE,
|
|
@@ -422,12 +427,13 @@ import {
|
|
|
422
427
|
createFarmDeploymentMismatchResponse,
|
|
423
428
|
createFarmDeploymentRequestHeaders,
|
|
424
429
|
getFarmDeploymentMismatch,
|
|
430
|
+
getFarmPresetRuntime,
|
|
425
431
|
getFarmRequestDeploymentId,
|
|
426
432
|
getFarmResponseDeploymentId,
|
|
427
433
|
isFarmDeploymentMismatchResponse,
|
|
428
434
|
normalizeFarmDeploymentId,
|
|
429
435
|
withFarmDeploymentResponse
|
|
430
|
-
} from "./chunk-
|
|
436
|
+
} from "./chunk-3HIVDX7J.mjs";
|
|
431
437
|
import {
|
|
432
438
|
api,
|
|
433
439
|
defineIntegrationAPI,
|
|
@@ -633,6 +639,7 @@ export {
|
|
|
633
639
|
FARM_DEVTOOLS_LAUNCH_PARAM,
|
|
634
640
|
FARM_DEVTOOLS_PATH,
|
|
635
641
|
FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY,
|
|
642
|
+
FARM_SERVER_FN_FAILURE_SYMBOL,
|
|
636
643
|
FARM_SERVER_FN_SYMBOL,
|
|
637
644
|
FARM_SERVER_QUERY_SYMBOL,
|
|
638
645
|
FarmClientPluginManager,
|
|
@@ -655,7 +662,9 @@ export {
|
|
|
655
662
|
PluginManager,
|
|
656
663
|
SPARouter,
|
|
657
664
|
ScalarAPIDocumentation,
|
|
665
|
+
ServerActionError,
|
|
658
666
|
ServerActionRequestError,
|
|
667
|
+
ServerFnFailure,
|
|
659
668
|
_parseServerFnSchema,
|
|
660
669
|
_runWithAfterNodeResponse,
|
|
661
670
|
_runWithAfterRequest,
|
|
@@ -744,6 +753,7 @@ export {
|
|
|
744
753
|
createServerAPIClient,
|
|
745
754
|
createServerActionRequestErrorResponse,
|
|
746
755
|
createServerFn,
|
|
756
|
+
createServerFnTransportError,
|
|
747
757
|
createServerMiddleware,
|
|
748
758
|
createServerOnlyFn,
|
|
749
759
|
createServerQuery,
|
|
@@ -797,6 +807,7 @@ export {
|
|
|
797
807
|
getFarmDocsRouteTypeEntries,
|
|
798
808
|
getFarmIntegrationPluginServerRuntime,
|
|
799
809
|
getFarmLayerAliases,
|
|
810
|
+
getFarmPresetRuntime,
|
|
800
811
|
getFarmRedirectError,
|
|
801
812
|
getFarmRequestDeploymentId,
|
|
802
813
|
getFarmResponseDeploymentId,
|
|
@@ -860,6 +871,7 @@ export {
|
|
|
860
871
|
isProgrammaticRouteManifest,
|
|
861
872
|
isProgrammaticRoutesFileName,
|
|
862
873
|
isSSGModule,
|
|
874
|
+
isServerFnFailure,
|
|
863
875
|
isWebResponse,
|
|
864
876
|
jsonStream,
|
|
865
877
|
layout,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/provider.tsx","../src/openapi/scalar-component.tsx","../src/openapi/docs-route.tsx"],"sourcesContent":["import React, { createContext, useContext, type ReactNode } from \"react\";\nimport type { FarmConfig } from \"./types\";\n\ninterface FarmContextValue {\n config: FarmConfig;\n basePath: string;\n}\n\nconst FarmContext = createContext<FarmContextValue | null>(null);\n\ninterface FarmProviderProps {\n children: ReactNode;\n config: FarmConfig;\n}\n\n/**\n * Farm.js context provider for client-side components\n */\nexport function FarmProvider({ children, config }: FarmProviderProps) {\n const value: FarmContextValue = {\n config,\n basePath: config.basePath || \"/\",\n };\n\n return <FarmContext.Provider value={value}>{children}</FarmContext.Provider>;\n}\n\n/**\n * Hook to access Farm.js configuration and utilities\n */\nexport function useFarm(): FarmContextValue {\n const context = useContext(FarmContext);\n\n if (!context) {\n throw new Error(\"useFarm must be used within a FarmProvider\");\n }\n\n return context;\n}\n\n/**\n * Hook to get the current base path\n */\nexport function useBasePath(): string {\n const { basePath } = useFarm();\n return basePath;\n}\n","import React from \"react\";\n\ninterface ScalarAPIDocumentationProps {\n spec: any;\n config?: {\n theme?: \"default\" | \"purple\" | \"blue\" | \"green\" | \"red\" | \"yellow\";\n layout?: \"modern\" | \"classic\";\n showSidebar?: boolean;\n hideDownloadButton?: boolean;\n hideTryItPanel?: boolean;\n };\n}\n\nexport function ScalarAPIDocumentation({ spec, config = {} }: ScalarAPIDocumentationProps) {\n const [isLoaded, setIsLoaded] = React.useState(false);\n\n React.useEffect(() => {\n // Dynamically import Scalar components\n const loadScalar = async () => {\n try {\n // Load Scalar CSS\n const cssLink = document.createElement(\"link\");\n cssLink.rel = \"stylesheet\";\n cssLink.href = \"https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest/dist/style.css\";\n document.head.appendChild(cssLink);\n\n // Load Scalar JS\n const script = document.createElement(\"script\");\n script.src =\n \"https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest/dist/browser/standalone.js\";\n script.onload = () => setIsLoaded(true);\n document.head.appendChild(script);\n } catch (error) {\n console.error(\"Failed to load Scalar:\", error);\n }\n };\n\n loadScalar();\n }, []);\n\n React.useEffect(() => {\n if (isLoaded && window.ScalarApiReference) {\n // Initialize Scalar\n const container = document.getElementById(\"scalar-api-reference\");\n if (container) {\n window.ScalarApiReference({\n spec,\n theme: config.theme || \"default\",\n layout: config.layout || \"modern\",\n showSidebar: config.showSidebar !== false,\n hideDownloadButton: config.hideDownloadButton || false,\n hideTryItPanel: config.hideTryItPanel || false,\n });\n }\n }\n }, [isLoaded, spec, config]);\n\n return (\n <div className=\"scalar-container\">\n <div id=\"scalar-api-reference\" style={{ height: \"100vh\", width: \"100%\" }} />\n </div>\n );\n}\n\n// Extend window type for Scalar\ndeclare global {\n interface Window {\n ScalarApiReference: (config: any) => void;\n }\n}\n","import React from \"react\";\nimport { ScalarAPIDocumentation } from \"./scalar-component\";\n\ninterface DocsRouteProps {\n spec: any;\n config?: any;\n}\n\nexport function DocsRoute({ spec, config }: DocsRouteProps) {\n return (\n <html lang=\"en\">\n <head>\n <meta charSet=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" href=\"data:,\" />\n <title>{config?.title || \"API Documentation\"}</title>\n <style>{`\n body {\n margin: 0;\n padding: 0;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;\n }\n .scalar-container {\n height: 100vh;\n width: 100%;\n }\n `}</style>\n </head>\n <body>\n <ScalarAPIDocumentation spec={spec} config={config} />\n </body>\n </html>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/provider.tsx","../src/openapi/scalar-component.tsx","../src/openapi/docs-route.tsx"],"sourcesContent":["import React, { createContext, useContext, type ReactNode } from \"react\";\nimport type { FarmConfig } from \"./types\";\n\ninterface FarmContextValue {\n config: FarmConfig;\n basePath: string;\n}\n\nconst FarmContext = createContext<FarmContextValue | null>(null);\n\ninterface FarmProviderProps {\n children: ReactNode;\n config: FarmConfig;\n}\n\n/**\n * Farm.js context provider for client-side components\n */\nexport function FarmProvider({ children, config }: FarmProviderProps) {\n const value: FarmContextValue = {\n config,\n basePath: config.basePath || \"/\",\n };\n\n return <FarmContext.Provider value={value}>{children}</FarmContext.Provider>;\n}\n\n/**\n * Hook to access Farm.js configuration and utilities\n */\nexport function useFarm(): FarmContextValue {\n const context = useContext(FarmContext);\n\n if (!context) {\n throw new Error(\"useFarm must be used within a FarmProvider\");\n }\n\n return context;\n}\n\n/**\n * Hook to get the current base path\n */\nexport function useBasePath(): string {\n const { basePath } = useFarm();\n return basePath;\n}\n","import React from \"react\";\n\ninterface ScalarAPIDocumentationProps {\n spec: any;\n config?: {\n theme?: \"default\" | \"purple\" | \"blue\" | \"green\" | \"red\" | \"yellow\";\n layout?: \"modern\" | \"classic\";\n showSidebar?: boolean;\n hideDownloadButton?: boolean;\n hideTryItPanel?: boolean;\n };\n}\n\nexport function ScalarAPIDocumentation({ spec, config = {} }: ScalarAPIDocumentationProps) {\n const [isLoaded, setIsLoaded] = React.useState(false);\n\n React.useEffect(() => {\n // Dynamically import Scalar components\n const loadScalar = async () => {\n try {\n // Load Scalar CSS\n const cssLink = document.createElement(\"link\");\n cssLink.rel = \"stylesheet\";\n cssLink.href = \"https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest/dist/style.css\";\n document.head.appendChild(cssLink);\n\n // Load Scalar JS\n const script = document.createElement(\"script\");\n script.src =\n \"https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest/dist/browser/standalone.js\";\n script.onload = () => setIsLoaded(true);\n document.head.appendChild(script);\n } catch (error) {\n console.error(\"Failed to load Scalar:\", error);\n }\n };\n\n loadScalar();\n }, []);\n\n React.useEffect(() => {\n if (isLoaded && window.ScalarApiReference) {\n // Initialize Scalar\n const container = document.getElementById(\"scalar-api-reference\");\n if (container) {\n window.ScalarApiReference({\n spec,\n theme: config.theme || \"default\",\n layout: config.layout || \"modern\",\n showSidebar: config.showSidebar !== false,\n hideDownloadButton: config.hideDownloadButton || false,\n hideTryItPanel: config.hideTryItPanel || false,\n });\n }\n }\n }, [isLoaded, spec, config]);\n\n return (\n <div className=\"scalar-container\">\n <div id=\"scalar-api-reference\" style={{ height: \"100vh\", width: \"100%\" }} />\n </div>\n );\n}\n\n// Extend window type for Scalar\ndeclare global {\n interface Window {\n ScalarApiReference: (config: any) => void;\n }\n}\n","import React from \"react\";\nimport { ScalarAPIDocumentation } from \"./scalar-component\";\n\ninterface DocsRouteProps {\n spec: any;\n config?: any;\n}\n\nexport function DocsRoute({ spec, config }: DocsRouteProps) {\n return (\n <html lang=\"en\">\n <head>\n <meta charSet=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" href=\"data:,\" />\n <title>{config?.title || \"API Documentation\"}</title>\n <style>{`\n body {\n margin: 0;\n padding: 0;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;\n }\n .scalar-container {\n height: 100vh;\n width: 100%;\n }\n `}</style>\n </head>\n <body>\n <ScalarAPIDocumentation spec={spec} config={config} />\n </body>\n </html>\n );\n}\n"],"mappings":"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","names":["createContext","createContext","React","jsx","React","jsx"]}
|
|
@@ -4303,6 +4303,13 @@ var init_cache_invalidation = __esm({
|
|
|
4303
4303
|
}
|
|
4304
4304
|
});
|
|
4305
4305
|
|
|
4306
|
+
// src/server-fn-error.ts
|
|
4307
|
+
var init_server_fn_error = __esm({
|
|
4308
|
+
"src/server-fn-error.ts"() {
|
|
4309
|
+
"use strict";
|
|
4310
|
+
}
|
|
4311
|
+
});
|
|
4312
|
+
|
|
4306
4313
|
// src/server-action-security.ts
|
|
4307
4314
|
function resolveServerActionsConfig(config) {
|
|
4308
4315
|
const allowedOrigins = (config?.allowedOrigins ?? []).map(normalizeAllowedOriginPattern);
|
|
@@ -4396,6 +4403,7 @@ var init_server_action_security = __esm({
|
|
|
4396
4403
|
"use strict";
|
|
4397
4404
|
import_node_async_hooks = require("async_hooks");
|
|
4398
4405
|
init_cache_invalidation();
|
|
4406
|
+
init_server_fn_error();
|
|
4399
4407
|
DEFAULT_SERVER_ACTION_BODY_SIZE_LIMIT = 1e6;
|
|
4400
4408
|
SERVER_ACTION_STORAGE_KEY = /* @__PURE__ */ Symbol.for("farm.serverActionStorage");
|
|
4401
4409
|
__name(resolveServerActionsConfig, "resolveServerActionsConfig");
|
|
@@ -4865,6 +4873,15 @@ var init_layers = __esm({
|
|
|
4865
4873
|
});
|
|
4866
4874
|
|
|
4867
4875
|
// src/deployment.ts
|
|
4876
|
+
function getFarmPresetRuntime(preset) {
|
|
4877
|
+
if (preset === "cloudflare" || preset === "cloudflare-pages" || preset === "cloudflare-module" || preset === "netlify-edge" || preset === "vercel-edge" || preset === "deno") {
|
|
4878
|
+
return "edge";
|
|
4879
|
+
}
|
|
4880
|
+
if (preset === "node-server" || preset === "vercel" || preset === "netlify" || preset === "aws-lambda" || preset === "azure" || preset === "firebase" || preset === "bun" || preset === "self-host" || preset === "farm") {
|
|
4881
|
+
return "node";
|
|
4882
|
+
}
|
|
4883
|
+
return "unknown";
|
|
4884
|
+
}
|
|
4868
4885
|
function normalizeFarmDeploymentId(value) {
|
|
4869
4886
|
if (typeof value !== "string" || value.trim() === "") {
|
|
4870
4887
|
throw new TypeError("Farm deploymentId must be a non-empty string");
|
|
@@ -4940,6 +4957,7 @@ var init_deployment = __esm({
|
|
|
4940
4957
|
FARM_DEPLOYMENT_COOKIE = "__farm_deployment";
|
|
4941
4958
|
FARM_DEPLOYMENT_MISMATCH_CODE = "FARM_DEPLOYMENT_MISMATCH";
|
|
4942
4959
|
FARM_DEPLOYMENT_MISMATCH_STATUS = 409;
|
|
4960
|
+
__name(getFarmPresetRuntime, "getFarmPresetRuntime");
|
|
4943
4961
|
__name(normalizeFarmDeploymentId, "normalizeFarmDeploymentId");
|
|
4944
4962
|
__name(getFarmRequestDeploymentId, "getFarmRequestDeploymentId");
|
|
4945
4963
|
__name(getFarmDeploymentMismatch, "getFarmDeploymentMismatch");
|
|
@@ -16340,6 +16358,13 @@ function routePatternToTsTypeLiterals(pattern) {
|
|
|
16340
16358
|
function routePatternToRouteLiteral(pattern) {
|
|
16341
16359
|
return JSON.stringify(pattern);
|
|
16342
16360
|
}
|
|
16361
|
+
function renderTypeUnion(values) {
|
|
16362
|
+
return values.length <= 1 ? values[0] || "never" : `
|
|
16363
|
+
| ${values.join("\n | ")}`;
|
|
16364
|
+
}
|
|
16365
|
+
function renderTypeAlias(name, value) {
|
|
16366
|
+
return `export type ${name} =${value.startsWith("\n") ? "" : " "}${value};`;
|
|
16367
|
+
}
|
|
16343
16368
|
function createRoutePattern(route) {
|
|
16344
16369
|
if (route.segments.length === 0) return "/";
|
|
16345
16370
|
return "/" + route.segments.map((seg) => {
|
|
@@ -16399,9 +16424,9 @@ async function createRouteTypeDeclarations(options, outPath) {
|
|
|
16399
16424
|
const typeLiterals = Array.from(new Set(sortedPatterns.flatMap(routePatternToTsTypeLiterals)));
|
|
16400
16425
|
const patternLiterals = sortedPatterns.map(routePatternToRouteLiteral);
|
|
16401
16426
|
const routeModulePatternLiterals = Array.from(routeModulePatterns).sort().map(routePatternToRouteLiteral);
|
|
16402
|
-
const routePathType = suppressLintOnLink ? "string" : typeLiterals
|
|
16403
|
-
const routePatternType = suppressLintOnLink ? "string" : patternLiterals
|
|
16404
|
-
const routeModulePatternType = routeModulePatternLiterals
|
|
16427
|
+
const routePathType = suppressLintOnLink ? "string" : renderTypeUnion(typeLiterals);
|
|
16428
|
+
const routePatternType = suppressLintOnLink ? "string" : renderTypeUnion(patternLiterals);
|
|
16429
|
+
const routeModulePatternType = renderTypeUnion(routeModulePatternLiterals);
|
|
16405
16430
|
const routeTypesImportPath = `./${path20.basename(outPath).replace(/\.d\.ts$/, "")}`;
|
|
16406
16431
|
const linkAugmentationBlock = suppressLintOnLink ? "" : `
|
|
16407
16432
|
declare module "@farm.js/core/client" {
|
|
@@ -16443,9 +16468,9 @@ declare global {
|
|
|
16443
16468
|
* Regenerated on dev start and when routes change.
|
|
16444
16469
|
* Set suppressLintOnLink: true in farm.config.ts to accept any string on Link href.
|
|
16445
16470
|
*/
|
|
16446
|
-
|
|
16447
|
-
|
|
16448
|
-
|
|
16471
|
+
${renderTypeAlias("RoutePath", routePathType)}
|
|
16472
|
+
${renderTypeAlias("RoutePattern", routePatternType)}
|
|
16473
|
+
${renderTypeAlias("RouteModulePattern", routeModulePatternType)}${linkAugmentationBlock}${routeModuleAugmentationBlock}
|
|
16449
16474
|
`;
|
|
16450
16475
|
return content;
|
|
16451
16476
|
}
|
|
@@ -16462,6 +16487,8 @@ var init_generate_route_types = __esm({
|
|
|
16462
16487
|
__name(routeSegmentsToTsTypeLiteral, "routeSegmentsToTsTypeLiteral");
|
|
16463
16488
|
__name(routePatternToTsTypeLiterals, "routePatternToTsTypeLiterals");
|
|
16464
16489
|
__name(routePatternToRouteLiteral, "routePatternToRouteLiteral");
|
|
16490
|
+
__name(renderTypeUnion, "renderTypeUnion");
|
|
16491
|
+
__name(renderTypeAlias, "renderTypeAlias");
|
|
16465
16492
|
__name(createRoutePattern, "createRoutePattern");
|
|
16466
16493
|
DEFAULT_OUT_FILE = "farm-routes.d.ts";
|
|
16467
16494
|
__name(generateRouteTypes, "generateRouteTypes");
|
|
@@ -16762,7 +16789,8 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
16762
16789
|
const sourceRoots = getFarmSourceRoots({ root, srcDir, layers: options.layers });
|
|
16763
16790
|
const appDirs = getFarmAppDirectories({ root, srcDir, layers: options.layers });
|
|
16764
16791
|
const result = {
|
|
16765
|
-
apiRoutes: []
|
|
16792
|
+
apiRoutes: [],
|
|
16793
|
+
stalePaths: []
|
|
16766
16794
|
};
|
|
16767
16795
|
const unifiedTypesPath = (0, import_path11.join)(root, srcDir, "farm.d.ts");
|
|
16768
16796
|
const shouldRefreshUnifiedTypes = shouldGenerateRoutes && !options.routeTypesOutFile || shouldGenerateEnv && !options.envTypesOutFile || shouldGenerateI18n && !options.i18nTypesOutFile;
|
|
@@ -16778,22 +16806,29 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
16778
16806
|
unifiedSections.push(await createRouteTypeDeclarations(routeOptions, unifiedTypesPath));
|
|
16779
16807
|
result.routeTypesPath = unifiedTypesPath;
|
|
16780
16808
|
} else if (shouldGenerateRoutes) {
|
|
16781
|
-
|
|
16809
|
+
const routeOptions = {
|
|
16782
16810
|
root,
|
|
16783
16811
|
srcDir,
|
|
16784
16812
|
outFile: options.routeTypesOutFile,
|
|
16785
16813
|
extraRoutes: options.extraRoutes || [],
|
|
16786
16814
|
suppressLintOnLink: options.suppressLintOnLink,
|
|
16787
16815
|
sourceRoots
|
|
16788
|
-
}
|
|
16816
|
+
};
|
|
16817
|
+
if (options.check) {
|
|
16818
|
+
const routeTypesPath = resolveGeneratedPath(root, srcDir, options.routeTypesOutFile);
|
|
16819
|
+
const content = await createRouteTypeDeclarations(routeOptions, routeTypesPath);
|
|
16820
|
+
checkGeneratedFile(routeTypesPath, content, result.stalePaths);
|
|
16821
|
+
result.routeTypesPath = routeTypesPath;
|
|
16822
|
+
} else {
|
|
16823
|
+
result.routeTypesPath = await generateRouteTypes(routeOptions);
|
|
16824
|
+
}
|
|
16789
16825
|
}
|
|
16790
16826
|
if (shouldGenerateApi) {
|
|
16791
16827
|
const generator = new APITypeGenerator(appDirs);
|
|
16792
16828
|
const apiRoutes = generator.scanAPIRoutes();
|
|
16793
16829
|
const apiTypesPath = options.apiTypesOutFile ? (0, import_path11.resolve)(root, options.apiTypesOutFile) : (0, import_path11.join)(root, srcDir, "lib", "api.generated.ts");
|
|
16794
16830
|
const content = generator.generateAPIRouter(apiRoutes, { outFile: apiTypesPath });
|
|
16795
|
-
(
|
|
16796
|
-
writeFileIfChanged(apiTypesPath, content);
|
|
16831
|
+
writeOrCheckGeneratedFile(apiTypesPath, content, options.check, result.stalePaths);
|
|
16797
16832
|
result.apiTypesPath = apiTypesPath;
|
|
16798
16833
|
result.apiRoutes = apiRoutes;
|
|
16799
16834
|
}
|
|
@@ -16811,36 +16846,63 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
16811
16846
|
);
|
|
16812
16847
|
result.envTypesPath = unifiedTypesPath;
|
|
16813
16848
|
} else if (shouldGenerateEnv) {
|
|
16814
|
-
|
|
16849
|
+
const envOptions = {
|
|
16815
16850
|
root,
|
|
16816
16851
|
srcDir,
|
|
16817
16852
|
outFile: options.envTypesOutFile,
|
|
16818
16853
|
configPath: options.configPath,
|
|
16819
16854
|
layerConfigPaths: (options.layers ?? []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile))
|
|
16820
|
-
}
|
|
16855
|
+
};
|
|
16856
|
+
if (options.check) {
|
|
16857
|
+
const envTypesPath = resolveGeneratedPath(root, srcDir, options.envTypesOutFile);
|
|
16858
|
+
checkGeneratedFile(
|
|
16859
|
+
envTypesPath,
|
|
16860
|
+
createEnvTypeDeclarations(envOptions, envTypesPath),
|
|
16861
|
+
result.stalePaths
|
|
16862
|
+
);
|
|
16863
|
+
result.envTypesPath = envTypesPath;
|
|
16864
|
+
} else {
|
|
16865
|
+
result.envTypesPath = await generateEnvTypes(envOptions);
|
|
16866
|
+
}
|
|
16821
16867
|
}
|
|
16822
16868
|
if (shouldGenerateImages && options.imageTypesOutFile) {
|
|
16823
|
-
|
|
16824
|
-
|
|
16825
|
-
|
|
16826
|
-
|
|
16827
|
-
}
|
|
16869
|
+
const imageTypesPath = resolveGeneratedPath(root, srcDir, options.imageTypesOutFile, false);
|
|
16870
|
+
if (options.check) {
|
|
16871
|
+
checkGeneratedFile(imageTypesPath, createFarmImageTypeDeclarations(), result.stalePaths);
|
|
16872
|
+
result.imageTypesPath = imageTypesPath;
|
|
16873
|
+
} else {
|
|
16874
|
+
result.imageTypesPath = generateFarmImageTypes({
|
|
16875
|
+
root,
|
|
16876
|
+
srcDir,
|
|
16877
|
+
outFile: options.imageTypesOutFile
|
|
16878
|
+
});
|
|
16879
|
+
}
|
|
16828
16880
|
}
|
|
16829
16881
|
if (shouldRefreshUnifiedTypes && options.i18nConfig?.enabled && !options.i18nTypesOutFile) {
|
|
16830
16882
|
const { signatures } = await readFarmI18nCatalogs(options.i18nConfig);
|
|
16831
16883
|
unifiedSections.push(renderFarmI18nTypes(options.i18nConfig.locales, signatures));
|
|
16832
16884
|
result.i18nTypesPath = unifiedTypesPath;
|
|
16833
16885
|
} else if (shouldGenerateI18n && options.i18nConfig) {
|
|
16834
|
-
|
|
16835
|
-
root,
|
|
16836
|
-
|
|
16837
|
-
|
|
16838
|
-
|
|
16839
|
-
|
|
16886
|
+
if (options.check) {
|
|
16887
|
+
const i18nTypesPath = resolveGeneratedPath(root, srcDir, options.i18nTypesOutFile, false);
|
|
16888
|
+
const { signatures } = await readFarmI18nCatalogs(options.i18nConfig);
|
|
16889
|
+
checkGeneratedFile(
|
|
16890
|
+
i18nTypesPath,
|
|
16891
|
+
renderFarmI18nTypes(options.i18nConfig.locales, signatures),
|
|
16892
|
+
result.stalePaths
|
|
16893
|
+
);
|
|
16894
|
+
result.i18nTypesPath = i18nTypesPath;
|
|
16895
|
+
} else {
|
|
16896
|
+
result.i18nTypesPath = await generateFarmI18nTypes({
|
|
16897
|
+
root,
|
|
16898
|
+
srcDir,
|
|
16899
|
+
config: options.i18nConfig,
|
|
16900
|
+
outFile: options.i18nTypesOutFile
|
|
16901
|
+
});
|
|
16902
|
+
}
|
|
16840
16903
|
}
|
|
16841
16904
|
if (shouldRefreshUnifiedTypes) {
|
|
16842
|
-
(
|
|
16843
|
-
writeFileIfChanged(
|
|
16905
|
+
writeOrCheckGeneratedFile(
|
|
16844
16906
|
unifiedTypesPath,
|
|
16845
16907
|
`/**
|
|
16846
16908
|
* Generated by Farm.js. Do not edit.
|
|
@@ -16849,13 +16911,37 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
16849
16911
|
|
|
16850
16912
|
import "@farm.js/core/image";
|
|
16851
16913
|
|
|
16852
|
-
${unifiedSections.join("\n")}
|
|
16914
|
+
${unifiedSections.map((section) => section.trimEnd()).join("\n\n")}
|
|
16915
|
+
`,
|
|
16916
|
+
options.check,
|
|
16917
|
+
result.stalePaths
|
|
16853
16918
|
);
|
|
16854
16919
|
result.typesPath = unifiedTypesPath;
|
|
16855
|
-
|
|
16920
|
+
if (options.check) {
|
|
16921
|
+
collectLegacyTypeArtifacts(root, srcDir, result.stalePaths);
|
|
16922
|
+
} else {
|
|
16923
|
+
removeLegacyTypeArtifacts(root, srcDir);
|
|
16924
|
+
}
|
|
16856
16925
|
}
|
|
16857
16926
|
return result;
|
|
16858
16927
|
}
|
|
16928
|
+
function resolveGeneratedPath(root, srcDir, outFile, relativeToSrc = true) {
|
|
16929
|
+
if ((0, import_path11.isAbsolute)(outFile)) return (0, import_path11.resolve)(outFile);
|
|
16930
|
+
return (0, import_path11.resolve)(root, relativeToSrc ? (0, import_path11.join)(srcDir, outFile) : outFile);
|
|
16931
|
+
}
|
|
16932
|
+
function writeOrCheckGeneratedFile(filePath, content, check, stalePaths) {
|
|
16933
|
+
if (check) {
|
|
16934
|
+
checkGeneratedFile(filePath, content, stalePaths);
|
|
16935
|
+
return;
|
|
16936
|
+
}
|
|
16937
|
+
(0, import_fs4.mkdirSync)((0, import_path11.dirname)(filePath), { recursive: true });
|
|
16938
|
+
writeFileIfChanged(filePath, content);
|
|
16939
|
+
}
|
|
16940
|
+
function checkGeneratedFile(filePath, content, stalePaths) {
|
|
16941
|
+
if (!(0, import_fs4.existsSync)(filePath) || (0, import_fs4.readFileSync)(filePath, "utf8") !== content) {
|
|
16942
|
+
stalePaths.push(filePath);
|
|
16943
|
+
}
|
|
16944
|
+
}
|
|
16859
16945
|
function removeLegacyTypeArtifacts(root, srcDir) {
|
|
16860
16946
|
for (const [fileName, marker] of LEGACY_TYPE_ARTIFACTS) {
|
|
16861
16947
|
const filePath = (0, import_path11.join)(root, srcDir, fileName);
|
|
@@ -16866,6 +16952,13 @@ function removeLegacyTypeArtifacts(root, srcDir) {
|
|
|
16866
16952
|
}
|
|
16867
16953
|
}
|
|
16868
16954
|
}
|
|
16955
|
+
function collectLegacyTypeArtifacts(root, srcDir, stalePaths) {
|
|
16956
|
+
for (const [fileName, marker] of LEGACY_TYPE_ARTIFACTS) {
|
|
16957
|
+
const filePath = (0, import_path11.join)(root, srcDir, fileName);
|
|
16958
|
+
if (!(0, import_fs4.existsSync)(filePath)) continue;
|
|
16959
|
+
if ((0, import_fs4.readFileSync)(filePath, "utf8").includes(marker)) stalePaths.push(filePath);
|
|
16960
|
+
}
|
|
16961
|
+
}
|
|
16869
16962
|
var import_fs4, import_path11, LEGACY_TYPE_ARTIFACTS;
|
|
16870
16963
|
var init_type_artifacts = __esm({
|
|
16871
16964
|
"src/type-artifacts.ts"() {
|
|
@@ -16881,6 +16974,9 @@ var init_type_artifacts = __esm({
|
|
|
16881
16974
|
init_layers();
|
|
16882
16975
|
init_write_file_if_changed();
|
|
16883
16976
|
__name(generateFarmTypeArtifacts, "generateFarmTypeArtifacts");
|
|
16977
|
+
__name(resolveGeneratedPath, "resolveGeneratedPath");
|
|
16978
|
+
__name(writeOrCheckGeneratedFile, "writeOrCheckGeneratedFile");
|
|
16979
|
+
__name(checkGeneratedFile, "checkGeneratedFile");
|
|
16884
16980
|
LEGACY_TYPE_ARTIFACTS = [
|
|
16885
16981
|
["farm-routes.d.ts", "Auto-generated route types"],
|
|
16886
16982
|
["farm-env.d.ts", "Auto-generated env types"],
|
|
@@ -16888,6 +16984,7 @@ var init_type_artifacts = __esm({
|
|
|
16888
16984
|
["farm-i18n.d.ts", "Generated by Farm.js"]
|
|
16889
16985
|
];
|
|
16890
16986
|
__name(removeLegacyTypeArtifacts, "removeLegacyTypeArtifacts");
|
|
16987
|
+
__name(collectLegacyTypeArtifacts, "collectLegacyTypeArtifacts");
|
|
16891
16988
|
}
|
|
16892
16989
|
});
|
|
16893
16990
|
|
|
@@ -16895,7 +16992,7 @@ var init_type_artifacts = __esm({
|
|
|
16895
16992
|
var version;
|
|
16896
16993
|
var init_package = __esm({
|
|
16897
16994
|
"package.json"() {
|
|
16898
|
-
version = "0.1.0-beta.
|
|
16995
|
+
version = "0.1.0-beta.16";
|
|
16899
16996
|
}
|
|
16900
16997
|
});
|
|
16901
16998
|
|
|
@@ -29190,6 +29287,7 @@ init_fonts();
|
|
|
29190
29287
|
|
|
29191
29288
|
// src/route-runtime-manifest.ts
|
|
29192
29289
|
var import_path8 = __toESM(require("path"));
|
|
29290
|
+
init_deployment();
|
|
29193
29291
|
init_route_runtime();
|
|
29194
29292
|
init_ssg();
|
|
29195
29293
|
var FARM_ROUTE_RUNTIME_MANIFEST = "route-runtime-manifest.json";
|
|
@@ -29250,10 +29348,15 @@ async function writeFarmRouteRuntimeManifest(directory, manifest) {
|
|
|
29250
29348
|
}
|
|
29251
29349
|
__name(writeFarmRouteRuntimeManifest, "writeFarmRouteRuntimeManifest");
|
|
29252
29350
|
function validateFarmRouteRuntimeDeployment(manifest, preset) {
|
|
29253
|
-
const runtime =
|
|
29351
|
+
const runtime = getFarmPresetRuntime(preset);
|
|
29254
29352
|
const warnings = /* @__PURE__ */ new Set();
|
|
29255
29353
|
for (const route of manifest.routes) {
|
|
29256
29354
|
if (route.rendering === "static") continue;
|
|
29355
|
+
if (runtime === "unknown" && route.runtime !== "auto") {
|
|
29356
|
+
warnings.add(
|
|
29357
|
+
`Preset "${preset}" has an unknown runtime, so Farm could not verify routes that explicitly require node or edge.`
|
|
29358
|
+
);
|
|
29359
|
+
}
|
|
29257
29360
|
if (runtime !== "unknown" && route.runtime !== "auto" && route.runtime !== runtime) {
|
|
29258
29361
|
throw new Error(
|
|
29259
29362
|
`Route "${route.pattern}" requires the ${route.runtime} runtime, but preset "${preset}" emits ${runtime} functions. Choose a compatible preset or change the route runtime.`
|
|
@@ -29273,16 +29376,6 @@ function validateFarmRouteRuntimeDeployment(manifest, preset) {
|
|
|
29273
29376
|
return { runtime, warnings: Array.from(warnings) };
|
|
29274
29377
|
}
|
|
29275
29378
|
__name(validateFarmRouteRuntimeDeployment, "validateFarmRouteRuntimeDeployment");
|
|
29276
|
-
function getPresetRuntime(preset) {
|
|
29277
|
-
if (preset === "cloudflare" || preset === "cloudflare-pages" || preset === "cloudflare-module" || preset === "netlify-edge" || preset === "vercel-edge" || preset === "deno") {
|
|
29278
|
-
return "edge";
|
|
29279
|
-
}
|
|
29280
|
-
if (preset === "node-server" || preset === "vercel" || preset === "netlify" || preset === "aws-lambda" || preset === "azure" || preset === "firebase" || preset === "bun") {
|
|
29281
|
-
return "node";
|
|
29282
|
-
}
|
|
29283
|
-
return "unknown";
|
|
29284
|
-
}
|
|
29285
|
-
__name(getPresetRuntime, "getPresetRuntime");
|
|
29286
29379
|
function normalizeManifestSource(root, modulePath) {
|
|
29287
29380
|
const queryIndex = modulePath.indexOf("?");
|
|
29288
29381
|
const filePath = queryIndex === -1 ? modulePath : modulePath.slice(0, queryIndex);
|