@farm.js/core 0.1.0-beta.44 → 0.1.0-beta.46

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.
Files changed (84) hide show
  1. package/dist/api/route-manager.cjs.map +1 -1
  2. package/dist/api/route-manager.mjs +2 -2
  3. package/dist/api.cjs.map +1 -1
  4. package/dist/api.mjs +3 -3
  5. package/dist/{chunk-EPBXX44K.mjs → chunk-3UUEBVR3.mjs} +3 -3
  6. package/dist/{chunk-IRYMQRYJ.mjs → chunk-ECLWCE4H.mjs} +2 -2
  7. package/dist/{chunk-MYNLKNAW.mjs → chunk-EHUGMAWL.mjs} +2 -2
  8. package/dist/{chunk-FY34HLY7.mjs → chunk-LGCIIMFR.mjs} +2 -2
  9. package/dist/{chunk-FY34HLY7.mjs.map → chunk-LGCIIMFR.mjs.map} +1 -1
  10. package/dist/{chunk-MU2QKVYL.mjs → chunk-MP2SDRRB.mjs} +2 -2
  11. package/dist/{chunk-VHYARVB7.mjs → chunk-TIESOJ7Z.mjs} +2 -2
  12. package/dist/{chunk-LIIZPHDO.mjs → chunk-TQJMU5BP.mjs} +16 -16
  13. package/dist/chunk-TQJMU5BP.mjs.map +1 -0
  14. package/dist/{chunk-KEPCW6EI.mjs → chunk-U5SPS2HR.mjs} +10 -1
  15. package/dist/chunk-U5SPS2HR.mjs.map +1 -0
  16. package/dist/{chunk-4MYKKWR4.mjs → chunk-V7VDW7IY.mjs} +7 -7
  17. package/dist/{chunk-BQWTEZSS.mjs → chunk-W2O6SKJU.mjs} +2 -2
  18. package/dist/{chunk-X4MNGHCU.mjs → chunk-XR7M5VXU.mjs} +2 -2
  19. package/dist/{chunk-TUYEGV7H.mjs → chunk-YKAUAZA4.mjs} +7 -3
  20. package/dist/chunk-YKAUAZA4.mjs.map +1 -0
  21. package/dist/client/lifecycle.mjs +2 -2
  22. package/dist/client-plugins.cjs +1 -1
  23. package/dist/client-plugins.cjs.map +1 -1
  24. package/dist/client-plugins.mjs +2 -2
  25. package/dist/client.cjs +1 -1
  26. package/dist/client.cjs.map +1 -1
  27. package/dist/client.mjs +2 -2
  28. package/dist/{devtools-3MSKJ4TE.mjs → devtools-BUFIHBX3.mjs} +3 -3
  29. package/dist/docs.cjs.map +1 -1
  30. package/dist/docs.mjs +3 -3
  31. package/dist/index.cjs +24 -11
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.mts +1 -1
  34. package/dist/index.d.ts +1 -1
  35. package/dist/index.mjs +14 -12
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/internal/build-runtime.cjs +22 -11
  38. package/dist/internal/build-runtime.cjs.map +1 -1
  39. package/dist/internal/build-runtime.d.mts +1 -1
  40. package/dist/internal/build-runtime.d.ts +1 -1
  41. package/dist/internal/build-runtime.mjs +9 -9
  42. package/dist/internal/client-runtime.cjs +1 -1
  43. package/dist/internal/client-runtime.cjs.map +1 -1
  44. package/dist/internal/client-runtime.mjs +2 -2
  45. package/dist/internal/config-runtime.cjs +6 -2
  46. package/dist/internal/config-runtime.cjs.map +1 -1
  47. package/dist/internal/config-runtime.d.mts +1 -1
  48. package/dist/internal/config-runtime.d.ts +1 -1
  49. package/dist/internal/config-runtime.mjs +3 -3
  50. package/dist/{layers-3ZHU4XTZ.mjs → layers-KJI5XUAP.mjs} +2 -2
  51. package/dist/middleware.cjs.map +1 -1
  52. package/dist/middleware.mjs +3 -3
  53. package/dist/plugin.cjs +16 -9
  54. package/dist/plugin.cjs.map +1 -1
  55. package/dist/plugin.mjs +6 -6
  56. package/dist/server.cjs +24 -11
  57. package/dist/server.cjs.map +1 -1
  58. package/dist/server.d.mts +1 -1
  59. package/dist/server.d.ts +1 -1
  60. package/dist/server.mjs +9 -7
  61. package/dist/server.mjs.map +1 -1
  62. package/dist/testing.mjs +2 -2
  63. package/dist/{utils-CjZRiq-l.d.mts → utils-9OPxcT1T.d.mts} +9 -1
  64. package/dist/{utils-_LOF-V9f.d.ts → utils-CIIoLfn9.d.ts} +9 -1
  65. package/dist/version.cjs +1 -1
  66. package/dist/version.cjs.map +1 -1
  67. package/dist/version.mjs +1 -1
  68. package/dist/vite.cjs +22 -11
  69. package/dist/vite.cjs.map +1 -1
  70. package/dist/vite.mjs +6 -6
  71. package/package.json +1 -1
  72. package/dist/chunk-KEPCW6EI.mjs.map +0 -1
  73. package/dist/chunk-LIIZPHDO.mjs.map +0 -1
  74. package/dist/chunk-TUYEGV7H.mjs.map +0 -1
  75. /package/dist/{chunk-EPBXX44K.mjs.map → chunk-3UUEBVR3.mjs.map} +0 -0
  76. /package/dist/{chunk-IRYMQRYJ.mjs.map → chunk-ECLWCE4H.mjs.map} +0 -0
  77. /package/dist/{chunk-MYNLKNAW.mjs.map → chunk-EHUGMAWL.mjs.map} +0 -0
  78. /package/dist/{chunk-MU2QKVYL.mjs.map → chunk-MP2SDRRB.mjs.map} +0 -0
  79. /package/dist/{chunk-VHYARVB7.mjs.map → chunk-TIESOJ7Z.mjs.map} +0 -0
  80. /package/dist/{chunk-4MYKKWR4.mjs.map → chunk-V7VDW7IY.mjs.map} +0 -0
  81. /package/dist/{chunk-BQWTEZSS.mjs.map → chunk-W2O6SKJU.mjs.map} +0 -0
  82. /package/dist/{chunk-X4MNGHCU.mjs.map → chunk-XR7M5VXU.mjs.map} +0 -0
  83. /package/dist/{devtools-3MSKJ4TE.mjs.map → devtools-BUFIHBX3.mjs.map} +0 -0
  84. /package/dist/{layers-3ZHU4XTZ.mjs.map → layers-KJI5XUAP.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, a as parseSearchParams, r as resolveAppPath, s as segmentsToPattern, t as toViteModuleId } from './utils-CjZRiq-l.mjs';
