@graphql-tools/jest-transform 1.1.0-alpha-aa385bc9.0 → 1.1.2
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/README.md +4 -4
- package/package.json +4 -3
- package/es5/README.md +0 -45
- package/es5/index.d.ts +0 -10
- package/es5/index.js +0 -38
- package/es5/index.mjs +0 -32
- package/es5/package.json +0 -37
package/README.md
CHANGED
|
@@ -18,13 +18,13 @@ In your `package.json`:
|
|
|
18
18
|
|
|
19
19
|
or `jest.config.js`:
|
|
20
20
|
|
|
21
|
-
```
|
|
21
|
+
```js
|
|
22
22
|
module.exports = {
|
|
23
23
|
// ...
|
|
24
24
|
transform: {
|
|
25
|
-
'\\.(gql|graphql)$': '@graphql-tools/jest-transform'
|
|
26
|
-
}
|
|
27
|
-
}
|
|
25
|
+
'\\.(gql|graphql)$': '@graphql-tools/jest-transform'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
28
|
```
|
|
29
29
|
|
|
30
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`.
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/jest-transform",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Jest Plugin to load and parse imported GraphQL files",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@graphql-tools/webpack-loader": "6.6.
|
|
10
|
+
"@graphql-tools/webpack-loader": "6.6.2",
|
|
11
11
|
"@jest/transform": "^27.0.2",
|
|
12
12
|
"@jest/types": "^27.0.2",
|
|
13
13
|
"tslib": "~2.3.0"
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"./*": {
|
|
33
33
|
"require": "./*.js",
|
|
34
34
|
"import": "./*.mjs"
|
|
35
|
-
}
|
|
35
|
+
},
|
|
36
|
+
"./package.json": "./package.json"
|
|
36
37
|
}
|
|
37
38
|
}
|
package/es5/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
|
-
```javascript
|
|
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
|
-
```
|
package/es5/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import loader from '@graphql-tools/webpack-loader';
|
|
2
|
-
export declare type GraphQLGlobalOptions = ThisParameterType<typeof loader>['query'];
|
|
3
|
-
declare module '@jest/types' {
|
|
4
|
-
namespace Config {
|
|
5
|
-
interface ConfigGlobals {
|
|
6
|
-
graphql: GraphQLGlobalOptions;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export declare function process(...args: any[]): any;
|
package/es5/index.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
|
-
|
|
7
|
-
const tslib = require('tslib');
|
|
8
|
-
const loader = _interopDefault(require('@graphql-tools/webpack-loader/es5'));
|
|
9
|
-
|
|
10
|
-
var GraphQLTransformer = /** @class */ (function () {
|
|
11
|
-
function GraphQLTransformer() {
|
|
12
|
-
}
|
|
13
|
-
GraphQLTransformer.prototype.process = function (input, _filePath, jestConfig) {
|
|
14
|
-
var _a;
|
|
15
|
-
var config = ((_a = jestConfig.config.globals) === null || _a === void 0 ? void 0 : _a['graphql']) || {};
|
|
16
|
-
// call directly the webpack loader with a mocked context
|
|
17
|
-
// as the loader leverages `this.cacheable()`
|
|
18
|
-
return loader.call({
|
|
19
|
-
cacheable: function () { },
|
|
20
|
-
query: config,
|
|
21
|
-
}, input);
|
|
22
|
-
};
|
|
23
|
-
return GraphQLTransformer;
|
|
24
|
-
}());
|
|
25
|
-
var transformer;
|
|
26
|
-
function defaultTransformer() {
|
|
27
|
-
return transformer || (transformer = new GraphQLTransformer());
|
|
28
|
-
}
|
|
29
|
-
function process() {
|
|
30
|
-
var _a;
|
|
31
|
-
var args = [];
|
|
32
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
33
|
-
args[_i] = arguments[_i];
|
|
34
|
-
}
|
|
35
|
-
return (_a = defaultTransformer()).process.apply(_a, tslib.__spreadArray([], tslib.__read(args), false));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
exports.process = process;
|
package/es5/index.mjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { __spreadArray, __read } from 'tslib';
|
|
2
|
-
import loader from '@graphql-tools/webpack-loader/es5';
|
|
3
|
-
|
|
4
|
-
var GraphQLTransformer = /** @class */ (function () {
|
|
5
|
-
function GraphQLTransformer() {
|
|
6
|
-
}
|
|
7
|
-
GraphQLTransformer.prototype.process = function (input, _filePath, jestConfig) {
|
|
8
|
-
var _a;
|
|
9
|
-
var config = ((_a = jestConfig.config.globals) === null || _a === void 0 ? void 0 : _a['graphql']) || {};
|
|
10
|
-
// call directly the webpack loader with a mocked context
|
|
11
|
-
// as the loader leverages `this.cacheable()`
|
|
12
|
-
return loader.call({
|
|
13
|
-
cacheable: function () { },
|
|
14
|
-
query: config,
|
|
15
|
-
}, input);
|
|
16
|
-
};
|
|
17
|
-
return GraphQLTransformer;
|
|
18
|
-
}());
|
|
19
|
-
var transformer;
|
|
20
|
-
function defaultTransformer() {
|
|
21
|
-
return transformer || (transformer = new GraphQLTransformer());
|
|
22
|
-
}
|
|
23
|
-
function process() {
|
|
24
|
-
var _a;
|
|
25
|
-
var args = [];
|
|
26
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
27
|
-
args[_i] = arguments[_i];
|
|
28
|
-
}
|
|
29
|
-
return (_a = defaultTransformer()).process.apply(_a, __spreadArray([], __read(args), false));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { process };
|
package/es5/package.json
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@graphql-tools/jest-transform/es5",
|
|
3
|
-
"version": "1.1.0-alpha-aa385bc9.0",
|
|
4
|
-
"description": "Jest Plugin to load and parse imported GraphQL files",
|
|
5
|
-
"sideEffects": false,
|
|
6
|
-
"peerDependencies": {
|
|
7
|
-
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
8
|
-
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"@graphql-tools/webpack-loader": "6.6.0-alpha-aa385bc9.0",
|
|
11
|
-
"@jest/transform": "^27.0.2",
|
|
12
|
-
"@jest/types": "^27.0.2",
|
|
13
|
-
"tslib": "~2.3.0"
|
|
14
|
-
},
|
|
15
|
-
"repository": {
|
|
16
|
-
"type": "git",
|
|
17
|
-
"url": "git@github.com:ardatan/graphql-tools.git",
|
|
18
|
-
"directory": "packages/jest-transform"
|
|
19
|
-
},
|
|
20
|
-
"license": "MIT",
|
|
21
|
-
"main": "index.js",
|
|
22
|
-
"module": "index.mjs",
|
|
23
|
-
"typings": "index.d.ts",
|
|
24
|
-
"typescript": {
|
|
25
|
-
"definition": "index.d.ts"
|
|
26
|
-
},
|
|
27
|
-
"exports": {
|
|
28
|
-
".": {
|
|
29
|
-
"require": "./index.js",
|
|
30
|
-
"import": "./index.mjs"
|
|
31
|
-
},
|
|
32
|
-
"./*": {
|
|
33
|
-
"require": "./*.js",
|
|
34
|
-
"import": "./*.mjs"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|