Catch the highlights of GraphQLConf 2023! Click for recordings. Or check out our recap blog post.
Docs
API Reference
Classes
CodeFileLoader

graphql-tools-monorepo / loaders/code-file/src / CodeFileLoader

Class: CodeFileLoader

loaders/code-file/src.CodeFileLoader

This loader loads GraphQL documents and type definitions from code files using graphql-tag-pluck.

const documents = await loadDocuments('queries/*.js', {
  loaders: [
    new CodeFileLoader()
  ]
});

Supported extensions include: .ts, .mts, .cts, .tsx, .js, .mjs, .cjs, .jsx, .vue, .svelte, .astro

Implements

Table of contents

Constructors

Methods

Constructors

constructor

new CodeFileLoader(config?): CodeFileLoader

Parameters

NameType
config?CodeFileLoaderConfig

Returns

CodeFileLoader

Defined in

packages/loaders/code-file/src/index.ts:83

Methods

canLoad

canLoad(pointer, options): Promise<boolean>

Parameters

NameType
pointerstring
optionsCodeFileLoaderOptions

Returns

Promise<boolean>

Defined in

packages/loaders/code-file/src/index.ts:95


canLoadSync

canLoadSync(pointer, options): boolean

Parameters

NameType
pointerstring
optionsCodeFileLoaderOptions

Returns

boolean

Defined in

packages/loaders/code-file/src/index.ts:115


handleSinglePath

handleSinglePath(location, options): Promise<Source[]>

Parameters

NameType
locationstring
optionsCodeFileLoaderOptions

Returns

Promise<Source[]>

Defined in

packages/loaders/code-file/src/index.ts:215


handleSinglePathSync

handleSinglePathSync(location, options): null | Source[]

Parameters

NameType
locationstring
optionsCodeFileLoaderOptions

Returns

null | Source[]

Defined in

packages/loaders/code-file/src/index.ts:277


load

load(pointer, options): Promise<Source[]>

Parameters

NameType
pointerstring
optionsCodeFileLoaderOptions

Returns

Promise<Source[]>

Implementation of

Loader.load

Defined in

packages/loaders/code-file/src/index.ts:148


loadSync

loadSync(pointer, options): null | Source[]

Parameters

NameType
pointerstring
optionsCodeFileLoaderOptions

Returns

null | Source[]

Implementation of

Loader.loadSync

Defined in

packages/loaders/code-file/src/index.ts:182


resolveGlobs

resolveGlobs(glob, options): Promise<string[]>

Parameters

NameType
globstring
optionsCodeFileLoaderOptions

Returns

Promise<string[]>

Defined in

packages/loaders/code-file/src/index.ts:136


resolveGlobsSync

resolveGlobsSync(glob, options): string[]

Parameters

NameType
globstring
optionsCodeFileLoaderOptions

Returns

string[]

Defined in

packages/loaders/code-file/src/index.ts:142