@mo36924/babel-plugin-graphql-tagged-template 1.5.21 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +1 -1
- package/dist/index.cjs +31 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.js +32 -52
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -52
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -10
package/LICENSE
CHANGED
package/dist/index.cjs
CHANGED
@@ -1,50 +1,40 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
const
|
4
|
-
const
|
5
|
-
const
|
3
|
+
const fs = require('fs');
|
4
|
+
const base52 = require('@mo36924/base52');
|
5
|
+
const graphqlSchema = require('@mo36924/graphql-schema');
|
6
6
|
const graphql = require('graphql');
|
7
7
|
|
8
|
-
let _schema;
|
9
8
|
const index = ({ types: t }, options) => {
|
10
|
-
let schema
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
9
|
+
let schema;
|
10
|
+
if (options.model) {
|
11
|
+
const model = fs.readFileSync(options.model || "index.graphql", "utf8");
|
12
|
+
schema = graphqlSchema.buildSchemaModel(model);
|
13
|
+
}
|
14
|
+
else if (typeof options.schema === "string") {
|
15
|
+
const graphqlSchema$1 = fs.readFileSync(options.schema || "index.graphql", "utf8");
|
16
|
+
schema = graphqlSchema.buildSchema(graphqlSchema$1);
|
17
|
+
}
|
18
|
+
else if (options.schema) {
|
19
|
+
schema = options.schema;
|
20
|
+
}
|
19
21
|
return {
|
20
|
-
name: "graphql-tagged-template",
|
21
22
|
visitor: {
|
22
|
-
TaggedTemplateExpression(path
|
23
|
+
TaggedTemplateExpression(path) {
|
23
24
|
const { tag, quasi: { quasis, expressions }, } = path.node;
|
24
25
|
if (!t.isIdentifier(tag)) {
|
25
26
|
return;
|
26
27
|
}
|
27
28
|
const name = tag.name;
|
28
|
-
|
29
|
-
|
30
|
-
case "gql":
|
31
|
-
case "query":
|
32
|
-
case "useQuery":
|
33
|
-
break;
|
34
|
-
case "mutation":
|
35
|
-
case "useMutation":
|
36
|
-
operation = "mutation";
|
37
|
-
break;
|
38
|
-
case "subscription":
|
39
|
-
case "useSubscription":
|
40
|
-
operation = "subscription";
|
41
|
-
break;
|
42
|
-
default:
|
43
|
-
return;
|
29
|
+
if (name !== "gql" && name !== "query" && name !== "mutation" && name !== "subscription") {
|
30
|
+
return;
|
44
31
|
}
|
45
|
-
let query =
|
32
|
+
let query = quasis[0].value.cooked ?? quasis[0].value.raw;
|
46
33
|
for (let i = 0; i < expressions.length; i++) {
|
47
|
-
query +=
|
34
|
+
query += `$${base52.encode(i)}${quasis[i + 1].value.cooked ?? quasis[i + 1].value.raw}`;
|
35
|
+
}
|
36
|
+
if (name === "mutation" || name === "subscription") {
|
37
|
+
query = name + query;
|
48
38
|
}
|
49
39
|
let documentNode;
|
50
40
|
try {
|
@@ -61,16 +51,16 @@ const index = ({ types: t }, options) => {
|
|
61
51
|
},
|
62
52
|
}));
|
63
53
|
if (values.length) {
|
64
|
-
const variables = `(${values.map((value, i) =>
|
65
|
-
if (
|
66
|
-
query =
|
54
|
+
const variables = `(${values.map((value, i) => `$${base52.encode(i)}:${value}`).join()})`;
|
55
|
+
if (name === "query") {
|
56
|
+
query = name + variables + query;
|
67
57
|
}
|
68
|
-
else if (name
|
69
|
-
query =
|
58
|
+
else if (name === "mutation" || name === "subscription") {
|
59
|
+
query = name + variables + query.slice(name.length);
|
70
60
|
}
|
71
61
|
}
|
72
62
|
try {
|
73
|
-
documentNode = graphql.parse(query
|
63
|
+
documentNode = graphql.parse(query);
|
74
64
|
}
|
75
65
|
catch (err) {
|
76
66
|
throw path.buildCodeFrameError(String(err));
|
@@ -79,19 +69,9 @@ const index = ({ types: t }, options) => {
|
|
79
69
|
if (errors.length) {
|
80
70
|
throw path.buildCodeFrameError(errors[0].message);
|
81
71
|
}
|
82
|
-
const args = [];
|
83
|
-
if (options.parse) {
|
84
|
-
const id = path.scope.generateUid("gql");
|
85
|
-
path.scope.getProgramParent().push({ kind: "let", id: t.identifier(id) });
|
86
|
-
args.push(t.assignmentExpression("||=", t.identifier(id), t.callExpression(t.memberExpression(t.identifier("JSON"), t.identifier("parse")), [
|
87
|
-
t.stringLiteral(JSON.stringify(documentNode)),
|
88
|
-
])));
|
89
|
-
}
|
90
|
-
else {
|
91
|
-
args.push(t.stringLiteral(graphql.stripIgnoredCharacters(query)));
|
92
|
-
}
|
72
|
+
const args = [t.stringLiteral(graphql.stripIgnoredCharacters(query))];
|
93
73
|
if (expressions.length) {
|
94
|
-
args.push(t.
|
74
|
+
args.push(t.objectExpression(expressions.map((expression, i) => t.objectProperty(t.identifier(base52.encode(i)), expression))));
|
95
75
|
}
|
96
76
|
path.replaceWith(t.callExpression(t.identifier(name), args));
|
97
77
|
},
|
package/dist/index.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import { readFileSync } from \"fs\";\nimport type { PluginObj, default as babel, types as t } from \"@babel/core\";\nimport { encode } from \"@mo36924/base52\";\nimport { buildSchema, buildSchemaModel } from \"@mo36924/graphql-schema\";\nimport {\n DocumentNode,\n GraphQLInputType,\n GraphQLSchema,\n TypeInfo,\n parse,\n stripIgnoredCharacters,\n validate,\n visit,\n visitWithTypeInfo,\n} from \"graphql\";\n\nexport type Options = {\n model: string;\n schema: string | GraphQLSchema;\n};\n\nexport default ({ types: t }: typeof babel, options: Options): PluginObj => {\n let schema: GraphQLSchema;\n\n if (options.model) {\n const model = readFileSync(options.model || \"index.graphql\", \"utf8\");\n schema = buildSchemaModel(model);\n } else if (typeof options.schema === \"string\") {\n const graphqlSchema = readFileSync(options.schema || \"index.graphql\", \"utf8\");\n schema = buildSchema(graphqlSchema);\n } else if (options.schema) {\n schema = options.schema;\n }\n\n return {\n visitor: {\n TaggedTemplateExpression(path) {\n const {\n tag,\n quasi: { quasis, expressions },\n } = path.node;\n\n if (!t.isIdentifier(tag)) {\n return;\n }\n\n const name = tag.name;\n\n if (name !== \"gql\" && name !== \"query\" && name !== \"mutation\" && name !== \"subscription\") {\n return;\n }\n\n let query = quasis[0].value.cooked ?? quasis[0].value.raw;\n\n for (let i = 0; i < expressions.length; i++) {\n query += `$${encode(i)}${quasis[i + 1].value.cooked ?? quasis[i + 1].value.raw}`;\n }\n\n if (name === \"mutation\" || name === \"subscription\") {\n query = name + query;\n }\n\n let documentNode: DocumentNode;\n\n try {\n documentNode = parse(query);\n } catch (err) {\n throw path.buildCodeFrameError(String(err));\n }\n\n const values: GraphQLInputType[] = [];\n const typeInfo = new TypeInfo(schema);\n\n visit(\n documentNode,\n visitWithTypeInfo(typeInfo, {\n Variable() {\n values.push(typeInfo.getInputType()!);\n },\n }),\n );\n\n if (values.length) {\n const variables = `(${values.map((value, i) => `$${encode(i)}:${value}`).join()})`;\n\n if (name === \"query\") {\n query = name + variables + query;\n } else if (name === \"mutation\" || name === \"subscription\") {\n query = name + variables + query.slice(name.length);\n }\n }\n\n try {\n documentNode = parse(query);\n } catch (err) {\n throw path.buildCodeFrameError(String(err));\n }\n\n const errors = validate(schema, documentNode);\n\n if (errors.length) {\n throw path.buildCodeFrameError(errors[0].message);\n }\n\n const args: t.Expression[] = [t.stringLiteral(stripIgnoredCharacters(query))];\n\n if (expressions.length) {\n args.push(\n t.objectExpression(\n expressions.map((expression, i) => t.objectProperty(t.identifier(encode(i)), expression as any)),\n ),\n );\n }\n\n path.replaceWith(t.callExpression(t.identifier(name), args));\n },\n },\n };\n};\n"],"names":["readFileSync","buildSchemaModel","graphqlSchema","buildSchema","encode","parse","TypeInfo","visit","visitWithTypeInfo","validate","stripIgnoredCharacters"],"mappings":";;;;;;;AAqBA,cAAe,CAAC,EAAE,KAAK,EAAE,CAAC,EAAgB,EAAE,OAAgB;IAC1D,IAAI,MAAqB,CAAC;IAE1B,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;iBAC7B;gBAAC,OAAO,GAAG,EAAE;oBACZ,MAAM,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;iBAC7C;gBAED,MAAM,MAAM,GAAGI,gBAAQ,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;gBAE9C,IAAI,MAAM,CAAC,MAAM,EAAE;oBACjB,MAAM,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;iBACnD;gBAED,MAAM,IAAI,GAAmB,CAAC,CAAC,CAAC,aAAa,CAACC,8BAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAE9E,IAAI,WAAW,CAAC,MAAM,EAAE;oBACtB,IAAI,CAAC,IAAI,CACP,CAAC,CAAC,gBAAgB,CAChB,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU,CAACN,aAAM,CAAC,CAAC,CAAC,CAAC,EAAE,UAAiB,CAAC,CAAC,CACjG,CACF,CAAC;iBACH;gBAED,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;aAC9D;SACF;KACF,CAAC;AACJ,CAAC;;;;"}
|
package/dist/index.d.ts
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
import babel, { PluginObj } from '@babel/core';
|
2
|
-
import {
|
2
|
+
import { GraphQLSchema } from 'graphql';
|
3
3
|
|
4
4
|
declare type Options = {
|
5
|
-
model
|
6
|
-
schema
|
7
|
-
parse?: boolean;
|
5
|
+
model: string;
|
6
|
+
schema: string | GraphQLSchema;
|
8
7
|
};
|
9
8
|
declare const _default: ({ types: t }: typeof babel, options: Options) => PluginObj;
|
10
9
|
|
package/dist/index.js
CHANGED
@@ -1,48 +1,38 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
1
|
+
import { readFileSync } from 'fs';
|
2
|
+
import { encode } from '@mo36924/base52';
|
3
|
+
import { buildSchemaModel, buildSchema } from '@mo36924/graphql-schema';
|
4
|
+
import { parse, TypeInfo, visit, visitWithTypeInfo, validate, stripIgnoredCharacters } from 'graphql';
|
5
5
|
|
6
|
-
let _schema;
|
7
6
|
const index = ({ types: t }, options) => {
|
8
|
-
let schema
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
7
|
+
let schema;
|
8
|
+
if (options.model) {
|
9
|
+
const model = readFileSync(options.model || "index.graphql", "utf8");
|
10
|
+
schema = buildSchemaModel(model);
|
11
|
+
}
|
12
|
+
else if (typeof options.schema === "string") {
|
13
|
+
const graphqlSchema = readFileSync(options.schema || "index.graphql", "utf8");
|
14
|
+
schema = buildSchema(graphqlSchema);
|
15
|
+
}
|
16
|
+
else if (options.schema) {
|
17
|
+
schema = options.schema;
|
18
|
+
}
|
17
19
|
return {
|
18
|
-
name: "graphql-tagged-template",
|
19
20
|
visitor: {
|
20
|
-
TaggedTemplateExpression(path
|
21
|
+
TaggedTemplateExpression(path) {
|
21
22
|
const { tag, quasi: { quasis, expressions }, } = path.node;
|
22
23
|
if (!t.isIdentifier(tag)) {
|
23
24
|
return;
|
24
25
|
}
|
25
26
|
const name = tag.name;
|
26
|
-
|
27
|
-
|
28
|
-
case "gql":
|
29
|
-
case "query":
|
30
|
-
case "useQuery":
|
31
|
-
break;
|
32
|
-
case "mutation":
|
33
|
-
case "useMutation":
|
34
|
-
operation = "mutation";
|
35
|
-
break;
|
36
|
-
case "subscription":
|
37
|
-
case "useSubscription":
|
38
|
-
operation = "subscription";
|
39
|
-
break;
|
40
|
-
default:
|
41
|
-
return;
|
27
|
+
if (name !== "gql" && name !== "query" && name !== "mutation" && name !== "subscription") {
|
28
|
+
return;
|
42
29
|
}
|
43
|
-
let query =
|
30
|
+
let query = quasis[0].value.cooked ?? quasis[0].value.raw;
|
44
31
|
for (let i = 0; i < expressions.length; i++) {
|
45
|
-
query +=
|
32
|
+
query += `$${encode(i)}${quasis[i + 1].value.cooked ?? quasis[i + 1].value.raw}`;
|
33
|
+
}
|
34
|
+
if (name === "mutation" || name === "subscription") {
|
35
|
+
query = name + query;
|
46
36
|
}
|
47
37
|
let documentNode;
|
48
38
|
try {
|
@@ -59,16 +49,16 @@ const index = ({ types: t }, options) => {
|
|
59
49
|
},
|
60
50
|
}));
|
61
51
|
if (values.length) {
|
62
|
-
const variables = `(${values.map((value, i) =>
|
63
|
-
if (
|
64
|
-
query =
|
52
|
+
const variables = `(${values.map((value, i) => `$${encode(i)}:${value}`).join()})`;
|
53
|
+
if (name === "query") {
|
54
|
+
query = name + variables + query;
|
65
55
|
}
|
66
|
-
else if (name
|
67
|
-
query =
|
56
|
+
else if (name === "mutation" || name === "subscription") {
|
57
|
+
query = name + variables + query.slice(name.length);
|
68
58
|
}
|
69
59
|
}
|
70
60
|
try {
|
71
|
-
documentNode = parse(query
|
61
|
+
documentNode = parse(query);
|
72
62
|
}
|
73
63
|
catch (err) {
|
74
64
|
throw path.buildCodeFrameError(String(err));
|
@@ -77,19 +67,9 @@ const index = ({ types: t }, options) => {
|
|
77
67
|
if (errors.length) {
|
78
68
|
throw path.buildCodeFrameError(errors[0].message);
|
79
69
|
}
|
80
|
-
const args = [];
|
81
|
-
if (options.parse) {
|
82
|
-
const id = path.scope.generateUid("gql");
|
83
|
-
path.scope.getProgramParent().push({ kind: "let", id: t.identifier(id) });
|
84
|
-
args.push(t.assignmentExpression("||=", t.identifier(id), t.callExpression(t.memberExpression(t.identifier("JSON"), t.identifier("parse")), [
|
85
|
-
t.stringLiteral(JSON.stringify(documentNode)),
|
86
|
-
])));
|
87
|
-
}
|
88
|
-
else {
|
89
|
-
args.push(t.stringLiteral(stripIgnoredCharacters(query)));
|
90
|
-
}
|
70
|
+
const args = [t.stringLiteral(stripIgnoredCharacters(query))];
|
91
71
|
if (expressions.length) {
|
92
|
-
args.push(t.
|
72
|
+
args.push(t.objectExpression(expressions.map((expression, i) => t.objectProperty(t.identifier(encode(i)), expression))));
|
93
73
|
}
|
94
74
|
path.replaceWith(t.callExpression(t.identifier(name), args));
|
95
75
|
},
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { readFileSync } from \"fs\";\nimport type { PluginObj, default as babel, types as t } from \"@babel/core\";\nimport { encode } from \"@mo36924/base52\";\nimport { buildSchema, buildSchemaModel } from \"@mo36924/graphql-schema\";\nimport {\n DocumentNode,\n GraphQLInputType,\n GraphQLSchema,\n TypeInfo,\n parse,\n stripIgnoredCharacters,\n validate,\n visit,\n visitWithTypeInfo,\n} from \"graphql\";\n\nexport type Options = {\n model: string;\n schema: string | GraphQLSchema;\n};\n\nexport default ({ types: t }: typeof babel, options: Options): PluginObj => {\n let schema: GraphQLSchema;\n\n if (options.model) {\n const model = readFileSync(options.model || \"index.graphql\", \"utf8\");\n schema = buildSchemaModel(model);\n } else if (typeof options.schema === \"string\") {\n const graphqlSchema = readFileSync(options.schema || \"index.graphql\", \"utf8\");\n schema = buildSchema(graphqlSchema);\n } else if (options.schema) {\n schema = options.schema;\n }\n\n return {\n visitor: {\n TaggedTemplateExpression(path) {\n const {\n tag,\n quasi: { quasis, expressions },\n } = path.node;\n\n if (!t.isIdentifier(tag)) {\n return;\n }\n\n const name = tag.name;\n\n if (name !== \"gql\" && name !== \"query\" && name !== \"mutation\" && name !== \"subscription\") {\n return;\n }\n\n let query = quasis[0].value.cooked ?? quasis[0].value.raw;\n\n for (let i = 0; i < expressions.length; i++) {\n query += `$${encode(i)}${quasis[i + 1].value.cooked ?? quasis[i + 1].value.raw}`;\n }\n\n if (name === \"mutation\" || name === \"subscription\") {\n query = name + query;\n }\n\n let documentNode: DocumentNode;\n\n try {\n documentNode = parse(query);\n } catch (err) {\n throw path.buildCodeFrameError(String(err));\n }\n\n const values: GraphQLInputType[] = [];\n const typeInfo = new TypeInfo(schema);\n\n visit(\n documentNode,\n visitWithTypeInfo(typeInfo, {\n Variable() {\n values.push(typeInfo.getInputType()!);\n },\n }),\n );\n\n if (values.length) {\n const variables = `(${values.map((value, i) => `$${encode(i)}:${value}`).join()})`;\n\n if (name === \"query\") {\n query = name + variables + query;\n } else if (name === \"mutation\" || name === \"subscription\") {\n query = name + variables + query.slice(name.length);\n }\n }\n\n try {\n documentNode = parse(query);\n } catch (err) {\n throw path.buildCodeFrameError(String(err));\n }\n\n const errors = validate(schema, documentNode);\n\n if (errors.length) {\n throw path.buildCodeFrameError(errors[0].message);\n }\n\n const args: t.Expression[] = [t.stringLiteral(stripIgnoredCharacters(query))];\n\n if (expressions.length) {\n args.push(\n t.objectExpression(\n expressions.map((expression, i) => t.objectProperty(t.identifier(encode(i)), expression as any)),\n ),\n );\n }\n\n path.replaceWith(t.callExpression(t.identifier(name), args));\n },\n },\n };\n};\n"],"names":[],"mappings":";;;;;AAqBA,cAAe,CAAC,EAAE,KAAK,EAAE,CAAC,EAAgB,EAAE,OAAgB;IAC1D,IAAI,MAAqB,CAAC;IAE1B,IAAI,OAAO,CAAC,KAAK,EAAE;QACjB,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,IAAI,eAAe,EAAE,MAAM,CAAC,CAAC;QACrE,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;KAClC;SAAM,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE;QAC7C,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,IAAI,eAAe,EAAE,MAAM,CAAC,CAAC;QAC9E,MAAM,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC;KACrC;SAAM,IAAI,OAAO,CAAC,MAAM,EAAE;QACzB,MAAM,GAAG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AM,EAAE;oBACtB,IAAI,CAAC,IAAI,CACP,CAAC,CAAC,gBAAgB,CAChB,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,UAAiB,CAAC,CAAC,CACjG,CACF,CAAC;iBACH;gBAED,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;aAC9D;SACF;KACF,CAAC;AACJ,CAAC;;;;"}
|
package/dist/index.mjs
CHANGED
@@ -1,48 +1,38 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
1
|
+
import { readFileSync } from 'fs';
|
2
|
+
import { encode } from '@mo36924/base52';
|
3
|
+
import { buildSchemaModel, buildSchema } from '@mo36924/graphql-schema';
|
4
|
+
import { parse, TypeInfo, visit, visitWithTypeInfo, validate, stripIgnoredCharacters } from 'graphql';
|
5
5
|
|
6
|
-
let _schema;
|
7
6
|
const index = ({ types: t }, options) => {
|
8
|
-
let schema
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
7
|
+
let schema;
|
8
|
+
if (options.model) {
|
9
|
+
const model = readFileSync(options.model || "index.graphql", "utf8");
|
10
|
+
schema = buildSchemaModel(model);
|
11
|
+
}
|
12
|
+
else if (typeof options.schema === "string") {
|
13
|
+
const graphqlSchema = readFileSync(options.schema || "index.graphql", "utf8");
|
14
|
+
schema = buildSchema(graphqlSchema);
|
15
|
+
}
|
16
|
+
else if (options.schema) {
|
17
|
+
schema = options.schema;
|
18
|
+
}
|
17
19
|
return {
|
18
|
-
name: "graphql-tagged-template",
|
19
20
|
visitor: {
|
20
|
-
TaggedTemplateExpression(path
|
21
|
+
TaggedTemplateExpression(path) {
|
21
22
|
const { tag, quasi: { quasis, expressions }, } = path.node;
|
22
23
|
if (!t.isIdentifier(tag)) {
|
23
24
|
return;
|
24
25
|
}
|
25
26
|
const name = tag.name;
|
26
|
-
|
27
|
-
|
28
|
-
case "gql":
|
29
|
-
case "query":
|
30
|
-
case "useQuery":
|
31
|
-
break;
|
32
|
-
case "mutation":
|
33
|
-
case "useMutation":
|
34
|
-
operation = "mutation";
|
35
|
-
break;
|
36
|
-
case "subscription":
|
37
|
-
case "useSubscription":
|
38
|
-
operation = "subscription";
|
39
|
-
break;
|
40
|
-
default:
|
41
|
-
return;
|
27
|
+
if (name !== "gql" && name !== "query" && name !== "mutation" && name !== "subscription") {
|
28
|
+
return;
|
42
29
|
}
|
43
|
-
let query =
|
30
|
+
let query = quasis[0].value.cooked ?? quasis[0].value.raw;
|
44
31
|
for (let i = 0; i < expressions.length; i++) {
|
45
|
-
query +=
|
32
|
+
query += `$${encode(i)}${quasis[i + 1].value.cooked ?? quasis[i + 1].value.raw}`;
|
33
|
+
}
|
34
|
+
if (name === "mutation" || name === "subscription") {
|
35
|
+
query = name + query;
|
46
36
|
}
|
47
37
|
let documentNode;
|
48
38
|
try {
|
@@ -59,16 +49,16 @@ const index = ({ types: t }, options) => {
|
|
59
49
|
},
|
60
50
|
}));
|
61
51
|
if (values.length) {
|
62
|
-
const variables = `(${values.map((value, i) =>
|
63
|
-
if (
|
64
|
-
query =
|
52
|
+
const variables = `(${values.map((value, i) => `$${encode(i)}:${value}`).join()})`;
|
53
|
+
if (name === "query") {
|
54
|
+
query = name + variables + query;
|
65
55
|
}
|
66
|
-
else if (name
|
67
|
-
query =
|
56
|
+
else if (name === "mutation" || name === "subscription") {
|
57
|
+
query = name + variables + query.slice(name.length);
|
68
58
|
}
|
69
59
|
}
|
70
60
|
try {
|
71
|
-
documentNode = parse(query
|
61
|
+
documentNode = parse(query);
|
72
62
|
}
|
73
63
|
catch (err) {
|
74
64
|
throw path.buildCodeFrameError(String(err));
|
@@ -77,19 +67,9 @@ const index = ({ types: t }, options) => {
|
|
77
67
|
if (errors.length) {
|
78
68
|
throw path.buildCodeFrameError(errors[0].message);
|
79
69
|
}
|
80
|
-
const args = [];
|
81
|
-
if (options.parse) {
|
82
|
-
const id = path.scope.generateUid("gql");
|
83
|
-
path.scope.getProgramParent().push({ kind: "let", id: t.identifier(id) });
|
84
|
-
args.push(t.assignmentExpression("||=", t.identifier(id), t.callExpression(t.memberExpression(t.identifier("JSON"), t.identifier("parse")), [
|
85
|
-
t.stringLiteral(JSON.stringify(documentNode)),
|
86
|
-
])));
|
87
|
-
}
|
88
|
-
else {
|
89
|
-
args.push(t.stringLiteral(stripIgnoredCharacters(query)));
|
90
|
-
}
|
70
|
+
const args = [t.stringLiteral(stripIgnoredCharacters(query))];
|
91
71
|
if (expressions.length) {
|
92
|
-
args.push(t.
|
72
|
+
args.push(t.objectExpression(expressions.map((expression, i) => t.objectProperty(t.identifier(encode(i)), expression))));
|
93
73
|
}
|
94
74
|
path.replaceWith(t.callExpression(t.identifier(name), args));
|
95
75
|
},
|
package/dist/index.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import { readFileSync } from \"fs\";\nimport type { PluginObj, default as babel, types as t } from \"@babel/core\";\nimport { encode } from \"@mo36924/base52\";\nimport { buildSchema, buildSchemaModel } from \"@mo36924/graphql-schema\";\nimport {\n DocumentNode,\n GraphQLInputType,\n GraphQLSchema,\n TypeInfo,\n parse,\n stripIgnoredCharacters,\n validate,\n visit,\n visitWithTypeInfo,\n} from \"graphql\";\n\nexport type Options = {\n model: string;\n schema: string | GraphQLSchema;\n};\n\nexport default ({ types: t }: typeof babel, options: Options): PluginObj => {\n let schema: GraphQLSchema;\n\n if (options.model) {\n const model = readFileSync(options.model || \"index.graphql\", \"utf8\");\n schema = buildSchemaModel(model);\n } else if (typeof options.schema === \"string\") {\n const graphqlSchema = readFileSync(options.schema || \"index.graphql\", \"utf8\");\n schema = buildSchema(graphqlSchema);\n } else if (options.schema) {\n schema = options.schema;\n }\n\n return {\n visitor: {\n TaggedTemplateExpression(path) {\n const {\n tag,\n quasi: { quasis, expressions },\n } = path.node;\n\n if (!t.isIdentifier(tag)) {\n return;\n }\n\n const name = tag.name;\n\n if (name !== \"gql\" && name !== \"query\" && name !== \"mutation\" && name !== \"subscription\") {\n return;\n }\n\n let query = quasis[0].value.cooked ?? quasis[0].value.raw;\n\n for (let i = 0; i < expressions.length; i++) {\n query += `$${encode(i)}${quasis[i + 1].value.cooked ?? quasis[i + 1].value.raw}`;\n }\n\n if (name === \"mutation\" || name === \"subscription\") {\n query = name + query;\n }\n\n let documentNode: DocumentNode;\n\n try {\n documentNode = parse(query);\n } catch (err) {\n throw path.buildCodeFrameError(String(err));\n }\n\n const values: GraphQLInputType[] = [];\n const typeInfo = new TypeInfo(schema);\n\n visit(\n documentNode,\n visitWithTypeInfo(typeInfo, {\n Variable() {\n values.push(typeInfo.getInputType()!);\n },\n }),\n );\n\n if (values.length) {\n const variables = `(${values.map((value, i) => `$${encode(i)}:${value}`).join()})`;\n\n if (name === \"query\") {\n query = name + variables + query;\n } else if (name === \"mutation\" || name === \"subscription\") {\n query = name + variables + query.slice(name.length);\n }\n }\n\n try {\n documentNode = parse(query);\n } catch (err) {\n throw path.buildCodeFrameError(String(err));\n }\n\n const errors = validate(schema, documentNode);\n\n if (errors.length) {\n throw path.buildCodeFrameError(errors[0].message);\n }\n\n const args: t.Expression[] = [t.stringLiteral(stripIgnoredCharacters(query))];\n\n if (expressions.length) {\n args.push(\n t.objectExpression(\n expressions.map((expression, i) => t.objectProperty(t.identifier(encode(i)), expression as any)),\n ),\n );\n }\n\n path.replaceWith(t.callExpression(t.identifier(name), args));\n },\n },\n };\n};\n"],"names":[],"mappings":";;;;;AAqBA,cAAe,CAAC,EAAE,KAAK,EAAE,CAAC,EAAgB,EA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AAK,CAAC,KAAK,CAAC,CAAC;iBAC7B;gBAAC,OAAO,GAAG,EAAE;oBACZ,MAAM,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;iBAC7C;gBAED,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;gBAE9C,IAAI,MAAM,CAAC,MAAM,EAAE;oBACjB,MAAM,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;iBACnD;gBAED,MAAM,IAAI,GAAmB,CAAC,CAAC,CAAC,aAAa,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAE9E,IAAI,WAAW,CAAC,MAAM,EAAE;oBACtB,IAAI,CAAC,IAAI,CACP,CAAC,CAAC,gBAAgB,CAChB,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,UAAiB,CAAC,CAAC,CACjG,CACF,CAAC;iBACH;gBAED,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;aAC9D;SACF;KACF,CAAC;AACJ,CAAC;;;;"}
|
package/package.json
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
{
|
2
2
|
"name": "@mo36924/babel-plugin-graphql-tagged-template",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.6.1",
|
4
4
|
"description": "babel-plugin-graphql-tagged-template",
|
5
5
|
"keywords": [],
|
6
|
-
"homepage": "https://github.com/mo36924/
|
6
|
+
"homepage": "https://github.com/mo36924/monorepo#readme",
|
7
7
|
"bugs": {
|
8
|
-
"url": "https://github.com/mo36924/
|
8
|
+
"url": "https://github.com/mo36924/monorepo/issues"
|
9
9
|
},
|
10
10
|
"repository": {
|
11
11
|
"type": "git",
|
12
|
-
"url": "git+https://github.com/mo36924/
|
12
|
+
"url": "git+https://github.com/mo36924/monorepo.git",
|
13
13
|
"directory": "packages/babel-plugin-graphql-tagged-template"
|
14
14
|
},
|
15
15
|
"license": "MIT",
|
16
|
-
"author": "mo36924",
|
16
|
+
"author": "mo36924 <mo36924@users.noreply.github.com>",
|
17
17
|
"exports": {
|
18
18
|
".": {
|
19
19
|
"types": "./dist/index.d.ts",
|
@@ -26,18 +26,25 @@
|
|
26
26
|
"main": "./dist/index.cjs",
|
27
27
|
"module": "./dist/index.mjs",
|
28
28
|
"types": "./dist/index.d.ts",
|
29
|
+
"typesVersions": {
|
30
|
+
"*": {
|
31
|
+
"*": [
|
32
|
+
"dist/*.d.ts"
|
33
|
+
]
|
34
|
+
}
|
35
|
+
},
|
29
36
|
"files": [
|
30
37
|
"dist"
|
31
38
|
],
|
32
39
|
"dependencies": {
|
33
|
-
"@babel/core": "^7.
|
34
|
-
"@mo36924/
|
35
|
-
"@mo36924/graphql-
|
36
|
-
"@
|
40
|
+
"@babel/core": "^7.16.12",
|
41
|
+
"@mo36924/base52": "^1.6.1",
|
42
|
+
"@mo36924/graphql-schema": "^1.6.1",
|
43
|
+
"@types/babel__core": "^7.1.18",
|
37
44
|
"graphql": "^16.3.0"
|
38
45
|
},
|
39
46
|
"publishConfig": {
|
40
47
|
"access": "public"
|
41
48
|
},
|
42
|
-
"gitHead": "
|
49
|
+
"gitHead": "6db82b81fcee91132bd8d1fae25b0fd429e31d41"
|
43
50
|
}
|