@graphql-codegen/jsdoc 2.2.14 → 2.3.0-alpha-bd464a586.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.
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const visitorPluginCommon = require('@graphql-codegen/visitor-plugin-common');
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.plugin = void 0;
|
|
4
|
+
const plugin_helpers_1 = require("@graphql-codegen/plugin-helpers");
|
|
5
|
+
const graphql_1 = require("graphql");
|
|
6
|
+
const visitor_plugin_common_1 = require("@graphql-codegen/visitor-plugin-common");
|
|
9
7
|
const transformScalar = (scalar) => {
|
|
10
|
-
if (
|
|
8
|
+
if (visitor_plugin_common_1.DEFAULT_SCALARS[scalar] === undefined) {
|
|
11
9
|
return scalar;
|
|
12
10
|
}
|
|
13
|
-
return
|
|
11
|
+
return visitor_plugin_common_1.DEFAULT_SCALARS[scalar];
|
|
14
12
|
};
|
|
15
13
|
const createDocBlock = (lines) => {
|
|
16
14
|
const typedef = [
|
|
@@ -32,10 +30,10 @@ const createDescriptionBlock = (nodeWithDesc) => {
|
|
|
32
30
|
return '';
|
|
33
31
|
};
|
|
34
32
|
const plugin = (schema, documents) => {
|
|
35
|
-
const parsedSchema =
|
|
33
|
+
const parsedSchema = (0, plugin_helpers_1.getCachedDocumentNodeFromSchema)(schema);
|
|
36
34
|
const mappedDocuments = documents.map(document => document.document).filter(document => document !== undefined);
|
|
37
|
-
const ast =
|
|
38
|
-
const schemaTypes =
|
|
35
|
+
const ast = (0, graphql_1.concatAST)([parsedSchema, ...mappedDocuments]);
|
|
36
|
+
const schemaTypes = (0, graphql_1.visit)(ast, {
|
|
39
37
|
Document: {
|
|
40
38
|
leave(node) {
|
|
41
39
|
return node.definitions;
|
|
@@ -187,5 +185,4 @@ const plugin = (schema, documents) => {
|
|
|
187
185
|
});
|
|
188
186
|
return schemaTypes.join('\n\n');
|
|
189
187
|
};
|
|
190
|
-
|
|
191
188
|
exports.plugin = plugin;
|
package/cjs/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { getCachedDocumentNodeFromSchema } from '@graphql-codegen/plugin-helpers';
|
|
2
|
-
import { concatAST,
|
|
2
|
+
import { visit, concatAST, } from 'graphql';
|
|
3
3
|
import { DEFAULT_SCALARS } from '@graphql-codegen/visitor-plugin-common';
|
|
4
|
-
|
|
5
4
|
const transformScalar = (scalar) => {
|
|
6
5
|
if (DEFAULT_SCALARS[scalar] === undefined) {
|
|
7
6
|
return scalar;
|
|
@@ -27,7 +26,7 @@ const createDescriptionBlock = (nodeWithDesc) => {
|
|
|
27
26
|
}
|
|
28
27
|
return '';
|
|
29
28
|
};
|
|
30
|
-
const plugin = (schema, documents) => {
|
|
29
|
+
export const plugin = (schema, documents) => {
|
|
31
30
|
const parsedSchema = getCachedDocumentNodeFromSchema(schema);
|
|
32
31
|
const mappedDocuments = documents.map(document => document.document).filter(document => document !== undefined);
|
|
33
32
|
const ast = concatAST([parsedSchema, ...mappedDocuments]);
|
|
@@ -183,5 +182,3 @@ const plugin = (schema, documents) => {
|
|
|
183
182
|
});
|
|
184
183
|
return schemaTypes.join('\n\n');
|
|
185
184
|
};
|
|
186
|
-
|
|
187
|
-
export { plugin };
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/jsdoc",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0-alpha-bd464a586.0",
|
|
4
4
|
"description": "GraphQL Code Generator plugin for generating JSDoc based types for GraphQL queries, mutations, subscriptions and fragments",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"graphql": "^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@graphql-codegen/plugin-helpers": "^2.
|
|
10
|
-
"@graphql-codegen/visitor-plugin-common": "2.
|
|
9
|
+
"@graphql-codegen/plugin-helpers": "^2.5.0-alpha-bd464a586.0",
|
|
10
|
+
"@graphql-codegen/visitor-plugin-common": "2.11.0-alpha-bd464a586.0",
|
|
11
11
|
"tslib": "~2.4.0"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
@@ -16,21 +16,28 @@
|
|
|
16
16
|
"directory": "packages/plugins/typescript/typescript"
|
|
17
17
|
},
|
|
18
18
|
"license": "MIT",
|
|
19
|
-
"main": "index.js",
|
|
20
|
-
"module": "index.
|
|
21
|
-
"typings": "index.d.ts",
|
|
19
|
+
"main": "cjs/index.js",
|
|
20
|
+
"module": "esm/index.js",
|
|
21
|
+
"typings": "typings/index.d.ts",
|
|
22
22
|
"typescript": {
|
|
23
|
-
"definition": "index.d.ts"
|
|
23
|
+
"definition": "typings/index.d.ts"
|
|
24
24
|
},
|
|
25
|
+
"type": "module",
|
|
25
26
|
"exports": {
|
|
26
|
-
"./package.json": "./package.json",
|
|
27
27
|
".": {
|
|
28
|
-
"require":
|
|
29
|
-
|
|
28
|
+
"require": {
|
|
29
|
+
"types": "./typings/index.d.ts",
|
|
30
|
+
"default": "./cjs/index.js"
|
|
31
|
+
},
|
|
32
|
+
"import": {
|
|
33
|
+
"types": "./typings/index.d.ts",
|
|
34
|
+
"default": "./esm/index.js"
|
|
35
|
+
},
|
|
36
|
+
"default": {
|
|
37
|
+
"types": "./typings/index.d.ts",
|
|
38
|
+
"default": "./esm/index.js"
|
|
39
|
+
}
|
|
30
40
|
},
|
|
31
|
-
"
|
|
32
|
-
"require": "./*.js",
|
|
33
|
-
"import": "./*.mjs"
|
|
34
|
-
}
|
|
41
|
+
"./package.json": "./package.json"
|
|
35
42
|
}
|
|
36
|
-
}
|
|
43
|
+
}
|
|
File without changes
|