@farm.js/core 0.1.67 → 0.1.68
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.d-BFu9xHAi.d.ts → agent-mcp.d-Uh5xr7aX.d.ts} +1 -1
- package/dist/{agent-mcp.d-DWyWkTSy.d.mts → agent-mcp.d-wkVPK1GA.d.mts} +1 -1
- package/dist/agent-runtime.d.mts +5 -3
- package/dist/agent-runtime.d.ts +5 -3
- package/dist/{analyzer-TTIIXXMQ.mjs → analyzer-CQDU7E3Y.mjs} +2 -2
- package/dist/analyzer-PPAHM4AW.cjs +16 -0
- package/dist/api/node.d.mts +7 -5
- package/dist/api/node.d.ts +7 -5
- package/dist/api/route-manager.d.mts +7 -5
- package/dist/api/route-manager.d.ts +7 -5
- package/dist/api/runtime.d.mts +6 -4
- package/dist/api/runtime.d.ts +6 -4
- package/dist/api.d.mts +8 -6
- package/dist/api.d.ts +8 -6
- package/dist/{app-manifest.d-CwfhGrVR.d.ts → app-manifest.d-BT5i2F-o.d.ts} +1 -1
- package/dist/{app-manifest.d-CRmjN5j9.d.mts → app-manifest.d-Dd4q5CFx.d.mts} +1 -1
- package/dist/app-markdown.cjs +3 -3
- package/dist/app-markdown.d.mts +10 -10
- package/dist/app-markdown.d.ts +10 -10
- package/dist/app-markdown.mjs +2 -2
- package/dist/{app.d-BX9LVTiP.d.ts → app.d-BVOpL_f2.d.ts} +6 -6
- package/dist/{app.d-uBBUxwyV.d.mts → app.d-BhiDXex_.d.mts} +6 -6
- package/dist/{chunk-23PVOIPT.cjs → chunk-225APHKC.cjs} +3 -3
- package/dist/{chunk-4JX3M4C6.cjs → chunk-23VJEGKC.cjs} +2 -1
- package/dist/{chunk-Q37INCXG.cjs → chunk-3EEINK7G.cjs} +11 -2
- package/dist/{chunk-BRWIVOV4.cjs → chunk-3GNHJ3RN.cjs} +10 -8
- package/dist/{chunk-QJVW76JG.mjs → chunk-3Y52TWYU.mjs} +2 -2
- package/dist/{chunk-OB3IFUK6.cjs → chunk-437QZIC2.cjs} +4 -4
- package/dist/{chunk-WGHY3OL5.mjs → chunk-4UAQB5LB.mjs} +232 -49
- package/dist/{chunk-JWSI5WO4.mjs → chunk-4ZXKYCYK.mjs} +1 -1
- package/dist/{chunk-N35YPV4N.mjs → chunk-57QAQU4F.mjs} +9 -7
- package/dist/{chunk-AQDLVHNF.mjs → chunk-5FBZJJGA.mjs} +17 -0
- package/dist/{chunk-PL6RTBDE.cjs → chunk-5JKDFRTK.cjs} +2 -2
- package/dist/{chunk-CO3YMZFD.mjs → chunk-6OFOIMNS.mjs} +1 -1
- package/dist/{chunk-556H7JCE.cjs → chunk-7LK5CTUM.cjs} +14 -14
- package/dist/{chunk-E6CD45JK.mjs → chunk-A3T445WK.mjs} +19 -5
- package/dist/{chunk-DQJ2CIH7.cjs → chunk-ASYOWPSR.cjs} +2 -1
- package/dist/{chunk-QGJ4FI2G.mjs → chunk-C6HGUTXB.mjs} +113 -29
- package/dist/{chunk-IRA2CZAY.mjs → chunk-CRVSYDHV.mjs} +2 -2
- package/dist/{chunk-XNZWMXCF.mjs → chunk-DIXFKAPM.mjs} +183 -76
- package/dist/{chunk-QGQP6QKO.cjs → chunk-DWLNLU55.cjs} +2 -2
- package/dist/{chunk-52Y3C3HG.mjs → chunk-E7VF3LQ5.mjs} +3 -2
- package/dist/{chunk-N5DQMOAG.cjs → chunk-F36LS2C7.cjs} +273 -90
- package/dist/{chunk-H37MDCPR.mjs → chunk-F6CMGWAL.mjs} +1 -1
- package/dist/{chunk-HNVAZGQD.cjs → chunk-FJMC24KG.cjs} +2 -2
- package/dist/{chunk-KCY52OUQ.cjs → chunk-FSODPZRT.cjs} +1 -1
- package/dist/{chunk-PPX7UOFY.cjs → chunk-FVYBEMOD.cjs} +55 -38
- package/dist/{chunk-6YBYX4K4.mjs → chunk-G7NBPP7H.mjs} +1 -1
- package/dist/{chunk-HFHJJXSV.mjs → chunk-GFPS7MNE.mjs} +1 -1
- package/dist/{chunk-3T5TLFCQ.mjs → chunk-HEJM46HQ.mjs} +11 -2
- package/dist/chunk-HHLEYA4B.cjs +17 -0
- package/dist/{chunk-F43OG25P.cjs → chunk-I7J5RLGO.cjs} +15 -1
- package/dist/chunk-ICFPTHXM.mjs +97 -0
- package/dist/{chunk-6V5YWI4W.cjs → chunk-IGDYL2IA.cjs} +2 -2
- package/dist/{chunk-TEG6HJVF.mjs → chunk-JL2YW5KX.mjs} +1 -0
- package/dist/{chunk-JVM3DKZE.mjs → chunk-KDO6T6OB.mjs} +1 -1
- package/dist/{chunk-QITSS4TD.cjs → chunk-KWCZKJYU.cjs} +352 -245
- package/dist/{chunk-DCXSIEFE.cjs → chunk-LDEXTX4I.cjs} +51 -37
- package/dist/{chunk-3T7ALZJF.cjs → chunk-LR4KP3I7.cjs} +2 -2
- package/dist/{chunk-VFXE6NWR.mjs → chunk-MGKWYPE3.mjs} +2 -1
- package/dist/{chunk-5TA63JD3.mjs → chunk-MGZVDX4R.mjs} +1 -1
- package/dist/{chunk-6SQZXRJ2.cjs → chunk-MMDKYJ5V.cjs} +7 -7
- package/dist/{chunk-HP2DQGQH.mjs → chunk-MNJDNTGO.mjs} +1 -1
- package/dist/{chunk-5Y2P454O.cjs → chunk-MTBDJ326.cjs} +6 -5
- package/dist/{chunk-XUES6OET.mjs → chunk-MV7NWU23.mjs} +1 -1
- package/dist/{chunk-4DRINDGN.cjs → chunk-MZ4CRSY7.cjs} +254 -125
- package/dist/{chunk-4IHMHFQB.cjs → chunk-NG2EZ6QS.cjs} +28 -1
- package/dist/{chunk-WDD5CTZW.mjs → chunk-NT4W4H52.mjs} +6 -6
- package/dist/{chunk-F7JKVHU2.mjs → chunk-NVOMQLI2.mjs} +15 -1
- package/dist/{chunk-22IWL4YD.cjs → chunk-OCNV4CI2.cjs} +21 -2
- package/dist/{chunk-72KCTHLV.cjs → chunk-PRL7FXG4.cjs} +113 -29
- package/dist/{chunk-YVTS3S3F.cjs → chunk-QOGIZKSO.cjs} +3 -3
- package/dist/{chunk-DB2HSHQA.cjs → chunk-QSUYB3RH.cjs} +14 -14
- package/dist/chunk-QYNZ3CTI.mjs +17 -0
- package/dist/{chunk-724MGMIL.mjs → chunk-R2ZHU37O.mjs} +19 -0
- package/dist/{chunk-YQYTQJZN.mjs → chunk-RLH5AH2M.mjs} +1 -1
- package/dist/{chunk-HM7AGSKU.cjs → chunk-SQ6IWJ3H.cjs} +1 -1
- package/dist/{chunk-V5MQMQ2P.mjs → chunk-T5XFZQCL.mjs} +1 -1
- package/dist/{chunk-Q5UX55YA.cjs → chunk-TNK2TVRS.cjs} +831 -470
- package/dist/{chunk-J7JHVCWA.cjs → chunk-UKZ6AWKZ.cjs} +2 -1
- package/dist/{chunk-V5RTHYJB.cjs → chunk-URN7VFO7.cjs} +91 -22
- package/dist/{chunk-HRPTMX5C.mjs → chunk-VFNAK6A5.mjs} +2 -2
- package/dist/{chunk-VK54PDQ6.mjs → chunk-VRGY3X2I.mjs} +86 -17
- package/dist/chunk-W44X6IC2.cjs +97 -0
- package/dist/{chunk-GTV2ABO7.mjs → chunk-WPB67LE5.mjs} +162 -33
- package/dist/{chunk-UHE5JUKB.mjs → chunk-XCAQTCGK.mjs} +1 -1
- package/dist/{chunk-DGOFR7D5.cjs → chunk-Y6KHPJDB.cjs} +2 -2
- package/dist/{chunk-LPIZMU7D.cjs → chunk-YTNBCXCW.cjs} +4 -4
- package/dist/{chunk-KWFNUODD.mjs → chunk-YVPX5PI5.mjs} +1 -0
- package/dist/{chunk-6R53ZWX2.cjs → chunk-Z3PW3DIR.cjs} +3 -3
- package/dist/{chunk-UHNSY2PQ.mjs → chunk-Z6SOXHAD.mjs} +772 -411
- package/dist/{chunk-5FE5YT2N.mjs → chunk-ZZGQD3LL.mjs} +28 -1
- package/dist/{client-component.d-CDRvRmbU.d.mts → client-component.d-BvQOxSqh.d.mts} +2 -2
- package/dist/{client-component.d-DWRKyAp5.d.ts → client-component.d-DNVSLEPi.d.ts} +2 -2
- package/dist/{client-plugins.d-BNILjfX3.d.mts → client-plugins.d-CE1lVK2R.d.mts} +23 -234
- package/dist/{client-plugins.d-CrKZiNSN.d.ts → client-plugins.d-CNDqcAuf.d.ts} +23 -234
- package/dist/client-plugins.d.mts +5 -3
- package/dist/client-plugins.d.ts +5 -3
- package/dist/client.cjs +6 -6
- package/dist/client.d.mts +10 -8
- package/dist/client.d.ts +10 -8
- package/dist/client.mjs +5 -5
- package/dist/config.d.mts +5 -3
- package/dist/config.d.ts +5 -3
- package/dist/deployment.cjs +4 -2
- package/dist/deployment.d.mts +15 -1
- package/dist/deployment.d.ts +15 -1
- package/dist/deployment.mjs +3 -1
- package/dist/desktop.d.mts +6 -4
- package/dist/desktop.d.ts +6 -4
- package/dist/{devtools-UFQYT3VA.mjs → devtools-2A2GPC7B.mjs} +6 -6
- package/dist/{devtools-RZVT4JVN.cjs → devtools-R27T3BRY.cjs} +7 -7
- package/dist/docs.cjs +9 -9
- package/dist/docs.d.mts +6 -4
- package/dist/docs.d.ts +6 -4
- package/dist/docs.mjs +8 -8
- package/dist/environment/vite.cjs +5 -5
- package/dist/environment/vite.d.mts +1 -1
- package/dist/environment/vite.d.ts +1 -1
- package/dist/environment/vite.mjs +4 -4
- package/dist/{generate-route-types.d-BL2pq6xC.d.ts → generate-route-types.d-B76M5R11.d.ts} +1 -1
- package/dist/{generate-route-types.d-BoVDU8qX.d.mts → generate-route-types.d-CaGMIaNI.d.mts} +1 -1
- package/dist/index.cjs +41 -36
- package/dist/{index.d-Bdm6866n.d.mts → index.d-Bt3kl19W.d.mts} +1 -1
- package/dist/{index.d-Dey5T14f.d.ts → index.d-Cx_-DaKV.d.ts} +1 -1
- package/dist/index.d.mts +25 -22
- package/dist/index.d.ts +25 -22
- package/dist/index.mjs +43 -38
- package/dist/instrumentation.cjs +3 -3
- package/dist/instrumentation.mjs +2 -2
- package/dist/integrations/orm.d.mts +5 -3
- package/dist/integrations/orm.d.ts +5 -3
- package/dist/integrations.d.mts +5 -3
- package/dist/integrations.d.ts +5 -3
- package/dist/internal/app-markdown-runtime.cjs +2 -2
- package/dist/internal/app-markdown-runtime.d.mts +12 -5
- package/dist/internal/app-markdown-runtime.d.ts +12 -5
- package/dist/internal/app-markdown-runtime.mjs +1 -1
- package/dist/internal/build-runtime.cjs +33 -30
- package/dist/internal/build-runtime.d.mts +7 -5
- package/dist/internal/build-runtime.d.ts +7 -5
- package/dist/internal/build-runtime.mjs +32 -29
- package/dist/internal/cli-runtime.cjs +10 -10
- package/dist/internal/cli-runtime.mjs +9 -9
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +31 -36
- package/dist/internal/client-runtime.d.mts +8 -6
- package/dist/internal/client-runtime.d.ts +8 -6
- package/dist/internal/client-runtime.mjs +22 -27
- package/dist/internal/compression-runtime.d.mts +5 -3
- package/dist/internal/compression-runtime.d.ts +5 -3
- package/dist/internal/config-runtime.cjs +8 -8
- package/dist/internal/config-runtime.d.mts +9 -7
- package/dist/internal/config-runtime.d.ts +9 -7
- package/dist/internal/config-runtime.mjs +7 -7
- package/dist/internal/form-actions.cjs +7 -2
- package/dist/internal/form-actions.d.mts +10 -3
- package/dist/internal/form-actions.d.ts +10 -3
- package/dist/internal/form-actions.mjs +8 -3
- package/dist/internal/infra-analytics-runtime.cjs +6 -6
- package/dist/internal/infra-analytics-runtime.mjs +4 -4
- package/dist/internal/islands-boot.cjs +6 -1
- package/dist/internal/islands-boot.mjs +6 -1
- 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 +4 -2
- package/dist/internal/production-node-env.d.mts +22 -1
- package/dist/internal/production-node-env.d.ts +22 -1
- package/dist/internal/production-node-env.mjs +3 -1
- package/dist/internal/production-runtime.cjs +13 -9
- package/dist/internal/production-runtime.d.mts +21 -16
- package/dist/internal/production-runtime.d.ts +21 -16
- package/dist/internal/production-runtime.mjs +13 -9
- package/dist/internal/server-tree.cjs +2 -2
- package/dist/internal/server-tree.d.mts +0 -5
- package/dist/internal/server-tree.d.ts +0 -5
- package/dist/internal/server-tree.mjs +1 -1
- package/dist/internal/vercel-edge-middleware.cjs +87 -0
- package/dist/internal/vercel-edge-middleware.d.mts +39 -0
- package/dist/internal/vercel-edge-middleware.d.ts +39 -0
- package/dist/internal/vercel-edge-middleware.mjs +87 -0
- package/dist/layers-7P4RLKVX.cjs +20 -0
- package/dist/{layers-T55SA47E.mjs → layers-XQ7VFMWO.mjs} +4 -2
- package/dist/{layers.d-CcS42OGR.d.mts → layers.d-CH0bC4QL.d.mts} +2 -1
- package/dist/{layers.d-CcS42OGR.d.ts → layers.d-CH0bC4QL.d.ts} +2 -1
- package/dist/markdown.d.mts +5 -3
- package/dist/markdown.d.ts +5 -3
- package/dist/middleware.cjs +4 -4
- package/dist/middleware.d.mts +8 -5
- package/dist/middleware.d.ts +8 -5
- package/dist/middleware.mjs +6 -6
- package/dist/mobile.d.mts +4 -4
- package/dist/mobile.d.ts +4 -4
- package/dist/{mount.d-BP0nLYQO.d.mts → mount.d-Bki4pOaJ.d.mts} +1 -1
- package/dist/{mount.d-CkiPky_F.d.ts → mount.d-DjR5aerM.d.ts} +1 -1
- package/dist/{navigation-delegate.d-DchcGzAQ.d.ts → navigation-delegate.d-CtghaSP3.d.ts} +1 -1
- package/dist/{navigation-delegate.d-CdBP-hkZ.d.mts → navigation-delegate.d-VDkziXTK.d.mts} +1 -1
- package/dist/navigation.cjs +5 -5
- package/dist/navigation.d.mts +8 -6
- package/dist/navigation.d.ts +8 -6
- package/dist/navigation.mjs +4 -4
- package/dist/{nitro-55YOZWRA.mjs → nitro-NSTXT7LB.mjs} +2 -2
- package/dist/{nitro-EEX2J3KB.cjs → nitro-Y3LGITW3.cjs} +4 -4
- package/dist/node-module-bundle-LIZ2KMVW.cjs +13 -0
- package/dist/node-module-bundle-VR6NV6AI.mjs +13 -0
- package/dist/plugin.cjs +20 -20
- package/dist/plugin.d.mts +7 -5
- package/dist/plugin.d.ts +7 -5
- package/dist/plugin.mjs +19 -19
- package/dist/{production-runtime.d-Dou_Htas.d.ts → production-runtime.d-BMyyLGBB.d.ts} +3 -57
- package/dist/{production-runtime.d-VwsBzIee.d.mts → production-runtime.d-DMZY3OgV.d.mts} +3 -57
- package/dist/query/client.cjs +6 -6
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan.d-LKymStDJ.d.mts → render-plan.d-BSwV8PE4.d.mts} +1 -1
- package/dist/{render-plan.d-D8UakAIk.d.ts → render-plan.d-i9sI4tc9.d.ts} +1 -1
- package/dist/renderer/react/server.cjs +2 -2
- package/dist/renderer/react/server.mjs +1 -1
- package/dist/renderer-client.cjs +5 -5
- package/dist/renderer-client.d.mts +8 -6
- package/dist/renderer-client.d.ts +8 -6
- package/dist/renderer-client.mjs +2 -2
- package/dist/renderer.d.mts +5 -0
- package/dist/renderer.d.ts +5 -0
- package/dist/{request.d-KG-4d2eG.d.mts → request.d-C24FNQ_7.d.mts} +1 -1
- package/dist/{request.d-B928QjWy.d.ts → request.d-Dgln8tuI.d.ts} +1 -1
- package/dist/request.d.mts +6 -4
- package/dist/request.d.ts +6 -4
- package/dist/{route-rendering.d-DoEe_w9t.d.ts → route-rendering.d-CUylZKJA.d.ts} +1 -1
- package/dist/{route-rendering.d-NIHQeb4m.d.mts → route-rendering.d-Ds0BfwQi.d.mts} +1 -1
- package/dist/{router.d-DYnRHQwz.d.ts → router.d-B56rMOFm.d.ts} +1 -1
- package/dist/{router.d-B8PkJSGp.d.mts → router.d-CFPcbqzc.d.mts} +1 -1
- package/dist/{routes.d-uUBZyWoK.d.ts → routes.d-9GFFNioh.d.ts} +1 -1
- package/dist/{routes.d-DgZ_jgGG.d.mts → routes.d-CrEy0lJS.d.mts} +1 -1
- package/dist/routes.d.mts +5 -3
- package/dist/routes.d.ts +5 -3
- package/dist/{rsc-pipeline-7K5H2RPH.cjs → rsc-pipeline-3T7V6OUT.cjs} +10 -9
- package/dist/{rsc-pipeline-4OJ5ZQNZ.mjs → rsc-pipeline-GA4AQWZI.mjs} +9 -8
- package/dist/{runtime-X52Q7JFR.cjs → runtime-REUTNTI5.cjs} +20 -20
- package/dist/{runtime-U7O3HZOZ.mjs → runtime-ZYCKKY7L.mjs} +12 -12
- package/dist/{runtime.d-BxQIzwfy.d.mts → runtime.d-DLRO-ExG.d.mts} +1 -1
- package/dist/{runtime.d-DP7mEkEF.d.ts → runtime.d-H7k9hOQE.d.ts} +1 -1
- package/dist/server-http.d-rAe7lAQc.d.mts +70 -0
- package/dist/server-http.d-rAe7lAQc.d.ts +70 -0
- package/dist/server-plugins.d.mts +6 -4
- package/dist/server-plugins.d.ts +6 -4
- package/dist/server.cjs +46 -44
- package/dist/server.d-C5FFrZAo.d.ts +57 -0
- package/dist/server.d-DgC8xew5.d.mts +57 -0
- package/dist/server.d.mts +13 -11
- package/dist/server.d.ts +13 -11
- package/dist/server.mjs +28 -26
- package/dist/{spa-router.d-DsFDHTsv.d.ts → spa-router.d-Dr7oanhl.d.ts} +2 -2
- package/dist/{spa-router.d-BgHPVMhz.d.mts → spa-router.d-g4CzhEH1.d.mts} +2 -2
- package/dist/testing.d.mts +5 -3
- package/dist/testing.d.ts +5 -3
- package/dist/types.d-xCIhyjOq.d.mts +233 -0
- package/dist/types.d-xCIhyjOq.d.ts +233 -0
- package/dist/{utils.d-zxAVcf_V.d.ts → utils.d-BxxyDEb8.d.ts} +1 -1
- package/dist/{utils.d-BKyKDBR1.d.mts → utils.d-HIla3pD_.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +20 -20
- package/dist/vite.d.mts +10 -8
- package/dist/vite.d.ts +10 -8
- package/dist/vite.mjs +19 -19
- package/dist/workflows.cjs +2 -2
- package/dist/workflows.d.mts +121 -1
- package/dist/workflows.d.ts +121 -1
- package/dist/workflows.mjs +1 -1
- package/package.json +7 -2
- package/dist/analyzer-KVZGVY5Q.cjs +0 -16
- package/dist/chunk-CLFEQGET.cjs +0 -60
- package/dist/chunk-MK5E44WP.mjs +0 -60
- package/dist/layers-DMRXRL7F.cjs +0 -18
- package/dist/node-module-bundle-7JHPPF6B.mjs +0 -11
- package/dist/node-module-bundle-YJGYBOGK.cjs +0 -11
- package/dist/workflows.d-CRMzQZ3k.d.mts +0 -188
- package/dist/workflows.d-CRMzQZ3k.d.ts +0 -188
|
@@ -7,7 +7,7 @@ var _chunk7KJJ4SBScjs = require('./chunk-7KJJ4SBS.cjs');
|
|
|
7
7
|
var _chunkRE5E2G5Scjs = require('./chunk-RE5E2G5S.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkMTBDJ326cjs = require('./chunk-MTBDJ326.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunk67MZTLTFcjs = require('./chunk-67MZTLTF.cjs');
|
|
@@ -21,7 +21,7 @@ var _chunkE7QOEV5Zcjs = require('./chunk-E7QOEV5Z.cjs');
|
|
|
21
21
|
var _chunkQMNWKQL4cjs = require('./chunk-QMNWKQL4.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _chunkSQ6IWJ3Hcjs = require('./chunk-SQ6IWJ3H.cjs');
|
|
25
25
|
|
|
26
26
|
// src/environment-vite.ts
|
|
27
27
|
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
@@ -1217,6 +1217,10 @@ var _crypto = require('crypto');
|
|
|
1217
1217
|
|
|
1218
1218
|
|
|
1219
1219
|
var IDENTIFIER = /^[A-Za-z_$][\w$]*$/;
|
|
1220
|
+
var moduleName = (node) => {
|
|
1221
|
+
const name = _optionalChain([node, 'optionalAccess', _60 => _60.type]) === "Identifier" ? node.name : _optionalChain([node, 'optionalAccess', _61 => _61.value]);
|
|
1222
|
+
return typeof name === "string" ? name : null;
|
|
1223
|
+
};
|
|
1220
1224
|
function parse(code, file) {
|
|
1221
1225
|
const extension = _path2.default.extname(file).slice(1);
|
|
1222
1226
|
const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : "tsx";
|
|
@@ -1247,8 +1251,8 @@ function namespaceMembers2(program, local, declaration) {
|
|
|
1247
1251
|
if (opaque || node === declaration) return;
|
|
1248
1252
|
const name = node.type === "Identifier" || node.type === "JSXIdentifier" ? node.name : null;
|
|
1249
1253
|
if (name !== local) return;
|
|
1250
|
-
if (_optionalChain([parent, 'optionalAccess',
|
|
1251
|
-
const member = (_optionalChain([parent, 'optionalAccess',
|
|
1254
|
+
if (_optionalChain([parent, 'optionalAccess', _62 => _62.type]) === "ImportNamespaceSpecifier") return;
|
|
1255
|
+
const member = (_optionalChain([parent, 'optionalAccess', _63 => _63.type]) === "MemberExpression" || _optionalChain([parent, 'optionalAccess', _64 => _64.type]) === "JSXMemberExpression") && parent.object === node ? parent.property : null;
|
|
1252
1256
|
const property = member && !parent.computed && (member.type === "Identifier" || member.type === "JSXIdentifier") ? member.name : null;
|
|
1253
1257
|
if (property) members.add(property);
|
|
1254
1258
|
else opaque = true;
|
|
@@ -1256,17 +1260,19 @@ function namespaceMembers2(program, local, declaration) {
|
|
|
1256
1260
|
return opaque ? null : [...members];
|
|
1257
1261
|
}
|
|
1258
1262
|
function findFarmPackageClientImports(code, file, isClientPackage) {
|
|
1259
|
-
if (!code.includes("import")) return [];
|
|
1263
|
+
if (!code.includes("import") && !code.includes("export")) return [];
|
|
1260
1264
|
const program = parse(code, file);
|
|
1261
1265
|
if (!program) return [];
|
|
1262
1266
|
const found = [];
|
|
1263
1267
|
for (const node of _nullishCoalesce(program.body, () => ( []))) {
|
|
1264
|
-
|
|
1265
|
-
|
|
1268
|
+
const reexport = node.type === "ExportNamedDeclaration" && node.source != null;
|
|
1269
|
+
if (node.type !== "ImportDeclaration" && !reexport) continue;
|
|
1270
|
+
if (node.importKind === "type" || node.exportKind === "type") continue;
|
|
1271
|
+
const specifier = _optionalChain([node, 'access', _65 => _65.source, 'optionalAccess', _66 => _66.value]);
|
|
1266
1272
|
if (typeof specifier !== "string" || specifier.startsWith(".") || specifier.startsWith("/"))
|
|
1267
1273
|
continue;
|
|
1268
1274
|
const specifiers = (_nullishCoalesce(node.specifiers, () => ( []))).filter(
|
|
1269
|
-
(entry2) => entry2.importKind !== "type"
|
|
1275
|
+
(entry2) => entry2.importKind !== "type" && entry2.exportKind !== "type"
|
|
1270
1276
|
);
|
|
1271
1277
|
if (specifiers.length === 0 || !isClientPackage(specifier)) continue;
|
|
1272
1278
|
const entry = {
|
|
@@ -1274,12 +1280,20 @@ function findFarmPackageClientImports(code, file, isClientPackage) {
|
|
|
1274
1280
|
end: node.end,
|
|
1275
1281
|
specifier,
|
|
1276
1282
|
named: [],
|
|
1277
|
-
kept: []
|
|
1283
|
+
kept: [],
|
|
1284
|
+
...reexport ? { reexport: true } : {}
|
|
1278
1285
|
};
|
|
1279
1286
|
const client = (name) => isFarmPackageClientExport(file, specifier, name);
|
|
1280
1287
|
let supported = true;
|
|
1281
1288
|
for (const binding of specifiers) {
|
|
1282
|
-
if (binding.type === "
|
|
1289
|
+
if (binding.type === "ExportSpecifier") {
|
|
1290
|
+
const imported = moduleName(binding.local);
|
|
1291
|
+
const exported = moduleName(binding.exported);
|
|
1292
|
+
if (!imported || !exported || !IDENTIFIER.test(imported) || !IDENTIFIER.test(exported))
|
|
1293
|
+
supported = false;
|
|
1294
|
+
else if (client(imported)) entry.named.push({ imported, local: exported });
|
|
1295
|
+
else entry.kept.push({ imported, local: exported });
|
|
1296
|
+
} else if (binding.type === "ImportDefaultSpecifier") {
|
|
1283
1297
|
if (client("default")) entry.defaultLocal = binding.local.name;
|
|
1284
1298
|
else entry.kept.push({ imported: "default", local: binding.local.name });
|
|
1285
1299
|
} else if (binding.type === "ImportNamespaceSpecifier") {
|
|
@@ -1297,8 +1311,8 @@ function findFarmPackageClientImports(code, file, isClientPackage) {
|
|
|
1297
1311
|
...values.length > 0 ? { values } : {}
|
|
1298
1312
|
};
|
|
1299
1313
|
} else {
|
|
1300
|
-
const imported =
|
|
1301
|
-
if (
|
|
1314
|
+
const imported = moduleName(binding.imported);
|
|
1315
|
+
if (!imported || !IDENTIFIER.test(imported)) supported = false;
|
|
1302
1316
|
else if (client(imported)) entry.named.push({ imported, local: binding.local.name });
|
|
1303
1317
|
else entry.kept.push({ imported, local: binding.local.name });
|
|
1304
1318
|
}
|
|
@@ -1311,31 +1325,88 @@ function farmPackageClientImportExports(entry) {
|
|
|
1311
1325
|
return [
|
|
1312
1326
|
...entry.defaultLocal ? ["default"] : [],
|
|
1313
1327
|
...entry.named.map((binding) => binding.imported),
|
|
1314
|
-
..._nullishCoalesce(_optionalChain([entry, 'access',
|
|
1328
|
+
..._nullishCoalesce(_optionalChain([entry, 'access', _67 => _67.namespace, 'optionalAccess', _68 => _68.members]), () => ( []))
|
|
1315
1329
|
];
|
|
1316
1330
|
}
|
|
1317
1331
|
var FARM_CLIENT_REFERENCE_PRAGMA = "// @farm-client-reference";
|
|
1318
1332
|
var FARM_CLIENT_REFERENCE_DIRECTORY = "/.farm/client-references/";
|
|
1319
|
-
|
|
1333
|
+
var FARM_RESOLVE_FROM_PREFIX = "farm:resolve-from:";
|
|
1334
|
+
function parseFarmResolveFrom(id, importer) {
|
|
1335
|
+
if (!id.startsWith(FARM_RESOLVE_FROM_PREFIX)) return null;
|
|
1336
|
+
const rest = id.slice(FARM_RESOLVE_FROM_PREFIX.length);
|
|
1337
|
+
const separator = rest.indexOf(":");
|
|
1338
|
+
if (separator <= 0) return null;
|
|
1339
|
+
const directory = _path2.default.resolve(
|
|
1340
|
+
_path2.default.dirname(importer),
|
|
1341
|
+
decodeURIComponent(rest.slice(0, separator))
|
|
1342
|
+
);
|
|
1343
|
+
return {
|
|
1344
|
+
specifier: rest.slice(separator + 1),
|
|
1345
|
+
importer: _path2.default.join(directory, "__farm_client_reference__.js")
|
|
1346
|
+
};
|
|
1347
|
+
}
|
|
1348
|
+
function farmPackageClientReferencePath(root, specifier, exportName, scope) {
|
|
1320
1349
|
const directory = specifier.replace(/^@/, "").replace(/[^A-Za-z0-9._-]/g, "+");
|
|
1321
|
-
return _path2.default.join(
|
|
1350
|
+
return _path2.default.join(
|
|
1351
|
+
root,
|
|
1352
|
+
".farm",
|
|
1353
|
+
"client-references",
|
|
1354
|
+
directory,
|
|
1355
|
+
...scope ? [scope] : [],
|
|
1356
|
+
`${exportName}.tsx`
|
|
1357
|
+
);
|
|
1358
|
+
}
|
|
1359
|
+
function specifierPackage(specifier) {
|
|
1360
|
+
const parts = specifier.split("/");
|
|
1361
|
+
return specifier.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0];
|
|
1322
1362
|
}
|
|
1323
|
-
function
|
|
1324
|
-
|
|
1363
|
+
function packageLookup(directory, packageName) {
|
|
1364
|
+
for (let current = directory; ; current = _path2.default.dirname(current)) {
|
|
1365
|
+
if (_path2.default.basename(current) !== "node_modules") {
|
|
1366
|
+
const candidate = _path2.default.join(current, "node_modules", packageName);
|
|
1367
|
+
try {
|
|
1368
|
+
return { from: current, real: _fs2.default.realpathSync(candidate) };
|
|
1369
|
+
} catch (e17) {
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
if (_path2.default.dirname(current) === current) return null;
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
function referenceResolveFrom(root, specifier, importer) {
|
|
1376
|
+
const packageName = specifierPackage(specifier);
|
|
1377
|
+
const own = packageLookup(_path2.default.dirname(importer), packageName);
|
|
1378
|
+
if (!own) return null;
|
|
1379
|
+
const app = packageLookup(_path2.default.join(root, ".farm", "client-references"), packageName);
|
|
1380
|
+
if (_optionalChain([app, 'optionalAccess', _69 => _69.real]) === own.real) return null;
|
|
1381
|
+
try {
|
|
1382
|
+
return _fs2.default.realpathSync(own.from);
|
|
1383
|
+
} catch (e18) {
|
|
1384
|
+
return own.from;
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
function ensureFarmPackageClientReference(root, specifier, exportName, importer) {
|
|
1388
|
+
const resolveFrom = importer ? referenceResolveFrom(root, specifier, importer) : null;
|
|
1389
|
+
const scope = resolveFrom ? `__from__${_crypto.createHash.call(void 0, "sha256").update(_path2.default.relative(root, resolveFrom).split(_path2.default.sep).join("/")).digest("hex").slice(0, 8)}` : void 0;
|
|
1390
|
+
const file = farmPackageClientReferencePath(root, specifier, exportName, scope);
|
|
1391
|
+
const target = JSON.stringify(
|
|
1392
|
+
resolveFrom ? `${FARM_RESOLVE_FROM_PREFIX}${encodeURIComponent(
|
|
1393
|
+
_path2.default.relative(_path2.default.dirname(file), resolveFrom).split(_path2.default.sep).join("/")
|
|
1394
|
+
)}:${specifier}` : specifier
|
|
1395
|
+
);
|
|
1325
1396
|
const source = [
|
|
1326
1397
|
`// Generated by Farm: ${specifier}'s ${exportName} export, as a client reference for server components.`,
|
|
1327
1398
|
FARM_CLIENT_REFERENCE_PRAGMA,
|
|
1328
1399
|
'"use client";',
|
|
1329
1400
|
// An import, not `export { name } from`: a server graph applies CommonJS interop to imports
|
|
1330
1401
|
// (react-wrap-balancer's `main` is CommonJS), not to re-exports.
|
|
1331
|
-
exportName === "default" ? `import __farm_reference__ from ${
|
|
1402
|
+
exportName === "default" ? `import __farm_reference__ from ${target};` : `import { ${exportName} as __farm_reference__ } from ${target};`,
|
|
1332
1403
|
`export { __farm_reference__ as ${exportName} };`,
|
|
1333
1404
|
""
|
|
1334
1405
|
].join("\n");
|
|
1335
1406
|
let current = null;
|
|
1336
1407
|
try {
|
|
1337
1408
|
current = _fs2.default.readFileSync(file, "utf8");
|
|
1338
|
-
} catch (
|
|
1409
|
+
} catch (e19) {
|
|
1339
1410
|
}
|
|
1340
1411
|
if (current !== source) {
|
|
1341
1412
|
_fs2.default.mkdirSync(_path2.default.dirname(file), { recursive: true });
|
|
@@ -1347,7 +1418,7 @@ function writeIfChanged(file, source) {
|
|
|
1347
1418
|
let current = null;
|
|
1348
1419
|
try {
|
|
1349
1420
|
current = _fs2.default.readFileSync(file, "utf8");
|
|
1350
|
-
} catch (
|
|
1421
|
+
} catch (e20) {
|
|
1351
1422
|
}
|
|
1352
1423
|
if (current !== source) {
|
|
1353
1424
|
_fs2.default.mkdirSync(_path2.default.dirname(file), { recursive: true });
|
|
@@ -1359,7 +1430,7 @@ function owningPackage(file) {
|
|
|
1359
1430
|
try {
|
|
1360
1431
|
const manifest = JSON.parse(_fs2.default.readFileSync(_path2.default.join(current, "package.json"), "utf8"));
|
|
1361
1432
|
if (typeof manifest.name === "string") return { directory: current, name: manifest.name };
|
|
1362
|
-
} catch (
|
|
1433
|
+
} catch (e21) {
|
|
1363
1434
|
}
|
|
1364
1435
|
if (_path2.default.dirname(current) === current) return null;
|
|
1365
1436
|
}
|
|
@@ -1400,24 +1471,27 @@ function ensureFarmInternalClientReference(root, clientFile) {
|
|
|
1400
1471
|
function rewriteFarmPackageClientImports(options) {
|
|
1401
1472
|
const imports = findFarmPackageClientImports(options.code, options.file, options.isClientPackage);
|
|
1402
1473
|
if (imports.length === 0) return null;
|
|
1403
|
-
const reference = (specifier, exportName) => JSON.stringify(
|
|
1474
|
+
const reference = (specifier, exportName) => JSON.stringify(
|
|
1475
|
+
ensureFarmPackageClientReference(options.root, specifier, exportName, options.file)
|
|
1476
|
+
);
|
|
1404
1477
|
let output = options.code;
|
|
1405
1478
|
let next = 0;
|
|
1406
1479
|
let changed = false;
|
|
1407
1480
|
for (const entry of [...imports].sort((left, right) => right.start - left.start)) {
|
|
1408
1481
|
if (farmPackageClientImportExports(entry).length === 0) continue;
|
|
1409
1482
|
changed = true;
|
|
1483
|
+
const keyword = entry.reexport ? "export" : "import";
|
|
1410
1484
|
const lines = [];
|
|
1411
1485
|
if (entry.kept.length > 0) {
|
|
1412
1486
|
const bindings = entry.kept.map((binding) => `${binding.imported} as ${binding.local}`);
|
|
1413
|
-
lines.push(
|
|
1487
|
+
lines.push(`${keyword} { ${bindings.join(", ")} } from ${JSON.stringify(entry.specifier)};`);
|
|
1414
1488
|
}
|
|
1415
1489
|
if (entry.defaultLocal) {
|
|
1416
1490
|
lines.push(`import ${entry.defaultLocal} from ${reference(entry.specifier, "default")};`);
|
|
1417
1491
|
}
|
|
1418
1492
|
for (const binding of entry.named) {
|
|
1419
1493
|
lines.push(
|
|
1420
|
-
|
|
1494
|
+
`${keyword} { ${binding.imported} as ${binding.local} } from ${reference(entry.specifier, binding.imported)};`
|
|
1421
1495
|
);
|
|
1422
1496
|
}
|
|
1423
1497
|
if (entry.namespace) {
|
|
@@ -1427,7 +1501,7 @@ function rewriteFarmPackageClientImports(options) {
|
|
|
1427
1501
|
lines.push(`import { ${member} as ${local} } from ${reference(entry.specifier, member)};`);
|
|
1428
1502
|
fields.push(`${member}: ${local}`);
|
|
1429
1503
|
}
|
|
1430
|
-
if (_optionalChain([entry, 'access',
|
|
1504
|
+
if (_optionalChain([entry, 'access', _70 => _70.namespace, 'access', _71 => _71.values, 'optionalAccess', _72 => _72.length])) {
|
|
1431
1505
|
const local = `__farm_package_values_${next++}__`;
|
|
1432
1506
|
lines.push(`import * as ${local} from ${JSON.stringify(entry.specifier)};`);
|
|
1433
1507
|
for (const value of entry.namespace.values) fields.push(`${value}: ${local}.${value}`);
|
|
@@ -1486,7 +1560,7 @@ function stampPackagePath(target, kind) {
|
|
|
1486
1560
|
const stat = _fs2.default.statSync(target, { throwIfNoEntry: false });
|
|
1487
1561
|
if (!stat || (kind === "file" ? !stat.isFile() : !stat.isDirectory())) return void 0;
|
|
1488
1562
|
return [target, stat.size, stat.mtimeMs, stat.ctimeMs];
|
|
1489
|
-
} catch (
|
|
1563
|
+
} catch (e22) {
|
|
1490
1564
|
return void 0;
|
|
1491
1565
|
}
|
|
1492
1566
|
}
|
|
@@ -1522,7 +1596,7 @@ var PackageClientBoundaryCache = class {
|
|
|
1522
1596
|
else this.dirty = true;
|
|
1523
1597
|
}
|
|
1524
1598
|
}
|
|
1525
|
-
return _optionalChain([entries, 'optionalAccess',
|
|
1599
|
+
return _optionalChain([entries, 'optionalAccess', _73 => _73.find, 'call', _74 => _74(
|
|
1526
1600
|
(entry) => entry.stops.every((file) => visited.has(file)) && !entry.files.some((file) => visited.has(file))
|
|
1527
1601
|
)]);
|
|
1528
1602
|
}
|
|
@@ -1541,7 +1615,7 @@ var PackageClientBoundaryCache = class {
|
|
|
1541
1615
|
await _fs2.default.promises.mkdir(_path2.default.dirname(file), { recursive: true });
|
|
1542
1616
|
await _fs2.default.promises.writeFile(temporary, contents);
|
|
1543
1617
|
await _fs2.default.promises.rename(temporary, file);
|
|
1544
|
-
} catch (
|
|
1618
|
+
} catch (e23) {
|
|
1545
1619
|
await _fs2.default.promises.rm(temporary, { force: true }).catch(() => {
|
|
1546
1620
|
});
|
|
1547
1621
|
}
|
|
@@ -1556,10 +1630,10 @@ var PackageClientBoundaryCache = class {
|
|
|
1556
1630
|
_fs2.default.mkdirSync(_path2.default.dirname(file), { recursive: true });
|
|
1557
1631
|
_fs2.default.writeFileSync(temporary, contents);
|
|
1558
1632
|
_fs2.default.renameSync(temporary, file);
|
|
1559
|
-
} catch (
|
|
1633
|
+
} catch (e24) {
|
|
1560
1634
|
try {
|
|
1561
1635
|
_fs2.default.rmSync(temporary, { force: true });
|
|
1562
|
-
} catch (
|
|
1636
|
+
} catch (e25) {
|
|
1563
1637
|
}
|
|
1564
1638
|
}
|
|
1565
1639
|
}
|
|
@@ -1593,7 +1667,7 @@ var PackageClientBoundaryCache = class {
|
|
|
1593
1667
|
}
|
|
1594
1668
|
const contents = JSON.stringify({
|
|
1595
1669
|
schema: SCHEMA_VERSION,
|
|
1596
|
-
farm:
|
|
1670
|
+
farm: _chunkSQ6IWJ3Hcjs.FARM_VERSION,
|
|
1597
1671
|
paths,
|
|
1598
1672
|
entries
|
|
1599
1673
|
});
|
|
@@ -1630,10 +1704,10 @@ function readStoredCache(file) {
|
|
|
1630
1704
|
let value;
|
|
1631
1705
|
try {
|
|
1632
1706
|
value = JSON.parse(_fs2.default.readFileSync(file, "utf8"));
|
|
1633
|
-
} catch (
|
|
1707
|
+
} catch (e26) {
|
|
1634
1708
|
return null;
|
|
1635
1709
|
}
|
|
1636
|
-
if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !==
|
|
1710
|
+
if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !== _chunkSQ6IWJ3Hcjs.FARM_VERSION) {
|
|
1637
1711
|
return null;
|
|
1638
1712
|
}
|
|
1639
1713
|
const { paths, entries } = value;
|
|
@@ -1644,7 +1718,7 @@ function readStoredCache(file) {
|
|
|
1644
1718
|
const usable = variants.filter((entry) => isStoredEntry(entry, paths.length));
|
|
1645
1719
|
if (usable.length > 0) valid[key] = usable;
|
|
1646
1720
|
}
|
|
1647
|
-
return { schema: SCHEMA_VERSION, farm:
|
|
1721
|
+
return { schema: SCHEMA_VERSION, farm: _chunkSQ6IWJ3Hcjs.FARM_VERSION, paths, entries: valid };
|
|
1648
1722
|
}
|
|
1649
1723
|
function isRecord(value) {
|
|
1650
1724
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -1683,7 +1757,7 @@ async function withPackageClientBoundaryCache(operation) {
|
|
|
1683
1757
|
}
|
|
1684
1758
|
}
|
|
1685
1759
|
function usePackageClientBoundaryCacheFile(file) {
|
|
1686
|
-
_optionalChain([getPackageClientBoundaryCache, 'call',
|
|
1760
|
+
_optionalChain([getPackageClientBoundaryCache, 'call', _75 => _75(), 'optionalAccess', _76 => _76.load, 'call', _77 => _77(file)]);
|
|
1687
1761
|
}
|
|
1688
1762
|
function resolvePackageClientBoundaryCacheFile(root, distDir) {
|
|
1689
1763
|
return _path2.default.resolve(root, distDir, "cache", "client-boundaries.json");
|
|
@@ -1704,7 +1778,7 @@ function readIfExists(filePath) {
|
|
|
1704
1778
|
return null;
|
|
1705
1779
|
}
|
|
1706
1780
|
return _fs2.default.readFileSync(filePath, "utf-8");
|
|
1707
|
-
} catch (
|
|
1781
|
+
} catch (e27) {
|
|
1708
1782
|
return null;
|
|
1709
1783
|
}
|
|
1710
1784
|
}
|
|
@@ -1717,7 +1791,7 @@ function resolveModuleSourcePath(modulePath, root) {
|
|
|
1717
1791
|
if (modulePath.startsWith("file://")) {
|
|
1718
1792
|
try {
|
|
1719
1793
|
candidates.add(_url.fileURLToPath.call(void 0, modulePath));
|
|
1720
|
-
} catch (
|
|
1794
|
+
} catch (e28) {
|
|
1721
1795
|
}
|
|
1722
1796
|
}
|
|
1723
1797
|
if (modulePath.startsWith("/@fs/")) {
|
|
@@ -1730,7 +1804,7 @@ function resolveModuleSourcePath(modulePath, root) {
|
|
|
1730
1804
|
candidates.add(_path2.default.join(root, normalized));
|
|
1731
1805
|
candidates.add(_path2.default.resolve(root, normalized));
|
|
1732
1806
|
}
|
|
1733
|
-
if (_optionalChain([withoutQuery, 'optionalAccess',
|
|
1807
|
+
if (_optionalChain([withoutQuery, 'optionalAccess', _78 => _78.startsWith, 'call', _79 => _79("/src/")])) {
|
|
1734
1808
|
const normalized = withoutQuery.replace(/^\/+/, "");
|
|
1735
1809
|
candidates.add(_path2.default.join(process.cwd(), normalized));
|
|
1736
1810
|
candidates.add(_path2.default.resolve(process.cwd(), normalized));
|
|
@@ -1809,7 +1883,7 @@ function hasHydrateExport(content) {
|
|
|
1809
1883
|
for (const match of content.matchAll(/\bexport\s*\{([^}]*)\}/g)) {
|
|
1810
1884
|
for (const specifier of match[1].split(",")) {
|
|
1811
1885
|
const parts = specifier.trim().split(/\s+as\s+/);
|
|
1812
|
-
const exportedName2 = _optionalChain([(_nullishCoalesce(parts[1], () => ( parts[0]))), 'optionalAccess',
|
|
1886
|
+
const exportedName2 = _optionalChain([(_nullishCoalesce(parts[1], () => ( parts[0]))), 'optionalAccess', _80 => _80.trim, 'call', _81 => _81()]);
|
|
1813
1887
|
if (exportedName2 === "hydrate") {
|
|
1814
1888
|
return true;
|
|
1815
1889
|
}
|
|
@@ -1886,13 +1960,35 @@ function skipRegularExpression(content, startIndex) {
|
|
|
1886
1960
|
}
|
|
1887
1961
|
return null;
|
|
1888
1962
|
}
|
|
1963
|
+
var tokenizedModules = /* @__PURE__ */ new Map();
|
|
1964
|
+
var TOKENIZED_MODULE_CACHE_SIZE = 32;
|
|
1889
1965
|
function tokenizeModuleSource(content) {
|
|
1966
|
+
const cached = tokenizedModules.get(content);
|
|
1967
|
+
if (cached) return cached;
|
|
1968
|
+
const tokens = scanModuleSourceTokens(content);
|
|
1969
|
+
if (tokenizedModules.size >= TOKENIZED_MODULE_CACHE_SIZE) {
|
|
1970
|
+
tokenizedModules.delete(tokenizedModules.keys().next().value);
|
|
1971
|
+
}
|
|
1972
|
+
tokenizedModules.set(content, tokens);
|
|
1973
|
+
return tokens;
|
|
1974
|
+
}
|
|
1975
|
+
function isWhitespaceCode(code) {
|
|
1976
|
+
if (code < 128) return code === 32 || code >= 9 && code <= 13;
|
|
1977
|
+
return /\s/.test(String.fromCharCode(code));
|
|
1978
|
+
}
|
|
1979
|
+
function isIdentifierStartCode(code) {
|
|
1980
|
+
return code >= 97 && code <= 122 || code >= 65 && code <= 90 || code === 95 || code === 36;
|
|
1981
|
+
}
|
|
1982
|
+
function isIdentifierPartCode(code) {
|
|
1983
|
+
return isIdentifierStartCode(code) || code >= 48 && code <= 57;
|
|
1984
|
+
}
|
|
1985
|
+
function scanModuleSourceTokens(content) {
|
|
1890
1986
|
const tokens = [];
|
|
1891
1987
|
let index = 0;
|
|
1892
1988
|
let line = 1;
|
|
1893
1989
|
while (index < content.length) {
|
|
1894
1990
|
const character = content[index];
|
|
1895
|
-
if (
|
|
1991
|
+
if (isWhitespaceCode(content.charCodeAt(index))) {
|
|
1896
1992
|
if (character === "\n") line++;
|
|
1897
1993
|
index++;
|
|
1898
1994
|
continue;
|
|
@@ -1962,9 +2058,9 @@ function tokenizeModuleSource(content) {
|
|
|
1962
2058
|
}
|
|
1963
2059
|
continue;
|
|
1964
2060
|
}
|
|
1965
|
-
if (
|
|
2061
|
+
if (isIdentifierStartCode(content.charCodeAt(index))) {
|
|
1966
2062
|
const start = index++;
|
|
1967
|
-
while (index < content.length &&
|
|
2063
|
+
while (index < content.length && isIdentifierPartCode(content.charCodeAt(index))) index++;
|
|
1968
2064
|
tokens.push({ kind: "identifier", value: content.slice(start, index), line });
|
|
1969
2065
|
continue;
|
|
1970
2066
|
}
|
|
@@ -1977,7 +2073,7 @@ function isIslandExportStart(tokens, index) {
|
|
|
1977
2073
|
const token = tokens[index];
|
|
1978
2074
|
const previous = tokens[index - 1];
|
|
1979
2075
|
const startsStatement = !previous || previous.value === ";" || previous.value === "{" || previous.value === "}" || token.line > previous.line;
|
|
1980
|
-
return startsStatement && token.value === "export" && _optionalChain([tokens, 'access',
|
|
2076
|
+
return startsStatement && token.value === "export" && _optionalChain([tokens, 'access', _82 => _82[index + 1], 'optionalAccess', _83 => _83.value]) === "const" && _optionalChain([tokens, 'access', _84 => _84[index + 2], 'optionalAccess', _85 => _85.value]) === "island";
|
|
1981
2077
|
}
|
|
1982
2078
|
function getIslandStrategyExport(content) {
|
|
1983
2079
|
if (!content) return null;
|
|
@@ -1985,15 +2081,15 @@ function getIslandStrategyExport(content) {
|
|
|
1985
2081
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
1986
2082
|
if (!isIslandExportStart(tokens, index)) continue;
|
|
1987
2083
|
let valueIndex = index + 3;
|
|
1988
|
-
if (_optionalChain([tokens, 'access',
|
|
2084
|
+
if (_optionalChain([tokens, 'access', _86 => _86[valueIndex], 'optionalAccess', _87 => _87.value]) === ":") {
|
|
1989
2085
|
while (valueIndex < tokens.length && tokens[valueIndex].value !== "=") valueIndex++;
|
|
1990
2086
|
}
|
|
1991
|
-
if (_optionalChain([tokens, 'access',
|
|
2087
|
+
if (_optionalChain([tokens, 'access', _88 => _88[valueIndex], 'optionalAccess', _89 => _89.value]) !== "=") break;
|
|
1992
2088
|
valueIndex++;
|
|
1993
2089
|
const literal = tokens[valueIndex];
|
|
1994
2090
|
if (!literal || literal.kind !== "string" || !_chunk7KJJ4SBScjs.isFarmIslandStrategy.call(void 0, literal.value)) break;
|
|
1995
2091
|
let trailingIndex = valueIndex + 1;
|
|
1996
|
-
if (_optionalChain([tokens, 'access',
|
|
2092
|
+
if (_optionalChain([tokens, 'access', _90 => _90[trailingIndex], 'optionalAccess', _91 => _91.value]) === "as" && _optionalChain([tokens, 'access', _92 => _92[trailingIndex + 1], 'optionalAccess', _93 => _93.value]) === "const") {
|
|
1997
2093
|
trailingIndex += 2;
|
|
1998
2094
|
}
|
|
1999
2095
|
const trailing = tokens[trailingIndex];
|
|
@@ -2019,13 +2115,13 @@ function hasAsyncDefaultExport(content) {
|
|
|
2019
2115
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
2020
2116
|
const token = tokens[index];
|
|
2021
2117
|
if (token.kind !== "identifier" || token.value !== "export") continue;
|
|
2022
|
-
if (_optionalChain([tokens, 'access',
|
|
2023
|
-
if (_optionalChain([tokens, 'access',
|
|
2118
|
+
if (_optionalChain([tokens, 'access', _94 => _94[index - 1], 'optionalAccess', _95 => _95.value]) === ".") continue;
|
|
2119
|
+
if (_optionalChain([tokens, 'access', _96 => _96[index + 1], 'optionalAccess', _97 => _97.value]) !== "default") continue;
|
|
2024
2120
|
const exported = tokens[index + 2];
|
|
2025
2121
|
if (exported.kind === "identifier" && exported.value === "async") {
|
|
2026
2122
|
return true;
|
|
2027
2123
|
}
|
|
2028
|
-
if (exported.kind === "identifier" && !["function", "class"].includes(exported.value) && _optionalChain([tokens, 'access',
|
|
2124
|
+
if (exported.kind === "identifier" && !["function", "class"].includes(exported.value) && _optionalChain([tokens, 'access', _98 => _98[index + 3], 'optionalAccess', _99 => _99.value]) !== "(" && isAsyncLocalDeclaration(tokens, exported.value)) {
|
|
2029
2125
|
return true;
|
|
2030
2126
|
}
|
|
2031
2127
|
}
|
|
@@ -2033,10 +2129,10 @@ function hasAsyncDefaultExport(content) {
|
|
|
2033
2129
|
}
|
|
2034
2130
|
function isAsyncLocalDeclaration(tokens, name) {
|
|
2035
2131
|
for (let index = 0; index < tokens.length - 2; index++) {
|
|
2036
|
-
if (tokens[index].value === "async" && _optionalChain([tokens, 'access',
|
|
2132
|
+
if (tokens[index].value === "async" && _optionalChain([tokens, 'access', _100 => _100[index + 1], 'optionalAccess', _101 => _101.value]) === "function" && _optionalChain([tokens, 'access', _102 => _102[index + 2], 'optionalAccess', _103 => _103.value]) === name) {
|
|
2037
2133
|
return true;
|
|
2038
2134
|
}
|
|
2039
|
-
if (tokens[index].value === name && _optionalChain([tokens, 'access',
|
|
2135
|
+
if (tokens[index].value === name && _optionalChain([tokens, 'access', _104 => _104[index + 1], 'optionalAccess', _105 => _105.value]) === "=" && _optionalChain([tokens, 'access', _106 => _106[index + 2], 'optionalAccess', _107 => _107.value]) === "async") {
|
|
2040
2136
|
return true;
|
|
2041
2137
|
}
|
|
2042
2138
|
}
|
|
@@ -2237,7 +2333,7 @@ function planClientModuleHydration(modulePath, root, mode, options) {
|
|
|
2237
2333
|
return plan;
|
|
2238
2334
|
}
|
|
2239
2335
|
function usesFarmServerTree(plan) {
|
|
2240
|
-
return _optionalChain([plan, 'optionalAccess',
|
|
2336
|
+
return _optionalChain([plan, 'optionalAccess', _108 => _108.asyncOwnerIslands]) === true && plan.isolatedBoundaries.length > 0 && plan.isolatedBoundaries.every((boundary) => boundary.islandStrategy === "load");
|
|
2241
2337
|
}
|
|
2242
2338
|
function getMarkdownPageHydrationPlan(componentsModulePath, root, mode = "off", options = {}) {
|
|
2243
2339
|
const plan = {
|
|
@@ -2368,7 +2464,7 @@ function getStaticImportBindings(content) {
|
|
|
2368
2464
|
if (!content) return bindings;
|
|
2369
2465
|
const tokens = tokenizeModuleSource(content);
|
|
2370
2466
|
for (let index = 0; index < tokens.length; index++) {
|
|
2371
|
-
if (tokens[index].value !== "import" || _optionalChain([tokens, 'access',
|
|
2467
|
+
if (tokens[index].value !== "import" || _optionalChain([tokens, 'access', _109 => _109[index - 1], 'optionalAccess', _110 => _110.value]) === ".") continue;
|
|
2372
2468
|
const first = tokens[index + 1];
|
|
2373
2469
|
if (!first || first.value === "type" || first.value === "(" || first.kind === "string") {
|
|
2374
2470
|
continue;
|
|
@@ -2376,7 +2472,7 @@ function getStaticImportBindings(content) {
|
|
|
2376
2472
|
let fromIndex = -1;
|
|
2377
2473
|
for (let cursor = index + 1; cursor < tokens.length; cursor++) {
|
|
2378
2474
|
if (tokens[cursor].value === ";") break;
|
|
2379
|
-
if (tokens[cursor].value === "from" && _optionalChain([tokens, 'access',
|
|
2475
|
+
if (tokens[cursor].value === "from" && _optionalChain([tokens, 'access', _111 => _111[cursor + 1], 'optionalAccess', _112 => _112.kind]) === "string") {
|
|
2380
2476
|
fromIndex = cursor;
|
|
2381
2477
|
break;
|
|
2382
2478
|
}
|
|
@@ -2385,13 +2481,13 @@ function getStaticImportBindings(content) {
|
|
|
2385
2481
|
const specifier = tokens[fromIndex + 1].value;
|
|
2386
2482
|
const clause = tokens.slice(index + 1, fromIndex);
|
|
2387
2483
|
const localNames = [];
|
|
2388
|
-
if (_optionalChain([clause, 'access',
|
|
2484
|
+
if (_optionalChain([clause, 'access', _113 => _113[0], 'optionalAccess', _114 => _114.kind]) === "identifier" && clause[0].value !== "type") {
|
|
2389
2485
|
localNames.push(clause[0].value);
|
|
2390
2486
|
}
|
|
2391
2487
|
const namespaceAs = clause.findIndex(
|
|
2392
|
-
(token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access',
|
|
2488
|
+
(token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access', _115 => _115[clauseIndex + 1], 'optionalAccess', _116 => _116.value]) === "as"
|
|
2393
2489
|
);
|
|
2394
|
-
if (namespaceAs !== -1 && _optionalChain([clause, 'access',
|
|
2490
|
+
if (namespaceAs !== -1 && _optionalChain([clause, 'access', _117 => _117[namespaceAs + 2], 'optionalAccess', _118 => _118.kind]) === "identifier") {
|
|
2395
2491
|
localNames.push(clause[namespaceAs + 2].value);
|
|
2396
2492
|
}
|
|
2397
2493
|
const openingBrace = clause.findIndex((token) => token.value === "{");
|
|
@@ -2401,11 +2497,11 @@ function getStaticImportBindings(content) {
|
|
|
2401
2497
|
if (openingBrace !== -1 && closingBrace !== -1) {
|
|
2402
2498
|
let entryStart = openingBrace + 1;
|
|
2403
2499
|
for (let cursor = entryStart; cursor <= closingBrace; cursor++) {
|
|
2404
|
-
if (cursor !== closingBrace && _optionalChain([clause, 'access',
|
|
2500
|
+
if (cursor !== closingBrace && _optionalChain([clause, 'access', _119 => _119[cursor], 'optionalAccess', _120 => _120.value]) !== ",") continue;
|
|
2405
2501
|
const entry = clause.slice(entryStart, cursor).filter((token) => token.value !== "type");
|
|
2406
2502
|
const asIndex = entry.findIndex((token) => token.value === "as");
|
|
2407
2503
|
const local = asIndex === -1 ? entry[0] : entry[asIndex + 1];
|
|
2408
|
-
if (_optionalChain([local, 'optionalAccess',
|
|
2504
|
+
if (_optionalChain([local, 'optionalAccess', _121 => _121.kind]) === "identifier") localNames.push(local.value);
|
|
2409
2505
|
entryStart = cursor + 1;
|
|
2410
2506
|
}
|
|
2411
2507
|
}
|
|
@@ -2442,14 +2538,14 @@ function findParserSensitiveJsxContainer(content, localBindings) {
|
|
|
2442
2538
|
const open = [];
|
|
2443
2539
|
const isSelfClosing = (openingIndex) => {
|
|
2444
2540
|
for (let index = openingIndex; index < tokens.length; index++) {
|
|
2445
|
-
if (tokens[index].value === ">") return _optionalChain([tokens, 'access',
|
|
2541
|
+
if (tokens[index].value === ">") return _optionalChain([tokens, 'access', _122 => _122[index - 1], 'optionalAccess', _123 => _123.value]) === "/";
|
|
2446
2542
|
}
|
|
2447
2543
|
return false;
|
|
2448
2544
|
};
|
|
2449
2545
|
for (let index = 0; index < tokens.length - 1; index++) {
|
|
2450
2546
|
if (tokens[index].value !== "<") continue;
|
|
2451
2547
|
if (tokens[index + 1].value === "/") {
|
|
2452
|
-
const closing = _optionalChain([tokens, 'access',
|
|
2548
|
+
const closing = _optionalChain([tokens, 'access', _124 => _124[index + 2], 'optionalAccess', _125 => _125.value]);
|
|
2453
2549
|
const at = closing ? open.lastIndexOf(closing) : -1;
|
|
2454
2550
|
if (at !== -1) open.length = at;
|
|
2455
2551
|
continue;
|
|
@@ -2492,7 +2588,7 @@ function findMatchingToken(tokens, openingIndex, opening, closing) {
|
|
|
2492
2588
|
}
|
|
2493
2589
|
function containsClientJsx(tokens, start, end, clientBindings) {
|
|
2494
2590
|
for (let index = start; index < end; index++) {
|
|
2495
|
-
if (tokens[index].value === "<" && clientBindings.has(_optionalChain([tokens, 'access',
|
|
2591
|
+
if (tokens[index].value === "<" && clientBindings.has(_optionalChain([tokens, 'access', _126 => _126[index + 1], 'optionalAccess', _127 => _127.value]))) return true;
|
|
2496
2592
|
}
|
|
2497
2593
|
return false;
|
|
2498
2594
|
}
|
|
@@ -2530,7 +2626,7 @@ function getClientRenderingHelpers(tokens, clientBindings) {
|
|
|
2530
2626
|
let helperName;
|
|
2531
2627
|
let bodyStart = -1;
|
|
2532
2628
|
let bodyEnd = -1;
|
|
2533
|
-
if (tokens[index].value === "function" && _optionalChain([tokens, 'access',
|
|
2629
|
+
if (tokens[index].value === "function" && _optionalChain([tokens, 'access', _128 => _128[index + 1], 'optionalAccess', _129 => _129.kind]) === "identifier") {
|
|
2534
2630
|
helperName = tokens[index + 1].value;
|
|
2535
2631
|
const parametersStart = tokens.findIndex(
|
|
2536
2632
|
(token, tokenIndex) => tokenIndex > index + 1 && token.value === "("
|
|
@@ -2540,21 +2636,21 @@ function getClientRenderingHelpers(tokens, clientBindings) {
|
|
|
2540
2636
|
(token, tokenIndex) => tokenIndex > parametersEnd && token.value === "{"
|
|
2541
2637
|
);
|
|
2542
2638
|
if (bodyStart !== -1) bodyEnd = findMatchingToken(tokens, bodyStart, "{", "}");
|
|
2543
|
-
} else if ((tokens[index].value === "const" || tokens[index].value === "let" || tokens[index].value === "var") && _optionalChain([tokens, 'access',
|
|
2639
|
+
} else if ((tokens[index].value === "const" || tokens[index].value === "let" || tokens[index].value === "var") && _optionalChain([tokens, 'access', _130 => _130[index + 1], 'optionalAccess', _131 => _131.kind]) === "identifier") {
|
|
2544
2640
|
helperName = tokens[index + 1].value;
|
|
2545
2641
|
let assignmentIndex = -1;
|
|
2546
2642
|
let arrowIndex = -1;
|
|
2547
2643
|
for (let cursor = index + 2; cursor < tokens.length; cursor++) {
|
|
2548
2644
|
if (tokens[cursor].value === ";") break;
|
|
2549
2645
|
if (assignmentIndex === -1 && tokens[cursor].value === "=") assignmentIndex = cursor;
|
|
2550
|
-
if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access',
|
|
2646
|
+
if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access', _132 => _132[cursor + 1], 'optionalAccess', _133 => _133.value]) === ">") {
|
|
2551
2647
|
arrowIndex = cursor;
|
|
2552
2648
|
break;
|
|
2553
2649
|
}
|
|
2554
2650
|
}
|
|
2555
2651
|
if (arrowIndex !== -1) {
|
|
2556
2652
|
bodyStart = arrowIndex + 2;
|
|
2557
|
-
bodyEnd = _optionalChain([tokens, 'access',
|
|
2653
|
+
bodyEnd = _optionalChain([tokens, 'access', _134 => _134[bodyStart], 'optionalAccess', _135 => _135.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : findStatementEnd(tokens, bodyStart);
|
|
2558
2654
|
} else if (assignmentIndex !== -1) {
|
|
2559
2655
|
bodyStart = assignmentIndex + 1;
|
|
2560
2656
|
bodyEnd = findStatementEnd(tokens, bodyStart);
|
|
@@ -2594,14 +2690,14 @@ function passesElementValuedProps(content, localBindings) {
|
|
|
2594
2690
|
else if (value === "}") braceDepth--;
|
|
2595
2691
|
else if (value === "<" && braceDepth > 0) return true;
|
|
2596
2692
|
else if (value === ">" && braceDepth === 0) {
|
|
2597
|
-
selfClosing = _optionalChain([tokens, 'access',
|
|
2693
|
+
selfClosing = _optionalChain([tokens, 'access', _136 => _136[cursor - 1], 'optionalAccess', _137 => _137.value]) === "/";
|
|
2598
2694
|
break;
|
|
2599
2695
|
}
|
|
2600
2696
|
}
|
|
2601
2697
|
if (selfClosing || cursor >= tokens.length) continue;
|
|
2602
2698
|
for (let child = cursor + 1; child < tokens.length; child++) {
|
|
2603
2699
|
if (tokens[child].value !== "<") continue;
|
|
2604
|
-
const closesBoundary = _optionalChain([tokens, 'access',
|
|
2700
|
+
const closesBoundary = _optionalChain([tokens, 'access', _138 => _138[child + 1], 'optionalAccess', _139 => _139.value]) === "/" && _optionalChain([tokens, 'access', _140 => _140[child + 2], 'optionalAccess', _141 => _141.value]) === name;
|
|
2605
2701
|
if (!closesBoundary) return true;
|
|
2606
2702
|
break;
|
|
2607
2703
|
}
|
|
@@ -2623,7 +2719,7 @@ function rendersOnlyLeafElements(content, localBindings) {
|
|
|
2623
2719
|
else if (value === "<" && braceDepth > 0) return false;
|
|
2624
2720
|
else if (value === ">" && braceDepth === 0) break;
|
|
2625
2721
|
}
|
|
2626
|
-
if (cursor >= tokens.length || _optionalChain([tokens, 'access',
|
|
2722
|
+
if (cursor >= tokens.length || _optionalChain([tokens, 'access', _142 => _142[cursor - 1], 'optionalAccess', _143 => _143.value]) !== "/") return false;
|
|
2627
2723
|
}
|
|
2628
2724
|
return true;
|
|
2629
2725
|
}
|
|
@@ -2635,9 +2731,9 @@ function hasDynamicJsxCardinality(content, localBindings) {
|
|
|
2635
2731
|
const containsDynamicRenderer = (start, end) => containsClientJsx(tokens, start, end, clientBindings) || tokens.slice(start, end).some((token) => renderingHelpers.has(token.value));
|
|
2636
2732
|
for (let index = 0; index < tokens.length; index++) {
|
|
2637
2733
|
let callStart = -1;
|
|
2638
|
-
if (tokens[index].value === "." && (_optionalChain([tokens, 'access',
|
|
2734
|
+
if (tokens[index].value === "." && (_optionalChain([tokens, 'access', _144 => _144[index + 1], 'optionalAccess', _145 => _145.value]) === "map" || _optionalChain([tokens, 'access', _146 => _146[index + 1], 'optionalAccess', _147 => _147.value]) === "flatMap") && _optionalChain([tokens, 'access', _148 => _148[index + 2], 'optionalAccess', _149 => _149.value]) === "(") {
|
|
2639
2735
|
callStart = index + 2;
|
|
2640
|
-
} else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access',
|
|
2736
|
+
} else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access', _150 => _150[index + 1], 'optionalAccess', _151 => _151.value]) === "." && _optionalChain([tokens, 'access', _152 => _152[index + 2], 'optionalAccess', _153 => _153.value]) === "from" && _optionalChain([tokens, 'access', _154 => _154[index + 3], 'optionalAccess', _155 => _155.value]) === "(") {
|
|
2641
2737
|
callStart = index + 3;
|
|
2642
2738
|
}
|
|
2643
2739
|
if (callStart !== -1) {
|
|
@@ -2646,10 +2742,10 @@ function hasDynamicJsxCardinality(content, localBindings) {
|
|
|
2646
2742
|
index = callEnd;
|
|
2647
2743
|
continue;
|
|
2648
2744
|
}
|
|
2649
|
-
if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access',
|
|
2745
|
+
if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access', _156 => _156[index + 1], 'optionalAccess', _157 => _157.value]) === "(") {
|
|
2650
2746
|
const conditionEnd = findMatchingToken(tokens, index + 1, "(", ")");
|
|
2651
2747
|
const bodyStart = conditionEnd + 1;
|
|
2652
|
-
const bodyEnd = _optionalChain([tokens, 'access',
|
|
2748
|
+
const bodyEnd = _optionalChain([tokens, 'access', _158 => _158[bodyStart], 'optionalAccess', _159 => _159.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : tokens.findIndex((token, tokenIndex) => tokenIndex > bodyStart && token.value === ";");
|
|
2653
2749
|
if (containsDynamicRenderer(bodyStart, bodyEnd === -1 ? tokens.length : bodyEnd)) return true;
|
|
2654
2750
|
}
|
|
2655
2751
|
}
|
|
@@ -2673,11 +2769,6 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
2673
2769
|
const content = readIfExists(moduleSourcePath);
|
|
2674
2770
|
const parsed = parseClientModuleMetadata(content, false);
|
|
2675
2771
|
if (parsed.isClientComponent) {
|
|
2676
|
-
if (projectRoot && !_path2.default.resolve(moduleSourcePath).startsWith(`${projectRoot}${_path2.default.sep}`)) {
|
|
2677
|
-
fallbackReason = `client boundary ${moduleSourcePath} is outside the application root`;
|
|
2678
|
-
fallbackHint = "Move the component into the application, or publish it as a package (package client components render as static HTML)";
|
|
2679
|
-
return 0;
|
|
2680
|
-
}
|
|
2681
2772
|
if (!isIsolatableClientBoundarySource(content)) {
|
|
2682
2773
|
fallbackReason = `client boundary ${moduleSourcePath} uses an unsupported export shape`;
|
|
2683
2774
|
fallbackHint = "Export each component by name (`export function Name`, `export { Name }`, or `export default`) instead of `export *`";
|
|
@@ -2703,15 +2794,23 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
2703
2794
|
const importedPath = imported.path;
|
|
2704
2795
|
if (!importedPath) continue;
|
|
2705
2796
|
let importedBoundaryCount;
|
|
2797
|
+
const workspaceEntry = !imported.local && options.packageReferences ? farmWorkspaceServerEntry(importedPath) : null;
|
|
2706
2798
|
if (imported.local) {
|
|
2707
2799
|
importedBoundaryCount = visit(importedPath);
|
|
2800
|
+
} else if (workspaceEntry) {
|
|
2801
|
+
importedBoundaryCount = visit(workspaceEntry);
|
|
2708
2802
|
} else {
|
|
2709
2803
|
const reactServerClientNames = options.packageReferences && projectRoot ? findFarmReactServerClientNames(_nullishCoalesce(content, () => ( "")), moduleSourcePath, specifier) : null;
|
|
2710
2804
|
if (reactServerClientNames) {
|
|
2711
2805
|
importedBoundaryCount = 0;
|
|
2712
2806
|
for (const exportName of reactServerClientNames) {
|
|
2713
2807
|
importedBoundaryCount += visit(
|
|
2714
|
-
ensureFarmPackageClientReference(
|
|
2808
|
+
ensureFarmPackageClientReference(
|
|
2809
|
+
projectRoot,
|
|
2810
|
+
specifier,
|
|
2811
|
+
exportName,
|
|
2812
|
+
moduleSourcePath
|
|
2813
|
+
)
|
|
2715
2814
|
);
|
|
2716
2815
|
}
|
|
2717
2816
|
for (const clientFile of _nullishCoalesce(findFarmReactServerClientModules(
|
|
@@ -2735,7 +2834,12 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
|
|
|
2735
2834
|
for (const reference of references) {
|
|
2736
2835
|
for (const exportName of farmPackageClientImportExports(reference)) {
|
|
2737
2836
|
importedBoundaryCount += visit(
|
|
2738
|
-
ensureFarmPackageClientReference(
|
|
2837
|
+
ensureFarmPackageClientReference(
|
|
2838
|
+
projectRoot,
|
|
2839
|
+
specifier,
|
|
2840
|
+
exportName,
|
|
2841
|
+
moduleSourcePath
|
|
2842
|
+
)
|
|
2739
2843
|
);
|
|
2740
2844
|
}
|
|
2741
2845
|
}
|
|
@@ -2838,10 +2942,16 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
|
|
|
2838
2942
|
islandStrategy: shouldHydrate ? _nullishCoalesce(_nullishCoalesce(parsed.islandStrategy, () => ( importedIslandStrategy)), () => ( "load")) : null
|
|
2839
2943
|
};
|
|
2840
2944
|
}
|
|
2945
|
+
function farmWorkspaceServerEntry(entry) {
|
|
2946
|
+
const real = realpathOrSelf(entry);
|
|
2947
|
+
if (real.split(_path2.default.sep).includes("node_modules")) return null;
|
|
2948
|
+
if (parseClientModuleMetadata(readIfExists(real), false).isClientComponent) return null;
|
|
2949
|
+
return real;
|
|
2950
|
+
}
|
|
2841
2951
|
function realpathOrSelf(file) {
|
|
2842
2952
|
try {
|
|
2843
2953
|
return _fs2.default.realpathSync(file);
|
|
2844
|
-
} catch (
|
|
2954
|
+
} catch (e29) {
|
|
2845
2955
|
return file;
|
|
2846
2956
|
}
|
|
2847
2957
|
}
|
|
@@ -2868,7 +2978,7 @@ function inspectPackageClientBoundary(resolvedPath, root, visited) {
|
|
|
2868
2978
|
}
|
|
2869
2979
|
function traversePackageClientBoundary(resolvedPath, root, visited, trace) {
|
|
2870
2980
|
if (!resolvedPath || visited.has(resolvedPath)) {
|
|
2871
|
-
if (resolvedPath) _optionalChain([trace, 'optionalAccess',
|
|
2981
|
+
if (resolvedPath) _optionalChain([trace, 'optionalAccess', _160 => _160.stop, 'call', _161 => _161(resolvedPath)]);
|
|
2872
2982
|
return {
|
|
2873
2983
|
isClientComponent: false,
|
|
2874
2984
|
shouldHydrate: false,
|
|
@@ -2876,7 +2986,7 @@ function traversePackageClientBoundary(resolvedPath, root, visited, trace) {
|
|
|
2876
2986
|
};
|
|
2877
2987
|
}
|
|
2878
2988
|
visited.add(resolvedPath);
|
|
2879
|
-
_optionalChain([trace, 'optionalAccess',
|
|
2989
|
+
_optionalChain([trace, 'optionalAccess', _162 => _162.visit, 'call', _163 => _163(resolvedPath)]);
|
|
2880
2990
|
const content = readIfExists(resolvedPath);
|
|
2881
2991
|
const parsed = parseClientModuleMetadata(content, false);
|
|
2882
2992
|
let importsClientBoundary = false;
|
|
@@ -2926,7 +3036,7 @@ function getImportSpecifiers(content, { reexportsOnly = false, dynamic = false }
|
|
|
2926
3036
|
braceDepth = Math.max(0, braceDepth - 1);
|
|
2927
3037
|
continue;
|
|
2928
3038
|
}
|
|
2929
|
-
if (dynamic && keyword.kind === "identifier" && keyword.value === "import" && _optionalChain([tokens, 'access',
|
|
3039
|
+
if (dynamic && keyword.kind === "identifier" && keyword.value === "import" && _optionalChain([tokens, 'access', _164 => _164[index - 1], 'optionalAccess', _165 => _165.value]) !== "." && _optionalChain([tokens, 'access', _166 => _166[index + 1], 'optionalAccess', _167 => _167.value]) === "(" && _optionalChain([tokens, 'access', _168 => _168[index + 2], 'optionalAccess', _169 => _169.kind]) === "string") {
|
|
2930
3040
|
matches.add(tokens[index + 2].value);
|
|
2931
3041
|
continue;
|
|
2932
3042
|
}
|
|
@@ -2936,7 +3046,7 @@ function getImportSpecifiers(content, { reexportsOnly = false, dynamic = false }
|
|
|
2936
3046
|
}
|
|
2937
3047
|
if (reexportsOnly && keyword.value !== "export") continue;
|
|
2938
3048
|
const previous = tokens[index - 1];
|
|
2939
|
-
if (_optionalChain([previous, 'optionalAccess',
|
|
3049
|
+
if (_optionalChain([previous, 'optionalAccess', _170 => _170.value]) === ".") continue;
|
|
2940
3050
|
const first = tokens[index + 1];
|
|
2941
3051
|
if (!first || first.value === "type" || first.value === "(" || first.value === ".") {
|
|
2942
3052
|
continue;
|
|
@@ -2952,7 +3062,7 @@ function getImportSpecifiers(content, { reexportsOnly = false, dynamic = false }
|
|
|
2952
3062
|
for (let cursor = index + 1; cursor < tokens.length; cursor++) {
|
|
2953
3063
|
const token = tokens[cursor];
|
|
2954
3064
|
if (token.value === ";") break;
|
|
2955
|
-
if (token.value === "from" && _optionalChain([tokens, 'access',
|
|
3065
|
+
if (token.value === "from" && _optionalChain([tokens, 'access', _171 => _171[cursor + 1], 'optionalAccess', _172 => _172.kind]) === "string") {
|
|
2956
3066
|
fromIndex = cursor;
|
|
2957
3067
|
break;
|
|
2958
3068
|
}
|
|
@@ -2970,14 +3080,14 @@ function getImportSpecifiers(content, { reexportsOnly = false, dynamic = false }
|
|
|
2970
3080
|
return Array.from(matches);
|
|
2971
3081
|
}
|
|
2972
3082
|
function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
|
|
2973
|
-
if (_optionalChain([tokens, 'access',
|
|
3083
|
+
if (_optionalChain([tokens, 'access', _173 => _173[startIndex], 'optionalAccess', _174 => _174.value]) !== "{") return false;
|
|
2974
3084
|
const closingBraceIndex = tokens.findIndex(
|
|
2975
3085
|
(token, index) => index > startIndex && index < endIndex && token.value === "}"
|
|
2976
3086
|
);
|
|
2977
3087
|
if (closingBraceIndex === -1) return false;
|
|
2978
3088
|
let entryStartsAt = startIndex + 1;
|
|
2979
3089
|
for (let index = entryStartsAt; index <= closingBraceIndex; index++) {
|
|
2980
|
-
if (index !== closingBraceIndex && _optionalChain([tokens, 'access',
|
|
3090
|
+
if (index !== closingBraceIndex && _optionalChain([tokens, 'access', _175 => _175[index], 'optionalAccess', _176 => _176.value]) !== ",") continue;
|
|
2981
3091
|
const entry = tokens.slice(entryStartsAt, index);
|
|
2982
3092
|
if (entry.length > 0 && entry[0].value !== "type") return false;
|
|
2983
3093
|
entryStartsAt = index + 1;
|
|
@@ -2988,6 +3098,13 @@ function resolveImportedModule(importerPath, specifier, root) {
|
|
|
2988
3098
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
2989
3099
|
return { path: resolveImportedModuleSourcePath(importerPath, specifier, root), local: true };
|
|
2990
3100
|
}
|
|
3101
|
+
const resolveFrom = parseFarmResolveFrom(specifier, importerPath);
|
|
3102
|
+
if (resolveFrom) {
|
|
3103
|
+
return {
|
|
3104
|
+
path: resolvePackageModuleSourcePath(resolveFrom.importer, resolveFrom.specifier),
|
|
3105
|
+
local: false
|
|
3106
|
+
};
|
|
3107
|
+
}
|
|
2991
3108
|
const aliased = resolveProjectAliasSourcePath(specifier, root);
|
|
2992
3109
|
if (aliased) return { path: aliased, local: true };
|
|
2993
3110
|
const packagePath = resolvePackageModuleSourcePath(importerPath, specifier, root);
|
|
@@ -3034,14 +3151,14 @@ function getProjectImportAliases(projectRoot) {
|
|
|
3034
3151
|
const stamp = PROJECT_ALIAS_FILES.map((file) => {
|
|
3035
3152
|
try {
|
|
3036
3153
|
return String(_fs2.default.statSync(_path2.default.join(projectRoot, file)).mtimeMs);
|
|
3037
|
-
} catch (
|
|
3154
|
+
} catch (e30) {
|
|
3038
3155
|
return "-";
|
|
3039
3156
|
}
|
|
3040
3157
|
}).join(":");
|
|
3041
3158
|
const sourceDir = _chunkRE5E2G5Scjs.getFarmProjectSourceDir.call(void 0, projectRoot);
|
|
3042
3159
|
const cacheStamp = `${stamp}:${sourceDir}`;
|
|
3043
3160
|
const cached = projectImportAliasCache.get(projectRoot);
|
|
3044
|
-
if (_optionalChain([cached, 'optionalAccess',
|
|
3161
|
+
if (_optionalChain([cached, 'optionalAccess', _177 => _177.stamp]) === cacheStamp) return cached.aliases;
|
|
3045
3162
|
const aliases = [
|
|
3046
3163
|
...readTsconfigPathAliases(projectRoot),
|
|
3047
3164
|
...readPackageImportAliases(projectRoot)
|
|
@@ -3062,7 +3179,7 @@ function readTsconfigPathAliases(projectRoot) {
|
|
|
3062
3179
|
const configPath = _path2.default.join(projectRoot, name);
|
|
3063
3180
|
if (!_fs2.default.existsSync(configPath)) continue;
|
|
3064
3181
|
const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
|
|
3065
|
-
if (!_optionalChain([resolved, 'optionalAccess',
|
|
3182
|
+
if (!_optionalChain([resolved, 'optionalAccess', _178 => _178.paths])) return [];
|
|
3066
3183
|
const base = _nullishCoalesce(resolved.baseUrl, () => ( resolved.pathsDirectory));
|
|
3067
3184
|
return Object.entries(resolved.paths).flatMap(([pattern, targets]) => {
|
|
3068
3185
|
if (!Array.isArray(targets)) return [];
|
|
@@ -3097,18 +3214,18 @@ function readTsconfigPaths(configPath, visited) {
|
|
|
3097
3214
|
inherited = _nullishCoalesce(readTsconfigPaths(parentPath, visited), () => ( inherited));
|
|
3098
3215
|
}
|
|
3099
3216
|
const options = _nullishCoalesce(config.compilerOptions, () => ( {}));
|
|
3100
|
-
const baseUrl = typeof options.baseUrl === "string" ? _path2.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess',
|
|
3217
|
+
const baseUrl = typeof options.baseUrl === "string" ? _path2.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess', _179 => _179.baseUrl]);
|
|
3101
3218
|
if (options.paths && typeof options.paths === "object") {
|
|
3102
3219
|
return { paths: options.paths, pathsDirectory: directory, baseUrl };
|
|
3103
3220
|
}
|
|
3104
3221
|
return inherited ? { ...inherited, baseUrl } : { pathsDirectory: directory, baseUrl };
|
|
3105
3222
|
}
|
|
3106
3223
|
function readPackageImportAliases(projectRoot) {
|
|
3107
|
-
const imports = _optionalChain([readPackageJson, 'call',
|
|
3224
|
+
const imports = _optionalChain([readPackageJson, 'call', _180 => _180(_path2.default.join(projectRoot, "package.json")), 'optionalAccess', _181 => _181.imports]);
|
|
3108
3225
|
if (!imports || typeof imports !== "object") return [];
|
|
3109
3226
|
return Object.entries(imports).flatMap(([pattern, value]) => {
|
|
3110
3227
|
const target = resolveConditionalExportTarget(value);
|
|
3111
|
-
if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess',
|
|
3228
|
+
if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess', _182 => _182.startsWith, 'call', _183 => _183("./")])) return [];
|
|
3112
3229
|
const wildcardIndex = pattern.indexOf("*");
|
|
3113
3230
|
return [
|
|
3114
3231
|
{
|
|
@@ -3124,7 +3241,7 @@ function readJsonWithComments(filePath) {
|
|
|
3124
3241
|
let source;
|
|
3125
3242
|
try {
|
|
3126
3243
|
source = _fs2.default.readFileSync(filePath, "utf8");
|
|
3127
|
-
} catch (
|
|
3244
|
+
} catch (e31) {
|
|
3128
3245
|
return null;
|
|
3129
3246
|
}
|
|
3130
3247
|
let output = "";
|
|
@@ -3152,7 +3269,7 @@ function readJsonWithComments(filePath) {
|
|
|
3152
3269
|
}
|
|
3153
3270
|
try {
|
|
3154
3271
|
return JSON.parse(output.replace(/,(\s*[}\]])/g, "$1"));
|
|
3155
|
-
} catch (
|
|
3272
|
+
} catch (e32) {
|
|
3156
3273
|
return null;
|
|
3157
3274
|
}
|
|
3158
3275
|
}
|
|
@@ -3174,15 +3291,15 @@ function resolvePackageModuleSourcePath(importerPath, specifier, root) {
|
|
|
3174
3291
|
const packageJsonPath = _path2.default.join(packageDirectory, "package.json");
|
|
3175
3292
|
const packageJson = readPackageJson(packageJsonPath);
|
|
3176
3293
|
const exportKey = packageSubpath ? `./${packageSubpath}` : ".";
|
|
3177
|
-
const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess',
|
|
3294
|
+
const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess', _184 => _184.exports]), exportKey);
|
|
3178
3295
|
const candidates = /* @__PURE__ */ new Set();
|
|
3179
|
-
if (_optionalChain([exportTarget, 'optionalAccess',
|
|
3296
|
+
if (_optionalChain([exportTarget, 'optionalAccess', _185 => _185.startsWith, 'call', _186 => _186("./")])) {
|
|
3180
3297
|
candidates.add(_path2.default.resolve(packageDirectory, exportTarget));
|
|
3181
3298
|
}
|
|
3182
3299
|
if (packageSubpath) {
|
|
3183
3300
|
candidates.add(_path2.default.join(packageDirectory, packageSubpath));
|
|
3184
3301
|
} else {
|
|
3185
|
-
for (const entry of [_optionalChain([packageJson, 'optionalAccess',
|
|
3302
|
+
for (const entry of [_optionalChain([packageJson, 'optionalAccess', _187 => _187.browser]), _optionalChain([packageJson, 'optionalAccess', _188 => _188.module]), _optionalChain([packageJson, 'optionalAccess', _189 => _189.main])]) {
|
|
3186
3303
|
if (typeof entry === "string") candidates.add(_path2.default.resolve(packageDirectory, entry));
|
|
3187
3304
|
}
|
|
3188
3305
|
candidates.add(_path2.default.join(packageDirectory, "index"));
|
|
@@ -3218,7 +3335,7 @@ function findPackageDirectory2(importerPath, packageName, root) {
|
|
|
3218
3335
|
function readPackageJson(packageJsonPath) {
|
|
3219
3336
|
try {
|
|
3220
3337
|
return JSON.parse(_fs2.default.readFileSync(packageJsonPath, "utf8"));
|
|
3221
|
-
} catch (
|
|
3338
|
+
} catch (e33) {
|
|
3222
3339
|
return null;
|
|
3223
3340
|
}
|
|
3224
3341
|
}
|
|
@@ -3247,7 +3364,7 @@ function resolvePackageExport(exportsField, exportKey) {
|
|
|
3247
3364
|
if (!exportKey.startsWith(prefix) || !exportKey.endsWith(suffix)) continue;
|
|
3248
3365
|
const wildcard = exportKey.slice(prefix.length, exportKey.length - suffix.length);
|
|
3249
3366
|
const target = resolveConditionalExportTarget(value);
|
|
3250
|
-
return _nullishCoalesce(_optionalChain([target, 'optionalAccess',
|
|
3367
|
+
return _nullishCoalesce(_optionalChain([target, 'optionalAccess', _190 => _190.replace, 'call', _191 => _191("*", wildcard)]), () => ( null));
|
|
3251
3368
|
}
|
|
3252
3369
|
return null;
|
|
3253
3370
|
}
|
|
@@ -3280,7 +3397,7 @@ function resolveSourceCandidate(candidates) {
|
|
|
3280
3397
|
for (const sourcePath of paths) {
|
|
3281
3398
|
try {
|
|
3282
3399
|
if (_fs2.default.statSync(sourcePath).isFile()) return sourcePath;
|
|
3283
|
-
} catch (
|
|
3400
|
+
} catch (e34) {
|
|
3284
3401
|
}
|
|
3285
3402
|
}
|
|
3286
3403
|
}
|
|
@@ -3292,7 +3409,18 @@ function isFarmPackageClientBoundary(importerPath, specifier, root) {
|
|
|
3292
3409
|
return inspectPackageClientBoundary(imported.path, root, /* @__PURE__ */ new Set()).shouldHydrate;
|
|
3293
3410
|
}
|
|
3294
3411
|
var CLIENT_PACKAGE_SCAN_EXTENSIONS = /\.(?:[cm]?[jt]sx?)$/;
|
|
3295
|
-
var CLIENT_PACKAGE_SCAN_SKIP = /* @__PURE__ */ new Set([
|
|
3412
|
+
var CLIENT_PACKAGE_SCAN_SKIP = /* @__PURE__ */ new Set([
|
|
3413
|
+
"node_modules",
|
|
3414
|
+
".farm",
|
|
3415
|
+
".git",
|
|
3416
|
+
"dist",
|
|
3417
|
+
".output",
|
|
3418
|
+
"__tests__"
|
|
3419
|
+
]);
|
|
3420
|
+
var TEST_FILE = /\.(?:test|spec)\.[cm]?[jt]sx?$/;
|
|
3421
|
+
function isScannedSourceFile(name) {
|
|
3422
|
+
return CLIENT_PACKAGE_SCAN_EXTENSIONS.test(name) && !name.endsWith(".d.ts") && !TEST_FILE.test(name);
|
|
3423
|
+
}
|
|
3296
3424
|
function bareSpecifierPackage(specifier) {
|
|
3297
3425
|
if (specifier.startsWith(".") || specifier.startsWith("/") || specifier.startsWith("#") || specifier.startsWith("node:") || specifier.startsWith("virtual:") || specifier.includes("\0") || // A package's stylesheet or asset is not a module for the optimizer.
|
|
3298
3426
|
/\.(?:css|scss|sass|less|styl|svg|png|jpe?g|gif|webp|avif|ico|woff2?|ttf|json|wasm)$/.test(
|
|
@@ -3312,7 +3440,7 @@ function scanFarmPackageImports(directory, root) {
|
|
|
3312
3440
|
let entries;
|
|
3313
3441
|
try {
|
|
3314
3442
|
entries = _fs2.default.readdirSync(current, { withFileTypes: true });
|
|
3315
|
-
} catch (
|
|
3443
|
+
} catch (e35) {
|
|
3316
3444
|
return;
|
|
3317
3445
|
}
|
|
3318
3446
|
for (const entry of entries) {
|
|
@@ -3322,8 +3450,7 @@ function scanFarmPackageImports(directory, root) {
|
|
|
3322
3450
|
if (!CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
|
|
3323
3451
|
continue;
|
|
3324
3452
|
}
|
|
3325
|
-
if (!
|
|
3326
|
-
continue;
|
|
3453
|
+
if (!isScannedSourceFile(entry.name)) continue;
|
|
3327
3454
|
const content = readIfExists(file);
|
|
3328
3455
|
if (!content) continue;
|
|
3329
3456
|
const client = hasUseClientDirective(content);
|
|
@@ -3346,7 +3473,7 @@ function collectFarmServerBundledPackageInfo(directory) {
|
|
|
3346
3473
|
let entries;
|
|
3347
3474
|
try {
|
|
3348
3475
|
entries = _fs2.default.readdirSync(current, { withFileTypes: true });
|
|
3349
|
-
} catch (
|
|
3476
|
+
} catch (e36) {
|
|
3350
3477
|
return;
|
|
3351
3478
|
}
|
|
3352
3479
|
for (const entry of entries) {
|
|
@@ -3356,8 +3483,7 @@ function collectFarmServerBundledPackageInfo(directory) {
|
|
|
3356
3483
|
if (!CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
|
|
3357
3484
|
continue;
|
|
3358
3485
|
}
|
|
3359
|
-
if (!
|
|
3360
|
-
continue;
|
|
3486
|
+
if (!isScannedSourceFile(entry.name)) continue;
|
|
3361
3487
|
const content = readIfExists(file);
|
|
3362
3488
|
if (!content) continue;
|
|
3363
3489
|
for (const specifier of new Set(getImportSpecifiers(content))) {
|
|
@@ -3386,14 +3512,14 @@ function getFarmClientReachableModules(directory, root) {
|
|
|
3386
3512
|
let entries;
|
|
3387
3513
|
try {
|
|
3388
3514
|
entries = _fs2.default.readdirSync(current, { withFileTypes: true });
|
|
3389
|
-
} catch (
|
|
3515
|
+
} catch (e37) {
|
|
3390
3516
|
return;
|
|
3391
3517
|
}
|
|
3392
3518
|
for (const entry of entries) {
|
|
3393
3519
|
const file = _path2.default.join(current, entry.name);
|
|
3394
3520
|
if (entry.isDirectory()) {
|
|
3395
3521
|
if (!entry.name.startsWith(".") && !CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
|
|
3396
|
-
} else if (
|
|
3522
|
+
} else if (isScannedSourceFile(entry.name)) {
|
|
3397
3523
|
const content = readIfExists(file);
|
|
3398
3524
|
if (hasUseClientDirective(content) || hasHydrateExport(content)) queue.push(file);
|
|
3399
3525
|
}
|
|
@@ -3489,13 +3615,13 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
3489
3615
|
let projectRoot = process.cwd();
|
|
3490
3616
|
let sources;
|
|
3491
3617
|
const routeSourceFiles = () => {
|
|
3492
|
-
const clientRoutes = _optionalChain([farmApi, 'optionalAccess',
|
|
3493
|
-
if (_optionalChain([sources, 'optionalAccess',
|
|
3618
|
+
const clientRoutes = _optionalChain([farmApi, 'optionalAccess', _192 => _192.getProgrammaticClientRoutes, 'call', _193 => _193()]);
|
|
3619
|
+
if (_optionalChain([sources, 'optionalAccess', _194 => _194.for]) !== clientRoutes || !sources) {
|
|
3494
3620
|
sources = {
|
|
3495
3621
|
for: clientRoutes,
|
|
3496
3622
|
files: /* @__PURE__ */ new Set([
|
|
3497
3623
|
...routesFiles,
|
|
3498
|
-
...[..._nullishCoalesce(_optionalChain([clientRoutes, 'optionalAccess',
|
|
3624
|
+
...[..._nullishCoalesce(_optionalChain([clientRoutes, 'optionalAccess', _195 => _195.routeSourceFiles]), () => ( []))].map(resolvedFile)
|
|
3499
3625
|
])
|
|
3500
3626
|
};
|
|
3501
3627
|
}
|
|
@@ -3508,10 +3634,10 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
3508
3634
|
configResolved(config) {
|
|
3509
3635
|
isBuild = config.command === "build";
|
|
3510
3636
|
projectRoot = config.root;
|
|
3511
|
-
farmApi = _optionalChain([config, 'access',
|
|
3637
|
+
farmApi = _optionalChain([config, 'access', _196 => _196.plugins, 'access', _197 => _197.find, 'call', _198 => _198((plugin) => plugin.name === "farm"), 'optionalAccess', _199 => _199.api]);
|
|
3512
3638
|
sources = void 0;
|
|
3513
3639
|
routesFiles = new Set(
|
|
3514
|
-
|
|
3640
|
+
_chunkMTBDJ326cjs.getFarmSourceRoots.call(void 0, { ...options, root: _nullishCoalesce(options.root, () => ( config.root)) }).flatMap(
|
|
3515
3641
|
(source) => _chunkE7QOEV5Zcjs.PROGRAMMATIC_ROUTE_FILE_NAMES.map(
|
|
3516
3642
|
(name) => resolvedFile(_path2.default.resolve(source.root, source.srcDir, name))
|
|
3517
3643
|
)
|
|
@@ -3521,14 +3647,14 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
3521
3647
|
transform(code, id, transformOptions) {
|
|
3522
3648
|
const environment = resolveBuildEnvironment(
|
|
3523
3649
|
this,
|
|
3524
|
-
_optionalChain([transformOptions, 'optionalAccess',
|
|
3650
|
+
_optionalChain([transformOptions, 'optionalAccess', _200 => _200.ssr])
|
|
3525
3651
|
);
|
|
3526
3652
|
const parse2 = (source) => this.parse(source);
|
|
3527
3653
|
const result = transformEnvironmentFunctions({ code, id, environment, parse: parse2 });
|
|
3528
3654
|
if (environment === "client" && !isBuild && !_chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, id) && routeSourceFiles().has(moduleFile(id)) && !isProgrammaticRouteActionProxy(code)) {
|
|
3529
3655
|
this.error(routeSourceError(moduleFile(id)));
|
|
3530
3656
|
}
|
|
3531
|
-
if (environment === "server" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([options, 'access',
|
|
3657
|
+
if (environment === "server" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([options, 'access', _201 => _201.experimental, 'optionalAccess', _202 => _202.serverComponents])) === "islands" && isApplicationScript(id)) {
|
|
3532
3658
|
const file = id.split("?", 1)[0];
|
|
3533
3659
|
const root = _fs.realpathSync.call(void 0, _nullishCoalesce(options.root, () => ( projectRoot)));
|
|
3534
3660
|
const clientCode = getFarmClientReachableModules(root, root).has(_path2.default.resolve(file)) || _fs.existsSync.call(void 0, file) && hasUseClientDirective(_fs.readFileSync.call(void 0, file, "utf8"));
|
|
@@ -3549,7 +3675,7 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
3549
3675
|
for (const id of this.getModuleIds()) {
|
|
3550
3676
|
if (_chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, id)) {
|
|
3551
3677
|
const chain = findClientNodeBuiltinChain(id, (moduleId) => {
|
|
3552
|
-
return _optionalChain([this, 'access',
|
|
3678
|
+
return _optionalChain([this, 'access', _203 => _203.getModuleInfo, 'call', _204 => _204(moduleId), 'optionalAccess', _205 => _205.importedIds]);
|
|
3553
3679
|
});
|
|
3554
3680
|
if (chain) {
|
|
3555
3681
|
this.error(
|
|
@@ -3560,8 +3686,8 @@ function farmEnvironmentFunctionsPlugin(options = {}) {
|
|
|
3560
3686
|
}
|
|
3561
3687
|
if (!forbidden.has(moduleFile(id))) continue;
|
|
3562
3688
|
const info = this.getModuleInfo(id);
|
|
3563
|
-
if (isProgrammaticRouteActionProxy(_optionalChain([info, 'optionalAccess',
|
|
3564
|
-
this.error(routeSourceError(moduleFile(id), _optionalChain([info, 'optionalAccess',
|
|
3689
|
+
if (isProgrammaticRouteActionProxy(_optionalChain([info, 'optionalAccess', _206 => _206.code]))) continue;
|
|
3690
|
+
this.error(routeSourceError(moduleFile(id), _optionalChain([info, 'optionalAccess', _207 => _207.importers, 'access', _208 => _208.map, 'call', _209 => _209(moduleFile)])));
|
|
3565
3691
|
}
|
|
3566
3692
|
}
|
|
3567
3693
|
};
|
|
@@ -3575,13 +3701,13 @@ function moduleFile(id) {
|
|
|
3575
3701
|
function resolvedFile(filePath) {
|
|
3576
3702
|
try {
|
|
3577
3703
|
return moduleFile(_fs.realpathSync.call(void 0, filePath));
|
|
3578
|
-
} catch (
|
|
3704
|
+
} catch (e38) {
|
|
3579
3705
|
return moduleFile(filePath);
|
|
3580
3706
|
}
|
|
3581
3707
|
}
|
|
3582
3708
|
function resolveBuildEnvironment(context, ssr) {
|
|
3583
|
-
if (_optionalChain([context, 'access',
|
|
3584
|
-
if (_optionalChain([context, 'access',
|
|
3709
|
+
if (_optionalChain([context, 'access', _210 => _210.environment, 'optionalAccess', _211 => _211.name]) === "client") return "client";
|
|
3710
|
+
if (_optionalChain([context, 'access', _212 => _212.environment, 'optionalAccess', _213 => _213.name]) === "rsc" || _optionalChain([context, 'access', _214 => _214.environment, 'optionalAccess', _215 => _215.name]) === "ssr") {
|
|
3585
3711
|
return "server";
|
|
3586
3712
|
}
|
|
3587
3713
|
return ssr ? "server" : "client";
|
|
@@ -3882,4 +4008,7 @@ function transformError(id, message) {
|
|
|
3882
4008
|
|
|
3883
4009
|
|
|
3884
4010
|
|
|
3885
|
-
|
|
4011
|
+
|
|
4012
|
+
|
|
4013
|
+
|
|
4014
|
+
exports.FARM_BROWSER_BUILTIN_PREFIX = FARM_BROWSER_BUILTIN_PREFIX; exports.resolveFarmBrowserBuiltin = resolveFarmBrowserBuiltin; exports.loadFarmBrowserBuiltin = loadFarmBrowserBuiltin; exports.farmBrowserBuiltinsOptimizerPlugin = farmBrowserBuiltinsOptimizerPlugin; exports.programmaticClientRouteKey = programmaticClientRouteKey; exports.resolveProgrammaticClientRoutes = resolveProgrammaticClientRoutes; exports.createEvaluatedRouteGraph = createEvaluatedRouteGraph; exports.mergeProgrammaticClientRoutes = mergeProgrammaticClientRoutes; exports.generateProgrammaticClientRouteModule = generateProgrammaticClientRouteModule; exports.rewriteFarmReactServerClientModuleImports = rewriteFarmReactServerClientModuleImports; exports.rewriteFarmReactServerImports = rewriteFarmReactServerImports; exports.invalidateFarmClientOnlyScan = invalidateFarmClientOnlyScan; exports.farmRelativeImportFiles = farmRelativeImportFiles; exports.FARM_CLIENT_REFERENCE_PRAGMA = FARM_CLIENT_REFERENCE_PRAGMA; exports.FARM_CLIENT_REFERENCE_DIRECTORY = FARM_CLIENT_REFERENCE_DIRECTORY; exports.FARM_RESOLVE_FROM_PREFIX = FARM_RESOLVE_FROM_PREFIX; exports.parseFarmResolveFrom = parseFarmResolveFrom; exports.ensureFarmPackageClientReference = ensureFarmPackageClientReference; exports.ensureFarmInternalClientReference = ensureFarmInternalClientReference; exports.rewriteFarmPackageClientImports = rewriteFarmPackageClientImports; exports.withPackageClientBoundaryCache = withPackageClientBoundaryCache; exports.usePackageClientBoundaryCacheFile = usePackageClientBoundaryCacheFile; exports.resolvePackageClientBoundaryCacheFile = resolvePackageClientBoundaryCacheFile; exports.runWithPackageClientBoundaryCacheFile = runWithPackageClientBoundaryCacheFile; exports.resolveModuleSourcePath = resolveModuleSourcePath; exports.getFarmClientHydrationPlanOptions = getFarmClientHydrationPlanOptions; exports.describeSuppressedAsyncHydration = describeSuppressedAsyncHydration; exports.resolveFarmIsolatedClientHydrationMode = resolveFarmIsolatedClientHydrationMode; exports.hasUseClientDirective = hasUseClientDirective; exports.getIslandStrategyExport = getIslandStrategyExport; exports.stripUseClientDirective = stripUseClientDirective; exports.collectFarmRenderedClientModules = collectFarmRenderedClientModules; exports.collectFarmServerStylesheets = collectFarmServerStylesheets; exports.getClientModuleMetadata = getClientModuleMetadata; exports.getClientModuleHydrationPlan = getClientModuleHydrationPlan; exports.usesFarmServerTree = usesFarmServerTree; exports.createMarkdownPageHydrationPlanner = createMarkdownPageHydrationPlanner; exports.enforceFarmIsolatedHydrationRouteBudget = enforceFarmIsolatedHydrationRouteBudget; exports.isIsolatableClientBoundarySource = isIsolatableClientBoundarySource; exports.resolveImportedModule = resolveImportedModule; exports.isFarmPackageClientBoundary = isFarmPackageClientBoundary; exports.collectFarmClientPackageImports = collectFarmClientPackageImports; exports.collectFarmServerBundledPackageInfo = collectFarmServerBundledPackageInfo; exports.invalidateFarmClientReachableModules = invalidateFarmClientReachableModules; exports.getFarmClientReachableModules = getFarmClientReachableModules; exports.resolveFarmClientOptimizeDeps = resolveFarmClientOptimizeDeps; exports.transformEnvironmentFunctions = transformEnvironmentFunctions; exports.farmEnvironmentFunctionsPlugin = farmEnvironmentFunctionsPlugin;
|