1 | import type { Types } from '@graphql-codegen/plugin-helpers';
|
2 | import babelPlugin from './babel.js';
|
3 | export declare type FragmentMaskingConfig = {
|
4 | /**
|
5 | * @description The module name from which a augmented module should be imported from.
|
6 | */
|
7 | augmentedModuleName?: string;
|
8 | /** @description Name of the function that should be used for unmasking a masked fragment property.
|
9 | * @default `'useFragment'`
|
10 | */
|
11 | unmaskFunctionName?: string;
|
12 | };
|
13 | export declare type GqlTagConfig = {
|
14 | /**
|
15 | * @description Instead of generating a `gql` function, this preset can also generate a `d.ts` that will enhance the `gql` function of your framework.
|
16 | *
|
17 | * E.g. `graphql-tag` or `@urql/core`.
|
18 | *
|
19 | * @exampleMarkdown
|
20 | * ```ts filename="codegen.ts" {10}
|
21 | * import type { CodegenConfig } from '@graphql-codegen/cli';
|
22 | *
|
23 | * const config: CodegenConfig = {
|
24 | * // ...
|
25 | * generates: {
|
26 | * 'path/to/file.ts': {
|
27 | * preset: 'gql-tag-operations',
|
28 | * plugins: [],
|
29 | * presetConfig: {
|
30 | * augmentedModuleName: '@urql/core'
|
31 | * },
|
32 | * },
|
33 | * },
|
34 | * };
|
35 | * export default config;
|
36 | * ```
|
37 | */
|
38 | augmentedModuleName?: string;
|
39 | /**
|
40 | * @description Fragment masking hides data from components and only allows accessing the data by using a unmasking function.
|
41 | * @exampleMarkdown
|
42 | * ```ts filename="codegen.ts" {10}
|
43 | * import type { CodegenConfig } from '@graphql-codegen/cli';
|
44 | *
|
45 | * const config: CodegenConfig = {
|
46 | * // ...
|
47 | * generates: {
|
48 | * 'path/to/file.ts': {
|
49 | * preset: 'gql-tag-operations',
|
50 | * plugins: [],
|
51 | * presetConfig: {
|
52 | * fragmentMasking: true
|
53 | * },
|
54 | * },
|
55 | * },
|
56 | * };
|
57 | * export default config;
|
58 | * ```
|
59 | *
|
60 | * When using the `augmentedModuleName` option, the unmask function will by default NOT be imported from the same module. It will still be generated to a `index.ts` file. You can, however, specify to resolve the unmasking function from an an augmented module by using the `augmentedModuleName` object sub-config.
|
61 | * @exampleMarkdown
|
62 | * ```ts filename="codegen.ts" {10-13}
|
63 | * import type { CodegenConfig } from '@graphql-codegen/cli';
|
64 | *
|
65 | * const config: CodegenConfig = {
|
66 | * // ...
|
67 | * generates: {
|
68 | * 'path/to/file.ts': {
|
69 | * preset: 'gql-tag-operations',
|
70 | * plugins: [],
|
71 | * presetConfig: {
|
72 | * augmentedModuleName: '@urql/core',
|
73 | * fragmentMasking: {
|
74 | * augmentedModuleName: '@urql/fragment',
|
75 | * },
|
76 | * },
|
77 | * },
|
78 | * },
|
79 | * };
|
80 | * export default config;
|
81 | * ```
|
82 | */
|
83 | fragmentMasking?: FragmentMaskingConfig | boolean;
|
84 | /**
|
85 | * @description Specify the name of the "graphql tag" function to use
|
86 | * @default "gql"
|
87 | *
|
88 | * E.g. `graphql` or `gql`.
|
89 | *
|
90 | * @exampleMarkdown
|
91 | * ```ts filename="codegen.ts" {10}
|
92 | * import type { CodegenConfig } from '@graphql-codegen/cli';
|
93 | *
|
94 | * const config: CodegenConfig = {
|
95 | * // ...
|
96 | * generates: {
|
97 | * 'path/to/file.ts': {
|
98 | * preset: 'gql-tag-operations',
|
99 | * plugins: [],
|
100 | * presetConfig: {
|
101 | * gqlTagName: 'graphql'
|
102 | * },
|
103 | * },
|
104 | * },
|
105 | * };
|
106 | * export default config;
|
107 | * ```
|
108 | */
|
109 | gqlTagName?: string;
|
110 | };
|
111 | export declare const preset: Types.OutputPreset<GqlTagConfig>;
|
112 | export { babelPlugin };
|