@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
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getResolvedEnv
|
|
3
|
+
} from "./chunk-RQ633A5I.mjs";
|
|
4
|
+
import {
|
|
5
|
+
clearRequestContext,
|
|
6
|
+
deleteRequestContext,
|
|
7
|
+
getRequestContext,
|
|
8
|
+
getRequestContextSnapshot,
|
|
9
|
+
hasRequestContext,
|
|
10
|
+
setRequestContext
|
|
11
|
+
} from "./chunk-K4667E2Q.mjs";
|
|
12
|
+
import {
|
|
13
|
+
__name
|
|
14
|
+
} from "./chunk-CGILA3WO.mjs";
|
|
15
|
+
|
|
16
|
+
// src/plugin.ts
|
|
17
|
+
var _PluginManager = class _PluginManager {
|
|
18
|
+
constructor(context) {
|
|
19
|
+
this.plugins = [];
|
|
20
|
+
this.hookPresence = /* @__PURE__ */ new Map();
|
|
21
|
+
this.runtimeHookPresence = /* @__PURE__ */ new Map();
|
|
22
|
+
this.pluginStates = /* @__PURE__ */ new Map();
|
|
23
|
+
this.setupComplete = false;
|
|
24
|
+
this.initialized = false;
|
|
25
|
+
this.runtimeReady = false;
|
|
26
|
+
this.runtimeClosed = false;
|
|
27
|
+
this.runtimeRequestContexts = /* @__PURE__ */ new WeakMap();
|
|
28
|
+
this.failedRuntimeSessions = /* @__PURE__ */ new WeakSet();
|
|
29
|
+
this.context = {
|
|
30
|
+
...context,
|
|
31
|
+
requestContext: {
|
|
32
|
+
set(target, key, value, options) {
|
|
33
|
+
setRequestContext(target, key, value, options);
|
|
34
|
+
},
|
|
35
|
+
get(target, key) {
|
|
36
|
+
return getRequestContext(target, key);
|
|
37
|
+
},
|
|
38
|
+
has(target, key) {
|
|
39
|
+
return hasRequestContext(target, key);
|
|
40
|
+
},
|
|
41
|
+
delete(target, key) {
|
|
42
|
+
return deleteRequestContext(target, key);
|
|
43
|
+
},
|
|
44
|
+
clear(target) {
|
|
45
|
+
clearRequestContext(target);
|
|
46
|
+
},
|
|
47
|
+
getAll(target, options) {
|
|
48
|
+
return getRequestContextSnapshot(target, options);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
createRequestHookContext(target) {
|
|
54
|
+
const requestContext = this.context.requestContext;
|
|
55
|
+
return {
|
|
56
|
+
...this.context,
|
|
57
|
+
req: {
|
|
58
|
+
set(key, value, options) {
|
|
59
|
+
requestContext.set(target, key, value, options);
|
|
60
|
+
},
|
|
61
|
+
get(key) {
|
|
62
|
+
return requestContext.get(target, key);
|
|
63
|
+
},
|
|
64
|
+
has(key) {
|
|
65
|
+
return requestContext.has(target, key);
|
|
66
|
+
},
|
|
67
|
+
delete(key) {
|
|
68
|
+
return requestContext.delete(target, key);
|
|
69
|
+
},
|
|
70
|
+
clear() {
|
|
71
|
+
requestContext.clear(target);
|
|
72
|
+
},
|
|
73
|
+
snapshot(options) {
|
|
74
|
+
return requestContext.getAll(target, options);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
copyRequestStore(source, target) {
|
|
80
|
+
const requestContext = this.context.requestContext;
|
|
81
|
+
const values = requestContext.getAll(source);
|
|
82
|
+
const exposed = requestContext.getAll(source, { exposedOnly: true });
|
|
83
|
+
for (const [key, value] of values) {
|
|
84
|
+
requestContext.set(target, key, value, {
|
|
85
|
+
exposeToPage: exposed.has(key)
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
copyRuntimeRequestContext(source, target) {
|
|
90
|
+
const runtimeContext = this.runtimeRequestContexts.get(source);
|
|
91
|
+
if (runtimeContext) {
|
|
92
|
+
this.runtimeRequestContexts.set(target, runtimeContext);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
createRuntimeBaseEvent(plugin, request, options, waitUntil) {
|
|
96
|
+
return {
|
|
97
|
+
...this.createStateHookContext(plugin),
|
|
98
|
+
request,
|
|
99
|
+
req: this.createRequestHookContext(request).req,
|
|
100
|
+
kind: options.kind ?? "request",
|
|
101
|
+
route: options.route,
|
|
102
|
+
signal: request.signal,
|
|
103
|
+
waitUntil
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
async createRuntimeRequestContext(request, options, waitUntil) {
|
|
107
|
+
const values = {};
|
|
108
|
+
const owners = /* @__PURE__ */ new Map();
|
|
109
|
+
for (const plugin of this.getSortedPlugins()) {
|
|
110
|
+
const createContext = plugin.runtime?.context;
|
|
111
|
+
if (!createContext) continue;
|
|
112
|
+
const result = await createContext(
|
|
113
|
+
this.createRuntimeBaseEvent(plugin, request, options, waitUntil)
|
|
114
|
+
);
|
|
115
|
+
if (result === void 0) continue;
|
|
116
|
+
if (!result || typeof result !== "object" || Array.isArray(result)) {
|
|
117
|
+
throw new TypeError(`Farm plugin "${plugin.name}" runtime.context must return an object`);
|
|
118
|
+
}
|
|
119
|
+
for (const [key, value] of Object.entries(result)) {
|
|
120
|
+
const owner = owners.get(key);
|
|
121
|
+
if (owner) {
|
|
122
|
+
throw new Error(
|
|
123
|
+
`Farm plugin context key "${key}" from "${plugin.name}" conflicts with "${owner}"`
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
owners.set(key, plugin.name);
|
|
127
|
+
values[key] = value;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const runtimeContext = Object.freeze(values);
|
|
131
|
+
this.runtimeRequestContexts.set(request, runtimeContext);
|
|
132
|
+
return runtimeContext;
|
|
133
|
+
}
|
|
134
|
+
async runRuntimeErrorHooks(request, error, ctx, durationMs, options, waitUntil) {
|
|
135
|
+
for (const plugin of this.getSortedPlugins()) {
|
|
136
|
+
const onError = plugin.runtime?.error;
|
|
137
|
+
if (!onError) continue;
|
|
138
|
+
try {
|
|
139
|
+
await onError({
|
|
140
|
+
...this.createRuntimeBaseEvent(plugin, request, options, waitUntil),
|
|
141
|
+
ctx,
|
|
142
|
+
error,
|
|
143
|
+
durationMs
|
|
144
|
+
});
|
|
145
|
+
} catch (hookError) {
|
|
146
|
+
console.error(`Farm plugin "${plugin.name}" runtime.error failed:`, hookError);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
await this.runHookParallel("onError", {
|
|
151
|
+
phase: "runtime",
|
|
152
|
+
error,
|
|
153
|
+
meta: {
|
|
154
|
+
kind: options.kind ?? "request",
|
|
155
|
+
pathname: new URL(request.url).pathname,
|
|
156
|
+
durationMs
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
} catch (hookError) {
|
|
160
|
+
console.error("Farm plugin onError hook failed:", hookError);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
createStateHookContext(plugin, context = this.context) {
|
|
164
|
+
return {
|
|
165
|
+
...context,
|
|
166
|
+
state: this.pluginStates.get(plugin)
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
getPluginHooks(plugin, hookName) {
|
|
170
|
+
const hooks = [];
|
|
171
|
+
const legacyHook = plugin[hookName];
|
|
172
|
+
if (typeof legacyHook === "function") {
|
|
173
|
+
hooks.push(legacyHook);
|
|
174
|
+
}
|
|
175
|
+
const withState = /* @__PURE__ */ __name((context) => this.createStateHookContext(plugin, context), "withState");
|
|
176
|
+
switch (hookName) {
|
|
177
|
+
case "config":
|
|
178
|
+
if (plugin.configure) {
|
|
179
|
+
hooks.push(
|
|
180
|
+
(config, context) => plugin.configure?.(config, context)
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
break;
|
|
184
|
+
case "ready":
|
|
185
|
+
if (plugin.runtime?.start) {
|
|
186
|
+
hooks.push((context) => plugin.runtime?.start?.(withState(context)));
|
|
187
|
+
}
|
|
188
|
+
break;
|
|
189
|
+
case "shutdown":
|
|
190
|
+
if (plugin.runtime?.close) {
|
|
191
|
+
hooks.push(
|
|
192
|
+
(payload, context) => plugin.runtime?.close?.({
|
|
193
|
+
...withState(context),
|
|
194
|
+
reason: payload.reason
|
|
195
|
+
})
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
break;
|
|
199
|
+
case "routeDiscovered":
|
|
200
|
+
if (plugin.router?.discovered) {
|
|
201
|
+
hooks.push(
|
|
202
|
+
(route, context) => plugin.router?.discovered?.(route, withState(context))
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
break;
|
|
206
|
+
case "middlewareDiscovered":
|
|
207
|
+
if (plugin.router?.discovered) {
|
|
208
|
+
hooks.push(
|
|
209
|
+
(route, context) => plugin.router?.discovered?.({ kind: "middleware", ...route }, withState(context))
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
break;
|
|
213
|
+
case "apiRouteDiscovered":
|
|
214
|
+
if (plugin.router?.discovered) {
|
|
215
|
+
hooks.push(
|
|
216
|
+
(route, context) => plugin.router?.discovered?.({ kind: "api", ...route }, withState(context))
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
break;
|
|
220
|
+
case "routesGenerated":
|
|
221
|
+
if (plugin.router?.generated) {
|
|
222
|
+
hooks.push(
|
|
223
|
+
(routes, context) => plugin.router?.generated?.(routes, withState(context))
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
break;
|
|
227
|
+
case "beforeRouteMatch":
|
|
228
|
+
if (plugin.router?.before) {
|
|
229
|
+
hooks.push(
|
|
230
|
+
(route, context) => plugin.router?.before?.(route, withState(context))
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
break;
|
|
234
|
+
case "afterRouteMatch":
|
|
235
|
+
if (plugin.router?.after) {
|
|
236
|
+
hooks.push(
|
|
237
|
+
(result, context) => plugin.router?.after?.(result, withState(context))
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
break;
|
|
241
|
+
case "beforeRender":
|
|
242
|
+
if (plugin.render?.before) {
|
|
243
|
+
hooks.push(
|
|
244
|
+
(render, context) => plugin.render?.before?.(render, withState(context))
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
break;
|
|
248
|
+
case "afterRender":
|
|
249
|
+
if (plugin.render?.html) {
|
|
250
|
+
hooks.push(
|
|
251
|
+
(html, render, context) => plugin.render?.html?.(html, render, withState(context))
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
break;
|
|
255
|
+
case "beforeBundle":
|
|
256
|
+
if (plugin.build?.before) {
|
|
257
|
+
hooks.push(
|
|
258
|
+
(bundle, context) => plugin.build?.before?.(bundle, withState(context))
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
break;
|
|
262
|
+
case "beforeNitroBuild":
|
|
263
|
+
if (plugin.build?.configure) {
|
|
264
|
+
hooks.push(
|
|
265
|
+
(buildConfig, context) => plugin.build?.configure?.(buildConfig, withState(context))
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
break;
|
|
269
|
+
case "afterBundle":
|
|
270
|
+
if (plugin.build?.after) {
|
|
271
|
+
hooks.push(
|
|
272
|
+
(result, context) => plugin.build?.after?.(result, withState(context))
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
break;
|
|
276
|
+
case "devServerCreated":
|
|
277
|
+
if (plugin.dev?.server) {
|
|
278
|
+
hooks.push(
|
|
279
|
+
(server, context) => plugin.dev?.server?.(server, withState(context))
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
break;
|
|
283
|
+
case "hmrUpdate":
|
|
284
|
+
if (plugin.dev?.update) {
|
|
285
|
+
hooks.push(
|
|
286
|
+
(update, context) => plugin.dev?.update?.(update, withState(context))
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
291
|
+
return hooks;
|
|
292
|
+
}
|
|
293
|
+
getHookContext(hookName, args) {
|
|
294
|
+
if (hookName === "beforeRequest" || hookName === "afterResponse" || hookName === "beforeApiHandler") {
|
|
295
|
+
const target = args[0];
|
|
296
|
+
if (target && typeof target === "object") {
|
|
297
|
+
return this.createRequestHookContext(target);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return this.context;
|
|
301
|
+
}
|
|
302
|
+
addPlugin(plugin) {
|
|
303
|
+
this.plugins.push(plugin);
|
|
304
|
+
this.hookPresence.clear();
|
|
305
|
+
this.runtimeHookPresence.clear();
|
|
306
|
+
}
|
|
307
|
+
addPlugins(plugins) {
|
|
308
|
+
for (const plugin of plugins) {
|
|
309
|
+
this.addPlugin(plugin);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
getPlugins() {
|
|
313
|
+
return [...this.plugins];
|
|
314
|
+
}
|
|
315
|
+
getSortedPlugins() {
|
|
316
|
+
const pre = this.plugins.filter((p) => p.enforce === "pre");
|
|
317
|
+
const normal = this.plugins.filter((p) => !p.enforce);
|
|
318
|
+
const post = this.plugins.filter((p) => p.enforce === "post");
|
|
319
|
+
return [...pre, ...normal, ...post];
|
|
320
|
+
}
|
|
321
|
+
hasHook(hookName) {
|
|
322
|
+
const cached = this.hookPresence.get(hookName);
|
|
323
|
+
if (cached !== void 0) return cached;
|
|
324
|
+
const present = this.plugins.some((plugin) => this.getPluginHooks(plugin, hookName).length > 0);
|
|
325
|
+
this.hookPresence.set(hookName, present);
|
|
326
|
+
return present;
|
|
327
|
+
}
|
|
328
|
+
hasRuntimeHook(hookName) {
|
|
329
|
+
const cached = this.runtimeHookPresence.get(hookName);
|
|
330
|
+
if (cached !== void 0) return cached;
|
|
331
|
+
const present = this.plugins.some((plugin) => typeof plugin.runtime?.[hookName] === "function");
|
|
332
|
+
this.runtimeHookPresence.set(hookName, present);
|
|
333
|
+
return present;
|
|
334
|
+
}
|
|
335
|
+
hasRuntimeRequestHooks() {
|
|
336
|
+
return this.hasRuntimeHook("context") || this.hasRuntimeHook("before") || this.hasRuntimeHook("after") || this.hasRuntimeHook("error");
|
|
337
|
+
}
|
|
338
|
+
copyRequestContext(source, target) {
|
|
339
|
+
this.copyRequestStore(source, target);
|
|
340
|
+
if (source instanceof Request && target instanceof Request) {
|
|
341
|
+
this.copyRuntimeRequestContext(source, target);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
async setupPlugins() {
|
|
345
|
+
if (this.setupComplete) return;
|
|
346
|
+
for (const plugin of this.getSortedPlugins()) {
|
|
347
|
+
if (!plugin.setup) continue;
|
|
348
|
+
const state = await plugin.setup({
|
|
349
|
+
...this.context,
|
|
350
|
+
env: getResolvedEnv()
|
|
351
|
+
});
|
|
352
|
+
this.pluginStates.set(plugin, state);
|
|
353
|
+
}
|
|
354
|
+
this.setupComplete = true;
|
|
355
|
+
}
|
|
356
|
+
async startRuntime() {
|
|
357
|
+
if (this.runtimeReady) return;
|
|
358
|
+
if (this.runtimeStartPromise) return this.runtimeStartPromise;
|
|
359
|
+
this.runtimeStartPromise = (async () => {
|
|
360
|
+
if (!this.initialized) {
|
|
361
|
+
await this.runHookParallel("init");
|
|
362
|
+
}
|
|
363
|
+
await this.setupPlugins();
|
|
364
|
+
if (!this.runtimeReady) {
|
|
365
|
+
await this.runHookParallel("ready");
|
|
366
|
+
}
|
|
367
|
+
})();
|
|
368
|
+
try {
|
|
369
|
+
await this.runtimeStartPromise;
|
|
370
|
+
} catch (error) {
|
|
371
|
+
this.runtimeStartPromise = void 0;
|
|
372
|
+
throw error;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
async closeRuntime(reason = "runtime-closed") {
|
|
376
|
+
if (this.runtimeClosed) return;
|
|
377
|
+
if (this.runtimeClosePromise) return this.runtimeClosePromise;
|
|
378
|
+
this.runtimeClosePromise = this.runHookParallel("shutdown", {
|
|
379
|
+
reason
|
|
380
|
+
}).then(() => void 0);
|
|
381
|
+
try {
|
|
382
|
+
await this.runtimeClosePromise;
|
|
383
|
+
} catch (error) {
|
|
384
|
+
this.runtimeClosePromise = void 0;
|
|
385
|
+
throw error;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
async beginRuntimeRequest(request, options = {}) {
|
|
389
|
+
await this.startRuntime();
|
|
390
|
+
const startedAt = Date.now();
|
|
391
|
+
const waitUntil = options.waitUntil ? (promise) => options.waitUntil?.(Promise.resolve(promise)) : (promise) => {
|
|
392
|
+
void Promise.resolve(promise).catch(() => {
|
|
393
|
+
});
|
|
394
|
+
};
|
|
395
|
+
let activeRequest = request;
|
|
396
|
+
let runtimeContext = Object.freeze({});
|
|
397
|
+
try {
|
|
398
|
+
runtimeContext = await this.createRuntimeRequestContext(activeRequest, options, waitUntil);
|
|
399
|
+
let response;
|
|
400
|
+
for (const plugin of this.getSortedPlugins()) {
|
|
401
|
+
const before = plugin.runtime?.before;
|
|
402
|
+
if (!before) continue;
|
|
403
|
+
const result = await before({
|
|
404
|
+
...this.createRuntimeBaseEvent(plugin, activeRequest, options, waitUntil),
|
|
405
|
+
ctx: runtimeContext
|
|
406
|
+
});
|
|
407
|
+
if (result instanceof Request) {
|
|
408
|
+
this.copyRequestStore(activeRequest, result);
|
|
409
|
+
this.copyRuntimeRequestContext(activeRequest, result);
|
|
410
|
+
activeRequest = result;
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
if (result instanceof Response) {
|
|
414
|
+
response = result;
|
|
415
|
+
break;
|
|
416
|
+
}
|
|
417
|
+
if (result !== void 0) {
|
|
418
|
+
throw new TypeError(
|
|
419
|
+
`Farm plugin "${plugin.name}" runtime.before must return a Request, Response, or undefined`
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return {
|
|
424
|
+
request: activeRequest,
|
|
425
|
+
response,
|
|
426
|
+
ctx: runtimeContext,
|
|
427
|
+
startedAt,
|
|
428
|
+
options,
|
|
429
|
+
waitUntil
|
|
430
|
+
};
|
|
431
|
+
} catch (error) {
|
|
432
|
+
await this.runRuntimeErrorHooks(
|
|
433
|
+
activeRequest,
|
|
434
|
+
error,
|
|
435
|
+
runtimeContext,
|
|
436
|
+
Date.now() - startedAt,
|
|
437
|
+
options,
|
|
438
|
+
waitUntil
|
|
439
|
+
);
|
|
440
|
+
throw error;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
async endRuntimeRequest(session, initialResponse) {
|
|
444
|
+
let response = initialResponse;
|
|
445
|
+
try {
|
|
446
|
+
for (const plugin of this.getSortedPlugins()) {
|
|
447
|
+
const after = plugin.runtime?.after;
|
|
448
|
+
if (!after) continue;
|
|
449
|
+
const result = await after({
|
|
450
|
+
...this.createRuntimeBaseEvent(
|
|
451
|
+
plugin,
|
|
452
|
+
session.request,
|
|
453
|
+
session.options,
|
|
454
|
+
session.waitUntil
|
|
455
|
+
),
|
|
456
|
+
ctx: session.ctx,
|
|
457
|
+
response,
|
|
458
|
+
durationMs: Date.now() - session.startedAt
|
|
459
|
+
});
|
|
460
|
+
if (result !== void 0) {
|
|
461
|
+
if (!(result instanceof Response)) {
|
|
462
|
+
throw new TypeError(
|
|
463
|
+
`Farm plugin "${plugin.name}" runtime.after must return a Response or undefined`
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
response = result;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
return response;
|
|
470
|
+
} catch (error) {
|
|
471
|
+
await this.failRuntimeRequest(session, error);
|
|
472
|
+
throw error;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
async failRuntimeRequest(session, error) {
|
|
476
|
+
if (this.failedRuntimeSessions.has(session)) return;
|
|
477
|
+
this.failedRuntimeSessions.add(session);
|
|
478
|
+
await this.runRuntimeErrorHooks(
|
|
479
|
+
session.request,
|
|
480
|
+
error,
|
|
481
|
+
session.ctx,
|
|
482
|
+
Date.now() - session.startedAt,
|
|
483
|
+
session.options,
|
|
484
|
+
session.waitUntil
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
async runRuntimeRequest(request, handler, options = {}) {
|
|
488
|
+
const session = await this.beginRuntimeRequest(request, options);
|
|
489
|
+
try {
|
|
490
|
+
const response = session.response ?? await handler(session.request);
|
|
491
|
+
if (!(response instanceof Response)) {
|
|
492
|
+
throw new TypeError("Farm plugin runtime handlers must return a Response");
|
|
493
|
+
}
|
|
494
|
+
return await this.endRuntimeRequest(session, response);
|
|
495
|
+
} catch (error) {
|
|
496
|
+
await this.failRuntimeRequest(session, error);
|
|
497
|
+
throw error;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
async runHook(hookName, ...args) {
|
|
501
|
+
const plugins = this.getSortedPlugins();
|
|
502
|
+
for (const plugin of plugins) {
|
|
503
|
+
for (const hook of this.getPluginHooks(plugin, hookName)) {
|
|
504
|
+
const hookContext = this.getHookContext(hookName, args);
|
|
505
|
+
const result = await hook.apply(plugin, [...args, hookContext]);
|
|
506
|
+
if (result !== void 0) {
|
|
507
|
+
return result;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
async runHookSerial(hookName, initialValue, ...args) {
|
|
513
|
+
const plugins = this.getSortedPlugins();
|
|
514
|
+
let value = initialValue;
|
|
515
|
+
for (const plugin of plugins) {
|
|
516
|
+
for (const hook of this.getPluginHooks(plugin, hookName)) {
|
|
517
|
+
const hookArgs = [value, ...args];
|
|
518
|
+
const hookContext = this.getHookContext(hookName, hookArgs);
|
|
519
|
+
const result = await hook.apply(plugin, [...hookArgs, hookContext]);
|
|
520
|
+
if (result !== void 0) {
|
|
521
|
+
if (hookName === "beforeApiHandler" && result !== value && value && result && typeof value === "object" && typeof result === "object") {
|
|
522
|
+
this.copyRequestStore(value, result);
|
|
523
|
+
}
|
|
524
|
+
value = result;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
return value;
|
|
529
|
+
}
|
|
530
|
+
async runHookParallel(hookName, ...args) {
|
|
531
|
+
const plugins = this.getSortedPlugins();
|
|
532
|
+
const sequentialHooks = /* @__PURE__ */ new Set([
|
|
533
|
+
"ready",
|
|
534
|
+
"shutdown",
|
|
535
|
+
"beforeRequest",
|
|
536
|
+
"afterResponse",
|
|
537
|
+
"beforeApiHandler",
|
|
538
|
+
"afterApiHandler",
|
|
539
|
+
"beforeRouteMatch",
|
|
540
|
+
"afterRouteMatch",
|
|
541
|
+
"beforeRender",
|
|
542
|
+
"afterRender"
|
|
543
|
+
]);
|
|
544
|
+
if (sequentialHooks.has(hookName)) {
|
|
545
|
+
for (const plugin of plugins) {
|
|
546
|
+
for (const hook of this.getPluginHooks(plugin, hookName)) {
|
|
547
|
+
if (hookName === "beforeRequest") {
|
|
548
|
+
const res = args[1];
|
|
549
|
+
if (res && res.writableEnded) {
|
|
550
|
+
return true;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
const hookContext = this.getHookContext(hookName, args);
|
|
554
|
+
await hook.apply(plugin, [...args, hookContext]);
|
|
555
|
+
if (hookName === "beforeRequest") {
|
|
556
|
+
const res = args[1];
|
|
557
|
+
if (res && res.writableEnded) {
|
|
558
|
+
return true;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
} else {
|
|
564
|
+
const promises = [];
|
|
565
|
+
for (const plugin of plugins) {
|
|
566
|
+
for (const hook of this.getPluginHooks(plugin, hookName)) {
|
|
567
|
+
const hookContext = this.getHookContext(hookName, args);
|
|
568
|
+
promises.push(hook.apply(plugin, [...args, hookContext]));
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
await Promise.all(promises);
|
|
572
|
+
}
|
|
573
|
+
if (hookName === "init") this.initialized = true;
|
|
574
|
+
if (hookName === "ready") this.runtimeReady = true;
|
|
575
|
+
if (hookName === "shutdown") this.runtimeClosed = true;
|
|
576
|
+
return false;
|
|
577
|
+
}
|
|
578
|
+
updateContext(updates) {
|
|
579
|
+
this.context = {
|
|
580
|
+
...this.context,
|
|
581
|
+
...updates,
|
|
582
|
+
requestContext: this.context.requestContext
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
__name(_PluginManager, "PluginManager");
|
|
587
|
+
var PluginManager = _PluginManager;
|
|
588
|
+
function definePlugin(plugin) {
|
|
589
|
+
return plugin;
|
|
590
|
+
}
|
|
591
|
+
__name(definePlugin, "definePlugin");
|
|
592
|
+
|
|
593
|
+
export {
|
|
594
|
+
PluginManager,
|
|
595
|
+
definePlugin
|
|
596
|
+
};
|
|
597
|
+
//# sourceMappingURL=chunk-DJSGLHCN.mjs.map
|