Skip to Content
GraphQL Tools
DocumentationAPIInterfacesGraphQLTagPluckOptions

graphql-tools-monorepo / graphql-tag-pluck/src / GraphQLTagPluckOptions

Interface: GraphQLTagPluckOptions

graphql-tag-pluck/src.GraphQLTagPluckOptions

Additional options for determining how a file is parsed.

Table of contents

Properties

Properties

globalGqlIdentifierName

Optional globalGqlIdentifierName: string | string[]

Allows to use a global identifier instead of a module import.

// `graphql` is a global function export const usersQuery = graphql` { users { id name } } `;

Defined in

packages/graphql-tag-pluck/src/index.ts:113


gqlMagicComment

Optional gqlMagicComment: string

The magic comment anchor to look for when parsing GraphQL strings. Defaults to graphql.

Defined in

packages/graphql-tag-pluck/src/index.ts:94


gqlVueBlock

Optional gqlVueBlock: string

The name of a custom Vue block that contains raw GraphQL to be plucked.

Defined in

packages/graphql-tag-pluck/src/index.ts:98


isGqlTemplateLiteral

Optional isGqlTemplateLiteral: (node: ExpressionStatement | TemplateLiteral, options: Omit<GraphQLTagPluckOptions, "isGqlTemplateLiteral" | "pluckStringFromFile">) => undefined | boolean

A custom way to determine if a template literal node contains a GraphQL query. By default, it checks if the leading comment is equal to the gqlMagicComment option.

Type declaration

▸ (node, options): undefined | boolean

Parameters
NameType
nodeExpressionStatement | TemplateLiteral
optionsOmit<GraphQLTagPluckOptions, "isGqlTemplateLiteral" | "pluckStringFromFile">
Returns

undefined | boolean

Defined in

packages/graphql-tag-pluck/src/index.ts:130


modules

Optional modules: { identifier?: string ; name: string }[]

Additional options for determining how a file is parsed. An array of packages that are responsible for exporting the GraphQL string parser function. The following modules are supported by default:

{ modules: [ { // import gql from 'graphql-tag' name: 'graphql-tag', }, { name: 'graphql-tag.macro', }, { // import { graphql } from 'gatsby' name: 'gatsby', identifier: 'graphql', }, { name: 'apollo-server-express', identifier: 'gql', }, { name: 'apollo-server', identifier: 'gql', }, { name: 'react-relay', identifier: 'graphql', }, { name: 'apollo-boost', identifier: 'gql', }, { name: 'apollo-server-koa', identifier: 'gql', }, { name: 'apollo-server-hapi', identifier: 'gql', }, { name: 'apollo-server-fastify', identifier: 'gql', }, { name: ' apollo-server-lambda', identifier: 'gql', }, { name: 'apollo-server-micro', identifier: 'gql', }, { name: 'apollo-server-azure-functions', identifier: 'gql', }, { name: 'apollo-server-cloud-functions', identifier: 'gql', }, { name: 'apollo-server-cloudflare', identifier: 'gql', }, ]; }

Defined in

packages/graphql-tag-pluck/src/index.ts:90


pluckStringFromFile

Optional pluckStringFromFile: (code: string, node: TemplateLiteral, options: Omit<GraphQLTagPluckOptions, "isGqlTemplateLiteral" | "pluckStringFromFile">) => undefined | null | string

A function that allows custom extraction of GraphQL strings from a file.

Type declaration

▸ (code, node, options): undefined | null | string

Parameters
NameType
codestring
nodeTemplateLiteral
optionsOmit<GraphQLTagPluckOptions, "isGqlTemplateLiteral" | "pluckStringFromFile">
Returns

undefined | null | string

Defined in

packages/graphql-tag-pluck/src/index.ts:121


skipIndent

Optional skipIndent: boolean

Set to true in order to get the found documents as-is, without any changes indentation changes

Defined in

packages/graphql-tag-pluck/src/index.ts:117