@graphql-tools/code-file-loader 7.3.2-alpha-33fb2950.0 → 7.3.2-alpha-420b7771.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/exports.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.pickExportFromModuleSync = exports.pickExportFromModule = void 0;
4
- const graphql_1 = require("@graphql-tools/graphql");
4
+ const graphql_1 = require("graphql");
5
5
  const helpers_js_1 = require("./helpers.js");
6
6
  const identifiersToLookFor = ['default', 'schema', 'typeDefs', 'data'];
7
7
  // Pick exports
package/cjs/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CodeFileLoader = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const graphql_1 = require("@graphql-tools/graphql");
5
+ const graphql_1 = require("graphql");
6
6
  const utils_1 = require("@graphql-tools/utils");
7
7
  const graphql_tag_pluck_1 = require("@graphql-tools/graphql-tag-pluck");
8
8
  const globby_1 = tslib_1.__importDefault(require("globby"));
package/esm/exports.js CHANGED
@@ -1,4 +1,4 @@
1
- import { parse, buildClientSchema, isSchema, } from '@graphql-tools/graphql';
1
+ import { parse, buildClientSchema, isSchema } from 'graphql';
2
2
  import { isSchemaAst, isSchemaJson, isSchemaText, isWrappedSchemaJson, pick } from './helpers.js';
3
3
  const identifiersToLookFor = ['default', 'schema', 'typeDefs', 'data'];
4
4
  // Pick exports
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { isSchema, parse } from '@graphql-tools/graphql';
1
+ import { isSchema, parse } from 'graphql';
2
2
  import { asArray, isValidPath, parseGraphQLSDL, isDocumentNode, AggregateError, } from '@graphql-tools/utils';
3
3
  import { gqlPluckFromCodeString, gqlPluckFromCodeStringSync, } from '@graphql-tools/graphql-tag-pluck';
4
4
  import globby from 'globby';
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@graphql-tools/code-file-loader",
3
- "version": "7.3.2-alpha-33fb2950.0",
3
+ "version": "7.3.2-alpha-420b7771.0",
4
4
  "description": "A set of utils for faster development of GraphQL tools",
5
5
  "sideEffects": false,
