@farm.js/core 0.1.0-beta.45 → 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 (70) 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-FLGRRGVU.mjs → chunk-LGCIIMFR.mjs} +2 -2
  8. package/dist/{chunk-FLGRRGVU.mjs.map → chunk-LGCIIMFR.mjs.map} +1 -1
  9. package/dist/{chunk-MU2QKVYL.mjs → chunk-MP2SDRRB.mjs} +2 -2
  10. package/dist/{chunk-VHYARVB7.mjs → chunk-TIESOJ7Z.mjs} +2 -2
  11. package/dist/{chunk-6NCLVPI7.mjs → chunk-TQJMU5BP.mjs} +13 -13
  12. package/dist/chunk-TQJMU5BP.mjs.map +1 -0
  13. package/dist/{chunk-KEPCW6EI.mjs → chunk-U5SPS2HR.mjs} +10 -1
  14. package/dist/chunk-U5SPS2HR.mjs.map +1 -0
  15. package/dist/{chunk-IWPBMZGE.mjs → chunk-V7VDW7IY.mjs} +4 -4
  16. package/dist/{chunk-QLCUQD3U.mjs → chunk-W2O6SKJU.mjs} +2 -2
  17. package/dist/client/lifecycle.mjs +2 -2
  18. package/dist/client-plugins.cjs +1 -1
  19. package/dist/client-plugins.cjs.map +1 -1
  20. package/dist/client-plugins.mjs +2 -2
  21. package/dist/client.cjs +1 -1
  22. package/dist/client.cjs.map +1 -1
  23. package/dist/client.mjs +2 -2
  24. package/dist/index.cjs +18 -9
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.mts +1 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.mjs +11 -9
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/internal/build-runtime.cjs +16 -9
  31. package/dist/internal/build-runtime.cjs.map +1 -1
  32. package/dist/internal/build-runtime.d.mts +1 -1
  33. package/dist/internal/build-runtime.d.ts +1 -1
  34. package/dist/internal/build-runtime.mjs +6 -6
  35. package/dist/internal/client-runtime.cjs +1 -1
  36. package/dist/internal/client-runtime.cjs.map +1 -1
  37. package/dist/internal/client-runtime.mjs +2 -2
  38. package/dist/internal/config-runtime.cjs.map +1 -1
  39. package/dist/internal/config-runtime.d.mts +1 -1
  40. package/dist/internal/config-runtime.d.ts +1 -1
  41. package/dist/internal/config-runtime.mjs +1 -1
  42. package/dist/middleware.cjs.map +1 -1
  43. package/dist/middleware.mjs +3 -3
  44. package/dist/plugin.cjs +16 -9
  45. package/dist/plugin.cjs.map +1 -1
  46. package/dist/plugin.mjs +5 -5
  47. package/dist/server.cjs +18 -9
  48. package/dist/server.cjs.map +1 -1
  49. package/dist/server.d.mts +1 -1
  50. package/dist/server.d.ts +1 -1
  51. package/dist/server.mjs +7 -5
  52. package/dist/server.mjs.map +1 -1
  53. package/dist/testing.mjs +2 -2
  54. package/dist/{utils-CjZRiq-l.d.mts → utils-9OPxcT1T.d.mts} +9 -1
  55. package/dist/{utils-_LOF-V9f.d.ts → utils-CIIoLfn9.d.ts} +9 -1
  56. package/dist/version.cjs +1 -1
  57. package/dist/version.cjs.map +1 -1
  58. package/dist/version.mjs +1 -1
  59. package/dist/vite.cjs +16 -9
  60. package/dist/vite.cjs.map +1 -1
  61. package/dist/vite.mjs +5 -5
  62. package/package.json +1 -1
  63. package/dist/chunk-6NCLVPI7.mjs.map +0 -1
  64. package/dist/chunk-KEPCW6EI.mjs.map +0 -1
  65. /package/dist/{chunk-EPBXX44K.mjs.map → chunk-3UUEBVR3.mjs.map} +0 -0
  66. /package/dist/{chunk-IRYMQRYJ.mjs.map → chunk-ECLWCE4H.mjs.map} +0 -0
  67. /package/dist/{chunk-MU2QKVYL.mjs.map → chunk-MP2SDRRB.mjs.map} +0 -0
  68. /package/dist/{chunk-VHYARVB7.mjs.map → chunk-TIESOJ7Z.mjs.map} +0 -0
  69. /package/dist/{chunk-IWPBMZGE.mjs.map → chunk-V7VDW7IY.mjs.map} +0 -0
  70. /package/dist/{chunk-QLCUQD3U.mjs.map → chunk-W2O6SKJU.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-IWPBMZGE.mjs";
12
+ } from "./chunk-V7VDW7IY.mjs";
13
13
  import "./chunk-SL6HTIOK.mjs";
14
14
  import "./chunk-4S3ORGFA.mjs";
