@farm.js/core 0.1.0-beta.95 → 0.1.0-beta.97
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 +1 -1
- package/dist/after.mjs +1 -1
- package/dist/agent-runtime.d.mts +3 -2
- package/dist/agent-runtime.d.ts +3 -2
- package/dist/api/route-manager.cjs +43 -4
- package/dist/api/route-manager.d.mts +4 -3
- package/dist/api/route-manager.d.ts +4 -3
- package/dist/api/route-manager.mjs +7 -7
- package/dist/api/runtime.cjs +43 -4
- package/dist/api/runtime.d.mts +1 -1
- package/dist/api/runtime.d.ts +1 -1
- package/dist/api/runtime.mjs +5 -5
- package/dist/api.cjs +352 -109
- package/dist/api.d.mts +7 -6
- package/dist/api.d.ts +7 -6
- package/dist/api.mjs +19 -12
- package/dist/{app-CIIEvA4r.d.ts → app-CIOx3LvY.d.ts} +4 -4
- package/dist/{app-O4AEC1OH.d.mts → app-DBd6437H.d.mts} +4 -4
- package/dist/app-markdown.d.mts +4 -3
- package/dist/app-markdown.d.ts +4 -3
- package/dist/cache.cjs +42 -4
- package/dist/cache.d.mts +68 -1
- package/dist/cache.d.ts +68 -1
- package/dist/cache.mjs +3 -3
- package/dist/{chunk-AXVJCMVF.mjs → chunk-2HDOV47R.mjs} +3 -3
- package/dist/chunk-2HDOV47R.mjs.map +1 -0
- package/dist/{chunk-RBRLLZL5.mjs → chunk-34IAPZBG.mjs} +16 -3
- package/dist/chunk-34IAPZBG.mjs.map +1 -0
- package/dist/{chunk-VV24CC42.mjs → chunk-35NPLKQJ.mjs} +2 -2
- package/dist/{chunk-D7QH7MDU.mjs → chunk-3TWQERDE.mjs} +5 -4
- package/dist/chunk-3TWQERDE.mjs.map +1 -0
- package/dist/{chunk-RWYRFCLG.mjs → chunk-4X57GXQA.mjs} +2 -2
- package/dist/{chunk-KOTSX5JH.mjs → chunk-52BR7LTX.mjs} +30 -21
- package/dist/chunk-52BR7LTX.mjs.map +1 -0
- package/dist/{chunk-SALMKQXH.mjs → chunk-6EJHNHH4.mjs} +80 -27
- package/dist/chunk-6EJHNHH4.mjs.map +1 -0
- package/dist/{chunk-ZFNK77WN.mjs → chunk-6JNGOC37.mjs} +2 -2
- package/dist/{after.cjs.map → chunk-6JNGOC37.mjs.map} +1 -1
- package/dist/{chunk-MOW47IF5.mjs → chunk-6UYVU46O.mjs} +2 -2
- package/dist/{chunk-7MABZJIM.mjs → chunk-7PYVLJ4J.mjs} +1 -1
- package/dist/chunk-7PYVLJ4J.mjs.map +1 -0
- package/dist/{chunk-FLHLPB57.mjs → chunk-D7F7YZ7L.mjs} +93 -67
- package/dist/chunk-D7F7YZ7L.mjs.map +1 -0
- package/dist/chunk-DU3PKDVQ.mjs +35 -0
- package/dist/chunk-DU3PKDVQ.mjs.map +1 -0
- package/dist/{chunk-SCFX4UTD.mjs → chunk-EHTUKVSW.mjs} +1 -1
- package/dist/chunk-EHTUKVSW.mjs.map +1 -0
- package/dist/{chunk-KWCNQUH5.mjs → chunk-EPDIF432.mjs} +526 -50
- package/dist/chunk-EPDIF432.mjs.map +1 -0
- package/dist/{chunk-A3636IHN.mjs → chunk-FP5Q67FO.mjs} +167 -96
- package/dist/chunk-FP5Q67FO.mjs.map +1 -0
- package/dist/{chunk-HHZAOTQD.mjs → chunk-GJ7W6LNK.mjs} +7 -6
- package/dist/chunk-GJ7W6LNK.mjs.map +1 -0
- package/dist/{chunk-RLGUZ3HS.mjs → chunk-I3OOUWO5.mjs} +3 -3
- package/dist/{chunk-75CGAL6E.mjs → chunk-IZBX2TEU.mjs} +217 -105
- package/dist/chunk-IZBX2TEU.mjs.map +1 -0
- package/dist/{chunk-22VG4DFJ.mjs → chunk-J3MPQ4MQ.mjs} +2 -2
- package/dist/{chunk-22VG4DFJ.mjs.map → chunk-J3MPQ4MQ.mjs.map} +1 -1
- package/dist/{chunk-2LS3KKE7.mjs → chunk-JV7JUD7Q.mjs} +4 -4
- package/dist/{chunk-Q3OX763A.mjs → chunk-LXDASSTE.mjs} +2 -2
- package/dist/{chunk-ZRBCBOEX.mjs → chunk-N2FY2QZ7.mjs} +28 -3
- package/dist/chunk-N2FY2QZ7.mjs.map +1 -0
- package/dist/{chunk-MRVJCLYQ.mjs → chunk-PSQ7N4XP.mjs} +4 -2
- package/dist/chunk-PSQ7N4XP.mjs.map +1 -0
- package/dist/{chunk-HVG3HLQZ.mjs → chunk-Q7WGOOAI.mjs} +3 -3
- package/dist/{chunk-WTYAPO5I.mjs → chunk-RCNWMEBT.mjs} +3 -2
- package/dist/{chunk-WTYAPO5I.mjs.map → chunk-RCNWMEBT.mjs.map} +1 -1
- package/dist/{chunk-3INDBMUU.mjs → chunk-TGDIACZT.mjs} +2 -2
- package/dist/{chunk-WB75GIX2.mjs → chunk-TQTB33JS.mjs} +14 -3
- package/dist/chunk-TQTB33JS.mjs.map +1 -0
- package/dist/{chunk-MH27UH72.mjs → chunk-TT3E2JOF.mjs} +3 -3
- package/dist/{chunk-UWRGX3J3.mjs → chunk-UMUWR5XA.mjs} +2 -2
- package/dist/{chunk-XTLLHCWU.mjs → chunk-V4VRLVLW.mjs} +52 -31
- package/dist/chunk-V4VRLVLW.mjs.map +1 -0
- package/dist/{chunk-EXCGBERG.mjs → chunk-WD2EBM3I.mjs} +79 -17
- package/dist/chunk-WD2EBM3I.mjs.map +1 -0
- package/dist/{chunk-DLBUAJTK.mjs → chunk-WMJGA32P.mjs} +74 -5
- package/dist/chunk-WMJGA32P.mjs.map +1 -0
- package/dist/{chunk-TKQCJMY7.mjs → chunk-X4SFHKFH.mjs} +7 -4
- package/dist/{chunk-TKQCJMY7.mjs.map → chunk-X4SFHKFH.mjs.map} +1 -1
- package/dist/{chunk-Q7GPJZCO.mjs → chunk-YIBV77KZ.mjs} +26 -7
- package/dist/chunk-YIBV77KZ.mjs.map +1 -0
- package/dist/client/lifecycle.mjs +2 -2
- package/dist/{client-mcMC334J.d.mts → client-DWoLZ3QU.d.mts} +52 -5
- package/dist/{client-d5ONQ-Pd.d.ts → client-DuQuQC1h.d.ts} +52 -5
- package/dist/client-cache-BMxuFqwH.d.ts +18 -0
- package/dist/client-cache-CCK-fCe0.d.mts +18 -0
- package/dist/{client-plugins-BvClItiL.d.mts → client-plugins-B6-07YmP.d.mts} +52 -99
- package/dist/{client-plugins-B9Sq-iMg.d.ts → client-plugins-By6MVUX-.d.ts} +52 -99
- package/dist/client-plugins.cjs +1 -1
- package/dist/client-plugins.d.mts +3 -2
- package/dist/client-plugins.d.ts +3 -2
- package/dist/client-plugins.mjs +2 -2
- package/dist/client.cjs +1046 -211
- package/dist/client.d.mts +136 -18
- package/dist/client.d.ts +136 -18
- package/dist/client.mjs +32 -15
- package/dist/config.d.mts +3 -2
- package/dist/config.d.ts +3 -2
- package/dist/{devtools-S52RRRMN.mjs → devtools-XWZX6CCL.mjs} +5 -5
- package/dist/{devtools-client-3XRTBND5.mjs → devtools-client-Z7QQA3Q2.mjs} +56 -17
- package/dist/devtools-client-Z7QQA3Q2.mjs.map +1 -0
- package/dist/{devtools-ui-NJKFORTG.mjs → devtools-ui-2HG5M4EL.mjs} +3 -1
- package/dist/devtools-ui-2HG5M4EL.mjs.map +1 -0
- package/dist/docs.cjs +24 -5
- package/dist/docs.mjs +5 -5
- package/dist/i18n/server.cjs +13 -2
- package/dist/i18n/server.d.mts +2 -2
- package/dist/i18n/server.d.ts +2 -2
- package/dist/i18n/server.mjs +1 -1
- package/dist/index.cjs +1928 -894
- package/dist/index.d.mts +139 -21
- package/dist/index.d.ts +139 -21
- package/dist/index.mjs +57 -34
- package/dist/index.mjs.map +1 -1
- package/dist/integration-api-BT024nuJ.d.mts +97 -0
- package/dist/integration-api-BT024nuJ.d.ts +97 -0
- package/dist/integrations.d.mts +3 -2
- package/dist/integrations.d.ts +3 -2
- package/dist/internal/build-runtime.cjs +764 -547
- package/dist/internal/build-runtime.d.mts +5 -4
- package/dist/internal/build-runtime.d.ts +5 -4
- package/dist/internal/build-runtime.mjs +16 -16
- package/dist/internal/client-runtime.cjs +1 -1
- package/dist/internal/client-runtime.mjs +2 -2
- package/dist/internal/config-runtime.cjs +4 -1
- package/dist/internal/config-runtime.d.mts +4 -3
- package/dist/internal/config-runtime.d.ts +4 -3
- package/dist/internal/config-runtime.mjs +4 -4
- package/dist/internal/product-telemetry-runtime.cjs +1 -1
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +29 -3
- package/dist/internal/production-runtime.d.mts +8 -7
- package/dist/internal/production-runtime.d.ts +8 -7
- package/dist/internal/production-runtime.mjs +5 -5
- package/dist/{metadata-route-yV4U6X8h.d.ts → metadata-route-8_V3UonT.d.ts} +1 -1
- package/dist/{metadata-route-p4K1l92V.d.mts → metadata-route-CWP_HjGU.d.mts} +1 -1
- package/dist/middleware.cjs +28 -2
- package/dist/middleware.d.mts +5 -4
- package/dist/middleware.d.ts +5 -4
- package/dist/middleware.mjs +4 -4
- package/dist/navigation.cjs +3 -1
- package/dist/navigation.mjs +3 -3
- package/dist/observability.cjs +27 -2
- package/dist/observability.mjs +1 -1
- package/dist/plugin.cjs +528 -349
- package/dist/plugin.d.mts +3 -2
- package/dist/plugin.d.ts +3 -2
- package/dist/plugin.mjs +13 -13
- package/dist/{production-runtime-IkB0Qj4i.d.mts → production-runtime-BGRH1dKG.d.mts} +1 -1
- package/dist/{production-runtime-0JTch4_d.d.ts → production-runtime-CdmzsDax.d.ts} +1 -1
- package/dist/query/client.cjs +68 -29
- package/dist/query/client.mjs +69 -30
- package/dist/query/client.mjs.map +1 -1
- package/dist/{render-plan-Dc8CjNI7.d.ts → render-plan-0GeHiGVZ.d.ts} +1 -1
- package/dist/{render-plan-CU31j-Jk.d.mts → render-plan-DLxJYAA5.d.mts} +1 -1
- package/dist/renderer-client.cjs +169 -26
- package/dist/renderer-client.d.mts +7 -6
- package/dist/renderer-client.d.ts +7 -6
- package/dist/renderer-client.mjs +16 -19
- package/dist/renderer-client.mjs.map +1 -1
- package/dist/{request-BXa1KY8i.d.mts → request-BCNXSXLh.d.mts} +1 -1
- package/dist/{request-CUUBujZt.d.ts → request-BstWbZ6O.d.ts} +1 -1
- package/dist/request.d.mts +4 -3
- package/dist/request.d.ts +4 -3
- package/dist/{route-Y8lfz1wF.d.ts → route-4pd-EVtw.d.ts} +45 -50
- package/dist/{route-Cq3aObmj.d.mts → route-CvEr4Uc9.d.mts} +45 -50
- package/dist/routes.cjs +27 -2
- package/dist/routes.d.mts +3 -2
- package/dist/routes.d.ts +3 -2
- package/dist/routes.mjs +4 -4
- package/dist/{runtime-j1S3sDTh.d.ts → runtime-BgDQzBiu.d.ts} +1 -0
- package/dist/{runtime-DDwvDtS4.d.mts → runtime-CV2UCV-5.d.mts} +1 -0
- package/dist/server-action-security.mjs +2 -2
- package/dist/server-fn-client.cjs +102 -26
- package/dist/server-fn-client.d.mts +6 -0
- package/dist/server-fn-client.d.ts +6 -0
- package/dist/server-fn-client.mjs +2 -1
- package/dist/server-fn.cjs +42 -4
- package/dist/server-fn.mjs +5 -5
- package/dist/server-plugins.d.mts +4 -3
- package/dist/server-plugins.d.ts +4 -3
- package/dist/server-query-client.cjs +195 -34
- package/dist/server-query-client.d.mts +3 -3
- package/dist/server-query-client.d.ts +3 -3
- package/dist/server-query-client.mjs +7 -7
- package/dist/{server-query-runtime-3zAj77yv.d.ts → server-query-runtime-DXRNhX_3.d.ts} +2 -0
- package/dist/{server-query-runtime-B50KAcj5.d.mts → server-query-runtime-aP52iuL5.d.mts} +2 -0
- package/dist/server-query.cjs +44 -5
- package/dist/server-query.d.mts +4 -0
- package/dist/server-query.d.ts +4 -0
- package/dist/server-query.mjs +7 -7
- package/dist/server.cjs +553 -370
- package/dist/server.d.mts +11 -10
- package/dist/server.d.ts +11 -10
- package/dist/server.mjs +17 -17
- package/dist/{spa-router-CyLkwst6.d.mts → spa-router-BeyAVSc6.d.mts} +1 -1
- package/dist/{spa-router-BkqGXaV_.d.ts → spa-router-COgu4txb.d.ts} +1 -1
- package/dist/testing.cjs +27 -2
- package/dist/testing.d.mts +3 -2
- package/dist/testing.d.ts +3 -2
- package/dist/testing.mjs +9 -9
- package/dist/{utils-NKR6SoNv.d.mts → utils-DL2VwDQl.d.mts} +1 -1
- package/dist/{utils-B2OHrb9F.d.ts → utils-DkU2c_1B.d.ts} +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +536 -353
- package/dist/vite.d.mts +3 -2
- package/dist/vite.d.ts +3 -2
- package/dist/vite.mjs +17 -13
- package/package.json +17 -17
- package/types/client.d.ts +115 -10
- package/dist/agent-runtime.cjs.map +0 -1
- package/dist/api/route-manager.cjs.map +0 -1
- package/dist/api/runtime.cjs.map +0 -1
- package/dist/api.cjs.map +0 -1
- package/dist/app-markdown.cjs.map +0 -1
- package/dist/cache.cjs.map +0 -1
- package/dist/chunk-75CGAL6E.mjs.map +0 -1
- package/dist/chunk-7MABZJIM.mjs.map +0 -1
- package/dist/chunk-A3636IHN.mjs.map +0 -1
- package/dist/chunk-AXVJCMVF.mjs.map +0 -1
- package/dist/chunk-D7QH7MDU.mjs.map +0 -1
- package/dist/chunk-DLBUAJTK.mjs.map +0 -1
- package/dist/chunk-EXCGBERG.mjs.map +0 -1
- package/dist/chunk-FLHLPB57.mjs.map +0 -1
- package/dist/chunk-HHZAOTQD.mjs.map +0 -1
- package/dist/chunk-KOTSX5JH.mjs.map +0 -1
- package/dist/chunk-KWCNQUH5.mjs.map +0 -1
- package/dist/chunk-MRVJCLYQ.mjs.map +0 -1
- package/dist/chunk-Q7GPJZCO.mjs.map +0 -1
- package/dist/chunk-RBRLLZL5.mjs.map +0 -1
- package/dist/chunk-SALMKQXH.mjs.map +0 -1
- package/dist/chunk-SCFX4UTD.mjs.map +0 -1
- package/dist/chunk-WB75GIX2.mjs.map +0 -1
- package/dist/chunk-XTLLHCWU.mjs.map +0 -1
- package/dist/chunk-ZFNK77WN.mjs.map +0 -1
- package/dist/chunk-ZRBCBOEX.mjs.map +0 -1
- package/dist/client/lifecycle.cjs.map +0 -1
- package/dist/client-cache-CopR_MaI.d.mts +0 -6
- package/dist/client-cache-Djy_TlE8.d.ts +0 -6
- package/dist/client-plugins.cjs.map +0 -1
- package/dist/client.cjs.map +0 -1
- package/dist/config.cjs.map +0 -1
- package/dist/cron.cjs.map +0 -1
- package/dist/deferred.cjs.map +0 -1
- package/dist/deployment.cjs.map +0 -1
- package/dist/devtools-client-3XRTBND5.mjs.map +0 -1
- package/dist/devtools-ui-NJKFORTG.mjs.map +0 -1
- package/dist/docs.cjs.map +0 -1
- package/dist/env-types.cjs.map +0 -1
- package/dist/env.cjs.map +0 -1
- package/dist/environment/vite.cjs.map +0 -1
- package/dist/environment.cjs.map +0 -1
- package/dist/font.cjs.map +0 -1
- package/dist/headers.cjs.map +0 -1
- package/dist/i18n/client.cjs.map +0 -1
- package/dist/i18n/index.cjs.map +0 -1
- package/dist/i18n/server.cjs.map +0 -1
- package/dist/image/server.cjs.map +0 -1
- package/dist/image/sharp.cjs.map +0 -1
- package/dist/image.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/instrumentation.cjs.map +0 -1
- package/dist/integrations.cjs.map +0 -1
- package/dist/internal/build-runtime.cjs.map +0 -1
- package/dist/internal/client-runtime.cjs.map +0 -1
- package/dist/internal/config-runtime.cjs.map +0 -1
- package/dist/internal/isolated-boundary.cjs.map +0 -1
- package/dist/internal/metadata-image-runtime.cjs.map +0 -1
- package/dist/internal/product-telemetry-runtime.cjs.map +0 -1
- package/dist/internal/production-node-env.cjs.map +0 -1
- package/dist/internal/production-runtime.cjs.map +0 -1
- package/dist/markdown.cjs.map +0 -1
- package/dist/middleware.cjs.map +0 -1
- package/dist/navigation.cjs.map +0 -1
- package/dist/observability.cjs.map +0 -1
- package/dist/plugin.cjs.map +0 -1
- package/dist/query/client.cjs.map +0 -1
- package/dist/query/index.cjs.map +0 -1
- package/dist/query/parsers.cjs.map +0 -1
- package/dist/query/server.cjs.map +0 -1
- package/dist/renderer/react/client.cjs.map +0 -1
- package/dist/renderer/react/server.cjs.map +0 -1
- package/dist/renderer/react/vite.cjs.map +0 -1
- package/dist/renderer-client.cjs.map +0 -1
- package/dist/renderer.cjs.map +0 -1
- package/dist/request.cjs.map +0 -1
- package/dist/router.cjs.map +0 -1
- package/dist/routes.cjs.map +0 -1
- package/dist/server-action-security.cjs.map +0 -1
- package/dist/server-fn-client.cjs.map +0 -1
- package/dist/server-fn.cjs.map +0 -1
- package/dist/server-plugins.cjs.map +0 -1
- package/dist/server-query-client.cjs.map +0 -1
- package/dist/server-query.cjs.map +0 -1
- package/dist/server.cjs.map +0 -1
- package/dist/storage.cjs.map +0 -1
- package/dist/testing.cjs.map +0 -1
- package/dist/theme/client.cjs.map +0 -1
- package/dist/theme/index.cjs.map +0 -1
- package/dist/theme/runtime.cjs.map +0 -1
- package/dist/theme/server.cjs.map +0 -1
- package/dist/version.cjs.map +0 -1
- package/dist/vite.cjs.map +0 -1
- package/dist/workflows.cjs.map +0 -1
- /package/dist/{chunk-VV24CC42.mjs.map → chunk-35NPLKQJ.mjs.map} +0 -0
- /package/dist/{chunk-RWYRFCLG.mjs.map → chunk-4X57GXQA.mjs.map} +0 -0
- /package/dist/{chunk-MOW47IF5.mjs.map → chunk-6UYVU46O.mjs.map} +0 -0
- /package/dist/{chunk-RLGUZ3HS.mjs.map → chunk-I3OOUWO5.mjs.map} +0 -0
- /package/dist/{chunk-2LS3KKE7.mjs.map → chunk-JV7JUD7Q.mjs.map} +0 -0
- /package/dist/{chunk-Q3OX763A.mjs.map → chunk-LXDASSTE.mjs.map} +0 -0
- /package/dist/{chunk-HVG3HLQZ.mjs.map → chunk-Q7WGOOAI.mjs.map} +0 -0
- /package/dist/{chunk-3INDBMUU.mjs.map → chunk-TGDIACZT.mjs.map} +0 -0
- /package/dist/{chunk-MH27UH72.mjs.map → chunk-TT3E2JOF.mjs.map} +0 -0
- /package/dist/{chunk-UWRGX3J3.mjs.map → chunk-UMUWR5XA.mjs.map} +0 -0
- /package/dist/{devtools-S52RRRMN.mjs.map → devtools-XWZX6CCL.mjs.map} +0 -0
package/dist/plugin.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { Z as PluginRoutes, P as PluginRoutesFactory, W as RouteDefinition } from './route-
|
|
2
|
-
export {
|
|
1
|
+
export { Z as PluginRoutes, P as PluginRoutesFactory, W as RouteDefinition } from './route-CvEr4Uc9.mjs';
|
|
2
|
+
export { bq as APIHandlerLifecyclePayload, bm as APIRouteDiscoveredPayload, bt as BundleLifecyclePayload, B as BundleResultPayload, br as ErrorLifecyclePayload, e4 as FARM_NODE_RESPONSE_END_PENDING, a as FarmPlugin, bg as FarmPluginBuildHooks, bi as FarmPluginClientConfig, aV as FarmPluginContext, bh as FarmPluginDevHooks, bd as FarmPluginDiscoveredRoute, aW as FarmPluginIntegrationContext, aX as FarmPluginLifecycle, bf as FarmPluginRenderHooks, a$ as FarmPluginRouteRuntimePayload, be as FarmPluginRouterHooks, b5 as FarmPluginRuntimeAfterEvent, b2 as FarmPluginRuntimeBaseEvent, b4 as FarmPluginRuntimeBeforeEvent, b8 as FarmPluginRuntimeCloseEvent, b3 as FarmPluginRuntimeContextEvent, b6 as FarmPluginRuntimeErrorEvent, b9 as FarmPluginRuntimeHooks, a_ as FarmPluginRuntimeKind, bb as FarmPluginRuntimeRequestHandler, ba as FarmPluginRuntimeRequestOptions, bc as FarmPluginRuntimeSession, b7 as FarmPluginRuntimeStartEvent, b0 as FarmPluginSetupContext, b1 as FarmPluginStateContext, aY as FarmRequestPluginContext, aZ as FarmRequestStore, au as FarmRuntimeShutdownError, bs as HMRUpdatePayload, bl as MiddlewareDiscoveredPayload, bu as NitroBuildLifecyclePayload, av as PluginManager, aU as PluginRequestContext, bp as RenderLifecyclePayload, bj as RouteDiscoveredPayload, bn as RouteMatchPayload, bo as RouteMatchResultPayload, bk as RoutesGeneratedPayload, bv as ShutdownPayload, at as definePlugin, s as farmPlugin } from './client-plugins-B6-07YmP.mjs';
|
|
3
3
|
import 'vite';
|
|
4
4
|
import './lifecycle-De0vQG45.mjs';
|
|
5
5
|
import './env.mjs';
|
|
@@ -10,6 +10,7 @@ import './types-Cc8l9IqS.mjs';
|
|
|
10
10
|
import 'db0';
|
|
11
11
|
import 'unstorage';
|
|
12
12
|
import 'react';
|
|
13
|
+
import './integration-api-BT024nuJ.mjs';
|
|
13
14
|
import '@farming-labs/orm';
|
|
14
15
|
import './types-CKwggz9n.mjs';
|
|
15
16
|
import '@farming-labs/docs';
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { Z as PluginRoutes, P as PluginRoutesFactory, W as RouteDefinition } from './route-
|
|
2
|
-
export {
|
|
1
|
+
export { Z as PluginRoutes, P as PluginRoutesFactory, W as RouteDefinition } from './route-4pd-EVtw.js';
|
|
2
|
+
export { bq as APIHandlerLifecyclePayload, bm as APIRouteDiscoveredPayload, bt as BundleLifecyclePayload, B as BundleResultPayload, br as ErrorLifecyclePayload, e4 as FARM_NODE_RESPONSE_END_PENDING, a as FarmPlugin, bg as FarmPluginBuildHooks, bi as FarmPluginClientConfig, aV as FarmPluginContext, bh as FarmPluginDevHooks, bd as FarmPluginDiscoveredRoute, aW as FarmPluginIntegrationContext, aX as FarmPluginLifecycle, bf as FarmPluginRenderHooks, a$ as FarmPluginRouteRuntimePayload, be as FarmPluginRouterHooks, b5 as FarmPluginRuntimeAfterEvent, b2 as FarmPluginRuntimeBaseEvent, b4 as FarmPluginRuntimeBeforeEvent, b8 as FarmPluginRuntimeCloseEvent, b3 as FarmPluginRuntimeContextEvent, b6 as FarmPluginRuntimeErrorEvent, b9 as FarmPluginRuntimeHooks, a_ as FarmPluginRuntimeKind, bb as FarmPluginRuntimeRequestHandler, ba as FarmPluginRuntimeRequestOptions, bc as FarmPluginRuntimeSession, b7 as FarmPluginRuntimeStartEvent, b0 as FarmPluginSetupContext, b1 as FarmPluginStateContext, aY as FarmRequestPluginContext, aZ as FarmRequestStore, au as FarmRuntimeShutdownError, bs as HMRUpdatePayload, bl as MiddlewareDiscoveredPayload, bu as NitroBuildLifecyclePayload, av as PluginManager, aU as PluginRequestContext, bp as RenderLifecyclePayload, bj as RouteDiscoveredPayload, bn as RouteMatchPayload, bo as RouteMatchResultPayload, bk as RoutesGeneratedPayload, bv as ShutdownPayload, at as definePlugin, s as farmPlugin } from './client-plugins-By6MVUX-.js';
|
|
3
3
|
import 'vite';
|
|
4
4
|
import './lifecycle-De0vQG45.js';
|
|
5
5
|
import './env.js';
|
|
@@ -10,6 +10,7 @@ import './types-Cc8l9IqS.js';
|
|
|
10
10
|
import 'db0';
|
|
11
11
|
import 'unstorage';
|
|
12
12
|
import 'react';
|
|
13
|
+
import './integration-api-BT024nuJ.js';
|
|
13
14
|
import '@farming-labs/orm';
|
|
14
15
|
import './types-CKwggz9n.js';
|
|
15
16
|
import '@farming-labs/docs';
|
package/dist/plugin.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
PluginManager,
|
|
5
5
|
definePlugin,
|
|
6
6
|
farmPlugin
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FP5Q67FO.mjs";
|
|
8
8
|
import "./chunk-YVPFZ2TK.mjs";
|
|
9
9
|
import "./chunk-KDP5ZSWP.mjs";
|
|
10
10
|
import "./chunk-WQDQCTC5.mjs";
|
|
@@ -16,7 +16,7 @@ import "./chunk-USWZZUEH.mjs";
|
|
|
16
16
|
import "./chunk-USLFXFFH.mjs";
|
|
17
17
|
import "./chunk-CG4GPK3Z.mjs";
|
|
18
18
|
import "./chunk-YKAUAZA4.mjs";
|
|
19
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-7PYVLJ4J.mjs";
|
|
20
20
|
import "./chunk-7T2QYWDH.mjs";
|
|
21
21
|
import "./chunk-5EZRXIFH.mjs";
|
|
22
22
|
import "./chunk-7ZVN3YZI.mjs";
|
|
@@ -27,19 +27,19 @@ import "./chunk-A5VG2BDG.mjs";
|
|
|
27
27
|
import "./chunk-EUYRVVXL.mjs";
|
|
28
28
|
import "./chunk-2SKCXYLB.mjs";
|
|
29
29
|
import "./chunk-BZAIS65C.mjs";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-35NPLKQJ.mjs";
|
|
31
31
|
import "./chunk-N2KC75H7.mjs";
|
|
32
32
|
import "./chunk-H53KVQUU.mjs";
|
|
33
33
|
import "./chunk-QKVUNGAH.mjs";
|
|
34
34
|
import "./chunk-AAC66ILR.mjs";
|
|
35
35
|
import "./chunk-ISSFLGJ5.mjs";
|
|
36
|
-
import "./chunk-
|
|
36
|
+
import "./chunk-4X57GXQA.mjs";
|
|
37
37
|
import "./chunk-IGOLMCE3.mjs";
|
|
38
38
|
import "./chunk-YUE4CJNB.mjs";
|
|
39
|
-
import "./chunk-
|
|
40
|
-
import "./chunk-
|
|
39
|
+
import "./chunk-6JNGOC37.mjs";
|
|
40
|
+
import "./chunk-TT3E2JOF.mjs";
|
|
41
41
|
import "./chunk-NXV52RNX.mjs";
|
|
42
|
-
import "./chunk-
|
|
42
|
+
import "./chunk-TQTB33JS.mjs";
|
|
43
43
|
import "./chunk-STV7A2LH.mjs";
|
|
44
44
|
import "./chunk-XNWHZQ6A.mjs";
|
|
45
45
|
import "./chunk-SXWF4QRU.mjs";
|
|
@@ -48,7 +48,7 @@ import "./chunk-LBRRZEEK.mjs";
|
|
|
48
48
|
import "./chunk-HAG2HEDU.mjs";
|
|
49
49
|
import "./chunk-VFPFBYG5.mjs";
|
|
50
50
|
import "./chunk-35SSRS5K.mjs";
|
|
51
|
-
import "./chunk-
|
|
51
|
+
import "./chunk-3TWQERDE.mjs";
|
|
52
52
|
import "./chunk-4OAR7CTF.mjs";
|
|
53
53
|
import "./chunk-O2IGROSM.mjs";
|
|
54
54
|
import "./chunk-4N7DAFLY.mjs";
|
|
@@ -57,17 +57,17 @@ import "./chunk-RCNUKRBF.mjs";
|
|
|
57
57
|
import "./chunk-GQVQESLY.mjs";
|
|
58
58
|
import "./chunk-HKXMMPYI.mjs";
|
|
59
59
|
import "./chunk-YECMFULZ.mjs";
|
|
60
|
-
import "./chunk-
|
|
60
|
+
import "./chunk-V4VRLVLW.mjs";
|
|
61
61
|
import "./chunk-6YPPIPKR.mjs";
|
|
62
62
|
import "./chunk-776TTMU3.mjs";
|
|
63
63
|
import "./chunk-3BXGOVKE.mjs";
|
|
64
64
|
import "./chunk-4C3Z34O7.mjs";
|
|
65
|
-
import "./chunk-
|
|
66
|
-
import "./chunk-
|
|
65
|
+
import "./chunk-2HDOV47R.mjs";
|
|
66
|
+
import "./chunk-34IAPZBG.mjs";
|
|
67
67
|
import "./chunk-WZ5QFROO.mjs";
|
|
68
|
-
import "./chunk-
|
|
68
|
+
import "./chunk-N2FY2QZ7.mjs";
|
|
69
69
|
import "./chunk-FXG2PS27.mjs";
|
|
70
|
-
import "./chunk-
|
|
70
|
+
import "./chunk-J3MPQ4MQ.mjs";
|
|
71
71
|
import "./chunk-PHN22XB2.mjs";
|
|
72
72
|
import "./chunk-XYTDSPBD.mjs";
|
|
73
73
|
import "./chunk-OMQWEX4N.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ad as ReadonlyMiddlewareStore, ae as FarmMiddlewareConfig, af as MiddlewareModule } from './client-plugins-
|
|
1
|
+
import { ad as ReadonlyMiddlewareStore, ae as FarmMiddlewareConfig, af as MiddlewareModule } from './client-plugins-B6-07YmP.mjs';
|
|
2
2
|
import { R as ResolvedFarmI18nConfig } from './types-CnH8DOqo.mjs';
|
|
3
3
|
import { R as ResolvedFarmServerConfig } from './workflows-ChyK_oTu.mjs';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ad as ReadonlyMiddlewareStore, ae as FarmMiddlewareConfig, af as MiddlewareModule } from './client-plugins-
|
|
1
|
+
import { ad as ReadonlyMiddlewareStore, ae as FarmMiddlewareConfig, af as MiddlewareModule } from './client-plugins-By6MVUX-.js';
|
|
2
2
|
import { R as ResolvedFarmI18nConfig } from './types-CnH8DOqo.js';
|
|
3
3
|
import { R as ResolvedFarmServerConfig } from './workflows-ChyK_oTu.js';
|
|
4
4
|
|
package/dist/query/client.cjs
CHANGED
|
@@ -457,7 +457,14 @@ __name(createParser, "createParser");
|
|
|
457
457
|
|
|
458
458
|
// src/query/client.ts
|
|
459
459
|
var getCurrentSearchParams = /* @__PURE__ */ __name(() => {
|
|
460
|
-
if (typeof window !== "undefined")
|
|
460
|
+
if (typeof window !== "undefined") {
|
|
461
|
+
discardDepartedURLUpdates();
|
|
462
|
+
let params = new URLSearchParams(window.location.search);
|
|
463
|
+
for (const pending of throttleTimers.values()) {
|
|
464
|
+
if (pending.href === window.location.href) params = applyChange(params, pending.updates);
|
|
465
|
+
}
|
|
466
|
+
return params;
|
|
467
|
+
}
|
|
461
468
|
const request = _resolveCurrentRequest();
|
|
462
469
|
if (!request) return new URLSearchParams();
|
|
463
470
|
try {
|
|
@@ -471,10 +478,28 @@ var readSearchParam = /* @__PURE__ */ __name((searchParams, key) => {
|
|
|
471
478
|
return values.length > 1 ? values.join(",") : values[0] ?? "";
|
|
472
479
|
}, "readSearchParam");
|
|
473
480
|
var throttleTimers = /* @__PURE__ */ new Map();
|
|
481
|
+
function discardDepartedURLUpdates() {
|
|
482
|
+
for (const [key, pending] of throttleTimers) {
|
|
483
|
+
if (pending.href === window.location.href) continue;
|
|
484
|
+
clearTimeout(pending.timer);
|
|
485
|
+
throttleTimers.delete(key);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
__name(discardDepartedURLUpdates, "discardDepartedURLUpdates");
|
|
474
489
|
function getUpdateKey(updates) {
|
|
475
490
|
return JSON.stringify(Object.keys(updates).sort());
|
|
476
491
|
}
|
|
477
492
|
__name(getUpdateKey, "getUpdateKey");
|
|
493
|
+
function supersedeQueuedKeys(updates) {
|
|
494
|
+
const keys = Object.keys(updates);
|
|
495
|
+
for (const [queueKey, pending] of throttleTimers) {
|
|
496
|
+
for (const key of keys) delete pending.updates[key];
|
|
497
|
+
if (Object.keys(pending.updates).length > 0) continue;
|
|
498
|
+
clearTimeout(pending.timer);
|
|
499
|
+
throttleTimers.delete(queueKey);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
__name(supersedeQueuedKeys, "supersedeQueuedKeys");
|
|
478
503
|
var compareStructuredValues = /* @__PURE__ */ __name((current, next, seen = /* @__PURE__ */ new WeakMap()) => {
|
|
479
504
|
if (Object.is(current, next)) return true;
|
|
480
505
|
if (current === null || next === null || typeof current !== typeof next) return false;
|
|
@@ -554,8 +579,10 @@ var commitURLUpdate = /* @__PURE__ */ __name((updates, options, emitUpdate) => {
|
|
|
554
579
|
window.history[history](nextHistoryState, "", newUrl);
|
|
555
580
|
}
|
|
556
581
|
if (emitUpdate) {
|
|
557
|
-
const
|
|
558
|
-
|
|
582
|
+
for (const pending of throttleTimers.values()) {
|
|
583
|
+
if (pending.href === url.href) pending.href = window.location.href;
|
|
584
|
+
}
|
|
585
|
+
emitter.emitUpdate(getCurrentSearchParams());
|
|
559
586
|
}
|
|
560
587
|
if (shallow) notifyHistoryChange("url-search");
|
|
561
588
|
if (scroll) {
|
|
@@ -564,31 +591,30 @@ var commitURLUpdate = /* @__PURE__ */ __name((updates, options, emitUpdate) => {
|
|
|
564
591
|
}, "commitURLUpdate");
|
|
565
592
|
var updateURL = /* @__PURE__ */ __name((updates, options = {}, emitUpdate = true) => {
|
|
566
593
|
if (typeof window === "undefined") return;
|
|
594
|
+
discardDepartedURLUpdates();
|
|
567
595
|
const { throttleMs } = options;
|
|
596
|
+
supersedeQueuedKeys(updates);
|
|
568
597
|
if (!throttleMs || throttleMs <= 0) {
|
|
569
598
|
commitURLUpdate(updates, options, emitUpdate);
|
|
570
599
|
return;
|
|
571
600
|
}
|
|
572
601
|
const throttleKey = getUpdateKey(updates);
|
|
573
|
-
const existingTimeout = throttleTimers.get(throttleKey);
|
|
574
|
-
if (existingTimeout) {
|
|
575
|
-
clearTimeout(existingTimeout);
|
|
576
|
-
throttleTimers.delete(throttleKey);
|
|
577
|
-
}
|
|
578
602
|
const currentUrl = new URL(window.location.href);
|
|
579
603
|
const nextSearch = applyChange(currentUrl.searchParams, updates).toString();
|
|
580
604
|
if (nextSearch === currentUrl.searchParams.toString()) return;
|
|
581
605
|
const timeout = setTimeout(() => {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
606
|
+
const pending = throttleTimers.get(throttleKey);
|
|
607
|
+
if (pending?.timer !== timeout) return;
|
|
608
|
+
throttleTimers.delete(throttleKey);
|
|
609
|
+
if (pending.href !== window.location.href) return;
|
|
585
610
|
commitURLUpdate(updates, options, emitUpdate);
|
|
586
611
|
}, throttleMs);
|
|
587
|
-
throttleTimers.set(throttleKey, timeout);
|
|
612
|
+
throttleTimers.set(throttleKey, { timer: timeout, updates, href: currentUrl.href });
|
|
588
613
|
return () => {
|
|
589
|
-
if (throttleTimers.get(throttleKey) !== timeout) return;
|
|
614
|
+
if (throttleTimers.get(throttleKey)?.timer !== timeout) return false;
|
|
590
615
|
clearTimeout(timeout);
|
|
591
616
|
throttleTimers.delete(throttleKey);
|
|
617
|
+
return true;
|
|
592
618
|
};
|
|
593
619
|
}, "updateURL");
|
|
594
620
|
function useQueryState(key, parser, options) {
|
|
@@ -599,21 +625,16 @@ function useQueryState(key, parser, options) {
|
|
|
599
625
|
});
|
|
600
626
|
const stateRef = (0, import_react.useRef)(state);
|
|
601
627
|
const stateKeyRef = (0, import_react.useRef)(key);
|
|
602
|
-
const isInternalUpdateRef = (0, import_react.useRef)(false);
|
|
603
628
|
const cancelPendingUpdateRef = (0, import_react.useRef)(void 0);
|
|
604
629
|
stateRef.current = state;
|
|
605
630
|
const setValue = (0, import_react.useCallback)(
|
|
606
631
|
(value) => {
|
|
607
|
-
isInternalUpdateRef.current = true;
|
|
608
632
|
setState(value);
|
|
609
633
|
stateRef.current = value;
|
|
610
634
|
const serialized = value === null ? null : parser.serialize(value);
|
|
611
|
-
emitter.emitKey(key, { state: value, query: serialized });
|
|
635
|
+
emitter.emitKey(key, { state: value, query: serialized, source: stateRef });
|
|
612
636
|
cancelPendingUpdateRef.current?.();
|
|
613
637
|
cancelPendingUpdateRef.current = updateURL({ [key]: serialized }, options, true);
|
|
614
|
-
setTimeout(() => {
|
|
615
|
-
isInternalUpdateRef.current = false;
|
|
616
|
-
}, 10);
|
|
617
638
|
},
|
|
618
639
|
[key, parser, options]
|
|
619
640
|
);
|
|
@@ -630,9 +651,6 @@ function useQueryState(key, parser, options) {
|
|
|
630
651
|
}
|
|
631
652
|
}, "onPopState");
|
|
632
653
|
const onEmitterUpdate = /* @__PURE__ */ __name((searchParams) => {
|
|
633
|
-
if (isInternalUpdateRef.current) {
|
|
634
|
-
return;
|
|
635
|
-
}
|
|
636
654
|
const parsed = parser.parse(readSearchParam(searchParams, key));
|
|
637
655
|
if (!areParsedValuesEqual(parser, stateRef.current, parsed)) {
|
|
638
656
|
setState(parsed);
|
|
@@ -640,12 +658,13 @@ function useQueryState(key, parser, options) {
|
|
|
640
658
|
}
|
|
641
659
|
}, "onEmitterUpdate");
|
|
642
660
|
const onKeyUpdate = /* @__PURE__ */ __name((payload) => {
|
|
643
|
-
if (
|
|
661
|
+
if (payload.source === stateRef) {
|
|
644
662
|
return;
|
|
645
663
|
}
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
664
|
+
const parsed = parser.parse(payload.query ?? "");
|
|
665
|
+
if (!areParsedValuesEqual(parser, stateRef.current, parsed)) {
|
|
666
|
+
setState(parsed);
|
|
667
|
+
stateRef.current = parsed;
|
|
649
668
|
}
|
|
650
669
|
}, "onKeyUpdate");
|
|
651
670
|
onPopState();
|
|
@@ -660,8 +679,11 @@ function useQueryState(key, parser, options) {
|
|
|
660
679
|
}, [key, parser]);
|
|
661
680
|
(0, import_react.useEffect)(
|
|
662
681
|
() => () => {
|
|
663
|
-
cancelPendingUpdateRef.current?.();
|
|
682
|
+
const canceledPendingWrite = cancelPendingUpdateRef.current?.() ?? false;
|
|
664
683
|
cancelPendingUpdateRef.current = void 0;
|
|
684
|
+
if (canceledPendingWrite && typeof window !== "undefined") {
|
|
685
|
+
emitter.emitUpdate(getCurrentSearchParams());
|
|
686
|
+
}
|
|
665
687
|
},
|
|
666
688
|
[key]
|
|
667
689
|
);
|
|
@@ -691,7 +713,7 @@ function useQueryStates(parsers, options = {}) {
|
|
|
691
713
|
const parser = parsers[key];
|
|
692
714
|
if (parser) {
|
|
693
715
|
const serialized = value === null ? null : parser.serialize(value);
|
|
694
|
-
emitter.emitKey(key, { state: value, query: serialized });
|
|
716
|
+
emitter.emitKey(key, { state: value, query: serialized, source: stateRef });
|
|
695
717
|
}
|
|
696
718
|
});
|
|
697
719
|
const urlUpdates = {};
|
|
@@ -742,17 +764,34 @@ function useQueryStates(parsers, options = {}) {
|
|
|
742
764
|
applyChange2(getCurrentSearchParams());
|
|
743
765
|
const unsubscribeHistory = subscribeHistoryChange(onPopState);
|
|
744
766
|
emitter.on("update", onEmitterUpdate);
|
|
767
|
+
const unsubscribeKeys = Object.entries(parsers).map(([key, parser]) => {
|
|
768
|
+
const onKeyUpdate = /* @__PURE__ */ __name((payload) => {
|
|
769
|
+
if (payload.source === stateRef) return;
|
|
770
|
+
const parsed = parser.parse(payload.query ?? "");
|
|
771
|
+
if (areParsedValuesEqual(parser, stateRef.current[key], parsed)) return;
|
|
772
|
+
const next = { ...stateRef.current, [key]: parsed };
|
|
773
|
+
stateRef.current = next;
|
|
774
|
+
setState(next);
|
|
775
|
+
}, "onKeyUpdate");
|
|
776
|
+
emitter.onKey(key, onKeyUpdate);
|
|
777
|
+
return () => emitter.offKey(key, onKeyUpdate);
|
|
778
|
+
});
|
|
745
779
|
return () => {
|
|
746
780
|
unsubscribeHistory();
|
|
747
781
|
emitter.off("update", onEmitterUpdate);
|
|
782
|
+
for (const unsubscribe of unsubscribeKeys) unsubscribe();
|
|
748
783
|
};
|
|
749
784
|
}, [watchKeys, parsers]);
|
|
750
785
|
(0, import_react.useEffect)(
|
|
751
786
|
() => () => {
|
|
787
|
+
let canceledPendingWrite = false;
|
|
752
788
|
for (const cancelPendingUpdate of pendingUpdatesRef.current.values()) {
|
|
753
|
-
cancelPendingUpdate();
|
|
789
|
+
if (cancelPendingUpdate()) canceledPendingWrite = true;
|
|
754
790
|
}
|
|
755
791
|
pendingUpdatesRef.current.clear();
|
|
792
|
+
if (canceledPendingWrite && typeof window !== "undefined") {
|
|
793
|
+
emitter.emitUpdate(getCurrentSearchParams());
|
|
794
|
+
}
|
|
756
795
|
},
|
|
757
796
|
[watchKeys]
|
|
758
797
|
);
|
package/dist/query/client.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
notifyHistoryChange,
|
|
18
18
|
subscribeHistoryChange,
|
|
19
19
|
writeFarmURLSearchHistory
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-PSQ7N4XP.mjs";
|
|
21
21
|
import "../chunk-ULD4ENAH.mjs";
|
|
22
22
|
import "../chunk-JIT7GXDP.mjs";
|
|
23
23
|
import "../chunk-3BXGOVKE.mjs";
|
|
@@ -98,7 +98,14 @@ var emitter = new Emitter();
|
|
|
98
98
|
|
|
99
99
|
// src/query/client.ts
|
|
100
100
|
var getCurrentSearchParams = /* @__PURE__ */ __name(() => {
|
|
101
|
-
if (typeof window !== "undefined")
|
|
101
|
+
if (typeof window !== "undefined") {
|
|
102
|
+
discardDepartedURLUpdates();
|
|
103
|
+
let params = new URLSearchParams(window.location.search);
|
|
104
|
+
for (const pending of throttleTimers.values()) {
|
|
105
|
+
if (pending.href === window.location.href) params = applyChange(params, pending.updates);
|
|
106
|
+
}
|
|
107
|
+
return params;
|
|
108
|
+
}
|
|
102
109
|
const request = _resolveCurrentRequest();
|
|
103
110
|
if (!request) return new URLSearchParams();
|
|
104
111
|
try {
|
|
@@ -112,10 +119,28 @@ var readSearchParam = /* @__PURE__ */ __name((searchParams, key) => {
|
|
|
112
119
|
return values.length > 1 ? values.join(",") : values[0] ?? "";
|
|
113
120
|
}, "readSearchParam");
|
|
114
121
|
var throttleTimers = /* @__PURE__ */ new Map();
|
|
122
|
+
function discardDepartedURLUpdates() {
|
|
123
|
+
for (const [key, pending] of throttleTimers) {
|
|
124
|
+
if (pending.href === window.location.href) continue;
|
|
125
|
+
clearTimeout(pending.timer);
|
|
126
|
+
throttleTimers.delete(key);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
__name(discardDepartedURLUpdates, "discardDepartedURLUpdates");
|
|
115
130
|
function getUpdateKey(updates) {
|
|
116
131
|
return JSON.stringify(Object.keys(updates).sort());
|
|
117
132
|
}
|
|
118
133
|
__name(getUpdateKey, "getUpdateKey");
|
|
134
|
+
function supersedeQueuedKeys(updates) {
|
|
135
|
+
const keys = Object.keys(updates);
|
|
136
|
+
for (const [queueKey, pending] of throttleTimers) {
|
|
137
|
+
for (const key of keys) delete pending.updates[key];
|
|
138
|
+
if (Object.keys(pending.updates).length > 0) continue;
|
|
139
|
+
clearTimeout(pending.timer);
|
|
140
|
+
throttleTimers.delete(queueKey);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
__name(supersedeQueuedKeys, "supersedeQueuedKeys");
|
|
119
144
|
var compareStructuredValues = /* @__PURE__ */ __name((current, next, seen = /* @__PURE__ */ new WeakMap()) => {
|
|
120
145
|
if (Object.is(current, next)) return true;
|
|
121
146
|
if (current === null || next === null || typeof current !== typeof next) return false;
|
|
@@ -195,8 +220,10 @@ var commitURLUpdate = /* @__PURE__ */ __name((updates, options, emitUpdate) => {
|
|
|
195
220
|
window.history[history](nextHistoryState, "", newUrl);
|
|
196
221
|
}
|
|
197
222
|
if (emitUpdate) {
|
|
198
|
-
const
|
|
199
|
-
|
|
223
|
+
for (const pending of throttleTimers.values()) {
|
|
224
|
+
if (pending.href === url.href) pending.href = window.location.href;
|
|
225
|
+
}
|
|
226
|
+
emitter.emitUpdate(getCurrentSearchParams());
|
|
200
227
|
}
|
|
201
228
|
if (shallow) notifyHistoryChange("url-search");
|
|
202
229
|
if (scroll) {
|
|
@@ -205,31 +232,30 @@ var commitURLUpdate = /* @__PURE__ */ __name((updates, options, emitUpdate) => {
|
|
|
205
232
|
}, "commitURLUpdate");
|
|
206
233
|
var updateURL = /* @__PURE__ */ __name((updates, options = {}, emitUpdate = true) => {
|
|
207
234
|
if (typeof window === "undefined") return;
|
|
235
|
+
discardDepartedURLUpdates();
|
|
208
236
|
const { throttleMs } = options;
|
|
237
|
+
supersedeQueuedKeys(updates);
|
|
209
238
|
if (!throttleMs || throttleMs <= 0) {
|
|
210
239
|
commitURLUpdate(updates, options, emitUpdate);
|
|
211
240
|
return;
|
|
212
241
|
}
|
|
213
242
|
const throttleKey = getUpdateKey(updates);
|
|
214
|
-
const existingTimeout = throttleTimers.get(throttleKey);
|
|
215
|
-
if (existingTimeout) {
|
|
216
|
-
clearTimeout(existingTimeout);
|
|
217
|
-
throttleTimers.delete(throttleKey);
|
|
218
|
-
}
|
|
219
243
|
const currentUrl = new URL(window.location.href);
|
|
220
244
|
const nextSearch = applyChange(currentUrl.searchParams, updates).toString();
|
|
221
245
|
if (nextSearch === currentUrl.searchParams.toString()) return;
|
|
222
246
|
const timeout = setTimeout(() => {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
247
|
+
const pending = throttleTimers.get(throttleKey);
|
|
248
|
+
if (pending?.timer !== timeout) return;
|
|
249
|
+
throttleTimers.delete(throttleKey);
|
|
250
|
+
if (pending.href !== window.location.href) return;
|
|
226
251
|
commitURLUpdate(updates, options, emitUpdate);
|
|
227
252
|
}, throttleMs);
|
|
228
|
-
throttleTimers.set(throttleKey, timeout);
|
|
253
|
+
throttleTimers.set(throttleKey, { timer: timeout, updates, href: currentUrl.href });
|
|
229
254
|
return () => {
|
|
230
|
-
if (throttleTimers.get(throttleKey) !== timeout) return;
|
|
255
|
+
if (throttleTimers.get(throttleKey)?.timer !== timeout) return false;
|
|
231
256
|
clearTimeout(timeout);
|
|
232
257
|
throttleTimers.delete(throttleKey);
|
|
258
|
+
return true;
|
|
233
259
|
};
|
|
234
260
|
}, "updateURL");
|
|
235
261
|
function useQueryState(key, parser, options) {
|
|
@@ -240,21 +266,16 @@ function useQueryState(key, parser, options) {
|
|
|
240
266
|
});
|
|
241
267
|
const stateRef = useRef(state);
|
|
242
268
|
const stateKeyRef = useRef(key);
|
|
243
|
-
const isInternalUpdateRef = useRef(false);
|
|
244
269
|
const cancelPendingUpdateRef = useRef(void 0);
|
|
245
270
|
stateRef.current = state;
|
|
246
271
|
const setValue = useCallback(
|
|
247
272
|
(value) => {
|
|
248
|
-
isInternalUpdateRef.current = true;
|
|
249
273
|
setState(value);
|
|
250
274
|
stateRef.current = value;
|
|
251
275
|
const serialized = value === null ? null : parser.serialize(value);
|
|
252
|
-
emitter.emitKey(key, { state: value, query: serialized });
|
|
276
|
+
emitter.emitKey(key, { state: value, query: serialized, source: stateRef });
|
|
253
277
|
cancelPendingUpdateRef.current?.();
|
|
254
278
|
cancelPendingUpdateRef.current = updateURL({ [key]: serialized }, options, true);
|
|
255
|
-
setTimeout(() => {
|
|
256
|
-
isInternalUpdateRef.current = false;
|
|
257
|
-
}, 10);
|
|
258
279
|
},
|
|
259
280
|
[key, parser, options]
|
|
260
281
|
);
|
|
@@ -271,9 +292,6 @@ function useQueryState(key, parser, options) {
|
|
|
271
292
|
}
|
|
272
293
|
}, "onPopState");
|
|
273
294
|
const onEmitterUpdate = /* @__PURE__ */ __name((searchParams) => {
|
|
274
|
-
if (isInternalUpdateRef.current) {
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
295
|
const parsed = parser.parse(readSearchParam(searchParams, key));
|
|
278
296
|
if (!areParsedValuesEqual(parser, stateRef.current, parsed)) {
|
|
279
297
|
setState(parsed);
|
|
@@ -281,12 +299,13 @@ function useQueryState(key, parser, options) {
|
|
|
281
299
|
}
|
|
282
300
|
}, "onEmitterUpdate");
|
|
283
301
|
const onKeyUpdate = /* @__PURE__ */ __name((payload) => {
|
|
284
|
-
if (
|
|
302
|
+
if (payload.source === stateRef) {
|
|
285
303
|
return;
|
|
286
304
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
305
|
+
const parsed = parser.parse(payload.query ?? "");
|
|
306
|
+
if (!areParsedValuesEqual(parser, stateRef.current, parsed)) {
|
|
307
|
+
setState(parsed);
|
|
308
|
+
stateRef.current = parsed;
|
|
290
309
|
}
|
|
291
310
|
}, "onKeyUpdate");
|
|
292
311
|
onPopState();
|
|
@@ -301,8 +320,11 @@ function useQueryState(key, parser, options) {
|
|
|
301
320
|
}, [key, parser]);
|
|
302
321
|
useEffect(
|
|
303
322
|
() => () => {
|
|
304
|
-
cancelPendingUpdateRef.current?.();
|
|
323
|
+
const canceledPendingWrite = cancelPendingUpdateRef.current?.() ?? false;
|
|
305
324
|
cancelPendingUpdateRef.current = void 0;
|
|
325
|
+
if (canceledPendingWrite && typeof window !== "undefined") {
|
|
326
|
+
emitter.emitUpdate(getCurrentSearchParams());
|
|
327
|
+
}
|
|
306
328
|
},
|
|
307
329
|
[key]
|
|
308
330
|
);
|
|
@@ -332,7 +354,7 @@ function useQueryStates(parsers, options = {}) {
|
|
|
332
354
|
const parser = parsers[key];
|
|
333
355
|
if (parser) {
|
|
334
356
|
const serialized = value === null ? null : parser.serialize(value);
|
|
335
|
-
emitter.emitKey(key, { state: value, query: serialized });
|
|
357
|
+
emitter.emitKey(key, { state: value, query: serialized, source: stateRef });
|
|
336
358
|
}
|
|
337
359
|
});
|
|
338
360
|
const urlUpdates = {};
|
|
@@ -383,17 +405,34 @@ function useQueryStates(parsers, options = {}) {
|
|
|
383
405
|
applyChange2(getCurrentSearchParams());
|
|
384
406
|
const unsubscribeHistory = subscribeHistoryChange(onPopState);
|
|
385
407
|
emitter.on("update", onEmitterUpdate);
|
|
408
|
+
const unsubscribeKeys = Object.entries(parsers).map(([key, parser]) => {
|
|
409
|
+
const onKeyUpdate = /* @__PURE__ */ __name((payload) => {
|
|
410
|
+
if (payload.source === stateRef) return;
|
|
411
|
+
const parsed = parser.parse(payload.query ?? "");
|
|
412
|
+
if (areParsedValuesEqual(parser, stateRef.current[key], parsed)) return;
|
|
413
|
+
const next = { ...stateRef.current, [key]: parsed };
|
|
414
|
+
stateRef.current = next;
|
|
415
|
+
setState(next);
|
|
416
|
+
}, "onKeyUpdate");
|
|
417
|
+
emitter.onKey(key, onKeyUpdate);
|
|
418
|
+
return () => emitter.offKey(key, onKeyUpdate);
|
|
419
|
+
});
|
|
386
420
|
return () => {
|
|
387
421
|
unsubscribeHistory();
|
|
388
422
|
emitter.off("update", onEmitterUpdate);
|
|
423
|
+
for (const unsubscribe of unsubscribeKeys) unsubscribe();
|
|
389
424
|
};
|
|
390
425
|
}, [watchKeys, parsers]);
|
|
391
426
|
useEffect(
|
|
392
427
|
() => () => {
|
|
428
|
+
let canceledPendingWrite = false;
|
|
393
429
|
for (const cancelPendingUpdate of pendingUpdatesRef.current.values()) {
|
|
394
|
-
cancelPendingUpdate();
|
|
430
|
+
if (cancelPendingUpdate()) canceledPendingWrite = true;
|
|
395
431
|
}
|
|
396
432
|
pendingUpdatesRef.current.clear();
|
|
433
|
+
if (canceledPendingWrite && typeof window !== "undefined") {
|
|
434
|
+
emitter.emitUpdate(getCurrentSearchParams());
|
|
435
|
+
}
|
|
397
436
|
},
|
|
398
437
|
[watchKeys]
|
|
399
438
|
);
|