@farm.js/core 0.1.0-beta.6 → 0.1.0-beta.8
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/after.cjs +227 -0
- package/dist/after.cjs.map +1 -0
- package/dist/after.d.mts +25 -0
- package/dist/after.d.ts +25 -0
- package/dist/after.mjs +14 -0
- package/dist/after.mjs.map +1 -0
- package/dist/agent-runtime.cjs +2379 -0
- package/dist/agent-runtime.cjs.map +1 -0
- package/dist/agent-runtime.d.mts +94 -0
- package/dist/agent-runtime.d.ts +94 -0
- package/dist/agent-runtime.mjs +479 -0
- package/dist/agent-runtime.mjs.map +1 -0
- package/dist/api/route-manager.d.mts +66 -0
- package/dist/api/route-manager.d.ts +66 -0
- package/dist/api/runtime.d.mts +3 -0
- package/dist/api/runtime.d.ts +3 -0
- package/dist/api.cjs +4100 -0
- package/dist/api.cjs.map +1 -0
- package/dist/api.d.mts +48 -0
- package/dist/api.d.ts +48 -0
- package/dist/api.mjs +93 -0
- package/dist/api.mjs.map +1 -0
- package/dist/app-BWtqQu3R.d.mts +302 -0
- package/dist/app-markdown.cjs +244 -0
- package/dist/app-markdown.cjs.map +1 -0
- package/dist/app-markdown.d.mts +22 -0
- package/dist/app-markdown.d.ts +22 -0
- package/dist/app-markdown.mjs +27 -0
- package/dist/app-markdown.mjs.map +1 -0
- package/dist/app-xltejvLY.d.ts +302 -0
- package/dist/cache.cjs +945 -0
- package/dist/cache.cjs.map +1 -0
- package/dist/cache.d.mts +192 -0
- package/dist/cache.d.ts +192 -0
- package/dist/cache.mjs +46 -0
- package/dist/cache.mjs.map +1 -0
- package/dist/chunk-2ED5Q2GH.mjs +422 -0
- package/dist/chunk-2ED5Q2GH.mjs.map +1 -0
- package/dist/chunk-32W4QEJP.mjs +158 -0
- package/dist/chunk-32W4QEJP.mjs.map +1 -0
- package/dist/chunk-3XNTL3FQ.mjs +452 -0
- package/dist/chunk-3XNTL3FQ.mjs.map +1 -0
- package/dist/chunk-44ZCFSKE.mjs +84 -0
- package/dist/chunk-44ZCFSKE.mjs.map +1 -0
- package/dist/chunk-4MGVSBRP.mjs +7787 -0
- package/dist/chunk-4MGVSBRP.mjs.map +1 -0
- package/dist/chunk-4S3ORGFA.mjs +44 -0
- package/dist/chunk-4S3ORGFA.mjs.map +1 -0
- package/dist/chunk-5BY76U2M.mjs +1 -0
- package/dist/chunk-5BY76U2M.mjs.map +1 -0
- package/dist/chunk-5ZGPRGWV.mjs +136 -0
- package/dist/chunk-5ZGPRGWV.mjs.map +1 -0
- package/dist/chunk-65A7QIKI.mjs +142 -0
- package/dist/chunk-65A7QIKI.mjs.map +1 -0
- package/dist/chunk-74YTBPTY.mjs +450 -0
- package/dist/chunk-74YTBPTY.mjs.map +1 -0
- package/dist/chunk-7FBJLMQH.mjs +338 -0
- package/dist/chunk-7FBJLMQH.mjs.map +1 -0
- package/dist/chunk-7HO6AEOP.mjs +74 -0
- package/dist/chunk-7HO6AEOP.mjs.map +1 -0
- package/dist/chunk-7MABZJIM.mjs +29 -0
- package/dist/chunk-7MABZJIM.mjs.map +1 -0
- package/dist/chunk-7N62DNSO.mjs +41 -0
- package/dist/chunk-7N62DNSO.mjs.map +1 -0
- package/dist/chunk-7ZY5AIJO.mjs +161 -0
- package/dist/chunk-7ZY5AIJO.mjs.map +1 -0
- package/dist/chunk-ALCLXXTY.mjs +187 -0
- package/dist/chunk-ALCLXXTY.mjs.map +1 -0
- package/dist/chunk-AZ7YUVNR.mjs +65 -0
- package/dist/chunk-AZ7YUVNR.mjs.map +1 -0
- package/dist/chunk-B232I2GP.mjs +163 -0
- package/dist/chunk-B232I2GP.mjs.map +1 -0
- package/dist/chunk-B4W3BNTL.mjs +483 -0
- package/dist/chunk-B4W3BNTL.mjs.map +1 -0
- package/dist/chunk-C2ROET2V.mjs +718 -0
- package/dist/chunk-C2ROET2V.mjs.map +1 -0
- package/dist/chunk-CGILA3WO.mjs +14 -0
- package/dist/chunk-CGILA3WO.mjs.map +1 -0
- package/dist/chunk-CGIXMLSY.mjs +184 -0
- package/dist/chunk-CGIXMLSY.mjs.map +1 -0
- package/dist/chunk-DJSGLHCN.mjs +597 -0
- package/dist/chunk-DJSGLHCN.mjs.map +1 -0
- package/dist/chunk-E2MPIBRE.mjs +149 -0
- package/dist/chunk-E2MPIBRE.mjs.map +1 -0
- package/dist/chunk-E6EPN5BT.mjs +203 -0
- package/dist/chunk-E6EPN5BT.mjs.map +1 -0
- package/dist/chunk-EI43C4RA.mjs +6277 -0
- package/dist/chunk-EI43C4RA.mjs.map +1 -0
- package/dist/chunk-EJ7T4TPB.mjs +622 -0
- package/dist/chunk-EJ7T4TPB.mjs.map +1 -0
- package/dist/chunk-FQYDHKKU.mjs +128 -0
- package/dist/chunk-FQYDHKKU.mjs.map +1 -0
- package/dist/chunk-FRPWCMMG.mjs +299 -0
- package/dist/chunk-FRPWCMMG.mjs.map +1 -0
- package/dist/chunk-GN72QAIH.mjs +146 -0
- package/dist/chunk-GN72QAIH.mjs.map +1 -0
- package/dist/chunk-GQVGIUSN.mjs +149 -0
- package/dist/chunk-GQVGIUSN.mjs.map +1 -0
- package/dist/chunk-GS6K5OCM.mjs +407 -0
- package/dist/chunk-GS6K5OCM.mjs.map +1 -0
- package/dist/chunk-GXASWWJU.mjs +364 -0
- package/dist/chunk-GXASWWJU.mjs.map +1 -0
- package/dist/chunk-GY2STC2S.mjs +180 -0
- package/dist/chunk-GY2STC2S.mjs.map +1 -0
- package/dist/chunk-H2FA2SBS.mjs +51 -0
- package/dist/chunk-H2FA2SBS.mjs.map +1 -0
- package/dist/chunk-I4CUBGVF.mjs +93 -0
- package/dist/chunk-I4CUBGVF.mjs.map +1 -0
- package/dist/chunk-ITN462YM.mjs +98 -0
- package/dist/chunk-ITN462YM.mjs.map +1 -0
- package/dist/chunk-J23HNLFY.mjs +72 -0
- package/dist/chunk-J23HNLFY.mjs.map +1 -0
- package/dist/chunk-J4FNJ5IU.mjs +179 -0
- package/dist/chunk-J4FNJ5IU.mjs.map +1 -0
- package/dist/chunk-J5YWQVI5.mjs +211 -0
- package/dist/chunk-J5YWQVI5.mjs.map +1 -0
- package/dist/chunk-JDEOUK5V.mjs +427 -0
- package/dist/chunk-JDEOUK5V.mjs.map +1 -0
- package/dist/chunk-JK25YEN6.mjs +219 -0
- package/dist/chunk-JK25YEN6.mjs.map +1 -0
- package/dist/chunk-K4667E2Q.mjs +1916 -0
- package/dist/chunk-K4667E2Q.mjs.map +1 -0
- package/dist/chunk-LGHEOHBU.mjs +218 -0
- package/dist/chunk-LGHEOHBU.mjs.map +1 -0
- package/dist/chunk-LM2YNO4U.mjs +24 -0
- package/dist/chunk-LM2YNO4U.mjs.map +1 -0
- package/dist/chunk-ME4MO2RJ.mjs +3540 -0
- package/dist/chunk-ME4MO2RJ.mjs.map +1 -0
- package/dist/chunk-MIUW47JX.mjs +639 -0
- package/dist/chunk-MIUW47JX.mjs.map +1 -0
- package/dist/chunk-NNLCAVB6.mjs +391 -0
- package/dist/chunk-NNLCAVB6.mjs.map +1 -0
- package/dist/chunk-P7QDS5AT.mjs +191 -0
- package/dist/chunk-P7QDS5AT.mjs.map +1 -0
- package/dist/chunk-PFE6GMNE.mjs +603 -0
- package/dist/chunk-PFE6GMNE.mjs.map +1 -0
- package/dist/chunk-QGOHVJ6J.mjs +63 -0
- package/dist/chunk-QGOHVJ6J.mjs.map +1 -0
- package/dist/chunk-QKVUNGAH.mjs +39 -0
- package/dist/chunk-QKVUNGAH.mjs.map +1 -0
- package/dist/chunk-QM746KUO.mjs +56 -0
- package/dist/chunk-QM746KUO.mjs.map +1 -0
- package/dist/chunk-QTZZ2ISQ.mjs +753 -0
- package/dist/chunk-QTZZ2ISQ.mjs.map +1 -0
- package/dist/chunk-RBRLLZL5.mjs +81 -0
- package/dist/chunk-RBRLLZL5.mjs.map +1 -0
- package/dist/chunk-RHIFZZUI.mjs +69 -0
- package/dist/chunk-RHIFZZUI.mjs.map +1 -0
- package/dist/chunk-RQ633A5I.mjs +187 -0
- package/dist/chunk-RQ633A5I.mjs.map +1 -0
- package/dist/chunk-SCFX4UTD.mjs +28 -0
- package/dist/chunk-SCFX4UTD.mjs.map +1 -0
- package/dist/chunk-SL6HTIOK.mjs +66 -0
- package/dist/chunk-SL6HTIOK.mjs.map +1 -0
- package/dist/chunk-SPBBQLXI.mjs +207 -0
- package/dist/chunk-SPBBQLXI.mjs.map +1 -0
- package/dist/chunk-SSA7THPX.mjs +10 -0
- package/dist/chunk-SSA7THPX.mjs.map +1 -0
- package/dist/chunk-T4QJQK76.mjs +459 -0
- package/dist/chunk-T4QJQK76.mjs.map +1 -0
- package/dist/chunk-TQAEEJB4.mjs +157 -0
- package/dist/chunk-TQAEEJB4.mjs.map +1 -0
- package/dist/chunk-UB5UOSHB.mjs +458 -0
- package/dist/chunk-UB5UOSHB.mjs.map +1 -0
- package/dist/chunk-USWZZUEH.mjs +25 -0
- package/dist/chunk-USWZZUEH.mjs.map +1 -0
- package/dist/chunk-UVCIEUJC.mjs +16 -0
- package/dist/chunk-UVCIEUJC.mjs.map +1 -0
- package/dist/chunk-UXUAWNO5.mjs +396 -0
- package/dist/chunk-UXUAWNO5.mjs.map +1 -0
- package/dist/chunk-V3XURYJO.mjs +756 -0
- package/dist/chunk-V3XURYJO.mjs.map +1 -0
- package/dist/chunk-V6WE6JSZ.mjs +352 -0
- package/dist/chunk-V6WE6JSZ.mjs.map +1 -0
- package/dist/chunk-V7RBCSDJ.mjs +170 -0
- package/dist/chunk-V7RBCSDJ.mjs.map +1 -0
- package/dist/chunk-VCANOYFI.mjs +588 -0
- package/dist/chunk-VCANOYFI.mjs.map +1 -0
- package/dist/chunk-VY2UYN5R.mjs +224 -0
- package/dist/chunk-VY2UYN5R.mjs.map +1 -0
- package/dist/chunk-W2CRQFF6.mjs +1352 -0
- package/dist/chunk-W2CRQFF6.mjs.map +1 -0
- package/dist/chunk-WDU6QXNK.mjs +872 -0
- package/dist/chunk-WDU6QXNK.mjs.map +1 -0
- package/dist/chunk-WZ5QFROO.mjs +23 -0
- package/dist/chunk-WZ5QFROO.mjs.map +1 -0
- package/dist/chunk-XIVV5IWN.mjs +541 -0
- package/dist/chunk-XIVV5IWN.mjs.map +1 -0
- package/dist/chunk-YW7OBE6Q.mjs +119 -0
- package/dist/chunk-YW7OBE6Q.mjs.map +1 -0
- package/dist/chunk-Z5CQMP54.mjs +365 -0
- package/dist/chunk-Z5CQMP54.mjs.map +1 -0
- package/dist/chunk-ZBE6MLHL.mjs +230 -0
- package/dist/chunk-ZBE6MLHL.mjs.map +1 -0
- package/dist/chunk-ZVWA4ZQ3.mjs +189 -0
- package/dist/chunk-ZVWA4ZQ3.mjs.map +1 -0
- package/dist/chunk-ZZ57EH5Z.mjs +173 -0
- package/dist/chunk-ZZ57EH5Z.mjs.map +1 -0
- package/dist/client-BT1mFQas.d.mts +447 -0
- package/dist/client-Nn0q4eO4.d.ts +447 -0
- package/dist/client-cache-CIlyBlmx.d.ts +6 -0
- package/dist/client-cache-D-EZ7XVW.d.mts +6 -0
- package/dist/client-plugins-BI2R6Eae.d.mts +1926 -0
- package/dist/client-plugins-DU9oMspX.d.ts +1926 -0
- package/dist/client-plugins.cjs +415 -0
- package/dist/client-plugins.cjs.map +1 -0
- package/dist/client-plugins.d.mts +22 -0
- package/dist/client-plugins.d.ts +22 -0
- package/dist/client-plugins.mjs +10 -0
- package/dist/client-plugins.mjs.map +1 -0
- package/dist/client.cjs +5402 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.mts +447 -0
- package/dist/client.d.ts +447 -0
- package/dist/client.mjs +110 -0
- package/dist/client.mjs.map +1 -0
- package/dist/config.cjs +38 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.mts +29 -0
- package/dist/config.d.ts +29 -0
- package/dist/config.mjs +10 -0
- package/dist/config.mjs.map +1 -0
- package/dist/cron.cjs +406 -0
- package/dist/cron.cjs.map +1 -0
- package/dist/cron.d.mts +78 -0
- package/dist/cron.d.ts +78 -0
- package/dist/cron.mjs +30 -0
- package/dist/cron.mjs.map +1 -0
- package/dist/deferred.cjs +438 -0
- package/dist/deferred.cjs.map +1 -0
- package/dist/deferred.d.mts +42 -0
- package/dist/deferred.d.ts +42 -0
- package/dist/deferred.mjs +28 -0
- package/dist/deferred.mjs.map +1 -0
- package/dist/deployment.cjs +199 -0
- package/dist/deployment.cjs.map +1 -0
- package/dist/deployment.d.mts +34 -0
- package/dist/deployment.d.ts +34 -0
- package/dist/deployment.mjs +38 -0
- package/dist/deployment.mjs.map +1 -0
- package/dist/devtools-REQTS3I7.mjs +371 -0
- package/dist/devtools-REQTS3I7.mjs.map +1 -0
- package/dist/devtools-client-3XRTBND5.mjs +216 -0
- package/dist/devtools-client-3XRTBND5.mjs.map +1 -0
- package/dist/devtools-ui-NJKFORTG.mjs +1349 -0
- package/dist/devtools-ui-NJKFORTG.mjs.map +1 -0
- package/dist/docs.cjs +5548 -0
- package/dist/docs.cjs.map +1 -0
- package/dist/docs.d.mts +69 -0
- package/dist/docs.d.ts +69 -0
- package/dist/docs.mjs +47 -0
- package/dist/docs.mjs.map +1 -0
- package/dist/env-types.cjs +232 -0
- package/dist/env-types.cjs.map +1 -0
- package/dist/env-types.d.mts +12 -0
- package/dist/env-types.d.ts +12 -0
- package/dist/env-types.mjs +11 -0
- package/dist/env-types.mjs.map +1 -0
- package/dist/env.cjs +215 -0
- package/dist/env.cjs.map +1 -0
- package/dist/env.d.mts +45 -0
- package/dist/env.d.ts +45 -0
- package/dist/env.mjs +22 -0
- package/dist/env.mjs.map +1 -0
- package/dist/environment/vite.d.mts +22 -0
- package/dist/environment/vite.d.ts +22 -0
- package/dist/environment.cjs +96 -0
- package/dist/environment.cjs.map +1 -0
- package/dist/environment.d.mts +18 -0
- package/dist/environment.d.ts +18 -0
- package/dist/environment.mjs +14 -0
- package/dist/environment.mjs.map +1 -0
- package/dist/headers.cjs +126 -0
- package/dist/headers.cjs.map +1 -0
- package/dist/headers.d.mts +22 -0
- package/dist/headers.d.ts +22 -0
- package/dist/headers.mjs +12 -0
- package/dist/headers.mjs.map +1 -0
- package/dist/i18n/client.d.mts +32 -0
- package/dist/i18n/client.d.ts +32 -0
- package/dist/i18n/index.d.mts +20 -0
- package/dist/i18n/index.d.ts +20 -0
- package/dist/i18n/server.d.mts +30 -0
- package/dist/i18n/server.d.ts +30 -0
- package/dist/image/server.d.mts +37 -0
- package/dist/image/server.d.ts +37 -0
- package/dist/image/sharp.d.mts +7 -0
- package/dist/image/sharp.d.ts +7 -0
- package/dist/image-config-Duob7wER.d.mts +50 -0
- package/dist/image-config-Duob7wER.d.ts +50 -0
- package/dist/image.cjs +209 -0
- package/dist/image.cjs.map +1 -0
- package/dist/image.d.mts +39 -0
- package/dist/image.d.ts +39 -0
- package/dist/image.mjs +165 -0
- package/dist/image.mjs.map +1 -0
- package/dist/index.cjs +42186 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +454 -0
- package/dist/index.d.ts +454 -0
- package/dist/index.mjs +980 -0
- package/dist/index.mjs.map +1 -0
- package/dist/integration-api-CHT2OKAf.d.mts +93 -0
- package/dist/integration-api-CHT2OKAf.d.ts +93 -0
- package/dist/integration-orm-GQLGU66X.mjs +13 -0
- package/dist/integration-orm-GQLGU66X.mjs.map +1 -0
- package/dist/integrations.cjs +2820 -0
- package/dist/integrations.cjs.map +1 -0
- package/dist/integrations.d.mts +22 -0
- package/dist/integrations.d.ts +22 -0
- package/dist/integrations.mjs +51 -0
- package/dist/integrations.mjs.map +1 -0
- package/dist/internal/build-runtime.cjs +643 -322
- package/dist/internal/build-runtime.cjs.map +1 -1
- package/dist/internal/build-runtime.d.mts +39 -0
- package/dist/internal/build-runtime.d.ts +39 -0
- package/dist/internal/build-runtime.mjs +11 -10
- package/dist/internal/client-runtime.d.mts +2 -0
- package/dist/internal/client-runtime.d.ts +2 -0
- package/dist/internal/config-runtime.cjs +135 -39
- package/dist/internal/config-runtime.cjs.map +1 -1
- package/dist/internal/config-runtime.d.mts +39 -0
- package/dist/internal/config-runtime.d.ts +39 -0
- package/dist/internal/config-runtime.mjs +5 -4
- package/dist/internal/production-node-env.d.mts +12 -0
- package/dist/internal/production-node-env.d.ts +12 -0
- package/dist/internal/production-runtime.d.mts +39 -0
- package/dist/internal/production-runtime.d.ts +39 -0
- package/dist/layers-VWVDTPUZ.mjs +16 -0
- package/dist/layers-VWVDTPUZ.mjs.map +1 -0
- package/dist/manager-THKFTOFE.mjs +10 -0
- package/dist/manager-THKFTOFE.mjs.map +1 -0
- package/dist/markdown.cjs +364 -0
- package/dist/markdown.cjs.map +1 -0
- package/dist/markdown.d.mts +60 -0
- package/dist/markdown.d.ts +60 -0
- package/dist/markdown.mjs +18 -0
- package/dist/markdown.mjs.map +1 -0
- package/dist/metadata-Cm9ujH4I.d.ts +22 -0
- package/dist/metadata-DacXbnLA.d.mts +22 -0
- package/dist/middleware.cjs +2148 -0
- package/dist/middleware.cjs.map +1 -0
- package/dist/middleware.d.mts +164 -0
- package/dist/middleware.d.ts +164 -0
- package/dist/middleware.mjs +49 -0
- package/dist/middleware.mjs.map +1 -0
- package/dist/navigation-errors-Dvwpzaer.d.mts +13 -0
- package/dist/navigation-errors-Dvwpzaer.d.ts +13 -0
- package/dist/navigation.cjs +1329 -0
- package/dist/navigation.cjs.map +1 -0
- package/dist/navigation.d.mts +14 -0
- package/dist/navigation.d.ts +14 -0
- package/dist/navigation.mjs +33 -0
- package/dist/navigation.mjs.map +1 -0
- package/dist/nitro-QO5LV6QK.mjs +689 -0
- package/dist/nitro-QO5LV6QK.mjs.map +1 -0
- package/dist/observability.cjs +186 -0
- package/dist/observability.cjs.map +1 -0
- package/dist/observability.d.mts +335 -0
- package/dist/observability.d.ts +335 -0
- package/dist/observability.mjs +16 -0
- package/dist/observability.mjs.map +1 -0
- package/dist/params-BALtrRim.d.ts +15 -0
- package/dist/params-ry-lxqmy.d.mts +15 -0
- package/dist/plugin-BJDf43dc.d.mts +165 -0
- package/dist/plugin-BJDf43dc.d.ts +165 -0
- package/dist/plugin.cjs +23470 -0
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.mts +22 -0
- package/dist/plugin.d.ts +22 -0
- package/dist/plugin.mjs +8 -7
- package/dist/production-runtime-4KKq1AVC.d.mts +79 -0
- package/dist/production-runtime-C_B79w2P.d.mts +28 -0
- package/dist/production-runtime-DDEM1D2q.d.ts +28 -0
- package/dist/production-runtime-DRsWDN2x.d.ts +79 -0
- package/dist/query/client.d.mts +61 -0
- package/dist/query/client.d.ts +61 -0
- package/dist/query/index.d.mts +90 -0
- package/dist/query/index.d.ts +90 -0
- package/dist/query/parsers.d.mts +25 -0
- package/dist/query/parsers.d.ts +25 -0
- package/dist/query/server.d.mts +55 -0
- package/dist/query/server.d.ts +55 -0
- package/dist/request-Dsq4kGW0.d.mts +6 -0
- package/dist/request-udtobOLv.d.ts +6 -0
- package/dist/request.d.mts +2 -0
- package/dist/request.d.ts +2 -0
- package/dist/resolver-DJqjLMg_.d.mts +14 -0
- package/dist/resolver-IH4RmPEl.d.ts +14 -0
- package/dist/route-runtime-DoOHzCAD.d.mts +38 -0
- package/dist/route-runtime-DoOHzCAD.d.ts +38 -0
- package/dist/router.d.mts +36 -0
- package/dist/router.d.ts +36 -0
- package/dist/routes.d.mts +224 -0
- package/dist/routes.d.ts +224 -0
- package/dist/runtime-9nQjVM7X.d.mts +206 -0
- package/dist/runtime-Cxpq6xZN.d.mts +27 -0
- package/dist/runtime-DgeS2skB.d.ts +206 -0
- package/dist/runtime-bv63eUiO.d.ts +27 -0
- package/dist/server-action-security.d.mts +43 -0
- package/dist/server-action-security.d.ts +43 -0
- package/dist/server-fn-client.d.mts +32 -0
- package/dist/server-fn-client.d.ts +32 -0
- package/dist/server-fn.d.mts +93 -0
- package/dist/server-fn.d.ts +93 -0
- package/dist/server-plugins.d.mts +55 -0
- package/dist/server-plugins.d.ts +55 -0
- package/dist/server-query-client.d.mts +50 -0
- package/dist/server-query-client.d.ts +50 -0
- package/dist/server-query.d.mts +36 -0
- package/dist/server-query.d.ts +36 -0
- package/dist/server.cjs +731 -447
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.mts +48 -0
- package/dist/server.d.ts +48 -0
- package/dist/server.mjs +9 -8
- package/dist/server.mjs.map +1 -1
- package/dist/storage.d.mts +52 -0
- package/dist/storage.d.ts +52 -0
- package/dist/testing.d.mts +101 -0
- package/dist/testing.d.ts +101 -0
- package/dist/transport-BmbGTXA5.d.mts +49 -0
- package/dist/transport-BmbGTXA5.d.ts +49 -0
- package/dist/types-BMxWr97v.d.mts +81 -0
- package/dist/types-BMxWr97v.d.ts +81 -0
- package/dist/types-C9N-nk5R.d.mts +53 -0
- package/dist/types-C9N-nk5R.d.ts +53 -0
- package/dist/types-D1A6-XvH.d.mts +73 -0
- package/dist/types-D1A6-XvH.d.ts +73 -0
- package/dist/utils-B-cUHwoK.d.ts +23 -0
- package/dist/utils-Cm41AefV.d.mts +23 -0
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.mts +3 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +682 -437
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.mts +22 -0
- package/dist/vite.d.ts +22 -0
- package/dist/vite.mjs +6 -5
- package/dist/workflows.d.mts +110 -0
- package/dist/workflows.d.ts +110 -0
- package/package.json +3 -2
- package/types/client.d.ts +1 -1
- package/types/image.d.ts +4 -0
- package/types/images.d.ts +59 -0
|
@@ -784,9 +784,9 @@ function getFarmIntegrationPluginServerRuntime(plugin) {
|
|
|
784
784
|
const value = plugin[FARM_INTEGRATION_PLUGIN_SERVER_RUNTIME];
|
|
785
785
|
return typeof value === "boolean" ? value : void 0;
|
|
786
786
|
}
|
|
787
|
-
function defineTypedIntegrationRoute(method,
|
|
787
|
+
function defineTypedIntegrationRoute(method, path28, input) {
|
|
788
788
|
return {
|
|
789
|
-
path:
|
|
789
|
+
path: path28,
|
|
790
790
|
method,
|
|
791
791
|
middleware: input.middleware,
|
|
792
792
|
before: input.before,
|
|
@@ -796,7 +796,7 @@ function defineTypedIntegrationRoute(method, path27, input) {
|
|
|
796
796
|
input: normalizeIntegrationRouteInputSchemas(input),
|
|
797
797
|
handler: input.handler,
|
|
798
798
|
__operation: defineIntegrationAPIOperation({
|
|
799
|
-
path:
|
|
799
|
+
path: path28,
|
|
800
800
|
method,
|
|
801
801
|
bodyFormat: input.bodyFormat,
|
|
802
802
|
responseFormat: input.responseFormat,
|
|
@@ -808,52 +808,52 @@ function defineTypedIntegrationRoute(method, path27, input) {
|
|
|
808
808
|
}
|
|
809
809
|
function createIntegrationRouteFactory() {
|
|
810
810
|
return {
|
|
811
|
-
get(
|
|
811
|
+
get(path28, input) {
|
|
812
812
|
return defineTypedIntegrationRoute(
|
|
813
813
|
"GET",
|
|
814
|
-
|
|
814
|
+
path28,
|
|
815
815
|
input
|
|
816
816
|
);
|
|
817
817
|
},
|
|
818
|
-
post(
|
|
818
|
+
post(path28, input) {
|
|
819
819
|
return defineTypedIntegrationRoute(
|
|
820
820
|
"POST",
|
|
821
|
-
|
|
821
|
+
path28,
|
|
822
822
|
{
|
|
823
823
|
bodyFormat: "json",
|
|
824
824
|
...input
|
|
825
825
|
}
|
|
826
826
|
);
|
|
827
827
|
},
|
|
828
|
-
put(
|
|
828
|
+
put(path28, input) {
|
|
829
829
|
return defineTypedIntegrationRoute(
|
|
830
830
|
"PUT",
|
|
831
|
-
|
|
831
|
+
path28,
|
|
832
832
|
{
|
|
833
833
|
bodyFormat: "json",
|
|
834
834
|
...input
|
|
835
835
|
}
|
|
836
836
|
);
|
|
837
837
|
},
|
|
838
|
-
patch(
|
|
839
|
-
return defineTypedIntegrationRoute("PATCH",
|
|
838
|
+
patch(path28, input) {
|
|
839
|
+
return defineTypedIntegrationRoute("PATCH", path28, {
|
|
840
840
|
bodyFormat: "json",
|
|
841
841
|
...input
|
|
842
842
|
});
|
|
843
843
|
},
|
|
844
|
-
delete(
|
|
845
|
-
return defineTypedIntegrationRoute("DELETE",
|
|
844
|
+
delete(path28, input) {
|
|
845
|
+
return defineTypedIntegrationRoute("DELETE", path28, {
|
|
846
846
|
bodyFormat: "json",
|
|
847
847
|
...input
|
|
848
848
|
});
|
|
849
849
|
},
|
|
850
|
-
options(
|
|
851
|
-
return defineTypedIntegrationRoute("OPTIONS",
|
|
850
|
+
options(path28, input) {
|
|
851
|
+
return defineTypedIntegrationRoute("OPTIONS", path28, input);
|
|
852
852
|
},
|
|
853
|
-
head(
|
|
853
|
+
head(path28, input) {
|
|
854
854
|
return defineTypedIntegrationRoute(
|
|
855
855
|
"HEAD",
|
|
856
|
-
|
|
856
|
+
path28,
|
|
857
857
|
input
|
|
858
858
|
);
|
|
859
859
|
}
|
|
@@ -1070,8 +1070,8 @@ async function parseIntegrationConfigSchema(integration, schema, value) {
|
|
|
1070
1070
|
function createIntegrationConfigValidationError(integration, error) {
|
|
1071
1071
|
const issues = Array.isArray(error.issues) && error.issues.length > 0 ? error.issues.map((issue) => {
|
|
1072
1072
|
const normalizedPath = normalizeIntegrationValidationPath(issue.path);
|
|
1073
|
-
const
|
|
1074
|
-
return `${
|
|
1073
|
+
const path28 = normalizedPath.length ? `${normalizedPath.join(".")}: ` : "";
|
|
1074
|
+
return `${path28}${issue.message || "Invalid config"}`;
|
|
1075
1075
|
}).join("; ") : error.message || "Invalid config";
|
|
1076
1076
|
return new Error(`Integration "${integration.type}" config validation failed: ${issues}`);
|
|
1077
1077
|
}
|
|
@@ -1756,8 +1756,8 @@ function normalizeIntegrationValidationIssues(source, error) {
|
|
|
1756
1756
|
}
|
|
1757
1757
|
];
|
|
1758
1758
|
}
|
|
1759
|
-
function normalizeIntegrationValidationPath(
|
|
1760
|
-
return (
|
|
1759
|
+
function normalizeIntegrationValidationPath(path28) {
|
|
1760
|
+
return (path28 || []).map((segment) => {
|
|
1761
1761
|
const key = typeof segment === "object" && segment !== null && "key" in segment ? segment.key : segment;
|
|
1762
1762
|
return typeof key === "symbol" ? key.description || key.toString() : key;
|
|
1763
1763
|
});
|
|
@@ -2408,13 +2408,13 @@ function getRequestId(req) {
|
|
|
2408
2408
|
return headerValue || String(Date.now());
|
|
2409
2409
|
}
|
|
2410
2410
|
async function readRequestBody(req) {
|
|
2411
|
-
return await new Promise((
|
|
2411
|
+
return await new Promise((resolve6, reject) => {
|
|
2412
2412
|
const chunks = [];
|
|
2413
2413
|
req.on("data", (chunk) => {
|
|
2414
2414
|
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
2415
2415
|
});
|
|
2416
2416
|
req.on("end", () => {
|
|
2417
|
-
|
|
2417
|
+
resolve6(Buffer.concat(chunks));
|
|
2418
2418
|
});
|
|
2419
2419
|
req.on("error", reject);
|
|
2420
2420
|
});
|
|
@@ -2513,7 +2513,7 @@ var init_integrations = __esm({
|
|
|
2513
2513
|
|
|
2514
2514
|
// src/markdown.ts
|
|
2515
2515
|
function resolveMarkdownConfig(config) {
|
|
2516
|
-
if (config === false
|
|
2516
|
+
if (config === false) {
|
|
2517
2517
|
return {
|
|
2518
2518
|
enabled: false,
|
|
2519
2519
|
expose: [],
|
|
@@ -2521,7 +2521,7 @@ function resolveMarkdownConfig(config) {
|
|
|
2521
2521
|
includeMetadata: true
|
|
2522
2522
|
};
|
|
2523
2523
|
}
|
|
2524
|
-
if (config === true) {
|
|
2524
|
+
if (config === true || config === void 0) {
|
|
2525
2525
|
return {
|
|
2526
2526
|
enabled: true,
|
|
2527
2527
|
expose: true,
|
|
@@ -2529,7 +2529,7 @@ function resolveMarkdownConfig(config) {
|
|
|
2529
2529
|
includeMetadata: true
|
|
2530
2530
|
};
|
|
2531
2531
|
}
|
|
2532
|
-
const exposeInput = config.expose ?? config.routes ??
|
|
2532
|
+
const exposeInput = config.expose ?? config.routes ?? true;
|
|
2533
2533
|
const expose = exposeInput === true ? true : Array.isArray(exposeInput) ? exposeInput.map(normalizeMarkdownRouteInput) : [];
|
|
2534
2534
|
return {
|
|
2535
2535
|
enabled: config.enabled !== false && (expose === true || expose.length > 0),
|
|
@@ -2538,11 +2538,14 @@ function resolveMarkdownConfig(config) {
|
|
|
2538
2538
|
includeMetadata: config.includeMetadata ?? true
|
|
2539
2539
|
};
|
|
2540
2540
|
}
|
|
2541
|
-
function resolveMarkdownMirrorTarget(config, pathname) {
|
|
2542
|
-
|
|
2541
|
+
function resolveMarkdownMirrorTarget(config, pathname, options = {}) {
|
|
2542
|
+
const hasMarkdownExtension = pathname.toLowerCase().endsWith(".md");
|
|
2543
|
+
if (!config?.enabled || !hasMarkdownExtension && !requestAcceptsMarkdown(options.accept)) {
|
|
2543
2544
|
return null;
|
|
2544
2545
|
}
|
|
2545
|
-
const targetPathname = normalizeMarkdownRoute(
|
|
2546
|
+
const targetPathname = normalizeMarkdownRoute(
|
|
2547
|
+
hasMarkdownExtension ? pathname.slice(0, -".md".length) || "/" : pathname
|
|
2548
|
+
);
|
|
2546
2549
|
const route = findExposedMarkdownRoute(config, targetPathname);
|
|
2547
2550
|
if (!route && config.expose !== true) {
|
|
2548
2551
|
return null;
|
|
@@ -2557,7 +2560,10 @@ async function createMarkdownMirrorResponse(options) {
|
|
|
2557
2560
|
return null;
|
|
2558
2561
|
}
|
|
2559
2562
|
const requestUrl = new URL(options.request.url);
|
|
2560
|
-
const
|
|
2563
|
+
const hasMarkdownExtension = requestUrl.pathname.toLowerCase().endsWith(".md");
|
|
2564
|
+
const target = resolveMarkdownMirrorTarget(options.config, requestUrl.pathname, {
|
|
2565
|
+
accept: options.request.headers.get("accept")
|
|
2566
|
+
});
|
|
2561
2567
|
if (!target) {
|
|
2562
2568
|
return null;
|
|
2563
2569
|
}
|
|
@@ -2585,8 +2591,12 @@ async function createMarkdownMirrorResponse(options) {
|
|
|
2585
2591
|
});
|
|
2586
2592
|
const headersOut = new Headers({
|
|
2587
2593
|
"Content-Type": "text/markdown; charset=utf-8",
|
|
2594
|
+
"Content-Location": target.pathname === "/" ? "/index.md" : `${target.pathname}.md`,
|
|
2588
2595
|
"X-Farm-Markdown-Route": target.pathname
|
|
2589
2596
|
});
|
|
2597
|
+
if (!hasMarkdownExtension) {
|
|
2598
|
+
headersOut.set("Vary", "Accept");
|
|
2599
|
+
}
|
|
2590
2600
|
const cache = target.route?.cache ?? options.config?.cache ?? false;
|
|
2591
2601
|
headersOut.set("Cache-Control", createMarkdownCacheHeader(cache));
|
|
2592
2602
|
return new Response(options.request.method === "HEAD" ? null : markdown, {
|
|
@@ -2672,11 +2682,24 @@ function normalizeMarkdownRouteInput(input) {
|
|
|
2672
2682
|
};
|
|
2673
2683
|
}
|
|
2674
2684
|
function normalizeMarkdownRoute(route) {
|
|
2675
|
-
const withoutMarkdownExtension = route.endsWith(".md") ? route.slice(0, -3) : route;
|
|
2685
|
+
const withoutMarkdownExtension = route.toLowerCase().endsWith(".md") ? route.slice(0, -3) : route;
|
|
2676
2686
|
const withSlash = withoutMarkdownExtension.startsWith("/") ? withoutMarkdownExtension : `/${withoutMarkdownExtension}`;
|
|
2677
2687
|
const normalized = withSlash.replace(/\/+/g, "/").replace(/\/$/g, "");
|
|
2678
2688
|
return normalized === "" || normalized === "/index" ? "/" : normalized;
|
|
2679
2689
|
}
|
|
2690
|
+
function requestAcceptsMarkdown(accept) {
|
|
2691
|
+
if (!accept) {
|
|
2692
|
+
return false;
|
|
2693
|
+
}
|
|
2694
|
+
return accept.split(",").some((entry) => {
|
|
2695
|
+
const [mediaType, ...parameters] = entry.trim().toLowerCase().split(";").map((part) => part.trim());
|
|
2696
|
+
if (mediaType !== "text/markdown") {
|
|
2697
|
+
return false;
|
|
2698
|
+
}
|
|
2699
|
+
const quality = parameters.find((parameter) => parameter.startsWith("q="));
|
|
2700
|
+
return quality === void 0 || Number(quality.slice(2)) > 0;
|
|
2701
|
+
});
|
|
2702
|
+
}
|
|
2680
2703
|
function findExposedMarkdownRoute(config, pathname) {
|
|
2681
2704
|
if (config.expose === true) {
|
|
2682
2705
|
return null;
|
|
@@ -2767,6 +2790,7 @@ var init_markdown = __esm({
|
|
|
2767
2790
|
__name(htmlToMarkdown, "htmlToMarkdown");
|
|
2768
2791
|
__name(normalizeMarkdownRouteInput, "normalizeMarkdownRouteInput");
|
|
2769
2792
|
__name(normalizeMarkdownRoute, "normalizeMarkdownRoute");
|
|
2793
|
+
__name(requestAcceptsMarkdown, "requestAcceptsMarkdown");
|
|
2770
2794
|
__name(findExposedMarkdownRoute, "findExposedMarkdownRoute");
|
|
2771
2795
|
__name(routeMatches, "routeMatches");
|
|
2772
2796
|
__name(isHtmlResponse, "isHtmlResponse");
|
|
@@ -2932,26 +2956,26 @@ async function prepareFarmWorkflowsForNitro(config) {
|
|
|
2932
2956
|
const root = config.root || process.cwd();
|
|
2933
2957
|
const distDir = config.distDir || ".farm";
|
|
2934
2958
|
const fs8 = await import("fs/promises");
|
|
2935
|
-
const
|
|
2936
|
-
const generatedDir =
|
|
2959
|
+
const path28 = await import("path");
|
|
2960
|
+
const generatedDir = path28.join(root, distDir, ".nitro", "farm-workflows");
|
|
2937
2961
|
await fs8.mkdir(generatedDir, { recursive: true });
|
|
2938
2962
|
const tasks = {};
|
|
2939
2963
|
const scheduledTasks = createScheduledTasks(workflows);
|
|
2940
2964
|
for (const workflow of workflows) {
|
|
2941
|
-
const wrapperPath =
|
|
2965
|
+
const wrapperPath = path28.join(generatedDir, `${safeFileName(workflow.id)}.mjs`);
|
|
2942
2966
|
await fs8.writeFile(wrapperPath, createNitroTaskWrapper(workflow), "utf8");
|
|
2943
2967
|
tasks[workflow.id] = {
|
|
2944
2968
|
handler: wrapperPath,
|
|
2945
2969
|
description: workflow.description || `Farm workflow ${workflow.id}`
|
|
2946
2970
|
};
|
|
2947
2971
|
}
|
|
2948
|
-
const handlerPath =
|
|
2972
|
+
const handlerPath = path28.join(generatedDir, "http-handler.mjs");
|
|
2949
2973
|
await fs8.writeFile(
|
|
2950
2974
|
handlerPath,
|
|
2951
2975
|
createNitroWorkflowHTTPHandler(workflowConfig, workflows),
|
|
2952
2976
|
"utf8"
|
|
2953
2977
|
);
|
|
2954
|
-
const manifestPath =
|
|
2978
|
+
const manifestPath = path28.join(generatedDir, "manifest.json");
|
|
2955
2979
|
await fs8.writeFile(
|
|
2956
2980
|
manifestPath,
|
|
2957
2981
|
JSON.stringify(
|
|
@@ -3034,10 +3058,10 @@ function resolveWorkflowDefinition(module2) {
|
|
|
3034
3058
|
}
|
|
3035
3059
|
async function findWorkflowFiles(root, dirs) {
|
|
3036
3060
|
const fs8 = await import("fs/promises");
|
|
3037
|
-
const
|
|
3061
|
+
const path28 = await import("path");
|
|
3038
3062
|
const files = [];
|
|
3039
3063
|
for (const dir of dirs) {
|
|
3040
|
-
const absoluteDir =
|
|
3064
|
+
const absoluteDir = path28.isAbsolute(dir) ? dir : path28.join(root, dir);
|
|
3041
3065
|
if (!await pathExists(absoluteDir)) continue;
|
|
3042
3066
|
await walkWorkflowDir(absoluteDir, files);
|
|
3043
3067
|
}
|
|
@@ -3045,10 +3069,10 @@ async function findWorkflowFiles(root, dirs) {
|
|
|
3045
3069
|
}
|
|
3046
3070
|
async function walkWorkflowDir(dir, files) {
|
|
3047
3071
|
const fs8 = await import("fs/promises");
|
|
3048
|
-
const
|
|
3072
|
+
const path28 = await import("path");
|
|
3049
3073
|
const entries = await fs8.readdir(dir, { withFileTypes: true });
|
|
3050
3074
|
for (const entry of entries) {
|
|
3051
|
-
const filePath =
|
|
3075
|
+
const filePath = path28.join(dir, entry.name);
|
|
3052
3076
|
if (entry.isDirectory()) {
|
|
3053
3077
|
if (entry.name === "node_modules" || entry.name.startsWith(".")) continue;
|
|
3054
3078
|
await walkWorkflowDir(filePath, files);
|
|
@@ -3068,12 +3092,12 @@ function isWorkflowFile(fileName) {
|
|
|
3068
3092
|
}
|
|
3069
3093
|
async function loadWorkflowModule(filePath, root) {
|
|
3070
3094
|
const fs8 = await import("fs/promises");
|
|
3071
|
-
const
|
|
3072
|
-
const { pathToFileURL:
|
|
3095
|
+
const path28 = await import("path");
|
|
3096
|
+
const { pathToFileURL: pathToFileURL4 } = await import("url");
|
|
3073
3097
|
const { build: build2 } = await import("esbuild");
|
|
3074
|
-
const outDir =
|
|
3098
|
+
const outDir = path28.join(root, ".farm", ".workflow-loader");
|
|
3075
3099
|
await fs8.mkdir(outDir, { recursive: true });
|
|
3076
|
-
const outfile =
|
|
3100
|
+
const outfile = path28.join(
|
|
3077
3101
|
outDir,
|
|
3078
3102
|
`workflow-${Date.now()}-${Math.random().toString(36).slice(2)}.mjs`
|
|
3079
3103
|
);
|
|
@@ -3094,7 +3118,7 @@ async function loadWorkflowModule(filePath, root) {
|
|
|
3094
3118
|
try {
|
|
3095
3119
|
return await import(
|
|
3096
3120
|
/* @vite-ignore */
|
|
3097
|
-
`${
|
|
3121
|
+
`${pathToFileURL4(outfile).href}?t=${Date.now()}`
|
|
3098
3122
|
);
|
|
3099
3123
|
} finally {
|
|
3100
3124
|
await fs8.unlink(outfile).catch(() => void 0);
|
|
@@ -3352,9 +3376,9 @@ async function prepareFarmCronForNitro(config) {
|
|
|
3352
3376
|
const root = config.root || process.cwd();
|
|
3353
3377
|
const distDir = config.distDir || ".farm";
|
|
3354
3378
|
const fs8 = await import("fs/promises");
|
|
3355
|
-
const
|
|
3356
|
-
const manifestPath =
|
|
3357
|
-
const generatedDir =
|
|
3379
|
+
const path28 = await import("path");
|
|
3380
|
+
const manifestPath = path28.join(root, distDir, FARM_CRON_MANIFEST);
|
|
3381
|
+
const generatedDir = path28.join(root, distDir, ".nitro", "farm-cron");
|
|
3358
3382
|
if (!cron.enabled) {
|
|
3359
3383
|
await Promise.all([
|
|
3360
3384
|
fs8.rm(manifestPath, { force: true }),
|
|
@@ -3371,7 +3395,7 @@ async function prepareFarmCronForNitro(config) {
|
|
|
3371
3395
|
const tasks = {};
|
|
3372
3396
|
for (const job of cron.jobs) {
|
|
3373
3397
|
const taskName = getFarmCronTaskName(job.name);
|
|
3374
|
-
const wrapperPath =
|
|
3398
|
+
const wrapperPath = path28.join(generatedDir, `${safeFileName2(job.name)}.mjs`);
|
|
3375
3399
|
await fs8.writeFile(wrapperPath, createNitroCronTaskWrapper(job, cron.secretEnv), "utf8");
|
|
3376
3400
|
tasks[taskName] = {
|
|
3377
3401
|
handler: wrapperPath,
|
|
@@ -3379,7 +3403,7 @@ async function prepareFarmCronForNitro(config) {
|
|
|
3379
3403
|
};
|
|
3380
3404
|
}
|
|
3381
3405
|
const manifest = createFarmCronManifest(cron);
|
|
3382
|
-
await fs8.mkdir(
|
|
3406
|
+
await fs8.mkdir(path28.dirname(manifestPath), { recursive: true });
|
|
3383
3407
|
await fs8.writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}
|
|
3384
3408
|
`, "utf8");
|
|
3385
3409
|
return {
|
|
@@ -3461,7 +3485,7 @@ function normalizeCronJob(name, job) {
|
|
|
3461
3485
|
if (!job || typeof job !== "object" || Array.isArray(job)) {
|
|
3462
3486
|
throw new TypeError(`Farm cron ${JSON.stringify(name)} must be a configuration object.`);
|
|
3463
3487
|
}
|
|
3464
|
-
const
|
|
3488
|
+
const path28 = normalizeCronPath(name, job.path);
|
|
3465
3489
|
const rawSchedule = Array.isArray(job.schedule) ? job.schedule : [job.schedule];
|
|
3466
3490
|
const schedule = [...new Set(rawSchedule.map((value) => normalizeCronExpression(name, value)))];
|
|
3467
3491
|
if (schedule.length === 0) {
|
|
@@ -3470,7 +3494,7 @@ function normalizeCronJob(name, job) {
|
|
|
3470
3494
|
return {
|
|
3471
3495
|
name,
|
|
3472
3496
|
schedule,
|
|
3473
|
-
path:
|
|
3497
|
+
path: path28,
|
|
3474
3498
|
description: job.description?.trim() || void 0
|
|
3475
3499
|
};
|
|
3476
3500
|
}
|
|
@@ -3478,13 +3502,13 @@ function normalizeCronPath(name, value) {
|
|
|
3478
3502
|
if (typeof value !== "string" || !value.trim().startsWith("/")) {
|
|
3479
3503
|
throw new TypeError(`Farm cron ${JSON.stringify(name)} path must start with "/".`);
|
|
3480
3504
|
}
|
|
3481
|
-
const
|
|
3482
|
-
if (
|
|
3505
|
+
const path28 = value.trim();
|
|
3506
|
+
if (path28.startsWith("//") || path28.includes("?") || path28.includes("#")) {
|
|
3483
3507
|
throw new TypeError(
|
|
3484
3508
|
`Farm cron ${JSON.stringify(name)} path must be an application pathname without a host, query, or hash.`
|
|
3485
3509
|
);
|
|
3486
3510
|
}
|
|
3487
|
-
return
|
|
3511
|
+
return path28.length > 1 ? path28.replace(/\/+$/, "") : path28;
|
|
3488
3512
|
}
|
|
3489
3513
|
function normalizeCronExpression(name, value) {
|
|
3490
3514
|
if (typeof value !== "string") {
|
|
@@ -3932,7 +3956,8 @@ async function createFarmMarkdownSourceResponse(options) {
|
|
|
3932
3956
|
return null;
|
|
3933
3957
|
}
|
|
3934
3958
|
const url = new URL(options.request.url);
|
|
3935
|
-
|
|
3959
|
+
const hasMarkdownExtension = url.pathname.toLowerCase().endsWith(".md");
|
|
3960
|
+
if (!hasMarkdownExtension && !requestAcceptsMarkdown(options.request.headers.get("accept"))) {
|
|
3936
3961
|
return null;
|
|
3937
3962
|
}
|
|
3938
3963
|
const targetPathname = normalizeFarmMarkdownRoutePath(url.pathname);
|
|
@@ -3940,14 +3965,19 @@ async function createFarmMarkdownSourceResponse(options) {
|
|
|
3940
3965
|
if (!source) {
|
|
3941
3966
|
return null;
|
|
3942
3967
|
}
|
|
3968
|
+
const headers = new Headers({
|
|
3969
|
+
"Content-Type": "text/markdown; charset=utf-8",
|
|
3970
|
+
"Content-Location": targetPathname === "/" ? "/index.md" : `${targetPathname}.md`,
|
|
3971
|
+
"Cache-Control": "public, s-maxage=60, stale-while-revalidate=300",
|
|
3972
|
+
"X-Farm-Markdown-Route": targetPathname,
|
|
3973
|
+
"X-Farm-Markdown-Source": source.filePath
|
|
3974
|
+
});
|
|
3975
|
+
if (!hasMarkdownExtension) {
|
|
3976
|
+
headers.set("Vary", "Accept");
|
|
3977
|
+
}
|
|
3943
3978
|
return new Response(options.request.method === "HEAD" ? null : source.source, {
|
|
3944
3979
|
status: 200,
|
|
3945
|
-
headers
|
|
3946
|
-
"Content-Type": "text/markdown; charset=utf-8",
|
|
3947
|
-
"Cache-Control": "public, s-maxage=60, stale-while-revalidate=300",
|
|
3948
|
-
"X-Farm-Markdown-Route": targetPathname,
|
|
3949
|
-
"X-Farm-Markdown-Source": source.filePath
|
|
3950
|
-
}
|
|
3980
|
+
headers
|
|
3951
3981
|
});
|
|
3952
3982
|
}
|
|
3953
3983
|
var import_react, import_promises, import_path, import_url;
|
|
@@ -3958,6 +3988,7 @@ var init_app_markdown = __esm({
|
|
|
3958
3988
|
import_promises = require("fs/promises");
|
|
3959
3989
|
import_path = __toESM(require("path"));
|
|
3960
3990
|
import_url = require("url");
|
|
3991
|
+
init_markdown();
|
|
3961
3992
|
__name(resolveMdxConfig, "resolveMdxConfig");
|
|
3962
3993
|
__name(isFarmMarkdownPageFile, "isFarmMarkdownPageFile");
|
|
3963
3994
|
__name(normalizeFarmMarkdownRoutePath, "normalizeFarmMarkdownRoutePath");
|
|
@@ -4873,8 +4904,8 @@ function createFarmDeploymentMismatchResponse(mismatch) {
|
|
|
4873
4904
|
}
|
|
4874
4905
|
);
|
|
4875
4906
|
}
|
|
4876
|
-
function createFarmDeploymentCookie(deploymentId,
|
|
4877
|
-
const normalizedPath =
|
|
4907
|
+
function createFarmDeploymentCookie(deploymentId, path28 = "/", secure = false) {
|
|
4908
|
+
const normalizedPath = path28.startsWith("/") ? path28 : `/${path28}`;
|
|
4878
4909
|
return [
|
|
4879
4910
|
`${FARM_DEPLOYMENT_COOKIE}=${encodeURIComponent(deploymentId)}`,
|
|
4880
4911
|
`Path=${normalizedPath}`,
|
|
@@ -4945,7 +4976,7 @@ var init_devtools_config = __esm({
|
|
|
4945
4976
|
|
|
4946
4977
|
// src/image-config.ts
|
|
4947
4978
|
function resolveFarmImageConfig(config) {
|
|
4948
|
-
const
|
|
4979
|
+
const path28 = normalizeImagePath(config?.path ?? DEFAULT_FARM_IMAGE_PATH);
|
|
4949
4980
|
const deviceSizes = normalizeIntegerList(
|
|
4950
4981
|
config?.deviceSizes ?? DEFAULT_FARM_IMAGE_DEVICE_SIZES,
|
|
4951
4982
|
"images.deviceSizes"
|
|
@@ -4973,7 +5004,7 @@ function resolveFarmImageConfig(config) {
|
|
|
4973
5004
|
);
|
|
4974
5005
|
return Object.freeze({
|
|
4975
5006
|
provider: config?.provider ?? "auto",
|
|
4976
|
-
path:
|
|
5007
|
+
path: path28,
|
|
4977
5008
|
domains: Object.freeze([
|
|
4978
5009
|
...new Set(
|
|
4979
5010
|
(config?.domains ?? []).map((domain) => domain.trim().toLowerCase()).filter(Boolean)
|
|
@@ -5012,11 +5043,11 @@ function getPublicFarmImageConfig(config) {
|
|
|
5012
5043
|
};
|
|
5013
5044
|
}
|
|
5014
5045
|
function normalizeImagePath(value) {
|
|
5015
|
-
const
|
|
5016
|
-
if (!
|
|
5046
|
+
const path28 = value.trim().replace(/\/+$/, "") || "/";
|
|
5047
|
+
if (!path28.startsWith("/") || path28.includes("?") || path28.includes("#")) {
|
|
5017
5048
|
throw new TypeError("images.path must be an absolute pathname without a query or hash");
|
|
5018
5049
|
}
|
|
5019
|
-
return
|
|
5050
|
+
return path28;
|
|
5020
5051
|
}
|
|
5021
5052
|
function normalizeIntegerList(values, name, max) {
|
|
5022
5053
|
if (values.length === 0) {
|
|
@@ -5240,6 +5271,96 @@ var init_config = __esm({
|
|
|
5240
5271
|
}
|
|
5241
5272
|
});
|
|
5242
5273
|
|
|
5274
|
+
// src/auth-config.ts
|
|
5275
|
+
function resolveFarmAuthConfig(input) {
|
|
5276
|
+
const config = input === true ? {} : input && typeof input === "object" ? input : {};
|
|
5277
|
+
const passwordConfig = typeof config.emailAndPassword === "object" ? config.emailAndPassword : {};
|
|
5278
|
+
const resolved = {
|
|
5279
|
+
enabled: input !== void 0 && input !== false && config.enabled !== false,
|
|
5280
|
+
appName: config.appName,
|
|
5281
|
+
basePath: normalizeBasePath(config.basePath),
|
|
5282
|
+
emailAndPassword: {
|
|
5283
|
+
enabled: config.emailAndPassword !== false,
|
|
5284
|
+
requireEmailVerification: passwordConfig.requireEmailVerification ?? false,
|
|
5285
|
+
minPasswordLength: passwordConfig.minPasswordLength ?? 8,
|
|
5286
|
+
maxPasswordLength: passwordConfig.maxPasswordLength ?? 128
|
|
5287
|
+
},
|
|
5288
|
+
session: {
|
|
5289
|
+
expiresIn: config.session?.expiresIn ?? 60 * 60 * 24 * 7,
|
|
5290
|
+
updateAge: config.session?.updateAge ?? 60 * 60 * 24
|
|
5291
|
+
},
|
|
5292
|
+
database: {
|
|
5293
|
+
url: config.database?.url,
|
|
5294
|
+
path: config.database?.path || ".farm/auth.sqlite",
|
|
5295
|
+
migrateInDevelopment: config.database?.migrateInDevelopment ?? true
|
|
5296
|
+
}
|
|
5297
|
+
};
|
|
5298
|
+
validateFarmAuthConfig(resolved);
|
|
5299
|
+
return resolved;
|
|
5300
|
+
}
|
|
5301
|
+
async function resolveFarmAuthIntegration(config, options) {
|
|
5302
|
+
if (!config.enabled) return void 0;
|
|
5303
|
+
const root = import_node_path3.default.resolve(options.root);
|
|
5304
|
+
let modulePath;
|
|
5305
|
+
try {
|
|
5306
|
+
const resolveFromApp = (0, import_node_module2.createRequire)(import_node_path3.default.join(root, "package.json"));
|
|
5307
|
+
modulePath = resolveFromApp.resolve("@farm.js/auth/internal");
|
|
5308
|
+
} catch {
|
|
5309
|
+
throw new Error(
|
|
5310
|
+
"The `auth` config requires @farm.js/auth. Install it with `pnpm add @farm.js/auth` and try again."
|
|
5311
|
+
);
|
|
5312
|
+
}
|
|
5313
|
+
const runtime = await import(
|
|
5314
|
+
/* @vite-ignore */
|
|
5315
|
+
(0, import_node_url2.pathToFileURL)(modulePath).href
|
|
5316
|
+
);
|
|
5317
|
+
if (typeof runtime.createFarmAuthIntegration !== "function") {
|
|
5318
|
+
throw new Error(
|
|
5319
|
+
"The installed @farm.js/auth package is incompatible with this version of @farm.js/core."
|
|
5320
|
+
);
|
|
5321
|
+
}
|
|
5322
|
+
return runtime.createFarmAuthIntegration(config, {
|
|
5323
|
+
...options,
|
|
5324
|
+
root
|
|
5325
|
+
});
|
|
5326
|
+
}
|
|
5327
|
+
function normalizeBasePath(value) {
|
|
5328
|
+
const route = (value || "/api/auth").trim();
|
|
5329
|
+
const withLeadingSlash = route.startsWith("/") ? route : `/${route}`;
|
|
5330
|
+
const normalized = withLeadingSlash.replace(/\/+/g, "/").replace(/\/+$/, "");
|
|
5331
|
+
return normalized || "/api/auth";
|
|
5332
|
+
}
|
|
5333
|
+
function validateFarmAuthConfig(config) {
|
|
5334
|
+
const { minPasswordLength, maxPasswordLength } = config.emailAndPassword;
|
|
5335
|
+
if (!Number.isInteger(minPasswordLength) || minPasswordLength < 1) {
|
|
5336
|
+
throw new Error("auth.emailAndPassword.minPasswordLength must be a positive integer.");
|
|
5337
|
+
}
|
|
5338
|
+
if (!Number.isInteger(maxPasswordLength) || maxPasswordLength < minPasswordLength) {
|
|
5339
|
+
throw new Error(
|
|
5340
|
+
"auth.emailAndPassword.maxPasswordLength must be an integer greater than or equal to minPasswordLength."
|
|
5341
|
+
);
|
|
5342
|
+
}
|
|
5343
|
+
if (!Number.isInteger(config.session.expiresIn) || config.session.expiresIn < 1) {
|
|
5344
|
+
throw new Error("auth.session.expiresIn must be a positive integer.");
|
|
5345
|
+
}
|
|
5346
|
+
if (!Number.isInteger(config.session.updateAge) || config.session.updateAge < 0) {
|
|
5347
|
+
throw new Error("auth.session.updateAge must be a non-negative integer.");
|
|
5348
|
+
}
|
|
5349
|
+
}
|
|
5350
|
+
var import_node_module2, import_node_path3, import_node_url2;
|
|
5351
|
+
var init_auth_config = __esm({
|
|
5352
|
+
"src/auth-config.ts"() {
|
|
5353
|
+
"use strict";
|
|
5354
|
+
import_node_module2 = require("module");
|
|
5355
|
+
import_node_path3 = __toESM(require("path"));
|
|
5356
|
+
import_node_url2 = require("url");
|
|
5357
|
+
__name(resolveFarmAuthConfig, "resolveFarmAuthConfig");
|
|
5358
|
+
__name(resolveFarmAuthIntegration, "resolveFarmAuthIntegration");
|
|
5359
|
+
__name(normalizeBasePath, "normalizeBasePath");
|
|
5360
|
+
__name(validateFarmAuthConfig, "validateFarmAuthConfig");
|
|
5361
|
+
}
|
|
5362
|
+
});
|
|
5363
|
+
|
|
5243
5364
|
// src/config-entry.ts
|
|
5244
5365
|
var init_config_entry = __esm({
|
|
5245
5366
|
"src/config-entry.ts"() {
|
|
@@ -5360,18 +5481,18 @@ function sanitizeDocsConfig(config) {
|
|
|
5360
5481
|
return cloneSerializable(config) || {};
|
|
5361
5482
|
}
|
|
5362
5483
|
async function findDocsConfigPath(rootDir, configPath) {
|
|
5363
|
-
const { existsSync:
|
|
5484
|
+
const { existsSync: existsSync15 } = await import("fs");
|
|
5364
5485
|
const root = import_path2.default.resolve(rootDir || process.cwd());
|
|
5365
5486
|
if (configPath) {
|
|
5366
5487
|
const resolvedPath = import_path2.default.isAbsolute(configPath) ? configPath : import_path2.default.join(root, configPath);
|
|
5367
|
-
if (!
|
|
5488
|
+
if (!existsSync15(resolvedPath)) {
|
|
5368
5489
|
throw new Error(`Could not find docs config at ${configPath}.`);
|
|
5369
5490
|
}
|
|
5370
5491
|
return import_path2.default.resolve(resolvedPath);
|
|
5371
5492
|
}
|
|
5372
5493
|
for (const filename of DOCS_CONFIG_FILENAMES) {
|
|
5373
5494
|
const resolvedPath = import_path2.default.join(root, filename);
|
|
5374
|
-
if (
|
|
5495
|
+
if (existsSync15(resolvedPath)) {
|
|
5375
5496
|
return resolvedPath;
|
|
5376
5497
|
}
|
|
5377
5498
|
}
|
|
@@ -5379,7 +5500,7 @@ async function findDocsConfigPath(rootDir, configPath) {
|
|
|
5379
5500
|
}
|
|
5380
5501
|
async function loadDocsConfig(rootDir, configPath) {
|
|
5381
5502
|
const fs8 = await import("fs/promises");
|
|
5382
|
-
const { pathToFileURL:
|
|
5503
|
+
const { pathToFileURL: pathToFileURL4 } = await import("url");
|
|
5383
5504
|
const root = import_path2.default.resolve(rootDir || process.cwd());
|
|
5384
5505
|
const resolvedPath = await findDocsConfigPath(root, configPath);
|
|
5385
5506
|
if (!resolvedPath) return void 0;
|
|
@@ -5408,7 +5529,7 @@ async function loadDocsConfig(rootDir, configPath) {
|
|
|
5408
5529
|
logLevel: "silent",
|
|
5409
5530
|
sourcemap: "inline"
|
|
5410
5531
|
});
|
|
5411
|
-
const moduleUrl =
|
|
5532
|
+
const moduleUrl = pathToFileURL4(modulePath).href + `?t=${Date.now()}`;
|
|
5412
5533
|
let importedConfig;
|
|
5413
5534
|
try {
|
|
5414
5535
|
importedConfig = await import(
|
|
@@ -5509,6 +5630,17 @@ async function resolveConfig(userConfig, mode) {
|
|
|
5509
5630
|
const mdx = resolveMdxConfig(userConfig.mdx);
|
|
5510
5631
|
const env2 = resolveEnv(userConfig.env, process.env);
|
|
5511
5632
|
setEnv(env2);
|
|
5633
|
+
const auth = resolveFarmAuthConfig(userConfig.auth);
|
|
5634
|
+
if (auth.enabled && userConfig.integrations?.auth) {
|
|
5635
|
+
throw new Error(
|
|
5636
|
+
"Choose either the top-level `auth` config or `integrations.auth`; they cannot both own the auth route."
|
|
5637
|
+
);
|
|
5638
|
+
}
|
|
5639
|
+
const nativeAuthIntegration = await resolveFarmAuthIntegration(auth, {
|
|
5640
|
+
root,
|
|
5641
|
+
mode
|
|
5642
|
+
});
|
|
5643
|
+
const integrations = nativeAuthIntegration ? { ...userConfig.integrations, auth: nativeAuthIntegration } : userConfig.integrations || {};
|
|
5512
5644
|
const generateBuildId = userConfig.generateBuildId || (() => `build-${Date.now()}`);
|
|
5513
5645
|
const deploymentId = normalizeFarmDeploymentId(
|
|
5514
5646
|
userConfig.deploymentId || process.env.FARM_DEPLOYMENT_ID || process.env.VERCEL_GIT_COMMIT_SHA || process.env.CF_PAGES_COMMIT_SHA || (mode === "production" ? await generateBuildId() : "development")
|
|
@@ -5533,14 +5665,15 @@ async function resolveConfig(userConfig, mode) {
|
|
|
5533
5665
|
devtools: resolveFarmDevtoolsConfig(userConfig.devtools, mode),
|
|
5534
5666
|
storage: userConfig.storage || {},
|
|
5535
5667
|
cache: userConfig.cache || {},
|
|
5668
|
+
auth,
|
|
5536
5669
|
suppressLintOnLink: userConfig.suppressLintOnLink ?? false,
|
|
5537
5670
|
experimental: {
|
|
5538
5671
|
serverComponents: false,
|
|
5539
5672
|
serverActions: false,
|
|
5540
5673
|
...userConfig.experimental
|
|
5541
5674
|
},
|
|
5542
|
-
plugins: [...resolveIntegrationPlugins(
|
|
5543
|
-
integrations
|
|
5675
|
+
plugins: [...resolveIntegrationPlugins(integrations), ...userConfig.plugins || []],
|
|
5676
|
+
integrations,
|
|
5544
5677
|
trailingSlash: userConfig.trailingSlash ?? false,
|
|
5545
5678
|
redirects: /* @__PURE__ */ __name(() => [...redirects, ...routeRuleRedirects], "redirects"),
|
|
5546
5679
|
rewrites: /* @__PURE__ */ __name(() => rewrites, "rewrites"),
|
|
@@ -5585,7 +5718,7 @@ async function resolveConfig(userConfig, mode) {
|
|
|
5585
5718
|
return resolved;
|
|
5586
5719
|
}
|
|
5587
5720
|
async function loadConfig(rootDir, configPath, mode = process.env.NODE_ENV === "production" ? "production" : "development", loadEnvironment) {
|
|
5588
|
-
const { existsSync:
|
|
5721
|
+
const { existsSync: existsSync15 } = await import("fs");
|
|
5589
5722
|
const loadEnv = loadEnvironment || (await import("vite")).loadEnv;
|
|
5590
5723
|
const root = rootDir || process.cwd();
|
|
5591
5724
|
const loadedEnv = loadEnv(mode, root, "");
|
|
@@ -5609,7 +5742,7 @@ async function loadConfig(rootDir, configPath, mode = process.env.NODE_ENV === "
|
|
|
5609
5742
|
try {
|
|
5610
5743
|
const absolutePath = relativePath2.startsWith("/") ? relativePath2 : import_path2.default.join(root, relativePath2);
|
|
5611
5744
|
const normalizedPath = import_path2.default.resolve(absolutePath);
|
|
5612
|
-
if (!
|
|
5745
|
+
if (!existsSync15(normalizedPath)) {
|
|
5613
5746
|
continue;
|
|
5614
5747
|
}
|
|
5615
5748
|
const loadedConfig = await loadFarmConfigFile(normalizedPath, { root });
|
|
@@ -5639,6 +5772,7 @@ var init_config2 = __esm({
|
|
|
5639
5772
|
init_devtools_config();
|
|
5640
5773
|
init_image_config();
|
|
5641
5774
|
init_config();
|
|
5775
|
+
init_auth_config();
|
|
5642
5776
|
init_config_entry();
|
|
5643
5777
|
FARM_RESOLVED_CUSTOM_CONTEXT = /* @__PURE__ */ Symbol.for("farm.resolvedCustomContext");
|
|
5644
5778
|
__name(hasCustomFarmRouteContext, "hasCustomFarmRouteContext");
|
|
@@ -6404,7 +6538,7 @@ function normalizePositiveDuration(value, fallback, name) {
|
|
|
6404
6538
|
return Math.floor(value);
|
|
6405
6539
|
}
|
|
6406
6540
|
function delay(ms) {
|
|
6407
|
-
return new Promise((
|
|
6541
|
+
return new Promise((resolve6) => setTimeout(resolve6, ms));
|
|
6408
6542
|
}
|
|
6409
6543
|
function normalizeCacheOptionsTags(options) {
|
|
6410
6544
|
const tags = /* @__PURE__ */ new Set();
|
|
@@ -6964,7 +7098,7 @@ function getProgrammaticRouteSearchClientOptions(search) {
|
|
|
6964
7098
|
if (search.temporary?.length) options.temporary = [...search.temporary];
|
|
6965
7099
|
return Object.keys(options).length > 0 ? options : void 0;
|
|
6966
7100
|
}
|
|
6967
|
-
function resolveProgrammaticRouteSearch(searchConfig, rawSearch,
|
|
7101
|
+
function resolveProgrammaticRouteSearch(searchConfig, rawSearch, path28, routePath) {
|
|
6968
7102
|
const schema = getProgrammaticRouteSearchSchema(searchConfig);
|
|
6969
7103
|
const search = parseProgrammaticSchema(schema, rawSearch, "search", routePath);
|
|
6970
7104
|
const options = getProgrammaticRouteSearchOptions(searchConfig);
|
|
@@ -6973,7 +7107,7 @@ function resolveProgrammaticRouteSearch(searchConfig, rawSearch, path27, routePa
|
|
|
6973
7107
|
schema,
|
|
6974
7108
|
rawSearch,
|
|
6975
7109
|
parsedSearch: search,
|
|
6976
|
-
path:
|
|
7110
|
+
path: path28
|
|
6977
7111
|
});
|
|
6978
7112
|
return { search, canonicalPath };
|
|
6979
7113
|
}
|
|
@@ -7140,7 +7274,7 @@ function createRouteModuleFromProgrammaticPage(route) {
|
|
|
7140
7274
|
mod.__farmRouteData = route.data;
|
|
7141
7275
|
mod.__farmRouteParsesProps = true;
|
|
7142
7276
|
mod.__farmResolveRouteProps = (props) => resolveProgrammaticRouteProps(route, props);
|
|
7143
|
-
mod.__farmResolveRouteCanonicalPath = (rawSearch,
|
|
7277
|
+
mod.__farmResolveRouteCanonicalPath = (rawSearch, path28) => resolveProgrammaticRouteSearch(route.search, rawSearch, path28, route.path).canonicalPath;
|
|
7144
7278
|
}
|
|
7145
7279
|
if (route.pending || route.error || route.notFound) {
|
|
7146
7280
|
mod.__farmRouteComponents = {
|
|
@@ -7538,25 +7672,25 @@ var init_routes = __esm({
|
|
|
7538
7672
|
];
|
|
7539
7673
|
__name(defineRoutes, "defineRoutes");
|
|
7540
7674
|
routesBuilder = {
|
|
7541
|
-
page(
|
|
7675
|
+
page(path28, options) {
|
|
7542
7676
|
return normalizeProgrammaticRoute({
|
|
7543
7677
|
kind: "page",
|
|
7544
|
-
path:
|
|
7678
|
+
path: path28,
|
|
7545
7679
|
...options
|
|
7546
7680
|
});
|
|
7547
7681
|
},
|
|
7548
|
-
layout(
|
|
7682
|
+
layout(path28, options) {
|
|
7549
7683
|
return normalizeProgrammaticRoute({
|
|
7550
7684
|
kind: "layout",
|
|
7551
|
-
path:
|
|
7685
|
+
path: path28,
|
|
7552
7686
|
...options
|
|
7553
7687
|
});
|
|
7554
7688
|
},
|
|
7555
|
-
api(
|
|
7689
|
+
api(path28, options) {
|
|
7556
7690
|
const { render, runtime, regions, maxDuration, ...methods } = options;
|
|
7557
7691
|
return normalizeProgrammaticRoute({
|
|
7558
7692
|
kind: "api",
|
|
7559
|
-
path:
|
|
7693
|
+
path: path28,
|
|
7560
7694
|
render,
|
|
7561
7695
|
runtime,
|
|
7562
7696
|
regions,
|
|
@@ -7897,13 +8031,13 @@ async function inspectStaticMetadataImage(filePath) {
|
|
|
7897
8031
|
};
|
|
7898
8032
|
}
|
|
7899
8033
|
function getStaticMetadataImageAltPath(filePath) {
|
|
7900
|
-
return
|
|
7901
|
-
|
|
7902
|
-
`${
|
|
8034
|
+
return import_node_path4.default.join(
|
|
8035
|
+
import_node_path4.default.dirname(filePath),
|
|
8036
|
+
`${import_node_path4.default.basename(filePath, import_node_path4.default.extname(filePath))}.alt.txt`
|
|
7903
8037
|
);
|
|
7904
8038
|
}
|
|
7905
8039
|
function getStaticMetadataImageExtension(filePath) {
|
|
7906
|
-
const extension =
|
|
8040
|
+
const extension = import_node_path4.default.extname(filePath).slice(1).toLowerCase();
|
|
7907
8041
|
return STATIC_METADATA_IMAGE_EXTENSIONS.includes(extension) ? extension : null;
|
|
7908
8042
|
}
|
|
7909
8043
|
async function readAltText(filePath) {
|
|
@@ -7917,13 +8051,13 @@ async function readAltText(filePath) {
|
|
|
7917
8051
|
throw error;
|
|
7918
8052
|
}
|
|
7919
8053
|
}
|
|
7920
|
-
var import_node_crypto, import_promises4,
|
|
8054
|
+
var import_node_crypto, import_promises4, import_node_path4, import_image_size, STATIC_METADATA_IMAGE_EXTENSIONS, CONTENT_TYPES;
|
|
7921
8055
|
var init_static_metadata_image = __esm({
|
|
7922
8056
|
"src/static-metadata-image.ts"() {
|
|
7923
8057
|
"use strict";
|
|
7924
8058
|
import_node_crypto = require("crypto");
|
|
7925
8059
|
import_promises4 = require("fs/promises");
|
|
7926
|
-
|
|
8060
|
+
import_node_path4 = __toESM(require("path"));
|
|
7927
8061
|
import_image_size = require("image-size");
|
|
7928
8062
|
STATIC_METADATA_IMAGE_EXTENSIONS = ["png", "jpg", "jpeg", "gif", "webp"];
|
|
7929
8063
|
CONTENT_TYPES = {
|
|
@@ -8517,8 +8651,56 @@ var init_route_manager = __esm({
|
|
|
8517
8651
|
"**/{opengraph-image,twitter-image}.{ts,tsx,js,jsx,png,jpg,jpeg,gif,webp}",
|
|
8518
8652
|
appDir
|
|
8519
8653
|
);
|
|
8654
|
+
const canonicalPageGroups = /* @__PURE__ */ new Map();
|
|
8655
|
+
for (const file of pageFiles.filter((candidate) => parseRouteSlotFile(candidate) === null)) {
|
|
8656
|
+
const route = parseRoutePath(file);
|
|
8657
|
+
const pattern = this.createRoutePattern(route);
|
|
8658
|
+
const group = canonicalPageGroups.get(pattern);
|
|
8659
|
+
if (group) {
|
|
8660
|
+
group.files.push(file);
|
|
8661
|
+
} else {
|
|
8662
|
+
canonicalPageGroups.set(pattern, {
|
|
8663
|
+
route,
|
|
8664
|
+
files: [file]
|
|
8665
|
+
});
|
|
8666
|
+
}
|
|
8667
|
+
}
|
|
8668
|
+
for (const [pattern, group] of canonicalPageGroups) {
|
|
8669
|
+
const componentFiles = group.files.filter((file) => !isFarmMarkdownPageFile(file));
|
|
8670
|
+
const markdownFiles = group.files.filter(isFarmMarkdownPageFile);
|
|
8671
|
+
if (componentFiles.length > 1) {
|
|
8672
|
+
throw new Error(
|
|
8673
|
+
`Duplicate page route "${pattern}". Found ${componentFiles.map((file) => import_path6.default.join(appDir, file)).join(" and ")}.`
|
|
8674
|
+
);
|
|
8675
|
+
}
|
|
8676
|
+
if (markdownFiles.length > 1) {
|
|
8677
|
+
throw new Error(
|
|
8678
|
+
`Duplicate markdown representation for page route "${pattern}". Found ${markdownFiles.map((file) => import_path6.default.join(appDir, file)).join(" and ")}.`
|
|
8679
|
+
);
|
|
8680
|
+
}
|
|
8681
|
+
const componentFile = componentFiles[0];
|
|
8682
|
+
const markdownFile = markdownFiles[0];
|
|
8683
|
+
const primaryFile = componentFile || markdownFile;
|
|
8684
|
+
if (!primaryFile) continue;
|
|
8685
|
+
const modulePath = import_path6.default.join(appDir, primaryFile);
|
|
8686
|
+
const existing = this.routes.get(pattern);
|
|
8687
|
+
if (existing?.sourceRoot === source.root) {
|
|
8688
|
+
throw new Error(
|
|
8689
|
+
`Duplicate page route "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
|
|
8690
|
+
);
|
|
8691
|
+
}
|
|
8692
|
+
this.routes.set(pattern, {
|
|
8693
|
+
route: group.route,
|
|
8694
|
+
modulePath,
|
|
8695
|
+
...markdownFile ? {
|
|
8696
|
+
markdownSourcePath: import_path6.default.join(appDir, markdownFile)
|
|
8697
|
+
} : {},
|
|
8698
|
+
pattern,
|
|
8699
|
+
source: "file",
|
|
8700
|
+
sourceRoot: source.root
|
|
8701
|
+
});
|
|
8702
|
+
}
|
|
8520
8703
|
for (const [kind, files, target] of [
|
|
8521
|
-
["page", pageFiles.filter((file) => parseRouteSlotFile(file) === null), this.routes],
|
|
8522
8704
|
["layout", layoutFiles, this.layouts],
|
|
8523
8705
|
["loading", loadingFiles, this.loadings],
|
|
8524
8706
|
["error", errorFiles, this.errors]
|
|
@@ -10273,14 +10455,14 @@ function createRouteStateProps(input) {
|
|
|
10273
10455
|
context: input.pluginExposedContext.size > 0 ? { data: input.pluginExposedContext } : void 0
|
|
10274
10456
|
};
|
|
10275
10457
|
}
|
|
10276
|
-
var import_react4, import_server, fs2,
|
|
10458
|
+
var import_react4, import_server, fs2, path10, import_stream, cachedClerkProvider, importRuntimeModule, _FarmRouteErrorBoundary, FarmRouteErrorBoundary, _ServerRenderer, ServerRenderer;
|
|
10277
10459
|
var init_renderer = __esm({
|
|
10278
10460
|
"src/server/renderer.ts"() {
|
|
10279
10461
|
"use strict";
|
|
10280
10462
|
import_react4 = __toESM(require("react"));
|
|
10281
10463
|
import_server = require("react-dom/server");
|
|
10282
10464
|
fs2 = __toESM(require("fs"));
|
|
10283
|
-
|
|
10465
|
+
path10 = __toESM(require("path"));
|
|
10284
10466
|
init_utils();
|
|
10285
10467
|
init_client_component();
|
|
10286
10468
|
import_stream = require("stream");
|
|
@@ -10299,6 +10481,7 @@ var init_renderer = __esm({
|
|
|
10299
10481
|
init_server2();
|
|
10300
10482
|
init_resolver();
|
|
10301
10483
|
init_routing();
|
|
10484
|
+
init_response();
|
|
10302
10485
|
cachedClerkProvider = null;
|
|
10303
10486
|
importRuntimeModule = new Function("specifier", "return import(specifier);");
|
|
10304
10487
|
__name(hasRequestHeader, "hasRequestHeader");
|
|
@@ -10365,7 +10548,7 @@ var init_renderer = __esm({
|
|
|
10365
10548
|
*/
|
|
10366
10549
|
loadSSGManifest() {
|
|
10367
10550
|
try {
|
|
10368
|
-
const manifestPath =
|
|
10551
|
+
const manifestPath = path10.join(this.config.root, this.config.outDir, "__ssg_manifest.json");
|
|
10369
10552
|
if (fs2.existsSync(manifestPath)) {
|
|
10370
10553
|
const content = fs2.readFileSync(manifestPath, "utf-8");
|
|
10371
10554
|
this.ssgManifest = JSON.parse(content);
|
|
@@ -10540,7 +10723,7 @@ var init_renderer = __esm({
|
|
|
10540
10723
|
return true;
|
|
10541
10724
|
}
|
|
10542
10725
|
try {
|
|
10543
|
-
const htmlPath = page2.urlPath === "/" ?
|
|
10726
|
+
const htmlPath = page2.urlPath === "/" ? path10.join(this.config.root, this.config.outDir, "client", "index.html") : path10.join(this.config.root, this.config.outDir, "client", page2.urlPath + ".html");
|
|
10544
10727
|
if (fs2.existsSync(htmlPath)) {
|
|
10545
10728
|
const stat = fs2.statSync(htmlPath);
|
|
10546
10729
|
const html = fs2.readFileSync(htmlPath, "utf-8");
|
|
@@ -10991,6 +11174,15 @@ var init_renderer = __esm({
|
|
|
10991
11174
|
});
|
|
10992
11175
|
});
|
|
10993
11176
|
} catch (error) {
|
|
11177
|
+
if (isWebResponse(error)) {
|
|
11178
|
+
if (!res.headersSent && !res.writableEnded) {
|
|
11179
|
+
await sendWebResponse(res, error);
|
|
11180
|
+
} else if (!res.writableEnded) {
|
|
11181
|
+
res.end();
|
|
11182
|
+
}
|
|
11183
|
+
completeRender(error.status, pathname);
|
|
11184
|
+
return;
|
|
11185
|
+
}
|
|
10994
11186
|
if (isFarmRedirectError(error)) {
|
|
10995
11187
|
const redirect3 = getFarmRedirectError(error);
|
|
10996
11188
|
const snapshot = getFarmI18nClientSnapshot();
|
|
@@ -11291,7 +11483,7 @@ var init_renderer = __esm({
|
|
|
11291
11483
|
}
|
|
11292
11484
|
}
|
|
11293
11485
|
async renderWithSSR(element, req, res, clearMiddlewareData, options = {}) {
|
|
11294
|
-
return new Promise((
|
|
11486
|
+
return new Promise((resolve6, reject) => {
|
|
11295
11487
|
const streamStartTime = Date.now();
|
|
11296
11488
|
const observabilityRoute = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
|
|
11297
11489
|
const deploymentId = this.getDeploymentId();
|
|
@@ -11471,7 +11663,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue(g
|
|
|
11471
11663
|
route: observabilityRoute,
|
|
11472
11664
|
durationMs: Date.now() - streamStartTime
|
|
11473
11665
|
});
|
|
11474
|
-
|
|
11666
|
+
resolve6();
|
|
11475
11667
|
}
|
|
11476
11668
|
});
|
|
11477
11669
|
res.write(shell);
|
|
@@ -11482,7 +11674,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue(g
|
|
|
11482
11674
|
},
|
|
11483
11675
|
onShellError(error) {
|
|
11484
11676
|
didError = true;
|
|
11485
|
-
if (!isFarmRedirectError(error) && !isFarmNotFoundError(error)) {
|
|
11677
|
+
if (!isWebResponse(error) && !isFarmRedirectError(error) && !isFarmNotFoundError(error)) {
|
|
11486
11678
|
logger.error(`SSR shell error: ${error}`);
|
|
11487
11679
|
emitFarmEvent({
|
|
11488
11680
|
type: "render.error",
|
|
@@ -11497,7 +11689,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue(g
|
|
|
11497
11689
|
},
|
|
11498
11690
|
onError(error) {
|
|
11499
11691
|
didError = true;
|
|
11500
|
-
if (!isFarmRedirectError(error) && !isFarmNotFoundError(error)) {
|
|
11692
|
+
if (!isWebResponse(error) && !isFarmRedirectError(error) && !isFarmNotFoundError(error)) {
|
|
11501
11693
|
logger.error(`SSR streaming error: ${error}`);
|
|
11502
11694
|
emitFarmEvent({
|
|
11503
11695
|
type: "render.error",
|
|
@@ -11513,11 +11705,11 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue(g
|
|
|
11513
11705
|
res.statusCode = 404;
|
|
11514
11706
|
const pathname = new URL(req.url || "/", `http://${req.headers.host || "localhost"}`).pathname;
|
|
11515
11707
|
try {
|
|
11516
|
-
const appDir =
|
|
11708
|
+
const appDir = path10.join(this.config.root, this.config.srcDir, "app");
|
|
11517
11709
|
const notFoundExtensions = [".tsx", ".jsx", ".ts", ".js"];
|
|
11518
11710
|
let notFoundPath = null;
|
|
11519
11711
|
for (const ext of notFoundExtensions) {
|
|
11520
|
-
const checkPath =
|
|
11712
|
+
const checkPath = path10.join(appDir, `not-found${ext}`);
|
|
11521
11713
|
if (fs2.existsSync(checkPath)) {
|
|
11522
11714
|
notFoundPath = checkPath;
|
|
11523
11715
|
break;
|
|
@@ -11529,7 +11721,7 @@ ${getFarmI18nClientSnapshot() ? `window.__FARM_I18N__ = ${serializeInlineValue(g
|
|
|
11529
11721
|
if (NotFoundComponent) {
|
|
11530
11722
|
let LayoutComponent = null;
|
|
11531
11723
|
for (const ext of notFoundExtensions) {
|
|
11532
|
-
const layoutPath =
|
|
11724
|
+
const layoutPath = path10.join(appDir, `layout${ext}`);
|
|
11533
11725
|
if (fs2.existsSync(layoutPath)) {
|
|
11534
11726
|
try {
|
|
11535
11727
|
const layoutModule = await this.routeManager.loadLayoutModule(layoutPath);
|
|
@@ -11660,6 +11852,11 @@ function isResolvedDocsConfig(value) {
|
|
|
11660
11852
|
function isResolvedI18nConfig(value) {
|
|
11661
11853
|
return Boolean(value && typeof value === "object" && "enabled" in value);
|
|
11662
11854
|
}
|
|
11855
|
+
function isResolvedAuthConfig(value) {
|
|
11856
|
+
return Boolean(
|
|
11857
|
+
value && typeof value === "object" && "enabled" in value && "emailAndPassword" in value && "database" in value
|
|
11858
|
+
);
|
|
11859
|
+
}
|
|
11663
11860
|
function createFarmApp(config, viteServer) {
|
|
11664
11861
|
return new FarmApp(config, viteServer);
|
|
11665
11862
|
}
|
|
@@ -11686,6 +11883,7 @@ var init_app = __esm({
|
|
|
11686
11883
|
init_config();
|
|
11687
11884
|
init_server2();
|
|
11688
11885
|
init_cache();
|
|
11886
|
+
init_auth_config();
|
|
11689
11887
|
defaultDocsConfig = {
|
|
11690
11888
|
enabled: false,
|
|
11691
11889
|
entry: "/docs",
|
|
@@ -11740,6 +11938,7 @@ var init_app = __esm({
|
|
|
11740
11938
|
deploy: config.deploy || {},
|
|
11741
11939
|
storage: config.storage || {},
|
|
11742
11940
|
cache: config.cache || {},
|
|
11941
|
+
auth: isResolvedAuthConfig(config.auth) ? config.auth : resolveFarmAuthConfig(config.auth),
|
|
11743
11942
|
integrations: config.integrations || {},
|
|
11744
11943
|
plugins: config.plugins || [],
|
|
11745
11944
|
migrations: config.migrations || { commands: [] },
|
|
@@ -11809,6 +12008,7 @@ var init_app = __esm({
|
|
|
11809
12008
|
__name(_FarmApp, "FarmApp");
|
|
11810
12009
|
FarmApp = _FarmApp;
|
|
11811
12010
|
__name(isResolvedI18nConfig, "isResolvedI18nConfig");
|
|
12011
|
+
__name(isResolvedAuthConfig, "isResolvedAuthConfig");
|
|
11812
12012
|
__name(createFarmApp, "createFarmApp");
|
|
11813
12013
|
}
|
|
11814
12014
|
});
|
|
@@ -12140,12 +12340,12 @@ var init_runtime2 = __esm({
|
|
|
12140
12340
|
});
|
|
12141
12341
|
|
|
12142
12342
|
// src/api/route-manager.ts
|
|
12143
|
-
var fs3,
|
|
12343
|
+
var fs3, path12, API_ROUTE_METHODS, _APIRouteManager, APIRouteManager;
|
|
12144
12344
|
var init_route_manager2 = __esm({
|
|
12145
12345
|
"src/api/route-manager.ts"() {
|
|
12146
12346
|
"use strict";
|
|
12147
12347
|
fs3 = __toESM(require("fs"));
|
|
12148
|
-
|
|
12348
|
+
path12 = __toESM(require("path"));
|
|
12149
12349
|
init_utils();
|
|
12150
12350
|
init_routes();
|
|
12151
12351
|
init_routes_server();
|
|
@@ -12176,7 +12376,7 @@ var init_route_manager2 = __esm({
|
|
|
12176
12376
|
async discoverRoutes() {
|
|
12177
12377
|
this.routes.clear();
|
|
12178
12378
|
for (const appDir of this.appDirs) {
|
|
12179
|
-
const apiDir =
|
|
12379
|
+
const apiDir = path12.join(appDir, "api");
|
|
12180
12380
|
let routeFiles = [];
|
|
12181
12381
|
if (fs3.existsSync(apiDir)) {
|
|
12182
12382
|
routeFiles = this.findRouteFiles(apiDir);
|
|
@@ -12204,7 +12404,7 @@ var init_route_manager2 = __esm({
|
|
|
12204
12404
|
}
|
|
12205
12405
|
const entries = fs3.readdirSync(dir, { withFileTypes: true });
|
|
12206
12406
|
for (const entry of entries) {
|
|
12207
|
-
const fullPath =
|
|
12407
|
+
const fullPath = path12.join(dir, entry.name);
|
|
12208
12408
|
if (entry.isDirectory()) {
|
|
12209
12409
|
files.push(...this.findRouteFiles(fullPath));
|
|
12210
12410
|
} else if (entry.name === "route.ts" || entry.name === "route.tsx" || entry.name === "route.js") {
|
|
@@ -12218,8 +12418,8 @@ var init_route_manager2 = __esm({
|
|
|
12218
12418
|
*/
|
|
12219
12419
|
async loadRoute(filePath, appDir) {
|
|
12220
12420
|
try {
|
|
12221
|
-
const apiDir =
|
|
12222
|
-
const relativePath2 =
|
|
12421
|
+
const apiDir = path12.join(appDir, "api");
|
|
12422
|
+
const relativePath2 = path12.relative(apiDir, path12.dirname(filePath));
|
|
12223
12423
|
const routePath = "/api/" + (relativePath2 === "." ? "" : relativePath2.replace(/\\/g, "/"));
|
|
12224
12424
|
const routeModule = await this.loadModule(filePath);
|
|
12225
12425
|
const endpoints = {};
|
|
@@ -12270,7 +12470,7 @@ var init_route_manager2 = __esm({
|
|
|
12270
12470
|
}
|
|
12271
12471
|
}
|
|
12272
12472
|
async loadProgrammaticApiRoutes(appDir) {
|
|
12273
|
-
const candidateRoots = [
|
|
12473
|
+
const candidateRoots = [path12.dirname(appDir), appDir];
|
|
12274
12474
|
const routeFiles = Array.from(
|
|
12275
12475
|
new Set(candidateRoots.flatMap((srcRoot) => findProgrammaticRouteFilesInDir(srcRoot)))
|
|
12276
12476
|
);
|
|
@@ -12296,11 +12496,11 @@ var init_route_manager2 = __esm({
|
|
|
12296
12496
|
}
|
|
12297
12497
|
findRootRoutesFile(appDir) {
|
|
12298
12498
|
const routeNames = ["routes.ts", "routes.tsx", "routes.js"];
|
|
12299
|
-
const candidateDirs = [
|
|
12499
|
+
const candidateDirs = [path12.dirname(appDir), appDir];
|
|
12300
12500
|
const seen = /* @__PURE__ */ new Set();
|
|
12301
12501
|
for (const dir of candidateDirs) {
|
|
12302
12502
|
for (const routeName of routeNames) {
|
|
12303
|
-
const routesFile =
|
|
12503
|
+
const routesFile = path12.join(dir, routeName);
|
|
12304
12504
|
if (seen.has(routesFile)) {
|
|
12305
12505
|
continue;
|
|
12306
12506
|
}
|
|
@@ -13022,11 +13222,11 @@ function resolveExistingPath(filePath) {
|
|
|
13022
13222
|
try {
|
|
13023
13223
|
return (0, import_node_fs2.realpathSync)(filePath);
|
|
13024
13224
|
} catch {
|
|
13025
|
-
return
|
|
13225
|
+
return import_node_path5.default.resolve(filePath);
|
|
13026
13226
|
}
|
|
13027
13227
|
}
|
|
13028
13228
|
function isDocsSourceFile(filePath) {
|
|
13029
|
-
return DOCS_FILE_EXTENSIONS.has(
|
|
13229
|
+
return DOCS_FILE_EXTENSIONS.has(import_node_path5.default.extname(filePath).toLowerCase());
|
|
13030
13230
|
}
|
|
13031
13231
|
function discoverDocsSourceFiles(contentDir) {
|
|
13032
13232
|
const files = [];
|
|
@@ -13035,7 +13235,7 @@ function discoverDocsSourceFiles(contentDir) {
|
|
|
13035
13235
|
(a, b) => a.name.localeCompare(b.name)
|
|
13036
13236
|
)) {
|
|
13037
13237
|
if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
|
|
13038
|
-
const absolutePath =
|
|
13238
|
+
const absolutePath = import_node_path5.default.join(dir, entry.name);
|
|
13039
13239
|
if (entry.isDirectory()) {
|
|
13040
13240
|
visit(absolutePath);
|
|
13041
13241
|
} else if (entry.isFile() && isDocsSourceFile(absolutePath)) {
|
|
@@ -13053,7 +13253,7 @@ function getGitLastModifiedDates(contentDir) {
|
|
|
13053
13253
|
stdio: ["ignore", "pipe", "ignore"]
|
|
13054
13254
|
}).trim();
|
|
13055
13255
|
if (!gitRoot) return {};
|
|
13056
|
-
const contentPathspec = normalizeRelativePath(
|
|
13256
|
+
const contentPathspec = normalizeRelativePath(import_node_path5.default.relative(gitRoot, contentDir)) || ".";
|
|
13057
13257
|
const contentPrefix = contentPathspec === "." ? "" : `${contentPathspec}/`;
|
|
13058
13258
|
const history = (0, import_node_child_process.execFileSync)(
|
|
13059
13259
|
"git",
|
|
@@ -13095,7 +13295,7 @@ function getGitLastModifiedDates(contentDir) {
|
|
|
13095
13295
|
}
|
|
13096
13296
|
}
|
|
13097
13297
|
function readManifest(contentDir) {
|
|
13098
|
-
const manifestPath =
|
|
13298
|
+
const manifestPath = import_node_path5.default.join(contentDir, FARM_DOCS_LAST_MODIFIED_MANIFEST);
|
|
13099
13299
|
if (!(0, import_node_fs2.existsSync)(manifestPath)) return null;
|
|
13100
13300
|
try {
|
|
13101
13301
|
const parsed = JSON.parse(
|
|
@@ -13118,14 +13318,14 @@ function createFarmDocsLastModifiedManifest(contentDir, options = {}) {
|
|
|
13118
13318
|
const fallbackDate = (options.now ?? /* @__PURE__ */ new Date()).toISOString();
|
|
13119
13319
|
const pages = {};
|
|
13120
13320
|
for (const sourcePath of discoverDocsSourceFiles(resolvedContentDir)) {
|
|
13121
|
-
const relativePath2 = normalizeRelativePath(
|
|
13321
|
+
const relativePath2 = normalizeRelativePath(import_node_path5.default.relative(resolvedContentDir, sourcePath));
|
|
13122
13322
|
pages[relativePath2] = gitDates[relativePath2] || (options.fallback === "now" ? fallbackDate : (0, import_node_fs2.statSync)(sourcePath).mtime.toISOString());
|
|
13123
13323
|
}
|
|
13124
13324
|
return { version: 1, pages };
|
|
13125
13325
|
}
|
|
13126
13326
|
function getLastModifiedManifest(contentDir) {
|
|
13127
13327
|
const resolvedContentDir = resolveExistingPath(contentDir);
|
|
13128
|
-
const manifestPath =
|
|
13328
|
+
const manifestPath = import_node_path5.default.join(resolvedContentDir, FARM_DOCS_LAST_MODIFIED_MANIFEST);
|
|
13129
13329
|
const manifestStat = (0, import_node_fs2.existsSync)(manifestPath) ? (0, import_node_fs2.statSync)(manifestPath) : null;
|
|
13130
13330
|
const signature = manifestStat ? `file:${manifestStat.mtimeMs}:${manifestStat.size}` : "generated";
|
|
13131
13331
|
const cached = manifestCache.get(resolvedContentDir);
|
|
@@ -13139,21 +13339,21 @@ function resolveFarmDocsPageLastModified(contentDir, sourcePath, frontmatter) {
|
|
|
13139
13339
|
if (configured) return configured;
|
|
13140
13340
|
const resolvedContentDir = resolveExistingPath(contentDir);
|
|
13141
13341
|
const resolvedSourcePath = resolveExistingPath(sourcePath);
|
|
13142
|
-
const relativePath2 = normalizeRelativePath(
|
|
13143
|
-
const isInsideContentDir = relativePath2 !== ".." && !relativePath2.startsWith("../") && !
|
|
13342
|
+
const relativePath2 = normalizeRelativePath(import_node_path5.default.relative(resolvedContentDir, resolvedSourcePath));
|
|
13343
|
+
const isInsideContentDir = relativePath2 !== ".." && !relativePath2.startsWith("../") && !import_node_path5.default.isAbsolute(relativePath2);
|
|
13144
13344
|
if (isInsideContentDir) {
|
|
13145
13345
|
const generated = getLastModifiedManifest(resolvedContentDir).pages[relativePath2];
|
|
13146
13346
|
if (generated) return generated;
|
|
13147
13347
|
}
|
|
13148
13348
|
return (0, import_node_fs2.statSync)(resolvedSourcePath).mtime.toISOString();
|
|
13149
13349
|
}
|
|
13150
|
-
var import_node_child_process, import_node_fs2,
|
|
13350
|
+
var import_node_child_process, import_node_fs2, import_node_path5, FARM_DOCS_LAST_MODIFIED_MANIFEST, COMMIT_MARKER, DOCS_FILE_EXTENSIONS, manifestCache;
|
|
13151
13351
|
var init_last_modified = __esm({
|
|
13152
13352
|
"src/docs/last-modified.ts"() {
|
|
13153
13353
|
"use strict";
|
|
13154
13354
|
import_node_child_process = require("child_process");
|
|
13155
13355
|
import_node_fs2 = require("fs");
|
|
13156
|
-
|
|
13356
|
+
import_node_path5 = __toESM(require("path"));
|
|
13157
13357
|
FARM_DOCS_LAST_MODIFIED_MANIFEST = ".farm-docs-last-modified.json";
|
|
13158
13358
|
COMMIT_MARKER = "__FARM_DOCS_COMMIT__";
|
|
13159
13359
|
DOCS_FILE_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".mdx"]);
|
|
@@ -13186,9 +13386,9 @@ function isFarmDocsSearchEnabled(docs) {
|
|
|
13186
13386
|
}
|
|
13187
13387
|
function resolveFarmDocsSearchClientModule(root) {
|
|
13188
13388
|
try {
|
|
13189
|
-
const requireFromApp = (0,
|
|
13389
|
+
const requireFromApp = (0, import_node_module3.createRequire)(import_node_path6.default.join(import_node_path6.default.resolve(root), "package.json"));
|
|
13190
13390
|
const themeEntry = requireFromApp.resolve("@farming-labs/theme");
|
|
13191
|
-
const commandSearchModule =
|
|
13391
|
+
const commandSearchModule = import_node_path6.default.join(import_node_path6.default.dirname(themeEntry), "docs-command-search.mjs");
|
|
13192
13392
|
if ((0, import_node_fs3.existsSync)(commandSearchModule)) return commandSearchModule;
|
|
13193
13393
|
} catch {
|
|
13194
13394
|
}
|
|
@@ -13328,13 +13528,13 @@ async function mountFarmDocsSearch() {
|
|
|
13328
13528
|
window.__FARM_MOUNT_DOCS_SEARCH__ = mountFarmDocsSearch;
|
|
13329
13529
|
`;
|
|
13330
13530
|
}
|
|
13331
|
-
var import_node_fs3,
|
|
13531
|
+
var import_node_fs3, import_node_module3, import_node_path6;
|
|
13332
13532
|
var init_search_client = __esm({
|
|
13333
13533
|
"src/docs/search-client.ts"() {
|
|
13334
13534
|
"use strict";
|
|
13335
13535
|
import_node_fs3 = require("fs");
|
|
13336
|
-
|
|
13337
|
-
|
|
13536
|
+
import_node_module3 = require("module");
|
|
13537
|
+
import_node_path6 = __toESM(require("path"));
|
|
13338
13538
|
__name(isFarmDocsSearchEnabled, "isFarmDocsSearchEnabled");
|
|
13339
13539
|
__name(resolveFarmDocsSearchClientModule, "resolveFarmDocsSearchClientModule");
|
|
13340
13540
|
__name(generateFarmDocsSearchBootstrapRuntime, "generateFarmDocsSearchBootstrapRuntime");
|
|
@@ -13749,12 +13949,12 @@ var init_module = __esm({
|
|
|
13749
13949
|
function isMiddlewareResponse(value) {
|
|
13750
13950
|
return value instanceof Response;
|
|
13751
13951
|
}
|
|
13752
|
-
var fs4,
|
|
13952
|
+
var fs4, path17, _MiddlewareManager, MiddlewareManager;
|
|
13753
13953
|
var init_manager = __esm({
|
|
13754
13954
|
"src/middleware/manager.ts"() {
|
|
13755
13955
|
"use strict";
|
|
13756
13956
|
fs4 = __toESM(require("fs"));
|
|
13757
|
-
|
|
13957
|
+
path17 = __toESM(require("path"));
|
|
13758
13958
|
init_context();
|
|
13759
13959
|
init_module();
|
|
13760
13960
|
init_utils();
|
|
@@ -13834,8 +14034,8 @@ var init_manager = __esm({
|
|
|
13834
14034
|
const entries = fs4.readdirSync(dir, { withFileTypes: true });
|
|
13835
14035
|
for (const entry of entries) {
|
|
13836
14036
|
if (entry.isDirectory() && !entry.name.startsWith(".") && !entry.name.startsWith("_")) {
|
|
13837
|
-
const subPath =
|
|
13838
|
-
const subRoutePath =
|
|
14037
|
+
const subPath = path17.join(dir, entry.name);
|
|
14038
|
+
const subRoutePath = path17.posix.join(routePath, entry.name);
|
|
13839
14039
|
await this.discoverInDirectory(subPath, subRoutePath, discovered);
|
|
13840
14040
|
}
|
|
13841
14041
|
}
|
|
@@ -13846,7 +14046,7 @@ var init_manager = __esm({
|
|
|
13846
14046
|
findMiddlewareFile(dir) {
|
|
13847
14047
|
const extensions = [".ts", ".tsx", ".js", ".jsx"];
|
|
13848
14048
|
for (const ext of extensions) {
|
|
13849
|
-
const filePath =
|
|
14049
|
+
const filePath = path17.join(dir, `middleware${ext}`);
|
|
13850
14050
|
if (fs4.existsSync(filePath)) {
|
|
13851
14051
|
return filePath;
|
|
13852
14052
|
}
|
|
@@ -14313,11 +14513,11 @@ var init_type_generator = __esm({
|
|
|
14313
14513
|
routeGroups.get(key).push(route);
|
|
14314
14514
|
}
|
|
14315
14515
|
const nestedStructure = {};
|
|
14316
|
-
for (const [
|
|
14516
|
+
for (const [path28, routeList] of routeGroups) {
|
|
14317
14517
|
const route = routeList[0];
|
|
14318
14518
|
const importPath = this.getRouteImportPath(route, options.outFile);
|
|
14319
14519
|
const routeName = this.pathToRouteName(route.path);
|
|
14320
|
-
const cleanPath =
|
|
14520
|
+
const cleanPath = path28 === "/api" ? "" : path28.replace(/^\/api\//, "");
|
|
14321
14521
|
const parts = cleanPath ? cleanPath.split("/") : [];
|
|
14322
14522
|
const allMethods = routeList.flatMap((r) => r.methods);
|
|
14323
14523
|
for (const method of allMethods) {
|
|
@@ -14376,8 +14576,8 @@ ${typeExports}
|
|
|
14376
14576
|
const relativeImport = (0, import_path10.relative)((0, import_path10.dirname)(outFile), route.filePath).replace(/\\/g, "/").replace(/\.(ts|tsx|js|jsx)$/, "");
|
|
14377
14577
|
return relativeImport.startsWith(".") ? relativeImport : `./${relativeImport}`;
|
|
14378
14578
|
}
|
|
14379
|
-
pathToRouteName(
|
|
14380
|
-
return (
|
|
14579
|
+
pathToRouteName(path28) {
|
|
14580
|
+
return (path28 === "/api" ? "root" : path28.replace(/^\/api\//, "")).replace(/\//g, "_").replace(/[^a-zA-Z0-9_]/g, "");
|
|
14381
14581
|
}
|
|
14382
14582
|
structureToTypeString(obj, indent) {
|
|
14383
14583
|
const spaces = " ".repeat(indent);
|
|
@@ -14397,15 +14597,15 @@ ${typeExports}
|
|
|
14397
14597
|
toTypePropertyKey(key) {
|
|
14398
14598
|
return /^[$A-Z_][0-9A-Z_$]*$/i.test(key) ? key : JSON.stringify(key);
|
|
14399
14599
|
}
|
|
14400
|
-
getBaseExportName(
|
|
14401
|
-
const cleanPath =
|
|
14600
|
+
getBaseExportName(path28) {
|
|
14601
|
+
const cleanPath = path28.replace(/^\/api\//, "");
|
|
14402
14602
|
if (cleanPath === "") {
|
|
14403
14603
|
return "api";
|
|
14404
14604
|
}
|
|
14405
14605
|
return cleanPath;
|
|
14406
14606
|
}
|
|
14407
|
-
getExportName(
|
|
14408
|
-
const cleanPath =
|
|
14607
|
+
getExportName(path28, method) {
|
|
14608
|
+
const cleanPath = path28.replace(/^\/api\//, "");
|
|
14409
14609
|
if (cleanPath === "") {
|
|
14410
14610
|
return method.toLowerCase();
|
|
14411
14611
|
}
|
|
@@ -14467,19 +14667,22 @@ function createRoutePattern(route) {
|
|
|
14467
14667
|
}).join("/");
|
|
14468
14668
|
}
|
|
14469
14669
|
async function generateRouteTypes(options) {
|
|
14470
|
-
const
|
|
14471
|
-
|
|
14472
|
-
|
|
14473
|
-
|
|
14474
|
-
|
|
14475
|
-
|
|
14476
|
-
|
|
14670
|
+
const root = path18.resolve(options.root);
|
|
14671
|
+
const srcDir = options.srcDir || "src";
|
|
14672
|
+
const outFile = options.outFile || DEFAULT_OUT_FILE;
|
|
14673
|
+
const outPath = path18.isAbsolute(outFile) ? outFile : path18.join(root, srcDir, outFile);
|
|
14674
|
+
const content = await createRouteTypeDeclarations(options, outPath);
|
|
14675
|
+
fs5.mkdirSync(path18.dirname(outPath), { recursive: true });
|
|
14676
|
+
writeFileIfChanged(outPath, content);
|
|
14677
|
+
return outPath;
|
|
14678
|
+
}
|
|
14679
|
+
async function createRouteTypeDeclarations(options, outPath) {
|
|
14680
|
+
const { root, srcDir = "src", extraRoutes = [], suppressLintOnLink = false } = options;
|
|
14477
14681
|
const sourceRoots = options.sourceRoots ?? [{ name: "project", root, srcDir, layer: false }];
|
|
14478
|
-
const outPath = path17.join(root, srcDir, outFile);
|
|
14479
14682
|
const patterns = /* @__PURE__ */ new Set();
|
|
14480
14683
|
const glob = await import("fast-glob");
|
|
14481
14684
|
for (const source of sourceRoots) {
|
|
14482
|
-
const appDir =
|
|
14685
|
+
const appDir = path18.join(source.root, source.srcDir, "app");
|
|
14483
14686
|
if (fs5.existsSync(appDir)) {
|
|
14484
14687
|
const pageFiles = await glob.default("**/page.{ts,tsx,js,jsx,md,mdx}", {
|
|
14485
14688
|
cwd: appDir,
|
|
@@ -14508,18 +14711,19 @@ async function generateRouteTypes(options) {
|
|
|
14508
14711
|
const patternLiterals = sortedPatterns.map(routePatternToRouteLiteral);
|
|
14509
14712
|
const routePathType = suppressLintOnLink ? "string" : typeLiterals.length ? typeLiterals.join(" | ") : "never";
|
|
14510
14713
|
const routePatternType = suppressLintOnLink ? "string" : patternLiterals.length ? patternLiterals.join(" | ") : "never";
|
|
14714
|
+
const routeTypesImportPath = `./${path18.basename(outPath).replace(/\.d\.ts$/, "")}`;
|
|
14511
14715
|
const augmentationBlock = suppressLintOnLink ? "" : `
|
|
14512
14716
|
declare module "@farm.js/core/client" {
|
|
14513
14717
|
interface LinkDefaultRoute {
|
|
14514
|
-
_: import(
|
|
14515
|
-
pattern: import(
|
|
14718
|
+
_: import(${JSON.stringify(routeTypesImportPath)}).RoutePath;
|
|
14719
|
+
pattern: import(${JSON.stringify(routeTypesImportPath)}).RoutePattern;
|
|
14516
14720
|
}
|
|
14517
14721
|
}
|
|
14518
14722
|
|
|
14519
14723
|
declare module "@farm.js/core" {
|
|
14520
14724
|
interface LinkDefaultRoute {
|
|
14521
|
-
_: import(
|
|
14522
|
-
pattern: import(
|
|
14725
|
+
_: import(${JSON.stringify(routeTypesImportPath)}).RoutePath;
|
|
14726
|
+
pattern: import(${JSON.stringify(routeTypesImportPath)}).RoutePattern;
|
|
14523
14727
|
}
|
|
14524
14728
|
// Ensure root import ("@farm.js/core") uses the same typed Link signature as client entry.
|
|
14525
14729
|
const Link: typeof import("@farm.js/core/client").Link;
|
|
@@ -14528,8 +14732,8 @@ declare module "@farm.js/core" {
|
|
|
14528
14732
|
// Internal declaration path used by @farm.js/core root type re-exports.
|
|
14529
14733
|
declare module "@farm.js/core/dist/client.js" {
|
|
14530
14734
|
interface LinkDefaultRoute {
|
|
14531
|
-
_: import(
|
|
14532
|
-
pattern: import(
|
|
14735
|
+
_: import(${JSON.stringify(routeTypesImportPath)}).RoutePath;
|
|
14736
|
+
pattern: import(${JSON.stringify(routeTypesImportPath)}).RoutePattern;
|
|
14533
14737
|
}
|
|
14534
14738
|
}
|
|
14535
14739
|
`;
|
|
@@ -14541,15 +14745,13 @@ declare module "@farm.js/core/dist/client.js" {
|
|
|
14541
14745
|
export type RoutePath = ${routePathType};
|
|
14542
14746
|
export type RoutePattern = ${routePatternType};${augmentationBlock}
|
|
14543
14747
|
`;
|
|
14544
|
-
|
|
14545
|
-
writeFileIfChanged(outPath, content);
|
|
14546
|
-
return outPath;
|
|
14748
|
+
return content;
|
|
14547
14749
|
}
|
|
14548
|
-
var
|
|
14750
|
+
var path18, fs5, DEFAULT_OUT_FILE;
|
|
14549
14751
|
var init_generate_route_types = __esm({
|
|
14550
14752
|
"src/routing/generate-route-types.ts"() {
|
|
14551
14753
|
"use strict";
|
|
14552
|
-
|
|
14754
|
+
path18 = __toESM(require("path"));
|
|
14553
14755
|
fs5 = __toESM(require("fs"));
|
|
14554
14756
|
init_utils();
|
|
14555
14757
|
init_route_slots();
|
|
@@ -14561,23 +14763,30 @@ var init_generate_route_types = __esm({
|
|
|
14561
14763
|
__name(createRoutePattern, "createRoutePattern");
|
|
14562
14764
|
DEFAULT_OUT_FILE = "farm-routes.d.ts";
|
|
14563
14765
|
__name(generateRouteTypes, "generateRouteTypes");
|
|
14766
|
+
__name(createRouteTypeDeclarations, "createRouteTypeDeclarations");
|
|
14564
14767
|
}
|
|
14565
14768
|
});
|
|
14566
14769
|
|
|
14567
14770
|
// src/env-types.ts
|
|
14568
14771
|
async function generateEnvTypes(options) {
|
|
14569
|
-
const root =
|
|
14772
|
+
const root = path19.resolve(options.root);
|
|
14570
14773
|
const srcDir = options.srcDir || "src";
|
|
14571
|
-
const
|
|
14774
|
+
const outFile = options.outFile || DEFAULT_OUT_FILE2;
|
|
14775
|
+
const outPath = path19.isAbsolute(outFile) ? outFile : path19.join(root, srcDir, outFile);
|
|
14776
|
+
const content = createEnvTypeDeclarations(options, outPath);
|
|
14777
|
+
fs6.mkdirSync(path19.dirname(outPath), { recursive: true });
|
|
14778
|
+
writeFileIfChanged(outPath, content);
|
|
14779
|
+
return outPath;
|
|
14780
|
+
}
|
|
14781
|
+
function createEnvTypeDeclarations(options, outPath) {
|
|
14782
|
+
const root = path19.resolve(options.root);
|
|
14572
14783
|
const configPath = findConfigPath(root, options.configPath);
|
|
14573
14784
|
const configPaths = [
|
|
14574
14785
|
...(options.layerConfigPaths ?? []).filter((value) => fs6.existsSync(value)),
|
|
14575
14786
|
...configPath ? [configPath] : []
|
|
14576
14787
|
];
|
|
14577
14788
|
const content = configPaths.length > 1 ? createLayeredConfigBackedEnvTypes(outPath, configPaths) : configPaths.length === 1 ? createConfigBackedEnvTypes(outPath, configPaths[0]) : createEmptyEnvTypes();
|
|
14578
|
-
|
|
14579
|
-
writeFileIfChanged(outPath, content);
|
|
14580
|
-
return outPath;
|
|
14789
|
+
return content;
|
|
14581
14790
|
}
|
|
14582
14791
|
function createLayeredConfigBackedEnvTypes(outPath, configPaths) {
|
|
14583
14792
|
const imports = configPaths.map(
|
|
@@ -14633,11 +14842,11 @@ export {};
|
|
|
14633
14842
|
}
|
|
14634
14843
|
function findConfigPath(root, configPath) {
|
|
14635
14844
|
if (configPath) {
|
|
14636
|
-
const resolvedPath =
|
|
14845
|
+
const resolvedPath = path19.isAbsolute(configPath) ? configPath : path19.join(root, configPath);
|
|
14637
14846
|
return fs6.existsSync(resolvedPath) ? resolvedPath : null;
|
|
14638
14847
|
}
|
|
14639
14848
|
for (const filename of CONFIG_FILENAMES2) {
|
|
14640
|
-
const resolvedPath =
|
|
14849
|
+
const resolvedPath = path19.join(root, filename);
|
|
14641
14850
|
if (fs6.existsSync(resolvedPath)) {
|
|
14642
14851
|
return resolvedPath;
|
|
14643
14852
|
}
|
|
@@ -14698,15 +14907,15 @@ export {};
|
|
|
14698
14907
|
`;
|
|
14699
14908
|
}
|
|
14700
14909
|
function toTypeImportPath(outPath, targetPath) {
|
|
14701
|
-
const relativePath2 =
|
|
14910
|
+
const relativePath2 = path19.relative(path19.dirname(outPath), targetPath).replace(/\\/g, "/").replace(/\.(tsx?|jsx?|mjs|cjs|mts|cts)$/, "");
|
|
14702
14911
|
return relativePath2.startsWith(".") ? relativePath2 : `./${relativePath2}`;
|
|
14703
14912
|
}
|
|
14704
|
-
var fs6,
|
|
14913
|
+
var fs6, path19, DEFAULT_OUT_FILE2, CONFIG_FILENAMES2;
|
|
14705
14914
|
var init_env_types = __esm({
|
|
14706
14915
|
"src/env-types.ts"() {
|
|
14707
14916
|
"use strict";
|
|
14708
14917
|
fs6 = __toESM(require("fs"));
|
|
14709
|
-
|
|
14918
|
+
path19 = __toESM(require("path"));
|
|
14710
14919
|
init_write_file_if_changed();
|
|
14711
14920
|
DEFAULT_OUT_FILE2 = "farm-env.d.ts";
|
|
14712
14921
|
CONFIG_FILENAMES2 = [
|
|
@@ -14728,6 +14937,7 @@ var init_env_types = __esm({
|
|
|
14728
14937
|
"config.cjs"
|
|
14729
14938
|
];
|
|
14730
14939
|
__name(generateEnvTypes, "generateEnvTypes");
|
|
14940
|
+
__name(createEnvTypeDeclarations, "createEnvTypeDeclarations");
|
|
14731
14941
|
__name(createLayeredConfigBackedEnvTypes, "createLayeredConfigBackedEnvTypes");
|
|
14732
14942
|
__name(findConfigPath, "findConfigPath");
|
|
14733
14943
|
__name(createConfigBackedEnvTypes, "createConfigBackedEnvTypes");
|
|
@@ -14738,8 +14948,8 @@ var init_env_types = __esm({
|
|
|
14738
14948
|
|
|
14739
14949
|
// src/image-types.ts
|
|
14740
14950
|
function generateFarmImageTypes(options) {
|
|
14741
|
-
const outputPath = options.outFile ?
|
|
14742
|
-
(0, import_node_fs5.mkdirSync)(
|
|
14951
|
+
const outputPath = options.outFile ? import_node_path7.default.resolve(options.root, options.outFile) : import_node_path7.default.join(options.root, options.srcDir || "src", "farm-images.d.ts");
|
|
14952
|
+
(0, import_node_fs5.mkdirSync)(import_node_path7.default.dirname(outputPath), { recursive: true });
|
|
14743
14953
|
writeFileIfChanged(outputPath, createFarmImageTypeDeclarations());
|
|
14744
14954
|
return outputPath;
|
|
14745
14955
|
}
|
|
@@ -14763,12 +14973,12 @@ declare module "*?url" {
|
|
|
14763
14973
|
}
|
|
14764
14974
|
`;
|
|
14765
14975
|
}
|
|
14766
|
-
var import_node_fs5,
|
|
14976
|
+
var import_node_fs5, import_node_path7, FARM_STATIC_IMAGE_EXTENSIONS;
|
|
14767
14977
|
var init_image_types = __esm({
|
|
14768
14978
|
"src/image-types.ts"() {
|
|
14769
14979
|
"use strict";
|
|
14770
14980
|
import_node_fs5 = require("fs");
|
|
14771
|
-
|
|
14981
|
+
import_node_path7 = __toESM(require("path"));
|
|
14772
14982
|
init_write_file_if_changed();
|
|
14773
14983
|
FARM_STATIC_IMAGE_EXTENSIONS = ["avif", "gif", "jpeg", "jpg", "png", "webp"];
|
|
14774
14984
|
__name(generateFarmImageTypes, "generateFarmImageTypes");
|
|
@@ -14780,9 +14990,9 @@ var init_image_types = __esm({
|
|
|
14780
14990
|
async function generateFarmI18nTypes(options) {
|
|
14781
14991
|
if (!options.config.enabled) return void 0;
|
|
14782
14992
|
const { signatures } = await readFarmI18nCatalogs(options.config);
|
|
14783
|
-
const outFile = options.outFile ? (0,
|
|
14993
|
+
const outFile = options.outFile ? (0, import_node_path8.resolve)(options.root, options.outFile) : (0, import_node_path8.join)((0, import_node_path8.resolve)(options.root), options.srcDir || "src", "farm-i18n.d.ts");
|
|
14784
14994
|
const content = renderFarmI18nTypes(options.config.locales, signatures);
|
|
14785
|
-
(0, import_node_fs6.mkdirSync)((0,
|
|
14995
|
+
(0, import_node_fs6.mkdirSync)((0, import_node_path8.dirname)(outFile), { recursive: true });
|
|
14786
14996
|
writeFileIfChanged(outFile, content);
|
|
14787
14997
|
return outFile;
|
|
14788
14998
|
}
|
|
@@ -14823,12 +15033,12 @@ function argumentType(kind) {
|
|
|
14823
15033
|
return "string";
|
|
14824
15034
|
}
|
|
14825
15035
|
}
|
|
14826
|
-
var import_node_fs6,
|
|
15036
|
+
var import_node_fs6, import_node_path8;
|
|
14827
15037
|
var init_type_generator2 = __esm({
|
|
14828
15038
|
"src/i18n/type-generator.ts"() {
|
|
14829
15039
|
"use strict";
|
|
14830
15040
|
import_node_fs6 = require("fs");
|
|
14831
|
-
|
|
15041
|
+
import_node_path8 = require("path");
|
|
14832
15042
|
init_catalog();
|
|
14833
15043
|
init_write_file_if_changed();
|
|
14834
15044
|
__name(generateFarmI18nTypes, "generateFarmI18nTypes");
|
|
@@ -14852,7 +15062,10 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
14852
15062
|
const result = {
|
|
14853
15063
|
apiRoutes: []
|
|
14854
15064
|
};
|
|
14855
|
-
|
|
15065
|
+
const unifiedTypesPath = (0, import_path11.join)(root, srcDir, "farm.d.ts");
|
|
15066
|
+
const shouldRefreshUnifiedTypes = shouldGenerateRoutes && !options.routeTypesOutFile || shouldGenerateEnv && !options.envTypesOutFile || shouldGenerateI18n && !options.i18nTypesOutFile;
|
|
15067
|
+
const unifiedSections = [];
|
|
15068
|
+
if (shouldRefreshUnifiedTypes && !options.routeTypesOutFile) {
|
|
14856
15069
|
const routeOptions = {
|
|
14857
15070
|
root,
|
|
14858
15071
|
srcDir,
|
|
@@ -14860,10 +15073,17 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
14860
15073
|
suppressLintOnLink: options.suppressLintOnLink,
|
|
14861
15074
|
sourceRoots
|
|
14862
15075
|
};
|
|
14863
|
-
|
|
14864
|
-
|
|
14865
|
-
|
|
14866
|
-
result.routeTypesPath = await generateRouteTypes(
|
|
15076
|
+
unifiedSections.push(await createRouteTypeDeclarations(routeOptions, unifiedTypesPath));
|
|
15077
|
+
result.routeTypesPath = unifiedTypesPath;
|
|
15078
|
+
} else if (shouldGenerateRoutes) {
|
|
15079
|
+
result.routeTypesPath = await generateRouteTypes({
|
|
15080
|
+
root,
|
|
15081
|
+
srcDir,
|
|
15082
|
+
outFile: options.routeTypesOutFile,
|
|
15083
|
+
extraRoutes: options.extraRoutes || [],
|
|
15084
|
+
suppressLintOnLink: options.suppressLintOnLink,
|
|
15085
|
+
sourceRoots
|
|
15086
|
+
});
|
|
14867
15087
|
}
|
|
14868
15088
|
if (shouldGenerateApi) {
|
|
14869
15089
|
const generator = new APITypeGenerator(appDirs);
|
|
@@ -14875,22 +15095,40 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
14875
15095
|
result.apiTypesPath = apiTypesPath;
|
|
14876
15096
|
result.apiRoutes = apiRoutes;
|
|
14877
15097
|
}
|
|
14878
|
-
if (
|
|
15098
|
+
if (shouldRefreshUnifiedTypes && !options.envTypesOutFile) {
|
|
15099
|
+
unifiedSections.push(
|
|
15100
|
+
createEnvTypeDeclarations(
|
|
15101
|
+
{
|
|
15102
|
+
root,
|
|
15103
|
+
srcDir,
|
|
15104
|
+
configPath: options.configPath,
|
|
15105
|
+
layerConfigPaths: (options.layers ?? []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile))
|
|
15106
|
+
},
|
|
15107
|
+
unifiedTypesPath
|
|
15108
|
+
)
|
|
15109
|
+
);
|
|
15110
|
+
result.envTypesPath = unifiedTypesPath;
|
|
15111
|
+
} else if (shouldGenerateEnv) {
|
|
14879
15112
|
result.envTypesPath = await generateEnvTypes({
|
|
14880
15113
|
root,
|
|
14881
15114
|
srcDir,
|
|
14882
15115
|
outFile: options.envTypesOutFile,
|
|
15116
|
+
configPath: options.configPath,
|
|
14883
15117
|
layerConfigPaths: (options.layers ?? []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile))
|
|
14884
15118
|
});
|
|
14885
15119
|
}
|
|
14886
|
-
if (shouldGenerateImages) {
|
|
15120
|
+
if (shouldGenerateImages && options.imageTypesOutFile) {
|
|
14887
15121
|
result.imageTypesPath = generateFarmImageTypes({
|
|
14888
15122
|
root,
|
|
14889
15123
|
srcDir,
|
|
14890
15124
|
outFile: options.imageTypesOutFile
|
|
14891
15125
|
});
|
|
14892
15126
|
}
|
|
14893
|
-
if (
|
|
15127
|
+
if (shouldRefreshUnifiedTypes && options.i18nConfig?.enabled && !options.i18nTypesOutFile) {
|
|
15128
|
+
const { signatures } = await readFarmI18nCatalogs(options.i18nConfig);
|
|
15129
|
+
unifiedSections.push(renderFarmI18nTypes(options.i18nConfig.locales, signatures));
|
|
15130
|
+
result.i18nTypesPath = unifiedTypesPath;
|
|
15131
|
+
} else if (shouldGenerateI18n && options.i18nConfig) {
|
|
14894
15132
|
result.i18nTypesPath = await generateFarmI18nTypes({
|
|
14895
15133
|
root,
|
|
14896
15134
|
srcDir,
|
|
@@ -14898,9 +15136,35 @@ async function generateFarmTypeArtifacts(options) {
|
|
|
14898
15136
|
outFile: options.i18nTypesOutFile
|
|
14899
15137
|
});
|
|
14900
15138
|
}
|
|
15139
|
+
if (shouldRefreshUnifiedTypes) {
|
|
15140
|
+
(0, import_fs4.mkdirSync)((0, import_path11.dirname)(unifiedTypesPath), { recursive: true });
|
|
15141
|
+
writeFileIfChanged(
|
|
15142
|
+
unifiedTypesPath,
|
|
15143
|
+
`/**
|
|
15144
|
+
* Generated by Farm.js. Do not edit.
|
|
15145
|
+
* Contains project-specific route, environment, and internationalization types.
|
|
15146
|
+
*/
|
|
15147
|
+
|
|
15148
|
+
import "@farm.js/core/image";
|
|
15149
|
+
|
|
15150
|
+
${unifiedSections.join("\n")}`
|
|
15151
|
+
);
|
|
15152
|
+
result.typesPath = unifiedTypesPath;
|
|
15153
|
+
removeLegacyTypeArtifacts(root, srcDir);
|
|
15154
|
+
}
|
|
14901
15155
|
return result;
|
|
14902
15156
|
}
|
|
14903
|
-
|
|
15157
|
+
function removeLegacyTypeArtifacts(root, srcDir) {
|
|
15158
|
+
for (const [fileName, marker] of LEGACY_TYPE_ARTIFACTS) {
|
|
15159
|
+
const filePath = (0, import_path11.join)(root, srcDir, fileName);
|
|
15160
|
+
if (!(0, import_fs4.existsSync)(filePath)) continue;
|
|
15161
|
+
const source = (0, import_fs4.readFileSync)(filePath, "utf8");
|
|
15162
|
+
if (source.includes(marker)) {
|
|
15163
|
+
(0, import_fs4.unlinkSync)(filePath);
|
|
15164
|
+
}
|
|
15165
|
+
}
|
|
15166
|
+
}
|
|
15167
|
+
var import_fs4, import_path11, LEGACY_TYPE_ARTIFACTS;
|
|
14904
15168
|
var init_type_artifacts = __esm({
|
|
14905
15169
|
"src/type-artifacts.ts"() {
|
|
14906
15170
|
"use strict";
|
|
@@ -14911,9 +15175,17 @@ var init_type_artifacts = __esm({
|
|
|
14911
15175
|
init_env_types();
|
|
14912
15176
|
init_image_types();
|
|
14913
15177
|
init_type_generator2();
|
|
15178
|
+
init_catalog();
|
|
14914
15179
|
init_layers();
|
|
14915
15180
|
init_write_file_if_changed();
|
|
14916
15181
|
__name(generateFarmTypeArtifacts, "generateFarmTypeArtifacts");
|
|
15182
|
+
LEGACY_TYPE_ARTIFACTS = [
|
|
15183
|
+
["farm-routes.d.ts", "Auto-generated route types"],
|
|
15184
|
+
["farm-env.d.ts", "Auto-generated env types"],
|
|
15185
|
+
["farm-images.d.ts", "Generated by Farm.js"],
|
|
15186
|
+
["farm-i18n.d.ts", "Generated by Farm.js"]
|
|
15187
|
+
];
|
|
15188
|
+
__name(removeLegacyTypeArtifacts, "removeLegacyTypeArtifacts");
|
|
14917
15189
|
}
|
|
14918
15190
|
});
|
|
14919
15191
|
|
|
@@ -14921,7 +15193,7 @@ var init_type_artifacts = __esm({
|
|
|
14921
15193
|
var version;
|
|
14922
15194
|
var init_package = __esm({
|
|
14923
15195
|
"package.json"() {
|
|
14924
|
-
version = "0.1.0-beta.
|
|
15196
|
+
version = "0.1.0-beta.8";
|
|
14925
15197
|
}
|
|
14926
15198
|
});
|
|
14927
15199
|
|
|
@@ -14958,8 +15230,8 @@ function reportAfterError(state, error) {
|
|
|
14958
15230
|
function createAfterRequestState(reportError = defaultAfterErrorReporter) {
|
|
14959
15231
|
let resolveResponseFinished;
|
|
14960
15232
|
let responseFinished = false;
|
|
14961
|
-
const responseFinishedPromise = new Promise((
|
|
14962
|
-
resolveResponseFinished =
|
|
15233
|
+
const responseFinishedPromise = new Promise((resolve6) => {
|
|
15234
|
+
resolveResponseFinished = resolve6;
|
|
14963
15235
|
});
|
|
14964
15236
|
const state = {
|
|
14965
15237
|
completion: Promise.resolve(),
|
|
@@ -15101,12 +15373,12 @@ async function createBlurDataURL(bytes) {
|
|
|
15101
15373
|
return void 0;
|
|
15102
15374
|
}
|
|
15103
15375
|
}
|
|
15104
|
-
var import_promises6,
|
|
15376
|
+
var import_promises6, import_node_path9, import_image_size2, FARM_IMAGE_ID_PREFIX, STATIC_IMAGE_RE, SCRIPT_IMPORTER_RE;
|
|
15105
15377
|
var init_image_vite = __esm({
|
|
15106
15378
|
"src/image-vite.ts"() {
|
|
15107
15379
|
"use strict";
|
|
15108
15380
|
import_promises6 = require("fs/promises");
|
|
15109
|
-
|
|
15381
|
+
import_node_path9 = __toESM(require("path"));
|
|
15110
15382
|
import_image_size2 = require("image-size");
|
|
15111
15383
|
FARM_IMAGE_ID_PREFIX = "\0farm:image:";
|
|
15112
15384
|
STATIC_IMAGE_RE = /\.(?:avif|gif|jpe?g|png|webp)$/i;
|
|
@@ -15954,8 +16226,8 @@ code:not(pre code) {
|
|
|
15954
16226
|
}
|
|
15955
16227
|
|
|
15956
16228
|
.code-block-header {
|
|
15957
|
-
min-height:
|
|
15958
|
-
padding:
|
|
16229
|
+
min-height: 34px;
|
|
16230
|
+
padding: 4px 8px 4px 10px;
|
|
15959
16231
|
}
|
|
15960
16232
|
|
|
15961
16233
|
.code-block-title {
|
|
@@ -16169,8 +16441,8 @@ code:not(pre code) {
|
|
|
16169
16441
|
}
|
|
16170
16442
|
|
|
16171
16443
|
.code-block-header {
|
|
16172
|
-
min-height:
|
|
16173
|
-
padding:
|
|
16444
|
+
min-height: 32px;
|
|
16445
|
+
padding: 3px 7px 3px 9px;
|
|
16174
16446
|
}
|
|
16175
16447
|
|
|
16176
16448
|
.code-copy-floating {
|
|
@@ -16210,38 +16482,30 @@ code:not(pre code) {
|
|
|
16210
16482
|
|
|
16211
16483
|
@media (max-width: 640px) {
|
|
16212
16484
|
.code-block-header {
|
|
16213
|
-
min-height:
|
|
16214
|
-
padding:
|
|
16215
|
-
}
|
|
16216
|
-
|
|
16217
|
-
.code-block-title {
|
|
16218
|
-
font-size: 9px;
|
|
16219
|
-
}
|
|
16220
|
-
|
|
16221
|
-
.code-copy {
|
|
16222
|
-
width: 20px;
|
|
16223
|
-
height: 20px;
|
|
16224
|
-
}
|
|
16225
|
-
|
|
16226
|
-
.code-copy svg {
|
|
16227
|
-
width: 12px;
|
|
16228
|
-
height: 12px;
|
|
16485
|
+
min-height: 30px;
|
|
16486
|
+
padding: 3px 6px 3px 8px;
|
|
16229
16487
|
}
|
|
16230
16488
|
|
|
16231
16489
|
.code-copy-floating {
|
|
16232
|
-
top:
|
|
16233
|
-
right:
|
|
16490
|
+
top: 7px;
|
|
16491
|
+
right: 7px;
|
|
16234
16492
|
}
|
|
16235
16493
|
|
|
16236
16494
|
#nd-docs-layout figure.shiki.code-block pre,
|
|
16237
16495
|
.code-block pre {
|
|
16238
|
-
padding:
|
|
16239
|
-
font-size:
|
|
16240
|
-
line-height: 1.
|
|
16496
|
+
padding: 12px !important;
|
|
16497
|
+
font-size: 12px;
|
|
16498
|
+
line-height: 1.6;
|
|
16499
|
+
}
|
|
16500
|
+
|
|
16501
|
+
#nd-docs-layout figure.shiki.code-block-plain pre,
|
|
16502
|
+
.code-block-plain pre {
|
|
16503
|
+
padding: 16px 44px 16px 14px !important;
|
|
16504
|
+
line-height: 1.65;
|
|
16241
16505
|
}
|
|
16242
16506
|
|
|
16243
16507
|
.sh__line {
|
|
16244
|
-
min-height: 1.
|
|
16508
|
+
min-height: 1.6em;
|
|
16245
16509
|
}
|
|
16246
16510
|
}
|
|
16247
16511
|
|
|
@@ -16828,9 +17092,9 @@ function resolveFarmDocsFavicon(docs, options) {
|
|
|
16828
17092
|
if (typeof configuredFavicon === "string" && configuredFavicon.trim()) {
|
|
16829
17093
|
return configuredFavicon.trim();
|
|
16830
17094
|
}
|
|
16831
|
-
const publicDir =
|
|
17095
|
+
const publicDir = import_node_path10.default.join(import_node_path10.default.resolve(options.root), "public");
|
|
16832
17096
|
for (const fileName of FARM_DOCS_FAVICON_FILES) {
|
|
16833
|
-
const faviconPath =
|
|
17097
|
+
const faviconPath = import_node_path10.default.join(publicDir, fileName);
|
|
16834
17098
|
if ((0, import_node_fs7.existsSync)(faviconPath) && (0, import_node_fs7.statSync)(faviconPath).isFile()) {
|
|
16835
17099
|
return `/${fileName}`;
|
|
16836
17100
|
}
|
|
@@ -16865,10 +17129,10 @@ function isSafeSegment(segment) {
|
|
|
16865
17129
|
return segment !== ".." && !segment.includes("/") && !segment.includes("\\");
|
|
16866
17130
|
}
|
|
16867
17131
|
function resolveInside(root, target) {
|
|
16868
|
-
const resolvedRoot =
|
|
16869
|
-
const resolvedTarget =
|
|
16870
|
-
const relative4 =
|
|
16871
|
-
if (relative4 === "" || !relative4.startsWith("..") && !
|
|
17132
|
+
const resolvedRoot = import_node_path10.default.resolve(root);
|
|
17133
|
+
const resolvedTarget = import_node_path10.default.resolve(target);
|
|
17134
|
+
const relative4 = import_node_path10.default.relative(resolvedRoot, resolvedTarget);
|
|
17135
|
+
if (relative4 === "" || !relative4.startsWith("..") && !import_node_path10.default.isAbsolute(relative4)) {
|
|
16872
17136
|
return resolvedTarget;
|
|
16873
17137
|
}
|
|
16874
17138
|
return null;
|
|
@@ -16882,16 +17146,16 @@ function isFarmDocsRequest(docs, request) {
|
|
|
16882
17146
|
return pathname === entry || pathname === `${entry}.md` || pathname.startsWith(`${entry}/`);
|
|
16883
17147
|
}
|
|
16884
17148
|
function resolveFarmDocsContentDir(docs, options) {
|
|
16885
|
-
const root =
|
|
17149
|
+
const root = import_node_path10.default.resolve(options.root);
|
|
16886
17150
|
const srcDir = options.srcDir || "src";
|
|
16887
17151
|
const configuredContentDir = docs.contentDir || docs.config.contentDir;
|
|
16888
17152
|
if (configuredContentDir) {
|
|
16889
|
-
return
|
|
17153
|
+
return import_node_path10.default.isAbsolute(configuredContentDir) ? configuredContentDir : import_node_path10.default.join(root, configuredContentDir);
|
|
16890
17154
|
}
|
|
16891
17155
|
const entryDir = docs.config.entry || trimSlashes2(docs.entry) || "docs";
|
|
16892
|
-
const appDocsDir =
|
|
17156
|
+
const appDocsDir = import_node_path10.default.join(root, srcDir, "app", entryDir);
|
|
16893
17157
|
if ((0, import_node_fs7.existsSync)(appDocsDir)) return appDocsDir;
|
|
16894
|
-
return
|
|
17158
|
+
return import_node_path10.default.join(root, entryDir);
|
|
16895
17159
|
}
|
|
16896
17160
|
function getFarmDocsRouteTypeEntries(docs) {
|
|
16897
17161
|
if (!docs?.enabled) return [];
|
|
@@ -16914,10 +17178,10 @@ function getRequestSlug(docs, request) {
|
|
|
16914
17178
|
function findDocsPageFile(contentDir, slug) {
|
|
16915
17179
|
const segments = slug ? slug.split("/").filter(Boolean) : [];
|
|
16916
17180
|
if (!segments.every(isSafeSegment)) return null;
|
|
16917
|
-
const slugDir =
|
|
16918
|
-
const candidates = segments.length === 0 ? DOCS_FILE_NAMES.map((filename) =>
|
|
16919
|
-
...DOCS_FILE_NAMES.map((filename) =>
|
|
16920
|
-
...DOCS_FILE_EXTENSIONS2.map((extension) =>
|
|
17181
|
+
const slugDir = import_node_path10.default.join(contentDir, ...segments);
|
|
17182
|
+
const candidates = segments.length === 0 ? DOCS_FILE_NAMES.map((filename) => import_node_path10.default.join(contentDir, filename)) : [
|
|
17183
|
+
...DOCS_FILE_NAMES.map((filename) => import_node_path10.default.join(slugDir, filename)),
|
|
17184
|
+
...DOCS_FILE_EXTENSIONS2.map((extension) => import_node_path10.default.join(contentDir, `${slug}${extension}`))
|
|
16921
17185
|
];
|
|
16922
17186
|
for (const candidate of candidates) {
|
|
16923
17187
|
const safePath = resolveInside(contentDir, candidate);
|
|
@@ -16978,9 +17242,9 @@ function createDocsHref(entry, slug) {
|
|
|
16978
17242
|
return normalizedSlug ? `${normalizedEntry}/${normalizedSlug}` : normalizedEntry;
|
|
16979
17243
|
}
|
|
16980
17244
|
function pathToSlug(contentDir, filePath) {
|
|
16981
|
-
const relative4 =
|
|
17245
|
+
const relative4 = import_node_path10.default.relative(contentDir, filePath).replace(/\\/g, "/");
|
|
16982
17246
|
if (relative4.startsWith("..")) return null;
|
|
16983
|
-
const extension =
|
|
17247
|
+
const extension = import_node_path10.default.extname(relative4);
|
|
16984
17248
|
if (!DOCS_FILE_EXTENSIONS2.includes(extension)) return null;
|
|
16985
17249
|
const withoutExtension = relative4.slice(0, -extension.length);
|
|
16986
17250
|
if (withoutExtension === "page" || withoutExtension === "index") return "";
|
|
@@ -16998,7 +17262,7 @@ function discoverFarmDocsPages(contentDir, docs) {
|
|
|
16998
17262
|
const visit = /* @__PURE__ */ __name((dir) => {
|
|
16999
17263
|
for (const entry of (0, import_node_fs7.readdirSync)(dir, { withFileTypes: true })) {
|
|
17000
17264
|
if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
|
|
17001
|
-
const absolutePath =
|
|
17265
|
+
const absolutePath = import_node_path10.default.join(dir, entry.name);
|
|
17002
17266
|
if (entry.isDirectory()) {
|
|
17003
17267
|
visit(absolutePath);
|
|
17004
17268
|
continue;
|
|
@@ -17837,13 +18101,13 @@ ${renderDocsHashRuntimeScript()}
|
|
|
17837
18101
|
${renderDocsPageActionsRuntimeScript()}`;
|
|
17838
18102
|
}
|
|
17839
18103
|
function readCssWithImports(filePath, seen = /* @__PURE__ */ new Set()) {
|
|
17840
|
-
const resolved =
|
|
18104
|
+
const resolved = import_node_path10.default.resolve(filePath);
|
|
17841
18105
|
if (seen.has(resolved)) return "";
|
|
17842
18106
|
seen.add(resolved);
|
|
17843
18107
|
const source = (0, import_node_fs7.readFileSync)(resolved, "utf8");
|
|
17844
18108
|
return source.replace(/@import\s+["']([^"']+)["'];?/g, (_match, importPath) => {
|
|
17845
18109
|
try {
|
|
17846
|
-
const importedPath = importPath.startsWith(".") ?
|
|
18110
|
+
const importedPath = importPath.startsWith(".") ? import_node_path10.default.resolve(import_node_path10.default.dirname(resolved), importPath) : (0, import_node_module4.createRequire)(resolved).resolve(importPath);
|
|
17847
18111
|
return readCssWithImports(importedPath, seen);
|
|
17848
18112
|
} catch {
|
|
17849
18113
|
return "";
|
|
@@ -17851,13 +18115,13 @@ function readCssWithImports(filePath, seen = /* @__PURE__ */ new Set()) {
|
|
|
17851
18115
|
});
|
|
17852
18116
|
}
|
|
17853
18117
|
function resolvePixelBorderThemeCss(options) {
|
|
17854
|
-
const cacheKey =
|
|
18118
|
+
const cacheKey = import_node_path10.default.resolve(options.root);
|
|
17855
18119
|
const cached = themeCssCache.get(cacheKey);
|
|
17856
18120
|
if (cached !== void 0) return cached;
|
|
17857
18121
|
try {
|
|
17858
|
-
const requireFromApp = (0,
|
|
18122
|
+
const requireFromApp = (0, import_node_module4.createRequire)(import_node_path10.default.join(cacheKey, "package.json"));
|
|
17859
18123
|
const themeCssPath = requireFromApp.resolve("@farming-labs/theme/pixel-border/css");
|
|
17860
|
-
const requireFromTheme = (0,
|
|
18124
|
+
const requireFromTheme = (0, import_node_module4.createRequire)(themeCssPath);
|
|
17861
18125
|
const fumadocsCssPath = requireFromTheme.resolve("fumadocs-ui/style.css");
|
|
17862
18126
|
const css = `${readCssWithImports(fumadocsCssPath)}
|
|
17863
18127
|
${readCssWithImports(themeCssPath)}`;
|
|
@@ -17973,7 +18237,7 @@ function renderFarmDocsBridgeCss(docs) {
|
|
|
17973
18237
|
.sh-code { --sh-class: #e5c07b; --sh-identifier: #c8ccd4; --sh-string: #98c379; --sh-keyword: #c678dd; --sh-comment: #5c6370; --sh-property: #e06c75; --sh-sign: #c8ccd4; --sh-space: inherit; }
|
|
17974
18238
|
.code-block { --fd-code-header-bg: color-mix(in srgb, var(--color-fd-foreground, #fff) 5%, var(--color-fd-background, #000)); --fd-code-body-bg: color-mix(in srgb, var(--color-fd-foreground, #fff) 8%, var(--color-fd-background, #000)); position: relative; width: 100%; min-width: 0; max-width: 100%; margin: 20px 0; overflow: hidden; border: 1px solid var(--color-fd-border, hsl(0 0% 15%)); background: var(--color-fd-background, hsl(0 0% 2%)); box-shadow: 3px 3px 0 0 var(--color-fd-border, hsl(0 0% 15%)); font-family: var(--fd-docs-font-mono); }
|
|
17975
18239
|
#nd-docs-layout figure.shiki.code-block { box-shadow: 3px 3px 0 0 var(--color-fd-border, hsl(0 0% 15%)) !important; }
|
|
17976
|
-
.code-block-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; min-height:
|
|
18240
|
+
.code-block-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; min-height: 34px; border-bottom: 1px solid var(--color-fd-border, hsl(0 0% 15%)); background-color: var(--fd-code-header-bg); background-image: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--color-fd-foreground, #fff) 4%, transparent), color-mix(in srgb, var(--color-fd-foreground, #fff) 4%, transparent) 1px, transparent 1px, transparent 6px); padding: 4px 8px 4px 10px; }
|
|
17977
18241
|
.code-block-title { overflow: hidden; color: color-mix(in srgb, var(--color-fd-foreground, #fff) 50%, transparent); font-size: 10px; line-height: 1.2; text-overflow: ellipsis; text-transform: lowercase; white-space: nowrap; }
|
|
17978
18242
|
.code-copy { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex: 0 0 auto; border: 1px solid var(--color-fd-border, hsl(0 0% 15%)); background: color-mix(in srgb, var(--color-fd-background, #000) 80%, transparent); color: var(--color-fd-muted-foreground, hsl(0 0% 55%)); cursor: pointer; padding: 0; }
|
|
17979
18243
|
.code-copy-floating { position: absolute; top: 8px; right: 8px; z-index: 2; opacity: 0.72; transition: opacity 150ms ease; }
|
|
@@ -18041,7 +18305,7 @@ function renderFarmDocsBridgeCss(docs) {
|
|
|
18041
18305
|
.prose h2 { margin-top: 34px; padding-top: 22px; font-size: 23px; }
|
|
18042
18306
|
.code-block { margin: 16px 0; box-shadow: 2px 2px 0 0 var(--color-fd-border, hsl(0 0% 15%)); }
|
|
18043
18307
|
#nd-docs-layout figure.shiki.code-block { box-shadow: 2px 2px 0 0 var(--color-fd-border, hsl(0 0% 15%)) !important; }
|
|
18044
|
-
.code-block-header { min-height:
|
|
18308
|
+
.code-block-header { min-height: 32px; padding: 3px 7px 3px 9px; }
|
|
18045
18309
|
.code-copy-floating { top: 6px; right: 6px; }
|
|
18046
18310
|
#nd-docs-layout figure.shiki.code-block pre, .code-block pre { padding: 12px 11px !important; font-size: 12px; line-height: 1.5; }
|
|
18047
18311
|
.sh__line { min-height: 1.5em; }
|
|
@@ -18051,13 +18315,11 @@ function renderFarmDocsBridgeCss(docs) {
|
|
|
18051
18315
|
.fd-page-footer .fd-last-updated-footer { margin-left: 0; }
|
|
18052
18316
|
}
|
|
18053
18317
|
@media (max-width: 640px) {
|
|
18054
|
-
.code-block-header { min-height:
|
|
18055
|
-
.code-
|
|
18056
|
-
.code-
|
|
18057
|
-
.code-
|
|
18058
|
-
.
|
|
18059
|
-
#nd-docs-layout figure.shiki.code-block pre, .code-block pre { padding: 10px !important; font-size: 11px; line-height: 1.55; }
|
|
18060
|
-
.sh__line { min-height: 1.55em; }
|
|
18318
|
+
.code-block-header { min-height: 30px; padding: 3px 6px 3px 8px; }
|
|
18319
|
+
.code-copy-floating { top: 7px; right: 7px; }
|
|
18320
|
+
#nd-docs-layout figure.shiki.code-block pre, .code-block pre { padding: 12px !important; font-size: 12px; line-height: 1.6; }
|
|
18321
|
+
#nd-docs-layout figure.shiki.code-block-plain pre, .code-block-plain pre { padding: 16px 44px 16px 14px !important; line-height: 1.65; }
|
|
18322
|
+
.sh__line { min-height: 1.6em; }
|
|
18061
18323
|
}
|
|
18062
18324
|
${farmDocsPixelBorderCss}
|
|
18063
18325
|
`;
|
|
@@ -18176,13 +18438,13 @@ function createFarmDocsHandler(docs, options) {
|
|
|
18176
18438
|
);
|
|
18177
18439
|
}, "handleFarmDocsRequest");
|
|
18178
18440
|
}
|
|
18179
|
-
var import_node_fs7,
|
|
18441
|
+
var import_node_fs7, import_node_module4, import_node_path10, import_docs, import_marked, import_sugar_high, DOCS_FILE_NAMES, DOCS_FILE_EXTENSIONS2, FARM_DOCS_FALLBACK_FAVICON, FARM_DOCS_FAVICON_FILES, GEIST_SANS_FONT_URL, GEIST_MONO_FONT_URL, CODE_LANGUAGE_LABELS, EXTENSIONLESS_CODE_FILENAMES, SIDEBAR_SECTION_ORDER, SIDEBAR_PAGE_ORDER, themeCssCache;
|
|
18180
18442
|
var init_handler = __esm({
|
|
18181
18443
|
"src/docs/handler.ts"() {
|
|
18182
18444
|
"use strict";
|
|
18183
18445
|
import_node_fs7 = require("fs");
|
|
18184
|
-
|
|
18185
|
-
|
|
18446
|
+
import_node_module4 = require("module");
|
|
18447
|
+
import_node_path10 = __toESM(require("path"));
|
|
18186
18448
|
import_docs = require("@farming-labs/docs");
|
|
18187
18449
|
import_marked = require("marked");
|
|
18188
18450
|
import_sugar_high = require("sugar-high");
|
|
@@ -19154,8 +19416,8 @@ var init_generator = __esm({
|
|
|
19154
19416
|
}
|
|
19155
19417
|
routeGroups.get(key).push(route);
|
|
19156
19418
|
}
|
|
19157
|
-
for (const [
|
|
19158
|
-
const openAPIPath = this.convertToOpenAPIPath(
|
|
19419
|
+
for (const [path28, routeList] of routeGroups) {
|
|
19420
|
+
const openAPIPath = this.convertToOpenAPIPath(path28);
|
|
19159
19421
|
spec.paths[openAPIPath] = {};
|
|
19160
19422
|
for (const route of routeList) {
|
|
19161
19423
|
for (const method of route.methods) {
|
|
@@ -19169,8 +19431,8 @@ var init_generator = __esm({
|
|
|
19169
19431
|
/**
|
|
19170
19432
|
* Convert Farm.js API path to OpenAPI path format
|
|
19171
19433
|
*/
|
|
19172
|
-
convertToOpenAPIPath(
|
|
19173
|
-
return
|
|
19434
|
+
convertToOpenAPIPath(path28) {
|
|
19435
|
+
return path28.replace(/^\/api/, "");
|
|
19174
19436
|
}
|
|
19175
19437
|
/**
|
|
19176
19438
|
* Extract request body schema from endpoint
|
|
@@ -19332,8 +19594,8 @@ var init_generator = __esm({
|
|
|
19332
19594
|
/**
|
|
19333
19595
|
* Generate operation summary
|
|
19334
19596
|
*/
|
|
19335
|
-
generateSummary(
|
|
19336
|
-
const cleanPath =
|
|
19597
|
+
generateSummary(path28, method) {
|
|
19598
|
+
const cleanPath = path28.replace(/^\/api\//, "");
|
|
19337
19599
|
const pathParts = cleanPath.split("/");
|
|
19338
19600
|
const lastPart = pathParts[pathParts.length - 1];
|
|
19339
19601
|
const action = method === "GET" ? "Get" : method === "POST" ? "Create" : method === "PUT" ? "Update" : method === "DELETE" ? "Delete" : method === "PATCH" ? "Update" : method;
|
|
@@ -19342,22 +19604,22 @@ var init_generator = __esm({
|
|
|
19342
19604
|
/**
|
|
19343
19605
|
* Generate operation description
|
|
19344
19606
|
*/
|
|
19345
|
-
generateDescription(
|
|
19346
|
-
const cleanPath =
|
|
19607
|
+
generateDescription(path28, method) {
|
|
19608
|
+
const cleanPath = path28.replace(/^\/api\//, "");
|
|
19347
19609
|
return `${method} ${cleanPath} endpoint`;
|
|
19348
19610
|
}
|
|
19349
19611
|
/**
|
|
19350
19612
|
* Generate operation ID
|
|
19351
19613
|
*/
|
|
19352
|
-
generateOperationId(
|
|
19353
|
-
const cleanPath =
|
|
19614
|
+
generateOperationId(path28, method) {
|
|
19615
|
+
const cleanPath = path28.replace(/^\/api\//, "").replace(/\//g, "_");
|
|
19354
19616
|
return `${method.toLowerCase()}_${cleanPath}`;
|
|
19355
19617
|
}
|
|
19356
19618
|
/**
|
|
19357
19619
|
* Generate tags for grouping operations
|
|
19358
19620
|
*/
|
|
19359
|
-
generateTags(
|
|
19360
|
-
const cleanPath =
|
|
19621
|
+
generateTags(path28) {
|
|
19622
|
+
const cleanPath = path28.replace(/^\/api\//, "");
|
|
19361
19623
|
const pathParts = cleanPath.split("/");
|
|
19362
19624
|
if (pathParts.length > 1) {
|
|
19363
19625
|
return [pathParts[0]];
|
|
@@ -19370,8 +19632,8 @@ var init_generator = __esm({
|
|
|
19370
19632
|
async generateSpecFile(routes, outputPath) {
|
|
19371
19633
|
const spec = await this.generateSpec(routes);
|
|
19372
19634
|
const fs8 = require("fs");
|
|
19373
|
-
const
|
|
19374
|
-
const dir =
|
|
19635
|
+
const path28 = require("path");
|
|
19636
|
+
const dir = path28.dirname(outputPath);
|
|
19375
19637
|
if (!fs8.existsSync(dir)) {
|
|
19376
19638
|
fs8.mkdirSync(dir, { recursive: true });
|
|
19377
19639
|
}
|
|
@@ -19791,7 +20053,7 @@ async function createFarmDevtoolsSnapshot(input) {
|
|
|
19791
20053
|
generatedAt: (input.now?.() || /* @__PURE__ */ new Date()).toISOString(),
|
|
19792
20054
|
health: resolveHealth(diagnostics),
|
|
19793
20055
|
project: {
|
|
19794
|
-
name:
|
|
20056
|
+
name: import_node_path11.default.basename(import_node_path11.default.resolve(input.root)),
|
|
19795
20057
|
root: input.root,
|
|
19796
20058
|
srcDir: input.srcDir,
|
|
19797
20059
|
basePath: config.basePath || "/",
|
|
@@ -19840,11 +20102,11 @@ async function createFarmDevtoolsSnapshot(input) {
|
|
|
19840
20102
|
diagnostics
|
|
19841
20103
|
};
|
|
19842
20104
|
}
|
|
19843
|
-
var
|
|
20105
|
+
var import_node_path11;
|
|
19844
20106
|
var init_devtools = __esm({
|
|
19845
20107
|
"src/devtools.ts"() {
|
|
19846
20108
|
"use strict";
|
|
19847
|
-
|
|
20109
|
+
import_node_path11 = __toESM(require("path"));
|
|
19848
20110
|
init_config2();
|
|
19849
20111
|
init_cron();
|
|
19850
20112
|
init_route_runtime();
|
|
@@ -21668,7 +21930,7 @@ function fileContainsProgrammaticPageRoute(file) {
|
|
|
21668
21930
|
}
|
|
21669
21931
|
function rewriteEarlySsrRelativeImports(options) {
|
|
21670
21932
|
const cleanId = options.id.split("?", 1)[0];
|
|
21671
|
-
if (!
|
|
21933
|
+
if (!path24.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
|
|
21672
21934
|
return null;
|
|
21673
21935
|
}
|
|
21674
21936
|
const replacements = [];
|
|
@@ -21688,7 +21950,7 @@ function rewriteEarlySsrRelativeImports(options) {
|
|
|
21688
21950
|
const suffixIndex = source.value.search(/[?#]/);
|
|
21689
21951
|
const sourcePath = suffixIndex === -1 ? source.value : source.value.slice(0, suffixIndex);
|
|
21690
21952
|
const suffix = suffixIndex === -1 ? "" : source.value.slice(suffixIndex);
|
|
21691
|
-
const resolvedPath =
|
|
21953
|
+
const resolvedPath = path24.resolve(path24.dirname(cleanId), sourcePath);
|
|
21692
21954
|
replacements.push({
|
|
21693
21955
|
start: source.start,
|
|
21694
21956
|
end: source.end,
|
|
@@ -21764,7 +22026,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
21764
22026
|
...layerRoots.length ? {
|
|
21765
22027
|
server: {
|
|
21766
22028
|
fs: {
|
|
21767
|
-
allow: [
|
|
22029
|
+
allow: [path24.resolve(options.root || process.cwd()), ...layerRoots]
|
|
21768
22030
|
}
|
|
21769
22031
|
}
|
|
21770
22032
|
} : {}
|
|
@@ -21789,9 +22051,9 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
21789
22051
|
},
|
|
21790
22052
|
server
|
|
21791
22053
|
);
|
|
21792
|
-
const globalsCSSPath =
|
|
22054
|
+
const globalsCSSPath = path24.join(server.config.root, "src/app/globals.css");
|
|
21793
22055
|
if (!fs7.existsSync(globalsCSSPath)) {
|
|
21794
|
-
const appDir =
|
|
22056
|
+
const appDir = path24.join(server.config.root, "src/app");
|
|
21795
22057
|
if (!fs7.existsSync(appDir)) {
|
|
21796
22058
|
fs7.mkdirSync(appDir, { recursive: true });
|
|
21797
22059
|
}
|
|
@@ -21813,10 +22075,10 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
21813
22075
|
});
|
|
21814
22076
|
}
|
|
21815
22077
|
const sourceRoots = getFarmSourceRoots(farmConfig);
|
|
21816
|
-
server.watcher.add(sourceRoots.map((source) =>
|
|
22078
|
+
server.watcher.add(sourceRoots.map((source) => path24.join(source.root, source.srcDir)));
|
|
21817
22079
|
if (farmConfig.i18n.enabled) {
|
|
21818
22080
|
server.watcher.add(
|
|
21819
|
-
farmConfig.i18n.messages.includes("{locale}") ?
|
|
22081
|
+
farmConfig.i18n.messages.includes("{locale}") ? path24.dirname(farmConfig.i18n.messages) : farmConfig.i18n.messages
|
|
21820
22082
|
);
|
|
21821
22083
|
}
|
|
21822
22084
|
const workflowConfig = farmConfig.workflows;
|
|
@@ -21826,7 +22088,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
21826
22088
|
...farmDocsDevRuntime?.getFarmDocsRouteTypeEntries(farmConfig.docs) ?? []
|
|
21827
22089
|
], "getExtraRouteTypes");
|
|
21828
22090
|
const appDirSlugs = sourceRoots.map(
|
|
21829
|
-
(source) =>
|
|
22091
|
+
(source) => path24.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
|
|
21830
22092
|
);
|
|
21831
22093
|
const generateTypeArtifacts = /* @__PURE__ */ __name(async (reason, selection = ALL_TYPE_ARTIFACTS, log = false) => {
|
|
21832
22094
|
try {
|
|
@@ -21866,7 +22128,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
21866
22128
|
}, "generateTypeArtifacts");
|
|
21867
22129
|
await generateTypeArtifacts("startup");
|
|
21868
22130
|
const srcDirSlugs = sourceRoots.map(
|
|
21869
|
-
(source) =>
|
|
22131
|
+
(source) => path24.join(source.root, source.srcDir).replace(/\\/g, "/")
|
|
21870
22132
|
);
|
|
21871
22133
|
const layerConfigFiles = new Set(
|
|
21872
22134
|
farmConfig.layers.map((layer) => layer.configFile?.replace(/\\/g, "/")).filter((file) => Boolean(file))
|
|
@@ -21984,7 +22246,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
21984
22246
|
await apiRouteManager.discoverRoutes();
|
|
21985
22247
|
let discoveredWorkflows = [];
|
|
21986
22248
|
const hasWorkflowDirectory = workflowConfig.enabled && workflowConfig.dirs.some(
|
|
21987
|
-
(dir) => fs7.existsSync(
|
|
22249
|
+
(dir) => fs7.existsSync(path24.isAbsolute(dir) ? dir : path24.join(farmConfig.root, dir))
|
|
21988
22250
|
);
|
|
21989
22251
|
if (hasWorkflowDirectory) {
|
|
21990
22252
|
const { createFarmWorkflowRequestHandler: createFarmWorkflowRequestHandler2, discoverFarmWorkflows: discoverFarmWorkflows2 } = await loadFarmWorkflowsDevRuntime();
|
|
@@ -22062,14 +22324,14 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
22062
22324
|
farmDocsDevRuntime ? [
|
|
22063
22325
|
[
|
|
22064
22326
|
"/assets/Geist-Variable-CrgPqtmy.woff2",
|
|
22065
|
-
|
|
22327
|
+
path24.join(
|
|
22066
22328
|
farmConfig.root,
|
|
22067
22329
|
"node_modules/geist/dist/fonts/geist-sans/Geist-Variable.woff2"
|
|
22068
22330
|
)
|
|
22069
22331
|
],
|
|
22070
22332
|
[
|
|
22071
22333
|
"/assets/GeistMono-Variable-BNLlm6Cd.woff2",
|
|
22072
|
-
|
|
22334
|
+
path24.join(
|
|
22073
22335
|
farmConfig.root,
|
|
22074
22336
|
"node_modules/geist/dist/fonts/geist-mono/GeistMono-Variable.woff2"
|
|
22075
22337
|
)
|
|
@@ -22233,12 +22495,13 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
22233
22495
|
config: farmApp.getConfig().mdx,
|
|
22234
22496
|
resolveSource: /* @__PURE__ */ __name(async (pathname2) => {
|
|
22235
22497
|
const match = farmApp.getRouteManager().matchRoute(pathname2);
|
|
22236
|
-
|
|
22498
|
+
const sourcePath = match.route?.markdownSourcePath || (match.route && isFarmMarkdownPageFile(match.route.modulePath) ? match.route.modulePath : null);
|
|
22499
|
+
if (!sourcePath) {
|
|
22237
22500
|
return null;
|
|
22238
22501
|
}
|
|
22239
22502
|
return {
|
|
22240
|
-
source: await fs7.promises.readFile(
|
|
22241
|
-
filePath:
|
|
22503
|
+
source: await fs7.promises.readFile(sourcePath, "utf8"),
|
|
22504
|
+
filePath: sourcePath
|
|
22242
22505
|
};
|
|
22243
22506
|
}, "resolveSource")
|
|
22244
22507
|
});
|
|
@@ -22259,16 +22522,37 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
22259
22522
|
await sendWebResponse(res, markdownResponse);
|
|
22260
22523
|
return;
|
|
22261
22524
|
}
|
|
22525
|
+
const markdownPageTarget = resolveMarkdownMirrorTarget(
|
|
22526
|
+
farmApp.getConfig().md,
|
|
22527
|
+
requestPathname,
|
|
22528
|
+
{
|
|
22529
|
+
accept: "text/markdown"
|
|
22530
|
+
}
|
|
22531
|
+
);
|
|
22532
|
+
if (markdownPageTarget && farmApp.getRouteManager().matchRoute(markdownPageTarget.pathname).route) {
|
|
22533
|
+
const vary = res.getHeader("Vary");
|
|
22534
|
+
const varyValues = String(vary || "").split(",").map((value) => value.trim()).filter(Boolean);
|
|
22535
|
+
if (!varyValues.some((value) => value.toLowerCase() === "accept")) {
|
|
22536
|
+
res.setHeader("Vary", [...varyValues, "Accept"].join(", "));
|
|
22537
|
+
}
|
|
22538
|
+
const alternatePath = markdownPageTarget.pathname === "/" ? "/index.md" : `${markdownPageTarget.pathname}.md`;
|
|
22539
|
+
const alternateLink = `<${alternatePath}>; rel="alternate"; type="text/markdown"`;
|
|
22540
|
+
const currentLink = res.getHeader("Link");
|
|
22541
|
+
res.setHeader(
|
|
22542
|
+
"Link",
|
|
22543
|
+
currentLink ? `${String(currentLink)}, ${alternateLink}` : alternateLink
|
|
22544
|
+
);
|
|
22545
|
+
}
|
|
22262
22546
|
if (workflowHandler && (requestPathname === workflowConfig.route || requestPathname.startsWith(`${workflowConfig.route}/`))) {
|
|
22263
22547
|
let workflowBody;
|
|
22264
22548
|
if (requestMethod !== "GET" && requestMethod !== "HEAD") {
|
|
22265
|
-
workflowBody = await new Promise((
|
|
22549
|
+
workflowBody = await new Promise((resolve6) => {
|
|
22266
22550
|
let data = "";
|
|
22267
22551
|
req.on("data", (chunk) => {
|
|
22268
22552
|
data += chunk;
|
|
22269
22553
|
});
|
|
22270
22554
|
req.on("end", () => {
|
|
22271
|
-
|
|
22555
|
+
resolve6(data);
|
|
22272
22556
|
});
|
|
22273
22557
|
});
|
|
22274
22558
|
}
|
|
@@ -22311,13 +22595,13 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
22311
22595
|
}
|
|
22312
22596
|
let body;
|
|
22313
22597
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
22314
|
-
body = await new Promise((
|
|
22598
|
+
body = await new Promise((resolve6) => {
|
|
22315
22599
|
let data = "";
|
|
22316
22600
|
req.on("data", (chunk) => {
|
|
22317
22601
|
data += chunk;
|
|
22318
22602
|
});
|
|
22319
22603
|
req.on("end", () => {
|
|
22320
|
-
|
|
22604
|
+
resolve6(data);
|
|
22321
22605
|
});
|
|
22322
22606
|
});
|
|
22323
22607
|
}
|
|
@@ -22423,13 +22707,13 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
22423
22707
|
}
|
|
22424
22708
|
let body;
|
|
22425
22709
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
22426
|
-
body = await new Promise((
|
|
22710
|
+
body = await new Promise((resolve6) => {
|
|
22427
22711
|
let data = "";
|
|
22428
22712
|
req.on("data", (chunk) => {
|
|
22429
22713
|
data += chunk;
|
|
22430
22714
|
});
|
|
22431
22715
|
req.on("end", () => {
|
|
22432
|
-
|
|
22716
|
+
resolve6(data);
|
|
22433
22717
|
});
|
|
22434
22718
|
});
|
|
22435
22719
|
}
|
|
@@ -22486,13 +22770,13 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
22486
22770
|
}
|
|
22487
22771
|
let body;
|
|
22488
22772
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
22489
|
-
body = await new Promise((
|
|
22773
|
+
body = await new Promise((resolve6) => {
|
|
22490
22774
|
let data = "";
|
|
22491
22775
|
req.on("data", (chunk) => {
|
|
22492
22776
|
data += chunk;
|
|
22493
22777
|
});
|
|
22494
22778
|
req.on("end", () => {
|
|
22495
|
-
|
|
22779
|
+
resolve6(data);
|
|
22496
22780
|
});
|
|
22497
22781
|
});
|
|
22498
22782
|
}
|
|
@@ -23212,8 +23496,8 @@ if (import.meta.hot) {
|
|
|
23212
23496
|
}
|
|
23213
23497
|
logger.info(`Found ${ssgPages.length} SSG pages, ${ssrRoutes.length} SSR routes`);
|
|
23214
23498
|
logger.info("Pre-rendering SSG pages...");
|
|
23215
|
-
const outDir =
|
|
23216
|
-
const clientDir =
|
|
23499
|
+
const outDir = path24.join(server?.config.root || process.cwd(), options.outDir || "dist");
|
|
23500
|
+
const clientDir = path24.join(outDir, "client");
|
|
23217
23501
|
for (const page2 of ssgPages) {
|
|
23218
23502
|
try {
|
|
23219
23503
|
const staticRequest = new Request(new URL(page2.urlPath, "http://farm.static"));
|
|
@@ -23265,8 +23549,8 @@ if (import.meta.hot) {
|
|
|
23265
23549
|
<script type="module" src="/assets/client.js"></script>
|
|
23266
23550
|
</body>
|
|
23267
23551
|
</html>`;
|
|
23268
|
-
const outputPath = page2.urlPath === "/" ?
|
|
23269
|
-
fs7.mkdirSync(
|
|
23552
|
+
const outputPath = page2.urlPath === "/" ? path24.join(clientDir, "index.html") : path24.join(clientDir, page2.urlPath + ".html");
|
|
23553
|
+
fs7.mkdirSync(path24.dirname(outputPath), { recursive: true });
|
|
23270
23554
|
fs7.writeFileSync(outputPath, fullHtml);
|
|
23271
23555
|
const revalidateInfo = page2.revalidate ? ` (revalidate: ${page2.revalidate}s)` : "";
|
|
23272
23556
|
logger.success(` \u2713 ${page2.urlPath}${revalidateInfo}`);
|
|
@@ -23275,7 +23559,7 @@ if (import.meta.hot) {
|
|
|
23275
23559
|
logger.error(` \u2717 ${page2.urlPath}: ${error}`);
|
|
23276
23560
|
}
|
|
23277
23561
|
}
|
|
23278
|
-
const manifestPath =
|
|
23562
|
+
const manifestPath = path24.join(outDir, "__ssg_manifest.json");
|
|
23279
23563
|
fs7.writeFileSync(
|
|
23280
23564
|
manifestPath,
|
|
23281
23565
|
JSON.stringify(
|
|
@@ -23311,9 +23595,9 @@ if (import.meta.hot) {
|
|
|
23311
23595
|
}
|
|
23312
23596
|
const currentFarmConfig = farmApp?.getConfig();
|
|
23313
23597
|
const normalizedFile = file.replace(/\\/g, "/");
|
|
23314
|
-
const currentSrcRoot = currentFarmConfig ? getFarmSourceRoots(currentFarmConfig).map((source) =>
|
|
23598
|
+
const currentSrcRoot = currentFarmConfig ? getFarmSourceRoots(currentFarmConfig).map((source) => path24.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
|
|
23315
23599
|
if (currentSrcRoot && normalizedFile.startsWith(`${currentSrcRoot}/`) && isProgrammaticRoutesFileName(normalizedFile)) {
|
|
23316
|
-
logUpdate("PAGE", `updated ${
|
|
23600
|
+
logUpdate("PAGE", `updated ${path24.basename(file)}`);
|
|
23317
23601
|
for (const mod of modules) {
|
|
23318
23602
|
server2.moduleGraph.invalidateModule(mod);
|
|
23319
23603
|
}
|
|
@@ -24350,6 +24634,7 @@ async function buildRouteComponentProps(pageModule, params, searchParams, path,
|
|
|
24350
24634
|
const parsedSearch = parseClientRouteSchema(schemas?.search, searchParams, 'search');
|
|
24351
24635
|
|
|
24352
24636
|
return {
|
|
24637
|
+
...(existingProps || {}),
|
|
24353
24638
|
params: parsedParams,
|
|
24354
24639
|
search: parsedSearch,
|
|
24355
24640
|
searchParams: schemas ? Promise.resolve(parsedSearch) : parsedSearch,
|
|
@@ -24863,7 +25148,7 @@ function generateClientManifest(bundle) {
|
|
|
24863
25148
|
}
|
|
24864
25149
|
async function defineConfig2(config = {}) {
|
|
24865
25150
|
const tailwindcss = (await import("@tailwindcss/vite")).default;
|
|
24866
|
-
const appRoot =
|
|
25151
|
+
const appRoot = path24.resolve(config.root || process.cwd());
|
|
24867
25152
|
if (config.extends?.length) {
|
|
24868
25153
|
const { config: layeredConfig } = await Promise.resolve().then(() => (init_layers(), layers_exports)).then(
|
|
24869
25154
|
({ resolveFarmLayers: resolveFarmLayers2 }) => resolveFarmLayers2(config, {
|
|
@@ -25049,7 +25334,7 @@ async function defineConfig2(config = {}) {
|
|
|
25049
25334
|
// Stub out problematic server-only modules during dev mode
|
|
25050
25335
|
alias: {
|
|
25051
25336
|
...getFarmLayerAliases(config.layers),
|
|
25052
|
-
"@":
|
|
25337
|
+
"@": path24.resolve(appRoot, "src"),
|
|
25053
25338
|
// Nitro internals that should not be resolved in browser
|
|
25054
25339
|
"supports-color": "data:text/javascript,export default false; export const supportsColor = false; export const stdout = false; export const stderr = false;",
|
|
25055
25340
|
"@poppinss/dumper": "data:text/javascript,export default {};",
|
|
@@ -25066,7 +25351,7 @@ async function defineConfig2(config = {}) {
|
|
|
25066
25351
|
}
|
|
25067
25352
|
};
|
|
25068
25353
|
}
|
|
25069
|
-
var fs7,
|
|
25354
|
+
var fs7, path24, ALL_TYPE_ARTIFACTS, createEmptyTypeArtifactSelection, FARM_I18N_CLIENT_BRIDGE_ID, EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME, FARM_CONFIG_FILENAMES;
|
|
25070
25355
|
var init_vite = __esm({
|
|
25071
25356
|
"src/vite.ts"() {
|
|
25072
25357
|
"use strict";
|
|
@@ -25087,7 +25372,7 @@ var init_vite = __esm({
|
|
|
25087
25372
|
init_route_context();
|
|
25088
25373
|
init_devtools_config();
|
|
25089
25374
|
fs7 = __toESM(require("fs"));
|
|
25090
|
-
|
|
25375
|
+
path24 = __toESM(require("path"));
|
|
25091
25376
|
init_layers();
|
|
25092
25377
|
init_environment_vite();
|
|
25093
25378
|
init_version();
|
|
@@ -25103,7 +25388,7 @@ var init_vite = __esm({
|
|
|
25103
25388
|
routes: true,
|
|
25104
25389
|
api: true,
|
|
25105
25390
|
env: true,
|
|
25106
|
-
images:
|
|
25391
|
+
images: false,
|
|
25107
25392
|
i18n: true
|
|
25108
25393
|
};
|
|
25109
25394
|
createEmptyTypeArtifactSelection = /* @__PURE__ */ __name(() => ({
|
|
@@ -27211,10 +27496,14 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
27211
27496
|
const routeRuntimeManifestResultPromise = Promise.allSettled([routeRuntimeManifestPromise]);
|
|
27212
27497
|
const pageRoutes = [];
|
|
27213
27498
|
for (const [pattern, entry] of routeManager.getRoutes()) {
|
|
27499
|
+
const markdownSourcePath = entry.markdownSourcePath || (isFarmMarkdownPageFile(entry.modulePath) ? entry.modulePath : void 0);
|
|
27214
27500
|
pageRoutes.push({
|
|
27215
27501
|
pattern,
|
|
27216
27502
|
modulePath: entry.modulePath,
|
|
27217
|
-
...
|
|
27503
|
+
...markdownSourcePath ? {
|
|
27504
|
+
source: (0, import_fs5.readFileSync)(markdownSourcePath, "utf8"),
|
|
27505
|
+
markdownSourcePath
|
|
27506
|
+
} : {}
|
|
27218
27507
|
});
|
|
27219
27508
|
}
|
|
27220
27509
|
const routeSlots = Array.from(
|
|
@@ -29125,15 +29414,13 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
|
|
|
29125
29414
|
});
|
|
29126
29415
|
const pageImports = [];
|
|
29127
29416
|
const pageRegistrations = [];
|
|
29128
|
-
const hasMarkdownPages = pageRoutes.some(
|
|
29129
|
-
(route) => route.source !== void 0 || isFarmMarkdownPageFile(route.modulePath)
|
|
29130
|
-
);
|
|
29417
|
+
const hasMarkdownPages = pageRoutes.some((route) => route.source !== void 0);
|
|
29131
29418
|
const orderedPageRoutes = pageRoutes.map((route, index) => ({ route, index })).sort(
|
|
29132
29419
|
(left, right) => routePatternSpecificity(right.route.pattern) - routePatternSpecificity(left.route.pattern) || left.index - right.index
|
|
29133
29420
|
).map(({ route }) => route);
|
|
29134
29421
|
orderedPageRoutes.forEach((route, index) => {
|
|
29135
29422
|
const varName = `pageRoute${index}`;
|
|
29136
|
-
if (
|
|
29423
|
+
if (isFarmMarkdownPageFile(route.modulePath)) {
|
|
29137
29424
|
pageRegistrations.push(`
|
|
29138
29425
|
{
|
|
29139
29426
|
pattern: ${JSON.stringify(route.pattern)},
|
|
@@ -29145,7 +29432,7 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
|
|
|
29145
29432
|
}),
|
|
29146
29433
|
markdownSource: {
|
|
29147
29434
|
source: ${JSON.stringify(route.source ?? "")},
|
|
29148
|
-
filePath: ${JSON.stringify(route.modulePath)},
|
|
29435
|
+
filePath: ${JSON.stringify(route.markdownSourcePath ?? route.modulePath)},
|
|
29149
29436
|
},
|
|
29150
29437
|
}`);
|
|
29151
29438
|
return;
|
|
@@ -29157,6 +29444,10 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
|
|
|
29157
29444
|
pattern: ${JSON.stringify(route.pattern)},
|
|
29158
29445
|
module: ${varName},
|
|
29159
29446
|
shouldHydrate: ${JSON.stringify(shouldHydrate)},
|
|
29447
|
+
${route.source !== void 0 ? `markdownSource: {
|
|
29448
|
+
source: ${JSON.stringify(route.source)},
|
|
29449
|
+
filePath: ${JSON.stringify(route.markdownSourcePath)},
|
|
29450
|
+
},` : ""}
|
|
29160
29451
|
}`);
|
|
29161
29452
|
});
|
|
29162
29453
|
const layoutImports = [];
|
|
@@ -29262,7 +29553,7 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
|
|
|
29262
29553
|
const docsRuntimeImport = config.docs?.enabled ? `import { existsSync as farmDocsExistsSync } from "node:fs";
|
|
29263
29554
|
import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
|
|
29264
29555
|
import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
29265
|
-
const markdownHandlerImport = config.md?.enabled ? `import { createMarkdownMirrorResponse } from "@farm.js/core/markdown";` : "";
|
|
29556
|
+
const markdownHandlerImport = config.md?.enabled ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse } from "@farm.js/core/markdown";` : "";
|
|
29266
29557
|
const appMarkdownImport = hasMarkdownPages ? `import { createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse } from "@farm.js/core/app-markdown";` : "const createFarmMarkdownSourceResponse = null;";
|
|
29267
29558
|
const mdxComponentsPath = typeof config.mdx?.components === "string" ? import_path12.default.isAbsolute(config.mdx.components) ? config.mdx.components : import_path12.default.join(config.root, config.mdx.components) : null;
|
|
29268
29559
|
const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from "${mdxComponentsPath.replace(/\\/g, "/")}";` : "";
|
|
@@ -29512,10 +29803,12 @@ function serializeFarmInlineValue(value) {
|
|
|
29512
29803
|
.replace(/\\u2029/g, "\\\\u2029");
|
|
29513
29804
|
}
|
|
29514
29805
|
|
|
29515
|
-
function renderFarmClientBootstrapScript(canonicalPath, selectedRouteSlots) {
|
|
29806
|
+
function renderFarmClientBootstrapScript(canonicalPath, selectedRouteSlots, pageProps) {
|
|
29516
29807
|
const integrationManifest = ${hasRuntimeIntegrationConfig ? "getRegisteredIntegrationAPIManifest()" : "{}"};
|
|
29517
29808
|
const serializedRouteSlots = serializeFarmInlineValue(selectedRouteSlots || []);
|
|
29518
|
-
|
|
29809
|
+
const serializedPageProps = serializeFarmInlineValue(pageProps || {});
|
|
29810
|
+
let source = 'window.__FARM_PROPS__=' + serializedPageProps +
|
|
29811
|
+
';window.__FARM_INTEGRATION_API_MANIFEST__=' +
|
|
29519
29812
|
serializeFarmInlineValue(integrationManifest) +
|
|
29520
29813
|
';window.__FARM_ROUTE_SLOTS__=' + serializedRouteSlots + ';';
|
|
29521
29814
|
if (typeof canonicalPath === "string" && canonicalPath.startsWith("/")) {
|
|
@@ -30566,7 +30859,7 @@ async function getCachedPPRShell(cacheKey) {
|
|
|
30566
30859
|
* Main request handler - created at runtime with bundled routes
|
|
30567
30860
|
*/
|
|
30568
30861
|
async function handleFarmRequest(request) {
|
|
30569
|
-
${config.i18n.enabled ? `
|
|
30862
|
+
const response = await ${config.i18n.enabled ? `_runWithFarmI18nRequest(
|
|
30570
30863
|
farmI18nRuntime,
|
|
30571
30864
|
request,
|
|
30572
30865
|
async function(farmLocaleResolution) {
|
|
@@ -30585,7 +30878,15 @@ async function handleFarmRequest(request) {
|
|
|
30585
30878
|
const response = await handleFarmRequestInContext(request, farmLocaleResolution);
|
|
30586
30879
|
return applyFarmI18nResponse(response, farmLocaleResolution);
|
|
30587
30880
|
}
|
|
30588
|
-
)
|
|
30881
|
+
)` : "handleFarmRequestInContext(request, null)"};
|
|
30882
|
+
${config.md?.enabled ? `const pathname = getFarmRoutePathname(new URL(request.url).pathname);
|
|
30883
|
+
if (matchPageRoute(pathname)) {
|
|
30884
|
+
return applyMarkdownNegotiationHeaders(response, {
|
|
30885
|
+
config: farmMarkdownConfig,
|
|
30886
|
+
pathname,
|
|
30887
|
+
});
|
|
30888
|
+
}` : ""}
|
|
30889
|
+
return response;
|
|
30589
30890
|
}
|
|
30590
30891
|
|
|
30591
30892
|
async function handleFarmRequestInContext(
|
|
@@ -30947,6 +31248,23 @@ async function handleFarmRequestInContext(
|
|
|
30947
31248
|
return { ...slot, props: slotProps };
|
|
30948
31249
|
}),
|
|
30949
31250
|
);
|
|
31251
|
+
const clientMiddleware = middlewareData?.size
|
|
31252
|
+
? { data: Object.fromEntries(middlewareData) }
|
|
31253
|
+
: undefined;
|
|
31254
|
+
const clientPageProps = {
|
|
31255
|
+
params: pageProps.params,
|
|
31256
|
+
search: pageProps.search ?? searchParamsObj,
|
|
31257
|
+
searchParams: pageProps.search ?? searchParamsObj,
|
|
31258
|
+
...("data" in pageProps ? { data: pageProps.data } : {}),
|
|
31259
|
+
...(pageProps.__farmCanonicalPath
|
|
31260
|
+
? { __farmCanonicalPath: pageProps.__farmCanonicalPath }
|
|
31261
|
+
: {}),
|
|
31262
|
+
...(pageProps.__farmRoutePropsResolved
|
|
31263
|
+
? { __farmRoutePropsResolved: true }
|
|
31264
|
+
: {}),
|
|
31265
|
+
path: pathname,
|
|
31266
|
+
...(clientMiddleware ? { middleware: clientMiddleware } : {}),
|
|
31267
|
+
};
|
|
30950
31268
|
const routeSlotPayload = renderedRouteSlots.map(function(slot) {
|
|
30951
31269
|
return {
|
|
30952
31270
|
name: slot.name,
|
|
@@ -30961,6 +31279,7 @@ async function handleFarmRequestInContext(
|
|
|
30961
31279
|
searchParams: slot.props.search || searchParamsObj,
|
|
30962
31280
|
...("data" in slot.props ? { data: slot.props.data } : {}),
|
|
30963
31281
|
path: pathname,
|
|
31282
|
+
...(clientMiddleware ? { middleware: clientMiddleware } : {}),
|
|
30964
31283
|
},
|
|
30965
31284
|
};
|
|
30966
31285
|
});
|
|
@@ -31116,7 +31435,8 @@ async function handleFarmRequestInContext(
|
|
|
31116
31435
|
const streamSuffix = '</div>\\n' +
|
|
31117
31436
|
' ' + renderFarmClientBootstrapScript(
|
|
31118
31437
|
pageProps.__farmCanonicalPath,
|
|
31119
|
-
routeSlotPayload
|
|
31438
|
+
routeSlotPayload,
|
|
31439
|
+
clientPageProps
|
|
31120
31440
|
) + '\\n' +
|
|
31121
31441
|
' <script type="module" src="/farm-client.js"></script>\\n' +
|
|
31122
31442
|
'</body>\\n</html>';
|
|
@@ -31176,7 +31496,8 @@ async function handleFarmRequestInContext(
|
|
|
31176
31496
|
/<\\/body>/i,
|
|
31177
31497
|
' ' + renderFarmClientBootstrapScript(
|
|
31178
31498
|
pageProps.__farmCanonicalPath,
|
|
31179
|
-
routeSlotPayload
|
|
31499
|
+
routeSlotPayload,
|
|
31500
|
+
clientPageProps
|
|
31180
31501
|
) + '\\n' +
|
|
31181
31502
|
' <script type="module" src="/farm-client.js"></script>\\n</body>',
|
|
31182
31503
|
);
|
|
@@ -31198,7 +31519,7 @@ async function handleFarmRequestInContext(
|
|
|
31198
31519
|
</head>
|
|
31199
31520
|
<body>
|
|
31200
31521
|
<div id="root">\${html}</div>
|
|
31201
|
-
\${renderFarmClientBootstrapScript(pageProps.__farmCanonicalPath, routeSlotPayload)}
|
|
31522
|
+
\${renderFarmClientBootstrapScript(pageProps.__farmCanonicalPath, routeSlotPayload, clientPageProps)}
|
|
31202
31523
|
<script type="module" src="/farm-client.js"></script>
|
|
31203
31524
|
</body>
|
|
31204
31525
|
</html>\`;
|