@farm.js/core 0.1.21 → 0.1.23
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 +3 -2
- package/dist/agent-runtime.d.ts +3 -2
- package/dist/api/route-manager.cjs +3 -2
- package/dist/api/route-manager.d.mts +3 -2
- package/dist/api/route-manager.d.ts +3 -2
- package/dist/api/route-manager.mjs +2 -1
- package/dist/api.cjs +4 -3
- package/dist/api.d.mts +4 -3
- package/dist/api.d.ts +4 -3
- package/dist/api.mjs +3 -2
- package/dist/{app-DAyPE-gr.d.ts → app-BV-7wV5q.d.ts} +10 -3
- package/dist/{app-D_6nTit-.d.mts → app-BZDWwwFa.d.mts} +10 -3
- package/dist/app-markdown.d.mts +4 -3
- package/dist/app-markdown.d.ts +4 -3
- package/dist/chunk-2VQKKQ6D.mjs +51 -0
- package/dist/{chunk-EGJDUF4Q.mjs → chunk-3ATMYLLJ.mjs} +6 -12
- package/dist/{chunk-HSDL2AUR.mjs → chunk-47H7VENP.mjs} +20 -32
- package/dist/{chunk-RWXZKZXB.cjs → chunk-4DKZ6JR3.cjs} +302 -339
- package/dist/{chunk-PUCUVI7K.mjs → chunk-72VJRKJD.mjs} +1 -1
- package/dist/{chunk-5L6NBNHI.mjs → chunk-7LU4IOXQ.mjs} +156 -193
- package/dist/{chunk-RMIJFZU3.mjs → chunk-BDJNP7AQ.mjs} +10 -14
- package/dist/{chunk-OLYK7EAK.mjs → chunk-DAATZTKJ.mjs} +14 -0
- package/dist/{chunk-YP5JZ4LF.cjs → chunk-DNLQMFER.cjs} +15 -19
- package/dist/{chunk-XFFQSD2F.cjs → chunk-DW34V5SM.cjs} +7 -7
- package/dist/{chunk-PKO4FCTL.mjs → chunk-EHUZ2MKO.mjs} +1 -1
- package/dist/{chunk-3NM6SRI6.mjs → chunk-F3VB7ONA.mjs} +10 -8
- package/dist/{chunk-L7ARWZYT.cjs → chunk-III667SJ.cjs} +496 -303
- package/dist/chunk-IK6LVLKC.cjs +51 -0
- package/dist/{chunk-B3WK4DTX.cjs → chunk-IMBMOEWT.cjs} +5 -1
- package/dist/{chunk-IILNZK5G.mjs → chunk-JHWOVJ3M.mjs} +46 -62
- package/dist/{chunk-TKNSDBBN.cjs → chunk-K3F2E6GS.cjs} +20 -1
- package/dist/{chunk-RTHIVJ2G.cjs → chunk-KCMTCM6I.cjs} +7 -8
- package/dist/{chunk-ZE6ONQ5R.cjs → chunk-LQIRVSBY.cjs} +30 -40
- package/dist/chunk-LYLEZIG3.cjs +73 -0
- package/dist/{chunk-NBAHDVOJ.cjs → chunk-LYM7HY34.cjs} +20 -32
- package/dist/{chunk-K6FNHVDR.cjs → chunk-MPEYMSCF.cjs} +6 -12
- package/dist/{chunk-TFAXUHWX.cjs → chunk-PSV6XKPO.cjs} +15 -1
- package/dist/{chunk-BHJUZ64B.cjs → chunk-QTBEAKCJ.cjs} +7 -7
- package/dist/{chunk-J6JRB2ER.mjs → chunk-S67OYZU7.mjs} +1 -1
- package/dist/chunk-SFGWNC43.mjs +97 -0
- package/dist/{chunk-AYJR42WX.cjs → chunk-UFDV5N3C.cjs} +2 -2
- package/dist/chunk-UYIHRDE4.cjs +97 -0
- package/dist/{chunk-Y4YMF2NQ.cjs → chunk-VPTDD5XF.cjs} +46 -62
- package/dist/{chunk-53G3OLTA.mjs → chunk-VPY755R2.mjs} +256 -63
- package/dist/{chunk-NRS46D4L.mjs → chunk-VVJCWBIE.mjs} +3 -3
- package/dist/{chunk-Q2TUENW2.cjs → chunk-VXCA7RZP.cjs} +1 -1
- package/dist/{chunk-CQHFU55R.mjs → chunk-WNUBR4CA.mjs} +5 -1
- package/dist/{chunk-CIAGU2X4.cjs → chunk-XSIRSMAS.cjs} +10 -8
- package/dist/{chunk-W7MZXRXM.mjs → chunk-YGMK6ESJ.mjs} +20 -30
- package/dist/chunk-YOZYCI6Z.mjs +73 -0
- package/dist/{chunk-HLCDYJY7.mjs → chunk-YQVSHTMR.mjs} +20 -1
- package/dist/{chunk-F5D4XEAS.mjs → chunk-ZZSRYEYU.mjs} +7 -8
- package/dist/{client-plugins-CWrhb1ir.d.mts → client-plugins-B_XzCegf.d.mts} +11 -9
- package/dist/{client-plugins-DPf0qZey.d.ts → client-plugins-CKsXQfXY.d.ts} +11 -9
- package/dist/client-plugins.d.mts +3 -2
- package/dist/client-plugins.d.ts +3 -2
- package/dist/client.d.mts +7 -6
- package/dist/client.d.ts +7 -6
- package/dist/config.d.mts +3 -2
- package/dist/config.d.ts +3 -2
- package/dist/{devtools-MTB5SA2B.mjs → devtools-OY4SNU3P.mjs} +5 -4
- package/dist/{devtools-R6MDDAZK.cjs → devtools-UHRSZ7VA.cjs} +6 -5
- package/dist/docs.cjs +10 -7
- package/dist/docs.mjs +9 -6
- package/dist/index.cjs +24 -21
- package/dist/index.d.mts +14 -13
- package/dist/index.d.ts +14 -13
- package/dist/index.mjs +19 -16
- package/dist/instrumentation.cjs +3 -2
- package/dist/instrumentation.mjs +2 -1
- package/dist/integrations.d.mts +3 -2
- package/dist/integrations.d.ts +3 -2
- package/dist/internal/app-markdown-runtime.d.mts +3 -2
- package/dist/internal/app-markdown-runtime.d.ts +3 -2
- package/dist/internal/build-runtime.cjs +18 -15
- package/dist/internal/build-runtime.d.mts +5 -4
- package/dist/internal/build-runtime.d.ts +5 -4
- package/dist/internal/build-runtime.mjs +17 -14
- package/dist/internal/cli-runtime.cjs +11 -8
- package/dist/internal/cli-runtime.mjs +10 -7
- 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 +3 -2
- package/dist/internal/compression-runtime.d.ts +3 -2
- package/dist/internal/config-runtime.cjs +6 -5
- package/dist/internal/config-runtime.d.mts +4 -3
- package/dist/internal/config-runtime.d.ts +4 -3
- package/dist/internal/config-runtime.mjs +5 -4
- package/dist/internal/metadata-image-runtime.cjs +3 -2
- package/dist/internal/metadata-image-runtime.mjs +2 -1
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.d.mts +9 -8
- package/dist/internal/production-runtime.d.ts +9 -8
- package/dist/layers-4PNE2HOY.cjs +18 -0
- package/dist/{layers-CJKSJGLN.mjs → layers-BRQF5ETU.mjs} +2 -1
- package/dist/{manager-NPG43N46.mjs → manager-RT733VRK.mjs} +2 -2
- package/dist/{manager-G4B2IPYE.cjs → manager-XZ5TX7AO.cjs} +3 -3
- package/dist/{metadata-CO9fRyyJ.d.mts → metadata-B08w4EYV.d.mts} +1 -1
- package/dist/{metadata-zY9wltwH.d.ts → metadata-IQEblkZp.d.ts} +1 -1
- package/dist/middleware.d.mts +5 -4
- package/dist/middleware.d.ts +5 -4
- package/dist/navigation.d.mts +6 -5
- package/dist/navigation.d.ts +6 -5
- package/dist/{nitro-TSGDUJMN.cjs → nitro-KQDU7CFE.cjs} +2 -2
- package/dist/{nitro-4LFVTT24.mjs → nitro-ZKLGOTVY.mjs} +1 -1
- package/dist/node-module-bundle-L5L7JCZ4.mjs +11 -0
- package/dist/node-module-bundle-VAFZOXMJ.cjs +11 -0
- package/dist/plugin.cjs +12 -10
- package/dist/plugin.d.mts +3 -2
- package/dist/plugin.d.ts +3 -2
- package/dist/plugin.mjs +11 -9
- package/dist/{production-runtime-CywsHwnG.d.mts → production-runtime-C3bGFEaM.d.mts} +1 -1
- package/dist/{production-runtime-lkfwujwK.d.ts → production-runtime-DRSOkc-d.d.ts} +1 -1
- package/dist/{render-plan-LVy6sGQe.d.mts → render-plan-B6CKNl4e.d.mts} +1 -1
- package/dist/{render-plan-DHF0GeWo.d.ts → render-plan-CCFuMLNS.d.ts} +1 -1
- package/dist/renderer-client.d.mts +5 -4
- package/dist/renderer-client.d.ts +5 -4
- package/dist/renderer.cjs +4 -2
- package/dist/renderer.d.mts +9 -1
- package/dist/renderer.d.ts +9 -1
- package/dist/renderer.mjs +3 -1
- package/dist/{request-6AkmhEYE.d.mts → request-DgD1XsTx.d.mts} +1 -1
- package/dist/{request-BYxlRqA9.d.ts → request-Dn6VURbE.d.ts} +1 -1
- package/dist/request.d.mts +4 -3
- package/dist/request.d.ts +4 -3
- package/dist/{route-rendering-Dd8Jmml7.d.mts → route-rendering-76A5I_kE.d.mts} +1 -1
- package/dist/{route-rendering-CWaKiUbS.d.ts → route-rendering-LAmQEdyG.d.ts} +1 -1
- package/dist/{router-B2m4fvve.d.ts → router-BSOOGya2.d.ts} +1 -1
- package/dist/{router-xwEE112q.d.mts → router-CnrRSa9d.d.mts} +1 -1
- package/dist/routes.d.mts +3 -2
- package/dist/routes.d.ts +3 -2
- package/dist/server-plugins.d.mts +4 -3
- package/dist/server-plugins.d.ts +4 -3
- package/dist/server.cjs +43 -36
- package/dist/server.d.mts +9 -8
- package/dist/server.d.ts +9 -8
- package/dist/server.mjs +27 -20
- package/dist/{spa-router-Y8rrXTVK.d.ts → spa-router-BMrSsG5b.d.ts} +2 -2
- package/dist/{spa-router-DVEHQnWo.d.mts → spa-router-DnYhWCvI.d.mts} +2 -2
- package/dist/testing.cjs +2 -1
- package/dist/testing.d.mts +3 -2
- package/dist/testing.d.ts +3 -2
- package/dist/testing.mjs +2 -1
- package/dist/{utils-DSPx34-A.d.mts → utils-ABkktwku.d.mts} +1 -1
- package/dist/{utils-Dvuny_08.d.ts → utils-C3GguS-Q.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +12 -10
- package/dist/vite.d.mts +3 -2
- package/dist/vite.d.ts +3 -2
- package/dist/vite.mjs +11 -9
- package/dist/workflows.cjs +2 -2
- package/dist/workflows.mjs +1 -1
- package/package.json +27 -13
- package/dist/layers-E4WPJNY5.cjs +0 -17
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
compileFarmDocsAdapterEdgeManifest,
|
|
9
9
|
createFarmDocsAPIHandler
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-YGMK6ESJ.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-47H7VENP.mjs";
|
|
21
21
|
import {
|
|
22
22
|
generateFarmDocsSearchClientRuntime,
|
|
23
23
|
isFarmDocsSearchEnabled,
|
|
@@ -26,15 +26,18 @@ import {
|
|
|
26
26
|
import {
|
|
27
27
|
FARM_PRERENDER_ENV
|
|
28
28
|
} from "./chunk-6VEHUKZ2.mjs";
|
|
29
|
+
import {
|
|
30
|
+
loadFarmDocsEngine
|
|
31
|
+
} from "./chunk-2VQKKQ6D.mjs";
|
|
29
32
|
import {
|
|
30
33
|
getDefaultDeployOutputDir,
|
|
31
34
|
getDeployTargetForPreset,
|
|
32
35
|
hasCustomFarmRouteContext,
|
|
33
36
|
resolveDeployOutputPath
|
|
34
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-BDJNP7AQ.mjs";
|
|
35
38
|
import {
|
|
36
39
|
resolveFarmInstrumentationFile
|
|
37
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-ZZSRYEYU.mjs";
|
|
38
41
|
import {
|
|
39
42
|
resolveFarmInstrumentationRuntime
|
|
40
43
|
} from "./chunk-H77NVNJ2.mjs";
|
|
@@ -42,6 +45,7 @@ import {
|
|
|
42
45
|
DEFAULT_NOT_FOUND_STYLES,
|
|
43
46
|
FARM_LAYOUT_ELEMENT_CLIENT_SOURCE,
|
|
44
47
|
PluginManager,
|
|
48
|
+
SHARP_INSTALL_HINT,
|
|
45
49
|
createFarmApp,
|
|
46
50
|
createFarmSourceAlias,
|
|
47
51
|
createFarmThemeCssPlugin,
|
|
@@ -57,19 +61,21 @@ import {
|
|
|
57
61
|
getClientModuleHydrationPlan,
|
|
58
62
|
getClientModuleMetadata,
|
|
59
63
|
getFarmClientHydrationPlanOptions,
|
|
64
|
+
loadTailwindVitePlugin,
|
|
60
65
|
mergeFarmFontCss,
|
|
61
66
|
mergeFarmProductionViteConfig,
|
|
62
67
|
mergeFarmViteConfig,
|
|
63
68
|
resolveFarmClientCacheAdapterEntry,
|
|
69
|
+
resolveFarmImageProviderForRuntime,
|
|
64
70
|
resolveFarmIsolatedClientHydrationMode,
|
|
65
71
|
resolveFarmNotFoundComponentPath
|
|
66
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-VPY755R2.mjs";
|
|
67
73
|
import {
|
|
68
74
|
findRequestBoundSourceBlockers,
|
|
69
75
|
generateFarmTypeArtifacts,
|
|
70
76
|
parseRouteRenderingDirective,
|
|
71
77
|
resolveRouteRenderingConfigFromFile
|
|
72
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-VVJCWBIE.mjs";
|
|
73
79
|
import {
|
|
74
80
|
isFarmPreviewDeploymentEnvironment
|
|
75
81
|
} from "./chunk-BOYNDCZL.mjs";
|
|
@@ -89,15 +95,16 @@ import {
|
|
|
89
95
|
} from "./chunk-GHFS7RUB.mjs";
|
|
90
96
|
import {
|
|
91
97
|
getFarmAppDirectories
|
|
92
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-JHWOVJ3M.mjs";
|
|
93
99
|
import {
|
|
94
100
|
REACT_RENDERER,
|
|
95
101
|
getFarmRendererCapabilities,
|
|
96
102
|
getFarmRendererComponentExtensions,
|
|
97
103
|
getFarmRendererStreamingCapabilitiesForRuntime,
|
|
98
104
|
isReactRenderer,
|
|
99
|
-
loadFarmRendererVitePlugins
|
|
100
|
-
|
|
105
|
+
loadFarmRendererVitePlugins,
|
|
106
|
+
resolveFarmRendererAppSetup
|
|
107
|
+
} from "./chunk-DAATZTKJ.mjs";
|
|
101
108
|
import {
|
|
102
109
|
applyFarmCspHashesToHtml
|
|
103
110
|
} from "./chunk-7BC6GAL7.mjs";
|
|
@@ -120,7 +127,7 @@ import {
|
|
|
120
127
|
import {
|
|
121
128
|
applyFarmWorkflowVercelCrons,
|
|
122
129
|
prepareFarmWorkflowsForNitro
|
|
123
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-3ATMYLLJ.mjs";
|
|
124
131
|
import {
|
|
125
132
|
getFarmIntegrationPluginServerRuntime,
|
|
126
133
|
getIntegrationProviders
|
|
@@ -130,10 +137,13 @@ import {
|
|
|
130
137
|
} from "./chunk-TIKNUAU7.mjs";
|
|
131
138
|
import {
|
|
132
139
|
APIRouteManager
|
|
133
|
-
} from "./chunk-
|
|
140
|
+
} from "./chunk-WNUBR4CA.mjs";
|
|
134
141
|
import {
|
|
135
142
|
readFarmI18nCatalogs
|
|
136
143
|
} from "./chunk-FV45CKBC.mjs";
|
|
144
|
+
import {
|
|
145
|
+
VERCEL_OG_INSTALL_HINT
|
|
146
|
+
} from "./chunk-YOZYCI6Z.mjs";
|
|
137
147
|
import {
|
|
138
148
|
resolveFarmAPIServerBasePath,
|
|
139
149
|
resolveFarmAPIServerRoutePath
|
|
@@ -954,52 +964,6 @@ export default {};
|
|
|
954
964
|
}
|
|
955
965
|
__name(createFarmNodeServerEntry, "createFarmNodeServerEntry");
|
|
956
966
|
|
|
957
|
-
// src/build/vite-plugin-compat.ts
|
|
958
|
-
function adaptTailwindVitePlugin(pluginOption, builder) {
|
|
959
|
-
if (builder !== "rolldown") return pluginOption;
|
|
960
|
-
return adaptPluginOption(pluginOption);
|
|
961
|
-
}
|
|
962
|
-
__name(adaptTailwindVitePlugin, "adaptTailwindVitePlugin");
|
|
963
|
-
function adaptPluginOption(pluginOption) {
|
|
964
|
-
if (Array.isArray(pluginOption)) return pluginOption.map(adaptPluginOption);
|
|
965
|
-
if (!pluginOption || typeof pluginOption !== "object") return pluginOption;
|
|
966
|
-
const plugin = pluginOption;
|
|
967
|
-
if (!plugin.name?.startsWith("@tailwindcss/vite:generate:")) return pluginOption;
|
|
968
|
-
if (isVitePluginHook(plugin.transform)) {
|
|
969
|
-
return {
|
|
970
|
-
...plugin,
|
|
971
|
-
transform: withVite5TransformContext(plugin.transform)
|
|
972
|
-
};
|
|
973
|
-
}
|
|
974
|
-
if (plugin.transform && typeof plugin.transform === "object" && "handler" in plugin.transform && isVitePluginHook(plugin.transform.handler)) {
|
|
975
|
-
return {
|
|
976
|
-
...plugin,
|
|
977
|
-
transform: {
|
|
978
|
-
...plugin.transform,
|
|
979
|
-
handler: withVite5TransformContext(plugin.transform.handler)
|
|
980
|
-
}
|
|
981
|
-
};
|
|
982
|
-
}
|
|
983
|
-
return pluginOption;
|
|
984
|
-
}
|
|
985
|
-
__name(adaptPluginOption, "adaptPluginOption");
|
|
986
|
-
function isVitePluginHook(value) {
|
|
987
|
-
return typeof value === "function";
|
|
988
|
-
}
|
|
989
|
-
__name(isVitePluginHook, "isVitePluginHook");
|
|
990
|
-
function withVite5TransformContext(handler) {
|
|
991
|
-
return function(...args) {
|
|
992
|
-
const context = new Proxy(this, {
|
|
993
|
-
get(target, property, receiver) {
|
|
994
|
-
if (property === "environment") return void 0;
|
|
995
|
-
return Reflect.get(target, property, receiver);
|
|
996
|
-
}
|
|
997
|
-
});
|
|
998
|
-
return handler.apply(context, args);
|
|
999
|
-
};
|
|
1000
|
-
}
|
|
1001
|
-
__name(withVite5TransformContext, "withVite5TransformContext");
|
|
1002
|
-
|
|
1003
967
|
// src/nitro/universal-build.ts
|
|
1004
968
|
function preloadFarmNitroBuilder() {
|
|
1005
969
|
return import("nitro/builder").then(
|
|
@@ -1117,6 +1081,9 @@ var NITRO_EXTERNAL_MODULES = /* @__PURE__ */ new Set([
|
|
|
1117
1081
|
"fsevents",
|
|
1118
1082
|
"esbuild",
|
|
1119
1083
|
"lightningcss",
|
|
1084
|
+
"rolldown",
|
|
1085
|
+
"rolldown/experimental",
|
|
1086
|
+
"rolldown/utils",
|
|
1120
1087
|
"rollup",
|
|
1121
1088
|
"vite",
|
|
1122
1089
|
"nitro",
|
|
@@ -1357,69 +1324,70 @@ function hasFarmRuntimeConfigModule(config, configModulePath) {
|
|
|
1357
1324
|
return Boolean(configModulePath || (config.layers || []).some((layer) => layer.configFile));
|
|
1358
1325
|
}
|
|
1359
1326
|
__name(hasFarmRuntimeConfigModule, "hasFarmRuntimeConfigModule");
|
|
1360
|
-
function
|
|
1361
|
-
const
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
)
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
return
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1327
|
+
async function minifyFarmServerChunk(code, fileName, options) {
|
|
1328
|
+
const rolldownUtils = await import("rolldown/utils");
|
|
1329
|
+
const keepNames = { function: options.keepNames, class: options.keepNames };
|
|
1330
|
+
const result = await rolldownUtils.minify(fileName, code, {
|
|
1331
|
+
module: true,
|
|
1332
|
+
compress: { target: options.target, keepNames },
|
|
1333
|
+
mangle: { keepNames },
|
|
1334
|
+
codegen: { legalComments: "none", asciiOnly: true },
|
|
1335
|
+
sourcemap: false
|
|
1336
|
+
});
|
|
1337
|
+
if (result.errors.length > 0) {
|
|
1338
|
+
throw new Error(`Failed to minify ${fileName}: ${result.errors[0].message}`);
|
|
1339
|
+
}
|
|
1340
|
+
return restoreLiteralModuleSpecifiers(result.code, fileName, rolldownUtils);
|
|
1341
|
+
}
|
|
1342
|
+
__name(minifyFarmServerChunk, "minifyFarmServerChunk");
|
|
1343
|
+
function restoreLiteralModuleSpecifiers(code, fileName, { parseSync, Visitor }) {
|
|
1344
|
+
if (!code.includes("import(`") && !code.includes("require(`")) return code;
|
|
1345
|
+
const parsed = parseSync(fileName, code, { lang: "js", sourceType: "module" });
|
|
1346
|
+
if (parsed.errors.length > 0) {
|
|
1347
|
+
throw new Error(`Failed to minify ${fileName}: ${parsed.errors[0].message}`);
|
|
1348
|
+
}
|
|
1349
|
+
const replacements = [];
|
|
1350
|
+
const restore = /* @__PURE__ */ __name((node) => {
|
|
1351
|
+
if (node?.type !== "TemplateLiteral") return;
|
|
1352
|
+
const template = node;
|
|
1353
|
+
const value = template.quasis[0]?.value.cooked;
|
|
1354
|
+
if (template.expressions.length > 0 || typeof value !== "string") return;
|
|
1355
|
+
const text = JSON.stringify(value).replace(
|
|
1356
|
+
/[\u007f-]/g,
|
|
1357
|
+
(character) => `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`
|
|
1358
|
+
);
|
|
1359
|
+
replacements.push({ start: template.start, end: template.end, text });
|
|
1360
|
+
}, "restore");
|
|
1361
|
+
new Visitor({
|
|
1362
|
+
ImportExpression(node) {
|
|
1363
|
+
restore(node.source);
|
|
1364
|
+
},
|
|
1365
|
+
CallExpression(node) {
|
|
1366
|
+
if (node.callee.type === "Identifier" && node.callee.name === "require" && node.arguments.length === 1) {
|
|
1367
|
+
restore(node.arguments[0]);
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
}).visit(parsed.program);
|
|
1371
|
+
let restored = "";
|
|
1372
|
+
let offset = 0;
|
|
1373
|
+
for (const { start, end, text } of replacements.sort((a, b) => a.start - b.start)) {
|
|
1374
|
+
restored += code.slice(offset, start) + text;
|
|
1375
|
+
offset = end;
|
|
1376
|
+
}
|
|
1377
|
+
return restored + code.slice(offset);
|
|
1388
1378
|
}
|
|
1389
|
-
__name(
|
|
1390
|
-
function
|
|
1391
|
-
const configuredTransformOptions = createEsbuildTransformOptions(
|
|
1392
|
-
configuredEsbuildOptions,
|
|
1393
|
-
true,
|
|
1394
|
-
"esnext"
|
|
1395
|
-
);
|
|
1396
|
-
const transformOptions = {
|
|
1397
|
-
format: "esm",
|
|
1398
|
-
target: configuredTransformOptions.target,
|
|
1399
|
-
loader: "js",
|
|
1400
|
-
sourcemap: false,
|
|
1401
|
-
minify: true,
|
|
1402
|
-
keepNames: configuredTransformOptions.keepNames,
|
|
1403
|
-
legalComments: configuredTransformOptions.legalComments,
|
|
1404
|
-
charset: configuredTransformOptions.charset
|
|
1405
|
-
};
|
|
1379
|
+
__name(restoreLiteralModuleSpecifiers, "restoreLiteralModuleSpecifiers");
|
|
1380
|
+
function createServerChunkMinifyPlugin(options) {
|
|
1406
1381
|
return {
|
|
1407
|
-
name: "farm-
|
|
1382
|
+
name: "farm-server-chunk-minify",
|
|
1408
1383
|
async renderChunk(code, chunk) {
|
|
1409
|
-
const
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
sourcefile: chunk.fileName
|
|
1413
|
-
});
|
|
1414
|
-
if (!result.code) return null;
|
|
1415
|
-
return {
|
|
1416
|
-
code: result.code,
|
|
1417
|
-
map: result.map || null
|
|
1418
|
-
};
|
|
1384
|
+
const minified = await minifyFarmServerChunk(code, chunk.fileName, options);
|
|
1385
|
+
if (!minified) return null;
|
|
1386
|
+
return { code: minified, map: null };
|
|
1419
1387
|
}
|
|
1420
1388
|
};
|
|
1421
1389
|
}
|
|
1422
|
-
__name(
|
|
1390
|
+
__name(createServerChunkMinifyPlugin, "createServerChunkMinifyPlugin");
|
|
1423
1391
|
function trimSlashes(value) {
|
|
1424
1392
|
return value.replace(/^\/+|\/+$/g, "");
|
|
1425
1393
|
}
|
|
@@ -2141,15 +2109,10 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2141
2109
|
const postcssConfigPath = path5.join(clientEntryDir, "postcss.config.cjs");
|
|
2142
2110
|
await fs.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
|
|
2143
2111
|
postcssSearchPath = clientEntryDir;
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
} catch (error) {
|
|
2149
|
-
logger.warn(
|
|
2150
|
-
`Tailwind plugin auto-enable failed; continuing without it: ${error.message}`
|
|
2151
|
-
);
|
|
2152
|
-
}
|
|
2112
|
+
tailwindVitePlugin = await loadTailwindVitePlugin({
|
|
2113
|
+
builder: productionVite.builder,
|
|
2114
|
+
announce: true
|
|
2115
|
+
});
|
|
2153
2116
|
}
|
|
2154
2117
|
try {
|
|
2155
2118
|
const clientViteConfig = {
|
|
@@ -2237,7 +2200,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2237
2200
|
if (id.includes("/api/") && id.includes("/route")) {
|
|
2238
2201
|
return { id: "\0empty-api-route", external: false };
|
|
2239
2202
|
}
|
|
2240
|
-
if (id === "fsevents" || id.includes("fsevents") || id.endsWith(".node") || id === "nitro" || id === "vite" || id === "esbuild" || id === "rollup" || id.startsWith("nitro/") || id.includes("node-pre-gyp") || id.includes("nf3")) {
|
|
2203
|
+
if (id === "fsevents" || id.includes("fsevents") || id.endsWith(".node") || id === "nitro" || id === "vite" || id === "esbuild" || id === "rolldown" || id.startsWith("rolldown/") || id === "rollup" || id.startsWith("nitro/") || id.includes("node-pre-gyp") || id.includes("nf3")) {
|
|
2241
2204
|
return { id: "\0empty-module", external: false };
|
|
2242
2205
|
}
|
|
2243
2206
|
return null;
|
|
@@ -3054,8 +3017,11 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3054
3017
|
srcDir,
|
|
3055
3018
|
publicRuntimeConfig
|
|
3056
3019
|
);
|
|
3020
|
+
const appSetupPath = resolveFarmRendererAppSetup(root, renderer);
|
|
3057
3021
|
const rendererClientImports = isReactRenderer(renderer) ? `import React from "react";
|
|
3058
|
-
import { createRoot, hydrateRoot } from "react-dom/client";` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)}
|
|
3022
|
+
import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
|
|
3023
|
+
import __farmAppSetup from ${JSON.stringify(toPosixPath(appSetupPath))};
|
|
3024
|
+
__farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
|
|
3059
3025
|
const providerClientCode = generateFarmIntegrationProviderClientCode(
|
|
3060
3026
|
integrationProviders,
|
|
3061
3027
|
root,
|
|
@@ -4434,7 +4400,7 @@ void hydrate();
|
|
|
4434
4400
|
__name(generateClientHydrationEntry, "generateClientHydrationEntry");
|
|
4435
4401
|
async function buildSSRInMemory(productionVite, config, root, routeManager, apiRouteManager, serverRenderer, preset, collectedPageRoutes, collectedLayoutRoutes, collectedRouteSlots, isolatedClientBoundaryModules, hydrationPlanCache, rendererBuildLifetime) {
|
|
4436
4402
|
const viteBuild = productionVite.build;
|
|
4437
|
-
const { farmPlugin } = await import("./vite.mjs");
|
|
4403
|
+
const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
|
|
4438
4404
|
const { PluginManager: PluginManager2 } = await import("./plugin.mjs");
|
|
4439
4405
|
const fs = await import("fs/promises");
|
|
4440
4406
|
const pluginManager = new PluginManager2({
|
|
@@ -4456,14 +4422,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4456
4422
|
path5.join(postcssConfigDir, "postcss.config.cjs"),
|
|
4457
4423
|
"module.exports = { plugins: [] };\n"
|
|
4458
4424
|
);
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
}
|
|
4463
|
-
logger.warn(
|
|
4464
|
-
`Tailwind plugin auto-enable failed for SSR; continuing without it: ${error.message}`
|
|
4465
|
-
);
|
|
4466
|
-
}
|
|
4425
|
+
tailwindVitePlugin = await loadTailwindVitePlugin({
|
|
4426
|
+
builder: productionVite.builder,
|
|
4427
|
+
label: "for SSR"
|
|
4428
|
+
});
|
|
4467
4429
|
}
|
|
4468
4430
|
let ssrBundle;
|
|
4469
4431
|
let ssrEntryFile;
|
|
@@ -4494,6 +4456,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4494
4456
|
modulePath: entry.modulePath
|
|
4495
4457
|
});
|
|
4496
4458
|
}
|
|
4459
|
+
assertMetadataImageRuntimeInstalled(root, metadataImageRoutes);
|
|
4497
4460
|
const applicationMetadataRoutes = Array.from(
|
|
4498
4461
|
routeManager.getMetadataRoutes().values(),
|
|
4499
4462
|
(entry) => ({
|
|
@@ -4537,7 +4500,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4537
4500
|
const appDirs = getFarmAppDirectories(config);
|
|
4538
4501
|
let openAPIReference = null;
|
|
4539
4502
|
if (config.openapi.enabled && config.openapi.route) {
|
|
4540
|
-
const { OpenAPIManager, renderOpenAPIReferenceHTML } = await import("./manager-
|
|
4503
|
+
const { OpenAPIManager, renderOpenAPIReferenceHTML } = await import("./manager-RT733VRK.mjs");
|
|
4541
4504
|
const openAPIManager = new OpenAPIManager(appDirs, config.openapi, {
|
|
4542
4505
|
mode: "production",
|
|
4543
4506
|
apiBaseURL: config.api.baseURL
|
|
@@ -4698,6 +4661,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4698
4661
|
...useExternalMetadataImageRuntime ? ["@vercel/og"] : [],
|
|
4699
4662
|
"esbuild",
|
|
4700
4663
|
"lightningcss",
|
|
4664
|
+
"rolldown",
|
|
4665
|
+
"rolldown/experimental",
|
|
4666
|
+
"rolldown/utils",
|
|
4701
4667
|
"rollup",
|
|
4702
4668
|
"@rollup/rollup-darwin-arm64",
|
|
4703
4669
|
"@rollup/rollup-darwin-x64",
|
|
@@ -4753,6 +4719,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4753
4719
|
};
|
|
4754
4720
|
}
|
|
4755
4721
|
},
|
|
4722
|
+
farmServerOnlyEntriesPlugin(),
|
|
4756
4723
|
farmPlugin({ ...config, isolatedClientBoundaryModules }, pluginManager),
|
|
4757
4724
|
farmEnvironmentFunctionsPlugin(),
|
|
4758
4725
|
{
|
|
@@ -5123,6 +5090,17 @@ async function applyFarmPreloadBudget(response, pathname, request) {
|
|
|
5123
5090
|
`.trim();
|
|
5124
5091
|
}
|
|
5125
5092
|
__name(generatePreloadResponseRuntimeSource, "generatePreloadResponseRuntimeSource");
|
|
5093
|
+
function generateFarmRendererAppSetupServerCode(config) {
|
|
5094
|
+
const appSetupPath = resolveFarmRendererAppSetup(config.root || process.cwd(), config.renderer);
|
|
5095
|
+
if (!appSetupPath) return "";
|
|
5096
|
+
return `
|
|
5097
|
+
import __farmAppSetup from ${JSON.stringify(toPosixPath(appSetupPath))};
|
|
5098
|
+
if (typeof ReactDOMServer.configureApp !== "function") {
|
|
5099
|
+
throw new Error(${JSON.stringify(`Renderer \`${config.renderer.name}\` does not support \`appSetup\`: its server module must export configureApp().`)});
|
|
5100
|
+
}
|
|
5101
|
+
ReactDOMServer.configureApp(__farmAppSetup);`;
|
|
5102
|
+
}
|
|
5103
|
+
__name(generateFarmRendererAppSetupServerCode, "generateFarmRendererAppSetupServerCode");
|
|
5126
5104
|
function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache) {
|
|
5127
5105
|
const hasCompressionRuntime = config.compress && resolveFarmInstrumentationRuntime(preset) === "nodejs";
|
|
5128
5106
|
const servesAgentRobotsTxt = Boolean(config.agent?.crawlers?.enabled) && !applicationMetadataRoutes.some(
|
|
@@ -5141,7 +5119,7 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
|
|
|
5141
5119
|
getFarmPresetRuntime(preset)
|
|
5142
5120
|
);
|
|
5143
5121
|
const rendererServerImports = isReactRenderer(config.renderer) ? `import * as React from "react";
|
|
5144
|
-
import * as ReactDOMServer from "react-dom/server";${hasIsolatedClientGraphRuntime ? '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";' : ""}` : `import React, * as ReactDOMServer from ${JSON.stringify(config.renderer.server)}
|
|
5122
|
+
import * as ReactDOMServer from "react-dom/server";${hasIsolatedClientGraphRuntime ? '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";' : ""}` : `import React, * as ReactDOMServer from ${JSON.stringify(config.renderer.server)};${generateFarmRendererAppSetupServerCode(config)}`;
|
|
5145
5123
|
const routeClientGraphServerRuntime = hasIsolatedClientGraphRuntime ? `function wrapFarmRouteClientGraph(element) {
|
|
5146
5124
|
return wrapFarmIsolatedClientGraph(React, element);
|
|
5147
5125
|
}
|
|
@@ -9316,16 +9294,9 @@ export default async function farmNitroEventHandler(event) {
|
|
|
9316
9294
|
if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
|
|
9317
9295
|
const useRolldownBuilder = canReusePrebuiltSSR && (nitroConfig.builder ?? process.env.NITRO_BUILDER) === "rolldown";
|
|
9318
9296
|
const shouldMinify = nitroConfig.minify !== false;
|
|
9319
|
-
const
|
|
9320
|
-
const
|
|
9321
|
-
|
|
9322
|
-
// function with toString(); the helper is outside the emitted script scope.
|
|
9323
|
-
keepNames: !(config.docs?.enabled && config.docs.adapter?.server),
|
|
9324
|
-
legalComments: "none"
|
|
9325
|
-
};
|
|
9326
|
-
const prebuiltSSREsbuildOptions = config.docs?.enabled && config.docs.adapter?.server ? resolvedEsbuildOptions : configuredEsbuildOptions;
|
|
9327
|
-
const useFarmEsbuildMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
|
|
9328
|
-
const esbuildChunkMinifier = useFarmEsbuildMinifier ? createEsbuildChunkMinifyPlugin(resolvedEsbuildOptions) : null;
|
|
9297
|
+
const keepServerNames = !(config.docs?.enabled && config.docs.adapter?.server);
|
|
9298
|
+
const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
|
|
9299
|
+
const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
|
|
9329
9300
|
if (canReusePrebuiltSSR) {
|
|
9330
9301
|
const configuredRollupPlugins = nitroConfig.rollupConfig?.plugins;
|
|
9331
9302
|
nitroConfig.rollupConfig = {
|
|
@@ -9336,7 +9307,7 @@ export default async function farmNitroEventHandler(event) {
|
|
|
9336
9307
|
]
|
|
9337
9308
|
};
|
|
9338
9309
|
}
|
|
9339
|
-
nitroConfig.minify =
|
|
9310
|
+
nitroConfig.minify = useFarmServerMinifier ? false : shouldMinify;
|
|
9340
9311
|
const nitroInstance = await nitroBuilder.createNitro(nitroConfig);
|
|
9341
9312
|
if (config.security.csp && config.security.csp.nonce) {
|
|
9342
9313
|
nitroInstance.hooks.hook("prerender:generate", async (route) => {
|
|
@@ -9386,26 +9357,25 @@ export default async function farmNitroEventHandler(event) {
|
|
|
9386
9357
|
await copyPrebuiltSSRBundle(
|
|
9387
9358
|
ssrBundle,
|
|
9388
9359
|
path5.join(prerenderServerDir, FARM_SSR_OUTPUT_DIR),
|
|
9389
|
-
|
|
9390
|
-
false,
|
|
9360
|
+
null,
|
|
9391
9361
|
fs
|
|
9392
9362
|
);
|
|
9393
9363
|
await registerPrebuiltSSRPackageImport(prerenderServerDir, ssrEntryFile, fs);
|
|
9394
9364
|
});
|
|
9395
9365
|
});
|
|
9396
9366
|
}
|
|
9397
|
-
if (
|
|
9367
|
+
if (serverChunkMinifier || useRolldownBuilder) {
|
|
9398
9368
|
nitroInstance.hooks.hook("rollup:before", (_nitro, rollupConfig) => {
|
|
9399
9369
|
if (useRolldownBuilder) {
|
|
9400
9370
|
const rolldownConfig = rollupConfig;
|
|
9401
9371
|
delete rolldownConfig.inject;
|
|
9402
9372
|
delete rolldownConfig.jsx;
|
|
9403
9373
|
}
|
|
9404
|
-
if (
|
|
9374
|
+
if (serverChunkMinifier) {
|
|
9405
9375
|
const configuredPlugins = rollupConfig.plugins;
|
|
9406
9376
|
rollupConfig.plugins = [
|
|
9407
9377
|
...Array.isArray(configuredPlugins) ? configuredPlugins : configuredPlugins ? [configuredPlugins] : [],
|
|
9408
|
-
|
|
9378
|
+
serverChunkMinifier
|
|
9409
9379
|
];
|
|
9410
9380
|
}
|
|
9411
9381
|
});
|
|
@@ -9452,8 +9422,7 @@ export default async function farmNitroEventHandler(event) {
|
|
|
9452
9422
|
canReusePrebuiltSSR ? copyPrebuiltSSRBundle(
|
|
9453
9423
|
ssrBundle,
|
|
9454
9424
|
path5.join(outputDir, "server", FARM_SSR_OUTPUT_DIR),
|
|
9455
|
-
|
|
9456
|
-
shouldMinify,
|
|
9425
|
+
shouldMinify ? { keepNames: keepServerNames, target: "node18" } : null,
|
|
9457
9426
|
fs
|
|
9458
9427
|
) : Promise.resolve(),
|
|
9459
9428
|
runtimeCopyPromise
|
|
@@ -9497,23 +9466,7 @@ function resolveFarmNitroOutputConfig(preset, outputDir) {
|
|
|
9497
9466
|
};
|
|
9498
9467
|
}
|
|
9499
9468
|
__name(resolveFarmNitroOutputConfig, "resolveFarmNitroOutputConfig");
|
|
9500
|
-
async function copyPrebuiltSSRBundle(ssrBundle, targetDir,
|
|
9501
|
-
const {
|
|
9502
|
-
include: _include,
|
|
9503
|
-
exclude: _exclude,
|
|
9504
|
-
sourceMap: _sourceMap,
|
|
9505
|
-
loaders: _loaders,
|
|
9506
|
-
...configuredTransformOptions
|
|
9507
|
-
} = configuredEsbuildOptions;
|
|
9508
|
-
const hasConfiguredTransforms = Object.keys(configuredTransformOptions).some(
|
|
9509
|
-
(option) => option !== "minify"
|
|
9510
|
-
);
|
|
9511
|
-
const transformOptions = createEsbuildTransformOptions(
|
|
9512
|
-
configuredEsbuildOptions,
|
|
9513
|
-
minify,
|
|
9514
|
-
"node18"
|
|
9515
|
-
);
|
|
9516
|
-
const transform = minify || hasConfiguredTransforms ? (await import("esbuild")).transform : null;
|
|
9469
|
+
async function copyPrebuiltSSRBundle(ssrBundle, targetDir, minifyOptions, fs) {
|
|
9517
9470
|
await fs.rm(targetDir, { recursive: true, force: true });
|
|
9518
9471
|
await Promise.all(
|
|
9519
9472
|
Object.entries(ssrBundle).map(async ([fileName, output]) => {
|
|
@@ -9523,14 +9476,7 @@ async function copyPrebuiltSSRBundle(ssrBundle, targetDir, configuredEsbuildOpti
|
|
|
9523
9476
|
await fs.writeFile(targetPath, output.source);
|
|
9524
9477
|
return;
|
|
9525
9478
|
}
|
|
9526
|
-
|
|
9527
|
-
if (transform) {
|
|
9528
|
-
const result = await transform(code, {
|
|
9529
|
-
...transformOptions,
|
|
9530
|
-
sourcefile: fileName
|
|
9531
|
-
});
|
|
9532
|
-
code = result.code;
|
|
9533
|
-
}
|
|
9479
|
+
const code = minifyOptions ? await minifyFarmServerChunk(output.code, fileName, minifyOptions) : output.code;
|
|
9534
9480
|
await fs.writeFile(targetPath, code);
|
|
9535
9481
|
})
|
|
9536
9482
|
);
|
|
@@ -9705,9 +9651,7 @@ async function stageSharpRuntime(config, root, distDir, fs, preset) {
|
|
|
9705
9651
|
try {
|
|
9706
9652
|
await copyPackage("sharp", sharpRequire);
|
|
9707
9653
|
if (!copiedPackages.has("sharp")) {
|
|
9708
|
-
throw new Error(
|
|
9709
|
-
"Farm image optimization requires sharp. Reinstall dependencies without omitting optional packages."
|
|
9710
|
-
);
|
|
9654
|
+
throw new Error(`Farm image optimization requires sharp. ${SHARP_INSTALL_HINT}`);
|
|
9711
9655
|
}
|
|
9712
9656
|
} catch (error) {
|
|
9713
9657
|
await fs.rm(stageDir, { recursive: true, force: true });
|
|
@@ -9779,20 +9723,31 @@ async function mergeStagedDirectory(sourceDir, targetDir, fs) {
|
|
|
9779
9723
|
);
|
|
9780
9724
|
}
|
|
9781
9725
|
__name(mergeStagedDirectory, "mergeStagedDirectory");
|
|
9782
|
-
|
|
9726
|
+
function assertMetadataImageRuntimeInstalled(root, metadataImageRoutes) {
|
|
9727
|
+
const generated = metadataImageRoutes.find((image) => image.sourceType === "module");
|
|
9728
|
+
if (!generated || resolveMetadataImageRuntimePackageJson(root)) return;
|
|
9729
|
+
const file = generated.modulePath ? toPosixPath(path5.relative(root, generated.modulePath)) : "";
|
|
9730
|
+
throw new Error(
|
|
9731
|
+
`${file || "A generated metadata image"} renders with @vercel/og, which is not installed. ${VERCEL_OG_INSTALL_HINT}`
|
|
9732
|
+
);
|
|
9733
|
+
}
|
|
9734
|
+
__name(assertMetadataImageRuntimeInstalled, "assertMetadataImageRuntimeInstalled");
|
|
9735
|
+
function resolveMetadataImageRuntimePackageJson(root) {
|
|
9783
9736
|
const projectRequire = createRequire(path5.join(root, "package.json"));
|
|
9784
|
-
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
} catch {
|
|
9791
|
-
}
|
|
9737
|
+
const packageJsonPath = resolvePackageJson(projectRequire, "@vercel/og");
|
|
9738
|
+
if (packageJsonPath) return packageJsonPath;
|
|
9739
|
+
try {
|
|
9740
|
+
return resolvePackageJson(createRequire(projectRequire.resolve("@farm.js/core")), "@vercel/og");
|
|
9741
|
+
} catch {
|
|
9742
|
+
return null;
|
|
9792
9743
|
}
|
|
9744
|
+
}
|
|
9745
|
+
__name(resolveMetadataImageRuntimePackageJson, "resolveMetadataImageRuntimePackageJson");
|
|
9746
|
+
async function copyMetadataImageRuntime(root, nitroFuncDir, fs) {
|
|
9747
|
+
const packageJsonPath = resolveMetadataImageRuntimePackageJson(root);
|
|
9793
9748
|
if (!packageJsonPath) {
|
|
9794
9749
|
throw new Error(
|
|
9795
|
-
|
|
9750
|
+
`The server output imports @vercel/og, which is not installed. ${VERCEL_OG_INSTALL_HINT}`
|
|
9796
9751
|
);
|
|
9797
9752
|
}
|
|
9798
9753
|
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
|
|
@@ -9969,6 +9924,14 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
9969
9924
|
outputDir: targets.outputDir
|
|
9970
9925
|
}
|
|
9971
9926
|
};
|
|
9927
|
+
config = {
|
|
9928
|
+
...config,
|
|
9929
|
+
images: resolveFarmImageProviderForRuntime(config.images, {
|
|
9930
|
+
root: targets.root,
|
|
9931
|
+
preset: targets.preset
|
|
9932
|
+
})
|
|
9933
|
+
};
|
|
9934
|
+
if (config.docs?.enabled) await loadFarmDocsEngine();
|
|
9972
9935
|
pluginManager.updateContext({ config });
|
|
9973
9936
|
const { root, preset, srcDir, distDir, deployOutputDir } = targets;
|
|
9974
9937
|
logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
|
|
@@ -10230,7 +10193,7 @@ function resolveLegacyPageEntry(config, root, srcDir) {
|
|
|
10230
10193
|
__name(resolveLegacyPageEntry, "resolveLegacyPageEntry");
|
|
10231
10194
|
async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
|
|
10232
10195
|
const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
|
|
10233
|
-
import("./nitro-
|
|
10196
|
+
import("./nitro-ZKLGOTVY.mjs"),
|
|
10234
10197
|
import("nitro/builder")
|
|
10235
10198
|
]);
|
|
10236
10199
|
let nitroConfig = await createNitroConfig(
|