houdini-react 1.3.14 → 2.0.0-go.1

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.
Files changed (141) hide show
  1. package/package.json +89 -73
  2. package/shim.cjs +64 -0
  3. package/LICENSE +0 -21
  4. package/README.md +0 -36
  5. package/build/plugin/codegen/entries/documentWrappers.d.ts +0 -6
  6. package/build/plugin/codegen/entries/fallbacks.d.ts +0 -5
  7. package/build/plugin/codegen/entries/index.d.ts +0 -16
  8. package/build/plugin/codegen/entries/pages.d.ts +0 -2
  9. package/build/plugin/codegen/index.d.ts +0 -17
  10. package/build/plugin/codegen/manifest.d.ts +0 -5
  11. package/build/plugin/codegen/render.d.ts +0 -7
  12. package/build/plugin/codegen/router.d.ts +0 -7
  13. package/build/plugin/codegen/typeRoot.d.ts +0 -5
  14. package/build/plugin/config.d.ts +0 -4
  15. package/build/plugin/dedent.d.ts +0 -1
  16. package/build/plugin/extract.d.ts +0 -6
  17. package/build/plugin/index.d.ts +0 -5
  18. package/build/plugin/state.d.ts +0 -3
  19. package/build/plugin/transform.d.ts +0 -6
  20. package/build/plugin/vite.d.ts +0 -70
  21. package/build/plugin-cjs/index.js +0 -84192
  22. package/build/plugin-cjs/package.json +0 -1
  23. package/build/plugin-esm/index.js +0 -84184
  24. package/build/plugin-esm/package.json +0 -1
  25. package/build/runtime/client.d.ts +0 -3
  26. package/build/runtime/clientPlugin.d.ts +0 -3
  27. package/build/runtime/componentFields.d.ts +0 -9
  28. package/build/runtime/hooks/index.d.ts +0 -8
  29. package/build/runtime/hooks/useDeepCompareEffect.d.ts +0 -35
  30. package/build/runtime/hooks/useDocumentHandle.d.ts +0 -36
  31. package/build/runtime/hooks/useDocumentStore.d.ts +0 -11
  32. package/build/runtime/hooks/useDocumentSubscription.d.ts +0 -11
  33. package/build/runtime/hooks/useFragment.d.ts +0 -16
  34. package/build/runtime/hooks/useFragmentHandle.d.ts +0 -8
  35. package/build/runtime/hooks/useIsMounted.d.ts +0 -3
  36. package/build/runtime/hooks/useMutation.d.ts +0 -11
  37. package/build/runtime/hooks/useQuery.d.ts +0 -5
  38. package/build/runtime/hooks/useQueryHandle.d.ts +0 -10
  39. package/build/runtime/hooks/useSubscription.d.ts +0 -4
  40. package/build/runtime/hooks/useSubscriptionHandle.d.ts +0 -25
  41. package/build/runtime/index.d.ts +0 -14
  42. package/build/runtime/manifest.d.ts +0 -3
  43. package/build/runtime/routing/Router.d.ts +0 -62
  44. package/build/runtime/routing/cache.d.ts +0 -7
  45. package/build/runtime/routing/hooks.d.ts +0 -40
  46. package/build/runtime/routing/index.d.ts +0 -3
  47. package/build/runtime-cjs/client.d.ts +0 -3
  48. package/build/runtime-cjs/client.js +0 -27
  49. package/build/runtime-cjs/clientPlugin.d.ts +0 -3
  50. package/build/runtime-cjs/clientPlugin.js +0 -39
  51. package/build/runtime-cjs/componentFields.d.ts +0 -9
  52. package/build/runtime-cjs/componentFields.js +0 -83
  53. package/build/runtime-cjs/hooks/index.d.ts +0 -8
  54. package/build/runtime-cjs/hooks/index.js +0 -45
  55. package/build/runtime-cjs/hooks/useDeepCompareEffect.d.ts +0 -35
  56. package/build/runtime-cjs/hooks/useDeepCompareEffect.js +0 -72
  57. package/build/runtime-cjs/hooks/useDocumentHandle.d.ts +0 -36
  58. package/build/runtime-cjs/hooks/useDocumentHandle.js +0 -173
  59. package/build/runtime-cjs/hooks/useDocumentStore.d.ts +0 -11
  60. package/build/runtime-cjs/hooks/useDocumentStore.js +0 -72
  61. package/build/runtime-cjs/hooks/useDocumentSubscription.d.ts +0 -11
  62. package/build/runtime-cjs/hooks/useDocumentSubscription.js +0 -71
  63. package/build/runtime-cjs/hooks/useFragment.d.ts +0 -16
  64. package/build/runtime-cjs/hooks/useFragment.js +0 -97
  65. package/build/runtime-cjs/hooks/useFragmentHandle.d.ts +0 -8
  66. package/build/runtime-cjs/hooks/useFragmentHandle.js +0 -47
  67. package/build/runtime-cjs/hooks/useIsMounted.d.ts +0 -3
  68. package/build/runtime-cjs/hooks/useIsMounted.js +0 -38
  69. package/build/runtime-cjs/hooks/useMutation.d.ts +0 -11
  70. package/build/runtime-cjs/hooks/useMutation.js +0 -52
  71. package/build/runtime-cjs/hooks/useQuery.d.ts +0 -5
  72. package/build/runtime-cjs/hooks/useQuery.js +0 -32
  73. package/build/runtime-cjs/hooks/useQueryHandle.d.ts +0 -10
  74. package/build/runtime-cjs/hooks/useQueryHandle.js +0 -125
  75. package/build/runtime-cjs/hooks/useSubscription.d.ts +0 -4
  76. package/build/runtime-cjs/hooks/useSubscription.js +0 -32
  77. package/build/runtime-cjs/hooks/useSubscriptionHandle.d.ts +0 -25
  78. package/build/runtime-cjs/hooks/useSubscriptionHandle.js +0 -42
  79. package/build/runtime-cjs/index.d.ts +0 -14
  80. package/build/runtime-cjs/index.js +0 -83
  81. package/build/runtime-cjs/manifest.d.ts +0 -3
  82. package/build/runtime-cjs/manifest.js +0 -27
  83. package/build/runtime-cjs/package.json +0 -1
  84. package/build/runtime-cjs/routing/Router.d.ts +0 -62
  85. package/build/runtime-cjs/routing/Router.js +0 -532
  86. package/build/runtime-cjs/routing/cache.d.ts +0 -7
  87. package/build/runtime-cjs/routing/cache.js +0 -58
  88. package/build/runtime-cjs/routing/hooks.d.ts +0 -40
  89. package/build/runtime-cjs/routing/hooks.js +0 -89
  90. package/build/runtime-cjs/routing/index.d.ts +0 -3
  91. package/build/runtime-cjs/routing/index.js +0 -31
  92. package/build/runtime-esm/client.d.ts +0 -3
  93. package/build/runtime-esm/client.js +0 -5
  94. package/build/runtime-esm/clientPlugin.d.ts +0 -3
  95. package/build/runtime-esm/clientPlugin.js +0 -17
  96. package/build/runtime-esm/componentFields.d.ts +0 -9
  97. package/build/runtime-esm/componentFields.js +0 -59
  98. package/build/runtime-esm/hooks/index.d.ts +0 -8
  99. package/build/runtime-esm/hooks/index.js +0 -16
  100. package/build/runtime-esm/hooks/useDeepCompareEffect.d.ts +0 -35
  101. package/build/runtime-esm/hooks/useDeepCompareEffect.js +0 -41
  102. package/build/runtime-esm/hooks/useDocumentHandle.d.ts +0 -36
  103. package/build/runtime-esm/hooks/useDocumentHandle.js +0 -143
  104. package/build/runtime-esm/hooks/useDocumentStore.d.ts +0 -11
  105. package/build/runtime-esm/hooks/useDocumentStore.js +0 -42
  106. package/build/runtime-esm/hooks/useDocumentSubscription.d.ts +0 -11
  107. package/build/runtime-esm/hooks/useDocumentSubscription.js +0 -41
  108. package/build/runtime-esm/hooks/useFragment.d.ts +0 -16
  109. package/build/runtime-esm/hooks/useFragment.js +0 -66
  110. package/build/runtime-esm/hooks/useFragmentHandle.d.ts +0 -8
  111. package/build/runtime-esm/hooks/useFragmentHandle.js +0 -23
  112. package/build/runtime-esm/hooks/useIsMounted.d.ts +0 -3
  113. package/build/runtime-esm/hooks/useIsMounted.js +0 -14
  114. package/build/runtime-esm/hooks/useMutation.d.ts +0 -11
  115. package/build/runtime-esm/hooks/useMutation.js +0 -28
  116. package/build/runtime-esm/hooks/useQuery.d.ts +0 -5
  117. package/build/runtime-esm/hooks/useQuery.js +0 -8
  118. package/build/runtime-esm/hooks/useQueryHandle.d.ts +0 -10
  119. package/build/runtime-esm/hooks/useQueryHandle.js +0 -95
  120. package/build/runtime-esm/hooks/useSubscription.d.ts +0 -4
  121. package/build/runtime-esm/hooks/useSubscription.js +0 -8
  122. package/build/runtime-esm/hooks/useSubscriptionHandle.d.ts +0 -25
  123. package/build/runtime-esm/hooks/useSubscriptionHandle.js +0 -18
  124. package/build/runtime-esm/index.d.ts +0 -14
  125. package/build/runtime-esm/index.js +0 -48
  126. package/build/runtime-esm/manifest.d.ts +0 -3
  127. package/build/runtime-esm/manifest.js +0 -5
  128. package/build/runtime-esm/package.json +0 -1
  129. package/build/runtime-esm/routing/Router.d.ts +0 -62
  130. package/build/runtime-esm/routing/Router.js +0 -495
  131. package/build/runtime-esm/routing/cache.d.ts +0 -7
  132. package/build/runtime-esm/routing/cache.js +0 -33
  133. package/build/runtime-esm/routing/hooks.d.ts +0 -40
  134. package/build/runtime-esm/routing/hooks.js +0 -53
  135. package/build/runtime-esm/routing/index.d.ts +0 -3
  136. package/build/runtime-esm/routing/index.js +0 -6
  137. package/build/server/index.d.ts +0 -1
  138. package/build/server-cjs/index.js +0 -28
  139. package/build/server-cjs/package.json +0 -1
  140. package/build/server-esm/index.js +0 -4
  141. package/build/server-esm/package.json +0 -1
