@graphql-tools/node-require 6.3.15 → 6.4.0-alpha-b76ec274.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 +27 -0
- package/cjs/package.json +1 -0
- package/{index.mjs → esm/index.js} +5 -6
- package/package.json +34 -13
- package/{index.d.ts → typings/index.d.ts} +0 -0
- package/index.js +0 -28
package/cjs/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/triple-slash-reference */
|
|
3
|
+
/* eslint-disable spaced-comment */
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.registerGraphQLExtensions = exports.handleModule = void 0;
|
|
6
|
+
///<reference path="declarations.d.ts" />
|
|
7
|
+
const load_1 = require("@graphql-tools/load");
|
|
8
|
+
const graphql_file_loader_1 = require("@graphql-tools/graphql-file-loader");
|
|
9
|
+
const graphql_1 = require("graphql");
|
|
10
|
+
const utils_1 = require("@graphql-tools/utils");
|
|
11
|
+
const VALID_EXTENSIONS = ['graphql', 'graphqls', 'gql', 'gqls'];
|
|
12
|
+
function handleModule(m, filename) {
|
|
13
|
+
const sources = (0, load_1.loadTypedefsSync)(filename, {
|
|
14
|
+
loaders: [new graphql_file_loader_1.GraphQLFileLoader()],
|
|
15
|
+
});
|
|
16
|
+
const documents = sources.map(source => source.document).filter(utils_1.isSome);
|
|
17
|
+
const mergedDoc = (0, graphql_1.concatAST)(documents);
|
|
18
|
+
m.exports = mergedDoc;
|
|
19
|
+
}
|
|
20
|
+
exports.handleModule = handleModule;
|
|
21
|
+
function registerGraphQLExtensions(nodeRequire) {
|
|
22
|
+
for (const ext of VALID_EXTENSIONS) {
|
|
23
|
+
nodeRequire.extensions[`.${ext}`] = handleModule;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.registerGraphQLExtensions = registerGraphQLExtensions;
|
|
27
|
+
registerGraphQLExtensions(require);
|
package/cjs/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/triple-slash-reference */
|
|
2
|
+
/* eslint-disable spaced-comment */
|
|
3
|
+
///<reference path="declarations.d.ts" />
|
|
1
4
|
import { loadTypedefsSync } from '@graphql-tools/load';
|
|
2
5
|
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader';
|
|
3
6
|
import { concatAST } from 'graphql';
|
|
4
7
|
import { isSome } from '@graphql-tools/utils';
|
|
5
|
-
|
|
6
|
-
/* eslint-disable @typescript-eslint/triple-slash-reference */
|
|
7
8
|
const VALID_EXTENSIONS = ['graphql', 'graphqls', 'gql', 'gqls'];
|
|
8
|
-
function handleModule(m, filename) {
|
|
9
|
+
export function handleModule(m, filename) {
|
|
9
10
|
const sources = loadTypedefsSync(filename, {
|
|
10
11
|
loaders: [new GraphQLFileLoader()],
|
|
11
12
|
});
|
|
@@ -13,11 +14,9 @@ function handleModule(m, filename) {
|
|
|
13
14
|
const mergedDoc = concatAST(documents);
|
|
14
15
|
m.exports = mergedDoc;
|
|
15
16
|
}
|
|
16
|
-
function registerGraphQLExtensions(nodeRequire) {
|
|
17
|
+
export function registerGraphQLExtensions(nodeRequire) {
|
|
17
18
|
for (const ext of VALID_EXTENSIONS) {
|
|
18
19
|
nodeRequire.extensions[`.${ext}`] = handleModule;
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
registerGraphQLExtensions(require);
|
|
22
|
-
|
|
23
|
-
export { handleModule, registerGraphQLExtensions };
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/node-require",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0-alpha-b76ec274.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/
|
|
11
|
-
"@graphql-tools/
|
|
12
|
-
"@graphql-tools/utils": "8.
|
|
10
|
+
"@graphql-tools/load": "7.7.0-alpha-b76ec274.0",
|
|
11
|
+
"@graphql-tools/graphql-file-loader": "7.4.0-alpha-b76ec274.0",
|
|
12
|
+
"@graphql-tools/utils": "8.8.0-alpha-b76ec274.0",
|
|
13
13
|
"tslib": "^2.4.0"
|
|
14
14
|
},
|
|
15
15
|
"repository": {
|
|
@@ -18,21 +18,42 @@
|
|
|
18
18
|
"directory": "packages/node-require"
|
|
19
19
|
},
|
|
20
20
|
"license": "MIT",
|
|
21
|
-
"main": "index.js",
|
|
22
|
-
"module": "index.
|
|
23
|
-
"typings": "index.d.ts",
|
|
21
|
+
"main": "cjs/index.js",
|
|
22
|
+
"module": "esm/index.js",
|
|
23
|
+
"typings": "typings/index.d.ts",
|
|
24
24
|
"typescript": {
|
|
25
|
-
"definition": "index.d.ts"
|
|
25
|
+
"definition": "typings/index.d.ts"
|
|
26
26
|
},
|
|
27
|
+
"type": "module",
|
|
27
28
|
"exports": {
|
|
28
29
|
".": {
|
|
29
|
-
"require":
|
|
30
|
-
|
|
30
|
+
"require": {
|
|
31
|
+
"types": "./typings/index.d.ts",
|
|
32
|
+
"default": "./cjs/index.js"
|
|
33
|
+
},
|
|
34
|
+
"import": {
|
|
35
|
+
"types": "./typings/index.d.ts",
|
|
36
|
+
"default": "./esm/index.js"
|
|
37
|
+
},
|
|
38
|
+
"default": {
|
|
39
|
+
"types": "./typings/index.d.ts",
|
|
40
|
+
"default": "./esm/index.js"
|
|
41
|
+
}
|
|
31
42
|
},
|
|
32
43
|
"./*": {
|
|
33
|
-
"require":
|
|
34
|
-
|
|
44
|
+
"require": {
|
|
45
|
+
"types": "./typings/*.d.ts",
|
|
46
|
+
"default": "./cjs/*.js"
|
|
47
|
+
},
|
|
48
|
+
"import": {
|
|
49
|
+
"types": "./typings/*.d.ts",
|
|
50
|
+
"default": "./esm/*.js"
|
|
51
|
+
},
|
|
52
|
+
"default": {
|
|
53
|
+
"types": "./typings/*.d.ts",
|
|
54
|
+
"default": "./esm/*.js"
|
|
55
|
+
}
|
|
35
56
|
},
|
|
36
57
|
"./package.json": "./package.json"
|
|
37
58
|
}
|
|
38
|
-
}
|
|
59
|
+
}
|
|
File without changes
|
package/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const load = require('@graphql-tools/load');
|
|
6
|
-
const graphqlFileLoader = require('@graphql-tools/graphql-file-loader');
|
|
7
|
-
const graphql = require('graphql');
|
|
8
|
-
const utils = require('@graphql-tools/utils');
|
|
9
|
-
|
|
10
|
-
/* eslint-disable @typescript-eslint/triple-slash-reference */
|
|
11
|
-
const VALID_EXTENSIONS = ['graphql', 'graphqls', 'gql', 'gqls'];
|
|
12
|
-
function handleModule(m, filename) {
|
|
13
|
-
const sources = load.loadTypedefsSync(filename, {
|
|
14
|
-
loaders: [new graphqlFileLoader.GraphQLFileLoader()],
|
|
15
|
-
});
|
|
16
|
-
const documents = sources.map(source => source.document).filter(utils.isSome);
|
|
17
|
-
const mergedDoc = graphql.concatAST(documents);
|
|
18
|
-
m.exports = mergedDoc;
|
|
19
|
-
}
|
|
20
|
-
function registerGraphQLExtensions(nodeRequire) {
|
|
21
|
-
for (const ext of VALID_EXTENSIONS) {
|
|
22
|
-
nodeRequire.extensions[`.${ext}`] = handleModule;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
registerGraphQLExtensions(require);
|
|
26
|
-
|
|
27
|
-
exports.handleModule = handleModule;
|
|
28
|
-
exports.registerGraphQLExtensions = registerGraphQLExtensions;
|