@gql.tada/cli-utils
Advanced tools
Comparing version
# @gql.tada/cli-utils | ||
## 1.6.2-canary-7fb938dc7d0bdc68e0a9ad7972b59c3dff5baedc | ||
## 1.6.2-canary-d6ca923132ea7071f806e0f7da2ad0e9c99640d8 | ||
### Patch Changes | ||
- Strip our internal `@_unmask` directive from fragment-definitions during persisted-operations generation | ||
Submitted by [@JoviDeCroock](https://github.com/JoviDeCroock) (See [#388](https://github.com/0no-co/gql.tada/pull/388)) | ||
- Updated dependencies (See [#386](https://github.com/0no-co/gql.tada/pull/386)) | ||
- @gql.tada/internal@1.0.8-canary-7fb938dc7d0bdc68e0a9ad7972b59c3dff5baedc | ||
- @gql.tada/internal@1.0.8-canary-d6ca923132ea7071f806e0f7da2ad0e9c99640d8 | ||
@@ -10,0 +12,0 @@ ## 1.6.1 |
@@ -11,2 +11,4 @@ var e = require("typescript"); | ||
var t = "FragmentDefinition"; | ||
class GraphQLError extends Error { | ||
@@ -55,18 +57,18 @@ constructor(e, i, r, n, a, t, o) { | ||
var t; | ||
var o; | ||
var l; | ||
function error(e) { | ||
return new GraphQLError(`Syntax Error: Unexpected token at ${o} in ${e}`); | ||
return new GraphQLError(`Syntax Error: Unexpected token at ${l} in ${e}`); | ||
} | ||
function advance(e) { | ||
e.lastIndex = o; | ||
if (e.test(t)) { | ||
return t.slice(o, o = e.lastIndex); | ||
e.lastIndex = l; | ||
if (e.test(o)) { | ||
return o.slice(l, l = e.lastIndex); | ||
} | ||
} | ||
var l = / +(?=[^\s])/y; | ||
var s = / +(?=[^\s])/y; | ||
@@ -80,6 +82,6 @@ function blockString(e) { | ||
for (var o = 0; o < i.length; o++) { | ||
l.lastIndex = 0; | ||
if (l.test(i[o])) { | ||
if (o && (!n || l.lastIndex < n)) { | ||
n = l.lastIndex; | ||
s.lastIndex = 0; | ||
if (s.test(i[o])) { | ||
if (o && (!n || s.lastIndex < n)) { | ||
n = s.lastIndex; | ||
} | ||
@@ -90,7 +92,7 @@ a = a || o; | ||
} | ||
for (var s = a; s <= t; s++) { | ||
if (s !== a) { | ||
for (var l = a; l <= t; l++) { | ||
if (l !== a) { | ||
r += "\n"; | ||
} | ||
r += i[s].slice(n).replace(/\\"""/g, '"""'); | ||
r += i[l].slice(n).replace(/\\"""/g, '"""'); | ||
} | ||
@@ -101,15 +103,15 @@ return r; | ||
function ignored() { | ||
for (var e = 0 | t.charCodeAt(o++); 9 === e || 10 === e || 13 === e || 32 === e || 35 === e || 44 === e || 65279 === e; e = 0 | t.charCodeAt(o++)) { | ||
for (var e = 0 | o.charCodeAt(l++); 9 === e || 10 === e || 13 === e || 32 === e || 35 === e || 44 === e || 65279 === e; e = 0 | o.charCodeAt(l++)) { | ||
if (35 === e) { | ||
while (10 !== (e = t.charCodeAt(o++)) && 13 !== e) {} | ||
while (10 !== (e = o.charCodeAt(l++)) && 13 !== e) {} | ||
} | ||
} | ||
o--; | ||
l--; | ||
} | ||
var s = /[_A-Za-z]\w*/y; | ||
var u = /[_A-Za-z]\w*/y; | ||
var u = new RegExp("(?:(null|true|false)|\\$(" + s.source + ')|(-?\\d+)((?:\\.\\d+)?[eE][+-]?\\d+|\\.\\d+)?|("""(?:"""|(?:[\\s\\S]*?[^\\\\])"""))|("(?:"|[^\\r\\n]*?[^\\\\]"))|(' + s.source + "))", "y"); | ||
var d = new RegExp("(?:(null|true|false)|\\$(" + u.source + ')|(-?\\d+)((?:\\.\\d+)?[eE][+-]?\\d+|\\.\\d+)?|("""(?:"""|(?:[\\s\\S]*?[^\\\\])"""))|("(?:"|[^\\r\\n]*?[^\\\\]"))|(' + u.source + "))", "y"); | ||
var d = function(e) { | ||
var c = function(e) { | ||
e[e.Const = 1] = "Const"; | ||
@@ -123,5 +125,5 @@ e[e.Var = 2] = "Var"; | ||
return e; | ||
}(d || {}); | ||
}(c || {}); | ||
var c = /\\/g; | ||
var v = /\\/g; | ||
@@ -131,11 +133,11 @@ function value(e) { | ||
var r; | ||
u.lastIndex = o; | ||
if (91 === t.charCodeAt(o)) { | ||
o++; | ||
d.lastIndex = l; | ||
if (91 === o.charCodeAt(l)) { | ||
l++; | ||
ignored(); | ||
var n = []; | ||
while (93 !== t.charCodeAt(o)) { | ||
while (93 !== o.charCodeAt(l)) { | ||
n.push(value(e)); | ||
} | ||
o++; | ||
l++; | ||
ignored(); | ||
@@ -146,12 +148,12 @@ return { | ||
}; | ||
} else if (123 === t.charCodeAt(o)) { | ||
o++; | ||
} else if (123 === o.charCodeAt(l)) { | ||
l++; | ||
ignored(); | ||
var a = []; | ||
while (125 !== t.charCodeAt(o)) { | ||
if (null == (i = advance(s))) { | ||
while (125 !== o.charCodeAt(l)) { | ||
if (null == (i = advance(u))) { | ||
throw error("ObjectField"); | ||
} | ||
ignored(); | ||
if (58 !== t.charCodeAt(o++)) { | ||
if (58 !== o.charCodeAt(l++)) { | ||
throw error("ObjectField"); | ||
@@ -169,3 +171,3 @@ } | ||
} | ||
o++; | ||
l++; | ||
ignored(); | ||
@@ -176,6 +178,6 @@ return { | ||
}; | ||
} else if (null != (r = u.exec(t))) { | ||
o = u.lastIndex; | ||
} else if (null != (r = d.exec(o))) { | ||
l = d.lastIndex; | ||
ignored(); | ||
if (null != (i = r[d.Const])) { | ||
if (null != (i = r[c.Const])) { | ||
return "null" === i ? { | ||
@@ -187,3 +189,3 @@ kind: "NullValue" | ||
}; | ||
} else if (null != (i = r[d.Var])) { | ||
} else if (null != (i = r[c.Var])) { | ||
if (e) { | ||
@@ -200,8 +202,8 @@ throw error("Variable"); | ||
} | ||
} else if (null != (i = r[d.Int])) { | ||
var l; | ||
if (null != (l = r[d.Float])) { | ||
} else if (null != (i = r[c.Int])) { | ||
var t; | ||
if (null != (t = r[c.Float])) { | ||
return { | ||
kind: "FloatValue", | ||
value: i + l | ||
value: i + t | ||
}; | ||
@@ -214,3 +216,3 @@ } else { | ||
} | ||
} else if (null != (i = r[d.BlockString])) { | ||
} else if (null != (i = r[c.BlockString])) { | ||
return { | ||
@@ -221,9 +223,9 @@ kind: "StringValue", | ||
}; | ||
} else if (null != (i = r[d.String])) { | ||
} else if (null != (i = r[c.String])) { | ||
return { | ||
kind: "StringValue", | ||
value: c.test(i) ? JSON.parse(i) : i.slice(1, -1), | ||
value: v.test(i) ? JSON.parse(i) : i.slice(1, -1), | ||
block: !1 | ||
}; | ||
} else if (null != (i = r[d.Enum])) { | ||
} else if (null != (i = r[c.Enum])) { | ||
return { | ||
@@ -239,13 +241,13 @@ kind: "EnumValue", | ||
function arguments_(e) { | ||
if (40 === t.charCodeAt(o)) { | ||
if (40 === o.charCodeAt(l)) { | ||
var i = []; | ||
o++; | ||
l++; | ||
ignored(); | ||
var r; | ||
do { | ||
if (null == (r = advance(s))) { | ||
if (null == (r = advance(u))) { | ||
throw error("Argument"); | ||
} | ||
ignored(); | ||
if (58 !== t.charCodeAt(o++)) { | ||
if (58 !== o.charCodeAt(l++)) { | ||
throw error("Argument"); | ||
@@ -262,4 +264,4 @@ } | ||
}); | ||
} while (41 !== t.charCodeAt(o)); | ||
o++; | ||
} while (41 !== o.charCodeAt(l)); | ||
l++; | ||
ignored(); | ||
@@ -271,8 +273,8 @@ return i; | ||
function directives(e) { | ||
if (64 === t.charCodeAt(o)) { | ||
if (64 === o.charCodeAt(l)) { | ||
var i = []; | ||
var r; | ||
do { | ||
o++; | ||
if (null == (r = advance(s))) { | ||
l++; | ||
if (null == (r = advance(u))) { | ||
throw error("Directive"); | ||
@@ -289,3 +291,3 @@ } | ||
}); | ||
} while (64 === t.charCodeAt(o)); | ||
} while (64 === o.charCodeAt(l)); | ||
return i; | ||
@@ -298,8 +300,8 @@ } | ||
var i = 0; | ||
while (91 === t.charCodeAt(o)) { | ||
while (91 === o.charCodeAt(l)) { | ||
i++; | ||
o++; | ||
l++; | ||
ignored(); | ||
} | ||
if (null == (e = advance(s))) { | ||
if (null == (e = advance(u))) { | ||
throw error("NamedType"); | ||
@@ -316,4 +318,4 @@ } | ||
do { | ||
if (33 === t.charCodeAt(o)) { | ||
o++; | ||
if (33 === o.charCodeAt(l)) { | ||
l++; | ||
ignored(); | ||
@@ -326,3 +328,3 @@ r = { | ||
if (i) { | ||
if (93 !== t.charCodeAt(o++)) { | ||
if (93 !== o.charCodeAt(l++)) { | ||
throw error("NamedType"); | ||
@@ -340,9 +342,9 @@ } | ||
var v = new RegExp("(?:(\\.{3})|(" + s.source + "))", "y"); | ||
var f = new RegExp("(?:(\\.{3})|(" + u.source + "))", "y"); | ||
var f = function(e) { | ||
var g = function(e) { | ||
e[e.Spread = 1] = "Spread"; | ||
e[e.Name = 2] = "Name"; | ||
return e; | ||
}(f || {}); | ||
}(g || {}); | ||
@@ -354,8 +356,8 @@ function selectionSet() { | ||
do { | ||
v.lastIndex = o; | ||
if (null != (r = v.exec(t))) { | ||
o = v.lastIndex; | ||
if (null != r[f.Spread]) { | ||
f.lastIndex = l; | ||
if (null != (r = f.exec(o))) { | ||
l = f.lastIndex; | ||
if (null != r[g.Spread]) { | ||
ignored(); | ||
var n = advance(s); | ||
var n = advance(u); | ||
if (null != n && "on" !== n) { | ||
@@ -374,3 +376,3 @@ ignored(); | ||
if ("on" === n) { | ||
if (null == (n = advance(s))) { | ||
if (null == (n = advance(u))) { | ||
throw error("NamedType"); | ||
@@ -381,3 +383,3 @@ } | ||
var a = directives(!1); | ||
if (123 !== t.charCodeAt(o++)) { | ||
if (123 !== o.charCodeAt(l++)) { | ||
throw error("InlineFragment"); | ||
@@ -399,10 +401,10 @@ } | ||
} | ||
} else if (null != (i = r[f.Name])) { | ||
var l = void 0; | ||
} else if (null != (i = r[g.Name])) { | ||
var t = void 0; | ||
ignored(); | ||
if (58 === t.charCodeAt(o)) { | ||
o++; | ||
if (58 === o.charCodeAt(l)) { | ||
l++; | ||
ignored(); | ||
l = i; | ||
if (null == (i = advance(s))) { | ||
t = i; | ||
if (null == (i = advance(u))) { | ||
throw error("Field"); | ||
@@ -412,8 +414,8 @@ } | ||
} | ||
var u = arguments_(!1); | ||
var s = arguments_(!1); | ||
ignored(); | ||
var d = directives(!1); | ||
var c = void 0; | ||
if (123 === t.charCodeAt(o)) { | ||
o++; | ||
if (123 === o.charCodeAt(l)) { | ||
l++; | ||
ignored(); | ||
@@ -424,5 +426,5 @@ c = selectionSet(); | ||
kind: "Field", | ||
alias: l ? { | ||
alias: t ? { | ||
kind: "Name", | ||
value: l | ||
value: t | ||
} : void 0, | ||
@@ -433,3 +435,3 @@ name: { | ||
}, | ||
arguments: u, | ||
arguments: s, | ||
directives: d, | ||
@@ -442,4 +444,4 @@ selectionSet: c | ||
} | ||
} while (125 !== t.charCodeAt(o)); | ||
o++; | ||
} while (125 !== o.charCodeAt(l)); | ||
l++; | ||
ignored(); | ||
@@ -455,11 +457,11 @@ return { | ||
var i; | ||
if (null == (e = advance(s))) { | ||
if (null == (e = advance(u))) { | ||
throw error("FragmentDefinition"); | ||
} | ||
ignored(); | ||
if ("on" !== advance(s)) { | ||
if ("on" !== advance(u)) { | ||
throw error("FragmentDefinition"); | ||
} | ||
ignored(); | ||
if (null == (i = advance(s))) { | ||
if (null == (i = advance(u))) { | ||
throw error("FragmentDefinition"); | ||
@@ -469,3 +471,3 @@ } | ||
var r = directives(!1); | ||
if (123 !== t.charCodeAt(o++)) { | ||
if (123 !== o.charCodeAt(l++)) { | ||
throw error("FragmentDefinition"); | ||
@@ -492,3 +494,3 @@ } | ||
var g = /(?:query|mutation|subscription|fragment)/y; | ||
var m = /(?:query|mutation|subscription|fragment)/y; | ||
@@ -501,19 +503,19 @@ function operationDefinition(e) { | ||
ignored(); | ||
i = advance(s); | ||
i = advance(u); | ||
r = function variableDefinitions() { | ||
ignored(); | ||
if (40 === t.charCodeAt(o)) { | ||
if (40 === o.charCodeAt(l)) { | ||
var e = []; | ||
o++; | ||
l++; | ||
ignored(); | ||
var i; | ||
do { | ||
if (36 !== t.charCodeAt(o++)) { | ||
if (36 !== o.charCodeAt(l++)) { | ||
throw error("Variable"); | ||
} | ||
if (null == (i = advance(s))) { | ||
if (null == (i = advance(u))) { | ||
throw error("Variable"); | ||
} | ||
ignored(); | ||
if (58 !== t.charCodeAt(o++)) { | ||
if (58 !== o.charCodeAt(l++)) { | ||
throw error("VariableDefinition"); | ||
@@ -524,4 +526,4 @@ } | ||
var n = void 0; | ||
if (61 === t.charCodeAt(o)) { | ||
o++; | ||
if (61 === o.charCodeAt(l)) { | ||
l++; | ||
ignored(); | ||
@@ -544,4 +546,4 @@ n = value(!0); | ||
}); | ||
} while (41 !== t.charCodeAt(o)); | ||
o++; | ||
} while (41 !== o.charCodeAt(l)); | ||
l++; | ||
ignored(); | ||
@@ -553,4 +555,4 @@ return e; | ||
} | ||
if (123 === t.charCodeAt(o)) { | ||
o++; | ||
if (123 === o.charCodeAt(l)) { | ||
l++; | ||
ignored(); | ||
@@ -572,4 +574,4 @@ return { | ||
function parse(e, i) { | ||
t = "string" == typeof e.body ? e.body : e; | ||
o = 0; | ||
o = "string" == typeof e.body ? e.body : e; | ||
l = 0; | ||
return function document() { | ||
@@ -581,3 +583,3 @@ var e; | ||
do { | ||
if ("fragment" === (e = advance(g))) { | ||
if ("fragment" === (e = advance(m))) { | ||
ignored(); | ||
@@ -590,3 +592,3 @@ r.push(fragmentDefinition()); | ||
} | ||
} while (o < t.length); | ||
} while (l < o.length); | ||
return { | ||
@@ -610,5 +612,5 @@ kind: "Document", | ||
var m = "\n"; | ||
var h = "\n"; | ||
var h = { | ||
var p = { | ||
OperationDefinition(e) { | ||
@@ -623,11 +625,11 @@ var i = e.operation; | ||
} | ||
i += "(" + mapJoin(e.variableDefinitions, ", ", h.VariableDefinition) + ")"; | ||
i += "(" + mapJoin(e.variableDefinitions, ", ", p.VariableDefinition) + ")"; | ||
} | ||
if (e.directives && e.directives.length) { | ||
i += " " + mapJoin(e.directives, " ", h.Directive); | ||
i += " " + mapJoin(e.directives, " ", p.Directive); | ||
} | ||
return "query" !== i ? i + " " + h.SelectionSet(e.selectionSet) : h.SelectionSet(e.selectionSet); | ||
return "query" !== i ? i + " " + p.SelectionSet(e.selectionSet) : p.SelectionSet(e.selectionSet); | ||
}, | ||
VariableDefinition(e) { | ||
var i = h.Variable(e.variable) + ": " + _print(e.type); | ||
var i = p.Variable(e.variable) + ": " + _print(e.type); | ||
if (e.defaultValue) { | ||
@@ -637,3 +639,3 @@ i += " = " + _print(e.defaultValue); | ||
if (e.directives && e.directives.length) { | ||
i += " " + mapJoin(e.directives, " ", h.Directive); | ||
i += " " + mapJoin(e.directives, " ", p.Directive); | ||
} | ||
@@ -645,5 +647,5 @@ return i; | ||
if (e.arguments && e.arguments.length) { | ||
var r = mapJoin(e.arguments, ", ", h.Argument); | ||
var r = mapJoin(e.arguments, ", ", p.Argument); | ||
if (i.length + r.length + 2 > 80) { | ||
i += "(" + (m += " ") + mapJoin(e.arguments, m, h.Argument) + (m = m.slice(0, -2)) + ")"; | ||
i += "(" + (h += " ") + mapJoin(e.arguments, h, p.Argument) + (h = h.slice(0, -2)) + ")"; | ||
} else { | ||
@@ -654,6 +656,6 @@ i += "(" + r + ")"; | ||
if (e.directives && e.directives.length) { | ||
i += " " + mapJoin(e.directives, " ", h.Directive); | ||
i += " " + mapJoin(e.directives, " ", p.Directive); | ||
} | ||
if (e.selectionSet) { | ||
i += " " + h.SelectionSet(e.selectionSet); | ||
i += " " + p.SelectionSet(e.selectionSet); | ||
} | ||
@@ -666,3 +668,3 @@ return i; | ||
return '"""\n' + e.replace(/"""/g, '\\"""') + '\n"""'; | ||
}(e.value).replace(/\n/g, m); | ||
}(e.value).replace(/\n/g, h); | ||
} else { | ||
@@ -682,3 +684,3 @@ return function printString(e) { | ||
ListValue: e => "[" + mapJoin(e.values, ", ", _print) + "]", | ||
ObjectValue: e => "{" + mapJoin(e.fields, ", ", h.ObjectField) + "}", | ||
ObjectValue: e => "{" + mapJoin(e.fields, ", ", p.ObjectField) + "}", | ||
ObjectField: e => e.name.value + ": " + _print(e.value), | ||
@@ -691,3 +693,3 @@ Document(e) { | ||
}, | ||
SelectionSet: e => "{" + (m += " ") + mapJoin(e.selections, m, _print) + (m = m.slice(0, -2)) + "}", | ||
SelectionSet: e => "{" + (h += " ") + mapJoin(e.selections, h, _print) + (h = h.slice(0, -2)) + "}", | ||
Argument: e => e.name.value + ": " + _print(e.value), | ||
@@ -697,3 +699,3 @@ FragmentSpread(e) { | ||
if (e.directives && e.directives.length) { | ||
i += " " + mapJoin(e.directives, " ", h.Directive); | ||
i += " " + mapJoin(e.directives, " ", p.Directive); | ||
} | ||
@@ -708,5 +710,5 @@ return i; | ||
if (e.directives && e.directives.length) { | ||
i += " " + mapJoin(e.directives, " ", h.Directive); | ||
i += " " + mapJoin(e.directives, " ", p.Directive); | ||
} | ||
return i + " " + h.SelectionSet(e.selectionSet); | ||
return i + " " + p.SelectionSet(e.selectionSet); | ||
}, | ||
@@ -717,5 +719,5 @@ FragmentDefinition(e) { | ||
if (e.directives && e.directives.length) { | ||
i += " " + mapJoin(e.directives, " ", h.Directive); | ||
i += " " + mapJoin(e.directives, " ", p.Directive); | ||
} | ||
return i + " " + h.SelectionSet(e.selectionSet); | ||
return i + " " + p.SelectionSet(e.selectionSet); | ||
}, | ||
@@ -725,3 +727,3 @@ Directive(e) { | ||
if (e.arguments && e.arguments.length) { | ||
i += "(" + mapJoin(e.arguments, ", ", h.Argument) + ")"; | ||
i += "(" + mapJoin(e.arguments, ", ", p.Argument) + ")"; | ||
} | ||
@@ -735,108 +737,115 @@ return i; | ||
var _print = e => h[e.kind](e); | ||
var _print = e => p[e.kind](e); | ||
function print(e) { | ||
m = "\n"; | ||
return h[e.kind] ? h[e.kind](e) : ""; | ||
h = "\n"; | ||
return p[e.kind] ? p[e.kind](e) : ""; | ||
} | ||
var p = n.expose((async function* _runPersisted(n) { | ||
var t = i.getSchemaNamesFromConfig(n.pluginConfig); | ||
var o = a.programFactory(n); | ||
var l = o.createExternalFiles(); | ||
if (l.length) { | ||
var S = n.expose((async function* _runPersisted(n) { | ||
var o = i.getSchemaNamesFromConfig(n.pluginConfig); | ||
var l = a.programFactory(n); | ||
var s = l.createExternalFiles(); | ||
if (s.length) { | ||
yield { | ||
kind: "EXTERNAL_WARNING" | ||
}; | ||
await o.addVirtualFiles(l); | ||
await l.addVirtualFiles(s); | ||
} | ||
var s = o.build(); | ||
var u = s.buildPluginInfo(n.pluginConfig); | ||
var d = s.getSourceFiles(); | ||
var u = l.build(); | ||
var d = u.buildPluginInfo(n.pluginConfig); | ||
var c = u.getSourceFiles(); | ||
yield { | ||
kind: "FILE_COUNT", | ||
fileCount: d.length | ||
fileCount: c.length | ||
}; | ||
for (var c of d) { | ||
var v = c.fileName; | ||
var f = []; | ||
for (var v of c) { | ||
var f = v.fileName; | ||
var g = []; | ||
var m = r.findAllPersistedCallExpressions(c, u); | ||
for (var h of m) { | ||
var p = s.getSourcePosition(c, h.node.getStart()); | ||
v = p.fileName; | ||
if (!t.has(h.schema)) { | ||
g.push({ | ||
message: h.schema ? `The '${h.schema}' schema is not in the configuration but was referenced by "graphql.persisted".` : t.size > 1 ? "The document is not for a known schema. Have you re-generated the output file?" : "Multiple schemas are configured, but the document is not for a specific schema.", | ||
file: p.fileName, | ||
line: p.line, | ||
col: p.col | ||
var m = []; | ||
var h = r.findAllPersistedCallExpressions(v, d); | ||
for (var p of h) { | ||
var S = u.getSourcePosition(v, p.node.getStart()); | ||
f = S.fileName; | ||
if (!o.has(p.schema)) { | ||
m.push({ | ||
message: p.schema ? `The '${p.schema}' schema is not in the configuration but was referenced by "graphql.persisted".` : o.size > 1 ? "The document is not for a known schema. Have you re-generated the output file?" : "Multiple schemas are configured, but the document is not for a specific schema.", | ||
file: S.fileName, | ||
line: S.line, | ||
col: S.col | ||
}); | ||
continue; | ||
} | ||
var S = h.node.arguments[0]; | ||
var y = h.node.arguments[1]; | ||
var k = h.node.typeArguments && h.node.typeArguments[0]; | ||
if (!S || !e.isStringLiteral(S)) { | ||
g.push({ | ||
var k = p.node.arguments[0]; | ||
var y = p.node.arguments[1]; | ||
var N = p.node.typeArguments && p.node.typeArguments[0]; | ||
if (!k || !e.isStringLiteral(k)) { | ||
m.push({ | ||
message: '"graphql.persisted" must be called with a string literal as the first argument.', | ||
file: p.fileName, | ||
line: p.line, | ||
col: p.col | ||
file: S.fileName, | ||
line: S.line, | ||
col: S.col | ||
}); | ||
continue; | ||
} else if (!y && !k) { | ||
g.push({ | ||
} else if (!y && !N) { | ||
m.push({ | ||
message: '"graphql.persisted" is missing a document.\nThis may be passed as a generic such as `graphql.persisted<typeof document>` or as the second argument.', | ||
file: p.fileName, | ||
line: p.line, | ||
col: p.col | ||
file: S.fileName, | ||
line: S.line, | ||
col: S.col | ||
}); | ||
continue; | ||
} | ||
var N = null; | ||
var b = h.node; | ||
var b = null; | ||
var C = p.node; | ||
if (y && (e.isCallExpression(y) || e.isIdentifier(y))) { | ||
N = r.getDocumentReferenceFromDocumentNode(y, c.fileName, u).node; | ||
b = y; | ||
} else if (k && e.isTypeQueryNode(k)) { | ||
N = r.getDocumentReferenceFromTypeQuery(k, c.fileName, u).node; | ||
b = k; | ||
b = r.getDocumentReferenceFromDocumentNode(y, v.fileName, d).node; | ||
C = y; | ||
} else if (N && e.isTypeQueryNode(N)) { | ||
b = r.getDocumentReferenceFromTypeQuery(N, v.fileName, d).node; | ||
C = N; | ||
} | ||
if (!N) { | ||
g.push({ | ||
message: `Could not find reference for "${b.getText()}".\nIf this is unexpected, please file an issue describing your case.`, | ||
file: p.fileName, | ||
line: p.line, | ||
col: p.col | ||
if (!b) { | ||
m.push({ | ||
message: `Could not find reference for "${C.getText()}".\nIf this is unexpected, please file an issue describing your case.`, | ||
file: S.fileName, | ||
line: S.line, | ||
col: S.col | ||
}); | ||
continue; | ||
} | ||
if (!N || !e.isCallExpression(N) || !e.isNoSubstitutionTemplateLiteral(N.arguments[0]) && !e.isStringLiteral(N.arguments[0])) { | ||
g.push({ | ||
message: `The referenced document of "${b.getText()}" contains no document string literal.\nIf this is unexpected, please file an issue describing your case.`, | ||
file: p.fileName, | ||
line: p.line, | ||
col: p.col | ||
if (!b || !e.isCallExpression(b) || !e.isNoSubstitutionTemplateLiteral(b.arguments[0]) && !e.isStringLiteral(b.arguments[0])) { | ||
m.push({ | ||
message: `The referenced document of "${C.getText()}" contains no document string literal.\nIf this is unexpected, please file an issue describing your case.`, | ||
file: S.fileName, | ||
line: S.line, | ||
col: S.col | ||
}); | ||
continue; | ||
} | ||
var C = []; | ||
var A = N.arguments[0].getText().slice(1, -1); | ||
if (N.arguments[1] && e.isArrayLiteralExpression(N.arguments[1])) { | ||
r.unrollTadaFragments(N.arguments[1], C, s.buildPluginInfo(n.pluginConfig)); | ||
var A = []; | ||
var w = b.arguments[0].getText().slice(1, -1); | ||
if (b.arguments[1] && e.isArrayLiteralExpression(b.arguments[1])) { | ||
r.unrollTadaFragments(b.arguments[1], A, u.buildPluginInfo(n.pluginConfig)); | ||
} | ||
var w = new Set; | ||
var D = void 0; | ||
var D = new Set; | ||
var V = void 0; | ||
if (n.disableNormalization) { | ||
D = A; | ||
V = w; | ||
} else { | ||
try { | ||
D = print(parse(A)); | ||
var F = parse(w); | ||
var x = new Set; | ||
for (var T of F.definitions) { | ||
if (T.kind === t && !x.has(T)) { | ||
stripUnmaskDirectivesFromDefinition(T); | ||
} | ||
} | ||
V = print(F); | ||
} catch (e) { | ||
g.push({ | ||
message: `The referenced document of "${b.getText()}" could not be parsed.\nRun \`check\` to see specific validation errors.`, | ||
file: p.fileName, | ||
line: p.line, | ||
col: p.col | ||
m.push({ | ||
message: `The referenced document of "${C.getText()}" could not be parsed.\nRun \`check\` to see specific validation errors.`, | ||
file: S.fileName, | ||
line: S.line, | ||
col: S.col | ||
}); | ||
@@ -846,13 +855,14 @@ continue; | ||
} | ||
for (var V of C) { | ||
var x = print(V); | ||
if (!w.has(x)) { | ||
D += "\n\n" + print(V); | ||
w.add(x); | ||
for (var E of A) { | ||
stripUnmaskDirectivesFromDefinition(E); | ||
var I = print(E); | ||
if (!D.has(I)) { | ||
V += "\n\n" + print(E); | ||
D.add(I); | ||
} | ||
} | ||
f.push({ | ||
schemaName: h.schema, | ||
hashKey: S.getText().slice(1, -1), | ||
document: D | ||
g.push({ | ||
schemaName: p.schema, | ||
hashKey: k.getText().slice(1, -1), | ||
document: V | ||
}); | ||
@@ -862,5 +872,5 @@ } | ||
kind: "FILE_PERSISTED", | ||
filePath: v, | ||
documents: f, | ||
warnings: g | ||
filePath: f, | ||
documents: g, | ||
warnings: m | ||
}; | ||
@@ -870,3 +880,7 @@ } | ||
exports.runPersisted = p; | ||
var stripUnmaskDirectivesFromDefinition = e => { | ||
e.directives = e.directives?.filter((e => "_unmask" !== e.name.value)); | ||
}; | ||
exports.runPersisted = S; | ||
//# sourceMappingURL=thread-chunk.js.map |
{ | ||
"name": "@gql.tada/cli-utils", | ||
"version": "1.6.2-canary-7fb938dc7d0bdc68e0a9ad7972b59c3dff5baedc", | ||
"version": "1.6.2-canary-d6ca923132ea7071f806e0f7da2ad0e9c99640d8", | ||
"public": true, | ||
@@ -54,3 +54,3 @@ "description": "Main logic for gql.tada’s CLI tool.", | ||
"graphql": "^15.5.0 || ^16.0.0 || ^17.0.0", | ||
"@gql.tada/internal": "1.0.8-canary-7fb938dc7d0bdc68e0a9ad7972b59c3dff5baedc" | ||
"@gql.tada/internal": "1.0.8-canary-d6ca923132ea7071f806e0f7da2ad0e9c99640d8" | ||
}, | ||
@@ -57,0 +57,0 @@ "peerDependenciesMeta": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1960834
2.36%18774
0.13%