@farm.js/core 0.1.0-beta.48 → 0.1.0-beta.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/route-manager.cjs.map +1 -1
- package/dist/api/route-manager.mjs +2 -2
- package/dist/api.cjs.map +1 -1
- package/dist/api.mjs +3 -3
- package/dist/{chunk-TIESOJ7Z.mjs → chunk-BOSVED4K.mjs} +2 -2
- package/dist/{chunk-XR7M5VXU.mjs → chunk-DF6GAB63.mjs} +2 -2
- package/dist/{chunk-3P63LWDM.mjs → chunk-DWG3W2FN.mjs} +2 -2
- package/dist/{chunk-3UUEBVR3.mjs → chunk-ECGXDMBF.mjs} +3 -3
- package/dist/{chunk-MP2SDRRB.mjs → chunk-HB3XKQ5X.mjs} +2 -2
- package/dist/{chunk-EHUGMAWL.mjs → chunk-LIBL3V6K.mjs} +3 -3
- package/dist/{chunk-ECLWCE4H.mjs → chunk-MHE2AMUC.mjs} +2 -2
- package/dist/{chunk-GXASWWJU.mjs → chunk-RS5Z5M26.mjs} +5 -2
- package/dist/chunk-RS5Z5M26.mjs.map +1 -0
- package/dist/{chunk-HEZHCCMF.mjs → chunk-UQ3PDDAK.mjs} +65 -29
- package/dist/chunk-UQ3PDDAK.mjs.map +1 -0
- package/dist/{chunk-VZKOMD6C.mjs → chunk-VVVDVGAS.mjs} +8 -8
- package/dist/{chunk-NKIHYEWC.mjs → chunk-X3JR4G7L.mjs} +2 -2
- package/dist/{chunk-NKIHYEWC.mjs.map → chunk-X3JR4G7L.mjs.map} +1 -1
- package/dist/{chunk-4E6VRJ6P.mjs → chunk-XY3B4K5E.mjs} +6 -3
- package/dist/chunk-XY3B4K5E.mjs.map +1 -0
- package/dist/{chunk-U5SPS2HR.mjs → chunk-YB7QPRM4.mjs} +6 -1
- package/dist/chunk-YB7QPRM4.mjs.map +1 -0
- package/dist/client/lifecycle.mjs +2 -2
- package/dist/client-plugins.cjs +1 -1
- package/dist/client-plugins.cjs.map +1 -1
- package/dist/client-plugins.mjs +2 -2
- package/dist/client.cjs +1 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.mjs +2 -2
- package/dist/cron.cjs +9 -1
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.mjs +2 -1
- package/dist/{devtools-BUFIHBX3.mjs → devtools-S7KR2MMF.mjs} +5 -4
- package/dist/{devtools-BUFIHBX3.mjs.map → devtools-S7KR2MMF.mjs.map} +1 -1
- package/dist/docs.mjs +5 -4
- package/dist/index.cjs +66 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +15 -13
- package/dist/index.mjs.map +1 -1
- package/dist/internal/build-runtime.cjs +230 -189
- package/dist/internal/build-runtime.cjs.map +1 -1
- package/dist/internal/build-runtime.d.mts +1 -1
- package/dist/internal/build-runtime.d.ts +1 -1
- package/dist/internal/build-runtime.mjs +10 -10
- package/dist/internal/client-runtime.cjs +1 -1
- package/dist/internal/client-runtime.cjs.map +1 -1
- package/dist/internal/client-runtime.mjs +2 -2
- package/dist/internal/config-runtime.cjs +10 -10
- package/dist/internal/config-runtime.cjs.map +1 -1
- package/dist/internal/config-runtime.d.mts +1 -1
- package/dist/internal/config-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.mjs +4 -4
- package/dist/middleware.cjs.map +1 -1
- package/dist/middleware.mjs +3 -3
- package/dist/{nitro-G3BP7E7F.mjs → nitro-VXD26VW2.mjs} +4 -3
- package/dist/{nitro-G3BP7E7F.mjs.map → nitro-VXD26VW2.mjs.map} +1 -1
- package/dist/plugin.cjs +171 -149
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.mjs +7 -7
- package/dist/server.cjs +203 -177
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.mjs +10 -8
- package/dist/server.mjs.map +1 -1
- package/dist/testing.mjs +2 -2
- package/dist/{utils-9OPxcT1T.d.mts → utils--3v-RtD3.d.mts} +7 -1
- package/dist/{utils-CIIoLfn9.d.ts → utils-J3ipMElz.d.ts} +7 -1
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +171 -149
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +7 -7
- package/dist/workflows.cjs +8 -2
- package/dist/workflows.cjs.map +1 -1
- package/dist/workflows.mjs +2 -1
- package/package.json +1 -1
- package/dist/chunk-4E6VRJ6P.mjs.map +0 -1
- package/dist/chunk-GXASWWJU.mjs.map +0 -1
- package/dist/chunk-HEZHCCMF.mjs.map +0 -1
- package/dist/chunk-U5SPS2HR.mjs.map +0 -1
- /package/dist/{chunk-TIESOJ7Z.mjs.map → chunk-BOSVED4K.mjs.map} +0 -0
- /package/dist/{chunk-XR7M5VXU.mjs.map → chunk-DF6GAB63.mjs.map} +0 -0
- /package/dist/{chunk-3P63LWDM.mjs.map → chunk-DWG3W2FN.mjs.map} +0 -0
- /package/dist/{chunk-3UUEBVR3.mjs.map → chunk-ECGXDMBF.mjs.map} +0 -0
- /package/dist/{chunk-MP2SDRRB.mjs.map → chunk-HB3XKQ5X.mjs.map} +0 -0
- /package/dist/{chunk-EHUGMAWL.mjs.map → chunk-LIBL3V6K.mjs.map} +0 -0
- /package/dist/{chunk-ECLWCE4H.mjs.map → chunk-MHE2AMUC.mjs.map} +0 -0
- /package/dist/{chunk-VZKOMD6C.mjs.map → chunk-VVVDVGAS.mjs.map} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as RouteModule, J as SSGCollectionResult, I as SSGPage, F as FarmConfig, aj as OpenAPIConfig, O as ResolvedFarmLayer, Q as FarmSourceRoot } from './client-plugins-DmcF3JHA.mjs';
|
|
2
2
|
export { bh as APIHandlerLifecyclePayload, bd as APIRouteDiscoveredPayload, A as AppRoutePattern, H as BuildOptions, bk as BundleLifecyclePayload, a5 as BundleResultPayload, c$ as CookieJar, d0 as CookieOptions, cQ as CreateIntegrationOrmOptions, dh as DEFAULT_FARM_DEVTOOLS_SHORTCUT, cw as DefinedIntegration, s as ErrorBoundary, bi as ErrorLifecyclePayload, E as ErrorProps, dj as FARM_DEVTOOLS_LAUNCH_PARAM, di as FARM_DEVTOOLS_PATH, bM as FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY, i as FarmAppContext, aG as FarmAuthConfig, aH as FarmAuthDatabaseConfig, aI as FarmAuthEmailAndPasswordConfig, aJ as FarmAuthSessionConfig, aK as FarmAuthUserConfig, a as FarmComponentType, h as FarmContextFactory, g as FarmContextFactoryInput, aA as FarmCspConfig, aC as FarmCspDirectiveValue, aB as FarmCspDirectives, aD as FarmCspOptions, bu as FarmDeployConfig, bw as FarmDeployTarget, dk as FarmDevtoolsConfig, dl as FarmDevtoolsUserConfig, a7 as FarmIntegration, bx as FarmIntegrationCategory, bQ as FarmIntegrationConfigContext, bR as FarmIntegrationConfigDefinition, bS as FarmIntegrationConfigInput, cj as FarmIntegrationContributedPlugin, bX as FarmIntegrationData, c5 as FarmIntegrationDocumentNavigation, cq as FarmIntegrationEndpointValue, cr as FarmIntegrationEndpoints, ct as FarmIntegrationEndpointsFactory, cs as FarmIntegrationEndpointsFactoryContext, bY as FarmIntegrationHandlerContext, bJ as FarmIntegrationInputSchema, bV as FarmIntegrationLifecycleContext, bW as FarmIntegrationLifecycleHook, bT as FarmIntegrationLifecycleLogLevel, bU as FarmIntegrationLifecycleLogger, cg as FarmIntegrationLogEvent, cf as FarmIntegrationLogPhase, ch as FarmIntegrationLogger, c2 as FarmIntegrationMiddleware, cL as FarmIntegrationOrmClient, cK as FarmIntegrationOrmSchema, ci as FarmIntegrationPluginOwner, c4 as FarmIntegrationProvider, c3 as FarmIntegrationProviderProps, bL as FarmIntegrationRequestContextStore, b$ as FarmIntegrationRoute, bP as FarmIntegrationRouteArgs, bN as FarmIntegrationRouteDb, cn as FarmIntegrationRouteFactory, b_ as FarmIntegrationRouteHook, bZ as FarmIntegrationRouteHookContext, bE as FarmIntegrationRouteInput, bK as FarmIntegrationRouteInputSchemas, bC as FarmIntegrationRouteInputSource, bB as FarmIntegrationRouteMethod, c1 as FarmIntegrationRouteMiddleware, bz as FarmIntegrationRouteParamValue, bA as FarmIntegrationRouteParams, bO as FarmIntegrationRouteStorageArgs, cp as FarmIntegrationRoutesFactory, co as FarmIntegrationRoutesFactoryContext, cd as FarmIntegrationSchema, c9 as FarmIntegrationSchemaConstraint, c8 as FarmIntegrationSchemaField, c6 as FarmIntegrationSchemaFieldType, ca as FarmIntegrationSchemaModel, cb as FarmIntegrationSchemaModelExtension, cc as FarmIntegrationSchemaModelOverride, c7 as FarmIntegrationSchemaReference, by as FarmIntegrationSlot, bI as FarmIntegrationStandardValidationResult, bG as FarmIntegrationValidationErrorLike, bF as FarmIntegrationValidationIssue, bD as FarmIntegrationValidationPathSegment, bH as FarmIntegrationValidationResult, ck as FarmIntegrationsUserConfig, av as FarmLayerConfig, K as FarmLayerEntry, a2 as FarmMdxComponent, $ as FarmMdxComponents, a0 as FarmMdxResolvedConfig, a3 as FarmMdxUserConfig, a9 as FarmMiddlewareConfig, b as FarmMigrationCommand, c as FarmMigrationsConfig, e as FarmMigrationsUserConfig, aw as FarmPerformanceConfig, a6 as FarmPlugin, b7 as FarmPluginBuildHooks, b9 as FarmPluginClientConfig, aM as FarmPluginContext, b8 as FarmPluginDevHooks, b4 as FarmPluginDiscoveredRoute, aN as FarmPluginIntegrationContext, aO as FarmPluginLifecycle, b6 as FarmPluginRenderHooks, aS as FarmPluginRouteRuntimePayload, b5 as FarmPluginRouterHooks, aY as FarmPluginRuntimeAfterEvent, aV as FarmPluginRuntimeBaseEvent, aX as FarmPluginRuntimeBeforeEvent, a$ as FarmPluginRuntimeCloseEvent, aW as FarmPluginRuntimeContextEvent, aZ as FarmPluginRuntimeErrorEvent, b0 as FarmPluginRuntimeHooks, aR as FarmPluginRuntimeKind, b2 as FarmPluginRuntimeRequestHandler, b1 as FarmPluginRuntimeRequestOptions, b3 as FarmPluginRuntimeSession, a_ as FarmPluginRuntimeStartEvent, aT as FarmPluginSetupContext, aU as FarmPluginStateContext, ax as FarmPreloadMode, ay as FarmPreloadUserConfig, y as FarmRequest, aP as FarmRequestPluginContext, aQ as FarmRequestStore, z as FarmResponse, db as FarmRouteRule, da as FarmRouteRuleCors, d9 as FarmRouteRuleRedirect, d8 as FarmRouteRuleRenderMode, dc as FarmRouteRules, al as FarmRuntimeShutdownError, aE as FarmSecurityConfig, c0 as FarmTypedIntegrationRoute, a4 as FarmUserConfig, G as GenerateStaticParams, bj as HMRUpdatePayload, bp as HeaderConfig, bs as I18nConfig, br as ImageConfig, cP as InferFarmIntegrationOrmClient, cM as InferFarmIntegrationOrmField, cN as InferFarmIntegrationOrmFields, cO as InferFarmIntegrationOrmSchema, cU as IntegrationOrmModelNames, q as Layout, o as LayoutMetadataProps, w as LayoutModule, m as LayoutProps, r as Loading, L as LoadingProps, d5 as MemoryRateLimitStorageOptions, x as Metadata, n as MetadataProps, c_ as MiddlewareChain, bt as MiddlewareConfig, cV as MiddlewareContext, bc as MiddlewareDiscoveredPayload, cW as MiddlewareFunction, M as MiddlewareProps, d7 as MiddlewareResult, cZ as MiddlewareStore, d6 as NextFunction, bl as NitroBuildLifecyclePayload, N as NitroPreset, p as Page, k as PageProps, l as PagePropsWithMiddleware, P as PageRouteParams, D as ParsedRoute, j as PluginContextProps, am as PluginManager, aL as PluginRequestContext, d1 as RateLimitConfig, d2 as RateLimitIncrementResult, d4 as RateLimitStatus, d3 as RateLimitStorage, a8 as ReadonlyMiddlewareStore, bo as RedirectConfig, bg as RenderLifecyclePayload, cX as RequestMiddleware, cY as RequestMiddlewareContext, ac as ResolvedFarmAuthConfig, bn as ResolvedFarmConfig, aF as ResolvedFarmCspConfig, bv as ResolvedFarmDeployConfig, ab as ResolvedFarmDevtoolsConfig, R as ResolvedFarmMigrationsConfig, ad as ResolvedFarmPerformanceConfig, az as ResolvedFarmPreloadConfig, ae as ResolvedFarmSecurityConfig, bq as RewriteConfig, ba as RouteDiscoveredPayload, be as RouteMatchPayload, bf as RouteMatchResultPayload, C as RouteSegment, bb as RoutesGeneratedPayload, B as ServerAction, bm as ShutdownPayload, u as StaticPathParams, S as StaticPathPrimitive, v as StaticRouteParams, cR as createIntegrationOrm, cu as createIntegrationRoute, cx as defineIntegration, ce as defineIntegrationSchema, ak as definePlugin, cJ as dispatchIntegrationRequest, cT as farmIntegrationSchemaToOrmSchema, at as getDeployTargetForPreset, X as getFarmAppDirectories, cm as getFarmIntegrationPluginOwner, cl as getFarmIntegrationPluginServerRuntime, Y as getFarmLayerAliases, W as getFarmSourceRoots, cB as getIntegrationDocumentNavigationMatchers, cA as getIntegrationProviders, cC as getIntegrationSchemas, au as getPresetForDeployTarget, cI as getRegisteredIntegrationAPIManifest, cD as getRegisteredIntegrationRuntime, cF as getRegisteredIntegrationSchemas, cE as getRegisteredIntegrations, cv as integrationRoute, cy as isFarmIntegration, ao as loadConfig, cG as matchIntegrationRoute, cH as matchRegisteredIntegrationRoute, as as normalizeDeployTarget, dd as normalizeRouteRules, an as resolveConfig, ap as resolveDeployConfig, ar as resolveDeployOutputPath, dm as resolveFarmDevtoolsConfig, V as resolveFarmLayers, cS as resolveIntegrationOrmRuntimeClient, cz as resolveIntegrationPlugins, a1 as resolveMdxConfig, aq as resolveMigrationsConfig, df as routeRulesToHeaders, dg as routeRulesToNitroRouteRules, de as routeRulesToRedirects } from './client-plugins-DmcF3JHA.mjs';
|
|
3
3
|
export { FarmRenderer, FarmRendererCapabilities, FarmRendererCapabilitiesInput, FarmRendererStreamingCapabilities, REACT_RENDERER, defineRenderer } from './renderer.mjs';
|
|
4
|
-
export { f as fileExists, g as globFiles, l as logger, m as matchRoute, p as parseRoutePath,
|
|
4
|
+
export { f as fileExists, g as globFiles, l as logger, m as matchRoute, p as parseRoutePath, c as parseSearchParams, r as resolveAppPath, s as segmentsToPattern, a as toPosixPath, t as toRootRelativeUrlPath, b as toViteModuleId } from './utils--3v-RtD3.mjs';
|
|
5
5
|
export { createFarmStorage, createStorageClient, databaseStorage, defineStorageClient, disposeStorage, driverStorage, getStorage, initStorage, libsqlStorage, localStorage, memoryStorage, mongodbStorage, mysql2Storage, mysqlStorage, netlifyBlobsStorage, pgStorage, pgliteStorage, planetscaleStorage, postgresStorage, redisStorage, resolveStorageRuntimeClient, s3Storage, sqliteStorage, upstashStorage, vercelBlobStorage, vercelKVStorage } from './storage.mjs';
|
|
6
6
|
export { D as DEFAULT_FARM_API_BASE_PATH, l as FarmAPIConfig, j as FarmAPIConfigResolverContext, k as FarmAPIConfigValue, F as FarmIntegrationAPI, e as FarmIntegrationAPIBodyFormat, f as FarmIntegrationAPIMethod, a as FarmIntegrationAPIOperation, g as FarmIntegrationAPIResponseFormat, h as FarmIntegrationRouteOperationCarrier, I as InferIntegrationAPIFromRoutes, R as ResolvedFarmAPIConfig, b as api, d as defineIntegrationAPI, c as defineIntegrationAPIOperation, i as endpoint, o as getFarmAPIBaseURL, m as normalizeFarmAPIBasePath, n as normalizeFarmAPIConfig, r as resolveFarmAPIConfig, p as resolveFarmAPIRequestURL } from './config-DtTPh5Ml.mjs';
|
|
7
7
|
export { c as createFarmApp } from './app-WXv1CQZu.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as RouteModule, J as SSGCollectionResult, I as SSGPage, F as FarmConfig, aj as OpenAPIConfig, O as ResolvedFarmLayer, Q as FarmSourceRoot } from './client-plugins-Dql9bGKX.js';
|
|
2
2
|
export { bh as APIHandlerLifecyclePayload, bd as APIRouteDiscoveredPayload, A as AppRoutePattern, H as BuildOptions, bk as BundleLifecyclePayload, a5 as BundleResultPayload, c$ as CookieJar, d0 as CookieOptions, cQ as CreateIntegrationOrmOptions, dh as DEFAULT_FARM_DEVTOOLS_SHORTCUT, cw as DefinedIntegration, s as ErrorBoundary, bi as ErrorLifecyclePayload, E as ErrorProps, dj as FARM_DEVTOOLS_LAUNCH_PARAM, di as FARM_DEVTOOLS_PATH, bM as FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY, i as FarmAppContext, aG as FarmAuthConfig, aH as FarmAuthDatabaseConfig, aI as FarmAuthEmailAndPasswordConfig, aJ as FarmAuthSessionConfig, aK as FarmAuthUserConfig, a as FarmComponentType, h as FarmContextFactory, g as FarmContextFactoryInput, aA as FarmCspConfig, aC as FarmCspDirectiveValue, aB as FarmCspDirectives, aD as FarmCspOptions, bu as FarmDeployConfig, bw as FarmDeployTarget, dk as FarmDevtoolsConfig, dl as FarmDevtoolsUserConfig, a7 as FarmIntegration, bx as FarmIntegrationCategory, bQ as FarmIntegrationConfigContext, bR as FarmIntegrationConfigDefinition, bS as FarmIntegrationConfigInput, cj as FarmIntegrationContributedPlugin, bX as FarmIntegrationData, c5 as FarmIntegrationDocumentNavigation, cq as FarmIntegrationEndpointValue, cr as FarmIntegrationEndpoints, ct as FarmIntegrationEndpointsFactory, cs as FarmIntegrationEndpointsFactoryContext, bY as FarmIntegrationHandlerContext, bJ as FarmIntegrationInputSchema, bV as FarmIntegrationLifecycleContext, bW as FarmIntegrationLifecycleHook, bT as FarmIntegrationLifecycleLogLevel, bU as FarmIntegrationLifecycleLogger, cg as FarmIntegrationLogEvent, cf as FarmIntegrationLogPhase, ch as FarmIntegrationLogger, c2 as FarmIntegrationMiddleware, cL as FarmIntegrationOrmClient, cK as FarmIntegrationOrmSchema, ci as FarmIntegrationPluginOwner, c4 as FarmIntegrationProvider, c3 as FarmIntegrationProviderProps, bL as FarmIntegrationRequestContextStore, b$ as FarmIntegrationRoute, bP as FarmIntegrationRouteArgs, bN as FarmIntegrationRouteDb, cn as FarmIntegrationRouteFactory, b_ as FarmIntegrationRouteHook, bZ as FarmIntegrationRouteHookContext, bE as FarmIntegrationRouteInput, bK as FarmIntegrationRouteInputSchemas, bC as FarmIntegrationRouteInputSource, bB as FarmIntegrationRouteMethod, c1 as FarmIntegrationRouteMiddleware, bz as FarmIntegrationRouteParamValue, bA as FarmIntegrationRouteParams, bO as FarmIntegrationRouteStorageArgs, cp as FarmIntegrationRoutesFactory, co as FarmIntegrationRoutesFactoryContext, cd as FarmIntegrationSchema, c9 as FarmIntegrationSchemaConstraint, c8 as FarmIntegrationSchemaField, c6 as FarmIntegrationSchemaFieldType, ca as FarmIntegrationSchemaModel, cb as FarmIntegrationSchemaModelExtension, cc as FarmIntegrationSchemaModelOverride, c7 as FarmIntegrationSchemaReference, by as FarmIntegrationSlot, bI as FarmIntegrationStandardValidationResult, bG as FarmIntegrationValidationErrorLike, bF as FarmIntegrationValidationIssue, bD as FarmIntegrationValidationPathSegment, bH as FarmIntegrationValidationResult, ck as FarmIntegrationsUserConfig, av as FarmLayerConfig, K as FarmLayerEntry, a2 as FarmMdxComponent, $ as FarmMdxComponents, a0 as FarmMdxResolvedConfig, a3 as FarmMdxUserConfig, a9 as FarmMiddlewareConfig, b as FarmMigrationCommand, c as FarmMigrationsConfig, e as FarmMigrationsUserConfig, aw as FarmPerformanceConfig, a6 as FarmPlugin, b7 as FarmPluginBuildHooks, b9 as FarmPluginClientConfig, aM as FarmPluginContext, b8 as FarmPluginDevHooks, b4 as FarmPluginDiscoveredRoute, aN as FarmPluginIntegrationContext, aO as FarmPluginLifecycle, b6 as FarmPluginRenderHooks, aS as FarmPluginRouteRuntimePayload, b5 as FarmPluginRouterHooks, aY as FarmPluginRuntimeAfterEvent, aV as FarmPluginRuntimeBaseEvent, aX as FarmPluginRuntimeBeforeEvent, a$ as FarmPluginRuntimeCloseEvent, aW as FarmPluginRuntimeContextEvent, aZ as FarmPluginRuntimeErrorEvent, b0 as FarmPluginRuntimeHooks, aR as FarmPluginRuntimeKind, b2 as FarmPluginRuntimeRequestHandler, b1 as FarmPluginRuntimeRequestOptions, b3 as FarmPluginRuntimeSession, a_ as FarmPluginRuntimeStartEvent, aT as FarmPluginSetupContext, aU as FarmPluginStateContext, ax as FarmPreloadMode, ay as FarmPreloadUserConfig, y as FarmRequest, aP as FarmRequestPluginContext, aQ as FarmRequestStore, z as FarmResponse, db as FarmRouteRule, da as FarmRouteRuleCors, d9 as FarmRouteRuleRedirect, d8 as FarmRouteRuleRenderMode, dc as FarmRouteRules, al as FarmRuntimeShutdownError, aE as FarmSecurityConfig, c0 as FarmTypedIntegrationRoute, a4 as FarmUserConfig, G as GenerateStaticParams, bj as HMRUpdatePayload, bp as HeaderConfig, bs as I18nConfig, br as ImageConfig, cP as InferFarmIntegrationOrmClient, cM as InferFarmIntegrationOrmField, cN as InferFarmIntegrationOrmFields, cO as InferFarmIntegrationOrmSchema, cU as IntegrationOrmModelNames, q as Layout, o as LayoutMetadataProps, w as LayoutModule, m as LayoutProps, r as Loading, L as LoadingProps, d5 as MemoryRateLimitStorageOptions, x as Metadata, n as MetadataProps, c_ as MiddlewareChain, bt as MiddlewareConfig, cV as MiddlewareContext, bc as MiddlewareDiscoveredPayload, cW as MiddlewareFunction, M as MiddlewareProps, d7 as MiddlewareResult, cZ as MiddlewareStore, d6 as NextFunction, bl as NitroBuildLifecyclePayload, N as NitroPreset, p as Page, k as PageProps, l as PagePropsWithMiddleware, P as PageRouteParams, D as ParsedRoute, j as PluginContextProps, am as PluginManager, aL as PluginRequestContext, d1 as RateLimitConfig, d2 as RateLimitIncrementResult, d4 as RateLimitStatus, d3 as RateLimitStorage, a8 as ReadonlyMiddlewareStore, bo as RedirectConfig, bg as RenderLifecyclePayload, cX as RequestMiddleware, cY as RequestMiddlewareContext, ac as ResolvedFarmAuthConfig, bn as ResolvedFarmConfig, aF as ResolvedFarmCspConfig, bv as ResolvedFarmDeployConfig, ab as ResolvedFarmDevtoolsConfig, R as ResolvedFarmMigrationsConfig, ad as ResolvedFarmPerformanceConfig, az as ResolvedFarmPreloadConfig, ae as ResolvedFarmSecurityConfig, bq as RewriteConfig, ba as RouteDiscoveredPayload, be as RouteMatchPayload, bf as RouteMatchResultPayload, C as RouteSegment, bb as RoutesGeneratedPayload, B as ServerAction, bm as ShutdownPayload, u as StaticPathParams, S as StaticPathPrimitive, v as StaticRouteParams, cR as createIntegrationOrm, cu as createIntegrationRoute, cx as defineIntegration, ce as defineIntegrationSchema, ak as definePlugin, cJ as dispatchIntegrationRequest, cT as farmIntegrationSchemaToOrmSchema, at as getDeployTargetForPreset, X as getFarmAppDirectories, cm as getFarmIntegrationPluginOwner, cl as getFarmIntegrationPluginServerRuntime, Y as getFarmLayerAliases, W as getFarmSourceRoots, cB as getIntegrationDocumentNavigationMatchers, cA as getIntegrationProviders, cC as getIntegrationSchemas, au as getPresetForDeployTarget, cI as getRegisteredIntegrationAPIManifest, cD as getRegisteredIntegrationRuntime, cF as getRegisteredIntegrationSchemas, cE as getRegisteredIntegrations, cv as integrationRoute, cy as isFarmIntegration, ao as loadConfig, cG as matchIntegrationRoute, cH as matchRegisteredIntegrationRoute, as as normalizeDeployTarget, dd as normalizeRouteRules, an as resolveConfig, ap as resolveDeployConfig, ar as resolveDeployOutputPath, dm as resolveFarmDevtoolsConfig, V as resolveFarmLayers, cS as resolveIntegrationOrmRuntimeClient, cz as resolveIntegrationPlugins, a1 as resolveMdxConfig, aq as resolveMigrationsConfig, df as routeRulesToHeaders, dg as routeRulesToNitroRouteRules, de as routeRulesToRedirects } from './client-plugins-Dql9bGKX.js';
|
|
3
3
|
export { FarmRenderer, FarmRendererCapabilities, FarmRendererCapabilitiesInput, FarmRendererStreamingCapabilities, REACT_RENDERER, defineRenderer } from './renderer.js';
|
|
4
|
-
export { f as fileExists, g as globFiles, l as logger, m as matchRoute, p as parseRoutePath,
|
|
4
|
+
export { f as fileExists, g as globFiles, l as logger, m as matchRoute, p as parseRoutePath, c as parseSearchParams, r as resolveAppPath, s as segmentsToPattern, a as toPosixPath, t as toRootRelativeUrlPath, b as toViteModuleId } from './utils-J3ipMElz.js';
|
|
5
5
|
export { createFarmStorage, createStorageClient, databaseStorage, defineStorageClient, disposeStorage, driverStorage, getStorage, initStorage, libsqlStorage, localStorage, memoryStorage, mongodbStorage, mysql2Storage, mysqlStorage, netlifyBlobsStorage, pgStorage, pgliteStorage, planetscaleStorage, postgresStorage, redisStorage, resolveStorageRuntimeClient, s3Storage, sqliteStorage, upstashStorage, vercelBlobStorage, vercelKVStorage } from './storage.js';
|
|
6
6
|
export { D as DEFAULT_FARM_API_BASE_PATH, l as FarmAPIConfig, j as FarmAPIConfigResolverContext, k as FarmAPIConfigValue, F as FarmIntegrationAPI, e as FarmIntegrationAPIBodyFormat, f as FarmIntegrationAPIMethod, a as FarmIntegrationAPIOperation, g as FarmIntegrationAPIResponseFormat, h as FarmIntegrationRouteOperationCarrier, I as InferIntegrationAPIFromRoutes, R as ResolvedFarmAPIConfig, b as api, d as defineIntegrationAPI, c as defineIntegrationAPIOperation, i as endpoint, o as getFarmAPIBaseURL, m as normalizeFarmAPIBasePath, n as normalizeFarmAPIConfig, r as resolveFarmAPIConfig, p as resolveFarmAPIRequestURL } from './config-kwlUiWBX.js';
|
|
7
7
|
export { c as createFarmApp } from './app-DyqYhh1o.js';
|
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-5ZGPRGWV.mjs";
|
|
10
10
|
import {
|
|
11
11
|
build
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-UQ3PDDAK.mjs";
|
|
13
13
|
import "./chunk-SL6HTIOK.mjs";
|
|
14
14
|
import "./chunk-4S3ORGFA.mjs";
|
|
15
15
|
import {
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
isFarmDocsRequest,
|
|
26
26
|
loadFarmDocsPage,
|
|
27
27
|
resolveFarmDocsContentDir
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-DF6GAB63.mjs";
|
|
29
29
|
import "./chunk-V7RBCSDJ.mjs";
|
|
30
30
|
import {
|
|
31
31
|
usePathname,
|
|
@@ -77,14 +77,14 @@ import {
|
|
|
77
77
|
memoryRateLimitStorage,
|
|
78
78
|
middleware,
|
|
79
79
|
unwrapMiddleware
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-MHE2AMUC.mjs";
|
|
81
81
|
import {
|
|
82
82
|
applyProductionMiddlewareHeaders,
|
|
83
83
|
createProductionMiddlewareRunner
|
|
84
84
|
} from "./chunk-U6Z3C4DS.mjs";
|
|
85
85
|
import {
|
|
86
86
|
farmApiPlugin
|
|
87
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-ECGXDMBF.mjs";
|
|
88
88
|
import {
|
|
89
89
|
FARM_SERVER_QUERY_SYMBOL,
|
|
90
90
|
createServerQuery
|
|
@@ -104,7 +104,7 @@ import {
|
|
|
104
104
|
resolveDeployConfig,
|
|
105
105
|
resolveDeployOutputPath,
|
|
106
106
|
resolveMigrationsConfig
|
|
107
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-LIBL3V6K.mjs";
|
|
108
108
|
import {
|
|
109
109
|
defineConfig,
|
|
110
110
|
defineFarmConfig
|
|
@@ -208,7 +208,7 @@ import {
|
|
|
208
208
|
createClientPluginManager,
|
|
209
209
|
installChunkErrorRecovery,
|
|
210
210
|
isChunkLoadError
|
|
211
|
-
} from "./chunk-
|
|
211
|
+
} from "./chunk-DWG3W2FN.mjs";
|
|
212
212
|
import {
|
|
213
213
|
analyzeStaticRouteCandidate,
|
|
214
214
|
collectSSGPages,
|
|
@@ -227,7 +227,7 @@ import {
|
|
|
227
227
|
parseRouteRenderingDirective,
|
|
228
228
|
resolveRouteRenderingConfig,
|
|
229
229
|
resolveRouteRenderingConfigFromFile
|
|
230
|
-
} from "./chunk-
|
|
230
|
+
} from "./chunk-VVVDVGAS.mjs";
|
|
231
231
|
import {
|
|
232
232
|
APITypeGenerator
|
|
233
233
|
} from "./chunk-XJTDE4L4.mjs";
|
|
@@ -309,7 +309,7 @@ import {
|
|
|
309
309
|
prepareFarmWorkflowsForNitro,
|
|
310
310
|
resolveWorkflowsConfig,
|
|
311
311
|
runFarmWorkflowModule
|
|
312
|
-
} from "./chunk-
|
|
312
|
+
} from "./chunk-XY3B4K5E.mjs";
|
|
313
313
|
import {
|
|
314
314
|
DEFAULT_FARM_CRON_SECRET_ENV,
|
|
315
315
|
FARM_CRON_MANIFEST,
|
|
@@ -323,7 +323,7 @@ import {
|
|
|
323
323
|
mergeScheduledTasks,
|
|
324
324
|
prepareFarmCronForNitro,
|
|
325
325
|
resolveCronConfig
|
|
326
|
-
} from "./chunk-
|
|
326
|
+
} from "./chunk-RS5Z5M26.mjs";
|
|
327
327
|
import {
|
|
328
328
|
DEFAULT_SERVER_ACTION_BODY_SIZE_LIMIT,
|
|
329
329
|
FARM_SERVER_FN_FAILURE_SYMBOL,
|
|
@@ -407,7 +407,7 @@ import {
|
|
|
407
407
|
import {
|
|
408
408
|
MiddlewareManager,
|
|
409
409
|
createContext
|
|
410
|
-
} from "./chunk-
|
|
410
|
+
} from "./chunk-BOSVED4K.mjs";
|
|
411
411
|
import {
|
|
412
412
|
_runWithMiddlewareContext,
|
|
413
413
|
_runWithMiddlewareData,
|
|
@@ -424,7 +424,7 @@ import {
|
|
|
424
424
|
import {
|
|
425
425
|
APIRouteManager,
|
|
426
426
|
API_ROUTE_METHODS
|
|
427
|
-
} from "./chunk-
|
|
427
|
+
} from "./chunk-HB3XKQ5X.mjs";
|
|
428
428
|
import "./chunk-XJ65E7MB.mjs";
|
|
429
429
|
import "./chunk-FQYDHKKU.mjs";
|
|
430
430
|
import {
|
|
@@ -447,9 +447,10 @@ import {
|
|
|
447
447
|
parseSearchParams,
|
|
448
448
|
resolveAppPath,
|
|
449
449
|
segmentsToPattern,
|
|
450
|
+
toPosixPath,
|
|
450
451
|
toRootRelativeUrlPath,
|
|
451
452
|
toViteModuleId
|
|
452
|
-
} from "./chunk-
|
|
453
|
+
} from "./chunk-YB7QPRM4.mjs";
|
|
453
454
|
import "./chunk-QGOHVJ6J.mjs";
|
|
454
455
|
import {
|
|
455
456
|
DELETE,
|
|
@@ -567,7 +568,7 @@ import {
|
|
|
567
568
|
runWithFarmSpan
|
|
568
569
|
} from "./chunk-7ZMKVETU.mjs";
|
|
569
570
|
import "./chunk-FXG2PS27.mjs";
|
|
570
|
-
import "./chunk-
|
|
571
|
+
import "./chunk-X3JR4G7L.mjs";
|
|
571
572
|
import {
|
|
572
573
|
createCompressionPlugin,
|
|
573
574
|
createEnvPlugin,
|
|
@@ -1133,6 +1134,7 @@ export {
|
|
|
1133
1134
|
storageCacheAdapter,
|
|
1134
1135
|
titleFromMarkdown,
|
|
1135
1136
|
toFormData,
|
|
1137
|
+
toPosixPath,
|
|
1136
1138
|
toRootRelativeUrlPath,
|
|
1137
1139
|
toViteModuleId,
|
|
1138
1140
|
toggleTheme,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/provider.tsx","../src/hmr.ts","../src/openapi/scalar-component.tsx","../src/openapi/docs-route.tsx"],"sourcesContent":["import React, { createContext, useContext, type ReactNode } from \"react\";\nimport type { FarmConfig } from \"./types\";\n\ninterface FarmContextValue {\n config: FarmConfig;\n basePath: string;\n}\n\nconst FarmContext = createContext<FarmContextValue | null>(null);\n\ninterface FarmProviderProps {\n children: ReactNode;\n config: FarmConfig;\n}\n\n/**\n * Farm.js context provider for client-side components\n */\nexport function FarmProvider({ children, config }: FarmProviderProps) {\n const value: FarmContextValue = {\n config,\n basePath: config.basePath || \"/\",\n };\n\n return <FarmContext.Provider value={value}>{children}</FarmContext.Provider>;\n}\n\n/**\n * Hook to access Farm.js configuration and utilities\n */\nexport function useFarm(): FarmContextValue {\n const context = useContext(FarmContext);\n\n if (!context) {\n throw new Error(\"useFarm must be used within a FarmProvider\");\n }\n\n return context;\n}\n\n/**\n * Hook to get the current base path\n */\nexport function useBasePath(): string {\n const { basePath } = useFarm();\n return basePath;\n}\n","import type { ViteDevServer, ModuleNode } from \"vite\";\nimport { logger } from \"./utils\";\n\nexport class HMRManager {\n private server: ViteDevServer;\n\n constructor(server: ViteDevServer) {\n this.server = server;\n }\n\n /**\n * Send HMR update to client\n */\n async send(payload: any) {\n this.server.ws.send(payload);\n }\n\n /**\n * Trigger full page reload\n */\n async reloadPage() {\n this.server.ws.send({\n type: \"full-reload\",\n path: \"*\",\n });\n }\n\n /**\n * Handle file change and trigger HMR\n */\n async handleFileChange(file: string) {\n const module = await this.server.moduleGraph.getModuleByUrl(file);\n\n if (!module) {\n return;\n }\n\n // Invalidate module\n this.server.moduleGraph.invalidateModule(module);\n\n // Get affected modules\n const affectedModules = this.getAffectedModules(module);\n\n if (affectedModules.size === 0) {\n return;\n }\n\n if (file.includes(\"/app/\") && /\\/page\\.(?:tsx?|jsx?|vue|svelte)$/.test(file)) {\n await this.reloadPage();\n return;\n }\n\n if (file.includes(\"/app/\") && /\\/layout\\.(?:tsx?|jsx?|vue|svelte)$/.test(file)) {\n await this.reloadPage();\n return;\n }\n // Send update for other files\n this.send({\n type: \"update\",\n updates: Array.from(affectedModules).map((m) => ({\n type: m.type === \"css\" ? \"css-update\" : \"js-update\",\n path: m.url,\n acceptedPath: m.url,\n timestamp: Date.now(),\n })),\n });\n }\n\n /**\n * Get all affected modules in the dependency graph\n */\n private getAffectedModules(module: ModuleNode): Set<ModuleNode> {\n const affected = new Set<ModuleNode>();\n const seen = new Set<ModuleNode>();\n\n const traverse = (mod: ModuleNode) => {\n if (seen.has(mod)) return;\n seen.add(mod);\n affected.add(mod);\n\n // Traverse importers\n for (const importer of mod.importers) {\n if (!importer.isSelfAccepting) {\n traverse(importer);\n }\n }\n };\n\n traverse(module);\n return affected;\n }\n\n /**\n * Handle custom HMR events from client\n */\n onClientMessage(event: string, callback: (data: any) => void) {\n // Vite handles this via ws.on\n }\n}\n\n/**\n * Create HMR client code for injection\n */\nexport function createHMRClientCode(): string {\n return `\n// Farm.js HMR Client\nif (import.meta.hot) {\n // Accept HMR updates for this module\n import.meta.hot.accept((newModule) => {\n if (newModule) {\n // Module updated, trigger re-render\n window.location.reload();\n }\n });\n\n // Listen for custom Farm.js events\n import.meta.hot.on('farm:route-update', (data) => {\n console.log('Route updated:', data.path);\n window.location.reload();\n });\n\n // Handle CSS updates\n import.meta.hot.on('vite:beforeUpdate', () => {\n console.log('[Farm.js] HMR update incoming...');\n });\n\n import.meta.hot.on('vite:afterUpdate', () => {\n console.log('[Farm.js] HMR update applied ✓');\n });\n\n // Handle errors\n import.meta.hot.on('vite:error', (err) => {\n console.error('[Farm.js] HMR error:', err);\n });\n}\n`;\n}\n","import React from \"react\";\n\ninterface ScalarAPIDocumentationProps {\n spec: any;\n config?: {\n theme?: \"default\" | \"purple\" | \"blue\" | \"green\" | \"red\" | \"yellow\";\n layout?: \"modern\" | \"classic\";\n showSidebar?: boolean;\n hideDownloadButton?: boolean;\n hideTryItPanel?: boolean;\n };\n}\n\nexport function ScalarAPIDocumentation({ spec, config = {} }: ScalarAPIDocumentationProps) {\n const [isLoaded, setIsLoaded] = React.useState(false);\n\n React.useEffect(() => {\n // Dynamically import Scalar components\n const loadScalar = async () => {\n try {\n // Load Scalar CSS\n const cssLink = document.createElement(\"link\");\n cssLink.rel = \"stylesheet\";\n cssLink.href = \"https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest/dist/style.css\";\n document.head.appendChild(cssLink);\n\n // Load Scalar JS\n const script = document.createElement(\"script\");\n script.src =\n \"https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest/dist/browser/standalone.js\";\n script.onload = () => setIsLoaded(true);\n document.head.appendChild(script);\n } catch (error) {\n console.error(\"Failed to load Scalar:\", error);\n }\n };\n\n loadScalar();\n }, []);\n\n React.useEffect(() => {\n if (isLoaded && window.ScalarApiReference) {\n // Initialize Scalar\n const container = document.getElementById(\"scalar-api-reference\");\n if (container) {\n window.ScalarApiReference({\n spec,\n theme: config.theme || \"default\",\n layout: config.layout || \"modern\",\n showSidebar: config.showSidebar !== false,\n hideDownloadButton: config.hideDownloadButton || false,\n hideTryItPanel: config.hideTryItPanel || false,\n });\n }\n }\n }, [isLoaded, spec, config]);\n\n return (\n <div className=\"scalar-container\">\n <div id=\"scalar-api-reference\" style={{ height: \"100vh\", width: \"100%\" }} />\n </div>\n );\n}\n\n// Extend window type for Scalar\ndeclare global {\n interface Window {\n ScalarApiReference: (config: any) => void;\n }\n}\n","import React from \"react\";\nimport { ScalarAPIDocumentation } from \"./scalar-component\";\n\ninterface DocsRouteProps {\n spec: any;\n config?: any;\n}\n\nexport function DocsRoute({ spec, config }: DocsRouteProps) {\n return (\n <html lang=\"en\">\n <head>\n <meta charSet=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" href=\"data:,\" />\n <title>{config?.title || \"API Documentation\"}</title>\n <style>{`\n body {\n margin: 0;\n padding: 0;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;\n }\n .scalar-container {\n height: 100vh;\n width: 100%;\n }\n `}</style>\n </head>\n <body>\n <ScalarAPIDocumentation spec={spec} config={config} />\n </body>\n </html>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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hmr.ts","../src/openapi/scalar-component.tsx","../src/openapi/docs-route.tsx"],"sourcesContent":["import React, { createContext, useContext, type ReactNode } from \"react\";\nimport type { FarmConfig } from \"./types\";\n\ninterface FarmContextValue {\n config: FarmConfig;\n basePath: string;\n}\n\nconst FarmContext = createContext<FarmContextValue | null>(null);\n\ninterface FarmProviderProps {\n children: ReactNode;\n config: FarmConfig;\n}\n\n/**\n * Farm.js context provider for client-side components\n */\nexport function FarmProvider({ children, config }: FarmProviderProps) {\n const value: FarmContextValue = {\n config,\n basePath: config.basePath || \"/\",\n };\n\n return <FarmContext.Provider value={value}>{children}</FarmContext.Provider>;\n}\n\n/**\n * Hook to access Farm.js configuration and utilities\n */\nexport function useFarm(): FarmContextValue {\n const context = useContext(FarmContext);\n\n if (!context) {\n throw new Error(\"useFarm must be used within a FarmProvider\");\n }\n\n return context;\n}\n\n/**\n * Hook to get the current base path\n */\nexport function useBasePath(): string {\n const { basePath } = useFarm();\n return basePath;\n}\n","import type { ViteDevServer, ModuleNode } from \"vite\";\nimport { logger } from \"./utils\";\n\nexport class HMRManager {\n private server: ViteDevServer;\n\n constructor(server: ViteDevServer) {\n this.server = server;\n }\n\n /**\n * Send HMR update to client\n */\n async send(payload: any) {\n this.server.ws.send(payload);\n }\n\n /**\n * Trigger full page reload\n */\n async reloadPage() {\n this.server.ws.send({\n type: \"full-reload\",\n path: \"*\",\n });\n }\n\n /**\n * Handle file change and trigger HMR\n */\n async handleFileChange(file: string) {\n const module = await this.server.moduleGraph.getModuleByUrl(file);\n\n if (!module) {\n return;\n }\n\n // Invalidate module\n this.server.moduleGraph.invalidateModule(module);\n\n // Get affected modules\n const affectedModules = this.getAffectedModules(module);\n\n if (affectedModules.size === 0) {\n return;\n }\n\n if (file.includes(\"/app/\") && /\\/page\\.(?:tsx?|jsx?|vue|svelte)$/.test(file)) {\n await this.reloadPage();\n return;\n }\n\n if (file.includes(\"/app/\") && /\\/layout\\.(?:tsx?|jsx?|vue|svelte)$/.test(file)) {\n await this.reloadPage();\n return;\n }\n // Send update for other files\n this.send({\n type: \"update\",\n updates: Array.from(affectedModules).map((m) => ({\n type: m.type === \"css\" ? \"css-update\" : \"js-update\",\n path: m.url,\n acceptedPath: m.url,\n timestamp: Date.now(),\n })),\n });\n }\n\n /**\n * Get all affected modules in the dependency graph\n */\n private getAffectedModules(module: ModuleNode): Set<ModuleNode> {\n const affected = new Set<ModuleNode>();\n const seen = new Set<ModuleNode>();\n\n const traverse = (mod: ModuleNode) => {\n if (seen.has(mod)) return;\n seen.add(mod);\n affected.add(mod);\n\n // Traverse importers\n for (const importer of mod.importers) {\n if (!importer.isSelfAccepting) {\n traverse(importer);\n }\n }\n };\n\n traverse(module);\n return affected;\n }\n\n /**\n * Handle custom HMR events from client\n */\n onClientMessage(event: string, callback: (data: any) => void) {\n // Vite handles this via ws.on\n }\n}\n\n/**\n * Create HMR client code for injection\n */\nexport function createHMRClientCode(): string {\n return `\n// Farm.js HMR Client\nif (import.meta.hot) {\n // Accept HMR updates for this module\n import.meta.hot.accept((newModule) => {\n if (newModule) {\n // Module updated, trigger re-render\n window.location.reload();\n }\n });\n\n // Listen for custom Farm.js events\n import.meta.hot.on('farm:route-update', (data) => {\n console.log('Route updated:', data.path);\n window.location.reload();\n });\n\n // Handle CSS updates\n import.meta.hot.on('vite:beforeUpdate', () => {\n console.log('[Farm.js] HMR update incoming...');\n });\n\n import.meta.hot.on('vite:afterUpdate', () => {\n console.log('[Farm.js] HMR update applied ✓');\n });\n\n // Handle errors\n import.meta.hot.on('vite:error', (err) => {\n console.error('[Farm.js] HMR error:', err);\n });\n}\n`;\n}\n","import React from \"react\";\n\ninterface ScalarAPIDocumentationProps {\n spec: any;\n config?: {\n theme?: \"default\" | \"purple\" | \"blue\" | \"green\" | \"red\" | \"yellow\";\n layout?: \"modern\" | \"classic\";\n showSidebar?: boolean;\n hideDownloadButton?: boolean;\n hideTryItPanel?: boolean;\n };\n}\n\nexport function ScalarAPIDocumentation({ spec, config = {} }: ScalarAPIDocumentationProps) {\n const [isLoaded, setIsLoaded] = React.useState(false);\n\n React.useEffect(() => {\n // Dynamically import Scalar components\n const loadScalar = async () => {\n try {\n // Load Scalar CSS\n const cssLink = document.createElement(\"link\");\n cssLink.rel = \"stylesheet\";\n cssLink.href = \"https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest/dist/style.css\";\n document.head.appendChild(cssLink);\n\n // Load Scalar JS\n const script = document.createElement(\"script\");\n script.src =\n \"https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest/dist/browser/standalone.js\";\n script.onload = () => setIsLoaded(true);\n document.head.appendChild(script);\n } catch (error) {\n console.error(\"Failed to load Scalar:\", error);\n }\n };\n\n loadScalar();\n }, []);\n\n React.useEffect(() => {\n if (isLoaded && window.ScalarApiReference) {\n // Initialize Scalar\n const container = document.getElementById(\"scalar-api-reference\");\n if (container) {\n window.ScalarApiReference({\n spec,\n theme: config.theme || \"default\",\n layout: config.layout || \"modern\",\n showSidebar: config.showSidebar !== false,\n hideDownloadButton: config.hideDownloadButton || false,\n hideTryItPanel: config.hideTryItPanel || false,\n });\n }\n }\n }, [isLoaded, spec, config]);\n\n return (\n <div className=\"scalar-container\">\n <div id=\"scalar-api-reference\" style={{ height: \"100vh\", width: \"100%\" }} />\n </div>\n );\n}\n\n// Extend window type for Scalar\ndeclare global {\n interface Window {\n ScalarApiReference: (config: any) => void;\n }\n}\n","import React from \"react\";\nimport { ScalarAPIDocumentation } from \"./scalar-component\";\n\ninterface DocsRouteProps {\n spec: any;\n config?: any;\n}\n\nexport function DocsRoute({ spec, config }: DocsRouteProps) {\n return (\n <html lang=\"en\">\n <head>\n <meta charSet=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" href=\"data:,\" />\n <title>{config?.title || \"API Documentation\"}</title>\n <style>{`\n body {\n margin: 0;\n padding: 0;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;\n }\n .scalar-container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