@shopify/hydrogen-codegen 0.0.2 → 0.2.0

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 (43) hide show
  1. package/README.md +53 -0
  2. package/dist/cjs/client.cjs +4 -0
  3. package/dist/cjs/client.cjs.map +1 -0
  4. package/dist/cjs/defaults.cjs +31 -0
  5. package/dist/cjs/defaults.cjs.map +1 -0
  6. package/dist/cjs/index.cjs +0 -4
  7. package/dist/cjs/index.cjs.map +1 -1
  8. package/dist/cjs/patch.cjs +53 -0
  9. package/dist/cjs/patch.cjs.map +1 -0
  10. package/dist/cjs/pluck.cjs +12 -22
  11. package/dist/cjs/pluck.cjs.map +1 -1
  12. package/dist/cjs/plugin.cjs +4 -1
  13. package/dist/cjs/plugin.cjs.map +1 -1
  14. package/dist/cjs/preset.cjs +22 -13
  15. package/dist/cjs/preset.cjs.map +1 -1
  16. package/dist/cjs/schema.cjs +11 -8
  17. package/dist/cjs/schema.cjs.map +1 -1
  18. package/dist/esm/client.js +3 -0
  19. package/dist/esm/client.js.map +1 -0
  20. package/dist/esm/defaults.js +29 -0
  21. package/dist/esm/defaults.js.map +1 -0
  22. package/dist/esm/index.d.ts +142 -8
  23. package/dist/esm/index.js +1 -1
  24. package/dist/esm/index.js.map +1 -1
  25. package/dist/esm/patch.d.ts +2 -0
  26. package/dist/esm/patch.js +45 -0
  27. package/dist/esm/patch.js.map +1 -0
  28. package/dist/esm/pluck.js +13 -22
  29. package/dist/esm/pluck.js.map +1 -1
  30. package/dist/esm/plugin.js +4 -1
  31. package/dist/esm/plugin.js.map +1 -1
  32. package/dist/esm/preset.js +18 -9
  33. package/dist/esm/preset.js.map +1 -1
  34. package/dist/esm/schema.js +11 -8
  35. package/dist/esm/schema.js.map +1 -1
  36. package/package.json +19 -11
  37. package/vendor/graphql-tag-pluck/visitor.cjs +1 -1
  38. package/vendor/graphql-tag-pluck/visitor.mjs +3 -3
  39. package/dist/esm/pluck.d.ts +0 -23
  40. package/dist/esm/plugin.d.ts +0 -20
  41. package/dist/esm/preset.d.ts +0 -35
  42. package/dist/esm/schema.d.ts +0 -4
  43. package/dist/esm/sources.d.ts +0 -8
@@ -1,20 +0,0 @@
1
- import { PluginFunction } from '@graphql-codegen/plugin-helpers';
2
- import { Source } from '@graphql-tools/utils';
3
- import { OperationDefinitionNode, FragmentDefinitionNode } from 'graphql';
4
-
5
- type OperationOrFragment = {
6
- initialName: string;
7
- definition: OperationDefinitionNode | FragmentDefinitionNode;
8
- };
9
- type SourceWithOperations = {
10
- source: Source;
11
- operations: Array<OperationOrFragment>;
12
- };
13
- declare const plugin: PluginFunction<{
14
- sourcesWithOperations: Array<SourceWithOperations>;
15
- interfaceExtensionCode: string;
16
- }>;
17
- declare const GENERATED_QUERY_INTERFACE_NAME = "GeneratedQueryTypes";
18
- declare const GENERATED_MUTATION_INTERFACE_NAME = "GeneratedMutationTypes";
19
-
20
- export { GENERATED_MUTATION_INTERFACE_NAME, GENERATED_QUERY_INTERFACE_NAME, OperationOrFragment, SourceWithOperations, plugin };
@@ -1,35 +0,0 @@
1
- import { Types } from '@graphql-codegen/plugin-helpers';
2
-
3
- type HydrogenPresetConfig = {
4
- /**
5
- * Name for the variable that contains the imported types.
6
- * @default 'StorefrontAPI'
7
- */
8
- namespacedImportName?: string;
9
- /**
10
- * Module to import the types from.
11
- * @default '@shopify/hydrogen/storefront-api-types'
12
- */
13
- importTypesFrom?: string;
14
- /**
15
- * Whether types should be imported from the `importTypesFrom` module, or generated inline.
16
- * @default true
17
- */
18
- importTypes?: boolean;
19
- /**
20
- * Whether to skip adding `__typename` to generated operation types.
21
- * @default true
22
- */
23
- skipTypenameInOperations?: boolean;
24
- /**
25
- * Override the default interface extension.
26
- */
27
- interfaceExtension?: (options: {
28
- queryType: string;
29
- mutationType: string;
30
- }) => string;
31
- };
32
- declare const defaultInterfaceExtensionCode: string;
33
- declare const preset: Types.OutputPreset<HydrogenPresetConfig>;
34
-
35
- export { HydrogenPresetConfig, defaultInterfaceExtensionCode, preset };
@@ -1,4 +0,0 @@
1
- declare const getSchema: () => string;
2
- declare const schema: string;
3
-
4
- export { getSchema, schema };
@@ -1,8 +0,0 @@
1
- import { SourceWithOperations } from './plugin.js';
2
- import { Source } from '@graphql-tools/utils';
3
- import { OperationDefinitionNode, FragmentDefinitionNode } from 'graphql';
4
- import '@graphql-codegen/plugin-helpers';
5
-
6
- declare function processSources(sources: Array<Source>, buildName?: (node: OperationDefinitionNode | FragmentDefinitionNode) => string): SourceWithOperations[];
7
-
8
- export { processSources };