UNPKG

1.55 kBTypeScriptView Raw
1import { Source, Loader, BaseLoaderOptions } from '@graphql-tools/utils';
2/**
3 * Additional options for loading from a GraphQL file
4 */
5export interface GraphQLFileLoaderOptions extends BaseLoaderOptions {
6 /**
7 * Set to `true` to disable handling `#import` syntax
8 */
9 skipGraphQLImport?: boolean;
10}
11/**
12 * This loader loads documents and type definitions from `.graphql` files.
13 *
14 * You can load a single source:
15 *
16 * ```js
17 * const schema = await loadSchema('schema.graphql', {
18 * loaders: [
19 * new GraphQLFileLoader()
20 * ]
21 * });
22 * ```
23 *
24 * Or provide a glob pattern to load multiple sources:
25 *
26 * ```js
27 * const schema = await loadSchema('graphql/*.graphql', {
28 * loaders: [
29 * new GraphQLFileLoader()
30 * ]
31 * });
32 * ```
33 */
34export declare class GraphQLFileLoader implements Loader<GraphQLFileLoaderOptions> {
35 canLoad(pointer: string, options: GraphQLFileLoaderOptions): Promise<boolean>;
36 canLoadSync(pointer: string, options: GraphQLFileLoaderOptions): boolean;
37 private _buildGlobs;
38 resolveGlobs(glob: string, options: GraphQLFileLoaderOptions): Promise<string[]>;
39 resolveGlobsSync(glob: string, options: GraphQLFileLoaderOptions): string[];
40 load(pointer: string, options: GraphQLFileLoaderOptions): Promise<Source[]>;
41 loadSync(pointer: string, options: GraphQLFileLoaderOptions): Source[];
42 handleFileContent(rawSDL: string, pointer: string, options: GraphQLFileLoaderOptions): {
43 location: string | undefined;
44 document: import("graphql").DocumentNode;
45 };
46}