@@ -1 +0,0 @@
1
- {"type":"module"}
@@ -1,3 +0,0 @@
1
- import type { HoudiniClient } from '$houdini/runtime/client';
2
- declare const _default: () => HoudiniClient;
3
- export default _default;
@@ -1,3 +0,0 @@
1
- import type { ClientPlugin } from 'houdini';
2
- declare const plugin: () => ClientPlugin;
3
- export default plugin;
@@ -1,9 +0,0 @@
1
- import { type Cache } from '$houdini/runtime/cache/cache';
2
- import type { DocumentArtifact, GraphQLValue } from 'houdini';
3
- export declare function injectComponents({ cache, selection, data, variables, parentType, }: {
4
- cache: Cache;
5
- selection: DocumentArtifact['selection'];
6
- data: GraphQLValue | null;
7
- variables: Record<string, GraphQLValue> | undefined | null;
8
- parentType?: string;
9
- }): void;
@@ -1,8 +0,0 @@
1
- export { useQuery } from './useQuery';
2
- export { useQueryHandle } from './useQueryHandle';
3
- export { useFragment } from './useFragment';
4
- export { useFragmentHandle } from './useFragmentHandle';
5
- export { useMutation } from './useMutation';
6
- export { useSubscription } from './useSubscription';
7
- export { type DocumentHandle } from './useDocumentHandle';
8
- export { type UseQueryConfig } from './useQueryHandle';
@@ -1,35 +0,0 @@
1
- import * as React from 'react';
2
- type UseEffectParams = Parameters<typeof React.useEffect>;
3
- type EffectCallback = UseEffectParams[0];
4
- type DependencyList = UseEffectParams[1];
5
- type UseEffectReturn = ReturnType<typeof React.useEffect>;
6
- /**
7
- * @param value the value to be memoized (usually a dependency list)
8
- * @returns a memoized version of the value as long as it remains deeply equal
9
- */
10
- export declare function useDeepCompareMemoize<T>(value: T): T;
11
- declare function useDeepCompareEffect(callback: EffectCallback, dependencies: DependencyList): UseEffectReturn;
12
- export declare function useDeepCompareEffectNoCheck(callback: EffectCallback, dependencies: DependencyList): UseEffectReturn;
13
- export default useDeepCompareEffect;
14
- /**
15
- The MIT License (MIT)
16
- Copyright (c) 2020 Kent C. Dodds
17
-
18
- Permission is hereby granted, free of charge, to any person obtaining a copy
19
- of this software and associated documentation files (the "Software"), to deal
20
- in the Software without restriction, including without limitation the rights
21
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
22
- copies of the Software, and to permit persons to whom the Software is
23
- furnished to do so, subject to the following conditions:
24
-
25
- The above copyright notice and this permission notice shall be included in all
26
- copies or substantial portions of the Software.
27
-
28
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
33
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34
- SOFTWARE.
35
- */
@@ -1,36 +0,0 @@
1
- import type { DocumentStore } from '$houdini/runtime/client';
2
- import type { GraphQLObject, GraphQLVariables, CursorHandlers, OffsetHandlers, PageInfo, FetchFn, QueryResult, DocumentArtifact, QueryArtifact } from '$houdini/runtime/lib/types';
3
- export declare function useDocumentHandle<_Artifact extends QueryArtifact, _Data extends GraphQLObject, _Input extends GraphQLVariables>({ artifact, observer, storeValue, }: {
4
- artifact: DocumentArtifact;
5
- observer: DocumentStore<_Data, _Input>;
6
- storeValue: QueryResult<_Data, _Input>;
7
- }): DocumentHandle<_Artifact, _Data, _Input> & {
8
- fetch: FetchFn<_Data, _Input>;
9
- };
10
- export type DocumentHandle<_Artifact extends QueryArtifact, _Data extends GraphQLObject = GraphQLObject, _Input extends GraphQLVariables = GraphQLVariables> = {
11
- data: _Data;
12
- partial: boolean;
13
- fetch: FetchFn<_Data, Partial<_Input>>;
14
- variables: _Input;
15
- } & RefetchHandlers<_Artifact, _Data, _Input>;
16
- type RefetchHandlers<_Artifact extends QueryArtifact, _Data extends GraphQLObject, _Input> = _Artifact extends {
17
- refetch: {
18
- paginated: true;
19
- method: 'cursor';
20
- };
21
- } ? {
22
- loadNext: CursorHandlers<_Data, _Input>['loadNextPage'];
23
- loadNextPending: boolean;
24
- loadPrevious: CursorHandlers<_Data, _Input>['loadPreviousPage'];
25
- loadPreviousPending: boolean;
26
- pageInfo: PageInfo;
27
- } : _Artifact extends {
28
- refetch: {
29
- paginated: true;
30
- method: 'offset';
31
- };
32
- } ? {
33
- loadNext: OffsetHandlers<_Data, _Input>['loadNextPage'];
34
- loadNextPending: boolean;
35
- } : {};
36
- export {};
@@ -1,11 +0,0 @@
1
- import type { DocumentArtifact, GraphQLVariables, QueryResult } from '$houdini/lib/types';
2
- import type { DocumentStore, ObserveParams } from '$houdini/runtime/client';
3
- import type { GraphQLObject } from 'houdini';
4
- export type UseDocumentStoreParams<_Artifact extends DocumentArtifact, _Data extends GraphQLObject, _Input extends GraphQLVariables> = {
5
- artifact: _Artifact;
6
- observer?: DocumentStore<_Data, _Input>;
7
- } & Partial<ObserveParams<_Data, DocumentArtifact, _Input>>;
8
- export declare function useDocumentStore<_Data extends GraphQLObject = GraphQLObject, _Input extends GraphQLVariables = GraphQLVariables, _Artifact extends DocumentArtifact = DocumentArtifact>({ artifact, observer: obs, ...observeParams }: UseDocumentStoreParams<_Artifact, _Data, _Input>): [
9
- QueryResult<_Data, _Input>,
10
- DocumentStore<_Data, _Input>
11
- ];
@@ -1,11 +0,0 @@
1
- import type { DocumentArtifact, GraphQLVariables, QueryResult } from '$houdini/lib/types';
2
- import type { DocumentStore, SendParams } from '$houdini/runtime/client';
3
- import type { GraphQLObject } from 'houdini';
4
- import { type UseDocumentStoreParams } from './useDocumentStore';
5
- export declare function useDocumentSubscription<_Artifact extends DocumentArtifact = DocumentArtifact, _Data extends GraphQLObject = GraphQLObject, _Input extends GraphQLVariables = GraphQLVariables>({ artifact, variables, send, disabled, ...observeParams }: UseDocumentStoreParams<_Artifact, _Data, _Input> & {
6
- variables: _Input;
7
- disabled?: boolean;
8
- send?: Partial<SendParams>;
9
- }): [QueryResult<_Data, _Input> & {
10
- parent?: string | null;
11
- }, DocumentStore<_Data, _Input>];
@@ -1,16 +0,0 @@
1
- import { fragmentKey } from '$houdini/runtime/lib/types';
2
- import type { GraphQLObject, GraphQLVariables, FragmentArtifact } from '$houdini/runtime/lib/types';
3
- export declare function useFragment<_Data extends GraphQLObject, _ReferenceType extends {}, _Input extends GraphQLVariables = GraphQLVariables>(reference: _Data | {
4
- [fragmentKey]: _ReferenceType;
5
- } | null, document: {
6
- artifact: FragmentArtifact;
7
- }): _Data | null;
8
- export declare function fragmentReference<_Data extends GraphQLObject, _Input, _ReferenceType extends {}>(reference: _Data | {
9
- [fragmentKey]: _ReferenceType;
10
- } | null, document: {
11
- artifact: FragmentArtifact;
12
- }): {
13
- variables: _Input;
14
- parent: string;
15
- loading: boolean;
16
- };
@@ -1,8 +0,0 @@
1
- import type { GraphQLObject, FragmentArtifact, QueryArtifact, fragmentKey, GraphQLVariables } from '$houdini/runtime/lib/types';
2
- import { type DocumentHandle } from './useDocumentHandle';
3
- export declare function useFragmentHandle<_Artifact extends FragmentArtifact, _Data extends GraphQLObject, _ReferenceType extends {}, _PaginationArtifact extends QueryArtifact, _Input extends GraphQLVariables = GraphQLVariables>(reference: _Data | {
4
- [fragmentKey]: _ReferenceType;
5
- } | null, document: {
6
- artifact: FragmentArtifact;
7
- refetchArtifact?: QueryArtifact;
8
- }): DocumentHandle<_PaginationArtifact, _Data, _Input>;
@@ -1,3 +0,0 @@
1
- export declare function useIsMountedRef(): {
2
- current: boolean;
3
- };
@@ -1,11 +0,0 @@
1
- import type { MutationArtifact, GraphQLObject, QueryResult, GraphQLVariables } from '$houdini/runtime/lib/types';
2
- export type MutationHandler<_Result, _Input, _Optimistic extends GraphQLObject> = (args: {
3
- variables: _Input;
4
- metadata?: App.Metadata;
5
- fetch?: typeof globalThis.fetch;
6
- optimisticResponse?: _Optimistic;
7
- abortController?: AbortController;
8
- }) => Promise<QueryResult<_Result, _Input>>;
9
- export declare function useMutation<_Result extends GraphQLObject, _Input extends GraphQLVariables, _Optimistic extends GraphQLObject>({ artifact, }: {
10
- artifact: MutationArtifact;
11
- }): [boolean, MutationHandler<_Result, _Input, _Optimistic>];
@@ -1,5 +0,0 @@
1
- import type { GraphQLVariables, GraphQLObject, QueryArtifact } from '$houdini/runtime/lib/types';
2
- import type { UseQueryConfig } from './useQueryHandle';
3
- export declare function useQuery<_Artifact extends QueryArtifact, _Data extends GraphQLObject = GraphQLObject, _Input extends GraphQLVariables = GraphQLVariables>(document: {
4
- artifact: QueryArtifact;
5
- }, variables?: any, config?: UseQueryConfig): _Data;
@@ -1,10 +0,0 @@
1
- import type { GraphQLObject, CachePolicies, QueryArtifact, GraphQLVariables } from '$houdini/runtime/lib/types';
2
- import type { DocumentHandle } from './useDocumentHandle';
3
- export declare function useQueryHandle<_Artifact extends QueryArtifact, _Data extends GraphQLObject = GraphQLObject, _Input extends GraphQLVariables = GraphQLVariables>({ artifact }: {
4
- artifact: QueryArtifact;
5
- }, variables?: any, config?: UseQueryConfig): DocumentHandle<_Artifact, _Data, _Input>;
6
- export type UseQueryConfig = {
7
- policy?: CachePolicies;
8
- metadata?: App.Metadata;
9
- fetchKey?: any;
10
- };
@@ -1,4 +0,0 @@
1
- import type { SubscriptionArtifact, GraphQLObject, GraphQLVariables } from '$houdini/runtime/lib/types';
2
- export declare function useSubscription<_Result extends GraphQLObject, _Input extends GraphQLVariables>(document: {
3
- artifact: SubscriptionArtifact;
4
- }, variables: _Input): import("houdini").GraphQLObject | null;
@@ -1,25 +0,0 @@
1
- import type { SubscriptionArtifact, GraphQLObject, GraphQLVariables } from '$houdini/runtime/lib/types';
2
- export type SubscriptionHandle<_Result extends GraphQLObject, _Input extends GraphQLVariables> = {
3
- data: _Result | null;
4
- errors: {
5
- message: string;
6
- }[] | null;
7
- variables: _Input;
8
- listen: (args: {
9
- variables?: _Input;
10
- }) => void;
11
- unlisten: () => void;
12
- fetching: boolean;
13
- };
14
- export declare function useSubscriptionHandle<_Result extends GraphQLObject, _Input extends GraphQLVariables>({ artifact }: {
15
- artifact: SubscriptionArtifact;
16
- }, variables: _Input): {
17
- data: import("houdini").GraphQLObject | null;
18
- errors: {
19
- message: string;
20
- }[] | null;
21
- fetching: boolean;
22
- variables: _Input;
23
- unlisten: () => Promise<void>;
24
- listen: ({ metadata, session, fetch, variables, policy, stuff, cacheParams, setup, silenceEcho, abortController, }?: import("$houdini/lib").SendParams) => Promise<import("$houdini/runtime/lib/types").QueryResult<import("houdini").GraphQLObject, _Input>>;
25
- };
@@ -1,14 +0,0 @@
1
- /// <reference types="react" />
2
- import type { GraphQLObject } from '$houdini/lib/types';
3
- import type { Cache } from '$houdini/runtime/cache/cache';
4
- import { RouterCache } from './routing';
5
- export * from './hooks';
6
- export { router_cache, useSession, useLocation, useRoute } from './routing';
7
- export declare function Router({ cache, initialURL, artifact_cache, component_cache, data_cache, ssr_signals, last_variables, session, assetPrefix, injectToStream, }: {
8
- initialURL: string;
9
- initialVariables: GraphQLObject;
10
- cache: Cache;
11
- session?: App.Session;
12
- assetPrefix: string;
13
- injectToStream?: (chunk: string) => void;
14
- } & RouterCache): import("react").JSX.Element;
@@ -1,3 +0,0 @@
1
- import type { RouterManifest } from '$houdini/runtime/lib/types';
2
- declare const manifest: RouterManifest;
3
- export default manifest;
@@ -1,62 +0,0 @@
1
- import type { Cache } from '$houdini/runtime/cache/cache';
2
- import { DocumentStore, HoudiniClient } from '$houdini/runtime/client';
3
- import type { LRUCache } from '$houdini/runtime/lib/lru';
4
- import type { GraphQLObject, GraphQLVariables } from '$houdini/runtime/lib/types';
5
- import type { QueryArtifact } from '$houdini/runtime/lib/types';
6
- import type { RouterManifest } from '$houdini/runtime/router/types';
7
- import React from 'react';
8
- import { type SuspenseCache } from './cache';
9
- import { type DocumentHandle } from '../hooks/useDocumentHandle';
10
- import { type PageComponent, type PendingCache } from './hooks';
11
- type ComponentType = any;
12
- /**
13
- * Router is the top level entry point for the filesystem-based router.
14
- * It is responsible for loading various page sources (including API fetches) and
15
- * then rendering when appropriate.
16
- */
17
- export declare function Router({ manifest, initialURL, assetPrefix, injectToStream, }: {
18
- manifest: RouterManifest<ComponentType>;
19
- initialURL?: string;
20
- assetPrefix: string;
21
- injectToStream?: undefined | ((chunk: string) => void);
22
- }): React.JSX.Element;
23
- export declare function RouterContextProvider({ children, client, cache, artifact_cache, component_cache, data_cache, ssr_signals, last_variables, session: ssrSession, }: {
24
- children: React.ReactNode;
25
- client: HoudiniClient;
26
- cache: Cache;
27
- artifact_cache: SuspenseCache<QueryArtifact>;
28
- component_cache: SuspenseCache<PageComponent>;
29
- data_cache: SuspenseCache<DocumentStore<GraphQLObject, GraphQLVariables>>;
30
- ssr_signals: PendingCache;
31
- last_variables: LRUCache<GraphQLVariables>;
32
- session?: App.Session;
33
- }): React.JSX.Element;
34
- export declare function updateLocalSession(session: App.Session): void;
35
- export declare function useCurrentVariables(): GraphQLVariables;
36
- export declare function useQueryResult<_Data extends GraphQLObject, _Input extends GraphQLVariables>(name: string): [_Data | null, DocumentHandle<any, _Data, _Input>];
37
- export type RouterCache = {
38
- artifact_cache: SuspenseCache<QueryArtifact>;
39
- component_cache: SuspenseCache<PageComponent>;
40
- data_cache: SuspenseCache<DocumentStore<GraphQLObject, GraphQLVariables>>;
41
- last_variables: LRUCache<GraphQLVariables>;
42
- ssr_signals: PendingCache;
43
- };
44
- export declare function router_cache({ pending_queries, artifacts, components, initialData, initialVariables, initialArtifacts, }?: {
45
- pending_queries?: string[];
46
- artifacts?: Record<string, QueryArtifact>;
47
- components?: Record<string, PageComponent>;
48
- initialData?: Record<string, DocumentStore<GraphQLObject, GraphQLVariables>>;
49
- initialVariables?: Record<string, GraphQLVariables>;
50
- initialArtifacts?: Record<string, QueryArtifact>;
51
- }): RouterCache;
52
- export declare function PageContextProvider({ keys, children, }: {
53
- keys: string[];
54
- children: React.ReactNode;
55
- }): React.JSX.Element;
56
- export declare function useRoute<PageProps extends {
57
- Params: {};
58
- }>(): RouteProp<PageProps['Params']>;
59
- export type RouteProp<Params> = {
60
- params: Params;
61
- };
62
- export {};
@@ -1,7 +0,0 @@
1
- import { LRUCache } from '$houdini/runtime/lib/lru';
2
- export declare function suspense_cache<T>(initialData?: Record<string, T>): SuspenseCache<T>;
3
- export declare class SuspenseCache<_Data> extends LRUCache<_Data> {
4
- #private;
5
- get(key: string): _Data;
6
- set(key: string, value: _Data): void;
7
- }
@@ -1,40 +0,0 @@
1
- import type { Cache } from '$houdini/runtime/cache/cache';
2
- import type { DocumentStore, HoudiniClient } from '$houdini/runtime/client';
3
- import type { LRUCache } from '$houdini/runtime/lib/lru';
4
- import type { GraphQLObject, GraphQLVariables, QueryArtifact } from '$houdini/runtime/lib/types';
5
- import { default as React } from 'react';
6
- import type { SuspenseCache } from './cache';
7
- export type PageComponent = React.ComponentType<{
8
- url: string;
9
- }>;
10
- export type PendingCache = SuspenseCache<Promise<void> & {
11
- resolve: () => void;
12
- reject: (message: string) => void;
13
- }>;
14
- type RouterContext = {
15
- client: HoudiniClient;
16
- cache: Cache;
17
- artifact_cache: SuspenseCache<QueryArtifact>;
18
- component_cache: SuspenseCache<PageComponent>;
19
- data_cache: SuspenseCache<DocumentStore<GraphQLObject, GraphQLVariables>>;
20
- ssr_signals: PendingCache;
21
- last_variables: LRUCache<GraphQLVariables>;
22
- session: App.Session;
23
- setSession: (newSession: Partial<App.Session>) => void;
24
- };
25
- export declare const Context: React.Context<RouterContext | null>;
26
- export declare const LocationContext: React.Context<{
27
- pathname: string;
28
- params: Record<string, any>;
29
- goto: (url: string) => void;
30
- }>;
31
- export declare const useLocation: () => {
32
- pathname: string;
33
- params: Record<string, any>;
34
- goto: (url: string) => void;
35
- };
36
- export declare const useRouterContext: () => RouterContext;
37
- export declare function useClient(): HoudiniClient;
38
- export declare function useCache(): Cache;
39
- export declare function useSession(): [App.Session, (newSession: Partial<App.Session>) => void];
40
- export {};
@@ -1,3 +0,0 @@
1
- export * from './Router';
2
- export * from './hooks';
3
- export { type SuspenseCache, suspense_cache } from './cache';
@@ -1,3 +0,0 @@
1
- import type { HoudiniClient } from '$houdini/runtime/client';
2
- declare const _default: () => HoudiniClient;
3
- export default _default;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var client_exports = {};
20
- __export(client_exports, {
21
- default: () => client_default
22
- });
23
- module.exports = __toCommonJS(client_exports);
24
- var client_default = () => {
25
- };
26
- // Annotate the CommonJS export names for ESM import in node:
27
- 0 && (module.exports = {});
@@ -1,3 +0,0 @@
1
- import type { ClientPlugin } from 'houdini';
2
- declare const plugin: () => ClientPlugin;
3
- export default plugin;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var clientPlugin_exports = {};
20
- __export(clientPlugin_exports, {
21
- default: () => clientPlugin_default
22
- });
23
- module.exports = __toCommonJS(clientPlugin_exports);
24
- const plugin = () => () => {
25
- return {
26
- start(ctx, { next }) {
27
- next({
28
- ...ctx,
29
- cacheParams: {
30
- ...ctx.cacheParams,
31
- serverSideFallback: false
32
- }
33
- });
34
- }
35
- };
36
- };
37
- var clientPlugin_default = plugin;
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {});
@@ -1,9 +0,0 @@
1
- import { type Cache } from '$houdini/runtime/cache/cache';
2
- import type { DocumentArtifact, GraphQLValue } from 'houdini';
3
- export declare function injectComponents({ cache, selection, data, variables, parentType, }: {
4
- cache: Cache;
5
- selection: DocumentArtifact['selection'];
6
- data: GraphQLValue | null;
7
- variables: Record<string, GraphQLValue> | undefined | null;
8
- parentType?: string;
9
- }): void;
@@ -1,83 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var componentFields_exports = {};
20
- __export(componentFields_exports, {
21
- injectComponents: () => injectComponents
22
- });
23
- module.exports = __toCommonJS(componentFields_exports);
24
- var import_cache = require("$houdini/runtime/cache/cache");
25
- var import_selection = require("$houdini/runtime/lib/selection");
26
- function injectComponents({
27
- cache,
28
- selection,
29
- data,
30
- variables,
31
- parentType = "Query"
32
- }) {
33
- if (data === null) {
34
- return;
35
- }
36
- if (typeof data !== "object") {
37
- return;
38
- }
39
- if (Array.isArray(data)) {
40
- data.forEach(
41
- (item) => injectComponents({
42
- cache,
43
- selection,
44
- data: item,
45
- variables,
46
- parentType
47
- })
48
- );
49
- return;
50
- }
51
- const typename = data["__typename"];
52
- const fields = (0, import_selection.getFieldsForType)(selection, typename, false);
53
- if (!fields) {
54
- return;
55
- }
56
- for (const [field, subSelection] of Object.entries(fields)) {
57
- if (subSelection.component) {
58
- if (!cache._internal_unstable.componentCache[subSelection.component.key]) {
59
- continue;
60
- }
61
- data[field] = (0, import_cache.defaultComponentField)({
62
- variables,
63
- parent: cache._internal_unstable.id(parentType, data) ?? "",
64
- cache,
65
- component: subSelection.component
66
- });
67
- }
68
- const dataValue = data[field];
69
- if (subSelection.selection) {
70
- injectComponents({
71
- cache,
72
- selection: subSelection.selection,
73
- data: dataValue,
74
- variables,
75
- parentType: subSelection.type
76
- });
77
- }
78
- }
79
- }
80
- // Annotate the CommonJS export names for ESM import in node:
81
- 0 && (module.exports = {
82
- injectComponents
83
- });
@@ -1,8 +0,0 @@
1
- export { useQuery } from './useQuery';
2
- export { useQueryHandle } from './useQueryHandle';
3
- export { useFragment } from './useFragment';
4
- export { useFragmentHandle } from './useFragmentHandle';
5
- export { useMutation } from './useMutation';
6
- export { useSubscription } from './useSubscription';
7
- export { type DocumentHandle } from './useDocumentHandle';
8
- export { type UseQueryConfig } from './useQueryHandle';
@@ -1,45 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var hooks_exports = {};
20
- __export(hooks_exports, {
21
- useFragment: () => import_useFragment.useFragment,
22
- useFragmentHandle: () => import_useFragmentHandle.useFragmentHandle,
23
- useMutation: () => import_useMutation.useMutation,
24
- useQuery: () => import_useQuery.useQuery,
25
- useQueryHandle: () => import_useQueryHandle.useQueryHandle,
26
- useSubscription: () => import_useSubscription.useSubscription
27
- });
28
- module.exports = __toCommonJS(hooks_exports);
29
- var import_useQuery = require("./useQuery");
30
- var import_useQueryHandle = require("./useQueryHandle");
31
- var import_useFragment = require("./useFragment");
32
- var import_useFragmentHandle = require("./useFragmentHandle");
33
- var import_useMutation = require("./useMutation");
34
- var import_useSubscription = require("./useSubscription");
35
- var import_useDocumentHandle = require("./useDocumentHandle");
36
- var import_useQueryHandle2 = require("./useQueryHandle");
37
- // Annotate the CommonJS export names for ESM import in node:
38
- 0 && (module.exports = {
39
- useFragment,
40
- useFragmentHandle,
41
- useMutation,
42
- useQuery,
43
- useQueryHandle,
44
- useSubscription
45
- });
@@ -1,35 +0,0 @@
1
- import * as React from 'react';
2
- type UseEffectParams = Parameters<typeof React.useEffect>;
3
- type EffectCallback = UseEffectParams[0];
4
- type DependencyList = UseEffectParams[1];
5
- type UseEffectReturn = ReturnType<typeof React.useEffect>;
6
- /**
7
- * @param value the value to be memoized (usually a dependency list)
8
- * @returns a memoized version of the value as long as it remains deeply equal
9
- */
10
- export declare function useDeepCompareMemoize<T>(value: T): T;
11
- declare function useDeepCompareEffect(callback: EffectCallback, dependencies: DependencyList): UseEffectReturn;
12
- export declare function useDeepCompareEffectNoCheck(callback: EffectCallback, dependencies: DependencyList): UseEffectReturn;
13
- export default useDeepCompareEffect;
14
- /**
15
- The MIT License (MIT)
16
- Copyright (c) 2020 Kent C. Dodds
17
-
18
- Permission is hereby granted, free of charge, to any person obtaining a copy
19
- of this software and associated documentation files (the "Software"), to deal
20
- in the Software without restriction, including without limitation the rights
21
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
22
- copies of the Software, and to permit persons to whom the Software is
23
- furnished to do so, subject to the following conditions:
24
-
25
- The above copyright notice and this permission notice shall be included in all
26
- copies or substantial portions of the Software.
27
-
28
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
33
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34
- SOFTWARE.
35
- */