@farm.js/core 0.1.19 → 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.d.mts +3 -4
- package/dist/app-markdown.d.ts +3 -4
- 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-FVZGEVTO.mjs → chunk-5V37LKBG.mjs} +102 -38
- package/dist/chunk-75WGQVQA.cjs +46 -0
- package/dist/{chunk-RFYO7QUD.cjs → chunk-A7T6JZNI.cjs} +1 -1
- package/dist/{chunk-AFOD3LYZ.cjs → chunk-B3WK4DTX.cjs} +10 -9
- 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-2GNATDDE.mjs → chunk-F7E2AZKQ.mjs} +1 -1
- package/dist/{chunk-7WPA7GBZ.mjs → chunk-GHFS7RUB.mjs} +1 -1
- package/dist/{chunk-NSFC3LHB.cjs → chunk-GQFSCBKJ.cjs} +234 -170
- package/dist/{chunk-NZ2JVBT2.mjs → chunk-GZ3ZPTQV.mjs} +2 -2
- package/dist/{chunk-RKQVJN2O.mjs → chunk-JIKGGIOL.mjs} +1 -1
- package/dist/{chunk-WZXN4R5Y.mjs → chunk-K6MG3SEG.mjs} +106 -75
- package/dist/{chunk-OXSIH4D6.cjs → chunk-KNPRCKXK.cjs} +6 -1
- package/dist/{chunk-2ANEVVF7.mjs → chunk-NRS46D4L.mjs} +1 -1
- package/dist/{chunk-A72YEUZ3.mjs → chunk-OCE65DDM.mjs} +1 -1
- package/dist/{chunk-UDBJCUPA.mjs → chunk-PUCUVI7K.mjs} +11 -7
- package/dist/{chunk-XDGMADQM.cjs → chunk-PZX6I4JW.cjs} +384 -353
- package/dist/{chunk-GDSHDTJ4.cjs → chunk-Q5B3KJBP.cjs} +2 -2
- package/dist/{chunk-TSWW5BVH.mjs → chunk-QMV4QELL.mjs} +1 -1
- package/dist/{chunk-V4AICMQA.mjs → chunk-RMIJFZU3.mjs} +26 -2
- 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-QBPKKQTD.mjs → chunk-W7MZXRXM.mjs} +19 -4
- package/dist/{chunk-Y53ZSFN6.cjs → chunk-WM6HL7E7.cjs} +4 -3
- package/dist/{chunk-GPVTX3HT.cjs → chunk-XFFQSD2F.cjs} +2 -2
- package/dist/{chunk-62YJ2IEB.cjs → chunk-XI3GWPUS.cjs} +23 -20
- package/dist/{chunk-KVFPGF2M.cjs → chunk-YJJLXIIS.cjs} +7 -7
- package/dist/{chunk-U5BMPGS3.cjs → chunk-YP5JZ4LF.cjs} +32 -8
- package/dist/{chunk-S27FMYAM.cjs → chunk-ZE6ONQ5R.cjs} +28 -13
- 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-FY5R7TQ4.mjs → devtools-MTB5SA2B.mjs} +3 -3
- package/dist/{devtools-5KGPDVKL.cjs → devtools-R6MDDAZK.cjs} +7 -7
- package/dist/docs.cjs +6 -5
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +5 -4
- package/dist/index.cjs +21 -20
- package/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.mjs +20 -19
- package/dist/integrations.d.mts +2 -3
- package/dist/integrations.d.ts +2 -3
- package/dist/internal/app-markdown-runtime.d.mts +2 -3
- package/dist/internal/app-markdown-runtime.d.ts +2 -3
- package/dist/internal/build-runtime.cjs +15 -14
- package/dist/internal/build-runtime.d.mts +4 -5
- package/dist/internal/build-runtime.d.ts +4 -5
- package/dist/internal/build-runtime.mjs +14 -13
- package/dist/internal/cli-runtime.cjs +7 -7
- package/dist/internal/cli-runtime.mjs +6 -6
- 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 +4 -4
- package/dist/internal/config-runtime.d.mts +3 -4
- package/dist/internal/config-runtime.d.ts +3 -4
- package/dist/internal/config-runtime.mjs +3 -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 +2 -2
- package/dist/internal/production-runtime.d.mts +8 -9
- package/dist/internal/production-runtime.d.ts +8 -9
- package/dist/internal/production-runtime.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 +17 -11
- package/dist/plugin.d.mts +3 -4
- package/dist/plugin.d.ts +3 -4
- package/dist/plugin.mjs +17 -11
- 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/server-plugins.d.mts +3 -4
- package/dist/server-plugins.d.ts +3 -4
- package/dist/server.cjs +25 -24
- package/dist/server.d.mts +8 -9
- package/dist/server.d.ts +8 -9
- package/dist/server.mjs +12 -11
- 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 +12 -11
- package/dist/vite.d.mts +2 -3
- package/dist/vite.d.ts +2 -3
- package/dist/vite.mjs +11 -10
- 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
|
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,
|
|
@@ -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";
|
|
@@ -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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkN4RLRSWWcjs = require('./chunk-N4RLRSWW.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunk2CQ74SP6cjs = require('./chunk-2CQ74SP6.cjs');
|
|
@@ -24,10 +24,11 @@ var _chunk6V4TDWECcjs = require('./chunk-6V4TDWEC.cjs');
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _chunkSOR334EBcjs = require('./chunk-SOR334EB.cjs');
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
|
|
31
|
+
var _chunkBMWDEBXOcjs = require('./chunk-BMWDEBXO.cjs');
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
|
|
@@ -152,8 +153,8 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
155
|
}
|
|
155
|
-
const runtimeConfig =
|
|
156
|
-
|
|
156
|
+
const runtimeConfig = _chunkSOR334EBcjs.normalizeFarmRouteRuntimeConfig.call(void 0,
|
|
157
|
+
_chunkSOR334EBcjs.getFarmRouteRuntimeConfig.call(void 0, routeModule),
|
|
157
158
|
`API route "${routePath}"`
|
|
158
159
|
);
|
|
159
160
|
this.registerRouteShape(routePath, filePath, appDir);
|
|
@@ -206,7 +207,7 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
206
207
|
async loadProgrammaticApiRoutes(appDir) {
|
|
207
208
|
const candidateRoots = [path.dirname(appDir), appDir];
|
|
208
209
|
const routeFiles = Array.from(
|
|
209
|
-
new Set(candidateRoots.flatMap((srcRoot) =>
|
|
210
|
+
new Set(candidateRoots.flatMap((srcRoot) => _chunkN4RLRSWWcjs.findProgrammaticRouteFilesInDir.call(void 0, srcRoot)))
|
|
210
211
|
);
|
|
211
212
|
if (routeFiles.length === 0) return;
|
|
212
213
|
const { getProgrammaticRouteManifest } = await import("./routes.cjs");
|
|
@@ -251,11 +252,11 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
251
252
|
}
|
|
252
253
|
async loadModule(filePath) {
|
|
253
254
|
if (this.viteServer) {
|
|
254
|
-
return await this.viteServer
|
|
255
|
+
return await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, this.viteServer, filePath);
|
|
255
256
|
}
|
|
256
257
|
return await import(
|
|
257
258
|
/* @vite-ignore */
|
|
258
|
-
|
|
259
|
+
_chunkBMWDEBXOcjs.toFileModuleUrl.call(void 0, filePath)
|
|
259
260
|
);
|
|
260
261
|
}
|
|
261
262
|
addEndpoint(routePath, filePath, method, endpoint, appDir, runtimeConfig = {}) {
|
|
@@ -292,7 +293,7 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
292
293
|
}
|
|
293
294
|
addProgrammaticApiRoute(filePath, route, appDir) {
|
|
294
295
|
const modulePath = _chunk6V4TDWECcjs.createProgrammaticRouteModuleId.call(void 0, filePath, "api", route.path);
|
|
295
|
-
const runtimeConfig =
|
|
296
|
+
const runtimeConfig = _chunkSOR334EBcjs.normalizeFarmRouteRuntimeConfig.call(void 0, route, `API route "${route.path}"`);
|
|
296
297
|
for (const [method, endpoint] of Object.entries(route.methods)) {
|
|
297
298
|
if (endpoint) {
|
|
298
299
|
this.addEndpoint(route.path, modulePath, method, endpoint, appDir, runtimeConfig);
|
|
@@ -6,10 +6,10 @@ var _chunk4PPEPOZZcjs = require('./chunk-4PPEPOZZ.cjs');
|
|
|
6
6
|
var _chunkMQ3H6LT5cjs = require('./chunk-MQ3H6LT5.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkB3WK4DTXcjs = require('./chunk-B3WK4DTX.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkN4RLRSWWcjs = require('./chunk-N4RLRSWW.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
var _chunk2CQ74SP6cjs = require('./chunk-2CQ74SP6.cjs');
|
|
@@ -33,6 +33,9 @@ var _chunkEM6SBQKMcjs = require('./chunk-EM6SBQKM.cjs');
|
|
|
33
33
|
var _chunkM2L4MYDQcjs = require('./chunk-M2L4MYDQ.cjs');
|
|
34
34
|
|
|
35
35
|
|
|
36
|
+
var _chunkBMWDEBXOcjs = require('./chunk-BMWDEBXO.cjs');
|
|
37
|
+
|
|
38
|
+
|
|
36
39
|
|
|
37
40
|
var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
|
|
38
41
|
|
|
@@ -102,7 +105,7 @@ function farmApiPlugin(options = {}) {
|
|
|
102
105
|
const existing = apiRoutesCache.get(routePath);
|
|
103
106
|
const existingFile = _optionalChain([endpointSources, 'access', _ => _.get, 'call', _2 => _2(routePath), 'optionalAccess', _3 => _3.get, 'call', _4 => _4(normalizedMethod)]);
|
|
104
107
|
if (existingFile) {
|
|
105
|
-
throw new (0,
|
|
108
|
+
throw new (0, _chunkB3WK4DTXcjs.APIRouteConflictError)(routePath, normalizedMethod, existingFile, filePath);
|
|
106
109
|
}
|
|
107
110
|
if (existing) {
|
|
108
111
|
if (!existing.methods.includes(normalizedMethod)) {
|
|
@@ -249,7 +252,7 @@ function farmApiPlugin(options = {}) {
|
|
|
249
252
|
try {
|
|
250
253
|
const relativePath = path.relative(apiDir, path.dirname(filePath));
|
|
251
254
|
const routePath = "/api/" + (relativePath === "." ? "" : relativePath.replace(/\\/g, "/"));
|
|
252
|
-
const routeModule = await
|
|
255
|
+
const routeModule = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, filePath);
|
|
253
256
|
const endpoints = {};
|
|
254
257
|
const availableMethods = [];
|
|
255
258
|
for (const method of _chunk4PNUXIVUcjs.API_ROUTE_METHODS) {
|
|
@@ -265,7 +268,7 @@ function farmApiPlugin(options = {}) {
|
|
|
265
268
|
log(`API route discovered: ${availableMethods.join(", ")} ${routePath}`);
|
|
266
269
|
}
|
|
267
270
|
} catch (e) {
|
|
268
|
-
if (e instanceof
|
|
271
|
+
if (e instanceof _chunkB3WK4DTXcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
269
272
|
log(`API route load failed at ${filePath}: ${e.message}`);
|
|
270
273
|
}
|
|
271
274
|
}
|
|
@@ -281,7 +284,7 @@ function farmApiPlugin(options = {}) {
|
|
|
281
284
|
for (const routesFile of routesFiles) {
|
|
282
285
|
if (fs.existsSync(routesFile)) {
|
|
283
286
|
try {
|
|
284
|
-
const routesModule = await
|
|
287
|
+
const routesModule = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, routesFile);
|
|
285
288
|
for (const [exportName, exportValue] of Object.entries(routesModule)) {
|
|
286
289
|
const endpoint = exportValue;
|
|
287
290
|
if (endpoint && endpoint.__path) {
|
|
@@ -292,7 +295,7 @@ function farmApiPlugin(options = {}) {
|
|
|
292
295
|
}
|
|
293
296
|
}
|
|
294
297
|
} catch (e) {
|
|
295
|
-
if (e instanceof
|
|
298
|
+
if (e instanceof _chunkB3WK4DTXcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
296
299
|
log(`Root routes.ts load failed: ${e.message}`);
|
|
297
300
|
}
|
|
298
301
|
break;
|
|
@@ -302,12 +305,13 @@ function farmApiPlugin(options = {}) {
|
|
|
302
305
|
const discoverProgrammaticRoutes = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
|
|
303
306
|
const path = await import("path");
|
|
304
307
|
const srcRoot = path.join(server.config.root, srcDir);
|
|
305
|
-
const routeFiles =
|
|
308
|
+
const routeFiles = _chunkN4RLRSWWcjs.findProgrammaticRouteFilesInDir.call(void 0, srcRoot);
|
|
306
309
|
if (routeFiles.length === 0) return;
|
|
307
310
|
const { getProgrammaticRouteManifest } = await import("./routes.cjs");
|
|
308
311
|
for (const routeFile of routeFiles) {
|
|
309
312
|
try {
|
|
310
|
-
const routesModule = await
|
|
313
|
+
const routesModule = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0,
|
|
314
|
+
server,
|
|
311
315
|
_chunk5QIKR7RRcjs.toViteModuleId.call(void 0, routeFile, server.config.root)
|
|
312
316
|
);
|
|
313
317
|
const manifest = getProgrammaticRouteManifest(routesModule);
|
|
@@ -322,7 +326,7 @@ function farmApiPlugin(options = {}) {
|
|
|
322
326
|
}
|
|
323
327
|
}
|
|
324
328
|
} catch (e) {
|
|
325
|
-
if (e instanceof
|
|
329
|
+
if (e instanceof _chunkB3WK4DTXcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
326
330
|
log(`Programmatic routes file load failed at ${routeFile}: ${e.message}`);
|
|
327
331
|
}
|
|
328
332
|
}
|
|
@@ -471,7 +475,7 @@ function farmApiPlugin(options = {}) {
|
|
|
471
475
|
if (await _optionalChain([recoverFailedDiscovery, 'optionalCall', _9 => _9()])) return [];
|
|
472
476
|
const previousState = snapshotRouteState();
|
|
473
477
|
try {
|
|
474
|
-
const routesModule = await
|
|
478
|
+
const routesModule = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, file);
|
|
475
479
|
removeEndpointsFromFile(file);
|
|
476
480
|
for (const [exportName, exportValue] of Object.entries(routesModule)) {
|
|
477
481
|
const endpoint = exportValue;
|
|
@@ -499,7 +503,7 @@ function farmApiPlugin(options = {}) {
|
|
|
499
503
|
log(`API router recreated`);
|
|
500
504
|
} catch (e) {
|
|
501
505
|
restoreRouteState(previousState);
|
|
502
|
-
if (e instanceof
|
|
506
|
+
if (e instanceof _chunkB3WK4DTXcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
503
507
|
log(`Root routes.ts HMR failed: ${e.message}`);
|
|
504
508
|
}
|
|
505
509
|
return [];
|
|
@@ -524,7 +528,7 @@ function farmApiPlugin(options = {}) {
|
|
|
524
528
|
log(`API route file removed: ${routePath}`);
|
|
525
529
|
return [];
|
|
526
530
|
}
|
|
527
|
-
const routeModule = await
|
|
531
|
+
const routeModule = await _chunkBMWDEBXOcjs.loadFarmDevModule.call(void 0, server, file);
|
|
528
532
|
removeEndpointsFromFile(file);
|
|
529
533
|
const availableMethods = [];
|
|
530
534
|
for (const method of _chunk4PNUXIVUcjs.API_ROUTE_METHODS) {
|
|
@@ -537,7 +541,7 @@ function farmApiPlugin(options = {}) {
|
|
|
537
541
|
log(`API router recreated`);
|
|
538
542
|
} catch (e) {
|
|
539
543
|
restoreRouteState(previousState);
|
|
540
|
-
if (e instanceof
|
|
544
|
+
if (e instanceof _chunkB3WK4DTXcjs.APIRouteConflictError || e instanceof _chunkNO3WWW3Ncjs.AmbiguousRouteError) throw e;
|
|
541
545
|
log(`API route HMR failed: ${e.message}`);
|
|
542
546
|
}
|
|
543
547
|
return [];
|