@farm.js/core 0.1.18 → 0.1.20
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 +2 -3
- package/dist/agent-runtime.d.ts +2 -3
- package/dist/api/route-manager.cjs +5 -5
- package/dist/api/route-manager.d.mts +2 -3
- package/dist/api/route-manager.d.ts +2 -3
- package/dist/api/route-manager.mjs +4 -4
- package/dist/api.cjs +6 -6
- package/dist/api.d.mts +3 -4
- package/dist/api.d.ts +3 -4
- package/dist/api.mjs +5 -5
- package/dist/{app-BHY_10Lm.d.ts → app-DAyPE-gr.d.ts} +11 -4
- package/dist/{app-BMk0do23.d.mts → app-D_6nTit-.d.mts} +11 -4
- package/dist/app-markdown.cjs +4 -4
- package/dist/app-markdown.d.mts +3 -4
- package/dist/app-markdown.d.ts +3 -4
- package/dist/app-markdown.mjs +3 -3
- package/dist/{chunk-FS7FLPOG.mjs → chunk-2J7W2WND.mjs} +3 -2
- package/dist/{chunk-YS3TRKCG.mjs → chunk-2M435BUE.mjs} +6 -1
- package/dist/{chunk-WJ3HK3LJ.cjs → chunk-2QLBIPFT.cjs} +4 -4
- package/dist/{chunk-FJSWYIR7.cjs → chunk-3IL5UC5I.cjs} +2 -2
- package/dist/chunk-43FMW62B.mjs +67 -0
- package/dist/{chunk-A7T6345N.mjs → chunk-5UX4C5QI.mjs} +10 -7
- package/dist/{chunk-KPNVGRBL.mjs → chunk-5V37LKBG.mjs} +105 -41
- package/dist/chunk-75WGQVQA.cjs +46 -0
- package/dist/{chunk-ZCNJKLA2.mjs → chunk-7BC6GAL7.mjs} +1 -1
- package/dist/{chunk-J2OP5GG3.cjs → chunk-A777V5WU.cjs} +28 -28
- package/dist/{chunk-NWOD6NIT.cjs → chunk-A7T6JZNI.cjs} +1 -1
- package/dist/{chunk-E2BMSZ2W.cjs → chunk-AH7HOAQ3.cjs} +2 -2
- package/dist/{chunk-AFOD3LYZ.cjs → chunk-B3WK4DTX.cjs} +10 -9
- package/dist/{chunk-TWGMSEHX.cjs → chunk-BBVSJVBZ.cjs} +88 -13
- package/dist/{chunk-AORPIPNB.cjs → chunk-BHJUZ64B.cjs} +18 -14
- package/dist/chunk-BMWDEBXO.cjs +67 -0
- package/dist/{chunk-ATERBVHQ.mjs → chunk-CQHFU55R.mjs} +5 -4
- package/dist/{chunk-XSKZORAS.cjs → chunk-DX4VKYAJ.cjs} +5 -5
- package/dist/{chunk-AWRISO2H.cjs → chunk-E2ROOWQC.cjs} +30 -4
- package/dist/{chunk-3XG26Z3J.mjs → chunk-F7E2AZKQ.mjs} +1 -1
- package/dist/{chunk-7WPA7GBZ.mjs → chunk-GHFS7RUB.mjs} +1 -1
- package/dist/{chunk-UN5GHC5V.cjs → chunk-GQFSCBKJ.cjs} +249 -185
- package/dist/{chunk-NZ2JVBT2.mjs → chunk-GZ3ZPTQV.mjs} +2 -2
- package/dist/{chunk-DHDVMXYK.mjs → chunk-HALDNTIV.mjs} +30 -4
- package/dist/{chunk-5QOEPUYE.mjs → chunk-HSDL2AUR.mjs} +1 -1
- package/dist/{chunk-BSTRERPP.cjs → chunk-I5YBCWQ6.cjs} +2 -2
- package/dist/{chunk-TYQUSXUG.cjs → chunk-ISTFC3MZ.cjs} +4 -4
- package/dist/{chunk-RKQVJN2O.mjs → chunk-JIKGGIOL.mjs} +1 -1
- package/dist/{chunk-GYKJCFTS.mjs → chunk-K6MG3SEG.mjs} +124 -82
- package/dist/{chunk-OXSIH4D6.cjs → chunk-KNPRCKXK.cjs} +6 -1
- package/dist/{chunk-TNBAYAWO.mjs → chunk-L4DVIHOC.mjs} +1 -1
- package/dist/{chunk-XWAYMDLB.mjs → chunk-MVUREHPN.mjs} +1 -1
- package/dist/{chunk-6VQIKZZO.mjs → chunk-N255VYFP.mjs} +1 -1
- package/dist/{chunk-GNEO2XOF.cjs → chunk-NBAHDVOJ.cjs} +4 -4
- package/dist/{chunk-EN7WTEAY.mjs → chunk-NRS46D4L.mjs} +2 -2
- package/dist/{chunk-A72YEUZ3.mjs → chunk-OCE65DDM.mjs} +1 -1
- package/dist/{chunk-SXHV42UQ.mjs → chunk-OFEY6KHO.mjs} +88 -13
- package/dist/{chunk-OIEOCXKG.cjs → chunk-OYDRPBBV.cjs} +2 -2
- package/dist/{chunk-76DG3LF3.mjs → chunk-PGQBL5DN.mjs} +1 -1
- package/dist/{chunk-UDBJCUPA.mjs → chunk-PUCUVI7K.mjs} +11 -7
- package/dist/{chunk-IKNRN4VS.cjs → chunk-PZX6I4JW.cjs} +462 -420
- package/dist/{chunk-GDSHDTJ4.cjs → chunk-Q5B3KJBP.cjs} +2 -2
- package/dist/{chunk-TSWW5BVH.mjs → chunk-QMV4QELL.mjs} +1 -1
- package/dist/{chunk-QGVJVSNX.mjs → chunk-RMIJFZU3.mjs} +28 -4
- package/dist/{chunk-MKB2EGIR.cjs → chunk-SOR334EB.cjs} +3 -2
- package/dist/{chunk-57J3Y7Y3.mjs → chunk-TIKNUAU7.mjs} +3 -2
- package/dist/chunk-VVBO3QH7.mjs +46 -0
- package/dist/{chunk-UTBVHYS3.mjs → chunk-W7MZXRXM.mjs} +20 -5
- package/dist/{chunk-Y53ZSFN6.cjs → chunk-WM6HL7E7.cjs} +4 -3
- package/dist/{chunk-WZMNW2IW.cjs → chunk-XFFQSD2F.cjs} +4 -4
- package/dist/{chunk-62YJ2IEB.cjs → chunk-XI3GWPUS.cjs} +23 -20
- package/dist/{chunk-KVFPGF2M.cjs → chunk-YJJLXIIS.cjs} +7 -7
- package/dist/{chunk-NV3A5DXM.cjs → chunk-YP5JZ4LF.cjs} +42 -18
- package/dist/{chunk-B4CH33IG.cjs → chunk-ZE6ONQ5R.cjs} +39 -24
- package/dist/{client-plugins-JXXmZliS.d.mts → client-plugins-CWrhb1ir.d.mts} +26 -3
- package/dist/{client-plugins-C089bQhN.d.ts → client-plugins-DPf0qZey.d.ts} +26 -3
- package/dist/client-plugins.d.mts +2 -3
- package/dist/client-plugins.d.ts +2 -3
- package/dist/client.cjs +4 -4
- package/dist/client.d.mts +9 -38
- package/dist/client.d.ts +9 -38
- package/dist/client.mjs +3 -3
- package/dist/config.d.mts +2 -3
- package/dist/config.d.ts +2 -3
- package/dist/{devtools-UFVTMQX5.mjs → devtools-MTB5SA2B.mjs} +5 -5
- package/dist/{devtools-OUIPHVV6.cjs → devtools-R6MDDAZK.cjs} +9 -9
- package/dist/docs.cjs +9 -8
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +8 -7
- package/dist/index.cjs +29 -28
- package/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.mjs +28 -27
- package/dist/integrations.d.mts +2 -3
- package/dist/integrations.d.ts +2 -3
- package/dist/internal/app-markdown-runtime.cjs +3 -3
- package/dist/internal/app-markdown-runtime.d.mts +2 -3
- package/dist/internal/app-markdown-runtime.d.ts +2 -3
- package/dist/internal/app-markdown-runtime.mjs +2 -2
- package/dist/internal/build-runtime.cjs +22 -21
- package/dist/internal/build-runtime.d.mts +4 -5
- package/dist/internal/build-runtime.d.ts +4 -5
- package/dist/internal/build-runtime.mjs +21 -20
- package/dist/internal/cli-runtime.cjs +12 -12
- package/dist/internal/cli-runtime.mjs +11 -11
- 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 +2 -3
- package/dist/internal/compression-runtime.d.ts +2 -3
- package/dist/internal/config-runtime.cjs +6 -6
- package/dist/internal/config-runtime.d.mts +3 -4
- package/dist/internal/config-runtime.d.ts +3 -4
- package/dist/internal/config-runtime.mjs +5 -5
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +5 -5
- package/dist/internal/production-runtime.d.mts +8 -9
- package/dist/internal/production-runtime.d.ts +8 -9
- package/dist/internal/production-runtime.mjs +4 -4
- package/dist/markdown.cjs +2 -2
- package/dist/markdown.mjs +1 -1
- package/dist/{metadata-C1Z9vLbb.d.mts → metadata-CO9fRyyJ.d.mts} +1 -1
- package/dist/{metadata-BcNJP4fq.d.ts → metadata-zY9wltwH.d.ts} +1 -1
- package/dist/middleware.cjs +4 -4
- package/dist/middleware.d.mts +4 -11
- package/dist/middleware.d.ts +4 -11
- package/dist/middleware.mjs +3 -3
- package/dist/navigation.cjs +5 -5
- package/dist/navigation.d.mts +42 -3
- package/dist/navigation.d.ts +42 -3
- package/dist/navigation.mjs +4 -4
- package/dist/{nitro-CVZ36JM5.mjs → nitro-4LFVTT24.mjs} +2 -2
- package/dist/{nitro-4I2MYLY2.cjs → nitro-TSGDUJMN.cjs} +3 -3
- package/dist/plugin.cjs +23 -17
- package/dist/plugin.d.mts +3 -4
- package/dist/plugin.d.ts +3 -4
- package/dist/plugin.mjs +23 -17
- package/dist/{production-runtime-jcrTlRTb.d.mts → production-runtime-CywsHwnG.d.mts} +1 -1
- package/dist/{production-runtime-oKmC0WU-.d.ts → production-runtime-lkfwujwK.d.ts} +1 -1
- package/dist/query/client.cjs +6 -6
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan-DOB9cV-h.d.ts → render-plan-DHF0GeWo.d.ts} +1 -1
- package/dist/{render-plan-BLIfc4jt.d.mts → render-plan-LVy6sGQe.d.mts} +1 -1
- package/dist/renderer-client.cjs +5 -5
- package/dist/renderer-client.d.mts +4 -5
- package/dist/renderer-client.d.ts +4 -5
- package/dist/renderer-client.mjs +2 -2
- package/dist/renderer.d.mts +3 -0
- package/dist/renderer.d.ts +3 -0
- package/dist/{request-Cr53NRHr.d.mts → request-6AkmhEYE.d.mts} +1 -1
- package/dist/{request-Dt2gNuQD.d.ts → request-BYxlRqA9.d.ts} +1 -1
- package/dist/request.d.mts +3 -4
- package/dist/request.d.ts +3 -4
- package/dist/{route-rendering-CWYd8Mv1.d.ts → route-rendering-CWaKiUbS.d.ts} +1 -1
- package/dist/{route-rendering-CeFBEAoZ.d.mts → route-rendering-Dd8Jmml7.d.mts} +1 -1
- package/dist/router-B2m4fvve.d.ts +50 -0
- package/dist/router-xwEE112q.d.mts +50 -0
- package/dist/routes.cjs +3 -3
- package/dist/routes.d.mts +2 -3
- package/dist/routes.d.ts +2 -3
- package/dist/routes.mjs +2 -2
- package/dist/{schema-dev-notice-2IE2F2XI.mjs → schema-dev-notice-O67CPXJ6.mjs} +1 -1
- package/dist/{schema-dev-notice-MXSZMVDG.cjs → schema-dev-notice-Y7MQEFGN.cjs} +3 -3
- package/dist/server-plugins.d.mts +3 -4
- package/dist/server-plugins.d.ts +3 -4
- package/dist/server.cjs +33 -32
- package/dist/server.d.mts +8 -9
- package/dist/server.d.ts +8 -9
- package/dist/server.mjs +19 -18
- package/dist/{spa-router-CQWiYGxS.d.mts → spa-router-DVEHQnWo.d.mts} +3 -3
- package/dist/{spa-router-Wjiw-8hB.d.ts → spa-router-Y8rrXTVK.d.ts} +3 -3
- package/dist/testing.cjs +6 -6
- package/dist/testing.d.mts +2 -3
- package/dist/testing.d.ts +2 -3
- package/dist/testing.mjs +5 -5
- package/dist/{types-D-1WTE72.d.mts → types-DFbjpjXX.d.mts} +8 -0
- package/dist/{types-D-1WTE72.d.ts → types-DFbjpjXX.d.ts} +8 -0
- package/dist/{utils-uUxF0K0P.d.mts → utils-DSPx34-A.d.mts} +1 -1
- package/dist/{utils-B0XJmG_b.d.ts → utils-Dvuny_08.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +18 -17
- package/dist/vite.d.mts +2 -3
- package/dist/vite.d.ts +2 -3
- package/dist/vite.mjs +17 -16
- package/package.json +3 -3
- package/dist/chunk-7GNWGLWB.mjs +0 -14
- package/dist/chunk-VQDBNVOO.cjs +0 -14
- package/dist/navigation-errors-Dvwpzaer.d.mts +0 -13
- package/dist/navigation-errors-Dvwpzaer.d.ts +0 -13
- /package/dist/{chunk-IAMRBF3Z.cjs → chunk-N4RLRSWW.cjs} +0 -0
- /package/dist/{chunk-BNGS6KJ6.mjs → chunk-YOYF2E4U.mjs} +0 -0
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
notifyHistoryChange,
|
|
8
8
|
readPageState,
|
|
9
9
|
subscribeHistoryChange
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JIKGGIOL.mjs";
|
|
11
11
|
import {
|
|
12
12
|
getFarmI18nClientState
|
|
13
13
|
} from "./chunk-TOVMYGYW.mjs";
|
|
@@ -49,12 +49,15 @@ function shouldBlockUnload(options) {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
__name(shouldBlockUnload, "shouldBlockUnload");
|
|
52
|
-
function navigateViaRouter(href, basePath, replace) {
|
|
52
|
+
function navigateViaRouter(href, basePath, replace, options = {}) {
|
|
53
53
|
if (typeof window === "undefined") return;
|
|
54
54
|
const url = applyFarmBasePath(href, basePath);
|
|
55
55
|
const spaRouter = getInstalledFarmSPARouter();
|
|
56
56
|
if (spaRouter) {
|
|
57
|
-
void spaRouter.navigate(url, {
|
|
57
|
+
void spaRouter.navigate(url, {
|
|
58
|
+
replace,
|
|
59
|
+
...options.scroll === void 0 ? {} : { scroll: options.scroll }
|
|
60
|
+
});
|
|
58
61
|
return;
|
|
59
62
|
}
|
|
60
63
|
if (replace) {
|
|
@@ -85,11 +88,11 @@ function useRouter(options = {}) {
|
|
|
85
88
|
const unsubscribe = subscribeHistoryChange(handlePopState);
|
|
86
89
|
return unsubscribe;
|
|
87
90
|
}, [basePath, routeMatcher]);
|
|
88
|
-
const push = /* @__PURE__ */ __name((href) => {
|
|
89
|
-
navigateViaRouter(href, basePath, false);
|
|
91
|
+
const push = /* @__PURE__ */ __name((href, navigateOptions) => {
|
|
92
|
+
navigateViaRouter(href, basePath, false, navigateOptions);
|
|
90
93
|
}, "push");
|
|
91
|
-
const replace = /* @__PURE__ */ __name((href) => {
|
|
92
|
-
navigateViaRouter(href, basePath, true);
|
|
94
|
+
const replace = /* @__PURE__ */ __name((href, navigateOptions) => {
|
|
95
|
+
navigateViaRouter(href, basePath, true, navigateOptions);
|
|
93
96
|
}, "replace");
|
|
94
97
|
const pushState = /* @__PURE__ */ __name((pageState, href) => {
|
|
95
98
|
if (typeof window === "undefined") return;
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
compileFarmDocsAdapterEdgeManifest,
|
|
9
9
|
createFarmDocsAPIHandler
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-W7MZXRXM.mjs";
|
|
11
11
|
import {
|
|
12
12
|
FARM_DOCS_LAST_MODIFIED_MANIFEST,
|
|
13
13
|
createFarmDocsHandler,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
loadFarmDocsPage,
|
|
18
18
|
resolveFarmDocsContentDir,
|
|
19
19
|
toFarmDocsMarkdownPage
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-HSDL2AUR.mjs";
|
|
21
21
|
import {
|
|
22
22
|
generateFarmDocsSearchClientRuntime,
|
|
23
23
|
isFarmDocsSearchEnabled,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
getDeployTargetForPreset,
|
|
32
32
|
hasCustomFarmRouteContext,
|
|
33
33
|
resolveDeployOutputPath
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-RMIJFZU3.mjs";
|
|
35
35
|
import {
|
|
36
36
|
resolveFarmInstrumentationFile
|
|
37
37
|
} from "./chunk-F5D4XEAS.mjs";
|
|
@@ -52,7 +52,6 @@ import {
|
|
|
52
52
|
farmPluginMayAffectRuntimePath,
|
|
53
53
|
generateClientCachePersistenceCode,
|
|
54
54
|
generateFarmClientPluginEntryCode,
|
|
55
|
-
generateFarmDocsAdapterClientRuntime,
|
|
56
55
|
generateFarmIntegrationProviderClientCode,
|
|
57
56
|
generateFarmIntegrationProviderServerModules,
|
|
58
57
|
getClientModuleHydrationPlan,
|
|
@@ -64,26 +63,30 @@ import {
|
|
|
64
63
|
resolveFarmClientCacheAdapterEntry,
|
|
65
64
|
resolveFarmIsolatedClientHydrationMode,
|
|
66
65
|
resolveFarmNotFoundComponentPath
|
|
67
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-K6MG3SEG.mjs";
|
|
68
67
|
import {
|
|
69
68
|
findRequestBoundSourceBlockers,
|
|
70
69
|
generateFarmTypeArtifacts,
|
|
71
70
|
parseRouteRenderingDirective,
|
|
72
71
|
resolveRouteRenderingConfigFromFile
|
|
73
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-NRS46D4L.mjs";
|
|
74
73
|
import {
|
|
75
74
|
isFarmPreviewDeploymentEnvironment
|
|
76
75
|
} from "./chunk-BOYNDCZL.mjs";
|
|
77
76
|
import {
|
|
78
77
|
farmEnvironmentFunctionsPlugin
|
|
79
78
|
} from "./chunk-ZSH2Y4LN.mjs";
|
|
79
|
+
import {
|
|
80
|
+
generateFarmDocsAdapterClientRuntime,
|
|
81
|
+
getFarmDocsAdapterConfigModule
|
|
82
|
+
} from "./chunk-VVBO3QH7.mjs";
|
|
80
83
|
import {
|
|
81
84
|
resolveFarmDocsFontAssets,
|
|
82
85
|
toFarmDocsPublicFontAssets
|
|
83
86
|
} from "./chunk-TVGP4BBZ.mjs";
|
|
84
87
|
import {
|
|
85
88
|
routeRulesToNitroRouteRules
|
|
86
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-GHFS7RUB.mjs";
|
|
87
90
|
import {
|
|
88
91
|
getFarmAppDirectories
|
|
89
92
|
} from "./chunk-IILNZK5G.mjs";
|
|
@@ -97,7 +100,7 @@ import {
|
|
|
97
100
|
} from "./chunk-OLYK7EAK.mjs";
|
|
98
101
|
import {
|
|
99
102
|
applyFarmCspHashesToHtml
|
|
100
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-7BC6GAL7.mjs";
|
|
101
104
|
import {
|
|
102
105
|
applyFarmCronVercelCrons,
|
|
103
106
|
createFarmCronCloudflareConfig,
|
|
@@ -109,7 +112,7 @@ import {
|
|
|
109
112
|
} from "./chunk-4OOBRCJX.mjs";
|
|
110
113
|
import {
|
|
111
114
|
isFarmMarkdownPageFile
|
|
112
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-N255VYFP.mjs";
|
|
113
116
|
import {
|
|
114
117
|
resolveFarmMdxComponentsModulePath,
|
|
115
118
|
resolveMdxConfig
|
|
@@ -124,10 +127,10 @@ import {
|
|
|
124
127
|
} from "./chunk-JLCQGPXE.mjs";
|
|
125
128
|
import {
|
|
126
129
|
appendMiddlewareRoutePath
|
|
127
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-TIKNUAU7.mjs";
|
|
128
131
|
import {
|
|
129
132
|
APIRouteManager
|
|
130
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-CQHFU55R.mjs";
|
|
131
134
|
import {
|
|
132
135
|
readFarmI18nCatalogs
|
|
133
136
|
} from "./chunk-FV45CKBC.mjs";
|
|
@@ -143,7 +146,7 @@ import {
|
|
|
143
146
|
normalizeFarmRouteRuntimeConfig,
|
|
144
147
|
resolveFarmRouteRuleRuntimeConfig,
|
|
145
148
|
resolveFarmRouteRuntimeConfig
|
|
146
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-2J7W2WND.mjs";
|
|
147
150
|
import {
|
|
148
151
|
logger,
|
|
149
152
|
toPosixPath,
|
|
@@ -1576,6 +1579,8 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1576
1579
|
]);
|
|
1577
1580
|
const nitroBuilderResultPromise = preloadFarmNitroBuilder();
|
|
1578
1581
|
logger.info(`\u{1F69C} Building Farm.js application (universal) with preset: ${preset}...`);
|
|
1582
|
+
const rendererBuild = options.rendererBuildLifetime ? void 0 : new AbortController();
|
|
1583
|
+
const rendererBuildLifetime = options.rendererBuildLifetime ?? rendererBuild.signal;
|
|
1579
1584
|
try {
|
|
1580
1585
|
const routeRuntimeManifestPromise = options.routeRuntimeManifest ? Promise.resolve(options.routeRuntimeManifest) : createFarmRouteRuntimeManifest({
|
|
1581
1586
|
config,
|
|
@@ -1658,7 +1663,8 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1658
1663
|
layoutRoutes,
|
|
1659
1664
|
routeSlots,
|
|
1660
1665
|
isolatedClientBoundaryModules,
|
|
1661
|
-
hydrationPlanCache
|
|
1666
|
+
hydrationPlanCache,
|
|
1667
|
+
rendererBuildLifetime
|
|
1662
1668
|
), "buildClientBundle");
|
|
1663
1669
|
const buildSSRBundle = /* @__PURE__ */ __name(() => buildSSRInMemory(
|
|
1664
1670
|
productionVite,
|
|
@@ -1672,7 +1678,8 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1672
1678
|
layoutRoutes,
|
|
1673
1679
|
routeSlots,
|
|
1674
1680
|
isolatedClientBoundaryModules,
|
|
1675
|
-
hydrationPlanCache
|
|
1681
|
+
hydrationPlanCache,
|
|
1682
|
+
rendererBuildLifetime
|
|
1676
1683
|
), "buildSSRBundle");
|
|
1677
1684
|
let clientBuildResult;
|
|
1678
1685
|
let ssrBuildResult;
|
|
@@ -1708,7 +1715,8 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1708
1715
|
layoutRoutes,
|
|
1709
1716
|
routeSlots,
|
|
1710
1717
|
isolatedClientBoundaryModules,
|
|
1711
|
-
hydrationPlanCache
|
|
1718
|
+
hydrationPlanCache,
|
|
1719
|
+
rendererBuildLifetime
|
|
1712
1720
|
);
|
|
1713
1721
|
} catch (retryError) {
|
|
1714
1722
|
if (!(retryError instanceof IncompleteClientBuildOutputError)) throw retryError;
|
|
@@ -1763,6 +1771,8 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1763
1771
|
}
|
|
1764
1772
|
logger.error(`\u274C Build failed: ${error}`);
|
|
1765
1773
|
throw error;
|
|
1774
|
+
} finally {
|
|
1775
|
+
rendererBuild?.abort();
|
|
1766
1776
|
}
|
|
1767
1777
|
}
|
|
1768
1778
|
__name(buildUniversal, "buildUniversal");
|
|
@@ -1866,7 +1876,7 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
|
|
|
1866
1876
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
1867
1877
|
}
|
|
1868
1878
|
__name(getCachedClientModuleHydrationPlan, "getCachedClientModuleHydrationPlan");
|
|
1869
|
-
async function buildClient(productionVite, config, root, srcDir, outputDir, pageRoutes, layoutRoutes = [], routeSlots = [], isolatedClientBoundaryModules = /* @__PURE__ */ new Set(), hydrationPlanCache = /* @__PURE__ */ new Map()) {
|
|
1879
|
+
async function buildClient(productionVite, config, root, srcDir, outputDir, pageRoutes, layoutRoutes = [], routeSlots = [], isolatedClientBoundaryModules = /* @__PURE__ */ new Set(), hydrationPlanCache = /* @__PURE__ */ new Map(), rendererBuildLifetime) {
|
|
1870
1880
|
const viteBuild = productionVite.build;
|
|
1871
1881
|
const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
|
|
1872
1882
|
const { PluginManager: PluginManager2 } = await import("./plugin.mjs");
|
|
@@ -2114,14 +2124,16 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2114
2124
|
config.trailingSlash,
|
|
2115
2125
|
getIntegrationProviders(config.integrations),
|
|
2116
2126
|
config.basePath,
|
|
2117
|
-
generateClientCachePersistenceCode(resolveFarmClientCacheAdapterEntry(root, config.cache))
|
|
2127
|
+
generateClientCachePersistenceCode(resolveFarmClientCacheAdapterEntry(root, config.cache)),
|
|
2128
|
+
adapterOwnsDocsRuntime ? getFarmDocsAdapterConfigModule(config.docs) : void 0
|
|
2118
2129
|
);
|
|
2119
2130
|
await fs.writeFile(clientEntryPath, clientHydrationCode);
|
|
2120
2131
|
const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
|
|
2121
2132
|
let postcssSearchPath;
|
|
2122
2133
|
let tailwindVitePlugin = void 0;
|
|
2123
2134
|
const rendererVitePlugins = await loadFarmRendererVitePlugins(config.renderer, root, {
|
|
2124
|
-
ssr: false
|
|
2135
|
+
ssr: false,
|
|
2136
|
+
buildLifetime: rendererBuildLifetime
|
|
2125
2137
|
});
|
|
2126
2138
|
if (hasScopedPostcssConfig) {
|
|
2127
2139
|
logger.info("\u{1F4E6} Using project PostCSS/Tailwind configuration");
|
|
@@ -3034,7 +3046,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3034
3046
|
secure: false
|
|
3035
3047
|
},
|
|
3036
3048
|
direction: {}
|
|
3037
|
-
}, plugins = [], renderer = REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }) {
|
|
3049
|
+
}, plugins = [], renderer = REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule) {
|
|
3038
3050
|
const toImportPath = /* @__PURE__ */ __name((targetPath) => targetPath.replace(/\\/g, "/"), "toImportPath");
|
|
3039
3051
|
const clientPluginEntry = generateFarmClientPluginEntryCode(
|
|
3040
3052
|
plugins,
|
|
@@ -3107,7 +3119,10 @@ function isFarmDocsPath() {
|
|
|
3107
3119
|
return false;
|
|
3108
3120
|
}
|
|
3109
3121
|
`;
|
|
3110
|
-
const docsAdapterRuntime = generateFarmDocsAdapterClientRuntime(
|
|
3122
|
+
const docsAdapterRuntime = generateFarmDocsAdapterClientRuntime(
|
|
3123
|
+
docsAdapterReact,
|
|
3124
|
+
docsConfigModule
|
|
3125
|
+
);
|
|
3111
3126
|
if (clientPages.length === 0 && clientRouteSlots.length === 0 && !providerClientCode.hasProviders) {
|
|
3112
3127
|
return `
|
|
3113
3128
|
// Farm.js Client Runtime (no client components)
|
|
@@ -4417,7 +4432,7 @@ void hydrate();
|
|
|
4417
4432
|
`.trim();
|
|
4418
4433
|
}
|
|
4419
4434
|
__name(generateClientHydrationEntry, "generateClientHydrationEntry");
|
|
4420
|
-
async function buildSSRInMemory(productionVite, config, root, routeManager, apiRouteManager, serverRenderer, preset, collectedPageRoutes, collectedLayoutRoutes, collectedRouteSlots, isolatedClientBoundaryModules, hydrationPlanCache) {
|
|
4435
|
+
async function buildSSRInMemory(productionVite, config, root, routeManager, apiRouteManager, serverRenderer, preset, collectedPageRoutes, collectedLayoutRoutes, collectedRouteSlots, isolatedClientBoundaryModules, hydrationPlanCache, rendererBuildLifetime) {
|
|
4421
4436
|
const viteBuild = productionVite.build;
|
|
4422
4437
|
const { farmPlugin } = await import("./vite.mjs");
|
|
4423
4438
|
const { PluginManager: PluginManager2 } = await import("./plugin.mjs");
|
|
@@ -4432,7 +4447,8 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4432
4447
|
let postcssConfigDir;
|
|
4433
4448
|
let tailwindVitePlugin = void 0;
|
|
4434
4449
|
const rendererVitePlugins = await loadFarmRendererVitePlugins(config.renderer, root, {
|
|
4435
|
-
ssr: true
|
|
4450
|
+
ssr: true,
|
|
4451
|
+
buildLifetime: rendererBuildLifetime
|
|
4436
4452
|
});
|
|
4437
4453
|
if (!hasScopedPostcssConfig) {
|
|
4438
4454
|
postcssConfigDir = await fs.mkdtemp(path5.join(os.tmpdir(), "farm-postcss-"));
|
|
@@ -4820,7 +4836,10 @@ function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
|
4820
4836
|
...docs,
|
|
4821
4837
|
contentDir: void 0,
|
|
4822
4838
|
...precompiled ? { configPath: void 0 } : {},
|
|
4823
|
-
config: void 0
|
|
4839
|
+
config: void 0,
|
|
4840
|
+
// React elements and functions do not survive JSON. The server bundle imports the
|
|
4841
|
+
// config module for those instead (see farmDocsConfigModule).
|
|
4842
|
+
runtimeConfig: void 0
|
|
4824
4843
|
};
|
|
4825
4844
|
const nestedConfig = {
|
|
4826
4845
|
...docs.config,
|
|
@@ -4841,7 +4860,7 @@ function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
|
4841
4860
|
contentDir: farmDocsBundledContentDir,
|
|
4842
4861
|
},
|
|
4843
4862
|
}
|
|
4844
|
-
: ${JSON.stringify(docs)}`;
|
|
4863
|
+
: ${JSON.stringify({ ...docs, runtimeConfig: void 0 })}`;
|
|
4845
4864
|
}
|
|
4846
4865
|
__name(generateFarmDocsRuntimeConfigExpression, "generateFarmDocsRuntimeConfigExpression");
|
|
4847
4866
|
function toVirtualEntryImportSpecifier(modulePath) {
|
|
@@ -5115,6 +5134,7 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
|
|
|
5115
5134
|
const adapterOwnsDocsRuntime = Boolean(
|
|
5116
5135
|
isReactRenderer(config.renderer) && config.docs?.enabled && config.docs.adapter?.server && config.docs.adapter.react
|
|
5117
5136
|
);
|
|
5137
|
+
const docsConfigModulePath = adapterOwnsDocsRuntime && !hasPrecompiledDocs && config.docs.configPath && !config.docs.configPath.endsWith(".json") ? config.docs.configPath : void 0;
|
|
5118
5138
|
const hasIsolatedClientGraphRuntime = isReactRenderer(config.renderer) && isolatedClientBoundaryModules.size > 0;
|
|
5119
5139
|
const rendererStreamingCapabilities = getFarmRendererStreamingCapabilitiesForRuntime(
|
|
5120
5140
|
config.renderer,
|
|
@@ -5475,7 +5495,8 @@ const isFarmDocsAPIRequest = (requestOrPathname) => {
|
|
|
5475
5495
|
return pathname === apiPath || pathname.startsWith(apiPath + "/");
|
|
5476
5496
|
};` : adapterOwnsDocsRuntime ? `import { isFarmDocsAPIRequest } from "@farm.js/core/docs";
|
|
5477
5497
|
import { createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler } from ${JSON.stringify(config.docs.adapter.server)};
|
|
5478
|
-
import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)}
|
|
5498
|
+
import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};${docsConfigModulePath ? `
|
|
5499
|
+
import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
|
|
5479
5500
|
const docsFontImport = config.docs?.enabled && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
|
|
5480
5501
|
const docsRuntimeImport = config.docs?.enabled && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
|
|
5481
5502
|
import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
|
|
@@ -5892,7 +5913,7 @@ globalThis.__FARM_DOCS_RUNTIME_CONFIG__ = {
|
|
|
5892
5913
|
};
|
|
5893
5914
|
const farmDocsPrecompiledRuntime = ${hasPrecompiledDocs ? `createFarmDocsPrecompiledRuntime(${JSON.stringify(farmDocsPrecompiledManifest)})` : "null"};
|
|
5894
5915
|
const farmDocsHandler = ${config.docs?.enabled ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `createFarmDocsAdapterRuntimeHandler({
|
|
5895
|
-
...farmDocsResolvedConfig.config,
|
|
5916
|
+
${docsConfigModulePath ? "...(farmDocsConfigModule.default || farmDocsConfigModule),\n ...farmDocsResolvedConfig.configOverrides," : "...farmDocsResolvedConfig.config,"}
|
|
5896
5917
|
entry: farmDocsResolvedConfig.config?.entry || String(farmDocsResolvedConfig.entry || "/docs").replace(/^\\/+|\\/+$/g, "") || "docs",
|
|
5897
5918
|
docsPath: farmDocsResolvedConfig.entry,
|
|
5898
5919
|
contentDir: farmDocsResolvedConfig.contentDir || farmDocsResolvedConfig.config?.contentDir,
|
|
@@ -6312,13 +6333,32 @@ function createFarmDocumentStream(contentStream, prefix, suffix, onComplete) {
|
|
|
6312
6333
|
}
|
|
6313
6334
|
|
|
6314
6335
|
function stripFarmDocumentWrappers(markup) {
|
|
6315
|
-
|
|
6336
|
+
return peelFarmDocumentPrefix(markup).inner;
|
|
6337
|
+
}
|
|
6338
|
+
|
|
6339
|
+
// Farm's display:contents wrappers, and the head elements React 19 hoists in front of them
|
|
6340
|
+
// (charset, viewport, preloads, titles) when the layout's <html> is not the render root.
|
|
6341
|
+
function peelFarmDocumentPrefix(markup) {
|
|
6342
|
+
let inner = markup.replace(/^\\s+/, "");
|
|
6343
|
+
let hoisted = "";
|
|
6316
6344
|
const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents["'][^>]*>/i;
|
|
6345
|
+
const hoistable = /^(?:<(?:meta|link|base)\\b[^>]*>|<title\\b[^>]*>[\\s\\S]*?<\\/title>)/i;
|
|
6317
6346
|
let match;
|
|
6318
|
-
while ((match = wrapper.exec(
|
|
6319
|
-
|
|
6347
|
+
while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
|
|
6348
|
+
if (!/^<div/i.test(match[0])) hoisted += match[0];
|
|
6349
|
+
inner = inner.slice(match[0].length).replace(/^\\s+/, "");
|
|
6320
6350
|
}
|
|
6321
|
-
return
|
|
6351
|
+
return { inner: inner, hoisted: hoisted };
|
|
6352
|
+
}
|
|
6353
|
+
|
|
6354
|
+
function restoreFarmHoistedHead(document, hoisted) {
|
|
6355
|
+
if (!hoisted) return document;
|
|
6356
|
+
if (/<head[\\s>]/i.test(document)) {
|
|
6357
|
+
return document.replace(/<head\\b[^>]*>/i, function(open) { return open + hoisted; });
|
|
6358
|
+
}
|
|
6359
|
+
return document.replace(/<html\\b[^>]*>/i, function(open) {
|
|
6360
|
+
return open + "<head>" + hoisted + "</head>";
|
|
6361
|
+
});
|
|
6322
6362
|
}
|
|
6323
6363
|
|
|
6324
6364
|
function opensFarmFullDocument(markup) {
|
|
@@ -6328,6 +6368,7 @@ function opensFarmFullDocument(markup) {
|
|
|
6328
6368
|
|
|
6329
6369
|
function extractFarmFullDocument(markup) {
|
|
6330
6370
|
if (!opensFarmFullDocument(markup)) return null;
|
|
6371
|
+
const hoisted = peelFarmDocumentPrefix(markup).hoisted;
|
|
6331
6372
|
const start = markup.search(/<!doctype|<html[\\s>]/i);
|
|
6332
6373
|
const lower = markup.toLowerCase();
|
|
6333
6374
|
let closeIndex = lower.lastIndexOf("</html>");
|
|
@@ -6355,7 +6396,7 @@ function extractFarmFullDocument(markup) {
|
|
|
6355
6396
|
return streamedTail + "</body>";
|
|
6356
6397
|
});
|
|
6357
6398
|
}
|
|
6358
|
-
return document;
|
|
6399
|
+
return restoreFarmHoistedHead(document, hoisted);
|
|
6359
6400
|
}
|
|
6360
6401
|
|
|
6361
6402
|
function ensureFarmDocumentHead(markup) {
|
|
@@ -9630,7 +9671,7 @@ async function stageSharpRuntime(config, root, distDir, fs) {
|
|
|
9630
9671
|
...packageJson.dependencies,
|
|
9631
9672
|
...packageJson.optionalDependencies
|
|
9632
9673
|
};
|
|
9633
|
-
await
|
|
9674
|
+
await settleAllOrThrow([
|
|
9634
9675
|
fs.cp(packageDir, targetDir, {
|
|
9635
9676
|
recursive: true,
|
|
9636
9677
|
force: true,
|
|
@@ -9681,10 +9722,18 @@ async function installStagedSharpRuntime(staged, nitroFuncDir, fs) {
|
|
|
9681
9722
|
);
|
|
9682
9723
|
}
|
|
9683
9724
|
__name(installStagedSharpRuntime, "installStagedSharpRuntime");
|
|
9725
|
+
async function settleAllOrThrow(operations) {
|
|
9726
|
+
const results = await Promise.allSettled(operations);
|
|
9727
|
+
const failure = results.find(
|
|
9728
|
+
(result) => result.status === "rejected"
|
|
9729
|
+
);
|
|
9730
|
+
if (failure) throw failure.reason;
|
|
9731
|
+
}
|
|
9732
|
+
__name(settleAllOrThrow, "settleAllOrThrow");
|
|
9684
9733
|
async function mergeStagedDirectory(sourceDir, targetDir, fs) {
|
|
9685
9734
|
await fs.mkdir(targetDir, { recursive: true });
|
|
9686
9735
|
const entries = await fs.readdir(sourceDir, { withFileTypes: true });
|
|
9687
|
-
await
|
|
9736
|
+
await settleAllOrThrow(
|
|
9688
9737
|
entries.map(async (entry) => {
|
|
9689
9738
|
const sourcePath = path5.join(sourceDir, entry.name);
|
|
9690
9739
|
const targetPath = path5.join(targetDir, entry.name);
|
|
@@ -9765,14 +9814,17 @@ async function writeNitroOutputPackage(outputDir, packageJson, fs) {
|
|
|
9765
9814
|
}
|
|
9766
9815
|
__name(writeNitroOutputPackage, "writeNitroOutputPackage");
|
|
9767
9816
|
function resolvePackageJson(parentRequire, packageName) {
|
|
9817
|
+
let metadataModule;
|
|
9768
9818
|
for (const request of [`${packageName}/package.json`, `${packageName}/package`]) {
|
|
9769
9819
|
try {
|
|
9770
|
-
|
|
9820
|
+
const resolved = parentRequire.resolve(request);
|
|
9821
|
+
if (resolved.endsWith(".json")) return resolved;
|
|
9822
|
+
metadataModule ?? (metadataModule = resolved);
|
|
9771
9823
|
} catch {
|
|
9772
9824
|
}
|
|
9773
9825
|
}
|
|
9774
9826
|
try {
|
|
9775
|
-
let directory = path5.dirname(parentRequire.resolve(packageName));
|
|
9827
|
+
let directory = path5.dirname(metadataModule ?? parentRequire.resolve(packageName));
|
|
9776
9828
|
while (directory !== path5.dirname(directory)) {
|
|
9777
9829
|
const candidate = path5.join(directory, "package.json");
|
|
9778
9830
|
if (existsSync(candidate)) {
|
|
@@ -9879,6 +9931,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
9879
9931
|
});
|
|
9880
9932
|
pluginManager.addPlugins(config.plugins || []);
|
|
9881
9933
|
let projectModuleServer;
|
|
9934
|
+
const rendererBuild = new AbortController();
|
|
9882
9935
|
try {
|
|
9883
9936
|
await pluginManager.runHookParallel("init");
|
|
9884
9937
|
config = await pluginManager.runHookSerial("config", config);
|
|
@@ -9914,7 +9967,12 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
9914
9967
|
if (productionViteResult?.status === "rejected") throw productionViteResult.reason;
|
|
9915
9968
|
const productionVite = productionViteResult?.value;
|
|
9916
9969
|
const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
|
|
9917
|
-
projectModuleServer = await createProjectModuleServer(
|
|
9970
|
+
projectModuleServer = await createProjectModuleServer(
|
|
9971
|
+
createViteServer,
|
|
9972
|
+
config,
|
|
9973
|
+
root,
|
|
9974
|
+
rendererBuild.signal
|
|
9975
|
+
);
|
|
9918
9976
|
const farmApp = createFarmApp(config, projectModuleServer);
|
|
9919
9977
|
await farmApp.initialize();
|
|
9920
9978
|
const routeManager = farmApp.getRouteManager();
|
|
@@ -9956,7 +10014,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
9956
10014
|
preset,
|
|
9957
10015
|
root,
|
|
9958
10016
|
pluginManager,
|
|
9959
|
-
productionVite
|
|
10017
|
+
productionVite,
|
|
10018
|
+
rendererBuildLifetime: rendererBuild.signal
|
|
9960
10019
|
});
|
|
9961
10020
|
} else {
|
|
9962
10021
|
const { build: legacyViteBuild } = await import("vite");
|
|
@@ -10008,13 +10067,18 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10008
10067
|
logger.error(`\u274C Build failed: ${error}`);
|
|
10009
10068
|
throw error;
|
|
10010
10069
|
} finally {
|
|
10011
|
-
|
|
10070
|
+
try {
|
|
10071
|
+
await projectModuleServer?.close();
|
|
10072
|
+
} finally {
|
|
10073
|
+
rendererBuild.abort();
|
|
10074
|
+
}
|
|
10012
10075
|
}
|
|
10013
10076
|
}
|
|
10014
10077
|
__name(buildWithProductionNodeEnv, "buildWithProductionNodeEnv");
|
|
10015
|
-
async function createProjectModuleServer(createViteServer, config, root) {
|
|
10078
|
+
async function createProjectModuleServer(createViteServer, config, root, buildLifetime) {
|
|
10016
10079
|
const rendererVitePlugins = await loadFarmRendererVitePlugins(config.renderer, root, {
|
|
10017
|
-
ssr: true
|
|
10080
|
+
ssr: true,
|
|
10081
|
+
buildLifetime
|
|
10018
10082
|
});
|
|
10019
10083
|
const viteConfig = mergeFarmViteConfig(
|
|
10020
10084
|
{
|
|
@@ -10148,7 +10212,7 @@ function resolveLegacyPageEntry(config, root, srcDir) {
|
|
|
10148
10212
|
__name(resolveLegacyPageEntry, "resolveLegacyPageEntry");
|
|
10149
10213
|
async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
|
|
10150
10214
|
const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
|
|
10151
|
-
import("./nitro-
|
|
10215
|
+
import("./nitro-4LFVTT24.mjs"),
|
|
10152
10216
|
import("nitro/builder")
|
|
10153
10217
|
]);
|
|
10154
10218
|
let nitroConfig = await createNitroConfig(
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
4
|
+
|
|
5
|
+
// src/docs/adapter-client.ts
|
|
6
|
+
function getFarmDocsAdapterConfigModule(docs) {
|
|
7
|
+
if (!_optionalChain([docs, 'optionalAccess', _ => _.enabled]) || !_optionalChain([docs, 'access', _2 => _2.adapter, 'optionalAccess', _3 => _3.react]) || !docs.configPath) return void 0;
|
|
8
|
+
return docs.configPath.endsWith(".json") ? void 0 : docs.configPath.replace(/\\/g, "/");
|
|
9
|
+
}
|
|
10
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, getFarmDocsAdapterConfigModule, "getFarmDocsAdapterConfigModule");
|
|
11
|
+
function generateFarmDocsAdapterClientRuntime(reactModule, configModule) {
|
|
12
|
+
if (!reactModule) {
|
|
13
|
+
return `
|
|
14
|
+
async function hydrateFarmDocsAdapterRuntime() {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
}
|
|
19
|
+
return `
|
|
20
|
+
async function hydrateFarmDocsAdapterRuntime() {
|
|
21
|
+
const runtime = window.__FARM_DOCS_ADAPTER__;
|
|
22
|
+
if (!runtime) return false;
|
|
23
|
+
const FarmDocsAdapterReact = await import(${JSON.stringify(reactModule)});
|
|
24
|
+
if (typeof FarmDocsAdapterReact.hydrateFarmDocs !== "function") {
|
|
25
|
+
throw new Error("The configured Farm docs adapter does not export hydrateFarmDocs().");
|
|
26
|
+
}
|
|
27
|
+
// The docs server flags pages whose config holds what its JSON copy cannot (icons,
|
|
28
|
+
// MDX components, callbacks); the adapter restores those from the module itself.
|
|
29
|
+
const configModule = runtime.configModule
|
|
30
|
+
? ${configModule ? `await import(${JSON.stringify(configModule)})` : "undefined"}
|
|
31
|
+
: undefined;
|
|
32
|
+
FarmDocsAdapterReact.hydrateFarmDocs({
|
|
33
|
+
config: runtime.config || {},
|
|
34
|
+
data: runtime.data,
|
|
35
|
+
...(configModule ? { configModule: configModule.default ?? configModule } : {}),
|
|
36
|
+
});
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
41
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, generateFarmDocsAdapterClientRuntime, "generateFarmDocsAdapterClientRuntime");
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
exports.getFarmDocsAdapterConfigModule = getFarmDocsAdapterConfigModule; exports.generateFarmDocsAdapterClientRuntime = generateFarmDocsAdapterClientRuntime;
|