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
- canLoad
- canLoadSync
- handleSinglePath
- handleSinglePathSync
- load
- loadSync
- resolveGlobs
- resolveGlobsSync
Constructors
constructor
• new CodeFileLoader(config?
)
Parameters
Name | Type |
---|---|
config? | CodeFileLoaderConfig |
Defined in
packages/loaders/code-file/src/index.ts:72
Methods
canLoad
▸ canLoad(pointer
, options
): Promise
<boolean
>
Parameters
Name | Type |
---|---|
pointer | string |
options | CodeFileLoaderOptions |
Returns
Promise
<boolean
>
Defined in
packages/loaders/code-file/src/index.ts:80
canLoadSync
▸ canLoadSync(pointer
, options
): boolean
Parameters
Name | Type |
---|---|
pointer | string |
options | CodeFileLoaderOptions |
Returns
boolean
Defined in
packages/loaders/code-file/src/index.ts:98
handleSinglePath
▸ handleSinglePath(location
, options
): Promise
<Source
[]>
Parameters
Name | Type |
---|---|
location | string |
options | CodeFileLoaderOptions |
Returns
Promise
<Source
[]>
Defined in
packages/loaders/code-file/src/index.ts:196
handleSinglePathSync
▸ handleSinglePathSync(location
, options
): null
| Source
[]
Parameters
Name | Type |
---|---|
location | string |
options | CodeFileLoaderOptions |
Returns
null
| Source
[]
Defined in
packages/loaders/code-file/src/index.ts:252
load
▸ load(pointer
, options
): Promise
<Source
[]>
Parameters
Name | Type |
---|---|
pointer | string |
options | CodeFileLoaderOptions |
Returns
Promise
<Source
[]>
Implementation of
Defined in
packages/loaders/code-file/src/index.ts:129
loadSync
▸ loadSync(pointer
, options
): null
| Source
[]
Parameters
Name | Type |
---|---|
pointer | string |
options | CodeFileLoaderOptions |
Returns
null
| Source
[]
Implementation of
Defined in
packages/loaders/code-file/src/index.ts:163
resolveGlobs
▸ resolveGlobs(glob
, options
): Promise
<string
[]>
Parameters
Name | Type |
---|---|
glob | string |
options | CodeFileLoaderOptions |
Returns
Promise
<string
[]>
Defined in
packages/loaders/code-file/src/index.ts:117
resolveGlobsSync
▸ resolveGlobsSync(glob
, options
): string
[]
Parameters
Name | Type |
---|---|
glob | string |
options | CodeFileLoaderOptions |
Returns
string
[]