@farm.js/core 0.1.26 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-runtime.d.mts +7 -9
- package/dist/agent-runtime.d.ts +7 -9
- package/dist/api/client.cjs +3 -3
- package/dist/api/client.d.mts +4 -5
- package/dist/api/client.d.ts +4 -5
- package/dist/api/client.mjs +2 -2
- package/dist/api/route-manager.cjs +6 -5
- package/dist/api/route-manager.d.mts +6 -8
- package/dist/api/route-manager.d.ts +6 -8
- package/dist/api/route-manager.mjs +5 -4
- package/dist/api/runtime.cjs +10 -4
- package/dist/api/runtime.d.mts +35 -3
- package/dist/api/runtime.d.ts +35 -3
- package/dist/api/runtime.mjs +9 -3
- package/dist/{api-client-Cx54IR5g.d.mts → api-client-BjMmY8OD.d.mts} +2 -3
- package/dist/{api-client-DykpaKcY.d.ts → api-client-CyFtZFJ4.d.ts} +2 -3
- package/dist/api.cjs +9 -8
- package/dist/api.d.mts +8 -10
- package/dist/api.d.ts +8 -10
- package/dist/api.mjs +9 -8
- package/dist/{app-29vG5tmY.d.mts → app-BfzZdjgX.d.mts} +3 -4
- package/dist/{app-Cx71s_PT.d.ts → app-CXK7Prrt.d.ts} +3 -4
- package/dist/app-markdown.cjs +10 -4
- package/dist/app-markdown.d.mts +8 -10
- package/dist/app-markdown.d.ts +8 -10
- package/dist/app-markdown.mjs +9 -3
- package/dist/{chunk-74RZNRY6.mjs → chunk-3PTVHMLD.mjs} +1 -1
- package/dist/{chunk-OFKG57MZ.mjs → chunk-4FHDV7VM.mjs} +2 -2
- package/dist/{chunk-KLSSO6YD.mjs → chunk-4UNKCNSL.mjs} +1 -1
- package/dist/chunk-5MKEDGLD.cjs +53 -0
- package/dist/{chunk-2CT6XUNO.cjs → chunk-DQMTHWPI.cjs} +4 -4
- package/dist/{chunk-ALIFMS4A.cjs → chunk-FOT7LZEO.cjs} +1 -1
- package/dist/{chunk-DU2CASV6.mjs → chunk-FPW4W3VW.mjs} +1 -1
- package/dist/{chunk-RCYINC4A.cjs → chunk-HF5SIACK.cjs} +3 -3
- package/dist/{chunk-ARXCHQLX.mjs → chunk-HG237IEY.mjs} +4 -4
- package/dist/{chunk-BD2U4ZL6.cjs → chunk-JQGDQO2I.cjs} +8 -8
- package/dist/{chunk-RAI7NULA.mjs → chunk-JT25KHDI.mjs} +1 -1
- package/dist/{chunk-WFPRVVF2.cjs → chunk-KAERLFD3.cjs} +16 -11
- package/dist/{chunk-H7CJRJ4L.cjs → chunk-LAHZ7LZA.cjs} +16 -16
- package/dist/{chunk-JM5GQL4H.mjs → chunk-MBFURXAC.mjs} +1 -1
- package/dist/{chunk-QLXEYIAW.cjs → chunk-NPFGGBM5.cjs} +13 -13
- package/dist/{chunk-VZWO3XVL.mjs → chunk-O2LV5XDG.mjs} +2 -2
- package/dist/chunk-O6XNAMBV.mjs +53 -0
- package/dist/{chunk-UXQXGB5A.mjs → chunk-OGHTEYXS.mjs} +11 -10
- package/dist/{chunk-OOIL3BWR.mjs → chunk-POXI72VV.mjs} +12 -0
- package/dist/{chunk-QGG336NI.mjs → chunk-Q4BHBO6V.mjs} +1 -1
- package/dist/{chunk-3WSWXPYM.cjs → chunk-QI7WQSMI.cjs} +4 -4
- package/dist/{chunk-PPIW3MH6.mjs → chunk-QQQNJS2E.mjs} +1 -1
- package/dist/{chunk-W2HZKYES.cjs → chunk-TDWFCC2T.cjs} +2 -2
- package/dist/{chunk-3TQG7CGC.cjs → chunk-UNSKL6BI.cjs} +78 -77
- package/dist/{chunk-QPPQHB6X.mjs → chunk-UWTQTZFN.mjs} +17 -11
- package/dist/{chunk-YMUH2BLR.mjs → chunk-WIVTGKLY.mjs} +7 -2
- package/dist/{chunk-QJ4D3UKJ.cjs → chunk-WJKVTJJR.cjs} +4 -4
- package/dist/{chunk-OAVTUMJP.cjs → chunk-YXM74XOW.cjs} +9 -9
- package/dist/{chunk-SZ4LYNUX.cjs → chunk-YZBV7733.cjs} +82 -76
- package/dist/{chunk-QIH2HD6H.cjs → chunk-ZSO5GWGD.cjs} +33 -21
- package/dist/{client-plugins-B8RPJnot.d.mts → client-plugins-1GS4zubE.d.mts} +1799 -1623
- package/dist/{client-plugins-bPBf4haK.d.ts → client-plugins-B1Za6F5x.d.ts} +1799 -1623
- package/dist/client-plugins.d.mts +7 -9
- package/dist/client-plugins.d.ts +7 -9
- package/dist/client.cjs +4 -4
- package/dist/client.d.mts +9 -11
- package/dist/client.d.ts +9 -11
- package/dist/client.mjs +3 -3
- package/dist/config.d.mts +7 -9
- package/dist/config.d.ts +7 -9
- package/dist/{devtools-5D4ZDRPR.mjs → devtools-6RN6KHTW.mjs} +6 -3
- package/dist/{devtools-QZJEUOJW.cjs → devtools-CQJ3H6MX.cjs} +7 -4
- package/dist/docs.cjs +9 -6
- package/dist/docs.mjs +8 -5
- package/dist/{endpoint-1zA994xL.d.ts → endpoint-CA-TNX60.d.ts} +1 -1
- package/dist/{endpoint-DAc96i93.d.mts → endpoint-CCHFqyTE.d.mts} +1 -1
- package/dist/index.cjs +21 -20
- package/dist/index.d.mts +15 -17
- package/dist/index.d.ts +15 -17
- package/dist/index.mjs +21 -20
- package/dist/{integration-api-BbaiokCC.d.ts → integration-api-0y4FXJpC.d.mts} +128 -1
- package/dist/{integration-api-BbaiokCC.d.mts → integration-api-BPJo5oXb.d.ts} +128 -1
- package/dist/integrations.d.mts +7 -9
- package/dist/integrations.d.ts +7 -9
- package/dist/internal/app-markdown-runtime.cjs +9 -3
- package/dist/internal/app-markdown-runtime.d.mts +8 -9
- package/dist/internal/app-markdown-runtime.d.ts +8 -9
- package/dist/internal/app-markdown-runtime.mjs +8 -2
- package/dist/internal/build-runtime.cjs +17 -16
- package/dist/internal/build-runtime.d.mts +9 -11
- package/dist/internal/build-runtime.d.ts +9 -11
- package/dist/internal/build-runtime.mjs +16 -15
- package/dist/internal/cli-runtime.cjs +8 -5
- package/dist/internal/cli-runtime.mjs +7 -4
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +7 -9
- package/dist/internal/compression-runtime.d.ts +7 -9
- package/dist/internal/config-runtime.cjs +7 -4
- package/dist/internal/config-runtime.d.mts +8 -10
- package/dist/internal/config-runtime.d.ts +8 -10
- package/dist/internal/config-runtime.mjs +6 -3
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +7 -5
- package/dist/internal/production-runtime.d.mts +12 -14
- package/dist/internal/production-runtime.d.ts +12 -14
- package/dist/internal/production-runtime.mjs +6 -4
- package/dist/markdown.cjs +8 -2
- package/dist/markdown.d.mts +35 -153
- package/dist/markdown.d.ts +35 -153
- package/dist/markdown.mjs +7 -1
- package/dist/{metadata-CzBP4Mfp.d.ts → metadata-7LKgQEWF.d.ts} +1 -1
- package/dist/{metadata-C3na4CBj.d.mts → metadata-B9mCxKgp.d.mts} +1 -1
- package/dist/middleware.d.mts +8 -10
- package/dist/middleware.d.ts +8 -10
- package/dist/navigation.d.mts +9 -11
- package/dist/navigation.d.ts +9 -11
- package/dist/{nitro-ZKLGOTVY.mjs → nitro-NAKCRVHX.mjs} +4 -3
- package/dist/{nitro-KQDU7CFE.cjs → nitro-VYDZGYFY.cjs} +4 -3
- package/dist/plugin.cjs +13 -12
- package/dist/plugin.d.mts +8 -10
- package/dist/plugin.d.ts +8 -10
- package/dist/plugin.mjs +12 -11
- package/dist/{production-runtime-CYg4wM4E.d.ts → production-runtime-B3xnY6fI.d.ts} +1 -1
- package/dist/{production-runtime-DP94hPGe.d.mts → production-runtime-DramhI0c.d.mts} +1 -1
- package/dist/{render-plan-Bl6Fzg5z.d.ts → render-plan-CpW32tOL.d.ts} +1 -1
- package/dist/{render-plan-CKAJg0jC.d.mts → render-plan-CtQB-zHS.d.mts} +1 -1
- package/dist/renderer-client.d.mts +5 -7
- package/dist/renderer-client.d.ts +5 -7
- package/dist/{request-CR-Bp1Px.d.ts → request-BVGGeQv4.d.ts} +1 -1
- package/dist/{request-CrBCcPZZ.d.mts → request-DlLVBKe3.d.mts} +1 -1
- package/dist/request.d.mts +8 -10
- package/dist/request.d.ts +8 -10
- package/dist/{route-rendering-CZH5FegB.d.ts → route-rendering-BdEldajn.d.ts} +1 -1
- package/dist/{route-rendering-C1NAHo-C.d.mts → route-rendering-DChYLNdh.d.mts} +1 -1
- package/dist/{router-Cg_kD3Bd.d.ts → router-D0Az-1Nu.d.ts} +1 -1
- package/dist/{router-B57eDJ3u.d.mts → router-D5htHn_M.d.mts} +1 -1
- package/dist/routes.d.mts +5 -7
- package/dist/routes.d.ts +5 -7
- package/dist/server-fn-client.d.mts +3 -4
- package/dist/server-fn-client.d.ts +3 -4
- package/dist/server-fn.d.mts +1 -1
- package/dist/server-fn.d.ts +1 -1
- package/dist/server-plugins.d.mts +7 -9
- package/dist/server-plugins.d.ts +7 -9
- package/dist/server-query-client.d.mts +1 -1
- package/dist/server-query-client.d.ts +1 -1
- package/dist/server-query.d.mts +1 -1
- package/dist/server-query.d.ts +1 -1
- package/dist/server.cjs +198 -104
- package/dist/server.d.mts +12 -14
- package/dist/server.d.ts +12 -14
- package/dist/server.mjs +184 -90
- package/dist/{spa-router-DTdbuinx.d.mts → spa-router-DVfSJZ5o.d.mts} +2 -2
- package/dist/{spa-router-BstQUO6Q.d.ts → spa-router-DmwP_7QL.d.ts} +2 -2
- package/dist/testing.cjs +6 -5
- package/dist/testing.d.mts +6 -8
- package/dist/testing.d.ts +6 -8
- package/dist/testing.mjs +5 -4
- package/dist/{utils-CS3ZLnEJ.d.mts → utils-B_Rmr0-n.d.mts} +1 -1
- package/dist/{utils-D3rdsIvM.d.ts → utils-Dv0OuLtF.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +13 -12
- package/dist/vite.d.mts +7 -9
- package/dist/vite.d.ts +7 -9
- package/dist/vite.mjs +12 -11
- package/package.json +1 -1
- package/dist/route-B0XrsrFk.d.mts +0 -128
- package/dist/route-DOEpbyWZ.d.ts +0 -128
- package/dist/{chunk-GDUYXFIS.mjs → chunk-6EG7U4NF.mjs} +3 -3
- package/dist/{chunk-YAOX43YI.cjs → chunk-C7OUJ6JI.cjs} +2 -2
- package/dist/{chunk-IXTFU4PL.cjs → chunk-NL3ZSMZB.cjs} +2 -2
- package/dist/{chunk-L6V3P73N.mjs → chunk-UOXGA6TO.mjs} +4 -4
package/dist/server.d.mts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
export { F as FarmApp, R as RouteManager, S as ServerRenderer, c as createFarmApp } from './app-
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
-
export { g as fileExists, h as globFiles, l as logger, m as matchRoute, b as matchRouteParts, c as matchRoutePrefix, d as matchRoutePrefixParts, p as parseRoutePath, i as parseSearchParams, r as resolveAppPath, s as segmentsToPattern, a as splitRoutePath, e as toPosixPath, t as toRootRelativeUrlPath, f as toViteModuleId } from './utils-
|
|
1
|
+
export { F as FarmApp, R as RouteManager, S as ServerRenderer, c as createFarmApp } from './app-BfzZdjgX.mjs';
|
|
2
|
+
import { J as FarmConfig, C as FarmUserConfig } from './client-plugins-1GS4zubE.mjs';
|
|
3
|
+
export { Q as AppRoutePattern, ae as BuildOptions, a6 as ErrorBoundary, $ as ErrorProps, m as FarmAppContext, O as FarmComponentType, E as FarmContextFactory, Y as FarmContextFactoryInput, Z as FarmIsolatedClientHydrationMode, aj as FarmLayerEntry, an as FarmLayerResolution, U as FarmMigrationCommand, V as FarmMigrationsConfig, W as FarmMigrationsUserConfig, e as FarmRequest, f as FarmResponse, al as FarmSourceRoot, aa as GenerateStaticParams, a4 as Layout, a2 as LayoutMetadataProps, ab as LayoutModule, L as LayoutProps, a5 as Loading, _ as LoadingProps, M as Metadata, ac as MetadataJsonLd, a1 as MetadataProps, ai as MetadataRobots, ah as MetadataRobotsDirectives, G as MiddlewareProps, T as NitroPreset, a3 as Page, o as PageProps, a0 as PagePropsWithMiddleware, S as PageRouteParams, P as ParsedRoute, q as PluginContextProps, am as ResolveFarmLayersOptions, ak as ResolvedFarmLayer, X as ResolvedFarmMigrationsConfig, s as RouteModule, R as RouteSegment, ag as SSGCollectionResult, af as SSGPage, ad as ServerAction, a8 as StaticPathParams, a7 as StaticPathPrimitive, a9 as StaticRouteParams, as as createFarmConfigResolutionPlugin, N as defineConfig, K as farmPlugin, aq as getFarmAppDirectories, ar as getFarmLayerAliases, ap as getFarmSourceRoots, at as loadFarmConfigFile, ao as resolveFarmLayers } from './client-plugins-1GS4zubE.mjs';
|
|
4
|
+
export { g as fileExists, h as globFiles, l as logger, m as matchRoute, b as matchRouteParts, c as matchRoutePrefix, d as matchRoutePrefixParts, p as parseRoutePath, i as parseSearchParams, r as resolveAppPath, s as segmentsToPattern, a as splitRoutePath, e as toPosixPath, t as toRootRelativeUrlPath, f as toViteModuleId } from './utils-B_Rmr0-n.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 { CacheKeyFactory, DefinedCacheKey, FarmCacheAdapter, FarmCacheEntry, FarmCacheInvalidationStreamOptions, FarmCacheInvalidationTarget, FarmCacheOptions, FarmCacheSetOptions, FarmCacheStorage, FarmCacheUserConfig, FarmClientCacheUserConfig, FarmDataCache, GetFarmCacheEntryOptions, InferCacheKeyData, RevalidateTagProfile, RouteDataCacheKey, StorageFarmCacheAdapterOptions, applyFarmCacheInvalidationTargets, applyFarmCacheInvalidations, configureFarmCache, createFarmCacheInvalidationStream, createFarmCacheKey, createPathCacheTag, createRouteDataCacheKey, createRouteDataCacheTag, defineCacheKey, getFarmDataCache, invalidate, invalidateRouteData, normalizeRevalidatePath, revalidatePath, revalidateTag, storageCacheAdapter, unstable_cache, updateTag } from './cache.mjs';
|
|
7
7
|
export { AfterCallback, FarmAfterPlatformContext, _runWithAfterNodeResponse, _runWithAfterRequest, _withAfterNodeMiddleware, after } from './after.mjs';
|
|
8
8
|
export { FARM_SERVER_QUERY_SYMBOL, ServerQuery, ServerQueryKey, ServerQueryOptions, ServerQueryOutputOptions, ServerQueryStaleTime, createServerQuery } from './server-query.mjs';
|
|
9
9
|
import { ViteDevServer } from 'vite';
|
|
10
|
-
|
|
11
|
-
export { g as getCurrentRequest } from './request-CrBCcPZZ.mjs';
|
|
10
|
+
export { g as getCurrentRequest } from './request-DlLVBKe3.mjs';
|
|
12
11
|
import { ServerResponse } from 'node:http';
|
|
13
12
|
export { getTheme, getThemeSnapshot } from './theme/server.mjs';
|
|
14
13
|
export { DEFAULT_SERVER_ACTION_BODY_SIZE_LIMIT, FarmServerActionsConfig, PreparedServerActionRequest, ResolvedFarmServerActionsConfig, SanitizedServerActionError, ServerActionRequestError, ServerActionRequestKind, createServerActionRequestErrorResponse, getServerActionExecutionContext, getServerActionInvalidations, getServerActionSignal, prepareServerActionRequest, resolveServerActionsConfig, runWithServerActionRequest, sanitizeServerActionError, validateServerActionRequest } from './server-action-security.mjs';
|
|
@@ -18,7 +17,6 @@ export { BuiltinDriverName, BuiltinDriverOptions, Driver, Storage, StorageMeta,
|
|
|
18
17
|
export { ConnectorName, ConnectorOptions, Database } from 'db0';
|
|
19
18
|
import './types-DFbjpjXX.mjs';
|
|
20
19
|
import '@farming-labs/docs';
|
|
21
|
-
import './markdown.mjs';
|
|
22
20
|
import './workflows-CR9ex-gz.mjs';
|
|
23
21
|
import './cron.mjs';
|
|
24
22
|
import './image-config-Duob7wER.mjs';
|
|
@@ -26,14 +24,14 @@ import './routes.mjs';
|
|
|
26
24
|
import 'react';
|
|
27
25
|
import './server-fn.mjs';
|
|
28
26
|
import './server-fn-error-DDh14a0V.mjs';
|
|
29
|
-
import './endpoint-
|
|
27
|
+
import './endpoint-CCHFqyTE.mjs';
|
|
30
28
|
import './renderer.mjs';
|
|
31
29
|
import './deployment.mjs';
|
|
32
30
|
import './lifecycle-DK06VuKP.mjs';
|
|
33
|
-
import './
|
|
31
|
+
import './integration-api-0y4FXJpC.mjs';
|
|
34
32
|
import 'http';
|
|
33
|
+
import './types-Z0aotQ8w.mjs';
|
|
35
34
|
import './schema.mjs';
|
|
36
|
-
import './integration-api-BbaiokCC.mjs';
|
|
37
35
|
import '@farming-labs/orm';
|
|
38
36
|
import './observability-BupkiN0m.mjs';
|
|
39
37
|
import '@opentelemetry/api';
|
|
@@ -43,8 +41,8 @@ import 'rolldown';
|
|
|
43
41
|
import './types-DQnyD3VD.mjs';
|
|
44
42
|
import './font.mjs';
|
|
45
43
|
import './island-CfGru1MO.mjs';
|
|
46
|
-
import './metadata-
|
|
47
|
-
import './render-plan-
|
|
44
|
+
import './metadata-B9mCxKgp.mjs';
|
|
45
|
+
import './render-plan-CtQB-zHS.mjs';
|
|
48
46
|
import './runtime-AOJge4vQ.mjs';
|
|
49
47
|
import './resolver-DhW0CqZN.mjs';
|
|
50
48
|
|
|
@@ -52,13 +50,13 @@ declare const DEFAULT_FARM_DEV_SERVER_PORT = 3000;
|
|
|
52
50
|
/**
|
|
53
51
|
* Create a Vite development server with Farm.js integration
|
|
54
52
|
*/
|
|
55
|
-
declare function createServer(config?: FarmConfig, options?: {
|
|
53
|
+
declare function createServer(config?: FarmConfig | FarmUserConfig, options?: {
|
|
56
54
|
port?: number;
|
|
57
55
|
}): Promise<ViteDevServer>;
|
|
58
56
|
/**
|
|
59
57
|
* Start the development server
|
|
60
58
|
*/
|
|
61
|
-
declare function startDevServer(config?: FarmConfig, port?: number): Promise<ViteDevServer>;
|
|
59
|
+
declare function startDevServer(config?: FarmConfig | FarmUserConfig, port?: number): Promise<ViteDevServer>;
|
|
62
60
|
|
|
63
61
|
declare function sendWebResponse(res: ServerResponse, response: Response): Promise<void>;
|
|
64
62
|
|
package/dist/server.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
export { F as FarmApp, R as RouteManager, S as ServerRenderer, c as createFarmApp } from './app-
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
-
export { g as fileExists, h as globFiles, l as logger, m as matchRoute, b as matchRouteParts, c as matchRoutePrefix, d as matchRoutePrefixParts, p as parseRoutePath, i as parseSearchParams, r as resolveAppPath, s as segmentsToPattern, a as splitRoutePath, e as toPosixPath, t as toRootRelativeUrlPath, f as toViteModuleId } from './utils-
|
|
1
|
+
export { F as FarmApp, R as RouteManager, S as ServerRenderer, c as createFarmApp } from './app-CXK7Prrt.js';
|
|
2
|
+
import { J as FarmConfig, C as FarmUserConfig } from './client-plugins-B1Za6F5x.js';
|
|
3
|
+
export { Q as AppRoutePattern, ae as BuildOptions, a6 as ErrorBoundary, $ as ErrorProps, m as FarmAppContext, O as FarmComponentType, E as FarmContextFactory, Y as FarmContextFactoryInput, Z as FarmIsolatedClientHydrationMode, aj as FarmLayerEntry, an as FarmLayerResolution, U as FarmMigrationCommand, V as FarmMigrationsConfig, W as FarmMigrationsUserConfig, e as FarmRequest, f as FarmResponse, al as FarmSourceRoot, aa as GenerateStaticParams, a4 as Layout, a2 as LayoutMetadataProps, ab as LayoutModule, L as LayoutProps, a5 as Loading, _ as LoadingProps, M as Metadata, ac as MetadataJsonLd, a1 as MetadataProps, ai as MetadataRobots, ah as MetadataRobotsDirectives, G as MiddlewareProps, T as NitroPreset, a3 as Page, o as PageProps, a0 as PagePropsWithMiddleware, S as PageRouteParams, P as ParsedRoute, q as PluginContextProps, am as ResolveFarmLayersOptions, ak as ResolvedFarmLayer, X as ResolvedFarmMigrationsConfig, s as RouteModule, R as RouteSegment, ag as SSGCollectionResult, af as SSGPage, ad as ServerAction, a8 as StaticPathParams, a7 as StaticPathPrimitive, a9 as StaticRouteParams, as as createFarmConfigResolutionPlugin, N as defineConfig, K as farmPlugin, aq as getFarmAppDirectories, ar as getFarmLayerAliases, ap as getFarmSourceRoots, at as loadFarmConfigFile, ao as resolveFarmLayers } from './client-plugins-B1Za6F5x.js';
|
|
4
|
+
export { g as fileExists, h as globFiles, l as logger, m as matchRoute, b as matchRouteParts, c as matchRoutePrefix, d as matchRoutePrefixParts, p as parseRoutePath, i as parseSearchParams, r as resolveAppPath, s as segmentsToPattern, a as splitRoutePath, e as toPosixPath, t as toRootRelativeUrlPath, f as toViteModuleId } from './utils-Dv0OuLtF.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 { CacheKeyFactory, DefinedCacheKey, FarmCacheAdapter, FarmCacheEntry, FarmCacheInvalidationStreamOptions, FarmCacheInvalidationTarget, FarmCacheOptions, FarmCacheSetOptions, FarmCacheStorage, FarmCacheUserConfig, FarmClientCacheUserConfig, FarmDataCache, GetFarmCacheEntryOptions, InferCacheKeyData, RevalidateTagProfile, RouteDataCacheKey, StorageFarmCacheAdapterOptions, applyFarmCacheInvalidationTargets, applyFarmCacheInvalidations, configureFarmCache, createFarmCacheInvalidationStream, createFarmCacheKey, createPathCacheTag, createRouteDataCacheKey, createRouteDataCacheTag, defineCacheKey, getFarmDataCache, invalidate, invalidateRouteData, normalizeRevalidatePath, revalidatePath, revalidateTag, storageCacheAdapter, unstable_cache, updateTag } from './cache.js';
|
|
7
7
|
export { AfterCallback, FarmAfterPlatformContext, _runWithAfterNodeResponse, _runWithAfterRequest, _withAfterNodeMiddleware, after } from './after.js';
|
|
8
8
|
export { FARM_SERVER_QUERY_SYMBOL, ServerQuery, ServerQueryKey, ServerQueryOptions, ServerQueryOutputOptions, ServerQueryStaleTime, createServerQuery } from './server-query.js';
|
|
9
9
|
import { ViteDevServer } from 'vite';
|
|
10
|
-
|
|
11
|
-
export { g as getCurrentRequest } from './request-CR-Bp1Px.js';
|
|
10
|
+
export { g as getCurrentRequest } from './request-BVGGeQv4.js';
|
|
12
11
|
import { ServerResponse } from 'node:http';
|
|
13
12
|
export { getTheme, getThemeSnapshot } from './theme/server.js';
|
|
14
13
|
export { DEFAULT_SERVER_ACTION_BODY_SIZE_LIMIT, FarmServerActionsConfig, PreparedServerActionRequest, ResolvedFarmServerActionsConfig, SanitizedServerActionError, ServerActionRequestError, ServerActionRequestKind, createServerActionRequestErrorResponse, getServerActionExecutionContext, getServerActionInvalidations, getServerActionSignal, prepareServerActionRequest, resolveServerActionsConfig, runWithServerActionRequest, sanitizeServerActionError, validateServerActionRequest } from './server-action-security.js';
|
|
@@ -18,7 +17,6 @@ export { BuiltinDriverName, BuiltinDriverOptions, Driver, Storage, StorageMeta,
|
|
|
18
17
|
export { ConnectorName, ConnectorOptions, Database } from 'db0';
|
|
19
18
|
import './types-DFbjpjXX.js';
|
|
20
19
|
import '@farming-labs/docs';
|
|
21
|
-
import './markdown.js';
|
|
22
20
|
import './workflows-CR9ex-gz.js';
|
|
23
21
|
import './cron.js';
|
|
24
22
|
import './image-config-Duob7wER.js';
|
|
@@ -26,14 +24,14 @@ import './routes.js';
|
|
|
26
24
|
import 'react';
|
|
27
25
|
import './server-fn.js';
|
|
28
26
|
import './server-fn-error-DDh14a0V.js';
|
|
29
|
-
import './endpoint-
|
|
27
|
+
import './endpoint-CA-TNX60.js';
|
|
30
28
|
import './renderer.js';
|
|
31
29
|
import './deployment.js';
|
|
32
30
|
import './lifecycle-DK06VuKP.js';
|
|
33
|
-
import './
|
|
31
|
+
import './integration-api-BPJo5oXb.js';
|
|
34
32
|
import 'http';
|
|
33
|
+
import './types-Z0aotQ8w.js';
|
|
35
34
|
import './schema.js';
|
|
36
|
-
import './integration-api-BbaiokCC.js';
|
|
37
35
|
import '@farming-labs/orm';
|
|
38
36
|
import './observability-BupkiN0m.js';
|
|
39
37
|
import '@opentelemetry/api';
|
|
@@ -43,8 +41,8 @@ import 'rolldown';
|
|
|
43
41
|
import './types-DQnyD3VD.js';
|
|
44
42
|
import './font.js';
|
|
45
43
|
import './island-CfGru1MO.js';
|
|
46
|
-
import './metadata-
|
|
47
|
-
import './render-plan-
|
|
44
|
+
import './metadata-7LKgQEWF.js';
|
|
45
|
+
import './render-plan-CpW32tOL.js';
|
|
48
46
|
import './runtime-BirxPwbZ.js';
|
|
49
47
|
import './resolver-PPEeiJ6M.js';
|
|
50
48
|
|
|
@@ -52,13 +50,13 @@ declare const DEFAULT_FARM_DEV_SERVER_PORT = 3000;
|
|
|
52
50
|
/**
|
|
53
51
|
* Create a Vite development server with Farm.js integration
|
|
54
52
|
*/
|
|
55
|
-
declare function createServer(config?: FarmConfig, options?: {
|
|
53
|
+
declare function createServer(config?: FarmConfig | FarmUserConfig, options?: {
|
|
56
54
|
port?: number;
|
|
57
55
|
}): Promise<ViteDevServer>;
|
|
58
56
|
/**
|
|
59
57
|
* Start the development server
|
|
60
58
|
*/
|
|
61
|
-
declare function startDevServer(config?: FarmConfig, port?: number): Promise<ViteDevServer>;
|
|
59
|
+
declare function startDevServer(config?: FarmConfig | FarmUserConfig, port?: number): Promise<ViteDevServer>;
|
|
62
60
|
|
|
63
61
|
declare function sendWebResponse(res: ServerResponse, response: Response): Promise<void>;
|
|
64
62
|
|
package/dist/server.mjs
CHANGED
|
@@ -16,9 +16,10 @@ import {
|
|
|
16
16
|
loadFarmDocsEngine
|
|
17
17
|
} from "./chunk-2VQKKQ6D.mjs";
|
|
18
18
|
import {
|
|
19
|
+
isResolvedFarmConfig,
|
|
19
20
|
loadConfig,
|
|
20
21
|
resolveConfig
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-WIVTGKLY.mjs";
|
|
22
23
|
import "./chunk-XZNTNMHT.mjs";
|
|
23
24
|
import {
|
|
24
25
|
loadFarmInstrumentation,
|
|
@@ -45,14 +46,14 @@ import {
|
|
|
45
46
|
loadTailwindVitePlugin,
|
|
46
47
|
mergeFarmViteConfig,
|
|
47
48
|
resolveFarmImageProviderForRuntime
|
|
48
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-OGHTEYXS.mjs";
|
|
49
50
|
import "./chunk-VVJCWBIE.mjs";
|
|
50
51
|
import {
|
|
51
52
|
readSchemaTables
|
|
52
53
|
} from "./chunk-HALDNTIV.mjs";
|
|
53
54
|
import "./chunk-ZMSZZXOR.mjs";
|
|
54
55
|
import "./chunk-F3VB7ONA.mjs";
|
|
55
|
-
import "./chunk-
|
|
56
|
+
import "./chunk-HG237IEY.mjs";
|
|
56
57
|
import "./chunk-DAO7JGTS.mjs";
|
|
57
58
|
import "./chunk-BOYNDCZL.mjs";
|
|
58
59
|
import "./chunk-YQVSHTMR.mjs";
|
|
@@ -86,7 +87,7 @@ import {
|
|
|
86
87
|
loadFarmRendererVitePlugins,
|
|
87
88
|
resolveFarmRenderer
|
|
88
89
|
} from "./chunk-DAATZTKJ.mjs";
|
|
89
|
-
import "./chunk-
|
|
90
|
+
import "./chunk-JT25KHDI.mjs";
|
|
90
91
|
import "./chunk-G2KY33I6.mjs";
|
|
91
92
|
import "./chunk-YHOCRI4H.mjs";
|
|
92
93
|
import {
|
|
@@ -102,11 +103,13 @@ import {
|
|
|
102
103
|
sanitizeServerActionError,
|
|
103
104
|
validateServerActionRequest
|
|
104
105
|
} from "./chunk-QCFFHV5H.mjs";
|
|
105
|
-
import
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
import {
|
|
107
|
+
setEnv
|
|
108
|
+
} from "./chunk-4OOBRCJX.mjs";
|
|
109
|
+
import "./chunk-3PTVHMLD.mjs";
|
|
110
|
+
import "./chunk-MBFURXAC.mjs";
|
|
108
111
|
import "./chunk-FA2W42OV.mjs";
|
|
109
|
-
import "./chunk-
|
|
112
|
+
import "./chunk-POXI72VV.mjs";
|
|
110
113
|
import "./chunk-MVL2RAJW.mjs";
|
|
111
114
|
import "./chunk-SFGWNC43.mjs";
|
|
112
115
|
import "./chunk-3ATMYLLJ.mjs";
|
|
@@ -155,17 +158,18 @@ import {
|
|
|
155
158
|
_withAfterNodeMiddleware,
|
|
156
159
|
after
|
|
157
160
|
} from "./chunk-IOEH4VWN.mjs";
|
|
158
|
-
import "./chunk-
|
|
161
|
+
import "./chunk-Q4BHBO6V.mjs";
|
|
159
162
|
import "./chunk-YOYF2E4U.mjs";
|
|
160
163
|
import "./chunk-CU625VAY.mjs";
|
|
161
164
|
import "./chunk-JNGIWIY6.mjs";
|
|
162
165
|
import "./chunk-FV45CKBC.mjs";
|
|
163
166
|
import "./chunk-YOZYCI6Z.mjs";
|
|
164
|
-
import "./chunk-
|
|
167
|
+
import "./chunk-6EG7U4NF.mjs";
|
|
165
168
|
import "./chunk-SYGGPS4A.mjs";
|
|
166
169
|
import "./chunk-W3B4PKAW.mjs";
|
|
167
|
-
import "./chunk-I6XDAKWQ.mjs";
|
|
168
170
|
import "./chunk-5WI2S4CO.mjs";
|
|
171
|
+
import "./chunk-O6XNAMBV.mjs";
|
|
172
|
+
import "./chunk-I6XDAKWQ.mjs";
|
|
169
173
|
import "./chunk-EA5K5BKU.mjs";
|
|
170
174
|
import "./chunk-2J7W2WND.mjs";
|
|
171
175
|
import "./chunk-XF7Q24PF.mjs";
|
|
@@ -197,13 +201,13 @@ import {
|
|
|
197
201
|
} from "./chunk-Z2RZJZIZ.mjs";
|
|
198
202
|
import {
|
|
199
203
|
FARM_VERSION
|
|
200
|
-
} from "./chunk-
|
|
204
|
+
} from "./chunk-QQQNJS2E.mjs";
|
|
201
205
|
import "./chunk-54UPOYFS.mjs";
|
|
202
206
|
import "./chunk-WNSDDRNU.mjs";
|
|
203
207
|
import "./chunk-JPLUGGRV.mjs";
|
|
204
208
|
import "./chunk-G4MWPDSE.mjs";
|
|
205
|
-
import "./chunk-O7BH5O46.mjs";
|
|
206
209
|
import "./chunk-EMLAPBEM.mjs";
|
|
210
|
+
import "./chunk-O7BH5O46.mjs";
|
|
207
211
|
import "./chunk-7LTCDQRS.mjs";
|
|
208
212
|
import "./chunk-IXUY2F5U.mjs";
|
|
209
213
|
import "./chunk-CEYUWDWA.mjs";
|
|
@@ -261,11 +265,30 @@ import {
|
|
|
261
265
|
__name
|
|
262
266
|
} from "./chunk-LPEX4YW6.mjs";
|
|
263
267
|
|
|
264
|
-
// src/server/create-server.ts
|
|
265
|
-
import { createServer as createViteServer } from "vite";
|
|
266
|
-
|
|
267
268
|
// src/server/dev-lifecycle.ts
|
|
269
|
+
import {
|
|
270
|
+
createServer,
|
|
271
|
+
resolveConfig as resolveConfig2
|
|
272
|
+
} from "vite";
|
|
268
273
|
var VITE_CLOSE_TIMEOUT_MS = 1e4;
|
|
274
|
+
async function createViteDevServer(config, capture) {
|
|
275
|
+
const resolved = await resolveConfig2(
|
|
276
|
+
config,
|
|
277
|
+
"serve",
|
|
278
|
+
void 0,
|
|
279
|
+
void 0,
|
|
280
|
+
false,
|
|
281
|
+
void 0,
|
|
282
|
+
(plugins) => {
|
|
283
|
+
plugins.unshift({
|
|
284
|
+
name: "farm:dev-construction",
|
|
285
|
+
configureServer: { order: "pre", handler: capture }
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
);
|
|
289
|
+
return createServer(resolved);
|
|
290
|
+
}
|
|
291
|
+
__name(createViteDevServer, "createViteDevServer");
|
|
269
292
|
async function drainVitePendingWork(server) {
|
|
270
293
|
const environments = Object.values(server.environments ?? {});
|
|
271
294
|
await Promise.allSettled(
|
|
@@ -285,6 +308,44 @@ async function drainVitePendingWork(server) {
|
|
|
285
308
|
}
|
|
286
309
|
}
|
|
287
310
|
__name(drainVitePendingWork, "drainVitePendingWork");
|
|
311
|
+
async function closeViteDevServer(server, closeViteServer) {
|
|
312
|
+
const closingHttpServer = server.httpServer;
|
|
313
|
+
const closingWatcher = server.watcher;
|
|
314
|
+
const closingWebSocket = server.ws;
|
|
315
|
+
let timer;
|
|
316
|
+
const timedOut = new Promise((resolve) => {
|
|
317
|
+
timer = setTimeout(() => resolve("timeout"), VITE_CLOSE_TIMEOUT_MS);
|
|
318
|
+
timer.unref?.();
|
|
319
|
+
});
|
|
320
|
+
try {
|
|
321
|
+
const outcome = await Promise.race([
|
|
322
|
+
(async () => {
|
|
323
|
+
await drainVitePendingWork(server);
|
|
324
|
+
await closeViteServer();
|
|
325
|
+
return "closed";
|
|
326
|
+
})(),
|
|
327
|
+
timedOut
|
|
328
|
+
]);
|
|
329
|
+
if (outcome === "timeout") {
|
|
330
|
+
logger.error(
|
|
331
|
+
`Vite server close did not settle within ${VITE_CLOSE_TIMEOUT_MS}ms; continuing shutdown without it (https://github.com/farming-labs/farm.js/issues/1263)`
|
|
332
|
+
);
|
|
333
|
+
await Promise.allSettled([
|
|
334
|
+
new Promise((resolve) => {
|
|
335
|
+
if (!closingHttpServer || !closingHttpServer.listening) return resolve();
|
|
336
|
+
closingHttpServer.close(() => resolve());
|
|
337
|
+
}),
|
|
338
|
+
Promise.resolve(closingWatcher?.close?.()).catch(() => {
|
|
339
|
+
}),
|
|
340
|
+
Promise.resolve(closingWebSocket?.close?.()).catch(() => {
|
|
341
|
+
})
|
|
342
|
+
]);
|
|
343
|
+
}
|
|
344
|
+
} finally {
|
|
345
|
+
if (timer) clearTimeout(timer);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
__name(closeViteDevServer, "closeViteDevServer");
|
|
288
349
|
function createFarmDevLifecyclePlugin(pluginManager, instrumentation) {
|
|
289
350
|
let runtimeServer;
|
|
290
351
|
const pendingRestarts = /* @__PURE__ */ new Set();
|
|
@@ -294,9 +355,6 @@ function createFarmDevLifecyclePlugin(pluginManager, instrumentation) {
|
|
|
294
355
|
shutdownPromise ?? (shutdownPromise = (async () => {
|
|
295
356
|
await Promise.allSettled(pendingRestarts);
|
|
296
357
|
const closeViteServer = viteClosers.get(server.environments);
|
|
297
|
-
const closingHttpServer = server.httpServer;
|
|
298
|
-
const closingWatcher = server.watcher;
|
|
299
|
-
const closingWebSocket = server.ws;
|
|
300
358
|
const failures = [];
|
|
301
359
|
const step = /* @__PURE__ */ __name(async (label, run) => {
|
|
302
360
|
try {
|
|
@@ -305,40 +363,7 @@ function createFarmDevLifecyclePlugin(pluginManager, instrumentation) {
|
|
|
305
363
|
failures.push({ label, error });
|
|
306
364
|
}
|
|
307
365
|
}, "step");
|
|
308
|
-
await step("Vite server close",
|
|
309
|
-
let timer;
|
|
310
|
-
const timedOut = new Promise((resolve) => {
|
|
311
|
-
timer = setTimeout(() => resolve("timeout"), VITE_CLOSE_TIMEOUT_MS);
|
|
312
|
-
timer.unref?.();
|
|
313
|
-
});
|
|
314
|
-
try {
|
|
315
|
-
const outcome = await Promise.race([
|
|
316
|
-
(async () => {
|
|
317
|
-
await drainVitePendingWork(server);
|
|
318
|
-
await closeViteServer();
|
|
319
|
-
return "closed";
|
|
320
|
-
})(),
|
|
321
|
-
timedOut
|
|
322
|
-
]);
|
|
323
|
-
if (outcome === "timeout") {
|
|
324
|
-
logger.error(
|
|
325
|
-
`Vite server close did not settle within ${VITE_CLOSE_TIMEOUT_MS}ms; continuing shutdown without it (https://github.com/farming-labs/farm.js/issues/1263)`
|
|
326
|
-
);
|
|
327
|
-
await Promise.allSettled([
|
|
328
|
-
new Promise((resolve) => {
|
|
329
|
-
if (!closingHttpServer || !closingHttpServer.listening) return resolve();
|
|
330
|
-
closingHttpServer.close(() => resolve());
|
|
331
|
-
}),
|
|
332
|
-
Promise.resolve(closingWatcher?.close?.()).catch(() => {
|
|
333
|
-
}),
|
|
334
|
-
Promise.resolve(closingWebSocket?.close?.()).catch(() => {
|
|
335
|
-
})
|
|
336
|
-
]);
|
|
337
|
-
}
|
|
338
|
-
} finally {
|
|
339
|
-
if (timer) clearTimeout(timer);
|
|
340
|
-
}
|
|
341
|
-
});
|
|
366
|
+
await step("Vite server close", () => closeViteDevServer(server, closeViteServer));
|
|
342
367
|
await step("Plugin runtime shutdown", () => pluginManager.closeRuntime("dev-server-closed"));
|
|
343
368
|
await step("Instrumentation shutdown", () => instrumentation.shutdown());
|
|
344
369
|
if (failures.length === 1) throw failures[0].error;
|
|
@@ -477,19 +502,66 @@ function withPortFlag(vite, port) {
|
|
|
477
502
|
return port === void 0 ? vite : { ...vite, server: { ...vite?.server, port } };
|
|
478
503
|
}
|
|
479
504
|
__name(withPortFlag, "withPortFlag");
|
|
480
|
-
|
|
505
|
+
function inlineEnvScope(scope) {
|
|
506
|
+
return Object.fromEntries(
|
|
507
|
+
Object.entries(scope || {}).map(([key, value]) => [
|
|
508
|
+
key,
|
|
509
|
+
typeof value === "function" || value && typeof value === "object" && "parse" in value && typeof value.parse === "function" ? value : () => value
|
|
510
|
+
])
|
|
511
|
+
);
|
|
512
|
+
}
|
|
513
|
+
__name(inlineEnvScope, "inlineEnvScope");
|
|
514
|
+
async function resolveInlineConfig(config, mode) {
|
|
515
|
+
if (isResolvedFarmConfig(config)) {
|
|
516
|
+
setEnv(config.env);
|
|
517
|
+
return { ...config };
|
|
518
|
+
}
|
|
519
|
+
const docs = config.docs;
|
|
520
|
+
const resolvedDocs = docs && typeof docs === "object" && "enabled" in docs && "entry" in docs && "config" in docs ? docs : void 0;
|
|
521
|
+
const i18n = config.i18n;
|
|
522
|
+
const resolvedI18n = i18n && "enabled" in i18n ? i18n : void 0;
|
|
523
|
+
const auth = config.auth;
|
|
524
|
+
const resolvedAuth = auth && typeof auth === "object" && typeof auth.emailAndPassword === "object" && "enabled" in auth.emailAndPassword ? auth : void 0;
|
|
525
|
+
const resolved = await resolveConfig(
|
|
526
|
+
{
|
|
527
|
+
...config,
|
|
528
|
+
...resolvedDocs ? { docs: false } : {},
|
|
529
|
+
...resolvedI18n ? { i18n: false } : {},
|
|
530
|
+
...resolvedAuth ? { auth: false } : {},
|
|
531
|
+
...config.layers ? { extends: [] } : {},
|
|
532
|
+
// FarmConfig also accepts literal runtime env values. Adapt only inline
|
|
533
|
+
// input; file/layer config keeps the normal parser validation contract.
|
|
534
|
+
env: config.env && {
|
|
535
|
+
server: inlineEnvScope(config.env.server),
|
|
536
|
+
public: inlineEnvScope(config.env.public)
|
|
537
|
+
}
|
|
538
|
+
},
|
|
539
|
+
mode
|
|
540
|
+
);
|
|
541
|
+
if (resolvedDocs) resolved.docs = resolvedDocs;
|
|
542
|
+
if (resolvedI18n) resolved.i18n = resolvedI18n;
|
|
543
|
+
if (resolvedAuth) resolved.auth = resolvedAuth;
|
|
544
|
+
if (config.layers) {
|
|
545
|
+
resolved.extends = config.extends || [];
|
|
546
|
+
resolved.layers = [...config.layers];
|
|
547
|
+
}
|
|
548
|
+
return resolved;
|
|
549
|
+
}
|
|
550
|
+
__name(resolveInlineConfig, "resolveInlineConfig");
|
|
551
|
+
async function createServer2(config = {}, options = {}) {
|
|
481
552
|
let pluginManager = null;
|
|
482
553
|
let instrumentation = null;
|
|
554
|
+
let server;
|
|
555
|
+
let pendingViteServer;
|
|
483
556
|
try {
|
|
484
557
|
const root = config.root || process.cwd();
|
|
485
558
|
const mode = process.env.NODE_ENV === "production" ? "production" : "development";
|
|
486
559
|
const userConfig = await loadConfig(root, void 0, mode);
|
|
487
|
-
const resolvedConfig = userConfig ? await resolveConfig(userConfig, mode) :
|
|
488
|
-
const
|
|
489
|
-
const instrumentationRoot = instrumentationConfig.root || root;
|
|
560
|
+
const resolvedConfig = userConfig ? await resolveConfig(userConfig, mode) : await resolveInlineConfig(config, mode);
|
|
561
|
+
const instrumentationRoot = resolvedConfig.root;
|
|
490
562
|
const instrumentationFile = resolveFarmInstrumentationFile(
|
|
491
563
|
instrumentationRoot,
|
|
492
|
-
|
|
564
|
+
resolvedConfig.srcDir
|
|
493
565
|
);
|
|
494
566
|
const instrumentationModule = await loadFarmInstrumentation(
|
|
495
567
|
instrumentationFile,
|
|
@@ -502,31 +574,27 @@ async function createServer(config = {}, options = {}) {
|
|
|
502
574
|
});
|
|
503
575
|
await instrumentation.start();
|
|
504
576
|
pluginManager = new PluginManager({
|
|
505
|
-
config: resolvedConfig
|
|
577
|
+
config: resolvedConfig,
|
|
506
578
|
isDev: mode === "development",
|
|
507
579
|
isProd: mode === "production"
|
|
508
580
|
});
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
pluginManager.addPlugin(createHeadersPlugin(headers, { i18n: resolvedConfig.i18n }));
|
|
518
|
-
}
|
|
519
|
-
if (rewrites.length > 0) {
|
|
520
|
-
pluginManager.addPlugin(createRewritesPlugin(rewrites, { i18n: resolvedConfig.i18n }));
|
|
521
|
-
}
|
|
522
|
-
if (resolvedConfig.compress && mode === "production") {
|
|
523
|
-
pluginManager.addPlugin(createCompressionPlugin());
|
|
524
|
-
}
|
|
525
|
-
if (resolvedConfig.plugins) {
|
|
526
|
-
pluginManager.addPlugins(resolvedConfig.plugins);
|
|
527
|
-
}
|
|
581
|
+
const redirects = await resolvedConfig.redirects();
|
|
582
|
+
const headers = await resolvedConfig.headers();
|
|
583
|
+
const rewrites = await resolvedConfig.rewrites();
|
|
584
|
+
if (redirects.length > 0) {
|
|
585
|
+
pluginManager.addPlugin(createRedirectsPlugin(redirects, { i18n: resolvedConfig.i18n }));
|
|
586
|
+
}
|
|
587
|
+
if (headers.length > 0) {
|
|
588
|
+
pluginManager.addPlugin(createHeadersPlugin(headers, { i18n: resolvedConfig.i18n }));
|
|
528
589
|
}
|
|
529
|
-
|
|
590
|
+
if (rewrites.length > 0) {
|
|
591
|
+
pluginManager.addPlugin(createRewritesPlugin(rewrites, { i18n: resolvedConfig.i18n }));
|
|
592
|
+
}
|
|
593
|
+
if (resolvedConfig.compress && mode === "production") {
|
|
594
|
+
pluginManager.addPlugin(createCompressionPlugin());
|
|
595
|
+
}
|
|
596
|
+
pluginManager.addPlugins(resolvedConfig.plugins);
|
|
597
|
+
const infraAnalytics = resolvedConfig.analytics !== false ? createFarmInfraAnalyticsPlugin() : null;
|
|
530
598
|
if (infraAnalytics) pluginManager.addPlugin(infraAnalytics);
|
|
531
599
|
if (mode === "development") {
|
|
532
600
|
const hasLogger = pluginManager.getPlugins().some((p) => p.name === "farm:logger");
|
|
@@ -535,7 +603,7 @@ async function createServer(config = {}, options = {}) {
|
|
|
535
603
|
}
|
|
536
604
|
}
|
|
537
605
|
await pluginManager.runHookParallel("init");
|
|
538
|
-
let finalConfig = resolvedConfig
|
|
606
|
+
let finalConfig = resolvedConfig;
|
|
539
607
|
finalConfig = await pluginManager.runHookSerial("config", finalConfig);
|
|
540
608
|
finalConfig.renderer = resolveFarmRenderer(finalConfig.renderer);
|
|
541
609
|
const projectRoot = finalConfig.root || process.cwd();
|
|
@@ -558,7 +626,7 @@ async function createServer(config = {}, options = {}) {
|
|
|
558
626
|
} else {
|
|
559
627
|
tailwindVitePlugin = await loadTailwindVitePlugin();
|
|
560
628
|
}
|
|
561
|
-
|
|
629
|
+
server = await createViteDevServer(
|
|
562
630
|
mergeFarmViteConfig(
|
|
563
631
|
{
|
|
564
632
|
root: projectRoot,
|
|
@@ -630,8 +698,12 @@ async function createServer(config = {}, options = {}) {
|
|
|
630
698
|
}
|
|
631
699
|
},
|
|
632
700
|
withPortFlag(finalConfig.vite, options.port)
|
|
633
|
-
)
|
|
701
|
+
),
|
|
702
|
+
(candidate) => {
|
|
703
|
+
pendingViteServer = candidate;
|
|
704
|
+
}
|
|
634
705
|
);
|
|
706
|
+
pendingViteServer = void 0;
|
|
635
707
|
server.__farmPluginManager = pluginManager;
|
|
636
708
|
server.__farmResolvedConfig = resolvedConfig;
|
|
637
709
|
server.__farmInstrumentation = instrumentation;
|
|
@@ -642,19 +714,41 @@ async function createServer(config = {}, options = {}) {
|
|
|
642
714
|
await pluginManager.runHookParallel("buildStart");
|
|
643
715
|
return server;
|
|
644
716
|
} catch (error) {
|
|
645
|
-
|
|
646
|
-
|
|
717
|
+
const attempt = /* @__PURE__ */ __name(async (operation, run) => {
|
|
718
|
+
try {
|
|
719
|
+
await run();
|
|
720
|
+
} catch (cleanupError) {
|
|
721
|
+
console.error(`Failed to ${operation} after a server creation failure:`, cleanupError);
|
|
722
|
+
}
|
|
723
|
+
}, "attempt");
|
|
724
|
+
await attempt(
|
|
725
|
+
"run plugin error hooks",
|
|
726
|
+
() => pluginManager?.runHookParallel("onError", {
|
|
647
727
|
phase: "createServer",
|
|
648
728
|
error
|
|
649
|
-
})
|
|
729
|
+
})
|
|
730
|
+
);
|
|
731
|
+
if (server) {
|
|
732
|
+
await attempt("close the dev server", server.close.bind(server));
|
|
733
|
+
} else {
|
|
734
|
+
const partialServer = pendingViteServer;
|
|
735
|
+
if (partialServer) {
|
|
736
|
+
await attempt(
|
|
737
|
+
"close the partially created Vite server",
|
|
738
|
+
() => closeViteDevServer(partialServer, partialServer.close.bind(partialServer))
|
|
739
|
+
);
|
|
740
|
+
}
|
|
741
|
+
await attempt(
|
|
742
|
+
"close the plugin runtime",
|
|
743
|
+
() => pluginManager?.closeRuntime("dev-server-creation-failed")
|
|
744
|
+
);
|
|
745
|
+
await attempt("shut down instrumentation", () => instrumentation?.shutdown());
|
|
650
746
|
}
|
|
651
|
-
await instrumentation?.shutdown().catch(() => {
|
|
652
|
-
});
|
|
653
747
|
logger.error(`Failed to create server: ${error}`);
|
|
654
748
|
throw error;
|
|
655
749
|
}
|
|
656
750
|
}
|
|
657
|
-
__name(
|
|
751
|
+
__name(createServer2, "createServer");
|
|
658
752
|
function noticeSchemaChangesInBackground(config) {
|
|
659
753
|
if (!config) return false;
|
|
660
754
|
const candidates = [
|
|
@@ -668,7 +762,7 @@ function noticeSchemaChangesInBackground(config) {
|
|
|
668
762
|
}
|
|
669
763
|
__name(noticeSchemaChangesInBackground, "noticeSchemaChangesInBackground");
|
|
670
764
|
async function startDevServer(config = {}, port) {
|
|
671
|
-
const server = await
|
|
765
|
+
const server = await createServer2(config, { port });
|
|
672
766
|
try {
|
|
673
767
|
await server.listen(port);
|
|
674
768
|
const pluginManager = server.__farmPluginManager;
|
|
@@ -712,7 +806,7 @@ export {
|
|
|
712
806
|
createPathCacheTag,
|
|
713
807
|
createRouteDataCacheKey,
|
|
714
808
|
createRouteDataCacheTag,
|
|
715
|
-
createServer,
|
|
809
|
+
createServer2 as createServer,
|
|
716
810
|
createServerActionRequestErrorResponse,
|
|
717
811
|
createServerOnlyFn,
|
|
718
812
|
createServerQuery,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { M as Metadata } from './client-plugins-
|
|
1
|
+
import { M as Metadata } from './client-plugins-1GS4zubE.mjs';
|
|
2
2
|
import { F as FarmClientPluginManager } from './lifecycle-DK06VuKP.mjs';
|
|
3
3
|
import { F as FarmI18nClientSnapshot } from './types-Z0aotQ8w.mjs';
|
|
4
4
|
import { F as FarmIslandStrategy } from './island-CfGru1MO.mjs';
|
|
5
|
-
import { F as FarmRouteRenderPlan } from './render-plan-
|
|
5
|
+
import { F as FarmRouteRenderPlan } from './render-plan-CtQB-zHS.mjs';
|
|
6
6
|
|
|
7
7
|
type NavigationMetadata = (Metadata & Record<string, any>) | undefined;
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { M as Metadata } from './client-plugins-
|
|
1
|
+
import { M as Metadata } from './client-plugins-B1Za6F5x.js';
|
|
2
2
|
import { F as FarmClientPluginManager } from './lifecycle-DK06VuKP.js';
|
|
3
3
|
import { F as FarmI18nClientSnapshot } from './types-Z0aotQ8w.js';
|
|
4
4
|
import { F as FarmIslandStrategy } from './island-CfGru1MO.js';
|
|
5
|
-
import { F as FarmRouteRenderPlan } from './render-plan-
|
|
5
|
+
import { F as FarmRouteRenderPlan } from './render-plan-CpW32tOL.js';
|
|
6
6
|
|
|
7
7
|
type NavigationMetadata = (Metadata & Record<string, any>) | undefined;
|
|
8
8
|
|