@mo36924/babel-plugin-graphql-tagged-template 5.4.4 → 5.4.6
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.cjs +3 -2
- package/dist/index.js +7 -6
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
@@ -7,9 +7,10 @@ var node_url = require('node:url');
|
|
7
7
|
var core = require('@babel/core');
|
8
8
|
var helperPluginUtils = require('@babel/helper-plugin-utils');
|
9
9
|
var utils = require('@graphql-tools/utils');
|
10
|
-
var graphql$1 = require('@mo36924/graphql');
|
11
10
|
var graphql = require('graphql');
|
12
11
|
var packages_babelPluginGraphqlTaggedTemplate_dist_queries = require('./queries.cjs');
|
12
|
+
var packages_babelPluginGraphqlTaggedTemplate_dist_schema = require('./schema.cjs');
|
13
|
+
require('@mo36924/graphql');
|
13
14
|
|
14
15
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
15
16
|
const queriesDir = node_path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('packages/babel-plugin-graphql-tagged-template/dist/index.cjs', document.baseURI).href))));
|
@@ -24,7 +25,7 @@ const schemaPaths = [
|
|
24
25
|
"ts"
|
25
26
|
].map((extname)=>node_path.join(queriesDir, `schema.${extname}`));
|
26
27
|
const hash = (data)=>node_crypto.createHash("sha256").update(data).digest("base64url");
|
27
|
-
var index = helperPluginUtils.declare((_api, { development = node_process.env.NODE_ENV === "development", schema =
|
28
|
+
var index = helperPluginUtils.declare((_api, { development = node_process.env.NODE_ENV === "development", schema = packages_babelPluginGraphqlTaggedTemplate_dist_schema.schema, queries = packages_babelPluginGraphqlTaggedTemplate_dist_queries.queries })=>{
|
28
29
|
return {
|
29
30
|
name: "babel-plugin-graphql-tagged-template",
|
30
31
|
visitor: {
|
package/dist/index.js
CHANGED
@@ -5,9 +5,10 @@ import { fileURLToPath } from 'node:url';
|
|
5
5
|
import { types } from '@babel/core';
|
6
6
|
import { declare } from '@babel/helper-plugin-utils';
|
7
7
|
import { printSchemaWithDirectives } from '@graphql-tools/utils';
|
8
|
-
import { getSchema } from '@mo36924/graphql';
|
9
8
|
import { parse, TypeInfo, OperationTypeNode, visit, visitWithTypeInfo, validate, stripIgnoredCharacters } from 'graphql';
|
10
9
|
import { queries } from './queries.js';
|
10
|
+
import { schema } from './schema.js';
|
11
|
+
import '@mo36924/graphql';
|
11
12
|
|
12
13
|
const queriesDir = dirname(fileURLToPath(import.meta.url));
|
13
14
|
const queriesPaths = [
|
@@ -21,7 +22,7 @@ const schemaPaths = [
|
|
21
22
|
"ts"
|
22
23
|
].map((extname)=>join(queriesDir, `schema.${extname}`));
|
23
24
|
const hash = (data)=>createHash("sha256").update(data).digest("base64url");
|
24
|
-
var index = declare((_api, { development = env.NODE_ENV === "development", schema =
|
25
|
+
var index = declare((_api, { development = env.NODE_ENV === "development", schema: schema$1 = schema, queries: queries$1 = queries })=>{
|
25
26
|
return {
|
26
27
|
name: "babel-plugin-graphql-tagged-template",
|
27
28
|
visitor: {
|
@@ -42,7 +43,7 @@ var index = declare((_api, { development = env.NODE_ENV === "development", schem
|
|
42
43
|
} else if (schemaPaths.includes(filename) && path.get("id").isIdentifier({
|
43
44
|
name: "schema"
|
44
45
|
})) {
|
45
|
-
const source = printSchemaWithDirectives(schema);
|
46
|
+
const source = printSchemaWithDirectives(schema$1);
|
46
47
|
const documentNode = parse(source, {
|
47
48
|
noLocation: true
|
48
49
|
});
|
@@ -87,8 +88,8 @@ var index = declare((_api, { development = env.NODE_ENV === "development", schem
|
|
87
88
|
throw path.buildCodeFrameError("Only a field is allowed");
|
88
89
|
}
|
89
90
|
const values = [];
|
90
|
-
const typeInfo = new TypeInfo(schema);
|
91
|
-
const isMutation = !!schema.getMutationType()?.getFields()[field.name.value];
|
91
|
+
const typeInfo = new TypeInfo(schema$1);
|
92
|
+
const isMutation = !!schema$1.getMutationType()?.getFields()[field.name.value];
|
92
93
|
const operation = isMutation ? OperationTypeNode.MUTATION : OperationTypeNode.QUERY;
|
93
94
|
visit({
|
94
95
|
...definition,
|
@@ -111,7 +112,7 @@ var index = declare((_api, { development = env.NODE_ENV === "development", schem
|
|
111
112
|
} catch (err) {
|
112
113
|
throw path.buildCodeFrameError(String(err));
|
113
114
|
}
|
114
|
-
const errors = validate(schema, documentNode);
|
115
|
+
const errors = validate(schema$1, documentNode);
|
115
116
|
if (errors.length) {
|
116
117
|
throw path.buildCodeFrameError(errors[0].message);
|
117
118
|
}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@mo36924/babel-plugin-graphql-tagged-template",
|
3
3
|
"type": "module",
|
4
|
-
"version": "5.4.
|
4
|
+
"version": "5.4.6",
|
5
5
|
"description": "babel-plugin-graphql-tagged-template",
|
6
6
|
"author": "mo36924",
|
7
7
|
"license": "MIT",
|
@@ -61,5 +61,5 @@
|
|
61
61
|
"@types/babel__helper-plugin-utils": "^7.10.3",
|
62
62
|
"graphql": "^16.9.0"
|
63
63
|
},
|
64
|
-
"gitHead": "
|
64
|
+
"gitHead": "0fc11c9a45c9304be259b12af873958cbf13bb9d"
|
65
65
|
}
|