Docs
API Reference
Classes
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, .tsx, .js, .jsx, .vue, .svelte

Implements

Table of contents

Constructors

Methods

Constructors

constructor

new CodeFileLoader(config?)

Parameters

NameType
config?CodeFileLoaderConfig

Defined in

packages/loaders/code-file/src/index.ts:72 (opens in a new tab)

Methods

canLoad

canLoad(pointer, options): Promise<boolean>

Parameters

NameType
pointerstring
optionsCodeFileLoaderOptions

Returns

Promise<boolean>

Defined in

packages/loaders/code-file/src/index.ts:84 (opens in a new tab)


canLoadSync

canLoadSync(pointer, options): boolean

Parameters

NameType
pointerstring
optionsCodeFileLoaderOptions

Returns

boolean

Defined in

packages/loaders/code-file/src/index.ts:102 (opens in a new tab)


handleSinglePath

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

Parameters

NameType
locationstring
optionsCodeFileLoaderOptions

Returns

Promise<Source[]>

Defined in

packages/loaders/code-file/src/index.ts:200 (opens in a new tab)


handleSinglePathSync

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

Parameters

NameType
locationstring
optionsCodeFileLoaderOptions

Returns

null | Source[]

Defined in

packages/loaders/code-file/src/index.ts:256 (opens in a new tab)


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:133 (opens in a new tab)


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:167 (opens in a new tab)


resolveGlobs

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

Parameters

NameType
globstring
optionsCodeFileLoaderOptions

Returns

Promise<string[]>

Defined in

packages/loaders/code-file/src/index.ts:121 (opens in a new tab)


resolveGlobsSync

resolveGlobsSync(glob, options): string[]

Parameters

NameType
globstring
optionsCodeFileLoaderOptions

Returns

string[]

Defined in

packages/loaders/code-file/src/index.ts:127 (opens in a new tab)