4
+ export { f as fileExists, g as globFiles, l as logger, m as matchRoute, p as parseRoutePath, b as parseSearchParams, r as resolveAppPath, s as segmentsToPattern, t as toRootRelativeUrlPath, a as toViteModuleId } from './utils-9OPxcT1T.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, a as parseSearchParams, r as resolveAppPath, s as segmentsToPattern, t as toViteModuleId } from './utils-_LOF-V9f.js';
4
+ export { f as fileExists, g as globFiles, l as logger, m as matchRoute, p as parseRoutePath, b as parseSearchParams, r as resolveAppPath, s as segmentsToPattern, t as toRootRelativeUrlPath, a as toViteModuleId } from './utils-CIIoLfn9.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-4MYKKWR4.mjs";
12
+ } from "./chunk-V7VDW7IY.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-X4MNGHCU.mjs";
28
+ } from "./chunk-XR7M5VXU.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-IRYMQRYJ.mjs";
80
+ } from "./chunk-ECLWCE4H.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-EPBXX44K.mjs";
87
+ } from "./chunk-3UUEBVR3.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-MYNLKNAW.mjs";
107
+ } from "./chunk-EHUGMAWL.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-BQWTEZSS.mjs";
211
+ } from "./chunk-W2O6SKJU.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-LIIZPHDO.mjs";
230
+ } from "./chunk-TQJMU5BP.mjs";
231
231
  import {
232
232
  APITypeGenerator
233
233
  } from "./chunk-XJTDE4L4.mjs";
@@ -270,7 +270,7 @@ import {
270
270
  getFarmLayerAliases,
271
271
  getFarmSourceRoots,
272
272
  resolveFarmLayers
273
- } from "./chunk-TUYEGV7H.mjs";
273
+ } from "./chunk-YKAUAZA4.mjs";
274
274
  import "./chunk-7ZVN3YZI.mjs";