15
15
  import {
@@ -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
@@ -208,7 +208,7 @@ import {
208
208
  createClientPluginManager,
209
209
  installChunkErrorRecovery,
210
210
  isChunkLoadError
211
- } from "./chunk-QLCUQD3U.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-6NCLVPI7.mjs";
230
+ } from "./chunk-TQJMU5BP.mjs";
231
231
  import {
232
232
  APITypeGenerator
233
233
  } from "./chunk-XJTDE4L4.mjs";
@@ -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-FLGRRGVU.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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;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,IAC9B;AAAA,IACA,UAAU,OAAO,YAAY;AAAA,EAC/B;AAEA,SAAO,oBAAC,YAAY,UAAZ,EA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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"]}
@@ -6616,6 +6616,13 @@ function matchRoute(url, segments) {
6616
6616
  function resolveAppPath(root, ...paths) {
6617
6617
  return import_path2.default.resolve(root, ...paths);
6618
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
+ }
6619
6626
  function toViteModuleId(filePath, root) {
6620
6627
  if (!import_path2.default.isAbsolute(filePath)) return filePath;
6621
6628
  const relativePath2 = import_path2.default.relative(root, filePath);
@@ -6647,6 +6654,7 @@ var init_utils = __esm({
6647
6654
  __name(getRouteType, "getRouteType");
6648
6655
  __name(matchRoute, "matchRoute");
6649
6656
  __name(resolveAppPath, "resolveAppPath");
6657
+ __name(toRootRelativeUrlPath, "toRootRelativeUrlPath");
6650
6658
  __name(toViteModuleId, "toViteModuleId");
6651
6659
  __name(fileExists, "fileExists");
6652
6660
  __name(globFiles, "globFiles");
@@ -10765,9 +10773,8 @@ var init_route_manager = __esm({
10765
10773
  return this.clientManifestCache.manifest;
10766
10774
  }
10767
10775
  const toUrlPath = /* @__PURE__ */ __name((absolutePath) => {
10768
- if (absolutePath === normalizedProjectRoot || absolutePath.startsWith(`${normalizedProjectRoot}${import_path6.default.sep}`)) {
10769
- return absolutePath.slice(normalizedProjectRoot.length);
10770
- }
10776
+ const rootRelative = toRootRelativeUrlPath(absolutePath, normalizedProjectRoot);
10777
+ if (rootRelative !== void 0) return rootRelative;
10771
10778
  if (import_path6.default.isAbsolute(absolutePath)) {
10772
10779
  const normalized = absolutePath.replace(/\\/g, "/");
10773
10780
  return normalized.startsWith("/") ? `/@fs${normalized}` : `/@fs/${normalized}`;
@@ -14851,7 +14858,7 @@ var init_server3 = __esm({
14851
14858
  var version;
14852
14859
  var init_package = __esm({
14853
14860
  "package.json"() {
14854
- version = "0.1.0-beta.45";
14861
+ version = "0.1.0-beta.46";
14855
14862
  }
14856
14863
  });
14857
14864
 
@@ -15899,7 +15906,7 @@ var init_renderer2 = __esm({
15899
15906
  );
15900
15907
  const clientLayouts = layouts.map((layout2, index) => ({
15901
15908
  pattern: layout2.pattern,
15902
- 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,
15903
15910
  shouldHydrate: layoutHydrationMetadata[index]?.shouldHydrate === true,
15904
15911
  islandStrategy: layoutHydrationMetadata[index]?.islandStrategy ?? null
15905
15912
  }));
@@ -16475,7 +16482,7 @@ var init_renderer2 = __esm({
16475
16482
  const routeSlots = (req.__FARM_ROUTE_SLOTS__ || []).map(
16476
16483
  (slot) => ({
16477
16484
  ...slot,
16478
- 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
16479
16486
  })
16480
16487
  );
16481
16488
  const deferredProps = prepareDeferredData({
@@ -16483,7 +16490,7 @@ var init_renderer2 = __esm({
16483
16490
  slots: routeSlots
16484
16491
  });
16485
16492
  const pagePath = req.__FARM_PAGE_PATH__;
16486
- 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";
16487
16494
  const deploymentId = this.getDeploymentId();
16488
16495
  const bootstrapScript = `<script>
16489
16496
  window.__FARM_PROPS__ = ${serializeInlineValue2(deferredProps.data.page)};
@@ -16579,7 +16586,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
16579
16586
  let didError = false;
16580
16587
  const pagePath = req.__FARM_PAGE_PATH__;
16581
16588
  const isClientComponent = req.__FARM_IS_CLIENT_COMPONENT__ === true;
16582
- 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";
16583
16590
  const manifest = options.routeManifest ?? this.routeManager.generateClientManifest(this.config.root);
16584
16591
  const clientManifest = {
16585
16592
  clientEntry: "/@farm/client.js",
@@ -16627,7 +16634,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
16627
16634
  const routeSlotPayload = (req.__FARM_ROUTE_SLOTS__ || []).map(
16628
16635
  (slot) => ({
16629
16636
  ...slot,
16630
- 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
16631
16638
  })
16632
16639
  );
16633
16640
  const deferredProps = prepareDeferredData({