6
+ "peerDependencies": {
7
+ "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
8
+ },
6
9
  "dependencies": {
7
- "@graphql-tools/utils": "8.9.1-alpha-33fb2950.0",
8
- "@graphql-tools/graphql-tag-pluck": "7.3.2-alpha-33fb2950.0",
9
- "@graphql-tools/graphql": "0.1.0-alpha-33fb2950.0",
10
+ "@graphql-tools/utils": "8.9.1-alpha-420b7771.0",
11
+ "@graphql-tools/graphql-tag-pluck": "7.3.2-alpha-420b7771.0",
10
12
  "globby": "^11.0.3",
11
13
  "tslib": "^2.4.0",
12
14
  "unixify": "^1.0.0"
@@ -28,7 +30,7 @@
28
30
  "exports": {
29
31
  ".": {
30
32
  "require": {
31
- "types": "./typings/index.d.ts",
33
+ "types": "./typings/index.d.cts",
32
34
  "default": "./cjs/index.js"
33
35
  },
34
36
  "import": {
@@ -42,7 +44,7 @@
42
44
  },
43
45
  "./*": {
44
46
  "require": {
45
- "types": "./typings/*.d.ts",
47
+ "types": "./typings/*.d.cts",
46
48
  "default": "./cjs/*.js"
47
49
  },
48
50
  "import": {
@@ -0,0 +1,15 @@
1
+ import { DocumentNode, GraphQLSchema } from 'graphql';
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare function pickExportFromModule({ module, filepath }: {
6
+ module: any;
7
+ filepath: string;
8
+ }): Promise<DocumentNode | GraphQLSchema | null>;
9
+ /**
10
+ * @internal
11
+ */
12
+ export declare function pickExportFromModuleSync({ module, filepath }: {
13
+ module: any;
14
+ filepath: string;
15
+ }): DocumentNode | GraphQLSchema | null;
@@ -1,4 +1,4 @@
1
- import { DocumentNode, GraphQLSchema } from '@graphql-tools/graphql';
1
+ import { DocumentNode, GraphQLSchema } from 'graphql';
2
2
  /**
3
3
  * @internal
4
4
  */
@@ -0,0 +1,23 @@
1
+ import { DocumentNode, IntrospectionQuery } from 'graphql';
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare function pick<T>(obj: any, keys: string[]): T;
6
+ /**
7
+ * @internal
8
+ */
9
+ export declare function isSchemaText(obj: any): obj is string;
10
+ /**
11
+ * @internal
12
+ */
13
+ export declare function isWrappedSchemaJson(obj: any): obj is {
14
+ data: IntrospectionQuery;
15
+ };
16
+ /**
17
+ * @internal
18
+ */
19
+ export declare function isSchemaJson(obj: any): obj is IntrospectionQuery;
20
+ /**
21
+ * @internal
22
+ */
23
+ export declare function isSchemaAst(obj: any): obj is DocumentNode;
@@ -1,4 +1,4 @@
1
- import { DocumentNode, IntrospectionQuery } from '@graphql-tools/graphql';
1
+ import { DocumentNode, IntrospectionQuery } from 'graphql';
2
2
  /**
3
3
  * @internal
4
4
  */
@@ -0,0 +1,45 @@
1
+ import { Source, BaseLoaderOptions, Loader } from '@graphql-tools/utils';
2
+ import { GraphQLTagPluckOptions } from '@graphql-tools/graphql-tag-pluck';
3
+ export declare type CodeFileLoaderConfig = {
4
+ pluckConfig?: GraphQLTagPluckOptions;
5
+ noPluck?: boolean;
6
+ noRequire?: boolean;
7
+ /**
8
+ * Set to `true` to raise errors if any matched files are not valid GraphQL
9
+ */
10
+ noSilentErrors?: boolean;
11
+ };
12
+ /**
13
+ * Additional options for loading from a code file
14
+ */
15
+ export declare type CodeFileLoaderOptions = {
16
+ require?: string | string[];
17
+ } & CodeFileLoaderConfig & BaseLoaderOptions;
18
+ /**
19
+ * This loader loads GraphQL documents and type definitions from code files
20
+ * using `graphql-tag-pluck`.
21
+ *
22
+ * ```js
23
+ * const documents = await loadDocuments('queries/*.js', {
24
+ * loaders: [
25
+ * new CodeFileLoader()
26
+ * ]
27
+ * });
28
+ * ```
29
+ *
30
+ * Supported extensions include: `.ts`, `.tsx`, `.js`, `.jsx`, `.vue`, `.svelte`
31
+ */
32
+ export declare class CodeFileLoader implements Loader<CodeFileLoaderOptions> {
33
+ private config;
34
+ constructor(config?: CodeFileLoaderConfig);
35
+ private getMergedOptions;
36
+ canLoad(pointer: string, options: CodeFileLoaderOptions): Promise<boolean>;
37
+ canLoadSync(pointer: string, options: CodeFileLoaderOptions): boolean;
38
+ private _buildGlobs;
39
+ resolveGlobs(glob: string, options: CodeFileLoaderOptions): Promise<string[]>;
40
+ resolveGlobsSync(glob: string, options: CodeFileLoaderOptions): string[];
41
+ load(pointer: string, options: CodeFileLoaderOptions): Promise<Source[]>;
42
+ loadSync(pointer: string, options: CodeFileLoaderOptions): Source[] | null;
43
+ handleSinglePath(location: string, options: CodeFileLoaderOptions): Promise<Source[]>;
44
+ handleSinglePathSync(location: string, options: CodeFileLoaderOptions): Source[] | null;
45
+ }
@@ -0,0 +1,9 @@
1
+ import { DocumentNode, GraphQLSchema } from 'graphql';
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare function tryToLoadFromExport(rawFilePath: string): Promise<GraphQLSchema | DocumentNode | null>;
6
+ /**
7
+ * @internal
8
+ */
9
+ export declare function tryToLoadFromExportSync(rawFilePath: string): GraphQLSchema | DocumentNode | null;
@@ -1,4 +1,4 @@
1
- import { DocumentNode, GraphQLSchema } from '@graphql-tools/graphql';
1
+ import { DocumentNode, GraphQLSchema } from 'graphql';
2
2
  /**
3
3
  * @internal
4
4
  */