import { Types , PluginFunction , getCachedDocumentNodeFromSchema , oldVisit } from '@graphql-codegen/plugin-helpers' ; import { GraphQLSchema } from 'graphql' ; import { FlowVisitor } from './visitor' ; import { FlowPluginConfig } from './config' ; export * from './visitor' ; export * from './flow-variables-to-object' ; export const plugin = ( schema , documents , config ) => { const header = `// @flow\n` ; const astNode = getCachedDocumentNodeFromSchema ( schema ) ; const visitor = new FlowVisitor ( schema , config ) ; const visitorResult = oldVisit ( astNode , { leave : visitor , } ) ; return { prepend : [ header , ... visitor . getEnumsImports ( ) ] , content : [ visitor . scalarsDefinition , ... visitorResult . definitions ] . join ( '\n' ) , } ; } ;