Skip to Content
GraphQL Tools
DocumentationAPI@graphql-tools/graphql-tag-plucksrcinterfacesGraphQLTagPluckOptions

Interface: GraphQLTagPluckOptions

Defined in: packages/graphql-tag-pluck/src/index.ts:28 

Additional options for determining how a file is parsed.

Properties

globalGqlIdentifierName?

optional globalGqlIdentifierName?: string | string[]

Defined in: packages/graphql-tag-pluck/src/index.ts:129 

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

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

gqlHashComment?

optional gqlHashComment?: string

Defined in: packages/graphql-tag-pluck/src/index.ts:110 

The #-comment marker looked for at the start of a template literal. Defaults to graphql, which matches #graphql. Set to an empty string to disable.


gqlMagicComment?

optional gqlMagicComment?: string

Defined in: packages/graphql-tag-pluck/src/index.ts:104 

The magic comment anchor to look for when parsing GraphQL strings. Defaults to graphql. Matches a leading block comment before a template literal (for example, GraphQL in slash-star comments).


gqlVueBlock?

optional gqlVueBlock?: string

Defined in: packages/graphql-tag-pluck/src/index.ts:114 

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


isGqlTemplateLiteral?

optional isGqlTemplateLiteral?: (node, options) => boolean | undefined

Defined in: packages/graphql-tag-pluck/src/index.ts:147 

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, or if the template literal starts with a #${gqlHashComment} comment.

Parameters

node

TemplateLiteral | ExpressionStatement

options

Omit<GraphQLTagPluckOptions, "isGqlTemplateLiteral" | "pluckStringFromFile">

Returns

boolean | undefined


modules?

optional modules?: object[]

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

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', }, ]; }

identifier?

optional identifier?: string

name

name: string


pluckStringFromFile?

optional pluckStringFromFile?: (code, node, options) => string | null | undefined

Defined in: packages/graphql-tag-pluck/src/index.ts:137 

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

Parameters

code

string

node

TemplateLiteral

options

Omit<GraphQLTagPluckOptions, "isGqlTemplateLiteral" | "pluckStringFromFile">

Returns

string | null | undefined


skipIndent?

optional skipIndent?: boolean

Defined in: packages/graphql-tag-pluck/src/index.ts:133 

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