@graphql-tools/jest-transform 1.1.3 → 1.2.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/{index.js → cjs/index.js} +10 -10
- package/cjs/package.json +1 -0
- package/{index.mjs → esm/index.js} +5 -4
- package/package.json +34 -13
- package/{index.d.ts → typings/index.d.ts} +4 -0
- package/README.md +0 -45
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const loader = _interopDefault(require('@graphql-tools/webpack-loader'));
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.process = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const webpack_loader_1 = tslib_1.__importDefault(require("@graphql-tools/webpack-loader"));
|
|
9
6
|
class GraphQLTransformer {
|
|
10
7
|
process(input, _filePath, jestConfig) {
|
|
11
8
|
var _a;
|
|
@@ -13,7 +10,7 @@ class GraphQLTransformer {
|
|
|
13
10
|
// call directly the webpack loader with a mocked context
|
|
14
11
|
// as the loader leverages `this.cacheable()`
|
|
15
12
|
return {
|
|
16
|
-
code:
|
|
13
|
+
code: webpack_loader_1.default.call({
|
|
17
14
|
cacheable() { },
|
|
18
15
|
query: config,
|
|
19
16
|
}, input),
|
|
@@ -27,5 +24,8 @@ function defaultTransformer() {
|
|
|
27
24
|
function process(...args) {
|
|
28
25
|
return defaultTransformer().process(...args);
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
exports.process = process;
|
|
28
|
+
const transformerFactory = {
|
|
29
|
+
process,
|
|
30
|
+
};
|
|
31
|
+
exports.default = transformerFactory;
|
package/cjs/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import loader from '@graphql-tools/webpack-loader';
|
|
2
|
-
|
|
3
2
|
class GraphQLTransformer {
|
|
4
3
|
process(input, _filePath, jestConfig) {
|
|
5
4
|
var _a;
|
|
@@ -18,8 +17,10 @@ let transformer;
|
|
|
18
17
|
function defaultTransformer() {
|
|
19
18
|
return transformer || (transformer = new GraphQLTransformer());
|
|
20
19
|
}
|
|
21
|
-
function process(...args) {
|
|
20
|
+
export function process(...args) {
|
|
22
21
|
return defaultTransformer().process(...args);
|
|
23
22
|
}
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const transformerFactory = {
|
|
24
|
+
process,
|
|
25
|
+
};
|
|
26
|
+
export default transformerFactory;
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/jest-transform",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-alpha-b76ec274.0",
|
|
4
4
|
"description": "Jest Plugin to load and parse imported GraphQL files",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
7
|
-
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
7
|
+
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@graphql-tools/webpack-loader": "6.
|
|
10
|
+
"@graphql-tools/webpack-loader": "6.7.0-alpha-b76ec274.0",
|
|
11
11
|
"@jest/transform": "^28.0.0",
|
|
12
12
|
"@jest/types": "^28.0.0",
|
|
13
|
-
"tslib": "
|
|
13
|
+
"tslib": "^2.4.0"
|
|
14
14
|
},
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
@@ -18,21 +18,42 @@
|
|
|
18
18
|
"directory": "packages/jest-transform"
|
|
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
|
+
}
|
package/README.md
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# GraphQL Jest Transform
|
|
2
|
-
|
|
3
|
-
A Jest transformer to preprocess GraphQL Documents (operations, fragments and SDL)
|
|
4
|
-
|
|
5
|
-
yarn add @graphql-tools/jest-transform
|
|
6
|
-
|
|
7
|
-
In your `package.json`:
|
|
8
|
-
|
|
9
|
-
```json
|
|
10
|
-
{
|
|
11
|
-
"jest": {
|
|
12
|
-
"transform": {
|
|
13
|
-
"\\.(gql|graphql)$": "@graphql-tools/jest-transform"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
or `jest.config.js`:
|
|
20
|
-
|
|
21
|
-
```js
|
|
22
|
-
module.exports = {
|
|
23
|
-
// ...
|
|
24
|
-
transform: {
|
|
25
|
-
'\\.(gql|graphql)$': '@graphql-tools/jest-transform'
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
> How is it different from `jest-transform-graphql`? It doesn't use `graphql-tag/loader` under the hood but our own, more optimized and customisable `@graphql-tools/webpack-loader`.
|
|
31
|
-
|
|
32
|
-
## Options
|
|
33
|
-
|
|
34
|
-
- noDescription (_default: false_) - removes descriptions
|
|
35
|
-
- esModule (_default: false_) - uses import and export statements instead of CommonJS
|
|
36
|
-
|
|
37
|
-
```json
|
|
38
|
-
{
|
|
39
|
-
"globals": {
|
|
40
|
-
"graphql": {
|
|
41
|
-
"noDescription": true
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
```
|