275
275
  import "./chunk-GY2STC2S.mjs";
276
276
  import {
@@ -407,7 +407,7 @@ import {
407
407
  import {
408
408
  MiddlewareManager,
409
409
  createContext
410
- } from "./chunk-VHYARVB7.mjs";
410
+ } from "./chunk-TIESOJ7Z.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-MU2QKVYL.mjs";
427
+ } from "./chunk-MP2SDRRB.mjs";
428
428
  import "./chunk-XJ65E7MB.mjs";
429
429
  import "./chunk-FQYDHKKU.mjs";
430
430
  import {
@@ -447,8 +447,9 @@ import {
447
447
  parseSearchParams,
448
448
  resolveAppPath,
449
449
  segmentsToPattern,
450
+ toRootRelativeUrlPath,
450
451
  toViteModuleId
451
- } from "./chunk-KEPCW6EI.mjs";
452
+ } from "./chunk-U5SPS2HR.mjs";
452
453
  import "./chunk-QGOHVJ6J.mjs";
453
454
  import {
454
455
  DELETE,
@@ -566,7 +567,7 @@ import {
566
567
  runWithFarmSpan
567
568
  } from "./chunk-7ZMKVETU.mjs";
568
569
  import "./chunk-FXG2PS27.mjs";
569
- import "./chunk-FY34HLY7.mjs";
570
+ import "./chunk-LGCIIMFR.mjs";
570
571
  import {
571
572
  createCompressionPlugin,
572
573
  createEnvPlugin,
@@ -1132,6 +1133,7 @@ export {
1132
1133
  storageCacheAdapter,
1133
1134
  titleFromMarkdown,
1134
1135
  toFormData,
1136
+ toRootRelativeUrlPath,
1135
1137
  toViteModuleId,
1136
1138
  toggleTheme,
1137
1139
  unstable_cache,
@@ -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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AAA,MAC7C,gBAAAA,KAAC,WAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAUN;AAAA,OACJ;AAAA,IACA,gBAAAA,KAAC,UACC,0BAAAA,KAAC,0BAAuB,MAAY,QAAgB,GACtD;AAAA,KACF;AAEJ;AAzBgB;","names":["createContext","createContext","React","jsx","React","jsx"]}
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAgB,iBAAAA,gBAAe,kBAAkC;AAwBxD;AAhBT,IAAM,cAAcC,eAAuC,IAAI;AAUxD,SAAS,aAAa,EAAE,UAAU,OAAO,GAAsB;AACpE,QAAM,QAA0B;AAAA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,UACvB,QAAQ,OAAO,UAAU;AAAA,UACzB,aAAa,OAAO,gBAAgB;AAAA,UACpC,oBAAoB,OAAO,sBAAsB;AAAA,UACjD,gBAAgB,OAAO,kBAAkB;AAAA,QAC3C,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF,GAAG,CAAC,UAAU,MAAM,MAAM,CAAC;AAE3B,SACE,gBAAAD,KAAC,SAAI,WAAU,oBACb,0BAAAA,KAAC,SAAI,IAAG,wBAAuB,OAAO,EAAE,QAAQ,SAAS,OAAO,OAAO,GAAG,GAC5E;AAEJ;AAjDgB;;;ACFV,SACE,OAAAE,MADF;AAHC,SAAS,UAAU,EAAE,MAAM,OAAO,GAAmB;AAC1D,SACE,qBAAC,UAAK,MAAK,MACT;AAAA,yBAAC,UACC;AAAA,sBAAAA,KAAC,UAAK,SAAQ,SAAQ;AAAA,MACtB,gBAAAA,KAAC,UAAK,MAAK,YAAW,SAAQ,uCAAsC;AAAA,MACpE,gBAAAA,KAAC,UAAK,KAAI,QAAO,MAAK,UAAS;AAAA,MAC/B,gBAAAA,KAAC,WAAO,kBAAQ,SAAS,qBAAoB;AAAA,MAC7C,gBAAAA,KAAC,WAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAUN;AAAA,OACJ;AAAA,IACA,gBAAAA,KAAC,UACC,0BAAAA,KAAC,0BAAuB,MAAY,QAAgB,GACtD;AAAA,KACF;AAEJ;AAzBgB;","names":["createContext","createContext","React","jsx","React","jsx"]}
@@ -4759,6 +4759,9 @@ function getFarmLayerAliases(layers) {
4759
4759
  (layers ?? []).map((layer) => [`#layers/${layer.name}`, import_node_path.default.join(layer.root, layer.srcDir)])
4760
4760
  );
4761
4761
  }
4762
+ function toExternalSpecifier(resolvedPath) {
4763
+ return import_node_path.default.isAbsolute(resolvedPath) ? (0, import_node_url.pathToFileURL)(resolvedPath).href : resolvedPath;
4764
+ }
4762
4765
  function createFarmConfigResolutionPlugin(options) {
4763
4766
  const configEntryChecks = /* @__PURE__ */ new Map();
4764
4767
  return {
@@ -4783,7 +4786,7 @@ function createFarmConfigResolutionPlugin(options) {
4783
4786
  });
4784
4787
  if (resolved.errors.length > 0 || !resolved.path) return;
4785
4788
  return {
4786
- path: resolved.path,
4789
+ path: toExternalSpecifier(resolved.path),
4787
4790
  external: true,
4788
4791
  warnings: resolved.warnings
4789
4792
  };
@@ -4804,7 +4807,7 @@ function createFarmConfigResolutionPlugin(options) {
4804
4807
  return { path: args.path, external: true };
4805
4808
  }
4806
4809
  return {
4807
- path: resolved.path,
4810
+ path: toExternalSpecifier(resolved.path),
4808
4811
  external: true,
4809
4812
  warnings: resolved.warnings
4810
4813
  };
@@ -5090,6 +5093,7 @@ var init_layers = __esm({
5090
5093
  __name(getFarmAppDirectories, "getFarmAppDirectories");
5091
5094
  __name(getFarmLayerAliases, "getFarmLayerAliases");
5092
5095
  WINDOWS_ABSOLUTE_PATH_RE = /^(?:[A-Za-z]:[\\/]|\\\\)/;
5096
+ __name(toExternalSpecifier, "toExternalSpecifier");
5093
5097
  __name(createFarmConfigResolutionPlugin, "createFarmConfigResolutionPlugin");
5094
5098
  __name(loadFarmConfigFile, "loadFarmConfigFile");
5095
5099
  __name(onlyImportsFarmConfigHelpers, "onlyImportsFarmConfigHelpers");
@@ -6612,6 +6616,13 @@ function matchRoute(url, segments) {
6612
6616
  function resolveAppPath(root, ...paths) {
6613
6617
  return import_path2.default.resolve(root, ...paths);
6614
6618
  }
6619
+ function toRootRelativeUrlPath(absolutePath, projectRoot) {
6620
+ if (absolutePath === projectRoot) return "";
6621
+ if (absolutePath.startsWith(`${projectRoot}/`) || absolutePath.startsWith(`${projectRoot}\\`)) {
6622
+ return absolutePath.slice(projectRoot.length).replace(/\\/g, "/");
6623
+ }
6624
+ return void 0;
6625
+ }
6615
6626
  function toViteModuleId(filePath, root) {
6616
6627
  if (!import_path2.default.isAbsolute(filePath)) return filePath;
6617
6628
  const relativePath2 = import_path2.default.relative(root, filePath);
@@ -6643,6 +6654,7 @@ var init_utils = __esm({
6643
6654
  __name(getRouteType, "getRouteType");
6644
6655
  __name(matchRoute, "matchRoute");
6645
6656
  __name(resolveAppPath, "resolveAppPath");
6657
+ __name(toRootRelativeUrlPath, "toRootRelativeUrlPath");
6646
6658
  __name(toViteModuleId, "toViteModuleId");
6647
6659
  __name(fileExists, "fileExists");
6648
6660
  __name(globFiles, "globFiles");
@@ -10761,9 +10773,8 @@ var init_route_manager = __esm({
10761
10773
  return this.clientManifestCache.manifest;
10762
10774
  }
10763
10775
  const toUrlPath = /* @__PURE__ */ __name((absolutePath) => {
10764
- if (absolutePath === normalizedProjectRoot || absolutePath.startsWith(`${normalizedProjectRoot}${import_path6.default.sep}`)) {
10765
- return absolutePath.slice(normalizedProjectRoot.length);
10766
- }
10776
+ const rootRelative = toRootRelativeUrlPath(absolutePath, normalizedProjectRoot);
10777
+ if (rootRelative !== void 0) return rootRelative;
10767
10778
  if (import_path6.default.isAbsolute(absolutePath)) {
10768
10779
  const normalized = absolutePath.replace(/\\/g, "/");
10769
10780
  return normalized.startsWith("/") ? `/@fs${normalized}` : `/@fs/${normalized}`;
@@ -14847,7 +14858,7 @@ var init_server3 = __esm({
14847
14858
  var version;
14848
14859
  var init_package = __esm({
14849
14860
  "package.json"() {
14850
- version = "0.1.0-beta.44";
14861
+ version = "0.1.0-beta.46";
14851
14862
  }
14852
14863
  });
14853
14864
 
@@ -15895,7 +15906,7 @@ var init_renderer2 = __esm({
15895
15906
  );
15896
15907
  const clientLayouts = layouts.map((layout2, index) => ({
15897
15908
  pattern: layout2.pattern,
15898
- modulePath: layout2.modulePath.startsWith(this.config.root) ? layout2.modulePath.slice(this.config.root.length) : layout2.modulePath,
15909
+ modulePath: toRootRelativeUrlPath(layout2.modulePath, this.config.root) ?? layout2.modulePath,
15899
15910
  shouldHydrate: layoutHydrationMetadata[index]?.shouldHydrate === true,
15900
15911
  islandStrategy: layoutHydrationMetadata[index]?.islandStrategy ?? null
15901
15912
  }));
@@ -16471,7 +16482,7 @@ var init_renderer2 = __esm({
16471
16482
  const routeSlots = (req.__FARM_ROUTE_SLOTS__ || []).map(
16472
16483
  (slot) => ({
16473
16484
  ...slot,
16474
- modulePath: typeof slot.modulePath === "string" && slot.modulePath.startsWith(this.config.root) ? slot.modulePath.slice(this.config.root.length) : slot.modulePath
16485
+ modulePath: typeof slot.modulePath === "string" ? toRootRelativeUrlPath(slot.modulePath, this.config.root) ?? slot.modulePath : slot.modulePath
16475
16486
  })
16476
16487
  );
16477
16488
  const deferredProps = prepareDeferredData({
@@ -16479,7 +16490,7 @@ var init_renderer2 = __esm({
16479
16490
  slots: routeSlots
16480
16491
  });
16481
16492
  const pagePath = req.__FARM_PAGE_PATH__;
16482
- const relativePath2 = pagePath ? pagePath.startsWith(this.config.root) ? pagePath.slice(this.config.root.length) : pagePath : "/src/app/page.tsx";
16493
+ const relativePath2 = pagePath ? toRootRelativeUrlPath(pagePath, this.config.root) ?? pagePath : "/src/app/page.tsx";
16483
16494
  const deploymentId = this.getDeploymentId();
16484
16495
  const bootstrapScript = `<script>
16485
16496
  window.__FARM_PROPS__ = ${serializeInlineValue2(deferredProps.data.page)};
@@ -16575,7 +16586,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
16575
16586
  let didError = false;
16576
16587
  const pagePath = req.__FARM_PAGE_PATH__;
16577
16588
  const isClientComponent = req.__FARM_IS_CLIENT_COMPONENT__ === true;
16578
- const relativePath2 = pagePath ? pagePath.startsWith(this.config.root) ? pagePath.slice(this.config.root.length) : pagePath : "/src/app/page.tsx";
16589
+ const relativePath2 = pagePath ? toRootRelativeUrlPath(pagePath, this.config.root) ?? pagePath : "/src/app/page.tsx";
16579
16590
  const manifest = options.routeManifest ?? this.routeManager.generateClientManifest(this.config.root);
16580
16591
  const clientManifest = {
16581
16592
  clientEntry: "/@farm/client.js",
@@ -16623,7 +16634,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
16623
16634
  const routeSlotPayload = (req.__FARM_ROUTE_SLOTS__ || []).map(
16624
16635
  (slot) => ({
16625
16636
  ...slot,
16626
- modulePath: typeof slot.modulePath === "string" && slot.modulePath.startsWith(this.config.root) ? slot.modulePath.slice(this.config.root.length) : slot.modulePath
16637
+ modulePath: typeof slot.modulePath === "string" ? toRootRelativeUrlPath(slot.modulePath, this.config.root) ?? slot.modulePath : slot.modulePath
16627
16638
  })
16628
16639
  );
16629
16640
  const deferredProps = prepareDeferredData({