@graphql-tools/import 6.7.2-alpha-33fb2950.0 → 6.7.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/index.js +1 -1
- package/esm/index.js +1 -1
- package/package.json +4 -4
- package/typings/index.d.cts +34 -0
- package/typings/index.d.ts +1 -1
package/cjs/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseImportLine = exports.extractImportLines = exports.processImports = exports.extractDependencies = exports.processImport = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const graphql_1 = require("
|
|
5
|
+
const graphql_1 = require("graphql");
|
|
6
6
|
const fs_1 = require("fs");
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const resolve_from_1 = tslib_1.__importDefault(require("resolve-from"));
|
package/esm/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/import",
|
|
3
|
-
"version": "6.7.2-alpha-
|
|
3
|
+
"version": "6.7.2-alpha-420b7771.0",
|
|
4
4
|
"description": "A set of utils for faster development of GraphQL tools",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@graphql-tools/utils": "8.9.1-alpha-
|
|
10
|
+
"@graphql-tools/utils": "8.9.1-alpha-420b7771.0",
|
|
11
11
|
"resolve-from": "5.0.0",
|
|
12
12
|
"tslib": "^2.4.0"
|
|
13
13
|
},
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"exports": {
|
|
29
29
|
".": {
|
|
30
30
|
"require": {
|
|
31
|
-
"types": "./typings/index.d.
|
|
31
|
+
"types": "./typings/index.d.cts",
|
|
32
32
|
"default": "./cjs/index.js"
|
|
33
33
|
},
|
|
34
34
|
"import": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"./*": {
|
|
44
44
|
"require": {
|
|
45
|
-
"types": "./typings/*.d.
|
|
45
|
+
"types": "./typings/*.d.cts",
|
|
46
46
|
"default": "./cjs/*.js"
|
|
47
47
|
},
|
|
48
48
|
"import": {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DefinitionNode, DocumentNode } from 'graphql';
|
|
2
|
+
export declare type VisitedFilesMap = Map<string, Map<string, Set<DefinitionNode>>>;
|
|
3
|
+
/**
|
|
4
|
+
* Loads the GraphQL document and recursively resolves all the imports
|
|
5
|
+
* and copies them into the final document.
|
|
6
|
+
* processImport does not merge the typeDefs as designed ( https://github.com/ardatan/graphql-tools/issues/2980#issuecomment-1003692728 )
|
|
7
|
+
*/
|
|
8
|
+
export declare function processImport(filePath: string, cwd?: string, predefinedImports?: Record<string, string>, visitedFiles?: VisitedFilesMap): DocumentNode;
|
|
9
|
+
export declare function extractDependencies(filePath: string, fileContents: string): {
|
|
10
|
+
definitionsByName: Map<string, Set<DefinitionNode>>;
|
|
11
|
+
dependenciesByDefinitionName: Map<string, Set<string>>;
|
|
12
|
+
};
|
|
13
|
+
export declare function processImports(importLines: string[], filePath: string, visitedFiles: VisitedFilesMap, predefinedImports: Record<string, string>): {
|
|
14
|
+
allImportedDefinitionsMap: Map<string, Set<DefinitionNode>>;
|
|
15
|
+
potentialTransitiveDefinitionsMap: Map<string, Set<DefinitionNode>>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Splits the contents of a GraphQL file into lines that are imports
|
|
19
|
+
* and other lines which define the actual GraphQL document.
|
|
20
|
+
*/
|
|
21
|
+
export declare function extractImportLines(fileContent: string): {
|
|
22
|
+
importLines: string[];
|
|
23
|
+
otherLines: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Parses an import line, returning a list of entities imported and the file
|
|
27
|
+
* from which they are imported.
|
|
28
|
+
*
|
|
29
|
+
* Throws if the import line does not have a correct format.
|
|
30
|
+
*/
|
|
31
|
+
export declare function parseImportLine(importLine: string): {
|
|
32
|
+
imports: string[];
|
|
33
|
+
from: string;
|
|
34
|
+
};
|
package/typings/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DefinitionNode, DocumentNode } from '
|
|
1
|
+
import { DefinitionNode, DocumentNode } from 'graphql';
|
|
2
2
|
export declare type VisitedFilesMap = Map<string, Map<string, Set<DefinitionNode>>>;
|
|
3
3
|
/**
|
|
4
4
|
* Loads the GraphQL document and recursively resolves all the imports
|