@farm.js/core 0.1.0-beta.5 → 0.1.0-beta.7
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-runtime.d.mts +2 -2
- package/dist/agent-runtime.d.ts +2 -2
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api.d.mts +3 -3
- package/dist/api.d.ts +3 -3
- package/dist/{app-CakAr8Be.d.mts → app-BWtqQu3R.d.mts} +6 -4
- package/dist/app-markdown.cjs +31 -7
- package/dist/app-markdown.cjs.map +1 -1
- package/dist/app-markdown.d.mts +2 -2
- package/dist/app-markdown.d.ts +2 -2
- package/dist/app-markdown.mjs +2 -1
- package/dist/{app-BjN-da13.d.ts → app-xltejvLY.d.ts} +6 -4
- package/dist/{chunk-A2LUXHD2.mjs → chunk-5VYHFKWE.mjs} +214 -58
- package/dist/chunk-5VYHFKWE.mjs.map +1 -0
- package/dist/{chunk-EEABSBKK.mjs → chunk-6F5OI5GA.mjs} +2 -2
- package/dist/chunk-6F5OI5GA.mjs.map +1 -0
- package/dist/{chunk-LLC7BNXW.mjs → chunk-7FBJLMQH.mjs} +73 -10
- package/dist/chunk-7FBJLMQH.mjs.map +1 -0
- package/dist/{chunk-NM3CRAAL.mjs → chunk-B4W3BNTL.mjs} +24 -8
- package/dist/chunk-B4W3BNTL.mjs.map +1 -0
- package/dist/{chunk-BHG3LVHH.mjs → chunk-CGIXMLSY.mjs} +15 -7
- package/dist/chunk-CGIXMLSY.mjs.map +1 -0
- package/dist/{chunk-C3DLZMBU.mjs → chunk-DJSGLHCN.mjs} +2 -2
- package/dist/{chunk-2NHCNRF6.mjs → chunk-GFMBXLGP.mjs} +56 -20
- package/dist/chunk-GFMBXLGP.mjs.map +1 -0
- package/dist/chunk-I4CUBGVF.mjs +93 -0
- package/dist/chunk-I4CUBGVF.mjs.map +1 -0
- package/dist/{chunk-HNIQFZKB.mjs → chunk-ME4MO2RJ.mjs} +27 -37
- package/dist/chunk-ME4MO2RJ.mjs.map +1 -0
- package/dist/{chunk-RSKVYESE.mjs → chunk-RQ633A5I.mjs} +1 -1
- package/dist/chunk-RQ633A5I.mjs.map +1 -0
- package/dist/{chunk-2CUKEMVR.mjs → chunk-WDU6QXNK.mjs} +1 -1
- package/dist/chunk-WDU6QXNK.mjs.map +1 -0
- package/dist/{chunk-QGQX7SFC.mjs → chunk-ZVWA4ZQ3.mjs} +17 -8
- package/dist/chunk-ZVWA4ZQ3.mjs.map +1 -0
- package/dist/{client-plugins-DQQ1adXM.d.mts → client-plugins-BI2R6Eae.d.mts} +74 -3
- package/dist/{client-plugins-Cw4qUGsw.d.ts → client-plugins-DU9oMspX.d.ts} +74 -3
- package/dist/client-plugins.d.mts +2 -2
- package/dist/client-plugins.d.ts +2 -2
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.mts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.mjs +1 -1
- package/dist/config.d.mts +2 -2
- package/dist/config.d.ts +2 -2
- package/dist/{devtools-LVC3VB5P.mjs → devtools-REQTS3I7.mjs} +6 -5
- package/dist/{devtools-LVC3VB5P.mjs.map → devtools-REQTS3I7.mjs.map} +1 -1
- package/dist/docs.cjs +51 -56
- package/dist/docs.cjs.map +1 -1
- package/dist/docs.mjs +6 -5
- package/dist/env-types.cjs +14 -5
- package/dist/env-types.cjs.map +1 -1
- package/dist/env-types.d.mts +2 -1
- package/dist/env-types.d.ts +2 -1
- package/dist/env-types.mjs +3 -1
- package/dist/env.cjs.map +1 -1
- package/dist/env.d.mts +1 -1
- package/dist/env.d.ts +1 -1
- package/dist/env.mjs +1 -1
- package/dist/i18n/client.d.mts +2 -2
- package/dist/i18n/client.d.ts +2 -2
- package/dist/i18n/index.d.mts +3 -3
- package/dist/i18n/index.d.ts +3 -3
- package/dist/i18n/server.d.mts +5 -5
- package/dist/i18n/server.d.ts +5 -5
- package/dist/index.cjs +931 -567
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +15 -13
- package/dist/index.d.ts +15 -13
- package/dist/index.mjs +23 -16
- package/dist/index.mjs.map +1 -1
- package/dist/integrations.d.mts +2 -2
- package/dist/integrations.d.ts +2 -2
- package/dist/internal/build-runtime.cjs +643 -322
- package/dist/internal/build-runtime.cjs.map +1 -1
- package/dist/internal/build-runtime.d.mts +4 -4
- package/dist/internal/build-runtime.d.ts +4 -4
- package/dist/internal/build-runtime.mjs +11 -10
- package/dist/internal/config-runtime.cjs +135 -39
- package/dist/internal/config-runtime.cjs.map +1 -1
- package/dist/internal/config-runtime.d.mts +3 -3
- package/dist/internal/config-runtime.d.ts +3 -3
- package/dist/internal/config-runtime.mjs +5 -4
- package/dist/internal/production-runtime.d.mts +6 -6
- package/dist/internal/production-runtime.d.ts +6 -6
- package/dist/markdown.cjs +73 -8
- package/dist/markdown.cjs.map +1 -1
- package/dist/markdown.d.mts +19 -2
- package/dist/markdown.d.ts +19 -2
- package/dist/markdown.mjs +5 -1
- package/dist/{metadata-BAPg_Nmo.d.ts → metadata-Cm9ujH4I.d.ts} +1 -1
- package/dist/{metadata-_6i9oFG3.d.mts → metadata-DacXbnLA.d.mts} +1 -1
- package/dist/middleware.d.mts +4 -4
- package/dist/middleware.d.ts +4 -4
- package/dist/plugin.cjs +679 -434
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.mts +2 -2
- package/dist/plugin.d.ts +2 -2
- package/dist/plugin.mjs +8 -7
- package/dist/{production-runtime-DPfgMV9Y.d.mts → production-runtime-4KKq1AVC.d.mts} +2 -2
- package/dist/{production-runtime-BoJDc5mc.d.ts → production-runtime-DRsWDN2x.d.ts} +2 -2
- package/dist/{request-BrFBuc8G.d.mts → request-Dsq4kGW0.d.mts} +1 -1
- package/dist/{request-BslSZIRz.d.ts → request-udtobOLv.d.ts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{resolver-DlOPpjkB.d.mts → resolver-DJqjLMg_.d.mts} +1 -1
- package/dist/{resolver-C6iecsDV.d.ts → resolver-IH4RmPEl.d.ts} +1 -1
- package/dist/routes.d.mts +2 -2
- package/dist/routes.d.ts +2 -2
- package/dist/{runtime-DeAAZ6gO.d.mts → runtime-Cxpq6xZN.d.mts} +2 -2
- package/dist/{runtime-B6GvwDS1.d.ts → runtime-bv63eUiO.d.ts} +2 -2
- package/dist/server-plugins.d.mts +3 -3
- package/dist/server-plugins.d.ts +3 -3
- package/dist/server.cjs +731 -447
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.mts +9 -9
- package/dist/server.d.ts +9 -9
- package/dist/server.mjs +9 -8
- package/dist/server.mjs.map +1 -1
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/{types-BH1lhg5G.d.mts → types-BMxWr97v.d.mts} +2 -2
- package/dist/{types-BH1lhg5G.d.ts → types-BMxWr97v.d.ts} +2 -2
- package/dist/{utils-Drsyz1Vj.d.ts → utils-B-cUHwoK.d.ts} +1 -1
- package/dist/{utils-CHXlMDkg.d.mts → utils-Cm41AefV.d.mts} +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +682 -437
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.mts +2 -2
- package/dist/vite.d.ts +2 -2
- package/dist/vite.mjs +6 -5
- package/package.json +3 -2
- package/types/client.d.ts +1 -1
- package/types/image.d.ts +4 -0
- package/types/images.d.ts +59 -0
- package/dist/chunk-2CUKEMVR.mjs.map +0 -1
- package/dist/chunk-2NHCNRF6.mjs.map +0 -1
- package/dist/chunk-A2LUXHD2.mjs.map +0 -1
- package/dist/chunk-BHG3LVHH.mjs.map +0 -1
- package/dist/chunk-EEABSBKK.mjs.map +0 -1
- package/dist/chunk-HNIQFZKB.mjs.map +0 -1
- package/dist/chunk-LLC7BNXW.mjs.map +0 -1
- package/dist/chunk-NM3CRAAL.mjs.map +0 -1
- package/dist/chunk-QGQX7SFC.mjs.map +0 -1
- package/dist/chunk-RSKVYESE.mjs.map +0 -1
- /package/dist/{chunk-C3DLZMBU.mjs.map → chunk-DJSGLHCN.mjs.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/mutation-client.ts","../src/fetcher-client.tsx","../src/store.ts","../src/client/link.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useMemo, useRef, useState } from \"react\";\nimport { isAPIRouteRef, type APIResult, type ClientOptions } from \"./api/client\";\n\nexport type MutationStatus = \"idle\" | \"pending\" | \"success\" | \"error\";\n\nexport type AnyMutationTarget = (...args: any[]) => Promise<any>;\n\nexport type InferMutationVariables<TTarget extends AnyMutationTarget> =\n Parameters<TTarget> extends [] ? undefined : Parameters<TTarget>[0];\n\nexport type InferMutationData<TTarget extends AnyMutationTarget> = TTarget extends {\n readonly __farmRouteData: infer TData;\n}\n ? TData\n : Awaited<ReturnType<TTarget>>;\n\nexport type InferMutationError<TTarget extends AnyMutationTarget> = TTarget extends (\n ...args: any[]\n) => Promise<APIResult<any, infer TError>>\n ? TError\n : Error;\n\nexport type MutationOptimisticContext<TVariables, TData> = {\n variables: TVariables | undefined;\n current: TData | null;\n};\n\nexport type UseMutationOptions<TVariables, TData, TError = Error> = {\n initialData?: TData | null;\n resetOnMutate?: boolean;\n optimistic?: (context: MutationOptimisticContext<TVariables, TData>) => TData | null | undefined;\n rollbackOnError?: boolean;\n /**\n * Options forwarded to generated `api.route.method` clients.\n * Server functions ignore this field.\n */\n request?: ClientOptions<TData, TError>;\n onSuccess?: (data: TData, variables: TVariables | undefined) => void;\n onError?: (error: TError, variables: TVariables | undefined) => void;\n onSettled?: (data: TData | null, error: TError | null, variables: TVariables | undefined) => void;\n};\n\ntype MutationInput<TTarget extends AnyMutationTarget> = InferMutationVariables<TTarget>;\n\ntype MutationData<TTarget extends AnyMutationTarget> = InferMutationData<TTarget>;\n\ntype MutationError<TTarget extends AnyMutationTarget> = InferMutationError<TTarget>;\n\nexport type MutationAsync<TTarget extends AnyMutationTarget, TData = MutationData<TTarget>> =\n [] extends Parameters<TTarget>\n ? (variables?: MutationInput<TTarget>) => Promise<TData>\n : (variables: MutationInput<TTarget>) => Promise<TData>;\n\nexport type MutationTrigger<TTarget extends AnyMutationTarget> =\n [] extends Parameters<TTarget>\n ? (variables?: MutationInput<TTarget>) => void\n : (variables: MutationInput<TTarget>) => void;\n\nexport type UseMutationReturn<\n TTarget extends AnyMutationTarget,\n TData = MutationData<TTarget>,\n TError = MutationError<TTarget>,\n> = {\n pending: boolean;\n status: MutationStatus;\n data: TData | null;\n error: TError | null;\n variables: MutationInput<TTarget> | undefined;\n mutate: MutationTrigger<TTarget>;\n mutateAsync: MutationAsync<TTarget, TData>;\n reset: () => void;\n};\n\ntype MutationState<TVariables, TData, TError> = {\n pendingCount: number;\n status: MutationStatus;\n data: TData | null;\n error: TError | null;\n variables: TVariables | undefined;\n};\n\n/**\n * Track a generated API route mutation or a Farm server function with one\n * React lifecycle.\n *\n * API routes keep using their existing fetch transport and request options.\n * Server functions keep using their configured server-function transport.\n */\nexport function useMutation<TTarget extends AnyMutationTarget>(\n target: TTarget,\n options: UseMutationOptions<\n MutationInput<TTarget>,\n MutationData<TTarget>,\n MutationError<TTarget>\n > = {},\n): UseMutationReturn<TTarget> {\n type TVariables = MutationInput<TTarget>;\n type TData = MutationData<TTarget>;\n type TError = MutationError<TTarget>;\n\n const initialData = options.initialData ?? null;\n const optionsRef = useRef(options);\n const targetRef = useRef(target);\n const requestIdRef = useRef(0);\n const initialState: MutationState<TVariables, TData, TError> = {\n pendingCount: 0,\n status: \"idle\",\n data: initialData,\n error: null,\n variables: undefined,\n };\n const stateRef = useRef(initialState);\n const [state, setState] = useState<MutationState<TVariables, TData, TError>>(initialState);\n\n optionsRef.current = options;\n targetRef.current = target;\n\n const setMutationState = useCallback(\n (\n value:\n | MutationState<TVariables, TData, TError>\n | ((\n current: MutationState<TVariables, TData, TError>,\n ) => MutationState<TVariables, TData, TError>),\n ) => {\n setState((current) => {\n const next = typeof value === \"function\" ? value(current) : value;\n stateRef.current = next;\n return next;\n });\n },\n [],\n );\n\n const mutateAsync = useCallback(\n async (variables?: TVariables) => {\n const requestId = ++requestIdRef.current;\n const currentOptions = optionsRef.current;\n const previousData = stateRef.current.data;\n const optimisticData = currentOptions.optimistic?.({\n variables,\n current: previousData,\n });\n const hasOptimisticData = optimisticData !== undefined;\n\n setMutationState((current) => ({\n pendingCount: current.pendingCount + 1,\n status: \"pending\",\n data: hasOptimisticData\n ? optimisticData\n : currentOptions.resetOnMutate === false\n ? current.data\n : null,\n error: null,\n variables,\n }));\n\n try {\n const mutationTarget = targetRef.current;\n const rawResult = isAPIRouteRef(mutationTarget)\n ? await mutationTarget(variables, currentOptions.request)\n : await mutationTarget(variables);\n const data = unwrapMutationResult<TData, TError>(rawResult, isAPIRouteRef(mutationTarget));\n const isLatestRequest = requestId === requestIdRef.current;\n\n setMutationState((current) => {\n const pendingCount = Math.max(0, current.pendingCount - 1);\n if (!isLatestRequest) {\n return {\n ...current,\n pendingCount,\n status: pendingCount > 0 ? \"pending\" : current.status,\n };\n }\n\n return {\n pendingCount,\n status: \"success\",\n data,\n error: null,\n variables,\n };\n });\n\n if (isLatestRequest) {\n currentOptions.onSuccess?.(data, variables);\n currentOptions.onSettled?.(data, null, variables);\n }\n\n return data;\n } catch (cause) {\n const error = normalizeMutationError(cause) as TError;\n const isLatestRequest = requestId === requestIdRef.current;\n\n setMutationState((current) => {\n const pendingCount = Math.max(0, current.pendingCount - 1);\n if (!isLatestRequest) {\n return {\n ...current,\n pendingCount,\n status: pendingCount > 0 ? \"pending\" : current.status,\n };\n }\n\n return {\n pendingCount,\n status: \"error\",\n data:\n hasOptimisticData && currentOptions.rollbackOnError\n ? previousData\n : currentOptions.resetOnMutate === false\n ? current.data\n : null,\n error,\n variables,\n };\n });\n\n if (isLatestRequest) {\n currentOptions.onError?.(error, variables);\n currentOptions.onSettled?.(null, error, variables);\n }\n\n throw error;\n }\n },\n [setMutationState],\n ) as MutationAsync<TTarget, TData>;\n\n const mutate = useCallback(\n (variables?: TVariables) => {\n void mutateAsync(variables as never).catch(() => {});\n },\n [mutateAsync],\n ) as MutationTrigger<TTarget>;\n\n const reset = useCallback(() => {\n requestIdRef.current += 1;\n setMutationState({\n pendingCount: 0,\n status: \"idle\",\n data: optionsRef.current.initialData ?? null,\n error: null,\n variables: undefined,\n });\n }, [setMutationState]);\n\n return useMemo(\n () => ({\n pending: state.pendingCount > 0,\n status: state.status,\n data: state.data,\n error: state.error,\n variables: state.variables,\n mutate,\n mutateAsync,\n reset,\n }),\n [\n mutate,\n mutateAsync,\n reset,\n state.data,\n state.error,\n state.pendingCount,\n state.status,\n state.variables,\n ],\n );\n}\n\nfunction unwrapMutationResult<TData, TError>(result: unknown, apiRoute: boolean): TData {\n if (!apiRoute) return result as TData;\n\n const apiResult = result as APIResult<TData, TError>;\n if (apiResult.error) {\n throw apiResult.error;\n }\n\n return apiResult.data as TData;\n}\n\nfunction normalizeMutationError(error: unknown): Error {\n if (error instanceof Error) return error;\n\n const normalized = new Error(typeof error === \"string\" ? error : \"Mutation failed\");\n (normalized as Error & { cause?: unknown }).cause = error;\n return normalized;\n}\n","\"use client\";\n\nimport {\n createElement,\n useCallback,\n useMemo,\n useRef,\n useState,\n type ComponentType,\n type FormEvent,\n type FormHTMLAttributes,\n} from \"react\";\nimport { getAPIRouteRefMetadata, isAPIRouteRef } from \"./api/client\";\nimport {\n useMutation,\n type AnyMutationTarget,\n type InferMutationData,\n type InferMutationError,\n type InferMutationVariables,\n type MutationStatus,\n type UseMutationOptions,\n} from \"./mutation-client\";\n\nexport type FetcherState = \"idle\" | \"submitting\";\n\nexport type FetcherFormDataContext = {\n form: HTMLFormElement | null;\n submitter: HTMLElement | null;\n};\n\nexport type UseFetcherOptions<TTarget extends AnyMutationTarget> = UseMutationOptions<\n InferMutationVariables<TTarget>,\n InferMutationData<TTarget>,\n InferMutationError<TTarget>\n> & {\n /**\n * Convert browser FormData into the target's typed variables.\n *\n * Generated API routes default to `{ body: Object.fromEntries(formData) }`\n * (or `{ query: ... }` for GET/HEAD). Server functions receive FormData\n * directly so their input schema remains authoritative.\n */\n mapFormData?: (\n formData: FormData,\n context: FetcherFormDataContext,\n ) => InferMutationVariables<TTarget>;\n};\n\nexport type FetcherFormProps = Omit<FormHTMLAttributes<HTMLFormElement>, \"action\" | \"onSubmit\"> & {\n /**\n * Override the native form fallback. By default server functions remain the\n * action and generated GET/POST API routes use their real URL.\n */\n action?: string | ((formData: FormData) => void | Promise<void>);\n onSubmit?: (event: FormEvent<HTMLFormElement>) => void;\n};\n\ntype FetcherInput<TTarget extends AnyMutationTarget> = InferMutationVariables<TTarget> | FormData;\n\nexport type FetcherSubmitAsync<TTarget extends AnyMutationTarget> =\n [] extends Parameters<TTarget>\n ? (input?: FetcherInput<TTarget>) => Promise<InferMutationData<TTarget>>\n : (input: FetcherInput<TTarget>) => Promise<InferMutationData<TTarget>>;\n\nexport type FetcherSubmit<TTarget extends AnyMutationTarget> =\n [] extends Parameters<TTarget>\n ? (input?: FetcherInput<TTarget>) => void\n : (input: FetcherInput<TTarget>) => void;\n\nexport type UseFetcherReturn<TTarget extends AnyMutationTarget> = {\n state: FetcherState;\n status: MutationStatus;\n pending: boolean;\n data: InferMutationData<TTarget> | null;\n error: InferMutationError<TTarget> | null;\n variables: InferMutationVariables<TTarget> | undefined;\n formData: FormData | null;\n submit: FetcherSubmit<TTarget>;\n submitAsync: FetcherSubmitAsync<TTarget>;\n Form: ComponentType<FetcherFormProps>;\n reset: () => void;\n};\n\nconst formDataContexts = new WeakMap<FormData, FetcherFormDataContext>();\n\n/**\n * Run a typed server function or generated API operation without navigating.\n *\n * `fetcher.Form` progressively keeps a server function as the native form\n * action, while hydration intercepts submissions into this fetcher lifecycle.\n */\nexport function useFetcher<TTarget extends AnyMutationTarget>(\n target: TTarget,\n options: UseFetcherOptions<TTarget> = {},\n): UseFetcherReturn<TTarget> {\n const targetRef = useRef(target);\n const optionsRef = useRef(options);\n const submissionIdRef = useRef(0);\n const [formData, setFormData] = useState<FormData | null>(null);\n const mutation = useMutation(target, options);\n\n targetRef.current = target;\n optionsRef.current = options;\n\n const submitAsync = useCallback(\n async (input?: FetcherInput<TTarget>) => {\n const submissionId = ++submissionIdRef.current;\n const submittedFormData = isFormData(input) ? input : null;\n setFormData(submittedFormData);\n\n try {\n const variables = submittedFormData\n ? mapFetcherFormData(targetRef.current, submittedFormData, optionsRef.current)\n : input;\n return await mutation.mutateAsync(variables as InferMutationVariables<TTarget>);\n } finally {\n if (submissionId === submissionIdRef.current) {\n setFormData(null);\n }\n }\n },\n [mutation.mutateAsync],\n ) as FetcherSubmitAsync<TTarget>;\n\n const submit = useCallback(\n (input?: FetcherInput<TTarget>) => {\n void submitAsync(input as never).catch(() => {});\n },\n [submitAsync],\n ) as FetcherSubmit<TTarget>;\n\n const Form = useMemo(() => {\n const FetcherForm = ({ action, method, encType, onSubmit, ...props }: FetcherFormProps) => {\n const targetValue = targetRef.current;\n const metadata = getAPIRouteRefMetadata(targetValue);\n const nativeAction = action ?? resolveFetcherFormAction(targetValue, metadata);\n const nativeMethod =\n method ??\n (metadata && (metadata.method === \"GET\" || metadata.method === \"POST\")\n ? metadata.method.toLowerCase()\n : metadata\n ? \"post\"\n : undefined);\n const functionAction = typeof nativeAction === \"function\";\n\n const handleSubmit = (event: FormEvent<HTMLFormElement>) => {\n onSubmit?.(event);\n if (event.defaultPrevented) return;\n\n event.preventDefault();\n const submitter = getSubmitter(event);\n const nextFormData = createSubmitterFormData(event.currentTarget, submitter);\n formDataContexts.set(nextFormData, {\n form: event.currentTarget,\n submitter,\n });\n void submitAsync(nextFormData as never).catch(() => {});\n };\n\n return createElement(\"form\", {\n ...props,\n action: nativeAction as FormHTMLAttributes<HTMLFormElement>[\"action\"],\n method: functionAction ? undefined : nativeMethod,\n encType: functionAction ? undefined : encType,\n onSubmit: handleSubmit,\n });\n };\n\n FetcherForm.displayName = \"FetcherForm\";\n return FetcherForm;\n }, [submitAsync]);\n\n const reset = useCallback(() => {\n submissionIdRef.current += 1;\n setFormData(null);\n mutation.reset();\n }, [mutation.reset]);\n\n return useMemo(\n () => ({\n state: mutation.pending ? \"submitting\" : \"idle\",\n status: mutation.status,\n pending: mutation.pending,\n data: mutation.data,\n error: mutation.error,\n variables: mutation.variables,\n formData,\n submit,\n submitAsync,\n Form,\n reset,\n }),\n [\n Form,\n formData,\n mutation.data,\n mutation.error,\n mutation.pending,\n mutation.status,\n mutation.variables,\n reset,\n submit,\n submitAsync,\n ],\n );\n}\n\nfunction mapFetcherFormData<TTarget extends AnyMutationTarget>(\n target: TTarget,\n formData: FormData,\n options: UseFetcherOptions<TTarget>,\n): InferMutationVariables<TTarget> | FormData {\n const context = formDataContexts.get(formData) ?? { form: null, submitter: null };\n if (options.mapFormData) {\n return options.mapFormData(formData, context);\n }\n if (!isAPIRouteRef(target)) {\n return formData;\n }\n\n const values = formDataToObject(formData);\n const method = getAPIRouteRefMetadata(target)?.method;\n return (\n method === \"GET\" || method === \"HEAD\" ? { query: values } : { body: values }\n ) as InferMutationVariables<TTarget>;\n}\n\nfunction resolveFetcherFormAction(\n target: AnyMutationTarget,\n metadata: ReturnType<typeof getAPIRouteRefMetadata>,\n): string | AnyMutationTarget | undefined {\n if (!metadata) return isProgressiveFormAction(target) ? target : undefined;\n if (metadata.sameOrigin) return metadata.path;\n\n return new URL(metadata.path, metadata.baseURL).href;\n}\n\nfunction formDataToObject(\n formData: FormData,\n): Record<string, FormDataEntryValue | FormDataEntryValue[]> {\n const output: Record<string, FormDataEntryValue | FormDataEntryValue[]> = Object.create(null);\n for (const [key, value] of formData.entries()) {\n if (key === \"__proto__\" || key === \"constructor\" || key === \"prototype\") continue;\n const current = output[key];\n if (current === undefined) {\n output[key] = value;\n } else if (Array.isArray(current)) {\n current.push(value);\n } else {\n output[key] = [current, value];\n }\n }\n return output;\n}\n\nfunction createSubmitterFormData(form: HTMLFormElement, submitter: HTMLElement | null): FormData {\n try {\n return new FormData(form, submitter as HTMLElement | undefined);\n } catch {\n const formData = new FormData(form);\n const candidate = submitter as\n | (HTMLElement & { disabled?: boolean; name?: string; value?: string })\n | null;\n if (candidate && !candidate.disabled && candidate.name) {\n formData.append(candidate.name, candidate.value ?? \"\");\n }\n return formData;\n }\n}\n\nfunction getSubmitter(event: FormEvent<HTMLFormElement>): HTMLElement | null {\n const nativeEvent = event.nativeEvent as SubmitEvent;\n return nativeEvent.submitter instanceof HTMLElement ? nativeEvent.submitter : null;\n}\n\nfunction isProgressiveFormAction(target: AnyMutationTarget): boolean {\n const candidate = target as AnyMutationTarget & {\n __farmServerFn?: unknown;\n $$FORM_ACTION?: unknown;\n $$typeof?: unknown;\n };\n return (\n candidate.__farmServerFn === true ||\n typeof candidate.$$FORM_ACTION === \"function\" ||\n candidate.$$typeof === Symbol.for(\"react.server.reference\")\n );\n}\n\nfunction isFormData(value: unknown): value is FormData {\n if (!value || typeof value !== \"object\") return false;\n return (\n (typeof FormData !== \"undefined\" && value instanceof FormData) ||\n (Object.prototype.toString.call(value) === \"[object FormData]\" &&\n typeof (value as { entries?: unknown }).entries === \"function\")\n );\n}\n","import { useSyncExternalStore } from \"react\";\n\nexport type StoreState = Record<string, any>;\nexport type StoreValueUpdater<T> = T | ((previous: T) => T);\nexport type StorePatch<T extends StoreState> = Partial<T> | ((state: T) => Partial<T>);\nexport type StoreListener<T extends StoreState> = (state: T, previousState: T) => void;\nexport type StoreKeyListener<T extends StoreState, K extends keyof T> = (\n value: T[K],\n previousValue: T[K],\n) => void;\nexport type StoreKeysListener<T extends StoreState, K extends keyof T> = (\n value: Pick<T, K>,\n previousValue: Pick<T, K>,\n) => void;\n\ntype StoreSubscription<T extends StoreState> = {\n keys: readonly (keyof T)[] | null;\n notify: (state: T, previousState: T) => void;\n};\n\ntype ReservedStoreKey = \"use\" | \"get\" | \"set\" | \"replace\" | \"reset\" | \"subscribe\";\n\ntype FieldAccessor<T extends StoreState, K extends keyof T> = {\n (): T[K];\n get(): T[K];\n set(value: StoreValueUpdater<T[K]>): T[K];\n subscribe(listener: StoreKeyListener<T, K>): () => void;\n};\n\nexport type StoreFields<T extends StoreState> = {\n [K in keyof T]: FieldAccessor<T, K>;\n};\n\nexport interface StoreApi<T extends StoreState> {\n use(): T;\n use<K extends keyof T>(key: K): T[K];\n use<K extends keyof T>(keys: readonly K[]): Pick<T, K>;\n get(): T;\n get<K extends keyof T>(key: K): T[K];\n set<K extends keyof T>(key: K, value: StoreValueUpdater<T[K]>): T[K];\n set(patch: StorePatch<T>): T;\n replace(nextState: T | ((state: T) => T)): T;\n reset(): T;\n subscribe(listener: StoreListener<T>): () => void;\n subscribe<K extends keyof T>(key: K, listener: StoreKeyListener<T, K>): () => void;\n subscribe<K extends keyof T>(keys: readonly K[], listener: StoreKeysListener<T, K>): () => void;\n}\n\nexport type Store<T extends StoreState, TMethods extends Record<string, any> = {}> = StoreApi<T> &\n StoreFields<T> &\n TMethods;\n\nconst RESERVED_STORE_KEYS = new Set<ReservedStoreKey>([\n \"use\",\n \"get\",\n \"set\",\n \"replace\",\n \"reset\",\n \"subscribe\",\n]);\n\nfunction cloneState<T extends StoreState>(state: T): T {\n return { ...state };\n}\n\nfunction pickState<T extends StoreState, K extends keyof T>(\n state: T,\n keys: readonly K[],\n): Pick<T, K> {\n const slice = {} as Pick<T, K>;\n\n for (const key of keys) {\n slice[key] = state[key];\n }\n\n return slice;\n}\n\nfunction getChangedKeys<T extends StoreState>(state: T, previousState: T): (keyof T)[] {\n const keys = new Set<keyof T>([\n ...(Object.keys(state) as (keyof T)[]),\n ...(Object.keys(previousState) as (keyof T)[]),\n ]);\n\n return [...keys].filter((key) => !Object.is(state[key], previousState[key]));\n}\n\nfunction normalizeKeys<T extends StoreState, K extends keyof T>(keys: readonly K[]): readonly K[] {\n return Array.from(new Set(keys));\n}\n\nfunction resolveValue<T>(value: StoreValueUpdater<T>, previousValue: T): T {\n return typeof value === \"function\" ? (value as (previousValue: T) => T)(previousValue) : value;\n}\n\nfunction isStoreKey(value: unknown): value is string | number | symbol {\n return typeof value === \"string\" || typeof value === \"number\" || typeof value === \"symbol\";\n}\n\nexport function createStore<T extends StoreState, TMethods extends Record<string, any> = {}>(\n initialState: T,\n extend?: (store: Store<T>) => TMethods,\n): Store<T, TMethods> {\n const initialSnapshot = cloneState(initialState);\n let state = cloneState(initialState);\n const subscriptions = new Set<StoreSubscription<T>>();\n\n const addSubscription = (\n keys: readonly (keyof T)[] | null,\n notify: (state: T, previousState: T) => void,\n ) => {\n const subscription: StoreSubscription<T> = { keys, notify };\n subscriptions.add(subscription);\n return () => {\n subscriptions.delete(subscription);\n };\n };\n\n const emit = (nextState: T, previousState: T) => {\n const changedKeys = getChangedKeys(nextState, previousState);\n\n if (changedKeys.length === 0) {\n return;\n }\n\n const changedKeySet = new Set(changedKeys);\n\n for (const subscription of subscriptions) {\n if (subscription.keys === null || subscription.keys.some((key) => changedKeySet.has(key))) {\n subscription.notify(nextState, previousState);\n }\n }\n };\n\n const getState = (key?: keyof T) => {\n return key === undefined ? state : state[key];\n };\n\n const replaceState = (nextState: T | ((state: T) => T)) => {\n const previousState = state;\n const resolvedState =\n typeof nextState === \"function\" ? (nextState as (state: T) => T)(previousState) : nextState;\n state = resolvedState;\n emit(state, previousState);\n return state;\n };\n\n const setState = (keyOrPatch: keyof T | StorePatch<T>, value?: StoreValueUpdater<T[keyof T]>) => {\n const previousState = state;\n let nextState: T;\n\n if (isStoreKey(keyOrPatch)) {\n const key = keyOrPatch as keyof T;\n const nextValue = resolveValue(value as StoreValueUpdater<T[keyof T]>, previousState[key]);\n\n if (Object.is(previousState[key], nextValue)) {\n return nextValue;\n }\n\n nextState = {\n ...previousState,\n [key]: nextValue,\n };\n state = nextState;\n emit(nextState, previousState);\n return nextValue;\n }\n\n const patch: Partial<T> =\n typeof keyOrPatch === \"function\"\n ? (keyOrPatch as (state: T) => Partial<T>)(previousState)\n : (keyOrPatch as Partial<T>);\n\n nextState = {\n ...previousState,\n ...patch,\n };\n state = nextState;\n emit(nextState, previousState);\n return nextState;\n };\n\n const subscribeState = (\n keyOrListener: keyof T | readonly (keyof T)[] | StoreListener<T>,\n listener?: StoreKeyListener<T, keyof T> | StoreKeysListener<T, keyof T>,\n ) => {\n if (typeof keyOrListener === \"function\") {\n return addSubscription(null, (nextState, previousState) => {\n (keyOrListener as StoreListener<T>)(nextState, previousState);\n });\n }\n\n if (Array.isArray(keyOrListener)) {\n const keys = normalizeKeys(keyOrListener);\n return addSubscription(keys, (nextState, previousState) => {\n (listener as StoreKeysListener<T, keyof T>)(\n pickState(nextState, keys),\n pickState(previousState, keys),\n );\n });\n }\n\n const key = keyOrListener as keyof T;\n return addSubscription([key], (nextState, previousState) => {\n (listener as StoreKeyListener<T, keyof T>)(nextState[key], previousState[key]);\n });\n };\n\n const useStateValue = <K extends keyof T>(keyOrKeys?: K | readonly K[]) => {\n if (Array.isArray(keyOrKeys)) {\n const keys = normalizeKeys(keyOrKeys);\n let lastState = state;\n let lastSlice = pickState(state, keys);\n const getSnapshot = () => {\n if (lastState !== state) {\n lastState = state;\n lastSlice = pickState(state, keys);\n }\n\n return lastSlice;\n };\n\n return useSyncExternalStore(\n (notify) => addSubscription(keys, () => notify()),\n getSnapshot,\n getSnapshot,\n );\n }\n\n if (typeof keyOrKeys === \"string\") {\n return useSyncExternalStore(\n (notify) => addSubscription([keyOrKeys], () => notify()),\n () => state[keyOrKeys],\n () => state[keyOrKeys],\n );\n }\n\n return useSyncExternalStore(\n (notify) => addSubscription(null, () => notify()),\n () => state,\n () => state,\n );\n };\n\n const store = {\n use: useStateValue,\n get: getState,\n set: setState,\n replace: replaceState,\n reset: () => replaceState(cloneState(initialSnapshot)),\n subscribe: subscribeState,\n } as Store<T>;\n\n for (const key of Object.keys(initialSnapshot) as (keyof T)[]) {\n if (RESERVED_STORE_KEYS.has(key as ReservedStoreKey)) {\n throw new Error(\n `createStore does not allow the reserved key \"${String(key)}\" in the initial state.`,\n );\n }\n\n const field = (() => useStateValue(key)) as FieldAccessor<T, typeof key>;\n field.get = () => state[key];\n field.set = (value) => setState(key, value) as T[typeof key];\n field.subscribe = (listener) => subscribeState(key, listener as StoreKeyListener<T, keyof T>);\n\n Object.defineProperty(store, key, {\n configurable: false,\n enumerable: true,\n value: field,\n writable: false,\n });\n }\n\n if (extend) {\n const methods = extend(store);\n\n for (const [name, method] of Object.entries(methods)) {\n if (name in store) {\n throw new Error(\n `createStore cannot attach the method \"${name}\" because it already exists.`,\n );\n }\n\n Object.defineProperty(store, name, {\n configurable: false,\n enumerable: true,\n value: method,\n writable: false,\n });\n }\n }\n\n return store as Store<T, TMethods>;\n}\n","\"use client\";\n\nimport type React from \"react\";\nimport { forwardRef, useEffect, useRef, useCallback, type AnchorHTMLAttributes } from \"react\";\nimport {\n buildFarmRoutePath,\n type FarmRouterBuildOptions,\n type FarmRouterPathParam,\n type FarmRouterPathParams,\n} from \"../router\";\nimport type { FarmViewTransitionMode } from \"./spa-router\";\nimport { isFarmLocaleChangeHref, localizeActiveFarmHref } from \"../i18n/client-runtime\";\nimport type { FarmI18nLocale } from \"../i18n/types\";\n\n/**\n * Prefetch strategy (TanStack Router–style):\n * - \"intent\": prefetch on hover and touchstart (with prefetchDelay)\n * - \"viewport\": prefetch when link enters viewport (IntersectionObserver)\n * - \"render\": prefetch as soon as the link is mounted\n * - \"none\" | false: no prefetch\n */\nexport type PrefetchBehavior = false | \"intent\" | \"viewport\" | \"render\" | \"none\";\n\n/** @internal Legacy prefetch mode for backward compatibility */\ntype PrefetchLegacy = boolean | \"hover\" | \"viewport\" | \"none\";\n\n/**\n * Augment this interface via the generated farm.d.ts so Link href is typed\n * without passing a generic. Defaults to string when not augmented.\n */\nexport interface LinkDefaultRoute {}\n\nexport type DefaultRoutePath = LinkDefaultRoute extends { _: infer TRoute extends string }\n ? TRoute\n : string;\n\nexport type DefaultRoutePattern = LinkDefaultRoute extends {\n pattern: infer TRoute extends string;\n}\n ? TRoute\n : DefaultRoutePath;\n\nexport type DefaultRouteHref = DefaultRoutePath | DefaultRoutePattern;\n\nexport type RouteHref<TRoute extends string> =\n | TRoute\n | `${TRoute}?${string}`\n | `${TRoute}#${string}`\n | `${TRoute}?${string}#${string}`;\n\n/** A generated route with params already filled into its pathname. */\nexport type ResolvedRouteHref = RouteHref<DefaultRoutePath>;\n\nexport type RouteParamValue = Exclude<FarmRouterPathParam, null | undefined>;\nexport type RouteOptionalParamValue = FarmRouterPathParam;\nexport type RouteParams<TRoute extends string> = string extends TRoute\n ? FarmRouterPathParams\n : ExtractRouteParams<StripRouteSuffix<TRoute>>;\n\n/** External URLs; these are never type-checked as routes. */\nexport type ExternalHref =\n | `http://${string}`\n | `https://${string}`\n | `//${string}`\n | `mailto:${string}`;\n\ntype StripRouteSuffix<TRoute extends string> = TRoute extends `${infer Path}?${string}`\n ? StripRouteSuffix<Path>\n : TRoute extends `${infer Path}#${string}`\n ? StripRouteSuffix<Path>\n : TRoute;\n\ntype ExtractRouteParams<TRoute extends string> = Simplify<\n ExtractOptionalCatchAllParams<TRoute> &\n ExtractCatchAllParams<TRoute> &\n ExtractDynamicParams<TRoute>\n>;\n\ntype ExtractOptionalCatchAllParams<TRoute extends string> =\n TRoute extends `${string}[[...${infer Param}]]${infer Rest}`\n ? { [Key in Param]?: RouteOptionalParamValue } & ExtractOptionalCatchAllParams<Rest>\n : {};\n\ntype ExtractCatchAllParams<TRoute extends string> =\n TRoute extends `${string}[...${infer Param}]${infer Rest}`\n ? Param extends `[...${string}`\n ? ExtractCatchAllParams<Rest>\n : { [Key in Param]: RouteParamValue } & ExtractCatchAllParams<Rest>\n : {};\n\ntype ExtractDynamicParams<TRoute extends string> =\n TRoute extends `${string}[${infer Param}]${infer Rest}`\n ? Param extends `...${string}` | `[...${string}`\n ? ExtractDynamicParams<Rest>\n : { [Key in Param]: RouteParamValue } & ExtractDynamicParams<Rest>\n : {};\n\ntype Simplify<T> = { [Key in keyof T]: T[Key] } & {};\n\ntype HasRouteParams<TRoute extends string> = keyof RouteParams<TRoute> extends never ? false : true;\n\ntype RoutesWithRequiredParams<TRoute extends string> = TRoute extends string\n ? HasRouteParams<TRoute> extends true\n ? TRoute\n : never\n : never;\n\ntype LinkRouteParamsProps<TRoute extends string> = string extends TRoute\n ? { params?: FarmRouterPathParams }\n : HasRouteParams<TRoute> extends true\n ? { params: RouteParams<TRoute> }\n : { params?: FarmRouterPathParams };\n\ntype LinkRouteTargetProps<TRoute extends string> = [RoutesWithRequiredParams<TRoute>] extends [\n never,\n]\n ? {\n /** Internal route path with all params already resolved. */\n href: RouteHref<TRoute>;\n params?: FarmRouterPathParams;\n }\n : TRoute extends string\n ? {\n /** Internal route path or route pattern. */\n href: RouteHref<TRoute>;\n } & LinkRouteParamsProps<TRoute>\n : never;\n\ntype LinkExternalTargetProps = {\n /** External URL; these are never type-checked as app routes. */\n href: ExternalHref;\n params?: never;\n};\n\ntype LinkTargetProps<TRoute extends string> =\n | LinkExternalTargetProps\n | LinkRouteTargetProps<TRoute>;\n\nexport type LinkProps<TRoute extends string = DefaultRouteHref> = Omit<\n AnchorHTMLAttributes<HTMLAnchorElement>,\n \"href\"\n> &\n LinkTargetProps<TRoute> & {\n /**\n * When to prefetch. TanStack-style: \"intent\" (hover+touch), \"viewport\", \"render\", or \"none\".\n * Legacy: true (intent+viewport), \"hover\" (intent), \"viewport\", false/\"none\".\n */\n prefetch?: PrefetchBehavior | PrefetchLegacy;\n /** Search params appended after route params are resolved. */\n query?: FarmRouterBuildOptions[\"query\"];\n /** Hash appended after route params and search params are resolved. */\n hash?: string;\n /** Add a trailing slash to the generated internal href. */\n trailingSlash?: boolean;\n /** Delay in ms before intent-based prefetch (hover/touch). Default 50. */\n prefetchDelay?: number;\n /** Replace current history entry instead of pushing */\n replace?: boolean;\n /** Scroll to top after navigation (default: true) */\n scroll?: boolean;\n /** Wrap this SPA navigation in a browser View Transition when supported. */\n viewTransition?: FarmViewTransitionMode;\n /** Preserve the active locale by default, or navigate using this locale. */\n locale?: FarmI18nLocale;\n };\n\nfunction isModifierEvent(e: React.MouseEvent): boolean {\n return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);\n}\n\nfunction isExternalUrl(href: string): boolean {\n return href.startsWith(\"http://\") || href.startsWith(\"https://\") || href.startsWith(\"//\");\n}\n\nfunction getRouter(): {\n prefetch(href: string): Promise<void>;\n observeForPrefetch(el: HTMLAnchorElement): void;\n unobserveForPrefetch(el: HTMLAnchorElement): void;\n navigate(\n href: string,\n opts: { replace?: boolean; scroll?: boolean; viewTransition?: FarmViewTransitionMode },\n ): void;\n} | null {\n if (typeof window !== \"undefined\" && (window as any).__FARM_SPA_ROUTER__) {\n return (window as any).__FARM_SPA_ROUTER__;\n }\n return null;\n}\n\nfunction normalizePrefetch(prefetch: LinkProps[\"prefetch\"]): {\n intent: boolean;\n viewport: boolean;\n render: boolean;\n} {\n if (prefetch === false || prefetch === \"none\") {\n return { intent: false, viewport: false, render: false };\n }\n if (prefetch === true) {\n return { intent: true, viewport: true, render: false };\n }\n if (prefetch === \"hover\") {\n return { intent: true, viewport: false, render: false };\n }\n if (prefetch === \"intent\") {\n return { intent: true, viewport: false, render: false };\n }\n if (prefetch === \"viewport\") {\n return { intent: false, viewport: true, render: false };\n }\n if (prefetch === \"render\") {\n return { intent: false, viewport: false, render: true };\n }\n return { intent: false, viewport: false, render: false };\n}\n\nfunction LinkInner<TRoute extends string = DefaultRouteHref>(\n {\n href,\n params,\n query,\n hash,\n trailingSlash,\n prefetch = true,\n prefetchDelay = 50,\n replace = false,\n scroll = true,\n viewTransition = false,\n locale,\n onClick,\n target,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n onTouchStart,\n ...props\n }: LinkProps<TRoute>,\n ref: React.ForwardedRef<HTMLAnchorElement>,\n) {\n const elementRef = useRef<HTMLAnchorElement | null>(null);\n const intentTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const hasPrefetched = useRef(false);\n\n const { intent, viewport, render } = normalizePrefetch(prefetch);\n const baseHref = resolveLinkHref(href, params, {\n query,\n hash,\n trailingSlash,\n });\n const resolvedHref = localizeActiveFarmHref(baseHref, locale);\n const isExternal = isExternalUrl(resolvedHref);\n\n const doPrefetch = useCallback(() => {\n if (isExternal || hasPrefetched.current) return;\n const router = getRouter();\n if (!router) return;\n hasPrefetched.current = true;\n router.prefetch(resolvedHref);\n }, [resolvedHref, isExternal]);\n\n useEffect(() => {\n hasPrefetched.current = false;\n }, [resolvedHref]);\n\n useEffect(() => {\n const element = elementRef.current;\n if (!element || isExternal) return;\n\n const router = getRouter();\n if (!router) return;\n\n if (viewport) {\n router.observeForPrefetch(element);\n return () => router.unobserveForPrefetch(element);\n }\n }, [resolvedHref, viewport, isExternal]);\n\n useEffect(() => {\n if (!render || isExternal) return;\n\n let cancelled = false;\n let timeoutId: ReturnType<typeof setTimeout> | null = null;\n\n const tryRenderPrefetch = () => {\n if (cancelled || hasPrefetched.current) return;\n\n const router = getRouter();\n if (!router) {\n timeoutId = setTimeout(tryRenderPrefetch, 30);\n return;\n }\n\n hasPrefetched.current = true;\n router.prefetch(resolvedHref);\n };\n\n tryRenderPrefetch();\n\n return () => {\n cancelled = true;\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n }, [render, isExternal, resolvedHref]);\n\n useEffect(() => {\n return () => {\n if (intentTimeoutRef.current) {\n clearTimeout(intentTimeoutRef.current);\n intentTimeoutRef.current = null;\n }\n };\n }, []);\n\n const cancelIntent = useCallback(() => {\n if (intentTimeoutRef.current) {\n clearTimeout(intentTimeoutRef.current);\n intentTimeoutRef.current = null;\n }\n }, []);\n\n const scheduleIntentPrefetch = useCallback(() => {\n if (isExternal || !intent || hasPrefetched.current) return;\n cancelIntent();\n intentTimeoutRef.current = setTimeout(() => {\n intentTimeoutRef.current = null;\n doPrefetch();\n }, prefetchDelay);\n }, [intent, isExternal, prefetchDelay, doPrefetch, cancelIntent]);\n\n const handleMouseEnter = useCallback(\n (event: React.MouseEvent<HTMLAnchorElement>) => {\n onMouseEnter?.(event);\n scheduleIntentPrefetch();\n },\n [onMouseEnter, scheduleIntentPrefetch],\n );\n\n const handleMouseLeave = useCallback(\n (event: React.MouseEvent<HTMLAnchorElement>) => {\n onMouseLeave?.(event);\n cancelIntent();\n },\n [onMouseLeave, cancelIntent],\n );\n\n const handleTouchStart = useCallback(\n (event: React.TouchEvent<HTMLAnchorElement>) => {\n onTouchStart?.(event);\n scheduleIntentPrefetch();\n },\n [onTouchStart, scheduleIntentPrefetch],\n );\n\n const handleFocus = useCallback(\n (event: React.FocusEvent<HTMLAnchorElement>) => {\n onFocus?.(event);\n scheduleIntentPrefetch();\n },\n [onFocus, scheduleIntentPrefetch],\n );\n\n const handleBlur = useCallback(\n (event: React.FocusEvent<HTMLAnchorElement>) => {\n onBlur?.(event);\n cancelIntent();\n },\n [onBlur, cancelIntent],\n );\n\n const handleClick = useCallback(\n (event: React.MouseEvent<HTMLAnchorElement>) => {\n onClick?.(event);\n if (event.defaultPrevented) return;\n if (isExternal) return;\n if (target && target !== \"_self\") return;\n if (isModifierEvent(event)) return;\n if (event.button !== 0) return;\n\n if (typeof window !== \"undefined\") {\n event.preventDefault();\n if (isFarmLocaleChangeHref(resolvedHref)) {\n window.location.assign(resolvedHref);\n return;\n }\n const router = getRouter();\n if (router) {\n router.navigate(resolvedHref, { replace, scroll, viewTransition });\n } else {\n if (replace) window.location.replace(resolvedHref);\n else window.location.href = resolvedHref;\n }\n }\n },\n [resolvedHref, replace, scroll, viewTransition, target, isExternal, onClick],\n );\n\n const setRefs = useCallback(\n (node: HTMLAnchorElement | null) => {\n elementRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLAnchorElement | null>).current = node;\n },\n [ref],\n );\n\n return (\n <a\n ref={setRefs}\n href={resolvedHref}\n target={target}\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onTouchStart={handleTouchStart}\n {...props}\n data-farm-link=\"\"\n data-replace={replace ? \"\" : undefined}\n data-no-scroll={!scroll ? \"\" : undefined}\n data-view-transition={\n viewTransition === \"auto\" ? \"auto\" : viewTransition ? \"true\" : undefined\n }\n />\n );\n}\n\nconst LinkWithRef = forwardRef(LinkInner);\nLinkWithRef.displayName = \"Link\";\n\ntype LinkComponentType = <TRoute extends string = DefaultRouteHref>(\n props: LinkProps<TRoute> & { ref?: React.ForwardedRef<HTMLAnchorElement> },\n) => React.ReactElement;\n\nexport const Link = LinkWithRef as unknown as LinkComponentType;\n\nfunction resolveLinkHref(\n href: string,\n params: FarmRouterPathParams | undefined,\n options: FarmRouterBuildOptions,\n) {\n if (isExternalUrl(href)) return href;\n\n const { pathname, query, hash } = splitInternalHref(href);\n\n const resolvedHref = buildFarmRoutePath(pathname, params, {\n query: mergeQueryParams(query, options.query),\n hash: options.hash ?? hash,\n trailingSlash: options.trailingSlash,\n });\n\n return applyPreservedSearchParams(resolvedHref);\n}\n\nfunction splitInternalHref(href: string) {\n try {\n const url = new URL(href, \"http://farm.local\");\n return {\n pathname: url.pathname || \"/\",\n query: url.searchParams,\n hash: url.hash ? url.hash.slice(1) : undefined,\n };\n } catch {\n const [withoutHash, rawHash] = href.split(\"#\", 2);\n const [pathname, rawQuery] = withoutHash.split(\"?\", 2);\n return {\n pathname: pathname || \"/\",\n query: new URLSearchParams(rawQuery || \"\"),\n hash: rawHash,\n };\n }\n}\n\nfunction mergeQueryParams(\n current: URLSearchParams,\n next: FarmRouterBuildOptions[\"query\"],\n): URLSearchParams | undefined {\n const merged = new URLSearchParams(current);\n\n if (next instanceof URLSearchParams) {\n for (const [key, value] of next.entries()) {\n merged.append(key, value);\n }\n } else if (next) {\n for (const [key, value] of Object.entries(next)) {\n const values = Array.isArray(value) ? value : [value];\n for (const item of values) {\n if (item == null) continue;\n merged.append(key, String(item));\n }\n }\n }\n\n return merged.toString() ? merged : undefined;\n}\n\nfunction applyPreservedSearchParams(href: string): string {\n if (typeof window === \"undefined\") return href;\n\n const manifest = (window as any).__FARM_MANIFEST__;\n const routes =\n manifest?.routes && typeof manifest.routes === \"object\" ? Object.values(manifest.routes) : [];\n if (routes.length === 0) return href;\n\n const url = new URL(href, window.location.origin);\n const route = routes.find((candidate: any) => matchManifestRoute(url.pathname, candidate));\n const preserve = Array.isArray((route as any)?.search?.preserve)\n ? ((route as any).search.preserve as string[])\n : [];\n if (preserve.length === 0) return href;\n\n const current = new URLSearchParams(window.location.search);\n let changed = false;\n\n for (const key of preserve) {\n if (url.searchParams.has(key) || !current.has(key)) continue;\n for (const value of current.getAll(key)) {\n url.searchParams.append(key, value);\n changed = true;\n }\n }\n\n if (!changed) return href;\n return `${url.pathname}${url.search}${url.hash}`;\n}\n\nfunction matchManifestRoute(pathname: string, route: any): boolean {\n if (!route || !Array.isArray(route.segments)) return false;\n const routeSegments = route.segments;\n const normalized = pathname === \"/\" ? \"\" : pathname.replace(/^\\/+/, \"\").replace(/\\/+$/, \"\");\n const pathSegments = normalized ? normalized.split(\"/\") : [];\n const hasCatchAll = routeSegments.some((segment: any) => segment.isCatchAll);\n\n if (!hasCatchAll && pathSegments.length !== routeSegments.length) {\n return false;\n }\n\n for (let index = 0; index < routeSegments.length; index++) {\n const routeSegment = routeSegments[index];\n const pathSegment = pathSegments[index];\n\n if (routeSegment.isCatchAll) {\n return true;\n }\n\n if (pathSegment === undefined) {\n if (routeSegment.isOptional) continue;\n return false;\n }\n\n if (!routeSegment.isDynamic && routeSegment.segment !== pathSegment) {\n return false;\n }\n }\n\n return pathSegments.length === routeSegments.length || hasCatchAll;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAEA,SAAS,aAAa,SAAS,QAAQ,gBAAgB;AAwFhD,SAAS,YACd,QACA,UAII,CAAC,GACuB;AAK5B,QAAM,cAAc,QAAQ,eAAe;AAC3C,QAAM,aAAa,OAAO,OAAO;AACjC,QAAM,YAAY,OAAO,MAAM;AAC/B,QAAM,eAAe,OAAO,CA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QAAQ,EAAG,QAAO;AACrD,QAAM,gBAAgB,MAAM;AAC5B,QAAM,aAAa,aAAa,MAAM,KAAK,SAAS,QAAQ,QAAQ,EAAE,EAAE,QAAQ,QAAQ,EAAE;AAC1F,QAAM,eAAe,aAAa,WAAW,MAAM,GAAG,IAAI,CAAC;AAC3D,QAAM,cAAc,cAAc,KAAK,CAAC,YAAiB,QAAQ,UAAU;AAE3E,MAAI,CAAC,eAAe,aAAa,WAAW,cAAc,QAAQ;AAChE,WAAO;AAAA,EACT;AAEA,WAAS,QAAQ,GAAG,QAAQ,cAAc,QAAQ,SAAS;AACzD,UAAM,eAAe,cAAc,KAAK;AACxC,UAAM,cAAc,aAAa,KAAK;AAEtC,QAAI,aAAa,YAAY;AAC3B,aAAO;AAAA,IACT;AAEA,QAAI,gBAAgB,QAAW;AAC7B,UAAI,aAAa,WAAY;AAC7B,aAAO;AAAA,IACT;AAEA,QAAI,CAAC,aAAa,aAAa,aAAa,YAAY,aAAa;AACnE,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO,aAAa,WAAW,cAAc,UAAU;AACzD;AA9BS;","names":["useCallback","useMemo","useRef","useState","useRef","useState","useCallback","useMemo","replaceState","useRef","useCallback","prefetch","useRef","useCallback"]}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
requestAcceptsMarkdown
|
|
3
|
+
} from "./chunk-7FBJLMQH.mjs";
|
|
1
4
|
import {
|
|
2
5
|
__name
|
|
3
6
|
} from "./chunk-CGILA3WO.mjs";
|
|
@@ -145,7 +148,8 @@ async function createFarmMarkdownSourceResponse(options) {
|
|
|
145
148
|
return null;
|
|
146
149
|
}
|
|
147
150
|
const url = new URL(options.request.url);
|
|
148
|
-
|
|
151
|
+
const hasMarkdownExtension = url.pathname.toLowerCase().endsWith(".md");
|
|
152
|
+
if (!hasMarkdownExtension && !requestAcceptsMarkdown(options.request.headers.get("accept"))) {
|
|
149
153
|
return null;
|
|
150
154
|
}
|
|
151
155
|
const targetPathname = normalizeFarmMarkdownRoutePath(url.pathname);
|
|
@@ -153,14 +157,19 @@ async function createFarmMarkdownSourceResponse(options) {
|
|
|
153
157
|
if (!source) {
|
|
154
158
|
return null;
|
|
155
159
|
}
|
|
160
|
+
const headers = new Headers({
|
|
161
|
+
"Content-Type": "text/markdown; charset=utf-8",
|
|
162
|
+
"Content-Location": targetPathname === "/" ? "/index.md" : `${targetPathname}.md`,
|
|
163
|
+
"Cache-Control": "public, s-maxage=60, stale-while-revalidate=300",
|
|
164
|
+
"X-Farm-Markdown-Route": targetPathname,
|
|
165
|
+
"X-Farm-Markdown-Source": source.filePath
|
|
166
|
+
});
|
|
167
|
+
if (!hasMarkdownExtension) {
|
|
168
|
+
headers.set("Vary", "Accept");
|
|
169
|
+
}
|
|
156
170
|
return new Response(options.request.method === "HEAD" ? null : source.source, {
|
|
157
171
|
status: 200,
|
|
158
|
-
headers
|
|
159
|
-
"Content-Type": "text/markdown; charset=utf-8",
|
|
160
|
-
"Cache-Control": "public, s-maxage=60, stale-while-revalidate=300",
|
|
161
|
-
"X-Farm-Markdown-Route": targetPathname,
|
|
162
|
-
"X-Farm-Markdown-Source": source.filePath
|
|
163
|
-
}
|
|
172
|
+
headers
|
|
164
173
|
});
|
|
165
174
|
}
|
|
166
175
|
__name(createFarmMarkdownSourceResponse, "createFarmMarkdownSourceResponse");
|
|
@@ -177,4 +186,4 @@ export {
|
|
|
177
186
|
loadFarmMdxComponents,
|
|
178
187
|
createFarmMarkdownSourceResponse
|
|
179
188
|
};
|
|
180
|
-
//# sourceMappingURL=chunk-
|
|
189
|
+
//# sourceMappingURL=chunk-ZVWA4ZQ3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/app-markdown.ts"],"sourcesContent":["import React from \"react\";\nimport { readFile } from \"fs/promises\";\nimport path from \"path\";\nimport { pathToFileURL } from \"url\";\nimport type { Metadata, RouteModule } from \"./types\";\nimport { requestAcceptsMarkdown } from \"./markdown\";\n\nexport type FarmMdxComponent = React.ComponentType<any> | keyof React.JSX.IntrinsicElements;\nexport type FarmMdxComponents = Record<string, FarmMdxComponent>;\n\nexport interface FarmMdxUserConfig {\n /**\n * Component map or module path that exports `components` or a default component map.\n * Relative paths resolve from the project root.\n */\n components?: string | FarmMdxComponents;\n /**\n * Serve source-authored markdown pages at `/route.md`.\n * Enabled by default for `page.md` and `page.mdx`.\n */\n markdownRoutes?: boolean;\n /**\n * Class name used for the wrapper around rendered markdown content.\n */\n className?: string;\n}\n\nexport interface FarmMdxResolvedConfig {\n components?: string | FarmMdxComponents;\n markdownRoutes: boolean;\n className: string;\n}\n\nexport interface FarmMarkdownPageSource {\n source: string;\n filePath: string;\n}\n\nexport interface FarmMarkdownPageModuleInput extends FarmMarkdownPageSource {\n components?: FarmMdxComponents;\n config?: FarmMdxResolvedConfig;\n}\n\nexport function resolveMdxConfig(config: FarmMdxUserConfig | undefined): FarmMdxResolvedConfig {\n return {\n components: config?.components,\n markdownRoutes: config?.markdownRoutes ?? true,\n className: config?.className ?? \"farm-markdown\",\n };\n}\n\nexport function isFarmMarkdownPageFile(filePath: string): boolean {\n return /(^|[/\\\\])page\\.mdx?$/i.test(filePath);\n}\n\nexport function normalizeFarmMarkdownRoutePath(pathname: string): string {\n const withoutExtension = pathname.replace(/\\.md$/i, \"\");\n const normalized = withoutExtension.startsWith(\"/\") ? withoutExtension : `/${withoutExtension}`;\n return normalized === \"/index\" ? \"/\" : normalized.replace(/\\/+$/g, \"\") || \"/\";\n}\n\nexport function parseMarkdownFrontmatter(source: string): {\n frontmatter: Record<string, string>;\n body: string;\n} {\n if (!source.startsWith(\"---\")) {\n return { frontmatter: {}, body: source };\n }\n\n const endIndex = source.indexOf(\"\\n---\", 3);\n if (endIndex === -1) {\n return { frontmatter: {}, body: source };\n }\n\n const frontmatterSource = source.slice(3, endIndex).trim();\n const closingFenceEnd = endIndex + \"\\n---\".length;\n const bodyStart =\n source.slice(closingFenceEnd, closingFenceEnd + 2) === \"\\r\\n\"\n ? closingFenceEnd + 2\n : source[closingFenceEnd] === \"\\n\"\n ? closingFenceEnd + 1\n : closingFenceEnd;\n const body = source.slice(bodyStart);\n const frontmatter: Record<string, string> = {};\n\n for (const line of frontmatterSource.split(/\\r?\\n/)) {\n const separator = line.indexOf(\":\");\n if (separator === -1) continue;\n const key = line.slice(0, separator).trim();\n const value = line\n .slice(separator + 1)\n .trim()\n .replace(/^[\"']|[\"']$/g, \"\");\n if (key && value) frontmatter[key] = value;\n }\n\n return { frontmatter, body };\n}\n\nexport function titleFromMarkdown(body: string, fallback?: string): string | undefined {\n return body.match(/^#\\s+(.+)$/m)?.[1]?.trim() || fallback;\n}\n\nexport function createMarkdownMetadata(\n source: string,\n filePath: string,\n): (Metadata & Record<string, any>) | undefined {\n const { frontmatter, body } = parseMarkdownFrontmatter(source);\n const routeTitle = titleFromMarkdown(body);\n const title = frontmatter.title || routeTitle;\n const description = frontmatter.description;\n\n if (!title && !description) {\n return undefined;\n }\n\n return {\n ...(title ? { title } : {}),\n ...(description ? { description } : {}),\n source: filePath,\n };\n}\n\nasync function evaluateMdxSource(source: string, filePath: string) {\n const [{ evaluate }, runtime, remarkGfmModule] = await Promise.all([\n import(\"@mdx-js/mdx\"),\n import(\"react/jsx-runtime\"),\n import(\"remark-gfm\"),\n ]);\n const remarkGfm = remarkGfmModule.default;\n\n return evaluate(source, {\n ...runtime,\n baseUrl: pathToFileURL(filePath),\n remarkPlugins: [remarkGfm],\n });\n}\n\nexport function createFarmMarkdownRouteModule(\n input: FarmMarkdownPageModuleInput,\n): RouteModule & { source: string } {\n const { body } = parseMarkdownFrontmatter(input.source);\n const components = input.components || {};\n const className = input.config?.className || \"farm-markdown\";\n let evaluatedPromise: Promise<{ default: React.ComponentType<any> }> | undefined;\n\n const loadContent = async () => {\n evaluatedPromise ??= evaluateMdxSource(body, input.filePath) as Promise<{\n default: React.ComponentType<any>;\n }>;\n return evaluatedPromise;\n };\n\n async function FarmMarkdownPage(props: any) {\n const evaluated = await loadContent();\n const MDXContent = evaluated.default;\n return React.createElement(\n \"article\",\n { className, \"data-farm-markdown-page\": \"\" },\n React.createElement(MDXContent, {\n ...props,\n components: {\n ...components,\n ...props?.components,\n },\n }),\n );\n }\n\n return {\n default: FarmMarkdownPage as unknown as RouteModule[\"default\"],\n metadata: createMarkdownMetadata(input.source, input.filePath),\n source: input.source,\n };\n}\n\nexport async function createFarmMarkdownRouteModuleFromFile(\n filePath: string,\n options: {\n components?: FarmMdxComponents;\n config?: FarmMdxResolvedConfig;\n } = {},\n) {\n const source = await readFile(filePath, \"utf8\");\n return createFarmMarkdownRouteModule({\n source,\n filePath,\n components: options.components,\n config: options.config,\n });\n}\n\nexport async function loadFarmMdxComponents(\n config: FarmMdxResolvedConfig | undefined,\n options: {\n root: string;\n loadModule?: (modulePath: string) => Promise<unknown>;\n },\n): Promise<FarmMdxComponents> {\n const configured = config?.components;\n if (!configured) {\n return {};\n }\n\n if (typeof configured !== \"string\") {\n return configured;\n }\n\n const modulePath = path.isAbsolute(configured) ? configured : path.join(options.root, configured);\n const mod = options.loadModule\n ? await options.loadModule(modulePath)\n : await import(pathToFileURL(modulePath).href);\n const maybeModule = mod as {\n components?: FarmMdxComponents;\n default?: FarmMdxComponents;\n };\n\n return maybeModule.components || maybeModule.default || {};\n}\n\nexport async function createFarmMarkdownSourceResponse(options: {\n request: Request;\n config?: FarmMdxResolvedConfig;\n resolveSource: (\n pathname: string,\n ) => Promise<FarmMarkdownPageSource | null> | FarmMarkdownPageSource | null;\n}): Promise<Response | null> {\n if (options.request.method !== \"GET\" && options.request.method !== \"HEAD\") {\n return null;\n }\n if (options.config?.markdownRoutes === false) {\n return null;\n }\n\n const url = new URL(options.request.url);\n const hasMarkdownExtension = url.pathname.toLowerCase().endsWith(\".md\");\n if (!hasMarkdownExtension && !requestAcceptsMarkdown(options.request.headers.get(\"accept\"))) {\n return null;\n }\n\n const targetPathname = normalizeFarmMarkdownRoutePath(url.pathname);\n const source = await options.resolveSource(targetPathname);\n if (!source) {\n return null;\n }\n\n const headers = new Headers({\n \"Content-Type\": \"text/markdown; charset=utf-8\",\n \"Content-Location\": targetPathname === \"/\" ? \"/index.md\" : `${targetPathname}.md`,\n \"Cache-Control\": \"public, s-maxage=60, stale-while-revalidate=300\",\n \"X-Farm-Markdown-Route\": targetPathname,\n \"X-Farm-Markdown-Source\": source.filePath,\n });\n if (!hasMarkdownExtension) {\n headers.set(\"Vary\", \"Accept\");\n }\n\n return new Response(options.request.method === \"HEAD\" ? null : source.source, {\n status: 200,\n headers,\n });\n}\n"],"mappings":";;;;;;;;AAAA,OAAO,WAAW;AAClB,SAAS,gBAAgB;AACzB,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAwCvB,SAAS,iBAAiB,QAA8D;AAC7F,SAAO;AAAA,IACL,YAAY,QAAQ;AAAA,IACpB,gBAAgB,QAAQ,kBAAkB;AAAA,IAC1C,WAAW,QAAQ,aAAa;AAAA,EAClC;AACF;AANgB;AAQT,SAAS,uBAAuB,UAA2B;AAChE,SAAO,wBAAwB,KAAK,QAAQ;AAC9C;AAFgB;AAIT,SAAS,+BAA+B,UAA0B;AACvE,QAAM,mBAAmB,SAAS,QAAQ,UAAU,EAAE;AACtD,QAAM,aAAa,iBAAiB,WAAW,GAAG,IAAI,mBAAmB,IAAI,gBAAgB;AAC7F,SAAO,eAAe,WAAW,MAAM,WAAW,QAAQ,SAAS,EAAE,KAAK;AAC5E;AAJgB;AAMT,SAAS,yBAAyB,QAGvC;AACA,MAAI,CAAC,OAAO,WAAW,KAAK,GAAG;AAC7B,WAAO,EAAE,aAAa,CAAC,GAAG,MAAM,OAAO;AAAA,EACzC;AAEA,QAAM,WAAW,OAAO,QAAQ,SAAS,CAAC;AAC1C,MAAI,aAAa,IAAI;AACnB,WAAO,EAAE,aAAa,CAAC,GAAG,MAAM,OAAO;AAAA,EACzC;AAEA,QAAM,oBAAoB,OAAO,MAAM,GAAG,QAAQ,EAAE,KAAK;AACzD,QA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+14,7 @@ import { FarmCronUserConfig, FarmCronResolvedConfig } from './cron.mjs';
|
|
|
14
14
|
import { FarmEnvConfig, ResolvedFarmEnv } from './env.mjs';
|
|
15
15
|
import { FarmServerActionsConfig, ResolvedFarmServerActionsConfig } from './server-action-security.mjs';
|
|
16
16
|
import { F as FarmImageConfig, R as ResolvedFarmImageConfig } from './image-config-Duob7wER.mjs';
|
|
17
|
-
import { k as FarmI18nUserConfig, R as ResolvedFarmI18nConfig } from './types-
|
|
17
|
+
import { k as FarmI18nUserConfig, R as ResolvedFarmI18nConfig } from './types-BMxWr97v.mjs';
|
|
18
18
|
import { FarmCacheUserConfig } from './cache.mjs';
|
|
19
19
|
import { F as FarmRouteRuntimeConfig, a as FarmRouteRuntime, b as FarmRouteRegions, c as FarmRouteMaxDuration } from './route-runtime-DoOHzCAD.mjs';
|
|
20
20
|
|
|
@@ -399,6 +399,68 @@ interface ResolvedFarmDevtoolsConfig {
|
|
|
399
399
|
}
|
|
400
400
|
declare function resolveFarmDevtoolsConfig(config: FarmDevtoolsUserConfig | ResolvedFarmDevtoolsConfig | undefined, mode?: "development" | "production"): ResolvedFarmDevtoolsConfig;
|
|
401
401
|
|
|
402
|
+
interface FarmAuthEmailAndPasswordConfig {
|
|
403
|
+
/** Require a verified email before creating a session. @default false */
|
|
404
|
+
requireEmailVerification?: boolean;
|
|
405
|
+
/** Smallest accepted password length. @default 8 */
|
|
406
|
+
minPasswordLength?: number;
|
|
407
|
+
/** Largest accepted password length. @default 128 */
|
|
408
|
+
maxPasswordLength?: number;
|
|
409
|
+
}
|
|
410
|
+
interface FarmAuthSessionConfig {
|
|
411
|
+
/** Session lifetime in seconds. @default 604800 */
|
|
412
|
+
expiresIn?: number;
|
|
413
|
+
/** Session refresh interval in seconds. @default 86400 */
|
|
414
|
+
updateAge?: number;
|
|
415
|
+
}
|
|
416
|
+
interface FarmAuthDatabaseConfig {
|
|
417
|
+
/**
|
|
418
|
+
* Postgres connection string. Defaults to DATABASE_URL.
|
|
419
|
+
* Local development falls back to SQLite when no URL is present.
|
|
420
|
+
*/
|
|
421
|
+
url?: string;
|
|
422
|
+
/** Local SQLite path. @default ".farm/auth.sqlite" */
|
|
423
|
+
path?: string;
|
|
424
|
+
/** Automatically update the auth schema in development. @default true */
|
|
425
|
+
migrateInDevelopment?: boolean;
|
|
426
|
+
}
|
|
427
|
+
interface FarmAuthConfig {
|
|
428
|
+
/** Set false to disable auth without removing its configuration. @default true */
|
|
429
|
+
enabled?: boolean;
|
|
430
|
+
/** Display name used by authentication emails and metadata. */
|
|
431
|
+
appName?: string;
|
|
432
|
+
/** Route prefix for the auth endpoints. @default "/api/auth" */
|
|
433
|
+
basePath?: string;
|
|
434
|
+
/**
|
|
435
|
+
* Email/password authentication. It is enabled by default; set false to
|
|
436
|
+
* disable it when adding another sign-in method.
|
|
437
|
+
*/
|
|
438
|
+
emailAndPassword?: boolean | FarmAuthEmailAndPasswordConfig;
|
|
439
|
+
session?: FarmAuthSessionConfig;
|
|
440
|
+
database?: FarmAuthDatabaseConfig;
|
|
441
|
+
}
|
|
442
|
+
type FarmAuthUserConfig = boolean | FarmAuthConfig;
|
|
443
|
+
interface ResolvedFarmAuthConfig {
|
|
444
|
+
enabled: boolean;
|
|
445
|
+
appName?: string;
|
|
446
|
+
basePath: string;
|
|
447
|
+
emailAndPassword: {
|
|
448
|
+
enabled: boolean;
|
|
449
|
+
requireEmailVerification: boolean;
|
|
450
|
+
minPasswordLength: number;
|
|
451
|
+
maxPasswordLength: number;
|
|
452
|
+
};
|
|
453
|
+
session: {
|
|
454
|
+
expiresIn: number;
|
|
455
|
+
updateAge: number;
|
|
456
|
+
};
|
|
457
|
+
database: {
|
|
458
|
+
url?: string;
|
|
459
|
+
path: string;
|
|
460
|
+
migrateInDevelopment: boolean;
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
|
|
402
464
|
declare const FARM_RESOLVED_CUSTOM_CONTEXT: unique symbol;
|
|
403
465
|
|
|
404
466
|
interface RedirectConfig {
|
|
@@ -487,6 +549,12 @@ interface FarmUserConfig extends Omit<FarmConfig, "vite" | "docs" | "env" | "lay
|
|
|
487
549
|
extends?: readonly FarmLayerEntry[];
|
|
488
550
|
plugins?: FarmPlugin[];
|
|
489
551
|
integrations?: FarmIntegrationsUserConfig;
|
|
552
|
+
/**
|
|
553
|
+
* Farm-native authentication. `true` enables email/password auth with
|
|
554
|
+
* server helpers from `@farm.js/auth/server` and React APIs from
|
|
555
|
+
* `@farm.js/auth/client`.
|
|
556
|
+
*/
|
|
557
|
+
auth?: FarmAuthUserConfig;
|
|
490
558
|
/** Shared application data, route, ISR, and PPR cache. */
|
|
491
559
|
cache?: FarmCacheUserConfig;
|
|
492
560
|
migrations?: FarmMigrationsUserConfig;
|
|
@@ -532,7 +600,7 @@ interface FarmUserConfig extends Omit<FarmConfig, "vite" | "docs" | "env" | "lay
|
|
|
532
600
|
vite?: UserConfig | ((config: UserConfig) => UserConfig);
|
|
533
601
|
[key: string]: any;
|
|
534
602
|
}
|
|
535
|
-
interface ResolvedFarmConfig extends Required<Omit<FarmUserConfig, "extends" | "plugins" | "vite" | "deploy" | "docs" | "md" | "mdx" | "migrations" | "cron" | "workflows" | "env" | "serverActions" | "devtools" | "images" | "i18n">> {
|
|
603
|
+
interface ResolvedFarmConfig extends Required<Omit<FarmUserConfig, "extends" | "plugins" | "vite" | "deploy" | "docs" | "md" | "mdx" | "migrations" | "cron" | "workflows" | "env" | "serverActions" | "devtools" | "images" | "i18n" | "auth">> {
|
|
536
604
|
/** @internal Tracks whether `context` came from user/layer config instead of the default noop. */
|
|
537
605
|
[FARM_RESOLVED_CUSTOM_CONTEXT]?: boolean;
|
|
538
606
|
extends: readonly FarmLayerEntry[];
|
|
@@ -551,6 +619,7 @@ interface ResolvedFarmConfig extends Required<Omit<FarmUserConfig, "extends" | "
|
|
|
551
619
|
devtools: ResolvedFarmDevtoolsConfig;
|
|
552
620
|
images: ResolvedFarmImageConfig;
|
|
553
621
|
i18n: ResolvedFarmI18nConfig;
|
|
622
|
+
auth: ResolvedFarmAuthConfig;
|
|
554
623
|
routeRules: FarmRouteRules;
|
|
555
624
|
}
|
|
556
625
|
type FarmLayerConfig = Omit<FarmUserConfig, "root" | "outDir" | "distDir" | "deploy" | "output" | "preset" | "publicDir" | "generateBuildId" | "deploymentId">;
|
|
@@ -1445,6 +1514,8 @@ interface FarmConfig {
|
|
|
1445
1514
|
/** Shared application data, route, ISR, and PPR cache. */
|
|
1446
1515
|
cache?: FarmCacheUserConfig;
|
|
1447
1516
|
integrations?: FarmIntegrationsUserConfig;
|
|
1517
|
+
/** Farm-native authentication. `true` enables email/password auth. */
|
|
1518
|
+
auth?: FarmAuthUserConfig | ResolvedFarmAuthConfig;
|
|
1448
1519
|
plugins?: FarmPlugin[];
|
|
1449
1520
|
migrations?: FarmMigrationsUserConfig;
|
|
1450
1521
|
/** Map portable cron schedules to ordinary GET API routes. */
|
|
@@ -1852,4 +1923,4 @@ interface SSGCollectionResult {
|
|
|
1852
1923
|
ssr: string[];
|
|
1853
1924
|
}
|
|
1854
1925
|
|
|
1855
|
-
export { type ResolvedFarmDevtoolsConfig as $, type FarmLayerEntry as A, type BuildOptions as B, type ResolvedFarmLayer as C, type FarmSourceRoot as D, type ErrorProps as E, type FarmConfig as F, type ResolveFarmLayersOptions as G, type FarmLayerResolution as H, resolveFarmLayers as I, getFarmSourceRoots as J, getFarmAppDirectories as K, type LoadingProps as L, type MiddlewareProps as M, type NitroPreset as N, getFarmLayerAliases as O, type PluginContextProps as P, loadFarmConfigFile as Q, type ResolvedFarmMigrationsConfig as R, type StaticPathPrimitive as S, type FarmUserConfig as T, type BundleResultPayload as U, type FarmPlugin as V, type FarmIntegration as W, type ReadonlyMiddlewareStore as X, type FarmMiddlewareConfig as Y, type MiddlewareModule as Z, type FarmMdxResolvedConfig as _, type FarmMigrationCommand as a, type
|
|
1926
|
+
export { type ResolvedFarmDevtoolsConfig as $, type FarmLayerEntry as A, type BuildOptions as B, type ResolvedFarmLayer as C, type FarmSourceRoot as D, type ErrorProps as E, type FarmConfig as F, type ResolveFarmLayersOptions as G, type FarmLayerResolution as H, resolveFarmLayers as I, getFarmSourceRoots as J, getFarmAppDirectories as K, type LoadingProps as L, type MiddlewareProps as M, type NitroPreset as N, getFarmLayerAliases as O, type PluginContextProps as P, loadFarmConfigFile as Q, type ResolvedFarmMigrationsConfig as R, type StaticPathPrimitive as S, type FarmUserConfig as T, type BundleResultPayload as U, type FarmPlugin as V, type FarmIntegration as W, type ReadonlyMiddlewareStore as X, type FarmMiddlewareConfig as Y, type MiddlewareModule as Z, type FarmMdxResolvedConfig as _, type FarmMigrationCommand as a, type FarmDeployConfig as a$, type ResolvedFarmAuthConfig as a0, type OpenAPIConfig as a1, definePlugin as a2, PluginManager as a3, resolveConfig as a4, loadConfig as a5, resolveDeployConfig as a6, resolveMigrationsConfig as a7, resolveDeployOutputPath as a8, normalizeDeployTarget as a9, type FarmPluginRuntimeSession as aA, type FarmPluginDiscoveredRoute as aB, type FarmPluginRouterHooks as aC, type FarmPluginRenderHooks as aD, type FarmPluginBuildHooks as aE, type FarmPluginDevHooks as aF, type FarmPluginClientConfig as aG, type RouteDiscoveredPayload as aH, type RoutesGeneratedPayload as aI, type MiddlewareDiscoveredPayload as aJ, type APIRouteDiscoveredPayload as aK, type RouteMatchPayload as aL, type RouteMatchResultPayload as aM, type RenderLifecyclePayload as aN, type APIHandlerLifecyclePayload as aO, type ErrorLifecyclePayload as aP, type HMRUpdatePayload as aQ, type BundleLifecyclePayload as aR, type NitroBuildLifecyclePayload as aS, type ShutdownPayload as aT, type ResolvedFarmConfig as aU, type RedirectConfig as aV, type HeaderConfig as aW, type RewriteConfig as aX, type ImageConfig as aY, type I18nConfig as aZ, type MiddlewareConfig as a_, getDeployTargetForPreset as aa, getPresetForDeployTarget as ab, type FarmLayerConfig as ac, type FarmAuthConfig as ad, type FarmAuthDatabaseConfig as ae, type FarmAuthEmailAndPasswordConfig as af, type FarmAuthSessionConfig as ag, type FarmAuthUserConfig as ah, type PluginRequestContext as ai, type FarmPluginContext as aj, type FarmRequestPluginContext as ak, type FarmRequestStore as al, type FarmPluginRuntimeKind as am, type FarmPluginRouteRuntimePayload as an, type FarmPluginSetupContext as ao, type FarmPluginStateContext as ap, type FarmPluginRuntimeBaseEvent as aq, type FarmPluginRuntimeContextEvent as ar, type FarmPluginRuntimeBeforeEvent as as, type FarmPluginRuntimeAfterEvent as at, type FarmPluginRuntimeErrorEvent as au, type FarmPluginRuntimeStartEvent as av, type FarmPluginRuntimeCloseEvent as aw, type FarmPluginRuntimeHooks as ax, type FarmPluginRuntimeRequestOptions as ay, type FarmPluginRuntimeRequestHandler as az, type FarmMigrationsConfig as b, defineIntegration as b$, type ResolvedFarmDeployConfig as b0, type FarmDeployTarget as b1, type FarmIntegrationCategory as b2, type FarmIntegrationSlot as b3, type FarmIntegrationRouteParamValue as b4, type FarmIntegrationRouteParams as b5, type FarmIntegrationRouteMethod as b6, type FarmIntegrationRouteInputSource as b7, type FarmIntegrationValidationPathSegment as b8, type FarmIntegrationRouteInput as b9, type FarmIntegrationProviderProps as bA, type FarmIntegrationProvider as bB, type FarmIntegrationDocumentNavigation as bC, type FarmIntegrationSchemaFieldType as bD, type FarmIntegrationSchemaReference as bE, type FarmIntegrationSchemaField as bF, type FarmIntegrationSchemaConstraint as bG, type FarmIntegrationSchemaModel as bH, type FarmIntegrationSchemaModelExtension as bI, type FarmIntegrationSchemaModelOverride as bJ, type FarmIntegrationSchema as bK, defineIntegrationSchema as bL, type FarmIntegrationLogPhase as bM, type FarmIntegrationLogEvent as bN, type FarmIntegrationLogger as bO, type FarmIntegrationsUserConfig as bP, getFarmIntegrationPluginServerRuntime as bQ, type FarmIntegrationRouteFactory as bR, type FarmIntegrationRoutesFactoryContext as bS, type FarmIntegrationRoutesFactory as bT, type FarmIntegrationEndpointValue as bU, type FarmIntegrationEndpoints as bV, type FarmIntegrationEndpointsFactoryContext as bW, type FarmIntegrationEndpointsFactory as bX, createIntegrationRoute as bY, integrationRoute as bZ, type DefinedIntegration as b_, type FarmIntegrationValidationIssue as ba, type FarmIntegrationValidationErrorLike as bb, type FarmIntegrationValidationResult as bc, type FarmIntegrationStandardValidationResult as bd, type FarmIntegrationInputSchema as be, type FarmIntegrationRouteInputSchemas as bf, type FarmIntegrationRequestContextStore as bg, FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY as bh, type FarmIntegrationRouteDb as bi, type FarmIntegrationRouteStorageArgs as bj, type FarmIntegrationRouteArgs as bk, type FarmIntegrationConfigContext as bl, type FarmIntegrationConfigDefinition as bm, type FarmIntegrationConfigInput as bn, type FarmIntegrationLifecycleLogLevel as bo, type FarmIntegrationLifecycleLogger as bp, type FarmIntegrationLifecycleContext as bq, type FarmIntegrationLifecycleHook as br, type FarmIntegrationData as bs, type FarmIntegrationHandlerContext as bt, type FarmIntegrationRouteHookContext as bu, type FarmIntegrationRouteHook as bv, type FarmIntegrationRoute as bw, type FarmTypedIntegrationRoute as bx, type FarmIntegrationRouteMiddleware as by, type FarmIntegrationMiddleware as bz, type FarmMigrationsUserConfig as c, type FarmDevtoolsConfig as c$, isFarmIntegration as c0, resolveIntegrationPlugins as c1, getIntegrationProviders as c2, getIntegrationDocumentNavigationMatchers as c3, getIntegrationSchemas as c4, getRegisteredIntegrationRuntime as c5, getRegisteredIntegrations as c6, getRegisteredIntegrationSchemas as c7, matchIntegrationRoute as c8, matchRegisteredIntegrationRoute as c9, type FarmRouteRuleRenderMode as cA, type FarmRouteRuleRedirect as cB, type FarmRouteRuleCors as cC, type FarmRouteRule as cD, type FarmRouteRules as cE, normalizeRouteRules as cF, routeRulesToRedirects as cG, routeRulesToHeaders as cH, routeRulesToNitroRouteRules as cI, type FarmMdxComponent as cJ, type FarmMdxComponents as cK, type FarmMdxUserConfig as cL, type FarmMarkdownPageSource as cM, type FarmMarkdownPageModuleInput as cN, resolveMdxConfig as cO, isFarmMarkdownPageFile as cP, normalizeFarmMarkdownRoutePath as cQ, parseMarkdownFrontmatter as cR, titleFromMarkdown as cS, createMarkdownMetadata as cT, createFarmMarkdownRouteModule as cU, createFarmMarkdownRouteModuleFromFile as cV, loadFarmMdxComponents as cW, createFarmMarkdownSourceResponse as cX, DEFAULT_FARM_DEVTOOLS_SHORTCUT as cY, FARM_DEVTOOLS_PATH as cZ, FARM_DEVTOOLS_LAUNCH_PARAM as c_, getRegisteredIntegrationAPIManifest as ca, dispatchIntegrationRequest as cb, type FarmIntegrationOrmSchema as cc, type FarmIntegrationOrmClient as cd, type InferFarmIntegrationOrmField as ce, type InferFarmIntegrationOrmFields as cf, type InferFarmIntegrationOrmSchema as cg, type InferFarmIntegrationOrmClient as ch, type CreateIntegrationOrmOptions as ci, createIntegrationOrm as cj, resolveIntegrationOrmRuntimeClient as ck, farmIntegrationSchemaToOrmSchema as cl, type IntegrationOrmModelNames as cm, type MiddlewareContext as cn, type MiddlewareFunction as co, type RequestMiddleware as cp, type RequestMiddlewareContext as cq, type MiddlewareStore as cr, type MiddlewareChain as cs, type CookieJar as ct, type CookieOptions as cu, type RateLimitConfig as cv, type RateLimitStorage as cw, type RateLimitStatus as cx, type NextFunction as cy, type MiddlewareResult as cz, defineConfig as d, type FarmDevtoolsUserConfig as d0, resolveFarmDevtoolsConfig as d1, type MiddlewareConfig$1 as d2, farmI18nClientBridgePlugin as d3, rewriteEarlySsrRelativeImports as d4, type FarmContextFactoryInput as e, farmPlugin as f, type FarmContextFactory as g, type FarmAppContext as h, type PageProps as i, type PagePropsWithMiddleware as j, type LayoutProps as k, type Page as l, type Layout as m, type Loading as n, type ErrorBoundary as o, type RouteModule as p, type StaticPathParams as q, type LayoutModule as r, type Metadata as s, type FarmRequest as t, type FarmResponse as u, type ServerAction as v, type RouteSegment as w, type ParsedRoute as x, type SSGPage as y, type SSGCollectionResult as z };
|
|
@@ -14,7 +14,7 @@ import { FarmCronUserConfig, FarmCronResolvedConfig } from './cron.js';
|
|
|
14
14
|
import { FarmEnvConfig, ResolvedFarmEnv } from './env.js';
|
|
15
15
|
import { FarmServerActionsConfig, ResolvedFarmServerActionsConfig } from './server-action-security.js';
|
|
16
16
|
import { F as FarmImageConfig, R as ResolvedFarmImageConfig } from './image-config-Duob7wER.js';
|
|
17
|
-
import { k as FarmI18nUserConfig, R as ResolvedFarmI18nConfig } from './types-
|
|
17
|
+
import { k as FarmI18nUserConfig, R as ResolvedFarmI18nConfig } from './types-BMxWr97v.js';
|
|
18
18
|
import { FarmCacheUserConfig } from './cache.js';
|
|
19
19
|
import { F as FarmRouteRuntimeConfig, a as FarmRouteRuntime, b as FarmRouteRegions, c as FarmRouteMaxDuration } from './route-runtime-DoOHzCAD.js';
|
|
20
20
|
|
|
@@ -399,6 +399,68 @@ interface ResolvedFarmDevtoolsConfig {
|
|
|
399
399
|
}
|
|
400
400
|
declare function resolveFarmDevtoolsConfig(config: FarmDevtoolsUserConfig | ResolvedFarmDevtoolsConfig | undefined, mode?: "development" | "production"): ResolvedFarmDevtoolsConfig;
|
|
401
401
|
|
|
402
|
+
interface FarmAuthEmailAndPasswordConfig {
|
|
403
|
+
/** Require a verified email before creating a session. @default false */
|
|
404
|
+
requireEmailVerification?: boolean;
|
|
405
|
+
/** Smallest accepted password length. @default 8 */
|
|
406
|
+
minPasswordLength?: number;
|
|
407
|
+
/** Largest accepted password length. @default 128 */
|
|
408
|
+
maxPasswordLength?: number;
|
|
409
|
+
}
|
|
410
|
+
interface FarmAuthSessionConfig {
|
|
411
|
+
/** Session lifetime in seconds. @default 604800 */
|
|
412
|
+
expiresIn?: number;
|
|
413
|
+
/** Session refresh interval in seconds. @default 86400 */
|
|
414
|
+
updateAge?: number;
|
|
415
|
+
}
|
|
416
|
+
interface FarmAuthDatabaseConfig {
|
|
417
|
+
/**
|
|
418
|
+
* Postgres connection string. Defaults to DATABASE_URL.
|
|
419
|
+
* Local development falls back to SQLite when no URL is present.
|
|
420
|
+
*/
|
|
421
|
+
url?: string;
|
|
422
|
+
/** Local SQLite path. @default ".farm/auth.sqlite" */
|
|
423
|
+
path?: string;
|
|
424
|
+
/** Automatically update the auth schema in development. @default true */
|
|
425
|
+
migrateInDevelopment?: boolean;
|
|
426
|
+
}
|
|
427
|
+
interface FarmAuthConfig {
|
|
428
|
+
/** Set false to disable auth without removing its configuration. @default true */
|
|
429
|
+
enabled?: boolean;
|
|
430
|
+
/** Display name used by authentication emails and metadata. */
|
|
431
|
+
appName?: string;
|
|
432
|
+
/** Route prefix for the auth endpoints. @default "/api/auth" */
|
|
433
|
+
basePath?: string;
|
|
434
|
+
/**
|
|
435
|
+
* Email/password authentication. It is enabled by default; set false to
|
|
436
|
+
* disable it when adding another sign-in method.
|
|
437
|
+
*/
|
|
438
|
+
emailAndPassword?: boolean | FarmAuthEmailAndPasswordConfig;
|
|
439
|
+
session?: FarmAuthSessionConfig;
|
|
440
|
+
database?: FarmAuthDatabaseConfig;
|
|
441
|
+
}
|
|
442
|
+
type FarmAuthUserConfig = boolean | FarmAuthConfig;
|
|
443
|
+
interface ResolvedFarmAuthConfig {
|
|
444
|
+
enabled: boolean;
|
|
445
|
+
appName?: string;
|
|
446
|
+
basePath: string;
|
|
447
|
+
emailAndPassword: {
|
|
448
|
+
enabled: boolean;
|
|
449
|
+
requireEmailVerification: boolean;
|
|
450
|
+
minPasswordLength: number;
|
|
451
|
+
maxPasswordLength: number;
|
|
452
|
+
};
|
|
453
|
+
session: {
|
|
454
|
+
expiresIn: number;
|
|
455
|
+
updateAge: number;
|
|
456
|
+
};
|
|
457
|
+
database: {
|
|
458
|
+
url?: string;
|
|
459
|
+
path: string;
|
|
460
|
+
migrateInDevelopment: boolean;
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
|
|
402
464
|
declare const FARM_RESOLVED_CUSTOM_CONTEXT: unique symbol;
|
|
403
465
|
|
|
404
466
|
interface RedirectConfig {
|
|
@@ -487,6 +549,12 @@ interface FarmUserConfig extends Omit<FarmConfig, "vite" | "docs" | "env" | "lay
|
|
|
487
549
|
extends?: readonly FarmLayerEntry[];
|
|
488
550
|
plugins?: FarmPlugin[];
|
|
489
551
|
integrations?: FarmIntegrationsUserConfig;
|
|
552
|
+
/**
|
|
553
|
+
* Farm-native authentication. `true` enables email/password auth with
|
|
554
|
+
* server helpers from `@farm.js/auth/server` and React APIs from
|
|
555
|
+
* `@farm.js/auth/client`.
|
|
556
|
+
*/
|
|
557
|
+
auth?: FarmAuthUserConfig;
|
|
490
558
|
/** Shared application data, route, ISR, and PPR cache. */
|
|
491
559
|
cache?: FarmCacheUserConfig;
|
|
492
560
|
migrations?: FarmMigrationsUserConfig;
|
|
@@ -532,7 +600,7 @@ interface FarmUserConfig extends Omit<FarmConfig, "vite" | "docs" | "env" | "lay
|
|
|
532
600
|
vite?: UserConfig | ((config: UserConfig) => UserConfig);
|
|
533
601
|
[key: string]: any;
|
|
534
602
|
}
|
|
535
|
-
interface ResolvedFarmConfig extends Required<Omit<FarmUserConfig, "extends" | "plugins" | "vite" | "deploy" | "docs" | "md" | "mdx" | "migrations" | "cron" | "workflows" | "env" | "serverActions" | "devtools" | "images" | "i18n">> {
|
|
603
|
+
interface ResolvedFarmConfig extends Required<Omit<FarmUserConfig, "extends" | "plugins" | "vite" | "deploy" | "docs" | "md" | "mdx" | "migrations" | "cron" | "workflows" | "env" | "serverActions" | "devtools" | "images" | "i18n" | "auth">> {
|
|
536
604
|
/** @internal Tracks whether `context` came from user/layer config instead of the default noop. */
|
|
537
605
|
[FARM_RESOLVED_CUSTOM_CONTEXT]?: boolean;
|
|
538
606
|
extends: readonly FarmLayerEntry[];
|
|
@@ -551,6 +619,7 @@ interface ResolvedFarmConfig extends Required<Omit<FarmUserConfig, "extends" | "
|
|
|
551
619
|
devtools: ResolvedFarmDevtoolsConfig;
|
|
552
620
|
images: ResolvedFarmImageConfig;
|
|
553
621
|
i18n: ResolvedFarmI18nConfig;
|
|
622
|
+
auth: ResolvedFarmAuthConfig;
|
|
554
623
|
routeRules: FarmRouteRules;
|
|
555
624
|
}
|
|
556
625
|
type FarmLayerConfig = Omit<FarmUserConfig, "root" | "outDir" | "distDir" | "deploy" | "output" | "preset" | "publicDir" | "generateBuildId" | "deploymentId">;
|
|
@@ -1445,6 +1514,8 @@ interface FarmConfig {
|
|
|
1445
1514
|
/** Shared application data, route, ISR, and PPR cache. */
|
|
1446
1515
|
cache?: FarmCacheUserConfig;
|
|
1447
1516
|
integrations?: FarmIntegrationsUserConfig;
|
|
1517
|
+
/** Farm-native authentication. `true` enables email/password auth. */
|
|
1518
|
+
auth?: FarmAuthUserConfig | ResolvedFarmAuthConfig;
|
|
1448
1519
|
plugins?: FarmPlugin[];
|
|
1449
1520
|
migrations?: FarmMigrationsUserConfig;
|
|
1450
1521
|
/** Map portable cron schedules to ordinary GET API routes. */
|
|
@@ -1852,4 +1923,4 @@ interface SSGCollectionResult {
|
|
|
1852
1923
|
ssr: string[];
|
|
1853
1924
|
}
|
|
1854
1925
|
|
|
1855
|
-
export { type ResolvedFarmDevtoolsConfig as $, type FarmLayerEntry as A, type BuildOptions as B, type ResolvedFarmLayer as C, type FarmSourceRoot as D, type ErrorProps as E, type FarmConfig as F, type ResolveFarmLayersOptions as G, type FarmLayerResolution as H, resolveFarmLayers as I, getFarmSourceRoots as J, getFarmAppDirectories as K, type LoadingProps as L, type MiddlewareProps as M, type NitroPreset as N, getFarmLayerAliases as O, type PluginContextProps as P, loadFarmConfigFile as Q, type ResolvedFarmMigrationsConfig as R, type StaticPathPrimitive as S, type FarmUserConfig as T, type BundleResultPayload as U, type FarmPlugin as V, type FarmIntegration as W, type ReadonlyMiddlewareStore as X, type FarmMiddlewareConfig as Y, type MiddlewareModule as Z, type FarmMdxResolvedConfig as _, type FarmMigrationCommand as a, type
|
|
1926
|
+
export { type ResolvedFarmDevtoolsConfig as $, type FarmLayerEntry as A, type BuildOptions as B, type ResolvedFarmLayer as C, type FarmSourceRoot as D, type ErrorProps as E, type FarmConfig as F, type ResolveFarmLayersOptions as G, type FarmLayerResolution as H, resolveFarmLayers as I, getFarmSourceRoots as J, getFarmAppDirectories as K, type LoadingProps as L, type MiddlewareProps as M, type NitroPreset as N, getFarmLayerAliases as O, type PluginContextProps as P, loadFarmConfigFile as Q, type ResolvedFarmMigrationsConfig as R, type StaticPathPrimitive as S, type FarmUserConfig as T, type BundleResultPayload as U, type FarmPlugin as V, type FarmIntegration as W, type ReadonlyMiddlewareStore as X, type FarmMiddlewareConfig as Y, type MiddlewareModule as Z, type FarmMdxResolvedConfig as _, type FarmMigrationCommand as a, type FarmDeployConfig as a$, type ResolvedFarmAuthConfig as a0, type OpenAPIConfig as a1, definePlugin as a2, PluginManager as a3, resolveConfig as a4, loadConfig as a5, resolveDeployConfig as a6, resolveMigrationsConfig as a7, resolveDeployOutputPath as a8, normalizeDeployTarget as a9, type FarmPluginRuntimeSession as aA, type FarmPluginDiscoveredRoute as aB, type FarmPluginRouterHooks as aC, type FarmPluginRenderHooks as aD, type FarmPluginBuildHooks as aE, type FarmPluginDevHooks as aF, type FarmPluginClientConfig as aG, type RouteDiscoveredPayload as aH, type RoutesGeneratedPayload as aI, type MiddlewareDiscoveredPayload as aJ, type APIRouteDiscoveredPayload as aK, type RouteMatchPayload as aL, type RouteMatchResultPayload as aM, type RenderLifecyclePayload as aN, type APIHandlerLifecyclePayload as aO, type ErrorLifecyclePayload as aP, type HMRUpdatePayload as aQ, type BundleLifecyclePayload as aR, type NitroBuildLifecyclePayload as aS, type ShutdownPayload as aT, type ResolvedFarmConfig as aU, type RedirectConfig as aV, type HeaderConfig as aW, type RewriteConfig as aX, type ImageConfig as aY, type I18nConfig as aZ, type MiddlewareConfig as a_, getDeployTargetForPreset as aa, getPresetForDeployTarget as ab, type FarmLayerConfig as ac, type FarmAuthConfig as ad, type FarmAuthDatabaseConfig as ae, type FarmAuthEmailAndPasswordConfig as af, type FarmAuthSessionConfig as ag, type FarmAuthUserConfig as ah, type PluginRequestContext as ai, type FarmPluginContext as aj, type FarmRequestPluginContext as ak, type FarmRequestStore as al, type FarmPluginRuntimeKind as am, type FarmPluginRouteRuntimePayload as an, type FarmPluginSetupContext as ao, type FarmPluginStateContext as ap, type FarmPluginRuntimeBaseEvent as aq, type FarmPluginRuntimeContextEvent as ar, type FarmPluginRuntimeBeforeEvent as as, type FarmPluginRuntimeAfterEvent as at, type FarmPluginRuntimeErrorEvent as au, type FarmPluginRuntimeStartEvent as av, type FarmPluginRuntimeCloseEvent as aw, type FarmPluginRuntimeHooks as ax, type FarmPluginRuntimeRequestOptions as ay, type FarmPluginRuntimeRequestHandler as az, type FarmMigrationsConfig as b, defineIntegration as b$, type ResolvedFarmDeployConfig as b0, type FarmDeployTarget as b1, type FarmIntegrationCategory as b2, type FarmIntegrationSlot as b3, type FarmIntegrationRouteParamValue as b4, type FarmIntegrationRouteParams as b5, type FarmIntegrationRouteMethod as b6, type FarmIntegrationRouteInputSource as b7, type FarmIntegrationValidationPathSegment as b8, type FarmIntegrationRouteInput as b9, type FarmIntegrationProviderProps as bA, type FarmIntegrationProvider as bB, type FarmIntegrationDocumentNavigation as bC, type FarmIntegrationSchemaFieldType as bD, type FarmIntegrationSchemaReference as bE, type FarmIntegrationSchemaField as bF, type FarmIntegrationSchemaConstraint as bG, type FarmIntegrationSchemaModel as bH, type FarmIntegrationSchemaModelExtension as bI, type FarmIntegrationSchemaModelOverride as bJ, type FarmIntegrationSchema as bK, defineIntegrationSchema as bL, type FarmIntegrationLogPhase as bM, type FarmIntegrationLogEvent as bN, type FarmIntegrationLogger as bO, type FarmIntegrationsUserConfig as bP, getFarmIntegrationPluginServerRuntime as bQ, type FarmIntegrationRouteFactory as bR, type FarmIntegrationRoutesFactoryContext as bS, type FarmIntegrationRoutesFactory as bT, type FarmIntegrationEndpointValue as bU, type FarmIntegrationEndpoints as bV, type FarmIntegrationEndpointsFactoryContext as bW, type FarmIntegrationEndpointsFactory as bX, createIntegrationRoute as bY, integrationRoute as bZ, type DefinedIntegration as b_, type FarmIntegrationValidationIssue as ba, type FarmIntegrationValidationErrorLike as bb, type FarmIntegrationValidationResult as bc, type FarmIntegrationStandardValidationResult as bd, type FarmIntegrationInputSchema as be, type FarmIntegrationRouteInputSchemas as bf, type FarmIntegrationRequestContextStore as bg, FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY as bh, type FarmIntegrationRouteDb as bi, type FarmIntegrationRouteStorageArgs as bj, type FarmIntegrationRouteArgs as bk, type FarmIntegrationConfigContext as bl, type FarmIntegrationConfigDefinition as bm, type FarmIntegrationConfigInput as bn, type FarmIntegrationLifecycleLogLevel as bo, type FarmIntegrationLifecycleLogger as bp, type FarmIntegrationLifecycleContext as bq, type FarmIntegrationLifecycleHook as br, type FarmIntegrationData as bs, type FarmIntegrationHandlerContext as bt, type FarmIntegrationRouteHookContext as bu, type FarmIntegrationRouteHook as bv, type FarmIntegrationRoute as bw, type FarmTypedIntegrationRoute as bx, type FarmIntegrationRouteMiddleware as by, type FarmIntegrationMiddleware as bz, type FarmMigrationsUserConfig as c, type FarmDevtoolsConfig as c$, isFarmIntegration as c0, resolveIntegrationPlugins as c1, getIntegrationProviders as c2, getIntegrationDocumentNavigationMatchers as c3, getIntegrationSchemas as c4, getRegisteredIntegrationRuntime as c5, getRegisteredIntegrations as c6, getRegisteredIntegrationSchemas as c7, matchIntegrationRoute as c8, matchRegisteredIntegrationRoute as c9, type FarmRouteRuleRenderMode as cA, type FarmRouteRuleRedirect as cB, type FarmRouteRuleCors as cC, type FarmRouteRule as cD, type FarmRouteRules as cE, normalizeRouteRules as cF, routeRulesToRedirects as cG, routeRulesToHeaders as cH, routeRulesToNitroRouteRules as cI, type FarmMdxComponent as cJ, type FarmMdxComponents as cK, type FarmMdxUserConfig as cL, type FarmMarkdownPageSource as cM, type FarmMarkdownPageModuleInput as cN, resolveMdxConfig as cO, isFarmMarkdownPageFile as cP, normalizeFarmMarkdownRoutePath as cQ, parseMarkdownFrontmatter as cR, titleFromMarkdown as cS, createMarkdownMetadata as cT, createFarmMarkdownRouteModule as cU, createFarmMarkdownRouteModuleFromFile as cV, loadFarmMdxComponents as cW, createFarmMarkdownSourceResponse as cX, DEFAULT_FARM_DEVTOOLS_SHORTCUT as cY, FARM_DEVTOOLS_PATH as cZ, FARM_DEVTOOLS_LAUNCH_PARAM as c_, getRegisteredIntegrationAPIManifest as ca, dispatchIntegrationRequest as cb, type FarmIntegrationOrmSchema as cc, type FarmIntegrationOrmClient as cd, type InferFarmIntegrationOrmField as ce, type InferFarmIntegrationOrmFields as cf, type InferFarmIntegrationOrmSchema as cg, type InferFarmIntegrationOrmClient as ch, type CreateIntegrationOrmOptions as ci, createIntegrationOrm as cj, resolveIntegrationOrmRuntimeClient as ck, farmIntegrationSchemaToOrmSchema as cl, type IntegrationOrmModelNames as cm, type MiddlewareContext as cn, type MiddlewareFunction as co, type RequestMiddleware as cp, type RequestMiddlewareContext as cq, type MiddlewareStore as cr, type MiddlewareChain as cs, type CookieJar as ct, type CookieOptions as cu, type RateLimitConfig as cv, type RateLimitStorage as cw, type RateLimitStatus as cx, type NextFunction as cy, type MiddlewareResult as cz, defineConfig as d, type FarmDevtoolsUserConfig as d0, resolveFarmDevtoolsConfig as d1, type MiddlewareConfig$1 as d2, farmI18nClientBridgePlugin as d3, rewriteEarlySsrRelativeImports as d4, type FarmContextFactoryInput as e, farmPlugin as f, type FarmContextFactory as g, type FarmAppContext as h, type PageProps as i, type PagePropsWithMiddleware as j, type LayoutProps as k, type Page as l, type Layout as m, type Loading as n, type ErrorBoundary as o, type RouteModule as p, type StaticPathParams as q, type LayoutModule as r, type Metadata as s, type FarmRequest as t, type FarmResponse as u, type ServerAction as v, type RouteSegment as w, type ParsedRoute as x, type SSGPage as y, type SSGCollectionResult as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { a as FarmClientHydrationCompleteEvent, b as FarmClientHydrationEvent, d as FarmClientHydrationMode, e as FarmClientHydrationSession, f as FarmClientLocation, g as FarmClientNavigationAction, h as FarmClientNavigationErrorEvent, i as FarmClientNavigationEvent, j as FarmClientNavigationLoadedEvent, k as FarmClientNavigationResolvedEvent, l as FarmClientNavigationSession, m as FarmClientPerformanceEvent, n as FarmClientPlugin, o as FarmClientPluginCloseEvent, p as FarmClientPluginEnforce, q as FarmClientPluginErrorEvent, r as FarmClientPluginErrorPhase, F as FarmClientPluginManager, s as FarmClientPluginManagerOptions, t as FarmClientPluginMetadata, u as FarmClientPluginRegistration, v as FarmClientPluginRouter, w as FarmClientPluginSetupEvent, x as FarmClientPluginStateEvent, c as createClientPluginManager } from './plugin-BJDf43dc.mjs';
|
|
2
|
-
export { V as FarmPlugin,
|
|
2
|
+
export { V as FarmPlugin, aj as FarmPluginContext, ak as FarmRequestPluginContext, al as FarmRequestStore } from './client-plugins-BI2R6Eae.mjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
import 'http';
|
|
5
5
|
import './types-D1A6-XvH.mjs';
|
|
@@ -17,6 +17,6 @@ import './cron.mjs';
|
|
|
17
17
|
import './env.mjs';
|
|
18
18
|
import './server-action-security.mjs';
|
|
19
19
|
import './image-config-Duob7wER.mjs';
|
|
20
|
-
import './types-
|
|
20
|
+
import './types-BMxWr97v.mjs';
|
|
21
21
|
import './cache.mjs';
|
|
22
22
|
import './route-runtime-DoOHzCAD.mjs';
|
package/dist/client-plugins.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { a as FarmClientHydrationCompleteEvent, b as FarmClientHydrationEvent, d as FarmClientHydrationMode, e as FarmClientHydrationSession, f as FarmClientLocation, g as FarmClientNavigationAction, h as FarmClientNavigationErrorEvent, i as FarmClientNavigationEvent, j as FarmClientNavigationLoadedEvent, k as FarmClientNavigationResolvedEvent, l as FarmClientNavigationSession, m as FarmClientPerformanceEvent, n as FarmClientPlugin, o as FarmClientPluginCloseEvent, p as FarmClientPluginEnforce, q as FarmClientPluginErrorEvent, r as FarmClientPluginErrorPhase, F as FarmClientPluginManager, s as FarmClientPluginManagerOptions, t as FarmClientPluginMetadata, u as FarmClientPluginRegistration, v as FarmClientPluginRouter, w as FarmClientPluginSetupEvent, x as FarmClientPluginStateEvent, c as createClientPluginManager } from './plugin-BJDf43dc.js';
|
|
2
|
-
export { V as FarmPlugin,
|
|
2
|
+
export { V as FarmPlugin, aj as FarmPluginContext, ak as FarmRequestPluginContext, al as FarmRequestStore } from './client-plugins-DU9oMspX.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import 'http';
|
|
5
5
|
import './types-D1A6-XvH.js';
|
|
@@ -17,6 +17,6 @@ import './cron.js';
|
|
|
17
17
|
import './env.js';
|
|
18
18
|
import './server-action-security.js';
|
|
19
19
|
import './image-config-Duob7wER.js';
|
|
20
|
-
import './types-
|
|
20
|
+
import './types-BMxWr97v.js';
|
|
21
21
|
import './cache.js';
|
|
22
22
|
import './route-runtime-DoOHzCAD.js';
|