@farm.js/core 0.2.0-beta.0 → 0.2.0-beta.2
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-mcp-handler-IUL6OPC3.cjs → agent-mcp-handler-EXOG55M4.cjs} +5 -5
- package/dist/{agent-mcp-handler-GDY5CPPW.mjs → agent-mcp-handler-VX4NDDHR.mjs} +4 -4
- package/dist/{agent-mcp.d-BdM0pIrD.d.ts → agent-mcp.d-DBaonhLg.d.ts} +1 -1
- package/dist/{agent-mcp.d-CMGqpUbk.d.mts → agent-mcp.d-DhCEzIfu.d.mts} +1 -1
- package/dist/agent-runtime.cjs +2 -2
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/agent-runtime.mjs +1 -1
- package/dist/analyzer-OWIHFO5M.cjs +17 -0
- package/dist/{analyzer-PWHYGER6.mjs → analyzer-T2U345WL.mjs} +2 -2
- package/dist/api/node.d.mts +3 -3
- package/dist/api/node.d.ts +3 -3
- package/dist/api/route-manager.cjs +3 -3
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api/route-manager.mjs +2 -2
- package/dist/api/runtime.d.mts +2 -2
- package/dist/api/runtime.d.ts +2 -2
- package/dist/api.cjs +4 -4
- package/dist/api.d.mts +4 -4
- package/dist/api.d.ts +4 -4
- package/dist/api.mjs +3 -3
- package/dist/{app-manifest.d-COhjPgHn.d.ts → app-manifest.d-nLVFFd7N.d.ts} +1 -1
- package/dist/{app-manifest.d-BeDB2OVm.d.mts → app-manifest.d-uE0JGZKN.d.mts} +1 -1
- package/dist/app-markdown.cjs +6 -4
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/app-markdown.mjs +7 -5
- package/dist/{app.d-b3A4cca5.d.ts → app.d-CwVkAUEU.d.ts} +14 -8
- package/dist/{app.d-AVZXCfcO.d.mts → app.d-DGGcNXV7.d.mts} +14 -8
- package/dist/{chunk-AG27TI6Q.mjs → chunk-23NBOP43.mjs} +3 -0
- package/dist/{chunk-BGEA4K7C.mjs → chunk-26ZTI2ZO.mjs} +4 -4
- package/dist/{chunk-L6ZL35ZJ.mjs → chunk-4A6A6P4T.mjs} +2 -2
- package/dist/{chunk-ZOD6EYWE.mjs → chunk-4Q263EQI.mjs} +2 -2
- package/dist/{chunk-2NOHVIJ3.cjs → chunk-5LJF4KUZ.cjs} +17 -4
- package/dist/{chunk-5AL2GXAU.mjs → chunk-7MMDEIVC.mjs} +1 -1
- package/dist/{chunk-GV5D5EM6.mjs → chunk-ANKMAGFJ.mjs} +1 -1
- package/dist/{chunk-QBXS4TNG.mjs → chunk-BL54BTVJ.mjs} +1 -1
- package/dist/{chunk-YCHIR3X6.mjs → chunk-BW563VZZ.mjs} +34 -2
- package/dist/{chunk-XRYLMTYF.cjs → chunk-CBB7I6HW.cjs} +3 -3
- package/dist/{chunk-KMGHXIDA.cjs → chunk-CHOOBTDD.cjs} +2 -2
- package/dist/{chunk-MRULVIH3.mjs → chunk-COK4IXOO.mjs} +35 -18
- package/dist/{chunk-YU2MNIIY.mjs → chunk-CRF5MOLO.mjs} +17 -4
- package/dist/{chunk-NQ3Y6E2T.mjs → chunk-CV4MOEMO.mjs} +2 -2
- package/dist/{chunk-OLKYHTLN.cjs → chunk-DA432P2F.cjs} +5 -5
- package/dist/{chunk-B3HQTGXS.cjs → chunk-DVAZ53X6.cjs} +6 -1
- package/dist/{chunk-XRSNW4IU.mjs → chunk-E72GG355.mjs} +5 -0
- package/dist/{chunk-CNGGEHXY.cjs → chunk-EA5HVG45.cjs} +2 -2
- package/dist/{chunk-NG2EZ6QS.cjs → chunk-EODGIFI7.cjs} +4 -2
- package/dist/{chunk-Y3DO7BIJ.cjs → chunk-EUZFBHPP.cjs} +3 -0
- package/dist/{chunk-ERV422FO.cjs → chunk-EXPVSFAG.cjs} +16 -13
- package/dist/{chunk-EACD6ND7.cjs → chunk-EZUTDTFM.cjs} +7 -7
- package/dist/{chunk-PTAGDZ7I.mjs → chunk-GTHBWZUK.mjs} +5 -1
- package/dist/{chunk-KCJBIWBM.mjs → chunk-GVORDLLV.mjs} +1 -1
- package/dist/{chunk-XGL42MQ7.mjs → chunk-HIDZM23B.mjs} +1 -1
- package/dist/{chunk-W3ZBLFLU.mjs → chunk-HNB5JHBO.mjs} +6 -3
- package/dist/{chunk-MM4U2NNI.mjs → chunk-HVGINJTO.mjs} +101 -42
- package/dist/{chunk-XJJQAFZX.mjs → chunk-I5KPOXUE.mjs} +1 -1
- package/dist/{chunk-HR5GU4UU.cjs → chunk-ILQSRLKK.cjs} +4 -4
- package/dist/{chunk-TQFIZRON.cjs → chunk-J2EKGR6E.cjs} +1030 -485
- package/dist/{chunk-26WP75W5.cjs → chunk-JDT733EW.cjs} +41 -27
- package/dist/{chunk-W53Z4WDI.cjs → chunk-JH4CDG4G.cjs} +8 -8
- package/dist/{chunk-KQ6TYQU7.cjs → chunk-KDQKTX3Q.cjs} +4 -4
- package/dist/{chunk-PEQJ4UUT.mjs → chunk-LP6DIYGA.mjs} +2 -2
- package/dist/{chunk-M4CNAZMS.mjs → chunk-LQ3FISSD.mjs} +61 -40
- package/dist/{chunk-PQ6DBVJ2.cjs → chunk-M4YXD6MD.cjs} +291 -232
- package/dist/{chunk-CFLRUCN7.cjs → chunk-MWAWMFG3.cjs} +415 -394
- package/dist/{chunk-ECVSRE4Y.mjs → chunk-N2BRIN7I.mjs} +1 -1
- package/dist/{chunk-SUACCCZG.cjs → chunk-N2ZMSSPP.cjs} +11 -11
- package/dist/{chunk-MO4UTDQ6.mjs → chunk-NNNMFSXG.mjs} +1 -1
- package/dist/{chunk-6266WH6X.cjs → chunk-NOSLIDSG.cjs} +1 -1
- package/dist/{chunk-ICOJ2BC6.mjs → chunk-NWF2FTFV.mjs} +24 -10
- package/dist/{chunk-HU4R2PPW.cjs → chunk-NZRAUCUL.cjs} +2 -2
- package/dist/{chunk-VMGQOP7X.cjs → chunk-OLIWLN4I.cjs} +2 -2
- package/dist/{chunk-H47EH24T.mjs → chunk-OQOII62L.mjs} +1 -1
- package/dist/{chunk-BJHXFEAF.mjs → chunk-P2TGLGRR.mjs} +4 -4
- package/dist/{chunk-THGSPDFD.cjs → chunk-PAKB6JHX.cjs} +7 -7
- package/dist/{chunk-WOTAU3BN.mjs → chunk-Q637AXGZ.mjs} +218 -74
- package/dist/{chunk-ZZGQD3LL.mjs → chunk-QO24II6C.mjs} +4 -2
- package/dist/{chunk-SG5RFGV6.cjs → chunk-RBSGFS5X.cjs} +66 -34
- package/dist/{chunk-IJPRCQHW.cjs → chunk-RGMUS3HO.cjs} +10 -10
- package/dist/{chunk-PA3VZNWU.cjs → chunk-RTAWQXME.cjs} +324 -180
- package/dist/{chunk-DMSXZNQR.cjs → chunk-RZI6436F.cjs} +2 -2
- package/dist/{chunk-HZY63K5C.mjs → chunk-S6MGFULY.mjs} +2 -2
- package/dist/{chunk-5GFTMTX3.cjs → chunk-SAUGKNCF.cjs} +2 -2
- package/dist/{chunk-JGUMFTZT.cjs → chunk-SCE7VWPN.cjs} +12 -12
- package/dist/{chunk-BQHIJOZM.cjs → chunk-SIECKBNK.cjs} +6 -2
- package/dist/{chunk-JDO3X7RB.mjs → chunk-SPKZCFPH.mjs} +1 -1
- package/dist/{chunk-LUGQUU4S.mjs → chunk-SSFAPTRD.mjs} +1 -1
- package/dist/{chunk-7LBNWL3L.cjs → chunk-SWPLGPYF.cjs} +7 -7
- package/dist/{chunk-3MY6TNNE.cjs → chunk-TWFJJPE7.cjs} +3 -3
- package/dist/{chunk-WP77JDKI.cjs → chunk-UCJCU2IL.cjs} +14 -14
- package/dist/{chunk-WX752VMN.mjs → chunk-UCRNNDNS.mjs} +1 -1
- package/dist/{chunk-FEWCWBOF.cjs → chunk-UGWKNZ4U.cjs} +44 -27
- package/dist/{chunk-IRPXOTEN.cjs → chunk-UOMSGJHK.cjs} +11 -11
- package/dist/{chunk-WPB6HJC7.mjs → chunk-UWDFH3ZV.mjs} +1 -1
- package/dist/{chunk-MZPPT5NA.mjs → chunk-V5FEFFHV.mjs} +1 -1
- package/dist/{chunk-HR4N2K4V.mjs → chunk-WABOJXAA.mjs} +2 -2
- package/dist/{chunk-LTXKRIST.mjs → chunk-WANLI3ZC.mjs} +2 -2
- package/dist/{chunk-5ZWXTIGE.cjs → chunk-WEZTGM7N.cjs} +2 -2
- package/dist/{chunk-HQEYZSF3.cjs → chunk-WPURVYXT.cjs} +2 -2
- package/dist/{chunk-TE7AX6HB.mjs → chunk-WV63R4GE.mjs} +1 -1
- package/dist/{chunk-SCOKBXHS.mjs → chunk-XOLYZZDX.mjs} +696 -151
- package/dist/{chunk-4ZVKDHS6.cjs → chunk-YSRZSKQB.cjs} +4 -4
- package/dist/{cli-runtime.d-jqZ7YCsm.d.ts → cli-runtime.d-Dbl-gIoz.d.ts} +5 -5
- package/dist/{cli-runtime.d-qL44rqYO.d.mts → cli-runtime.d-oUiNuspW.d.mts} +5 -5
- package/dist/{client-component.d-BDD5aiUb.d.ts → client-component.d-CT4q7tmy.d.ts} +1 -1
- package/dist/{client-component.d-B2L2LyAr.d.mts → client-component.d-DaUqOhZT.d.mts} +1 -1
- package/dist/{client-plugins.d-Crct3m_r.d.ts → client-plugins.d-24qhjX8c.d.ts} +30 -4
- package/dist/{client-plugins.d-Dzc3vOw_.d.mts → client-plugins.d-BfGTqbAH.d.mts} +30 -4
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.cjs +4 -4
- package/dist/client.d.mts +7 -7
- package/dist/client.d.ts +7 -7
- package/dist/client.mjs +3 -3
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/desktop.d.mts +2 -2
- package/dist/desktop.d.ts +2 -2
- package/dist/{devtools-RL4AU5KD.cjs → devtools-5WDQQDTA.cjs} +6 -6
- package/dist/{devtools-2CRVXV7E.mjs → devtools-DPYIYHTI.mjs} +5 -5
- package/dist/docs.cjs +8 -8
- package/dist/docs.d.mts +3 -3
- package/dist/docs.d.ts +3 -3
- package/dist/docs.mjs +7 -7
- package/dist/environment/vite.cjs +3 -3
- package/dist/environment/vite.mjs +2 -2
- package/dist/{handler.d-B1S1ZBqS.d.mts → handler.d-GfNuz57p.d.mts} +1 -1
- package/dist/{handler.d-ZweCBJD4.d.ts → handler.d-Oca5kNSz.d.ts} +1 -1
- package/dist/{headers.d-C-yGl_f6.d.mts → headers.d-C_lsQIWA.d.mts} +1 -1
- package/dist/{headers.d-BgBdQN8x.d.ts → headers.d-b8gHJDvu.d.ts} +1 -1
- package/dist/index.cjs +42 -38
- package/dist/{index.d-13h3oDu7.d.mts → index.d-BLtjh1aS.d.mts} +1 -1
- package/dist/{index.d-CtoniAXT.d.ts → index.d-Ckv6kHFm.d.ts} +1 -1
- package/dist/index.d.mts +23 -23
- package/dist/index.d.ts +23 -23
- package/dist/index.mjs +39 -35
- package/dist/integrations/orm.d.mts +1 -1
- package/dist/integrations/orm.d.ts +1 -1
- package/dist/integrations.cjs +4 -2
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/integrations.mjs +3 -1
- package/dist/internal/app-markdown-runtime.cjs +5 -3
- package/dist/internal/app-markdown-runtime.d.mts +10 -5
- package/dist/internal/app-markdown-runtime.d.ts +10 -5
- package/dist/internal/app-markdown-runtime.mjs +6 -4
- package/dist/internal/build-runtime.cjs +29 -29
- package/dist/internal/build-runtime.d.mts +4 -4
- package/dist/internal/build-runtime.d.ts +4 -4
- package/dist/internal/build-runtime.mjs +28 -28
- package/dist/internal/cli-runtime.cjs +12 -12
- package/dist/internal/cli-runtime.d.mts +7 -7
- package/dist/internal/cli-runtime.d.ts +7 -7
- 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/client-runtime.d.mts +5 -5
- package/dist/internal/client-runtime.d.ts +5 -5
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +7 -7
- package/dist/internal/config-runtime.d.mts +3 -3
- package/dist/internal/config-runtime.d.ts +3 -3
- package/dist/internal/config-runtime.mjs +6 -6
- package/dist/internal/infra-analytics-runtime.cjs +9 -9
- package/dist/internal/infra-analytics-runtime.mjs +7 -7
- package/dist/internal/metadata-image-runtime.d.mts +2 -2
- package/dist/internal/metadata-image-runtime.d.ts +2 -2
- package/dist/internal/native-server-fns.cjs +4 -4
- package/dist/internal/native-server-fns.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-node-env.cjs +2 -2
- package/dist/internal/production-node-env.mjs +1 -1
- package/dist/internal/production-runtime.cjs +12 -12
- package/dist/internal/production-runtime.d.mts +10 -10
- package/dist/internal/production-runtime.d.ts +10 -10
- package/dist/internal/production-runtime.mjs +11 -11
- package/dist/internal/spa-router.cjs +3 -3
- package/dist/internal/spa-router.d.mts +3 -3
- package/dist/internal/spa-router.d.ts +3 -3
- package/dist/internal/spa-router.mjs +2 -2
- package/dist/internal/start-manifest.d.mts +1 -1
- package/dist/internal/start-manifest.d.ts +1 -1
- package/dist/{manager-D4DZRBRS.cjs → manager-37UJPUN4.cjs} +4 -4
- package/dist/{manager-PKPQGBAE.mjs → manager-7BNSJKME.mjs} +3 -3
- package/dist/markdown.cjs +2 -2
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/middleware.d.mts +1 -1
- package/dist/middleware.d.ts +1 -1
- package/dist/{mount.d-_6Un9wdK.d.mts → mount.d-BCS8mD4E.d.mts} +1 -1
- package/dist/{mount.d-DyKlRR6z.d.ts → mount.d-DEX8eref.d.ts} +1 -1
- package/dist/{native-tree-5TENEQ7Y.cjs → native-tree-52CUAP3N.cjs} +3 -3
- package/dist/{native-tree-LNO7K6JR.mjs → native-tree-AO7PQ7FR.mjs} +2 -2
- package/dist/{navigation-delegate.d-BbW1_pf_.d.ts → navigation-delegate.d-Cgi28e5Q.d.ts} +1 -1
- package/dist/{navigation-delegate.d-B9GjWbov.d.mts → navigation-delegate.d-F83ugsZW.d.mts} +1 -1
- package/dist/navigation.cjs +5 -5
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.mjs +4 -4
- package/dist/plugin.cjs +22 -22
- package/dist/plugin.d.mts +5 -5
- package/dist/plugin.d.ts +5 -5
- package/dist/plugin.mjs +21 -21
- package/dist/query/client.cjs +7 -7
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan.d-DaM1NPnm.d.mts → render-plan.d-BkVY4aFb.d.mts} +1 -1
- package/dist/{render-plan.d-D0FV9lDT.d.ts → render-plan.d-DCF2GZdD.d.ts} +1 -1
- package/dist/renderer-client.cjs +5 -5
- package/dist/renderer-client.d.mts +5 -5
- package/dist/renderer-client.d.ts +5 -5
- package/dist/renderer-client.mjs +2 -2
- package/dist/renderer.d.mts +22 -11
- package/dist/renderer.d.ts +22 -11
- package/dist/{request.d-CrXC7voZ.d.ts → request.d-C5o-4dU2.d.ts} +1 -1
- package/dist/{request.d-DVSLilGx.d.mts → request.d-DMPB53-i.d.mts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{route-rendering.d-CWi3UYtR.d.mts → route-rendering.d-DDvArvik.d.mts} +1 -1
- package/dist/{route-rendering.d-OfbM_rj8.d.ts → route-rendering.d-DfP6zRP7.d.ts} +1 -1
- package/dist/{router.d-YKVirmj4.d.mts → router.d-1Skf2XCO.d.mts} +1 -1
- package/dist/{router.d-Bm9FNSu3.d.ts → router.d-s40h7aoS.d.ts} +1 -1
- package/dist/routes.d.mts +3 -3
- package/dist/routes.d.ts +3 -3
- package/dist/{rsc-pipeline-LRB4ZG6I.mjs → rsc-pipeline-O2YMVHUF.mjs} +7 -7
- package/dist/{rsc-pipeline-3DYC5ZXW.cjs → rsc-pipeline-SFQSMVI7.cjs} +8 -8
- package/dist/{runtime-3WJNNAAR.mjs → runtime-K2X3IZAF.mjs} +6 -6
- package/dist/{runtime-CRFF32H6.cjs → runtime-WOTVFYQY.cjs} +8 -8
- package/dist/{runtime.d-BVj6apd0.d.mts → runtime.d-Bykc5Qfg.d.mts} +1 -1
- package/dist/{runtime.d-D7QYVJGO.d.ts → runtime.d-k-9kFUsM.d.ts} +1 -1
- package/dist/{server-components-status.d-BDVcxi0z.d.mts → server-components-status.d-D-HixBe0.d.mts} +1 -1
- package/dist/{server-components-status.d-CfKDpmCH.d.ts → server-components-status.d-DLNd1C5j.d.ts} +1 -1
- package/dist/server-plugins.d.mts +3 -3
- package/dist/server-plugins.d.ts +3 -3
- package/dist/server.cjs +47 -46
- package/dist/server.d.mts +11 -11
- package/dist/server.d.ts +11 -11
- package/dist/server.mjs +26 -25
- package/dist/{spa-router.d-DGmropfK.d.mts → spa-router.d-DIlXwm00.d.mts} +2 -2
- package/dist/{spa-router.d-nE1jHNGt.d.ts → spa-router.d-Dl-EJeJT.d.ts} +2 -2
- package/dist/{ssg.d-DS-gXUbf.d.mts → ssg.d-D2ZV0bhs.d.mts} +2 -2
- package/dist/{ssg.d-jXlUAKzg.d.ts → ssg.d-bE-ylg0e.d.ts} +2 -2
- package/dist/{store-core.d-B5cwOd8g.d.ts → store-core.d-BmdnMopD.d.ts} +2 -2
- package/dist/{store-core.d-C-gATBwd.d.mts → store-core.d-DPsCYzV7.d.mts} +2 -2
- package/dist/testing.cjs +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.mjs +2 -2
- package/dist/{utils.d-BODwBtkz.d.ts → utils.d-BFZQcBZV.d.ts} +1 -1
- package/dist/{utils.d-Cmj-fzds.d.mts → utils.d-nM3OHKq5.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +22 -22
- package/dist/vite.d.mts +6 -6
- package/dist/vite.d.ts +6 -6
- package/dist/vite.mjs +21 -21
- package/package.json +1 -1
- package/dist/analyzer-B2TRJT3B.cjs +0 -17
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from "./chunk-U6GMCDRS.mjs";
|
|
29
29
|
import {
|
|
30
30
|
FARM_VERSION
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-I5KPOXUE.mjs";
|
|
32
32
|
|
|
33
33
|
// src/environment-vite.ts
|
|
34
34
|
import { existsSync, readFileSync, realpathSync } from "fs";
|
|
@@ -158,9 +158,16 @@ var snapshot;
|
|
|
158
158
|
var base;
|
|
159
159
|
var volatile;
|
|
160
160
|
var trace;
|
|
161
|
+
var traceGroups;
|
|
161
162
|
function farmSourceSnapshotPathKey(file, paths = path2) {
|
|
163
|
+
if (paths === path2 && path2.sep === "/" && isNormalizedPosixPath(file)) return file;
|
|
162
164
|
return paths.resolve(file);
|
|
163
165
|
}
|
|
166
|
+
function isNormalizedPosixPath(file) {
|
|
167
|
+
if (file.charCodeAt(0) !== 47) return false;
|
|
168
|
+
if (file.length === 1) return true;
|
|
169
|
+
return !file.endsWith("/") && !file.endsWith("/.") && !file.endsWith("/..") && !file.includes("//") && !file.includes("/./") && !file.includes("/../");
|
|
170
|
+
}
|
|
164
171
|
function getFarmSourceStamp(file) {
|
|
165
172
|
try {
|
|
166
173
|
const stat = fs.statSync(file);
|
|
@@ -268,15 +275,34 @@ function memoizeInFarmSourceSnapshot(scope, key, compute, lasting) {
|
|
|
268
275
|
function noteFarmSourceRead(file) {
|
|
269
276
|
trace?.add(file);
|
|
270
277
|
}
|
|
278
|
+
function noteFarmSourceReads(files) {
|
|
279
|
+
if (traceGroups) traceGroups.add(files);
|
|
280
|
+
else if (trace) for (const file of files) trace.add(file);
|
|
281
|
+
}
|
|
271
282
|
function traceFarmSourceReads(operation) {
|
|
283
|
+
const { result, files } = traceReads(operation, false);
|
|
284
|
+
return { result, files: [...files] };
|
|
285
|
+
}
|
|
286
|
+
function traceFarmSourceReadGroups(operation) {
|
|
287
|
+
const { result, files, groups } = traceReads(operation, true);
|
|
288
|
+
return { result, files: [...files], groups: [...groups] };
|
|
289
|
+
}
|
|
290
|
+
function traceReads(operation, grouped) {
|
|
272
291
|
const outer = trace;
|
|
292
|
+
const outerGroups = traceGroups;
|
|
273
293
|
const files = /* @__PURE__ */ new Set();
|
|
294
|
+
const groups = grouped ? /* @__PURE__ */ new Set() : void 0;
|
|
274
295
|
trace = files;
|
|
296
|
+
traceGroups = groups;
|
|
275
297
|
try {
|
|
276
|
-
return { result: operation(), files
|
|
298
|
+
return { result: operation(), files, groups };
|
|
277
299
|
} finally {
|
|
278
300
|
trace = outer;
|
|
279
|
-
|
|
301
|
+
traceGroups = outerGroups;
|
|
302
|
+
if (outer) {
|
|
303
|
+
for (const file of files) outer.add(file);
|
|
304
|
+
if (groups) for (const group of groups) noteFarmSourceReads(group);
|
|
305
|
+
}
|
|
280
306
|
}
|
|
281
307
|
}
|
|
282
308
|
|
|
@@ -304,11 +330,19 @@ function packageNameOf(specifier) {
|
|
|
304
330
|
return { name, subpath: parts.slice(name.startsWith("@") ? 2 : 1).join("/") };
|
|
305
331
|
}
|
|
306
332
|
function findPackageDirectory(importer, name) {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
333
|
+
const start = path3.dirname(importer);
|
|
334
|
+
return memoizeInFarmSourceSnapshot(
|
|
335
|
+
"package-directory",
|
|
336
|
+
`${farmSourceSnapshotPathKey(start)}\0${name}`,
|
|
337
|
+
() => {
|
|
338
|
+
for (let current = start; ; current = path3.dirname(current)) {
|
|
339
|
+
const directory = path3.join(current, "node_modules", name);
|
|
340
|
+
if (fs2.existsSync(path3.join(directory, "package.json"))) return fs2.realpathSync(directory);
|
|
341
|
+
if (path3.dirname(current) === current) return null;
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
(directory) => directory !== null
|
|
345
|
+
);
|
|
312
346
|
}
|
|
313
347
|
function pickTarget(value, conditions) {
|
|
314
348
|
if (typeof value === "string") return value;
|
|
@@ -505,7 +539,11 @@ function traceExport(file, name, depth) {
|
|
|
505
539
|
return void 0;
|
|
506
540
|
}
|
|
507
541
|
function traceFarmExport(file, name) {
|
|
508
|
-
return
|
|
542
|
+
return memoizeInFarmSourceSnapshot(
|
|
543
|
+
"export-kind",
|
|
544
|
+
`${farmSourceSnapshotPathKey(file)}\0${name}`,
|
|
545
|
+
() => traceExport(file, name, 0)?.kind
|
|
546
|
+
);
|
|
509
547
|
}
|
|
510
548
|
function isFarmClientExport(file, name) {
|
|
511
549
|
return traceFarmExport(file, name) === "client";
|
|
@@ -785,9 +823,21 @@ function readModuleImports(file) {
|
|
|
785
823
|
return imports;
|
|
786
824
|
}
|
|
787
825
|
var clientOnlyFreeFiles = /* @__PURE__ */ new Set();
|
|
788
|
-
function invalidateFarmClientOnlyScan() {
|
|
826
|
+
function invalidateFarmClientOnlyScan(file, event) {
|
|
827
|
+
if (file && event === "update" && path3.basename(file) !== "package.json" && !isClientOnlyScanned(file)) {
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
789
830
|
clientOnlyFreeFiles.clear();
|
|
790
831
|
}
|
|
832
|
+
function isClientOnlyScanned(file) {
|
|
833
|
+
const resolved = path3.resolve(file);
|
|
834
|
+
if (clientOnlyFreeFiles.has(resolved)) return true;
|
|
835
|
+
try {
|
|
836
|
+
return clientOnlyFreeFiles.has(fs2.realpathSync(resolved));
|
|
837
|
+
} catch {
|
|
838
|
+
return true;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
791
841
|
function resolveServerEntry(importer, specifier) {
|
|
792
842
|
const parsed = packageNameOf(specifier);
|
|
793
843
|
if (!parsed || REACT_PACKAGES.has(parsed.name) || parsed.name.startsWith("@farm.js/")) {
|
|
@@ -1769,16 +1819,23 @@ function specifierPackage(specifier) {
|
|
|
1769
1819
|
return specifier.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0];
|
|
1770
1820
|
}
|
|
1771
1821
|
function packageLookup(directory, packageName) {
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1822
|
+
return memoizeInFarmSourceSnapshot(
|
|
1823
|
+
"package-lookup",
|
|
1824
|
+
`${farmSourceSnapshotPathKey(directory)}\0${packageName}`,
|
|
1825
|
+
() => {
|
|
1826
|
+
for (let current = directory; ; current = path4.dirname(current)) {
|
|
1827
|
+
if (path4.basename(current) !== "node_modules") {
|
|
1828
|
+
const candidate = path4.join(current, "node_modules", packageName);
|
|
1829
|
+
try {
|
|
1830
|
+
return { from: current, real: fs3.realpathSync(candidate) };
|
|
1831
|
+
} catch {
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
if (path4.dirname(current) === current) return null;
|
|
1778
1835
|
}
|
|
1779
|
-
}
|
|
1780
|
-
|
|
1781
|
-
|
|
1836
|
+
},
|
|
1837
|
+
(result) => result !== null
|
|
1838
|
+
);
|
|
1782
1839
|
}
|
|
1783
1840
|
function referenceResolveFrom(root, specifier, importer) {
|
|
1784
1841
|
const packageName = specifierPackage(specifier);
|
|
@@ -1811,15 +1868,12 @@ function ensureFarmPackageClientReference(root, specifier, exportName, importer)
|
|
|
1811
1868
|
`export { __farm_reference__ as ${exportName} };`,
|
|
1812
1869
|
""
|
|
1813
1870
|
].join("\n");
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
fs3.mkdirSync(path4.dirname(file), { recursive: true });
|
|
1821
|
-
fs3.writeFileSync(file, source);
|
|
1822
|
-
}
|
|
1871
|
+
memoizeInFarmSourceSnapshot(
|
|
1872
|
+
"client-reference-file",
|
|
1873
|
+
`${file}\0${source}`,
|
|
1874
|
+
() => writeIfChanged(file, source),
|
|
1875
|
+
() => false
|
|
1876
|
+
);
|
|
1823
1877
|
return file;
|
|
1824
1878
|
}
|
|
1825
1879
|
function writeIfChanged(file, source) {
|
|
@@ -2147,6 +2201,7 @@ var PackageClientBoundaryCache = class {
|
|
|
2147
2201
|
else this.dirty = true;
|
|
2148
2202
|
}
|
|
2149
2203
|
}
|
|
2204
|
+
if (visited.size === 0) return entries?.find((entry) => entry.stops.length === 0);
|
|
2150
2205
|
return entries?.find(
|
|
2151
2206
|
(entry) => entry.stops.every((file) => visited.has(file)) && !entry.files.some((file) => visited.has(file))
|
|
2152
2207
|
);
|
|
@@ -2307,6 +2362,11 @@ async function withPackageClientBoundaryCache(operation) {
|
|
|
2307
2362
|
await cache2.persist();
|
|
2308
2363
|
}
|
|
2309
2364
|
}
|
|
2365
|
+
function bindPackageClientBoundaryCache() {
|
|
2366
|
+
const cache2 = getPackageClientBoundaryCache();
|
|
2367
|
+
if (!cache2) return (operation) => operation();
|
|
2368
|
+
return (operation) => getPackageClientBoundaryCache() ? operation() : getStorage().run(cache2, operation);
|
|
2369
|
+
}
|
|
2310
2370
|
function usePackageClientBoundaryCacheFile(file) {
|
|
2311
2371
|
getPackageClientBoundaryCache()?.load(file);
|
|
2312
2372
|
}
|
|
@@ -2881,6 +2941,14 @@ function isAsyncLocalDeclaration(tokens, name) {
|
|
|
2881
2941
|
}
|
|
2882
2942
|
return false;
|
|
2883
2943
|
}
|
|
2944
|
+
function parseImportedModuleMetadata(content) {
|
|
2945
|
+
if (!content) return parseClientModuleMetadata(content, false);
|
|
2946
|
+
return memoizeInFarmSourceSnapshot(
|
|
2947
|
+
"imported-module-metadata",
|
|
2948
|
+
content,
|
|
2949
|
+
() => parseClientModuleMetadata(content, false)
|
|
2950
|
+
);
|
|
2951
|
+
}
|
|
2884
2952
|
function parseClientModuleMetadata(content, inspectIslandExport, sourcePath) {
|
|
2885
2953
|
if (!content) {
|
|
2886
2954
|
return {
|
|
@@ -2943,7 +3011,7 @@ function getFarmClientRenderingBindings(code, file, root) {
|
|
|
2943
3011
|
for (const [specifier, locals] of getStaticImportBindings(code)) {
|
|
2944
3012
|
const imported = resolveImportedModule(file, specifier, root);
|
|
2945
3013
|
if (!imported.path) continue;
|
|
2946
|
-
const metadata = imported.local ? inspectClientModuleMetadata(imported.path, root, /* @__PURE__ */ new Set([path8.resolve(file)]), false) : inspectPackageClientBoundary(imported.path, root
|
|
3014
|
+
const metadata = imported.local ? inspectClientModuleMetadata(imported.path, root, /* @__PURE__ */ new Set([path8.resolve(file)]), false) : inspectPackageClientBoundary(imported.path, root);
|
|
2947
3015
|
if (metadata.isClientComponent || metadata.shouldHydrate) bindings.push(...locals);
|
|
2948
3016
|
}
|
|
2949
3017
|
return bindings;
|
|
@@ -3266,9 +3334,17 @@ function exportListNames(content) {
|
|
|
3266
3334
|
}
|
|
3267
3335
|
return names;
|
|
3268
3336
|
}
|
|
3337
|
+
var NO_IMPORT_BINDINGS = /* @__PURE__ */ new Map();
|
|
3269
3338
|
function getStaticImportBindings(content) {
|
|
3339
|
+
if (!content) return NO_IMPORT_BINDINGS;
|
|
3340
|
+
return memoizeInFarmSourceSnapshot(
|
|
3341
|
+
"import-bindings",
|
|
3342
|
+
content,
|
|
3343
|
+
() => scanStaticImportBindings(content)
|
|
3344
|
+
);
|
|
3345
|
+
}
|
|
3346
|
+
function scanStaticImportBindings(content) {
|
|
3270
3347
|
const bindings = /* @__PURE__ */ new Map();
|
|
3271
|
-
if (!content) return bindings;
|
|
3272
3348
|
const tokens = tokenizeModuleSource(content);
|
|
3273
3349
|
for (let index = 0; index < tokens.length; index++) {
|
|
3274
3350
|
if (tokens[index].value !== "import" || tokens[index - 1]?.value === ".") continue;
|
|
@@ -3575,7 +3651,7 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
3575
3651
|
if (visiting.has(moduleSourcePath)) return 0;
|
|
3576
3652
|
visiting.add(moduleSourcePath);
|
|
3577
3653
|
const content = readModuleCode(moduleSourcePath);
|
|
3578
|
-
const parsed =
|
|
3654
|
+
const parsed = parseImportedModuleMetadata(content);
|
|
3579
3655
|
if (parsed.isClientComponent) {
|
|
3580
3656
|
if (!isIsolatableClientBoundarySource(content)) {
|
|
3581
3657
|
fallbackReason = `client boundary ${moduleSourcePath} uses an unsupported export shape`;
|
|
@@ -3637,7 +3713,7 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
3637
3713
|
if (reference) importedBoundaryCount += visit(reference);
|
|
3638
3714
|
}
|
|
3639
3715
|
} else {
|
|
3640
|
-
const packageMetadata = inspectPackageClientBoundary(importedPath, root
|
|
3716
|
+
const packageMetadata = inspectPackageClientBoundary(importedPath, root);
|
|
3641
3717
|
if (!packageMetadata.shouldHydrate) continue;
|
|
3642
3718
|
const references = options.packageReferences && projectRoot ? findFarmPackageClientImports(
|
|
3643
3719
|
content ?? "",
|
|
@@ -3762,37 +3838,59 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
|
|
|
3762
3838
|
function farmWorkspaceServerEntry(entry) {
|
|
3763
3839
|
const real = realpathOrSelf(entry);
|
|
3764
3840
|
if (real.split(path8.sep).includes("node_modules")) return null;
|
|
3765
|
-
if (
|
|
3841
|
+
if (parseImportedModuleMetadata(readIfExists(real)).isClientComponent) return null;
|
|
3766
3842
|
return real;
|
|
3767
3843
|
}
|
|
3768
3844
|
function realpathOrSelf(file) {
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3845
|
+
const real = memoizeInFarmSourceSnapshot(
|
|
3846
|
+
"realpath",
|
|
3847
|
+
farmSourceSnapshotPathKey(file),
|
|
3848
|
+
() => {
|
|
3849
|
+
try {
|
|
3850
|
+
return fs7.realpathSync(file);
|
|
3851
|
+
} catch {
|
|
3852
|
+
return null;
|
|
3853
|
+
}
|
|
3854
|
+
},
|
|
3855
|
+
(resolved) => resolved !== null
|
|
3856
|
+
);
|
|
3857
|
+
return real ?? file;
|
|
3858
|
+
}
|
|
3859
|
+
var NODE_MODULES_SEGMENT2 = `${path8.sep}node_modules${path8.sep}`;
|
|
3860
|
+
function getInstalledPackageDirectory(file, start) {
|
|
3861
|
+
let end = file.indexOf(path8.sep, start);
|
|
3862
|
+
if (end !== -1 && file[start] === "@") end = file.indexOf(path8.sep, end + 1);
|
|
3863
|
+
return end === -1 ? file : file.slice(0, end);
|
|
3864
|
+
}
|
|
3865
|
+
function installedRealPath(file) {
|
|
3866
|
+
const segment = file.lastIndexOf(NODE_MODULES_SEGMENT2);
|
|
3867
|
+
if (segment === -1) return file;
|
|
3868
|
+
const directory = getInstalledPackageDirectory(file, segment + NODE_MODULES_SEGMENT2.length);
|
|
3869
|
+
const real = realpathOrSelf(directory);
|
|
3870
|
+
if (real === directory || !real.includes(NODE_MODULES_SEGMENT2)) return file;
|
|
3871
|
+
return real + file.slice(directory.length);
|
|
3872
|
+
}
|
|
3873
|
+
var NO_VISITED_FILES = /* @__PURE__ */ new Set();
|
|
3775
3874
|
function getBarePackageReexports(content) {
|
|
3776
3875
|
return getImportSpecifiers(content, { reexportsOnly: true }).filter(
|
|
3777
3876
|
(specifier) => bareSpecifierPackage(specifier)
|
|
3778
3877
|
);
|
|
3779
3878
|
}
|
|
3780
|
-
function inspectPackageClientBoundary(
|
|
3879
|
+
function inspectPackageClientBoundary(importedPath, root, visited) {
|
|
3880
|
+
const resolvedPath = importedPath && installedRealPath(importedPath);
|
|
3781
3881
|
const cache2 = getPackageClientBoundaryCache();
|
|
3782
|
-
if (!cache2 || !resolvedPath || visited
|
|
3783
|
-
return traversePackageClientBoundary(resolvedPath, root, visited);
|
|
3882
|
+
if (!cache2 || !resolvedPath || visited?.has(resolvedPath)) {
|
|
3883
|
+
return traversePackageClientBoundary(resolvedPath, root, visited ?? /* @__PURE__ */ new Set());
|
|
3784
3884
|
}
|
|
3785
3885
|
const key = `${root ?? ""}\0${resolvedPath}`;
|
|
3786
|
-
const cached = cache2.find(key, visited);
|
|
3886
|
+
const cached = cache2.find(key, visited ?? NO_VISITED_FILES);
|
|
3787
3887
|
if (cached) {
|
|
3788
|
-
for (const file of cached.files)
|
|
3789
|
-
|
|
3790
|
-
noteFarmSourceRead(file);
|
|
3791
|
-
}
|
|
3888
|
+
if (visited) for (const file of cached.files) visited.add(file);
|
|
3889
|
+
noteFarmSourceReads(cached.files);
|
|
3792
3890
|
return { ...cached.result };
|
|
3793
3891
|
}
|
|
3794
3892
|
const trace2 = new PackageInspectionTrace();
|
|
3795
|
-
const result = traversePackageClientBoundary(resolvedPath, root, visited, trace2);
|
|
3893
|
+
const result = traversePackageClientBoundary(resolvedPath, root, visited ?? /* @__PURE__ */ new Set(), trace2);
|
|
3796
3894
|
cache2.add(key, trace2.toEntry(result));
|
|
3797
3895
|
return result;
|
|
3798
3896
|
}
|
|
@@ -3808,7 +3906,7 @@ function traversePackageClientBoundary(resolvedPath, root, visited, trace2) {
|
|
|
3808
3906
|
visited.add(resolvedPath);
|
|
3809
3907
|
trace2?.visit(resolvedPath);
|
|
3810
3908
|
const content = readIfExists(resolvedPath);
|
|
3811
|
-
const parsed =
|
|
3909
|
+
const parsed = parseImportedModuleMetadata(content);
|
|
3812
3910
|
let importsClientBoundary = false;
|
|
3813
3911
|
let importedIslandStrategy = null;
|
|
3814
3912
|
const reexports = getBarePackageReexports(content);
|
|
@@ -3909,9 +4007,12 @@ function scanImportSpecifiers(content, { reexportsOnly = false, dynamic = false
|
|
|
3909
4007
|
}
|
|
3910
4008
|
function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
|
|
3911
4009
|
if (tokens[startIndex]?.value !== "{") return false;
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
4010
|
+
let closingBraceIndex = -1;
|
|
4011
|
+
for (let index = startIndex + 1; index < endIndex; index++) {
|
|
4012
|
+
if (tokens[index].value !== "}") continue;
|
|
4013
|
+
closingBraceIndex = index;
|
|
4014
|
+
break;
|
|
4015
|
+
}
|
|
3915
4016
|
if (closingBraceIndex === -1) return false;
|
|
3916
4017
|
let entryStartsAt = startIndex + 1;
|
|
3917
4018
|
for (let index = entryStartsAt; index <= closingBraceIndex; index++) {
|
|
@@ -3986,19 +4087,22 @@ function matchProjectImportAlias(alias, specifier) {
|
|
|
3986
4087
|
return specifier.slice(alias.prefix.length, specifier.length - alias.suffix.length);
|
|
3987
4088
|
}
|
|
3988
4089
|
function getProjectImportAliases(projectRoot) {
|
|
3989
|
-
const stamp = PROJECT_ALIAS_FILES.map((file) => {
|
|
3990
|
-
try {
|
|
3991
|
-
return String(fs7.statSync(path8.join(projectRoot, file)).mtimeMs);
|
|
3992
|
-
} catch {
|
|
3993
|
-
return "-";
|
|
3994
|
-
}
|
|
3995
|
-
}).join(":");
|
|
3996
4090
|
const sourceDir = getFarmProjectSourceDir(projectRoot);
|
|
3997
|
-
const cacheStamp = `${stamp}:${sourceDir}`;
|
|
3998
4091
|
const cached = projectImportAliasCache.get(projectRoot);
|
|
3999
|
-
|
|
4092
|
+
const dependencies = new Set(
|
|
4093
|
+
cached?.stamps.keys() ?? PROJECT_ALIAS_FILES.map((file) => path8.join(projectRoot, file))
|
|
4094
|
+
);
|
|
4095
|
+
const stamps = /* @__PURE__ */ new Map();
|
|
4096
|
+
for (const file of dependencies) {
|
|
4097
|
+
noteFarmSourceRead(file);
|
|
4098
|
+
stamps.set(file, getFarmSourceStamp(file));
|
|
4099
|
+
}
|
|
4100
|
+
if (cached?.sourceDir === sourceDir && [...stamps].every(([file, stamp]) => cached.stamps.get(file) === stamp))
|
|
4101
|
+
return cached.aliases;
|
|
4102
|
+
dependencies.clear();
|
|
4103
|
+
for (const file of PROJECT_ALIAS_FILES) dependencies.add(path8.join(projectRoot, file));
|
|
4000
4104
|
const aliases = [
|
|
4001
|
-
...readTsconfigPathAliases(projectRoot),
|
|
4105
|
+
...readTsconfigPathAliases(projectRoot, dependencies),
|
|
4002
4106
|
...readPackageImportAliases(projectRoot)
|
|
4003
4107
|
];
|
|
4004
4108
|
if (!aliases.some((alias) => alias.prefix === "@/")) {
|
|
@@ -4009,14 +4113,19 @@ function getProjectImportAliases(projectRoot) {
|
|
|
4009
4113
|
targets: [path8.join(projectRoot, sourceDir, "*")]
|
|
4010
4114
|
});
|
|
4011
4115
|
}
|
|
4012
|
-
|
|
4116
|
+
stamps.clear();
|
|
4117
|
+
for (const file of dependencies) {
|
|
4118
|
+
noteFarmSourceRead(file);
|
|
4119
|
+
stamps.set(file, getFarmSourceStamp(file));
|
|
4120
|
+
}
|
|
4121
|
+
projectImportAliasCache.set(projectRoot, { sourceDir, stamps, aliases });
|
|
4013
4122
|
return aliases;
|
|
4014
4123
|
}
|
|
4015
|
-
function readTsconfigPathAliases(projectRoot) {
|
|
4124
|
+
function readTsconfigPathAliases(projectRoot, dependencies) {
|
|
4016
4125
|
for (const name of ["tsconfig.json", "jsconfig.json"]) {
|
|
4017
4126
|
const configPath = path8.join(projectRoot, name);
|
|
4018
4127
|
if (!fs7.existsSync(configPath)) continue;
|
|
4019
|
-
const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
|
|
4128
|
+
const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set(), dependencies);
|
|
4020
4129
|
if (!resolved?.paths) return [];
|
|
4021
4130
|
const base2 = resolved.baseUrl ?? resolved.pathsDirectory;
|
|
4022
4131
|
return Object.entries(resolved.paths).flatMap(([pattern, targets]) => {
|
|
@@ -4034,9 +4143,10 @@ function readTsconfigPathAliases(projectRoot) {
|
|
|
4034
4143
|
}
|
|
4035
4144
|
return [];
|
|
4036
4145
|
}
|
|
4037
|
-
function readTsconfigPaths(configPath, visited) {
|
|
4146
|
+
function readTsconfigPaths(configPath, visited, dependencies) {
|
|
4038
4147
|
if (visited.has(configPath)) return null;
|
|
4039
4148
|
visited.add(configPath);
|
|
4149
|
+
dependencies.add(configPath);
|
|
4040
4150
|
const config = readJsonWithComments(configPath);
|
|
4041
4151
|
if (!config) return null;
|
|
4042
4152
|
const directory = path8.dirname(configPath);
|
|
@@ -4049,7 +4159,7 @@ function readTsconfigPaths(configPath, visited) {
|
|
|
4049
4159
|
directory,
|
|
4050
4160
|
parent.endsWith(".json") ? parent : `${parent}.json`
|
|
4051
4161
|
);
|
|
4052
|
-
inherited = readTsconfigPaths(parentPath, visited) ?? inherited;
|
|
4162
|
+
inherited = readTsconfigPaths(parentPath, visited, dependencies) ?? inherited;
|
|
4053
4163
|
}
|
|
4054
4164
|
const options = config.compilerOptions ?? {};
|
|
4055
4165
|
const baseUrl = typeof options.baseUrl === "string" ? path8.resolve(directory, options.baseUrl) : inherited?.baseUrl;
|
|
@@ -4254,7 +4364,7 @@ function resolveSourceCandidatePath(candidate) {
|
|
|
4254
4364
|
function isFarmPackageClientBoundary(importerPath, specifier, root) {
|
|
4255
4365
|
const imported = resolveImportedModule(importerPath, specifier, root);
|
|
4256
4366
|
if (imported.local || !imported.path) return false;
|
|
4257
|
-
return inspectPackageClientBoundary(imported.path, root
|
|
4367
|
+
return inspectPackageClientBoundary(imported.path, root).shouldHydrate;
|
|
4258
4368
|
}
|
|
4259
4369
|
var CLIENT_PACKAGE_SCAN_EXTENSIONS = /\.(?:[cm]?[jt]sx?)$/;
|
|
4260
4370
|
var CLIENT_PACKAGE_SCAN_SKIP = /* @__PURE__ */ new Set([
|
|
@@ -4350,11 +4460,37 @@ var clientReachableModules = /* @__PURE__ */ new Map();
|
|
|
4350
4460
|
function invalidateFarmClientReachableModules() {
|
|
4351
4461
|
clientReachableModules.clear();
|
|
4352
4462
|
}
|
|
4463
|
+
function isClientEntrySource(content) {
|
|
4464
|
+
return hasUseClientDirective(content) || hasHydrateExport(content);
|
|
4465
|
+
}
|
|
4466
|
+
function getClientReachableImports(content) {
|
|
4467
|
+
return getImportSpecifiers(content, { dynamic: true });
|
|
4468
|
+
}
|
|
4469
|
+
function noteFarmClientReachableModuleChange(file, event, options) {
|
|
4470
|
+
if (event !== "update") {
|
|
4471
|
+
invalidateFarmClientReachableModules();
|
|
4472
|
+
return;
|
|
4473
|
+
}
|
|
4474
|
+
const resolved = path8.resolve(file);
|
|
4475
|
+
let content;
|
|
4476
|
+
for (const [key, scan] of clientReachableModules) {
|
|
4477
|
+
const read = scan.reads.get(resolved);
|
|
4478
|
+
if (!read) {
|
|
4479
|
+
if (options.appSource) clientReachableModules.delete(key);
|
|
4480
|
+
continue;
|
|
4481
|
+
}
|
|
4482
|
+
if (content === void 0) content = readIfExists(resolved);
|
|
4483
|
+
if (read.entry !== void 0 && read.entry !== isClientEntrySource(content) || read.imports !== void 0 && read.imports !== getClientReachableImports(content).join("\0")) {
|
|
4484
|
+
clientReachableModules.delete(key);
|
|
4485
|
+
}
|
|
4486
|
+
}
|
|
4487
|
+
}
|
|
4353
4488
|
function getFarmClientReachableModules(directory, root) {
|
|
4354
4489
|
const key = `${path8.resolve(root)}\0${path8.resolve(directory)}`;
|
|
4355
4490
|
const cached = clientReachableModules.get(key);
|
|
4356
|
-
if (cached) return cached;
|
|
4491
|
+
if (cached) return cached.modules;
|
|
4357
4492
|
const reachable = /* @__PURE__ */ new Set();
|
|
4493
|
+
const reads = /* @__PURE__ */ new Map();
|
|
4358
4494
|
const queue = [];
|
|
4359
4495
|
const walk2 = (current) => {
|
|
4360
4496
|
let entries;
|
|
@@ -4368,8 +4504,9 @@ function getFarmClientReachableModules(directory, root) {
|
|
|
4368
4504
|
if (entry.isDirectory()) {
|
|
4369
4505
|
if (!entry.name.startsWith(".") && !CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
|
|
4370
4506
|
} else if (isScannedSourceFile(entry.name)) {
|
|
4371
|
-
const
|
|
4372
|
-
|
|
4507
|
+
const clientEntry = isClientEntrySource(readIfExists(file));
|
|
4508
|
+
reads.set(path8.resolve(file), { entry: clientEntry });
|
|
4509
|
+
if (clientEntry) queue.push(file);
|
|
4373
4510
|
}
|
|
4374
4511
|
}
|
|
4375
4512
|
};
|
|
@@ -4378,14 +4515,18 @@ function getFarmClientReachableModules(directory, root) {
|
|
|
4378
4515
|
const file = path8.resolve(queue.pop());
|
|
4379
4516
|
if (reachable.has(file)) continue;
|
|
4380
4517
|
reachable.add(file);
|
|
4381
|
-
|
|
4518
|
+
const imports = getClientReachableImports(readIfExists(file));
|
|
4519
|
+
const read = reads.get(file);
|
|
4520
|
+
if (read) read.imports = imports.join("\0");
|
|
4521
|
+
else reads.set(file, { imports: imports.join("\0") });
|
|
4522
|
+
for (const specifier of imports) {
|
|
4382
4523
|
const imported = resolveImportedModule(file, specifier, root);
|
|
4383
4524
|
if (imported.local && imported.path && !reachable.has(path8.resolve(imported.path))) {
|
|
4384
4525
|
queue.push(imported.path);
|
|
4385
4526
|
}
|
|
4386
4527
|
}
|
|
4387
4528
|
}
|
|
4388
|
-
clientReachableModules.set(key, reachable);
|
|
4529
|
+
clientReachableModules.set(key, { modules: reachable, reads });
|
|
4389
4530
|
return reachable;
|
|
4390
4531
|
}
|
|
4391
4532
|
function resolveFarmClientOptimizeDeps(directory, root) {
|
|
@@ -4871,6 +5012,7 @@ export {
|
|
|
4871
5012
|
memoizeInFarmSourceSnapshot,
|
|
4872
5013
|
noteFarmSourceRead,
|
|
4873
5014
|
traceFarmSourceReads,
|
|
5015
|
+
traceFarmSourceReadGroups,
|
|
4874
5016
|
rewriteFarmReactServerClientModuleImports,
|
|
4875
5017
|
rewriteFarmReactServerImports,
|
|
4876
5018
|
invalidateFarmClientOnlyScan,
|
|
@@ -4888,6 +5030,7 @@ export {
|
|
|
4888
5030
|
ensureFarmIslandContainerReference,
|
|
4889
5031
|
wrapFarmIslandContainers,
|
|
4890
5032
|
withPackageClientBoundaryCache,
|
|
5033
|
+
bindPackageClientBoundaryCache,
|
|
4891
5034
|
usePackageClientBoundaryCacheFile,
|
|
4892
5035
|
resolvePackageClientBoundaryCacheFile,
|
|
4893
5036
|
runWithPackageClientBoundaryCacheFile,
|
|
@@ -4912,11 +5055,12 @@ export {
|
|
|
4912
5055
|
enforceFarmIsolatedHydrationRouteBudget,
|
|
4913
5056
|
isIsolatableClientBoundarySource,
|
|
4914
5057
|
isFarmClientModulePlanUnchanged,
|
|
5058
|
+
getInstalledPackageDirectory,
|
|
4915
5059
|
resolveImportedModule,
|
|
4916
5060
|
isFarmPackageClientBoundary,
|
|
4917
5061
|
collectFarmClientPackageImports,
|
|
4918
5062
|
collectFarmServerBundledPackageInfo,
|
|
4919
|
-
|
|
5063
|
+
noteFarmClientReachableModuleChange,
|
|
4920
5064
|
getFarmClientReachableModules,
|
|
4921
5065
|
resolveFarmClientOptimizeDeps,
|
|
4922
5066
|
createFarmDiagnostic,
|
|
@@ -132,7 +132,7 @@ import { trapUnhandledErrors } from "#nitro/runtime/error/hooks";
|
|
|
132
132
|
import { setupCloseHooks } from "#nitro/runtime/shutdown";
|
|
133
133
|
import { startScheduleRunner } from "#nitro/runtime/task";
|
|
134
134
|
import { tracingSrvxPlugins } from "#nitro/virtual/tracing";
|
|
135
|
-
import { farmProductionLifecycle } from ${JSON.stringify(nitroEntryImport)};${desktop ? `
|
|
135
|
+
import { farmPrepareNativeRoutes, farmProductionLifecycle } from ${JSON.stringify(nitroEntryImport)};${desktop ? `
|
|
136
136
|
import { realpathSync } from "node:fs";
|
|
137
137
|
import { pathToFileURL } from "node:url";
|
|
138
138
|
import { createFarmDesktopGuard } from ${JSON.stringify(desktop.guardModule)};
|
|
@@ -196,7 +196,9 @@ if (!shutdownConfig.disabled) {
|
|
|
196
196
|
|
|
197
197
|
try {
|
|
198
198
|
await Promise.race([
|
|
199
|
-
Promise.resolve()
|
|
199
|
+
Promise.resolve()
|
|
200
|
+
.then(() => farmProductionLifecycle.start())
|
|
201
|
+
.then(() => farmPrepareNativeRoutes()),
|
|
200
202
|
startupSignalPromise,
|
|
201
203
|
]);
|
|
202
204
|
} catch (error) {
|