import { Plugin } from 'vite'; import { TypeScriptPluginConfig } from '@graphql-codegen/typescript'; import { TypeScriptDocumentsPluginConfig } from '@graphql-codegen/typescript-operations'; interface GraphQLPluginOptions { /** * A [picomatch pattern](https://github.com/micromatch/picomatch), or array of patterns, which * specifies the files in the build the plugin should operate on. By default all files are targeted. */ include?: string | string[]; /** * A [picomatch pattern](https://github.com/micromatch/picomatch), or array of patterns, which * specifies the files in the build the plugin should _ignore_. By default no files are ignored. */ exclude?: string | string[]; /** * Path to GraphQL schema file */ schemaPath?: string; /** * If `true`, instructs plugin to generate type declaration files next to included `.graphql` * / `.gql` files, to allow for type-safe GraphQL queries / mutations. */ generateDeclarations?: boolean; /** * Configs of GraphQL-Codegen plugins */ codegenPluginConfigs?: { /** * Config to pass to the TypeScript plugin (see [documentation](https://the-guild.dev/graphql/codegen/plugins/typescript/typescript#config-api-reference)) * * Note: `strictScalars`, `defaultScalarType`, and `scalars` will be overridden by the options in this plugin. */ typescript?: TypeScriptPluginConfig; /** * Config to pass to the TypeScript operations plugin (see [documentation](https://the-guild.dev/graphql/codegen/plugins/typescript/typescript-operations#config-api-reference)) * * Note: `strictScalars`, `defaultScalarType`, and `scalars` will be overridden by the options in this plugin. */ typescriptOperations?: TypeScriptDocumentsPluginConfig; }; /** * Makes scalars strict. * * If scalars are found in the schema that are not defined in {@link scalars} an error will be thrown during codegen. * * @default false */ strictScalars?: boolean; /** * Allows you to override the type that unknown scalars will have. * * @default 'unknown' */ defaultScalarType?: string; /** * Header to be added to the generated declaration file for the GraphQL schema. * * @default '/* eslint-disable *​/\n\n' */ schemaDeclarationFileHeader?: string; /** * Header to be added to the generated declaration file for GraphQL operations. * * @default '/* eslint-disable *​/\n\n' */ operationDeclarationFileHeader?: string; /** * Extend or override the built-in scalars and custom GraphQL scalars to a custom type. * * @example * { * UUID: 'string', * DateTime: { * input: 'Date | string', * output: 'string' * }, * } */ scalars?: { [name: string]: string | { input: string; output: string; }; }; } declare function typedGraphQLPlugin(options?: GraphQLPluginOptions): Plugin; export = typedGraphQLPlugin; export type { GraphQLPluginOptions };