@farm.js/core 0.1.0-beta.45 → 0.1.0-beta.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/route-manager.cjs.map +1 -1
- package/dist/api/route-manager.mjs +2 -2
- package/dist/api.cjs.map +1 -1
- package/dist/api.mjs +3 -3
- package/dist/{chunk-EPBXX44K.mjs → chunk-3UUEBVR3.mjs} +3 -3
- package/dist/{chunk-IRYMQRYJ.mjs → chunk-ECLWCE4H.mjs} +2 -2
- package/dist/{chunk-IWPBMZGE.mjs → chunk-IHYFDXKQ.mjs} +4 -4
- package/dist/{chunk-FLGRRGVU.mjs → chunk-KTV3UWGE.mjs} +2 -2
- package/dist/{chunk-FLGRRGVU.mjs.map → chunk-KTV3UWGE.mjs.map} +1 -1
- package/dist/{chunk-MU2QKVYL.mjs → chunk-MP2SDRRB.mjs} +2 -2
- package/dist/{chunk-6NCLVPI7.mjs → chunk-MWYVMV3T.mjs} +124 -15
- package/dist/chunk-MWYVMV3T.mjs.map +1 -0
- package/dist/{chunk-QLCUQD3U.mjs → chunk-SHZF3DEB.mjs} +2 -2
- package/dist/{chunk-VHYARVB7.mjs → chunk-TIESOJ7Z.mjs} +2 -2
- package/dist/{chunk-KEPCW6EI.mjs → chunk-U5SPS2HR.mjs} +10 -1
- package/dist/chunk-U5SPS2HR.mjs.map +1 -0
- package/dist/client/lifecycle.mjs +2 -2
- package/dist/client-plugins.cjs +1 -1
- package/dist/client-plugins.cjs.map +1 -1
- package/dist/client-plugins.mjs +2 -2
- package/dist/client.cjs +1 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.mjs +2 -2
- package/dist/index.cjs +134 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +11 -9
- package/dist/index.mjs.map +1 -1
- package/dist/internal/build-runtime.cjs +132 -12
- package/dist/internal/build-runtime.cjs.map +1 -1
- package/dist/internal/build-runtime.d.mts +1 -1
- package/dist/internal/build-runtime.d.ts +1 -1
- package/dist/internal/build-runtime.mjs +6 -6
- package/dist/internal/client-runtime.cjs +1 -1
- package/dist/internal/client-runtime.cjs.map +1 -1
- package/dist/internal/client-runtime.mjs +2 -2
- package/dist/internal/config-runtime.cjs.map +1 -1
- package/dist/internal/config-runtime.d.mts +1 -1
- package/dist/internal/config-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.mjs +1 -1
- package/dist/middleware.cjs.map +1 -1
- package/dist/middleware.mjs +3 -3
- package/dist/plugin.cjs +127 -11
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.mjs +5 -5
- package/dist/server.cjs +129 -11
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.mjs +7 -5
- package/dist/server.mjs.map +1 -1
- package/dist/testing.mjs +2 -2
- package/dist/{utils-CjZRiq-l.d.mts → utils-9OPxcT1T.d.mts} +9 -1
- package/dist/{utils-_LOF-V9f.d.ts → utils-CIIoLfn9.d.ts} +9 -1
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +127 -11
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +5 -5
- package/package.json +3 -3
- package/dist/chunk-6NCLVPI7.mjs.map +0 -1
- package/dist/chunk-KEPCW6EI.mjs.map +0 -1
- /package/dist/{chunk-EPBXX44K.mjs.map → chunk-3UUEBVR3.mjs.map} +0 -0
- /package/dist/{chunk-IRYMQRYJ.mjs.map → chunk-ECLWCE4H.mjs.map} +0 -0
- /package/dist/{chunk-IWPBMZGE.mjs.map → chunk-IHYFDXKQ.mjs.map} +0 -0
- /package/dist/{chunk-MU2QKVYL.mjs.map → chunk-MP2SDRRB.mjs.map} +0 -0
- /package/dist/{chunk-QLCUQD3U.mjs.map → chunk-SHZF3DEB.mjs.map} +0 -0
- /package/dist/{chunk-VHYARVB7.mjs.map → chunk-TIESOJ7Z.mjs.map} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as RouteModule, J as SSGCollectionResult, I as SSGPage, F as FarmConfig, aj as OpenAPIConfig, O as ResolvedFarmLayer, Q as FarmSourceRoot } from './client-plugins-DmcF3JHA.mjs';
|
|
2
2
|
export { bh as APIHandlerLifecyclePayload, bd as APIRouteDiscoveredPayload, A as AppRoutePattern, H as BuildOptions, bk as BundleLifecyclePayload, a5 as BundleResultPayload, c$ as CookieJar, d0 as CookieOptions, cQ as CreateIntegrationOrmOptions, dh as DEFAULT_FARM_DEVTOOLS_SHORTCUT, cw as DefinedIntegration, s as ErrorBoundary, bi as ErrorLifecyclePayload, E as ErrorProps, dj as FARM_DEVTOOLS_LAUNCH_PARAM, di as FARM_DEVTOOLS_PATH, bM as FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY, i as FarmAppContext, aG as FarmAuthConfig, aH as FarmAuthDatabaseConfig, aI as FarmAuthEmailAndPasswordConfig, aJ as FarmAuthSessionConfig, aK as FarmAuthUserConfig, a as FarmComponentType, h as FarmContextFactory, g as FarmContextFactoryInput, aA as FarmCspConfig, aC as FarmCspDirectiveValue, aB as FarmCspDirectives, aD as FarmCspOptions, bu as FarmDeployConfig, bw as FarmDeployTarget, dk as FarmDevtoolsConfig, dl as FarmDevtoolsUserConfig, a7 as FarmIntegration, bx as FarmIntegrationCategory, bQ as FarmIntegrationConfigContext, bR as FarmIntegrationConfigDefinition, bS as FarmIntegrationConfigInput, cj as FarmIntegrationContributedPlugin, bX as FarmIntegrationData, c5 as FarmIntegrationDocumentNavigation, cq as FarmIntegrationEndpointValue, cr as FarmIntegrationEndpoints, ct as FarmIntegrationEndpointsFactory, cs as FarmIntegrationEndpointsFactoryContext, bY as FarmIntegrationHandlerContext, bJ as FarmIntegrationInputSchema, bV as FarmIntegrationLifecycleContext, bW as FarmIntegrationLifecycleHook, bT as FarmIntegrationLifecycleLogLevel, bU as FarmIntegrationLifecycleLogger, cg as FarmIntegrationLogEvent, cf as FarmIntegrationLogPhase, ch as FarmIntegrationLogger, c2 as FarmIntegrationMiddleware, cL as FarmIntegrationOrmClient, cK as FarmIntegrationOrmSchema, ci as FarmIntegrationPluginOwner, c4 as FarmIntegrationProvider, c3 as FarmIntegrationProviderProps, bL as FarmIntegrationRequestContextStore, b$ as FarmIntegrationRoute, bP as FarmIntegrationRouteArgs, bN as FarmIntegrationRouteDb, cn as FarmIntegrationRouteFactory, b_ as FarmIntegrationRouteHook, bZ as FarmIntegrationRouteHookContext, bE as FarmIntegrationRouteInput, bK as FarmIntegrationRouteInputSchemas, bC as FarmIntegrationRouteInputSource, bB as FarmIntegrationRouteMethod, c1 as FarmIntegrationRouteMiddleware, bz as FarmIntegrationRouteParamValue, bA as FarmIntegrationRouteParams, bO as FarmIntegrationRouteStorageArgs, cp as FarmIntegrationRoutesFactory, co as FarmIntegrationRoutesFactoryContext, cd as FarmIntegrationSchema, c9 as FarmIntegrationSchemaConstraint, c8 as FarmIntegrationSchemaField, c6 as FarmIntegrationSchemaFieldType, ca as FarmIntegrationSchemaModel, cb as FarmIntegrationSchemaModelExtension, cc as FarmIntegrationSchemaModelOverride, c7 as FarmIntegrationSchemaReference, by as FarmIntegrationSlot, bI as FarmIntegrationStandardValidationResult, bG as FarmIntegrationValidationErrorLike, bF as FarmIntegrationValidationIssue, bD as FarmIntegrationValidationPathSegment, bH as FarmIntegrationValidationResult, ck as FarmIntegrationsUserConfig, av as FarmLayerConfig, K as FarmLayerEntry, a2 as FarmMdxComponent, $ as FarmMdxComponents, a0 as FarmMdxResolvedConfig, a3 as FarmMdxUserConfig, a9 as FarmMiddlewareConfig, b as FarmMigrationCommand, c as FarmMigrationsConfig, e as FarmMigrationsUserConfig, aw as FarmPerformanceConfig, a6 as FarmPlugin, b7 as FarmPluginBuildHooks, b9 as FarmPluginClientConfig, aM as FarmPluginContext, b8 as FarmPluginDevHooks, b4 as FarmPluginDiscoveredRoute, aN as FarmPluginIntegrationContext, aO as FarmPluginLifecycle, b6 as FarmPluginRenderHooks, aS as FarmPluginRouteRuntimePayload, b5 as FarmPluginRouterHooks, aY as FarmPluginRuntimeAfterEvent, aV as FarmPluginRuntimeBaseEvent, aX as FarmPluginRuntimeBeforeEvent, a$ as FarmPluginRuntimeCloseEvent, aW as FarmPluginRuntimeContextEvent, aZ as FarmPluginRuntimeErrorEvent, b0 as FarmPluginRuntimeHooks, aR as FarmPluginRuntimeKind, b2 as FarmPluginRuntimeRequestHandler, b1 as FarmPluginRuntimeRequestOptions, b3 as FarmPluginRuntimeSession, a_ as FarmPluginRuntimeStartEvent, aT as FarmPluginSetupContext, aU as FarmPluginStateContext, ax as FarmPreloadMode, ay as FarmPreloadUserConfig, y as FarmRequest, aP as FarmRequestPluginContext, aQ as FarmRequestStore, z as FarmResponse, db as FarmRouteRule, da as FarmRouteRuleCors, d9 as FarmRouteRuleRedirect, d8 as FarmRouteRuleRenderMode, dc as FarmRouteRules, al as FarmRuntimeShutdownError, aE as FarmSecurityConfig, c0 as FarmTypedIntegrationRoute, a4 as FarmUserConfig, G as GenerateStaticParams, bj as HMRUpdatePayload, bp as HeaderConfig, bs as I18nConfig, br as ImageConfig, cP as InferFarmIntegrationOrmClient, cM as InferFarmIntegrationOrmField, cN as InferFarmIntegrationOrmFields, cO as InferFarmIntegrationOrmSchema, cU as IntegrationOrmModelNames, q as Layout, o as LayoutMetadataProps, w as LayoutModule, m as LayoutProps, r as Loading, L as LoadingProps, d5 as MemoryRateLimitStorageOptions, x as Metadata, n as MetadataProps, c_ as MiddlewareChain, bt as MiddlewareConfig, cV as MiddlewareContext, bc as MiddlewareDiscoveredPayload, cW as MiddlewareFunction, M as MiddlewareProps, d7 as MiddlewareResult, cZ as MiddlewareStore, d6 as NextFunction, bl as NitroBuildLifecyclePayload, N as NitroPreset, p as Page, k as PageProps, l as PagePropsWithMiddleware, P as PageRouteParams, D as ParsedRoute, j as PluginContextProps, am as PluginManager, aL as PluginRequestContext, d1 as RateLimitConfig, d2 as RateLimitIncrementResult, d4 as RateLimitStatus, d3 as RateLimitStorage, a8 as ReadonlyMiddlewareStore, bo as RedirectConfig, bg as RenderLifecyclePayload, cX as RequestMiddleware, cY as RequestMiddlewareContext, ac as ResolvedFarmAuthConfig, bn as ResolvedFarmConfig, aF as ResolvedFarmCspConfig, bv as ResolvedFarmDeployConfig, ab as ResolvedFarmDevtoolsConfig, R as ResolvedFarmMigrationsConfig, ad as ResolvedFarmPerformanceConfig, az as ResolvedFarmPreloadConfig, ae as ResolvedFarmSecurityConfig, bq as RewriteConfig, ba as RouteDiscoveredPayload, be as RouteMatchPayload, bf as RouteMatchResultPayload, C as RouteSegment, bb as RoutesGeneratedPayload, B as ServerAction, bm as ShutdownPayload, u as StaticPathParams, S as StaticPathPrimitive, v as StaticRouteParams, cR as createIntegrationOrm, cu as createIntegrationRoute, cx as defineIntegration, ce as defineIntegrationSchema, ak as definePlugin, cJ as dispatchIntegrationRequest, cT as farmIntegrationSchemaToOrmSchema, at as getDeployTargetForPreset, X as getFarmAppDirectories, cm as getFarmIntegrationPluginOwner, cl as getFarmIntegrationPluginServerRuntime, Y as getFarmLayerAliases, W as getFarmSourceRoots, cB as getIntegrationDocumentNavigationMatchers, cA as getIntegrationProviders, cC as getIntegrationSchemas, au as getPresetForDeployTarget, cI as getRegisteredIntegrationAPIManifest, cD as getRegisteredIntegrationRuntime, cF as getRegisteredIntegrationSchemas, cE as getRegisteredIntegrations, cv as integrationRoute, cy as isFarmIntegration, ao as loadConfig, cG as matchIntegrationRoute, cH as matchRegisteredIntegrationRoute, as as normalizeDeployTarget, dd as normalizeRouteRules, an as resolveConfig, ap as resolveDeployConfig, ar as resolveDeployOutputPath, dm as resolveFarmDevtoolsConfig, V as resolveFarmLayers, cS as resolveIntegrationOrmRuntimeClient, cz as resolveIntegrationPlugins, a1 as resolveMdxConfig, aq as resolveMigrationsConfig, df as routeRulesToHeaders, dg as routeRulesToNitroRouteRules, de as routeRulesToRedirects } from './client-plugins-DmcF3JHA.mjs';
|
|
3
3
|
export { FarmRenderer, FarmRendererCapabilities, FarmRendererCapabilitiesInput, FarmRendererStreamingCapabilities, REACT_RENDERER, defineRenderer } from './renderer.mjs';
|
|
4
|
-
export { f as fileExists, g as globFiles, l as logger, m as matchRoute, p as parseRoutePath,
|
|
4
|
+
export { f as fileExists, g as globFiles, l as logger, m as matchRoute, p as parseRoutePath, 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,
|
|
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-
|
|
12
|
+
} from "./chunk-IHYFDXKQ.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-
|
|
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-
|
|
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-
|
|
211
|
+
} from "./chunk-SHZF3DEB.mjs";
|
|
212
212
|
import {
|
|
213
213
|
analyzeStaticRouteCandidate,
|
|
214
214
|
collectSSGPages,
|
|
@@ -227,7 +227,7 @@ import {
|
|
|
227
227
|
parseRouteRenderingDirective,
|
|
228
228
|
resolveRouteRenderingConfig,
|
|
229
229
|
resolveRouteRenderingConfigFromFile
|
|
230
|
-
} from "./chunk-
|
|
230
|
+
} from "./chunk-MWYVMV3T.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-
|
|
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-
|
|
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-
|
|
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-
|
|
570
|
+
import "./chunk-KTV3UWGE.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,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/provider.tsx","../src/hmr.ts","../src/openapi/scalar-component.tsx","../src/openapi/docs-route.tsx"],"sourcesContent":["import React, { createContext, useContext, type ReactNode } from \"react\";\nimport type { FarmConfig } from \"./types\";\n\ninterface FarmContextValue {\n config: FarmConfig;\n basePath: string;\n}\n\nconst FarmContext = createContext<FarmContextValue | null>(null);\n\ninterface FarmProviderProps {\n children: ReactNode;\n config: FarmConfig;\n}\n\n/**\n * Farm.js context provider for client-side components\n */\nexport function FarmProvider({ children, config }: FarmProviderProps) {\n const value: FarmContextValue = {\n config,\n basePath: config.basePath || \"/\",\n };\n\n return <FarmContext.Provider value={value}>{children}</FarmContext.Provider>;\n}\n\n/**\n * Hook to access Farm.js configuration and utilities\n */\nexport function useFarm(): FarmContextValue {\n const context = useContext(FarmContext);\n\n if (!context) {\n throw new Error(\"useFarm must be used within a FarmProvider\");\n }\n\n return context;\n}\n\n/**\n * Hook to get the current base path\n */\nexport function useBasePath(): string {\n const { basePath } = useFarm();\n return basePath;\n}\n","import type { ViteDevServer, ModuleNode } from \"vite\";\nimport { logger } from \"./utils\";\n\nexport class HMRManager {\n private server: ViteDevServer;\n\n constructor(server: ViteDevServer) {\n this.server = server;\n }\n\n /**\n * Send HMR update to client\n */\n async send(payload: any) {\n this.server.ws.send(payload);\n }\n\n /**\n * Trigger full page reload\n */\n async reloadPage() {\n this.server.ws.send({\n type: \"full-reload\",\n path: \"*\",\n });\n }\n\n /**\n * Handle file change and trigger HMR\n */\n async handleFileChange(file: string) {\n const module = await this.server.moduleGraph.getModuleByUrl(file);\n\n if (!module) {\n return;\n }\n\n // Invalidate module\n this.server.moduleGraph.invalidateModule(module);\n\n // Get affected modules\n const affectedModules = this.getAffectedModules(module);\n\n if (affectedModules.size === 0) {\n return;\n }\n\n if (file.includes(\"/app/\") && /\\/page\\.(?:tsx?|jsx?|vue|svelte)$/.test(file)) {\n await this.reloadPage();\n return;\n }\n\n if (file.includes(\"/app/\") && /\\/layout\\.(?:tsx?|jsx?|vue|svelte)$/.test(file)) {\n await this.reloadPage();\n return;\n }\n // Send update for other files\n this.send({\n type: \"update\",\n updates: Array.from(affectedModules).map((m) => ({\n type: m.type === \"css\" ? \"css-update\" : \"js-update\",\n path: m.url,\n acceptedPath: m.url,\n timestamp: Date.now(),\n })),\n });\n }\n\n /**\n * Get all affected modules in the dependency graph\n */\n private getAffectedModules(module: ModuleNode): Set<ModuleNode> {\n const affected = new Set<ModuleNode>();\n const seen = new Set<ModuleNode>();\n\n const traverse = (mod: ModuleNode) => {\n if (seen.has(mod)) return;\n seen.add(mod);\n affected.add(mod);\n\n // Traverse importers\n for (const importer of mod.importers) {\n if (!importer.isSelfAccepting) {\n traverse(importer);\n }\n }\n };\n\n traverse(module);\n return affected;\n }\n\n /**\n * Handle custom HMR events from client\n */\n onClientMessage(event: string, callback: (data: any) => void) {\n // Vite handles this via ws.on\n }\n}\n\n/**\n * Create HMR client code for injection\n */\nexport function createHMRClientCode(): string {\n return `\n// Farm.js HMR Client\nif (import.meta.hot) {\n // Accept HMR updates for this module\n import.meta.hot.accept((newModule) => {\n if (newModule) {\n // Module updated, trigger re-render\n window.location.reload();\n }\n });\n\n // Listen for custom Farm.js events\n import.meta.hot.on('farm:route-update', (data) => {\n console.log('Route updated:', data.path);\n window.location.reload();\n });\n\n // Handle CSS updates\n import.meta.hot.on('vite:beforeUpdate', () => {\n console.log('[Farm.js] HMR update incoming...');\n });\n\n import.meta.hot.on('vite:afterUpdate', () => {\n console.log('[Farm.js] HMR update applied ✓');\n });\n\n // Handle errors\n import.meta.hot.on('vite:error', (err) => {\n console.error('[Farm.js] HMR error:', err);\n });\n}\n`;\n}\n","import React from \"react\";\n\ninterface ScalarAPIDocumentationProps {\n spec: any;\n config?: {\n theme?: \"default\" | \"purple\" | \"blue\" | \"green\" | \"red\" | \"yellow\";\n layout?: \"modern\" | \"classic\";\n showSidebar?: boolean;\n hideDownloadButton?: boolean;\n hideTryItPanel?: boolean;\n };\n}\n\nexport function ScalarAPIDocumentation({ spec, config = {} }: ScalarAPIDocumentationProps) {\n const [isLoaded, setIsLoaded] = React.useState(false);\n\n React.useEffect(() => {\n // Dynamically import Scalar components\n const loadScalar = async () => {\n try {\n // Load Scalar CSS\n const cssLink = document.createElement(\"link\");\n cssLink.rel = \"stylesheet\";\n cssLink.href = \"https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest/dist/style.css\";\n document.head.appendChild(cssLink);\n\n // Load Scalar JS\n const script = document.createElement(\"script\");\n script.src =\n \"https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest/dist/browser/standalone.js\";\n script.onload = () => setIsLoaded(true);\n document.head.appendChild(script);\n } catch (error) {\n console.error(\"Failed to load Scalar:\", error);\n }\n };\n\n loadScalar();\n }, []);\n\n React.useEffect(() => {\n if (isLoaded && window.ScalarApiReference) {\n // Initialize Scalar\n const container = document.getElementById(\"scalar-api-reference\");\n if (container) {\n window.ScalarApiReference({\n spec,\n theme: config.theme || \"default\",\n layout: config.layout || \"modern\",\n showSidebar: config.showSidebar !== false,\n hideDownloadButton: config.hideDownloadButton || false,\n hideTryItPanel: config.hideTryItPanel || false,\n });\n }\n }\n }, [isLoaded, spec, config]);\n\n return (\n <div className=\"scalar-container\">\n <div id=\"scalar-api-reference\" style={{ height: \"100vh\", width: \"100%\" }} />\n </div>\n );\n}\n\n// Extend window type for Scalar\ndeclare global {\n interface Window {\n ScalarApiReference: (config: any) => void;\n }\n}\n","import React from \"react\";\nimport { ScalarAPIDocumentation } from \"./scalar-component\";\n\ninterface DocsRouteProps {\n spec: any;\n config?: any;\n}\n\nexport function DocsRoute({ spec, config }: DocsRouteProps) {\n return (\n <html lang=\"en\">\n <head>\n <meta charSet=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link rel=\"icon\" href=\"data:,\" />\n <title>{config?.title || \"API Documentation\"}</title>\n <style>{`\n body {\n margin: 0;\n padding: 0;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;\n }\n .scalar-container {\n height: 100vh;\n width: 100%;\n }\n `}</style>\n </head>\n <body>\n <ScalarAPIDocumentation spec={spec} config={config} />\n </body>\n </html>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,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"]}
|
|
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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EACb,GAAG,CAAC,CAAC;AAEL,EAAAA,OAAM,UAAU,MAAM;AACpB,QAAI,YAAY,OAAO,oBAAoB;AAEzC,YAAM,YAAY,SAAS,eAAe,sBAAsB;AAChE,UAAI,WAAW;AACb,eAAO,mBAAmB;AAAA,UACxB;AAAA,UACA,OAAO,OAAO,SAAS;AAAA,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"]}
|
|
@@ -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
|
-
|
|
10769
|
-
|
|
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}`;
|
|
@@ -11393,6 +11400,60 @@ var init_route_manager = __esm({
|
|
|
11393
11400
|
}
|
|
11394
11401
|
});
|
|
11395
11402
|
|
|
11403
|
+
// src/server/full-document.ts
|
|
11404
|
+
function stripContentsWrappers(markup) {
|
|
11405
|
+
let out = markup.replace(/^\s+/, "");
|
|
11406
|
+
const opener = /^<div\b[^>]*style="display\s*:\s*contents"[^>]*>/i;
|
|
11407
|
+
let match;
|
|
11408
|
+
while (match = opener.exec(out)) {
|
|
11409
|
+
out = out.slice(match[0].length).replace(/^\s+/, "");
|
|
11410
|
+
}
|
|
11411
|
+
return out;
|
|
11412
|
+
}
|
|
11413
|
+
function extractFarmFullDocument(markup) {
|
|
11414
|
+
const inner = stripContentsWrappers(markup);
|
|
11415
|
+
if (!/^<!doctype/i.test(inner) && !/^<html[\s>]/i.test(inner)) return null;
|
|
11416
|
+
const start = markup.search(/<!doctype|<html[\s>]/i);
|
|
11417
|
+
const closeIndex = markup.toLowerCase().lastIndexOf("</html>");
|
|
11418
|
+
if (start < 0 || closeIndex < 0) return null;
|
|
11419
|
+
return markup.slice(start, closeIndex + "</html>".length);
|
|
11420
|
+
}
|
|
11421
|
+
function opensFarmFullDocument(markup) {
|
|
11422
|
+
const inner = stripContentsWrappers(markup);
|
|
11423
|
+
return /^<!doctype/i.test(inner) || /^<html[\s>]/i.test(inner);
|
|
11424
|
+
}
|
|
11425
|
+
function composeFarmFullDocument(documentHtml, assets) {
|
|
11426
|
+
let html = documentHtml;
|
|
11427
|
+
if (assets.htmlAttributes) {
|
|
11428
|
+
html = html.replace(
|
|
11429
|
+
/<html\b([^>]*)>/i,
|
|
11430
|
+
(_match, attrs) => `<html${attrs}${assets.htmlAttributes}>`
|
|
11431
|
+
);
|
|
11432
|
+
}
|
|
11433
|
+
if (!/\sid=["']root["']/i.test(html)) {
|
|
11434
|
+
html = html.replace(/<body\b([^>]*)>/i, '<body$1><div id="root">').replace(/<\/body>/i, "</div></body>");
|
|
11435
|
+
}
|
|
11436
|
+
if (assets.headAssets) {
|
|
11437
|
+
html = html.replace(/<\/head>/i, () => ` ${assets.headAssets}
|
|
11438
|
+
</head>`);
|
|
11439
|
+
}
|
|
11440
|
+
if (assets.bodyFooter) {
|
|
11441
|
+
html = html.replace(/<\/body>/i, () => ` ${assets.bodyFooter}
|
|
11442
|
+
</body>`);
|
|
11443
|
+
}
|
|
11444
|
+
return /^\s*<!doctype/i.test(html) ? html : `<!DOCTYPE html>
|
|
11445
|
+
${html}`;
|
|
11446
|
+
}
|
|
11447
|
+
var init_full_document = __esm({
|
|
11448
|
+
"src/server/full-document.ts"() {
|
|
11449
|
+
"use strict";
|
|
11450
|
+
__name(stripContentsWrappers, "stripContentsWrappers");
|
|
11451
|
+
__name(extractFarmFullDocument, "extractFarmFullDocument");
|
|
11452
|
+
__name(opensFarmFullDocument, "opensFarmFullDocument");
|
|
11453
|
+
__name(composeFarmFullDocument, "composeFarmFullDocument");
|
|
11454
|
+
}
|
|
11455
|
+
});
|
|
11456
|
+
|
|
11396
11457
|
// src/middleware/server.ts
|
|
11397
11458
|
function getGlobalMiddlewareStore(key) {
|
|
11398
11459
|
const state = globalThis;
|
|
@@ -14851,7 +14912,7 @@ var init_server3 = __esm({
|
|
|
14851
14912
|
var version;
|
|
14852
14913
|
var init_package = __esm({
|
|
14853
14914
|
"package.json"() {
|
|
14854
|
-
version = "0.1.0-beta.
|
|
14915
|
+
version = "0.1.0-beta.47";
|
|
14855
14916
|
}
|
|
14856
14917
|
});
|
|
14857
14918
|
|
|
@@ -15023,6 +15084,13 @@ function warnSuppressedAsyncHydrationOnce(modulePath) {
|
|
|
15023
15084
|
`${modulePath} is an async server component that imports client components. React cannot hydrate async components in the browser, so this route stays server-rendered and its client imports are not interactive. Move the interactive UI into a "use client" child rendered by a synchronous page, or enable experimental server components support.`
|
|
15024
15085
|
);
|
|
15025
15086
|
}
|
|
15087
|
+
function warnFarmFullDocumentLayout() {
|
|
15088
|
+
if (warnedFullDocumentLayout) return;
|
|
15089
|
+
warnedFullDocumentLayout = true;
|
|
15090
|
+
logger.warn(
|
|
15091
|
+
`A root layout returned a full <html> document. Farm.js owns the document shell, so a layout should return a fragment (its children) \u2014 like the docs example \u2014 and let the framework provide <html>/<head>/<body>. The document has been composed into the response, but returning a fragment avoids the ambiguity and keeps dev and production identical.`
|
|
15092
|
+
);
|
|
15093
|
+
}
|
|
15026
15094
|
function hasRequestHeader(req, name2) {
|
|
15027
15095
|
const value = req.headers[name2.toLowerCase()];
|
|
15028
15096
|
return Array.isArray(value) ? value.length > 0 : Boolean(value);
|
|
@@ -15161,13 +15229,14 @@ function createRouteStateProps(input) {
|
|
|
15161
15229
|
context: input.pluginExposedContext.size > 0 ? { data: input.pluginExposedContext } : void 0
|
|
15162
15230
|
};
|
|
15163
15231
|
}
|
|
15164
|
-
var fs3, path13, import_stream, import_node_url6, cachedClerkProvider, importRuntimeModule, warnedSuppressedAsyncHydrationModules, _ServerRenderer, ServerRenderer;
|
|
15232
|
+
var fs3, path13, import_stream, import_node_url6, cachedClerkProvider, importRuntimeModule, warnedSuppressedAsyncHydrationModules, fullDocumentRoutes, warnedFullDocumentLayout, _ServerRenderer, ServerRenderer;
|
|
15165
15233
|
var init_renderer2 = __esm({
|
|
15166
15234
|
"src/server/renderer.ts"() {
|
|
15167
15235
|
"use strict";
|
|
15168
15236
|
fs3 = __toESM(require("fs"));
|
|
15169
15237
|
path13 = __toESM(require("path"));
|
|
15170
15238
|
init_utils();
|
|
15239
|
+
init_full_document();
|
|
15171
15240
|
init_client_component();
|
|
15172
15241
|
import_stream = require("stream");
|
|
15173
15242
|
init_server();
|
|
@@ -15202,6 +15271,9 @@ var init_renderer2 = __esm({
|
|
|
15202
15271
|
importRuntimeModule = new Function("specifier", "return import(specifier);");
|
|
15203
15272
|
warnedSuppressedAsyncHydrationModules = /* @__PURE__ */ new Set();
|
|
15204
15273
|
__name(warnSuppressedAsyncHydrationOnce, "warnSuppressedAsyncHydrationOnce");
|
|
15274
|
+
fullDocumentRoutes = /* @__PURE__ */ new Set();
|
|
15275
|
+
warnedFullDocumentLayout = false;
|
|
15276
|
+
__name(warnFarmFullDocumentLayout, "warnFarmFullDocumentLayout");
|
|
15205
15277
|
__name(hasRequestHeader, "hasRequestHeader");
|
|
15206
15278
|
__name(serializeInlineValue2, "serializeInlineValue");
|
|
15207
15279
|
__name(escapeHtmlAttribute2, "escapeHtmlAttribute");
|
|
@@ -15899,7 +15971,7 @@ var init_renderer2 = __esm({
|
|
|
15899
15971
|
);
|
|
15900
15972
|
const clientLayouts = layouts.map((layout2, index) => ({
|
|
15901
15973
|
pattern: layout2.pattern,
|
|
15902
|
-
modulePath: layout2.modulePath
|
|
15974
|
+
modulePath: toRootRelativeUrlPath(layout2.modulePath, this.config.root) ?? layout2.modulePath,
|
|
15903
15975
|
shouldHydrate: layoutHydrationMetadata[index]?.shouldHydrate === true,
|
|
15904
15976
|
islandStrategy: layoutHydrationMetadata[index]?.islandStrategy ?? null
|
|
15905
15977
|
}));
|
|
@@ -16475,7 +16547,7 @@ var init_renderer2 = __esm({
|
|
|
16475
16547
|
const routeSlots = (req.__FARM_ROUTE_SLOTS__ || []).map(
|
|
16476
16548
|
(slot) => ({
|
|
16477
16549
|
...slot,
|
|
16478
|
-
modulePath: typeof slot.modulePath === "string"
|
|
16550
|
+
modulePath: typeof slot.modulePath === "string" ? toRootRelativeUrlPath(slot.modulePath, this.config.root) ?? slot.modulePath : slot.modulePath
|
|
16479
16551
|
})
|
|
16480
16552
|
);
|
|
16481
16553
|
const deferredProps = prepareDeferredData({
|
|
@@ -16483,7 +16555,7 @@ var init_renderer2 = __esm({
|
|
|
16483
16555
|
slots: routeSlots
|
|
16484
16556
|
});
|
|
16485
16557
|
const pagePath = req.__FARM_PAGE_PATH__;
|
|
16486
|
-
const relativePath2 = pagePath ? pagePath
|
|
16558
|
+
const relativePath2 = pagePath ? toRootRelativeUrlPath(pagePath, this.config.root) ?? pagePath : "/src/app/page.tsx";
|
|
16487
16559
|
const deploymentId = this.getDeploymentId();
|
|
16488
16560
|
const bootstrapScript = `<script>
|
|
16489
16561
|
window.__FARM_PROPS__ = ${serializeInlineValue2(deferredProps.data.page)};
|
|
@@ -16517,7 +16589,27 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
|
|
|
16517
16589
|
this.config.basePath,
|
|
16518
16590
|
getTheme()
|
|
16519
16591
|
);
|
|
16520
|
-
const
|
|
16592
|
+
const fullDocument = extractFarmFullDocument(content);
|
|
16593
|
+
let html;
|
|
16594
|
+
if (fullDocument) {
|
|
16595
|
+
warnFarmFullDocumentLayout();
|
|
16596
|
+
html = composeFarmFullDocument(fullDocument, {
|
|
16597
|
+
htmlAttributes: `${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}`,
|
|
16598
|
+
headAssets: [
|
|
16599
|
+
themeDocument.head,
|
|
16600
|
+
`<meta name="farm-deployment-id" content="${escapeHtmlAttribute2(deploymentId)}">`,
|
|
16601
|
+
metaTags,
|
|
16602
|
+
alternateTags,
|
|
16603
|
+
renderFarmFontDevHead(this.config.root || process.cwd()),
|
|
16604
|
+
`<link rel="stylesheet" href="/src/app/globals.css">`,
|
|
16605
|
+
`<script type="module" src="/@vite/client"></script>`,
|
|
16606
|
+
rendererHydrationScript,
|
|
16607
|
+
bootstrapScript
|
|
16608
|
+
].filter(Boolean).join("\n "),
|
|
16609
|
+
bodyFooter: [deferredScript, `<script type="module" src="/@farm/client.js"></script>`].filter(Boolean).join("\n ")
|
|
16610
|
+
});
|
|
16611
|
+
} else {
|
|
16612
|
+
html = `<!DOCTYPE html>
|
|
16521
16613
|
<html lang="${escapeHtmlAttribute2(i18nSnapshot?.locale || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
|
|
16522
16614
|
<head>
|
|
16523
16615
|
${themeDocument.head}
|
|
@@ -16538,6 +16630,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
|
|
|
16538
16630
|
<script type="module" src="/@farm/client.js"></script>
|
|
16539
16631
|
</body>
|
|
16540
16632
|
</html>`;
|
|
16633
|
+
}
|
|
16541
16634
|
emitFarmEvent({
|
|
16542
16635
|
type: "render.stream.shellReady",
|
|
16543
16636
|
route,
|
|
@@ -16560,7 +16653,8 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
|
|
|
16560
16653
|
}
|
|
16561
16654
|
async renderWithSSR(element, req, res, clearMiddlewareData, options = {}) {
|
|
16562
16655
|
const renderToPipeableStream2 = this.rendererRuntime.renderToPipeableStream;
|
|
16563
|
-
|
|
16656
|
+
const fullDocumentRouteKey = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
|
|
16657
|
+
if (!renderToPipeableStream2 || fullDocumentRoutes.has(fullDocumentRouteKey)) {
|
|
16564
16658
|
return this.renderBufferedSSR(element, req, res, clearMiddlewareData, options);
|
|
16565
16659
|
}
|
|
16566
16660
|
return new Promise((resolve8, reject) => {
|
|
@@ -16579,7 +16673,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
|
|
|
16579
16673
|
let didError = false;
|
|
16580
16674
|
const pagePath = req.__FARM_PAGE_PATH__;
|
|
16581
16675
|
const isClientComponent = req.__FARM_IS_CLIENT_COMPONENT__ === true;
|
|
16582
|
-
const relativePath2 = pagePath ? pagePath
|
|
16676
|
+
const relativePath2 = pagePath ? toRootRelativeUrlPath(pagePath, this.config.root) ?? pagePath : "/src/app/page.tsx";
|
|
16583
16677
|
const manifest = options.routeManifest ?? this.routeManager.generateClientManifest(this.config.root);
|
|
16584
16678
|
const clientManifest = {
|
|
16585
16679
|
clientEntry: "/@farm/client.js",
|
|
@@ -16627,7 +16721,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
|
|
|
16627
16721
|
const routeSlotPayload = (req.__FARM_ROUTE_SLOTS__ || []).map(
|
|
16628
16722
|
(slot) => ({
|
|
16629
16723
|
...slot,
|
|
16630
|
-
modulePath: typeof slot.modulePath === "string"
|
|
16724
|
+
modulePath: typeof slot.modulePath === "string" ? toRootRelativeUrlPath(slot.modulePath, this.config.root) ?? slot.modulePath : slot.modulePath
|
|
16631
16725
|
})
|
|
16632
16726
|
);
|
|
16633
16727
|
const deferredProps = prepareDeferredData({
|
|
@@ -16707,6 +16801,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
|
|
|
16707
16801
|
htmlParts.push(shell);
|
|
16708
16802
|
staticShellParts?.push(shell);
|
|
16709
16803
|
let firstChunk = true;
|
|
16804
|
+
let checkedFullDocument = false;
|
|
16710
16805
|
const writableStream = new import_stream.Writable({
|
|
16711
16806
|
write(chunk, encoding, callback) {
|
|
16712
16807
|
if (firstChunk && process.env.FARM_VERBOSE) {
|
|
@@ -16714,6 +16809,13 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue2(
|
|
|
16714
16809
|
firstChunk = false;
|
|
16715
16810
|
}
|
|
16716
16811
|
const chunkText = Buffer.isBuffer(chunk) ? chunk.toString() : String(chunk);
|
|
16812
|
+
if (!checkedFullDocument) {
|
|
16813
|
+
checkedFullDocument = true;
|
|
16814
|
+
if (opensFarmFullDocument(chunkText)) {
|
|
16815
|
+
fullDocumentRoutes.add(fullDocumentRouteKey);
|
|
16816
|
+
warnFarmFullDocumentLayout();
|
|
16817
|
+
}
|
|
16818
|
+
}
|
|
16717
16819
|
htmlParts.push(chunkText);
|
|
16718
16820
|
if (staticShellParts && !staticShellClosed) {
|
|
16719
16821
|
const dynamicIndex = findPPRDynamicChunkIndex(chunkText);
|
|
@@ -16912,6 +17014,24 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue2(i18nSnapshot)};
|
|
|
16912
17014
|
getTheme()
|
|
16913
17015
|
);
|
|
16914
17016
|
const rendererHydrationScript = this.rendererRuntime.generateHydrationScript?.() || "";
|
|
17017
|
+
const fullDocument = extractFarmFullDocument(content);
|
|
17018
|
+
if (fullDocument) {
|
|
17019
|
+
warnFarmFullDocumentLayout();
|
|
17020
|
+
return composeFarmFullDocument(fullDocument, {
|
|
17021
|
+
htmlAttributes: `${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}`,
|
|
17022
|
+
headAssets: [
|
|
17023
|
+
themeDocument.head,
|
|
17024
|
+
`<meta name="farm-deployment-id" content="${escapeHtmlAttribute2(this.getDeploymentId())}">`,
|
|
17025
|
+
alternateLinks,
|
|
17026
|
+
fontHead,
|
|
17027
|
+
`<link rel="stylesheet" href="/src/app/globals.css" />`,
|
|
17028
|
+
`<script type="module" src="/@vite/client"></script>`,
|
|
17029
|
+
rendererHydrationScript,
|
|
17030
|
+
integrationManifestScript
|
|
17031
|
+
].filter(Boolean).join("\n "),
|
|
17032
|
+
bodyFooter: clientScript.trim()
|
|
17033
|
+
});
|
|
17034
|
+
}
|
|
16915
17035
|
return `<!DOCTYPE html>
|
|
16916
17036
|
<html lang="${escapeHtmlAttribute2(i18nSnapshot?.locale || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
|
|
16917
17037
|
<head>
|