@lingo.dev/_compiler 0.7.17 → 0.8.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.
- package/build/acorn-GCP5ZV2A.mjs +3152 -0
- package/build/acorn-QFXI4BEA.cjs +3152 -0
- package/build/angular-JQSQXFBY.mjs +2937 -0
- package/build/angular-OXTGJOFJ.cjs +2937 -0
- package/build/babel-EJ7OIZP4.cjs +7246 -0
- package/build/babel-R5G642DR.mjs +7246 -0
- package/build/chunk-6BWS3CLP.mjs +16 -0
- package/build/chunk-AKFJBAG4.cjs +21 -0
- package/build/chunk-K3VLB5BY.mjs +22598 -0
- package/build/chunk-NMKWLVJK.cjs +22599 -0
- package/build/estree-NGS2AYBH.cjs +4388 -0
- package/build/estree-XLH46TSP.mjs +4388 -0
- package/build/flow-DHPXOK5S.mjs +27251 -0
- package/build/flow-RDDDCZAV.cjs +27251 -0
- package/build/glimmer-CAMUE4OK.cjs +2823 -0
- package/build/glimmer-E3TJQSQ4.mjs +2823 -0
- package/build/graphql-22VX22UI.mjs +1257 -0
- package/build/graphql-YJNPH5D2.cjs +1257 -0
- package/build/html-TYMOOA3H.cjs +2792 -0
- package/build/html-ZAWF5C3B.mjs +2792 -0
- package/build/index.cjs +67 -60
- package/build/index.d.cts +1 -1
- package/build/index.mjs +47 -38
- package/build/lingo-turbopack-loader.cjs +4 -5
- package/build/lingo-turbopack-loader.d.cts +1 -1
- package/build/lingo-turbopack-loader.mjs +2 -1
- package/build/markdown-EW4GGIPV.cjs +3536 -0
- package/build/markdown-WJTZKU3V.mjs +3536 -0
- package/build/meriyah-FBYDJ6EA.mjs +2631 -0
- package/build/meriyah-OWUHWYCU.cjs +2631 -0
- package/build/postcss-3TJJTQXP.mjs +5083 -0
- package/build/postcss-MQS25GNZ.cjs +5083 -0
- package/build/typescript-FJLY3MEC.mjs +13205 -0
- package/build/typescript-Z5DYTVQY.cjs +13205 -0
- package/build/yaml-FHNA2CVI.cjs +4222 -0
- package/build/yaml-MMD4LQP5.mjs +4222 -0
- package/package.json +41 -34
- package/build/chunk-COKHINWO.mjs +0 -2743
- package/build/chunk-TMPC4O5V.cjs +0 -2743
|
@@ -0,0 +1,1257 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;require('./chunk-AKFJBAG4.cjs');
|
|
2
|
+
|
|
3
|
+
// ../../node_modules/.pnpm/prettier@3.6.2/node_modules/prettier/plugins/graphql.mjs
|
|
4
|
+
var Et = Object.defineProperty;
|
|
5
|
+
var xe = (e2, t) => {
|
|
6
|
+
for (var n in t) Et(e2, n, { get: t[n], enumerable: true });
|
|
7
|
+
};
|
|
8
|
+
var Ne = {};
|
|
9
|
+
xe(Ne, { languages: () => Qe, options: () => Ke, parsers: () => _e, printers: () => pn });
|
|
10
|
+
var Tt = (e2, t, n, i) => {
|
|
11
|
+
if (!(e2 && t == null)) return t.replaceAll ? t.replaceAll(n, i) : n.global ? t.replace(n, i) : t.split(n).join(i);
|
|
12
|
+
};
|
|
13
|
+
var G = Tt;
|
|
14
|
+
var j = "indent";
|
|
15
|
+
var $ = "group";
|
|
16
|
+
var w = "if-break";
|
|
17
|
+
var S = "line";
|
|
18
|
+
var X = "break-parent";
|
|
19
|
+
var Re = () => {
|
|
20
|
+
};
|
|
21
|
+
var L = Re;
|
|
22
|
+
var le = Re;
|
|
23
|
+
function N(e2) {
|
|
24
|
+
return L(e2), { type: j, contents: e2 };
|
|
25
|
+
}
|
|
26
|
+
function y(e2, t = {}) {
|
|
27
|
+
return L(e2), le(t.expandedStates, true), { type: $, id: t.id, contents: e2, break: !!t.shouldBreak, expandedStates: t.expandedStates };
|
|
28
|
+
}
|
|
29
|
+
function I(e2, t = "", n = {}) {
|
|
30
|
+
return L(e2), t !== "" && L(t), { type: w, breakContents: e2, flatContents: t, groupId: n.groupId };
|
|
31
|
+
}
|
|
32
|
+
var yt = { type: X };
|
|
33
|
+
var Ot = { type: S, hard: true };
|
|
34
|
+
var k = { type: S };
|
|
35
|
+
var p = { type: S, soft: true };
|
|
36
|
+
var f = [Ot, yt];
|
|
37
|
+
function E(e2, t) {
|
|
38
|
+
L(e2), le(t);
|
|
39
|
+
let n = [];
|
|
40
|
+
for (let i = 0; i < t.length; i++) i !== 0 && n.push(e2), n.push(t[i]);
|
|
41
|
+
return n;
|
|
42
|
+
}
|
|
43
|
+
function H(e2) {
|
|
44
|
+
return (t, n, i) => {
|
|
45
|
+
let r = !!(i != null && i.backwards);
|
|
46
|
+
if (n === false) return false;
|
|
47
|
+
let { length: s } = t, a = n;
|
|
48
|
+
for (; a >= 0 && a < s; ) {
|
|
49
|
+
let u = t.charAt(a);
|
|
50
|
+
if (e2 instanceof RegExp) {
|
|
51
|
+
if (!e2.test(u)) return a;
|
|
52
|
+
} else if (!e2.includes(u)) return a;
|
|
53
|
+
r ? a-- : a++;
|
|
54
|
+
}
|
|
55
|
+
return a === -1 || a === s ? a : false;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
var Qn = H(/\s/u);
|
|
59
|
+
var J = H(" ");
|
|
60
|
+
var ve = H(",; ");
|
|
61
|
+
var Le = H(/[^\n\r]/u);
|
|
62
|
+
function It(e2, t, n) {
|
|
63
|
+
let i = !!(n != null && n.backwards);
|
|
64
|
+
if (t === false) return false;
|
|
65
|
+
let r = e2.charAt(t);
|
|
66
|
+
if (i) {
|
|
67
|
+
if (e2.charAt(t - 1) === "\r" && r === `
|
|
68
|
+
`) return t - 2;
|
|
69
|
+
if (r === `
|
|
70
|
+
` || r === "\r" || r === "\u2028" || r === "\u2029") return t - 1;
|
|
71
|
+
} else {
|
|
72
|
+
if (r === "\r" && e2.charAt(t + 1) === `
|
|
73
|
+
`) return t + 2;
|
|
74
|
+
if (r === `
|
|
75
|
+
` || r === "\r" || r === "\u2028" || r === "\u2029") return t + 1;
|
|
76
|
+
}
|
|
77
|
+
return t;
|
|
78
|
+
}
|
|
79
|
+
var q = It;
|
|
80
|
+
function At(e2, t, n = {}) {
|
|
81
|
+
let i = J(e2, n.backwards ? t - 1 : t, n), r = q(e2, i, n);
|
|
82
|
+
return i !== r;
|
|
83
|
+
}
|
|
84
|
+
var be = At;
|
|
85
|
+
function Dt(e2, t) {
|
|
86
|
+
if (t === false) return false;
|
|
87
|
+
if (e2.charAt(t) === "/" && e2.charAt(t + 1) === "*") {
|
|
88
|
+
for (let n = t + 2; n < e2.length; ++n) if (e2.charAt(n) === "*" && e2.charAt(n + 1) === "/") return n + 2;
|
|
89
|
+
}
|
|
90
|
+
return t;
|
|
91
|
+
}
|
|
92
|
+
var Pe = Dt;
|
|
93
|
+
function gt(e2, t) {
|
|
94
|
+
return t === false ? false : e2.charAt(t) === "/" && e2.charAt(t + 1) === "/" ? Le(e2, t) : t;
|
|
95
|
+
}
|
|
96
|
+
var we = gt;
|
|
97
|
+
function kt(e2, t) {
|
|
98
|
+
let n = null, i = t;
|
|
99
|
+
for (; i !== n; ) n = i, i = ve(e2, i), i = Pe(e2, i), i = J(e2, i);
|
|
100
|
+
return i = we(e2, i), i = q(e2, i), i !== false && be(e2, i);
|
|
101
|
+
}
|
|
102
|
+
var Fe = kt;
|
|
103
|
+
function St(e2) {
|
|
104
|
+
return Array.isArray(e2) && e2.length > 0;
|
|
105
|
+
}
|
|
106
|
+
var pe = St;
|
|
107
|
+
var fe = (_class = class extends Error {
|
|
108
|
+
__init() {this.name = "UnexpectedNodeError"}
|
|
109
|
+
constructor(t, n, i = "type") {
|
|
110
|
+
super(`Unexpected ${n} node ${i}: ${JSON.stringify(t[i])}.`);_class.prototype.__init.call(this);, this.node = t;
|
|
111
|
+
}
|
|
112
|
+
}, _class);
|
|
113
|
+
var Be = fe;
|
|
114
|
+
var F = null;
|
|
115
|
+
function B(e2) {
|
|
116
|
+
if (F !== null && typeof F.property) {
|
|
117
|
+
let t = F;
|
|
118
|
+
return F = B.prototype = null, t;
|
|
119
|
+
}
|
|
120
|
+
return F = B.prototype = _nullishCoalesce(e2, () => ( /* @__PURE__ */ Object.create(null))), new B();
|
|
121
|
+
}
|
|
122
|
+
var Ct = 10;
|
|
123
|
+
for (let e2 = 0; e2 <= Ct; e2++) B();
|
|
124
|
+
function he(e2) {
|
|
125
|
+
return B(e2);
|
|
126
|
+
}
|
|
127
|
+
function Rt(e2, t = "type") {
|
|
128
|
+
he(e2);
|
|
129
|
+
function n(i) {
|
|
130
|
+
let r = i[t], s = e2[r];
|
|
131
|
+
if (!Array.isArray(s)) throw Object.assign(new Error(`Missing visitor keys for '${r}'.`), { node: i });
|
|
132
|
+
return s;
|
|
133
|
+
}
|
|
134
|
+
return n;
|
|
135
|
+
}
|
|
136
|
+
var Ue = Rt;
|
|
137
|
+
var Q = class {
|
|
138
|
+
constructor(t, n, i) {
|
|
139
|
+
this.start = t.start, this.end = n.end, this.startToken = t, this.endToken = n, this.source = i;
|
|
140
|
+
}
|
|
141
|
+
get [Symbol.toStringTag]() {
|
|
142
|
+
return "Location";
|
|
143
|
+
}
|
|
144
|
+
toJSON() {
|
|
145
|
+
return { start: this.start, end: this.end };
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
var U = class {
|
|
149
|
+
constructor(t, n, i, r, s, a) {
|
|
150
|
+
this.kind = t, this.start = n, this.end = i, this.line = r, this.column = s, this.value = a, this.prev = null, this.next = null;
|
|
151
|
+
}
|
|
152
|
+
get [Symbol.toStringTag]() {
|
|
153
|
+
return "Token";
|
|
154
|
+
}
|
|
155
|
+
toJSON() {
|
|
156
|
+
return { kind: this.kind, value: this.value, line: this.line, column: this.column };
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
var W = { Name: [], Document: ["definitions"], OperationDefinition: ["name", "variableDefinitions", "directives", "selectionSet"], VariableDefinition: ["variable", "type", "defaultValue", "directives"], Variable: ["name"], SelectionSet: ["selections"], Field: ["alias", "name", "arguments", "directives", "selectionSet"], Argument: ["name", "value"], FragmentSpread: ["name", "directives"], InlineFragment: ["typeCondition", "directives", "selectionSet"], FragmentDefinition: ["name", "variableDefinitions", "typeCondition", "directives", "selectionSet"], IntValue: [], FloatValue: [], StringValue: [], BooleanValue: [], NullValue: [], EnumValue: [], ListValue: ["values"], ObjectValue: ["fields"], ObjectField: ["name", "value"], Directive: ["name", "arguments"], NamedType: ["name"], ListType: ["type"], NonNullType: ["type"], SchemaDefinition: ["description", "directives", "operationTypes"], OperationTypeDefinition: ["type"], ScalarTypeDefinition: ["description", "name", "directives"], ObjectTypeDefinition: ["description", "name", "interfaces", "directives", "fields"], FieldDefinition: ["description", "name", "arguments", "type", "directives"], InputValueDefinition: ["description", "name", "type", "defaultValue", "directives"], InterfaceTypeDefinition: ["description", "name", "interfaces", "directives", "fields"], UnionTypeDefinition: ["description", "name", "directives", "types"], EnumTypeDefinition: ["description", "name", "directives", "values"], EnumValueDefinition: ["description", "name", "directives"], InputObjectTypeDefinition: ["description", "name", "directives", "fields"], DirectiveDefinition: ["description", "name", "arguments", "locations"], SchemaExtension: ["directives", "operationTypes"], ScalarTypeExtension: ["name", "directives"], ObjectTypeExtension: ["name", "interfaces", "directives", "fields"], InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"], UnionTypeExtension: ["name", "directives", "types"], EnumTypeExtension: ["name", "directives", "values"], InputObjectTypeExtension: ["name", "directives", "fields"] };
|
|
160
|
+
var mr = new Set(Object.keys(W));
|
|
161
|
+
var C;
|
|
162
|
+
(function(e2) {
|
|
163
|
+
e2.QUERY = "query", e2.MUTATION = "mutation", e2.SUBSCRIPTION = "subscription";
|
|
164
|
+
})(C || (C = {}));
|
|
165
|
+
var vt = Ue(W, "kind");
|
|
166
|
+
var Me = vt;
|
|
167
|
+
function K(e2) {
|
|
168
|
+
return e2.loc.start;
|
|
169
|
+
}
|
|
170
|
+
function z(e2) {
|
|
171
|
+
return e2.loc.end;
|
|
172
|
+
}
|
|
173
|
+
var Ve = "format";
|
|
174
|
+
var Ye = /^\s*#[^\S\n]*@(?:noformat|noprettier)\s*(?:\n|$)/u;
|
|
175
|
+
var Ge = /^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/u;
|
|
176
|
+
function je(e2) {
|
|
177
|
+
return Ge.test(e2);
|
|
178
|
+
}
|
|
179
|
+
function $e(e2) {
|
|
180
|
+
return Ye.test(e2);
|
|
181
|
+
}
|
|
182
|
+
function Xe(e2) {
|
|
183
|
+
return `# @${Ve}
|
|
184
|
+
|
|
185
|
+
${e2}`;
|
|
186
|
+
}
|
|
187
|
+
function Lt(e2, t, n) {
|
|
188
|
+
let { node: i } = e2;
|
|
189
|
+
if (!i.description) return "";
|
|
190
|
+
let r = [n("description")];
|
|
191
|
+
return i.kind === "InputValueDefinition" && !i.description.block ? r.push(k) : r.push(f), r;
|
|
192
|
+
}
|
|
193
|
+
var D = Lt;
|
|
194
|
+
function bt(e2, t, n) {
|
|
195
|
+
let { node: i } = e2;
|
|
196
|
+
switch (i.kind) {
|
|
197
|
+
case "Document":
|
|
198
|
+
return [...E(f, g(e2, t, n, "definitions")), f];
|
|
199
|
+
case "OperationDefinition": {
|
|
200
|
+
let r = t.originalText[K(i)] !== "{", s = !!i.name;
|
|
201
|
+
return [r ? i.operation : "", r && s ? [" ", n("name")] : "", r && !s && pe(i.variableDefinitions) ? " " : "", He(e2, n), x(e2, n, i), !r && !s ? "" : " ", n("selectionSet")];
|
|
202
|
+
}
|
|
203
|
+
case "FragmentDefinition":
|
|
204
|
+
return ["fragment ", n("name"), He(e2, n), " on ", n("typeCondition"), x(e2, n, i), " ", n("selectionSet")];
|
|
205
|
+
case "SelectionSet":
|
|
206
|
+
return ["{", N([f, E(f, g(e2, t, n, "selections"))]), f, "}"];
|
|
207
|
+
case "Field":
|
|
208
|
+
return y([i.alias ? [n("alias"), ": "] : "", n("name"), i.arguments.length > 0 ? y(["(", N([p, E([I("", ", "), p], g(e2, t, n, "arguments"))]), p, ")"]) : "", x(e2, n, i), i.selectionSet ? " " : "", n("selectionSet")]);
|
|
209
|
+
case "Name":
|
|
210
|
+
return i.value;
|
|
211
|
+
case "StringValue":
|
|
212
|
+
if (i.block) {
|
|
213
|
+
let r = G(false, i.value, '"""', String.raw`\"""`).split(`
|
|
214
|
+
`);
|
|
215
|
+
return r.length === 1 && (r[0] = r[0].trim()), r.every((s) => s === "") && (r.length = 0), E(f, ['"""', ...r, '"""']);
|
|
216
|
+
}
|
|
217
|
+
return ['"', G(false, G(false, i.value, /["\\]/gu, String.raw`\$&`), `
|
|
218
|
+
`, String.raw`\n`), '"'];
|
|
219
|
+
case "IntValue":
|
|
220
|
+
case "FloatValue":
|
|
221
|
+
case "EnumValue":
|
|
222
|
+
return i.value;
|
|
223
|
+
case "BooleanValue":
|
|
224
|
+
return i.value ? "true" : "false";
|
|
225
|
+
case "NullValue":
|
|
226
|
+
return "null";
|
|
227
|
+
case "Variable":
|
|
228
|
+
return ["$", n("name")];
|
|
229
|
+
case "ListValue":
|
|
230
|
+
return y(["[", N([p, E([I("", ", "), p], e2.map(n, "values"))]), p, "]"]);
|
|
231
|
+
case "ObjectValue": {
|
|
232
|
+
let r = t.bracketSpacing && i.fields.length > 0 ? " " : "";
|
|
233
|
+
return y(["{", r, N([p, E([I("", ", "), p], e2.map(n, "fields"))]), p, I("", r), "}"]);
|
|
234
|
+
}
|
|
235
|
+
case "ObjectField":
|
|
236
|
+
case "Argument":
|
|
237
|
+
return [n("name"), ": ", n("value")];
|
|
238
|
+
case "Directive":
|
|
239
|
+
return ["@", n("name"), i.arguments.length > 0 ? y(["(", N([p, E([I("", ", "), p], g(e2, t, n, "arguments"))]), p, ")"]) : ""];
|
|
240
|
+
case "NamedType":
|
|
241
|
+
return n("name");
|
|
242
|
+
case "VariableDefinition":
|
|
243
|
+
return [n("variable"), ": ", n("type"), i.defaultValue ? [" = ", n("defaultValue")] : "", x(e2, n, i)];
|
|
244
|
+
case "ObjectTypeExtension":
|
|
245
|
+
case "ObjectTypeDefinition":
|
|
246
|
+
case "InputObjectTypeExtension":
|
|
247
|
+
case "InputObjectTypeDefinition":
|
|
248
|
+
case "InterfaceTypeExtension":
|
|
249
|
+
case "InterfaceTypeDefinition": {
|
|
250
|
+
let { kind: r } = i, s = [];
|
|
251
|
+
return r.endsWith("TypeDefinition") ? s.push(D(e2, t, n)) : s.push("extend "), r.startsWith("ObjectType") ? s.push("type") : r.startsWith("InputObjectType") ? s.push("input") : s.push("interface"), s.push(" ", n("name")), !r.startsWith("InputObjectType") && i.interfaces.length > 0 && s.push(" implements ", ...Ft(e2, t, n)), s.push(x(e2, n, i)), i.fields.length > 0 && s.push([" {", N([f, E(f, g(e2, t, n, "fields"))]), f, "}"]), s;
|
|
252
|
+
}
|
|
253
|
+
case "FieldDefinition":
|
|
254
|
+
return [D(e2, t, n), n("name"), i.arguments.length > 0 ? y(["(", N([p, E([I("", ", "), p], g(e2, t, n, "arguments"))]), p, ")"]) : "", ": ", n("type"), x(e2, n, i)];
|
|
255
|
+
case "DirectiveDefinition":
|
|
256
|
+
return [D(e2, t, n), "directive ", "@", n("name"), i.arguments.length > 0 ? y(["(", N([p, E([I("", ", "), p], g(e2, t, n, "arguments"))]), p, ")"]) : "", i.repeatable ? " repeatable" : "", " on ", ...E(" | ", e2.map(n, "locations"))];
|
|
257
|
+
case "EnumTypeExtension":
|
|
258
|
+
case "EnumTypeDefinition":
|
|
259
|
+
return [D(e2, t, n), i.kind === "EnumTypeExtension" ? "extend " : "", "enum ", n("name"), x(e2, n, i), i.values.length > 0 ? [" {", N([f, E(f, g(e2, t, n, "values"))]), f, "}"] : ""];
|
|
260
|
+
case "EnumValueDefinition":
|
|
261
|
+
return [D(e2, t, n), n("name"), x(e2, n, i)];
|
|
262
|
+
case "InputValueDefinition":
|
|
263
|
+
return [D(e2, t, n), n("name"), ": ", n("type"), i.defaultValue ? [" = ", n("defaultValue")] : "", x(e2, n, i)];
|
|
264
|
+
case "SchemaExtension":
|
|
265
|
+
return ["extend schema", x(e2, n, i), ...i.operationTypes.length > 0 ? [" {", N([f, E(f, g(e2, t, n, "operationTypes"))]), f, "}"] : []];
|
|
266
|
+
case "SchemaDefinition":
|
|
267
|
+
return [D(e2, t, n), "schema", x(e2, n, i), " {", i.operationTypes.length > 0 ? N([f, E(f, g(e2, t, n, "operationTypes"))]) : "", f, "}"];
|
|
268
|
+
case "OperationTypeDefinition":
|
|
269
|
+
return [i.operation, ": ", n("type")];
|
|
270
|
+
case "FragmentSpread":
|
|
271
|
+
return ["...", n("name"), x(e2, n, i)];
|
|
272
|
+
case "InlineFragment":
|
|
273
|
+
return ["...", i.typeCondition ? [" on ", n("typeCondition")] : "", x(e2, n, i), " ", n("selectionSet")];
|
|
274
|
+
case "UnionTypeExtension":
|
|
275
|
+
case "UnionTypeDefinition":
|
|
276
|
+
return y([D(e2, t, n), y([i.kind === "UnionTypeExtension" ? "extend " : "", "union ", n("name"), x(e2, n, i), i.types.length > 0 ? [" =", I("", " "), N([I([k, "| "]), E([k, "| "], e2.map(n, "types"))])] : ""])]);
|
|
277
|
+
case "ScalarTypeExtension":
|
|
278
|
+
case "ScalarTypeDefinition":
|
|
279
|
+
return [D(e2, t, n), i.kind === "ScalarTypeExtension" ? "extend " : "", "scalar ", n("name"), x(e2, n, i)];
|
|
280
|
+
case "NonNullType":
|
|
281
|
+
return [n("type"), "!"];
|
|
282
|
+
case "ListType":
|
|
283
|
+
return ["[", n("type"), "]"];
|
|
284
|
+
default:
|
|
285
|
+
throw new Be(i, "Graphql", "kind");
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
function x(e2, t, n) {
|
|
289
|
+
if (n.directives.length === 0) return "";
|
|
290
|
+
let i = E(k, e2.map(t, "directives"));
|
|
291
|
+
return n.kind === "FragmentDefinition" || n.kind === "OperationDefinition" ? y([k, i]) : [" ", y(N([p, i]))];
|
|
292
|
+
}
|
|
293
|
+
function g(e2, t, n, i) {
|
|
294
|
+
return e2.map(({ isLast: r, node: s }) => {
|
|
295
|
+
let a = n();
|
|
296
|
+
return !r && Fe(t.originalText, z(s)) ? [a, f] : a;
|
|
297
|
+
}, i);
|
|
298
|
+
}
|
|
299
|
+
function Pt(e2) {
|
|
300
|
+
return e2.kind !== "Comment";
|
|
301
|
+
}
|
|
302
|
+
function wt(e2) {
|
|
303
|
+
let t = e2.node;
|
|
304
|
+
if (t.kind === "Comment") return "#" + t.value.trimEnd();
|
|
305
|
+
throw new Error("Not a comment: " + JSON.stringify(t));
|
|
306
|
+
}
|
|
307
|
+
function Ft(e2, t, n) {
|
|
308
|
+
let { node: i } = e2, r = [], { interfaces: s } = i, a = e2.map(n, "interfaces");
|
|
309
|
+
for (let u = 0; u < s.length; u++) {
|
|
310
|
+
let l = s[u];
|
|
311
|
+
r.push(a[u]);
|
|
312
|
+
let T = s[u + 1];
|
|
313
|
+
if (T) {
|
|
314
|
+
let A = t.originalText.slice(l.loc.end, T.loc.start).includes("#");
|
|
315
|
+
r.push(" &", A ? k : " ");
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return r;
|
|
319
|
+
}
|
|
320
|
+
function He(e2, t) {
|
|
321
|
+
let { node: n } = e2;
|
|
322
|
+
return pe(n.variableDefinitions) ? y(["(", N([p, E([I("", ", "), p], e2.map(t, "variableDefinitions"))]), p, ")"]) : "";
|
|
323
|
+
}
|
|
324
|
+
function Je(e2, t) {
|
|
325
|
+
e2.kind === "StringValue" && e2.block && !e2.value.includes(`
|
|
326
|
+
`) && (t.value = e2.value.trim());
|
|
327
|
+
}
|
|
328
|
+
Je.ignoredProperties = /* @__PURE__ */ new Set(["loc", "comments"]);
|
|
329
|
+
function Bt(e2) {
|
|
330
|
+
var n;
|
|
331
|
+
let { node: t } = e2;
|
|
332
|
+
return (n = t == null ? void 0 : t.comments) == null ? void 0 : n.some((i) => i.value.trim() === "prettier-ignore");
|
|
333
|
+
}
|
|
334
|
+
var Ut = { print: bt, massageAstNode: Je, hasPrettierIgnore: Bt, insertPragma: Xe, printComment: wt, canAttachComment: Pt, getVisitorKeys: Me };
|
|
335
|
+
var qe = Ut;
|
|
336
|
+
var Qe = [{ name: "GraphQL", type: "data", extensions: [".graphql", ".gql", ".graphqls"], tmScope: "source.graphql", aceMode: "text", parsers: ["graphql"], vscodeLanguageIds: ["graphql"], linguistLanguageId: 139 }];
|
|
337
|
+
var We = { bracketSpacing: { category: "Common", type: "boolean", default: true, description: "Print spaces between brackets.", oppositeDescription: "Do not print spaces between brackets." }, objectWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap object literals.", choices: [{ value: "preserve", description: "Keep as multi-line, if there is a newline between the opening brace and first property." }, { value: "collapse", description: "Fit to a single line when possible." }] }, singleQuote: { category: "Common", type: "boolean", default: false, description: "Use single quotes instead of double quotes." }, proseWrap: { category: "Common", type: "choice", default: "preserve", description: "How to wrap prose.", choices: [{ value: "always", description: "Wrap prose if it exceeds the print width." }, { value: "never", description: "Do not wrap prose." }, { value: "preserve", description: "Wrap prose as-is." }] }, bracketSameLine: { category: "Common", type: "boolean", default: false, description: "Put > of opening tags on the last line instead of on a new line." }, singleAttributePerLine: { category: "Common", type: "boolean", default: false, description: "Enforce single attribute per line in HTML, Vue and JSX." } };
|
|
338
|
+
var Mt = { bracketSpacing: We.bracketSpacing };
|
|
339
|
+
var Ke = Mt;
|
|
340
|
+
var _e = {};
|
|
341
|
+
xe(_e, { graphql: () => ln });
|
|
342
|
+
function ze(e2) {
|
|
343
|
+
return typeof e2 == "object" && e2 !== null;
|
|
344
|
+
}
|
|
345
|
+
function Ze(e2, t) {
|
|
346
|
+
if (!!!e2) throw new Error(_nullishCoalesce(t, () => ( "Unexpected invariant triggered.")));
|
|
347
|
+
}
|
|
348
|
+
var Vt = /\r\n|[\n\r]/g;
|
|
349
|
+
function M(e2, t) {
|
|
350
|
+
let n = 0, i = 1;
|
|
351
|
+
for (let r of e2.body.matchAll(Vt)) {
|
|
352
|
+
if (typeof r.index == "number" || Ze(false), r.index >= t) break;
|
|
353
|
+
n = r.index + r[0].length, i += 1;
|
|
354
|
+
}
|
|
355
|
+
return { line: i, column: t + 1 - n };
|
|
356
|
+
}
|
|
357
|
+
function tt(e2) {
|
|
358
|
+
return de(e2.source, M(e2.source, e2.start));
|
|
359
|
+
}
|
|
360
|
+
function de(e2, t) {
|
|
361
|
+
let n = e2.locationOffset.column - 1, i = "".padStart(n) + e2.body, r = t.line - 1, s = e2.locationOffset.line - 1, a = t.line + s, u = t.line === 1 ? n : 0, l = t.column + u, T = `${e2.name}:${a}:${l}
|
|
362
|
+
`, h = i.split(/\r\n|[\n\r]/g), A = h[r];
|
|
363
|
+
if (A.length > 120) {
|
|
364
|
+
let O = Math.floor(l / 80), ae = l % 80, _ = [];
|
|
365
|
+
for (let v = 0; v < A.length; v += 80) _.push(A.slice(v, v + 80));
|
|
366
|
+
return T + et([[`${a} |`, _[0]], ..._.slice(1, O + 1).map((v) => ["|", v]), ["|", "^".padStart(ae)], ["|", _[O + 1]]]);
|
|
367
|
+
}
|
|
368
|
+
return T + et([[`${a - 1} |`, h[r - 1]], [`${a} |`, A], ["|", "^".padStart(l)], [`${a + 1} |`, h[r + 1]]]);
|
|
369
|
+
}
|
|
370
|
+
function et(e2) {
|
|
371
|
+
let t = e2.filter(([i, r]) => r !== void 0), n = Math.max(...t.map(([i]) => i.length));
|
|
372
|
+
return t.map(([i, r]) => i.padStart(n) + (r ? " " + r : "")).join(`
|
|
373
|
+
`);
|
|
374
|
+
}
|
|
375
|
+
function Yt(e2) {
|
|
376
|
+
let t = e2[0];
|
|
377
|
+
return t == null || "kind" in t || "length" in t ? { nodes: t, source: e2[1], positions: e2[2], path: e2[3], originalError: e2[4], extensions: e2[5] } : t;
|
|
378
|
+
}
|
|
379
|
+
var Z = class e extends Error {
|
|
380
|
+
constructor(t, ...n) {
|
|
381
|
+
var i, r, s;
|
|
382
|
+
let { nodes: a, source: u, positions: l, path: T, originalError: h, extensions: A } = Yt(n);
|
|
383
|
+
super(t), this.name = "GraphQLError", this.path = _nullishCoalesce(T, () => ( void 0)), this.originalError = _nullishCoalesce(h, () => ( void 0)), this.nodes = nt(Array.isArray(a) ? a : a ? [a] : void 0);
|
|
384
|
+
let O = nt((i = this.nodes) === null || i === void 0 ? void 0 : i.map((_) => _.loc).filter((_) => _ != null));
|
|
385
|
+
this.source = _nullishCoalesce(u, () => ( (O == null || (r = O[0]) === null || r === void 0 ? void 0 : r.source))), this.positions = _nullishCoalesce(l, () => ( (O == null ? void 0 : O.map((_) => _.start)))), this.locations = l && u ? l.map((_) => M(u, _)) : O == null ? void 0 : O.map((_) => M(_.source, _.start));
|
|
386
|
+
let ae = ze(h == null ? void 0 : h.extensions) ? h == null ? void 0 : h.extensions : void 0;
|
|
387
|
+
this.extensions = (s = _nullishCoalesce(A, () => ( ae))) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, { message: { writable: true, enumerable: true }, name: { enumerable: false }, nodes: { enumerable: false }, source: { enumerable: false }, positions: { enumerable: false }, originalError: { enumerable: false } }), h != null && h.stack ? Object.defineProperty(this, "stack", { value: h.stack, writable: true, configurable: true }) : Error.captureStackTrace ? Error.captureStackTrace(this, e) : Object.defineProperty(this, "stack", { value: Error().stack, writable: true, configurable: true });
|
|
388
|
+
}
|
|
389
|
+
get [Symbol.toStringTag]() {
|
|
390
|
+
return "GraphQLError";
|
|
391
|
+
}
|
|
392
|
+
toString() {
|
|
393
|
+
let t = this.message;
|
|
394
|
+
if (this.nodes) for (let n of this.nodes) n.loc && (t += `
|
|
395
|
+
|
|
396
|
+
` + tt(n.loc));
|
|
397
|
+
else if (this.source && this.locations) for (let n of this.locations) t += `
|
|
398
|
+
|
|
399
|
+
` + de(this.source, n);
|
|
400
|
+
return t;
|
|
401
|
+
}
|
|
402
|
+
toJSON() {
|
|
403
|
+
let t = { message: this.message };
|
|
404
|
+
return this.locations != null && (t.locations = this.locations), this.path != null && (t.path = this.path), this.extensions != null && Object.keys(this.extensions).length > 0 && (t.extensions = this.extensions), t;
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
function nt(e2) {
|
|
408
|
+
return e2 === void 0 || e2.length === 0 ? void 0 : e2;
|
|
409
|
+
}
|
|
410
|
+
function d(e2, t, n) {
|
|
411
|
+
return new Z(`Syntax Error: ${n}`, { source: e2, positions: [t] });
|
|
412
|
+
}
|
|
413
|
+
var ee;
|
|
414
|
+
(function(e2) {
|
|
415
|
+
e2.QUERY = "QUERY", e2.MUTATION = "MUTATION", e2.SUBSCRIPTION = "SUBSCRIPTION", e2.FIELD = "FIELD", e2.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION", e2.FRAGMENT_SPREAD = "FRAGMENT_SPREAD", e2.INLINE_FRAGMENT = "INLINE_FRAGMENT", e2.VARIABLE_DEFINITION = "VARIABLE_DEFINITION", e2.SCHEMA = "SCHEMA", e2.SCALAR = "SCALAR", e2.OBJECT = "OBJECT", e2.FIELD_DEFINITION = "FIELD_DEFINITION", e2.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION", e2.INTERFACE = "INTERFACE", e2.UNION = "UNION", e2.ENUM = "ENUM", e2.ENUM_VALUE = "ENUM_VALUE", e2.INPUT_OBJECT = "INPUT_OBJECT", e2.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION";
|
|
416
|
+
})(ee || (ee = {}));
|
|
417
|
+
var c;
|
|
418
|
+
(function(e2) {
|
|
419
|
+
e2.NAME = "Name", e2.DOCUMENT = "Document", e2.OPERATION_DEFINITION = "OperationDefinition", e2.VARIABLE_DEFINITION = "VariableDefinition", e2.SELECTION_SET = "SelectionSet", e2.FIELD = "Field", e2.ARGUMENT = "Argument", e2.FRAGMENT_SPREAD = "FragmentSpread", e2.INLINE_FRAGMENT = "InlineFragment", e2.FRAGMENT_DEFINITION = "FragmentDefinition", e2.VARIABLE = "Variable", e2.INT = "IntValue", e2.FLOAT = "FloatValue", e2.STRING = "StringValue", e2.BOOLEAN = "BooleanValue", e2.NULL = "NullValue", e2.ENUM = "EnumValue", e2.LIST = "ListValue", e2.OBJECT = "ObjectValue", e2.OBJECT_FIELD = "ObjectField", e2.DIRECTIVE = "Directive", e2.NAMED_TYPE = "NamedType", e2.LIST_TYPE = "ListType", e2.NON_NULL_TYPE = "NonNullType", e2.SCHEMA_DEFINITION = "SchemaDefinition", e2.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", e2.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", e2.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", e2.FIELD_DEFINITION = "FieldDefinition", e2.INPUT_VALUE_DEFINITION = "InputValueDefinition", e2.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", e2.UNION_TYPE_DEFINITION = "UnionTypeDefinition", e2.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", e2.ENUM_VALUE_DEFINITION = "EnumValueDefinition", e2.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", e2.DIRECTIVE_DEFINITION = "DirectiveDefinition", e2.SCHEMA_EXTENSION = "SchemaExtension", e2.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", e2.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", e2.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", e2.UNION_TYPE_EXTENSION = "UnionTypeExtension", e2.ENUM_TYPE_EXTENSION = "EnumTypeExtension", e2.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension";
|
|
420
|
+
})(c || (c = {}));
|
|
421
|
+
function rt(e2) {
|
|
422
|
+
return e2 === 9 || e2 === 32;
|
|
423
|
+
}
|
|
424
|
+
function b(e2) {
|
|
425
|
+
return e2 >= 48 && e2 <= 57;
|
|
426
|
+
}
|
|
427
|
+
function it(e2) {
|
|
428
|
+
return e2 >= 97 && e2 <= 122 || e2 >= 65 && e2 <= 90;
|
|
429
|
+
}
|
|
430
|
+
function me(e2) {
|
|
431
|
+
return it(e2) || e2 === 95;
|
|
432
|
+
}
|
|
433
|
+
function st(e2) {
|
|
434
|
+
return it(e2) || b(e2) || e2 === 95;
|
|
435
|
+
}
|
|
436
|
+
function ot(e2) {
|
|
437
|
+
var t;
|
|
438
|
+
let n = Number.MAX_SAFE_INTEGER, i = null, r = -1;
|
|
439
|
+
for (let a = 0; a < e2.length; ++a) {
|
|
440
|
+
var s;
|
|
441
|
+
let u = e2[a], l = Gt(u);
|
|
442
|
+
l !== u.length && (i = (s = i) !== null && s !== void 0 ? s : a, r = a, a !== 0 && l < n && (n = l));
|
|
443
|
+
}
|
|
444
|
+
return e2.map((a, u) => u === 0 ? a : a.slice(n)).slice((t = i) !== null && t !== void 0 ? t : 0, r + 1);
|
|
445
|
+
}
|
|
446
|
+
function Gt(e2) {
|
|
447
|
+
let t = 0;
|
|
448
|
+
for (; t < e2.length && rt(e2.charCodeAt(t)); ) ++t;
|
|
449
|
+
return t;
|
|
450
|
+
}
|
|
451
|
+
var o;
|
|
452
|
+
(function(e2) {
|
|
453
|
+
e2.SOF = "<SOF>", e2.EOF = "<EOF>", e2.BANG = "!", e2.DOLLAR = "$", e2.AMP = "&", e2.PAREN_L = "(", e2.PAREN_R = ")", e2.SPREAD = "...", e2.COLON = ":", e2.EQUALS = "=", e2.AT = "@", e2.BRACKET_L = "[", e2.BRACKET_R = "]", e2.BRACE_L = "{", e2.PIPE = "|", e2.BRACE_R = "}", e2.NAME = "Name", e2.INT = "Int", e2.FLOAT = "Float", e2.STRING = "String", e2.BLOCK_STRING = "BlockString", e2.COMMENT = "Comment";
|
|
454
|
+
})(o || (o = {}));
|
|
455
|
+
var te = class {
|
|
456
|
+
constructor(t) {
|
|
457
|
+
let n = new U(o.SOF, 0, 0, 0, 0);
|
|
458
|
+
this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
|
|
459
|
+
}
|
|
460
|
+
get [Symbol.toStringTag]() {
|
|
461
|
+
return "Lexer";
|
|
462
|
+
}
|
|
463
|
+
advance() {
|
|
464
|
+
return this.lastToken = this.token, this.token = this.lookahead();
|
|
465
|
+
}
|
|
466
|
+
lookahead() {
|
|
467
|
+
let t = this.token;
|
|
468
|
+
if (t.kind !== o.EOF) do
|
|
469
|
+
if (t.next) t = t.next;
|
|
470
|
+
else {
|
|
471
|
+
let n = jt(this, t.end);
|
|
472
|
+
t.next = n, n.prev = t, t = n;
|
|
473
|
+
}
|
|
474
|
+
while (t.kind === o.COMMENT);
|
|
475
|
+
return t;
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
function ct(e2) {
|
|
479
|
+
return e2 === o.BANG || e2 === o.DOLLAR || e2 === o.AMP || e2 === o.PAREN_L || e2 === o.PAREN_R || e2 === o.SPREAD || e2 === o.COLON || e2 === o.EQUALS || e2 === o.AT || e2 === o.BRACKET_L || e2 === o.BRACKET_R || e2 === o.BRACE_L || e2 === o.PIPE || e2 === o.BRACE_R;
|
|
480
|
+
}
|
|
481
|
+
function P(e2) {
|
|
482
|
+
return e2 >= 0 && e2 <= 55295 || e2 >= 57344 && e2 <= 1114111;
|
|
483
|
+
}
|
|
484
|
+
function ne(e2, t) {
|
|
485
|
+
return ut(e2.charCodeAt(t)) && lt(e2.charCodeAt(t + 1));
|
|
486
|
+
}
|
|
487
|
+
function ut(e2) {
|
|
488
|
+
return e2 >= 55296 && e2 <= 56319;
|
|
489
|
+
}
|
|
490
|
+
function lt(e2) {
|
|
491
|
+
return e2 >= 56320 && e2 <= 57343;
|
|
492
|
+
}
|
|
493
|
+
function R(e2, t) {
|
|
494
|
+
let n = e2.source.body.codePointAt(t);
|
|
495
|
+
if (n === void 0) return o.EOF;
|
|
496
|
+
if (n >= 32 && n <= 126) {
|
|
497
|
+
let i = String.fromCodePoint(n);
|
|
498
|
+
return i === '"' ? `'"'` : `"${i}"`;
|
|
499
|
+
}
|
|
500
|
+
return "U+" + n.toString(16).toUpperCase().padStart(4, "0");
|
|
501
|
+
}
|
|
502
|
+
function m(e2, t, n, i, r) {
|
|
503
|
+
let s = e2.line, a = 1 + n - e2.lineStart;
|
|
504
|
+
return new U(t, n, i, s, a, r);
|
|
505
|
+
}
|
|
506
|
+
function jt(e2, t) {
|
|
507
|
+
let n = e2.source.body, i = n.length, r = t;
|
|
508
|
+
for (; r < i; ) {
|
|
509
|
+
let s = n.charCodeAt(r);
|
|
510
|
+
switch (s) {
|
|
511
|
+
case 65279:
|
|
512
|
+
case 9:
|
|
513
|
+
case 32:
|
|
514
|
+
case 44:
|
|
515
|
+
++r;
|
|
516
|
+
continue;
|
|
517
|
+
case 10:
|
|
518
|
+
++r, ++e2.line, e2.lineStart = r;
|
|
519
|
+
continue;
|
|
520
|
+
case 13:
|
|
521
|
+
n.charCodeAt(r + 1) === 10 ? r += 2 : ++r, ++e2.line, e2.lineStart = r;
|
|
522
|
+
continue;
|
|
523
|
+
case 35:
|
|
524
|
+
return $t(e2, r);
|
|
525
|
+
case 33:
|
|
526
|
+
return m(e2, o.BANG, r, r + 1);
|
|
527
|
+
case 36:
|
|
528
|
+
return m(e2, o.DOLLAR, r, r + 1);
|
|
529
|
+
case 38:
|
|
530
|
+
return m(e2, o.AMP, r, r + 1);
|
|
531
|
+
case 40:
|
|
532
|
+
return m(e2, o.PAREN_L, r, r + 1);
|
|
533
|
+
case 41:
|
|
534
|
+
return m(e2, o.PAREN_R, r, r + 1);
|
|
535
|
+
case 46:
|
|
536
|
+
if (n.charCodeAt(r + 1) === 46 && n.charCodeAt(r + 2) === 46) return m(e2, o.SPREAD, r, r + 3);
|
|
537
|
+
break;
|
|
538
|
+
case 58:
|
|
539
|
+
return m(e2, o.COLON, r, r + 1);
|
|
540
|
+
case 61:
|
|
541
|
+
return m(e2, o.EQUALS, r, r + 1);
|
|
542
|
+
case 64:
|
|
543
|
+
return m(e2, o.AT, r, r + 1);
|
|
544
|
+
case 91:
|
|
545
|
+
return m(e2, o.BRACKET_L, r, r + 1);
|
|
546
|
+
case 93:
|
|
547
|
+
return m(e2, o.BRACKET_R, r, r + 1);
|
|
548
|
+
case 123:
|
|
549
|
+
return m(e2, o.BRACE_L, r, r + 1);
|
|
550
|
+
case 124:
|
|
551
|
+
return m(e2, o.PIPE, r, r + 1);
|
|
552
|
+
case 125:
|
|
553
|
+
return m(e2, o.BRACE_R, r, r + 1);
|
|
554
|
+
case 34:
|
|
555
|
+
return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? Wt(e2, r) : Ht(e2, r);
|
|
556
|
+
}
|
|
557
|
+
if (b(s) || s === 45) return Xt(e2, r, s);
|
|
558
|
+
if (me(s)) return Kt(e2, r);
|
|
559
|
+
throw d(e2.source, r, s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : P(s) || ne(n, r) ? `Unexpected character: ${R(e2, r)}.` : `Invalid character: ${R(e2, r)}.`);
|
|
560
|
+
}
|
|
561
|
+
return m(e2, o.EOF, i, i);
|
|
562
|
+
}
|
|
563
|
+
function $t(e2, t) {
|
|
564
|
+
let n = e2.source.body, i = n.length, r = t + 1;
|
|
565
|
+
for (; r < i; ) {
|
|
566
|
+
let s = n.charCodeAt(r);
|
|
567
|
+
if (s === 10 || s === 13) break;
|
|
568
|
+
if (P(s)) ++r;
|
|
569
|
+
else if (ne(n, r)) r += 2;
|
|
570
|
+
else break;
|
|
571
|
+
}
|
|
572
|
+
return m(e2, o.COMMENT, t, r, n.slice(t + 1, r));
|
|
573
|
+
}
|
|
574
|
+
function Xt(e2, t, n) {
|
|
575
|
+
let i = e2.source.body, r = t, s = n, a = false;
|
|
576
|
+
if (s === 45 && (s = i.charCodeAt(++r)), s === 48) {
|
|
577
|
+
if (s = i.charCodeAt(++r), b(s)) throw d(e2.source, r, `Invalid number, unexpected digit after 0: ${R(e2, r)}.`);
|
|
578
|
+
} else r = Ee(e2, r, s), s = i.charCodeAt(r);
|
|
579
|
+
if (s === 46 && (a = true, s = i.charCodeAt(++r), r = Ee(e2, r, s), s = i.charCodeAt(r)), (s === 69 || s === 101) && (a = true, s = i.charCodeAt(++r), (s === 43 || s === 45) && (s = i.charCodeAt(++r)), r = Ee(e2, r, s), s = i.charCodeAt(r)), s === 46 || me(s)) throw d(e2.source, r, `Invalid number, expected digit but got: ${R(e2, r)}.`);
|
|
580
|
+
return m(e2, a ? o.FLOAT : o.INT, t, r, i.slice(t, r));
|
|
581
|
+
}
|
|
582
|
+
function Ee(e2, t, n) {
|
|
583
|
+
if (!b(n)) throw d(e2.source, t, `Invalid number, expected digit but got: ${R(e2, t)}.`);
|
|
584
|
+
let i = e2.source.body, r = t + 1;
|
|
585
|
+
for (; b(i.charCodeAt(r)); ) ++r;
|
|
586
|
+
return r;
|
|
587
|
+
}
|
|
588
|
+
function Ht(e2, t) {
|
|
589
|
+
let n = e2.source.body, i = n.length, r = t + 1, s = r, a = "";
|
|
590
|
+
for (; r < i; ) {
|
|
591
|
+
let u = n.charCodeAt(r);
|
|
592
|
+
if (u === 34) return a += n.slice(s, r), m(e2, o.STRING, t, r + 1, a);
|
|
593
|
+
if (u === 92) {
|
|
594
|
+
a += n.slice(s, r);
|
|
595
|
+
let l = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? Jt(e2, r) : qt(e2, r) : Qt(e2, r);
|
|
596
|
+
a += l.value, r += l.size, s = r;
|
|
597
|
+
continue;
|
|
598
|
+
}
|
|
599
|
+
if (u === 10 || u === 13) break;
|
|
600
|
+
if (P(u)) ++r;
|
|
601
|
+
else if (ne(n, r)) r += 2;
|
|
602
|
+
else throw d(e2.source, r, `Invalid character within String: ${R(e2, r)}.`);
|
|
603
|
+
}
|
|
604
|
+
throw d(e2.source, r, "Unterminated string.");
|
|
605
|
+
}
|
|
606
|
+
function Jt(e2, t) {
|
|
607
|
+
let n = e2.source.body, i = 0, r = 3;
|
|
608
|
+
for (; r < 12; ) {
|
|
609
|
+
let s = n.charCodeAt(t + r++);
|
|
610
|
+
if (s === 125) {
|
|
611
|
+
if (r < 5 || !P(i)) break;
|
|
612
|
+
return { value: String.fromCodePoint(i), size: r };
|
|
613
|
+
}
|
|
614
|
+
if (i = i << 4 | V(s), i < 0) break;
|
|
615
|
+
}
|
|
616
|
+
throw d(e2.source, t, `Invalid Unicode escape sequence: "${n.slice(t, t + r)}".`);
|
|
617
|
+
}
|
|
618
|
+
function qt(e2, t) {
|
|
619
|
+
let n = e2.source.body, i = at(n, t + 2);
|
|
620
|
+
if (P(i)) return { value: String.fromCodePoint(i), size: 6 };
|
|
621
|
+
if (ut(i) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
|
|
622
|
+
let r = at(n, t + 8);
|
|
623
|
+
if (lt(r)) return { value: String.fromCodePoint(i, r), size: 12 };
|
|
624
|
+
}
|
|
625
|
+
throw d(e2.source, t, `Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`);
|
|
626
|
+
}
|
|
627
|
+
function at(e2, t) {
|
|
628
|
+
return V(e2.charCodeAt(t)) << 12 | V(e2.charCodeAt(t + 1)) << 8 | V(e2.charCodeAt(t + 2)) << 4 | V(e2.charCodeAt(t + 3));
|
|
629
|
+
}
|
|
630
|
+
function V(e2) {
|
|
631
|
+
return e2 >= 48 && e2 <= 57 ? e2 - 48 : e2 >= 65 && e2 <= 70 ? e2 - 55 : e2 >= 97 && e2 <= 102 ? e2 - 87 : -1;
|
|
632
|
+
}
|
|
633
|
+
function Qt(e2, t) {
|
|
634
|
+
let n = e2.source.body;
|
|
635
|
+
switch (n.charCodeAt(t + 1)) {
|
|
636
|
+
case 34:
|
|
637
|
+
return { value: '"', size: 2 };
|
|
638
|
+
case 92:
|
|
639
|
+
return { value: "\\", size: 2 };
|
|
640
|
+
case 47:
|
|
641
|
+
return { value: "/", size: 2 };
|
|
642
|
+
case 98:
|
|
643
|
+
return { value: "\b", size: 2 };
|
|
644
|
+
case 102:
|
|
645
|
+
return { value: "\f", size: 2 };
|
|
646
|
+
case 110:
|
|
647
|
+
return { value: `
|
|
648
|
+
`, size: 2 };
|
|
649
|
+
case 114:
|
|
650
|
+
return { value: "\r", size: 2 };
|
|
651
|
+
case 116:
|
|
652
|
+
return { value: " ", size: 2 };
|
|
653
|
+
}
|
|
654
|
+
throw d(e2.source, t, `Invalid character escape sequence: "${n.slice(t, t + 2)}".`);
|
|
655
|
+
}
|
|
656
|
+
function Wt(e2, t) {
|
|
657
|
+
let n = e2.source.body, i = n.length, r = e2.lineStart, s = t + 3, a = s, u = "", l = [];
|
|
658
|
+
for (; s < i; ) {
|
|
659
|
+
let T = n.charCodeAt(s);
|
|
660
|
+
if (T === 34 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34) {
|
|
661
|
+
u += n.slice(a, s), l.push(u);
|
|
662
|
+
let h = m(e2, o.BLOCK_STRING, t, s + 3, ot(l).join(`
|
|
663
|
+
`));
|
|
664
|
+
return e2.line += l.length - 1, e2.lineStart = r, h;
|
|
665
|
+
}
|
|
666
|
+
if (T === 92 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34 && n.charCodeAt(s + 3) === 34) {
|
|
667
|
+
u += n.slice(a, s), a = s + 1, s += 4;
|
|
668
|
+
continue;
|
|
669
|
+
}
|
|
670
|
+
if (T === 10 || T === 13) {
|
|
671
|
+
u += n.slice(a, s), l.push(u), T === 13 && n.charCodeAt(s + 1) === 10 ? s += 2 : ++s, u = "", a = s, r = s;
|
|
672
|
+
continue;
|
|
673
|
+
}
|
|
674
|
+
if (P(T)) ++s;
|
|
675
|
+
else if (ne(n, s)) s += 2;
|
|
676
|
+
else throw d(e2.source, s, `Invalid character within String: ${R(e2, s)}.`);
|
|
677
|
+
}
|
|
678
|
+
throw d(e2.source, s, "Unterminated string.");
|
|
679
|
+
}
|
|
680
|
+
function Kt(e2, t) {
|
|
681
|
+
let n = e2.source.body, i = n.length, r = t + 1;
|
|
682
|
+
for (; r < i; ) {
|
|
683
|
+
let s = n.charCodeAt(r);
|
|
684
|
+
if (st(s)) ++r;
|
|
685
|
+
else break;
|
|
686
|
+
}
|
|
687
|
+
return m(e2, o.NAME, t, r, n.slice(t, r));
|
|
688
|
+
}
|
|
689
|
+
function re(e2, t) {
|
|
690
|
+
if (!!!e2) throw new Error(t);
|
|
691
|
+
}
|
|
692
|
+
function ie(e2) {
|
|
693
|
+
return se(e2, []);
|
|
694
|
+
}
|
|
695
|
+
function se(e2, t) {
|
|
696
|
+
switch (typeof e2) {
|
|
697
|
+
case "string":
|
|
698
|
+
return JSON.stringify(e2);
|
|
699
|
+
case "function":
|
|
700
|
+
return e2.name ? `[function ${e2.name}]` : "[function]";
|
|
701
|
+
case "object":
|
|
702
|
+
return zt(e2, t);
|
|
703
|
+
default:
|
|
704
|
+
return String(e2);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
function zt(e2, t) {
|
|
708
|
+
if (e2 === null) return "null";
|
|
709
|
+
if (t.includes(e2)) return "[Circular]";
|
|
710
|
+
let n = [...t, e2];
|
|
711
|
+
if (Zt(e2)) {
|
|
712
|
+
let i = e2.toJSON();
|
|
713
|
+
if (i !== e2) return typeof i == "string" ? i : se(i, n);
|
|
714
|
+
} else if (Array.isArray(e2)) return tn(e2, n);
|
|
715
|
+
return en(e2, n);
|
|
716
|
+
}
|
|
717
|
+
function Zt(e2) {
|
|
718
|
+
return typeof e2.toJSON == "function";
|
|
719
|
+
}
|
|
720
|
+
function en(e2, t) {
|
|
721
|
+
let n = Object.entries(e2);
|
|
722
|
+
return n.length === 0 ? "{}" : t.length > 2 ? "[" + nn(e2) + "]" : "{ " + n.map(([r, s]) => r + ": " + se(s, t)).join(", ") + " }";
|
|
723
|
+
}
|
|
724
|
+
function tn(e2, t) {
|
|
725
|
+
if (e2.length === 0) return "[]";
|
|
726
|
+
if (t.length > 2) return "[Array]";
|
|
727
|
+
let n = Math.min(10, e2.length), i = e2.length - n, r = [];
|
|
728
|
+
for (let s = 0; s < n; ++s) r.push(se(e2[s], t));
|
|
729
|
+
return i === 1 ? r.push("... 1 more item") : i > 1 && r.push(`... ${i} more items`), "[" + r.join(", ") + "]";
|
|
730
|
+
}
|
|
731
|
+
function nn(e2) {
|
|
732
|
+
let t = Object.prototype.toString.call(e2).replace(/^\[object /, "").replace(/]$/, "");
|
|
733
|
+
if (t === "Object" && typeof e2.constructor == "function") {
|
|
734
|
+
let n = e2.constructor.name;
|
|
735
|
+
if (typeof n == "string" && n !== "") return n;
|
|
736
|
+
}
|
|
737
|
+
return t;
|
|
738
|
+
}
|
|
739
|
+
var rn = globalThis.process && true;
|
|
740
|
+
var pt = rn ? function(t, n) {
|
|
741
|
+
return t instanceof n;
|
|
742
|
+
} : function(t, n) {
|
|
743
|
+
if (t instanceof n) return true;
|
|
744
|
+
if (typeof t == "object" && t !== null) {
|
|
745
|
+
var i;
|
|
746
|
+
let r = n.prototype[Symbol.toStringTag], s = Symbol.toStringTag in t ? t[Symbol.toStringTag] : (i = t.constructor) === null || i === void 0 ? void 0 : i.name;
|
|
747
|
+
if (r === s) {
|
|
748
|
+
let a = ie(t);
|
|
749
|
+
throw new Error(`Cannot use ${r} "${a}" from another module or realm.
|
|
750
|
+
|
|
751
|
+
Ensure that there is only one instance of "graphql" in the node_modules
|
|
752
|
+
directory. If different versions of "graphql" are the dependencies of other
|
|
753
|
+
relied on modules, use "resolutions" to ensure only one version is installed.
|
|
754
|
+
|
|
755
|
+
https://yarnpkg.com/en/docs/selective-version-resolutions
|
|
756
|
+
|
|
757
|
+
Duplicate "graphql" modules cannot be used at the same time since different
|
|
758
|
+
versions may have different capabilities and behavior. The data from one
|
|
759
|
+
version used in the function from another could produce confusing and
|
|
760
|
+
spurious results.`);
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
return false;
|
|
764
|
+
};
|
|
765
|
+
var Y = class {
|
|
766
|
+
constructor(t, n = "GraphQL request", i = { line: 1, column: 1 }) {
|
|
767
|
+
typeof t == "string" || re(false, `Body must be a string. Received: ${ie(t)}.`), this.body = t, this.name = n, this.locationOffset = i, this.locationOffset.line > 0 || re(false, "line in locationOffset is 1-indexed and must be positive."), this.locationOffset.column > 0 || re(false, "column in locationOffset is 1-indexed and must be positive.");
|
|
768
|
+
}
|
|
769
|
+
get [Symbol.toStringTag]() {
|
|
770
|
+
return "Source";
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
function ft(e2) {
|
|
774
|
+
return pt(e2, Y);
|
|
775
|
+
}
|
|
776
|
+
function ht(e2, t) {
|
|
777
|
+
let n = new Te(e2, t), i = n.parseDocument();
|
|
778
|
+
return Object.defineProperty(i, "tokenCount", { enumerable: false, value: n.tokenCount }), i;
|
|
779
|
+
}
|
|
780
|
+
var Te = class {
|
|
781
|
+
constructor(t, n = {}) {
|
|
782
|
+
let i = ft(t) ? t : new Y(t);
|
|
783
|
+
this._lexer = new te(i), this._options = n, this._tokenCounter = 0;
|
|
784
|
+
}
|
|
785
|
+
get tokenCount() {
|
|
786
|
+
return this._tokenCounter;
|
|
787
|
+
}
|
|
788
|
+
parseName() {
|
|
789
|
+
let t = this.expectToken(o.NAME);
|
|
790
|
+
return this.node(t, { kind: c.NAME, value: t.value });
|
|
791
|
+
}
|
|
792
|
+
parseDocument() {
|
|
793
|
+
return this.node(this._lexer.token, { kind: c.DOCUMENT, definitions: this.many(o.SOF, this.parseDefinition, o.EOF) });
|
|
794
|
+
}
|
|
795
|
+
parseDefinition() {
|
|
796
|
+
if (this.peek(o.BRACE_L)) return this.parseOperationDefinition();
|
|
797
|
+
let t = this.peekDescription(), n = t ? this._lexer.lookahead() : this._lexer.token;
|
|
798
|
+
if (n.kind === o.NAME) {
|
|
799
|
+
switch (n.value) {
|
|
800
|
+
case "schema":
|
|
801
|
+
return this.parseSchemaDefinition();
|
|
802
|
+
case "scalar":
|
|
803
|
+
return this.parseScalarTypeDefinition();
|
|
804
|
+
case "type":
|
|
805
|
+
return this.parseObjectTypeDefinition();
|
|
806
|
+
case "interface":
|
|
807
|
+
return this.parseInterfaceTypeDefinition();
|
|
808
|
+
case "union":
|
|
809
|
+
return this.parseUnionTypeDefinition();
|
|
810
|
+
case "enum":
|
|
811
|
+
return this.parseEnumTypeDefinition();
|
|
812
|
+
case "input":
|
|
813
|
+
return this.parseInputObjectTypeDefinition();
|
|
814
|
+
case "directive":
|
|
815
|
+
return this.parseDirectiveDefinition();
|
|
816
|
+
}
|
|
817
|
+
if (t) throw d(this._lexer.source, this._lexer.token.start, "Unexpected description, descriptions are supported only on type definitions.");
|
|
818
|
+
switch (n.value) {
|
|
819
|
+
case "query":
|
|
820
|
+
case "mutation":
|
|
821
|
+
case "subscription":
|
|
822
|
+
return this.parseOperationDefinition();
|
|
823
|
+
case "fragment":
|
|
824
|
+
return this.parseFragmentDefinition();
|
|
825
|
+
case "extend":
|
|
826
|
+
return this.parseTypeSystemExtension();
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
throw this.unexpected(n);
|
|
830
|
+
}
|
|
831
|
+
parseOperationDefinition() {
|
|
832
|
+
let t = this._lexer.token;
|
|
833
|
+
if (this.peek(o.BRACE_L)) return this.node(t, { kind: c.OPERATION_DEFINITION, operation: C.QUERY, name: void 0, variableDefinitions: [], directives: [], selectionSet: this.parseSelectionSet() });
|
|
834
|
+
let n = this.parseOperationType(), i;
|
|
835
|
+
return this.peek(o.NAME) && (i = this.parseName()), this.node(t, { kind: c.OPERATION_DEFINITION, operation: n, name: i, variableDefinitions: this.parseVariableDefinitions(), directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet() });
|
|
836
|
+
}
|
|
837
|
+
parseOperationType() {
|
|
838
|
+
let t = this.expectToken(o.NAME);
|
|
839
|
+
switch (t.value) {
|
|
840
|
+
case "query":
|
|
841
|
+
return C.QUERY;
|
|
842
|
+
case "mutation":
|
|
843
|
+
return C.MUTATION;
|
|
844
|
+
case "subscription":
|
|
845
|
+
return C.SUBSCRIPTION;
|
|
846
|
+
}
|
|
847
|
+
throw this.unexpected(t);
|
|
848
|
+
}
|
|
849
|
+
parseVariableDefinitions() {
|
|
850
|
+
return this.optionalMany(o.PAREN_L, this.parseVariableDefinition, o.PAREN_R);
|
|
851
|
+
}
|
|
852
|
+
parseVariableDefinition() {
|
|
853
|
+
return this.node(this._lexer.token, { kind: c.VARIABLE_DEFINITION, variable: this.parseVariable(), type: (this.expectToken(o.COLON), this.parseTypeReference()), defaultValue: this.expectOptionalToken(o.EQUALS) ? this.parseConstValueLiteral() : void 0, directives: this.parseConstDirectives() });
|
|
854
|
+
}
|
|
855
|
+
parseVariable() {
|
|
856
|
+
let t = this._lexer.token;
|
|
857
|
+
return this.expectToken(o.DOLLAR), this.node(t, { kind: c.VARIABLE, name: this.parseName() });
|
|
858
|
+
}
|
|
859
|
+
parseSelectionSet() {
|
|
860
|
+
return this.node(this._lexer.token, { kind: c.SELECTION_SET, selections: this.many(o.BRACE_L, this.parseSelection, o.BRACE_R) });
|
|
861
|
+
}
|
|
862
|
+
parseSelection() {
|
|
863
|
+
return this.peek(o.SPREAD) ? this.parseFragment() : this.parseField();
|
|
864
|
+
}
|
|
865
|
+
parseField() {
|
|
866
|
+
let t = this._lexer.token, n = this.parseName(), i, r;
|
|
867
|
+
return this.expectOptionalToken(o.COLON) ? (i = n, r = this.parseName()) : r = n, this.node(t, { kind: c.FIELD, alias: i, name: r, arguments: this.parseArguments(false), directives: this.parseDirectives(false), selectionSet: this.peek(o.BRACE_L) ? this.parseSelectionSet() : void 0 });
|
|
868
|
+
}
|
|
869
|
+
parseArguments(t) {
|
|
870
|
+
let n = t ? this.parseConstArgument : this.parseArgument;
|
|
871
|
+
return this.optionalMany(o.PAREN_L, n, o.PAREN_R);
|
|
872
|
+
}
|
|
873
|
+
parseArgument(t = false) {
|
|
874
|
+
let n = this._lexer.token, i = this.parseName();
|
|
875
|
+
return this.expectToken(o.COLON), this.node(n, { kind: c.ARGUMENT, name: i, value: this.parseValueLiteral(t) });
|
|
876
|
+
}
|
|
877
|
+
parseConstArgument() {
|
|
878
|
+
return this.parseArgument(true);
|
|
879
|
+
}
|
|
880
|
+
parseFragment() {
|
|
881
|
+
let t = this._lexer.token;
|
|
882
|
+
this.expectToken(o.SPREAD);
|
|
883
|
+
let n = this.expectOptionalKeyword("on");
|
|
884
|
+
return !n && this.peek(o.NAME) ? this.node(t, { kind: c.FRAGMENT_SPREAD, name: this.parseFragmentName(), directives: this.parseDirectives(false) }) : this.node(t, { kind: c.INLINE_FRAGMENT, typeCondition: n ? this.parseNamedType() : void 0, directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet() });
|
|
885
|
+
}
|
|
886
|
+
parseFragmentDefinition() {
|
|
887
|
+
let t = this._lexer.token;
|
|
888
|
+
return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === true ? this.node(t, { kind: c.FRAGMENT_DEFINITION, name: this.parseFragmentName(), variableDefinitions: this.parseVariableDefinitions(), typeCondition: (this.expectKeyword("on"), this.parseNamedType()), directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet() }) : this.node(t, { kind: c.FRAGMENT_DEFINITION, name: this.parseFragmentName(), typeCondition: (this.expectKeyword("on"), this.parseNamedType()), directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet() });
|
|
889
|
+
}
|
|
890
|
+
parseFragmentName() {
|
|
891
|
+
if (this._lexer.token.value === "on") throw this.unexpected();
|
|
892
|
+
return this.parseName();
|
|
893
|
+
}
|
|
894
|
+
parseValueLiteral(t) {
|
|
895
|
+
let n = this._lexer.token;
|
|
896
|
+
switch (n.kind) {
|
|
897
|
+
case o.BRACKET_L:
|
|
898
|
+
return this.parseList(t);
|
|
899
|
+
case o.BRACE_L:
|
|
900
|
+
return this.parseObject(t);
|
|
901
|
+
case o.INT:
|
|
902
|
+
return this.advanceLexer(), this.node(n, { kind: c.INT, value: n.value });
|
|
903
|
+
case o.FLOAT:
|
|
904
|
+
return this.advanceLexer(), this.node(n, { kind: c.FLOAT, value: n.value });
|
|
905
|
+
case o.STRING:
|
|
906
|
+
case o.BLOCK_STRING:
|
|
907
|
+
return this.parseStringLiteral();
|
|
908
|
+
case o.NAME:
|
|
909
|
+
switch (this.advanceLexer(), n.value) {
|
|
910
|
+
case "true":
|
|
911
|
+
return this.node(n, { kind: c.BOOLEAN, value: true });
|
|
912
|
+
case "false":
|
|
913
|
+
return this.node(n, { kind: c.BOOLEAN, value: false });
|
|
914
|
+
case "null":
|
|
915
|
+
return this.node(n, { kind: c.NULL });
|
|
916
|
+
default:
|
|
917
|
+
return this.node(n, { kind: c.ENUM, value: n.value });
|
|
918
|
+
}
|
|
919
|
+
case o.DOLLAR:
|
|
920
|
+
if (t) if (this.expectToken(o.DOLLAR), this._lexer.token.kind === o.NAME) {
|
|
921
|
+
let i = this._lexer.token.value;
|
|
922
|
+
throw d(this._lexer.source, n.start, `Unexpected variable "$${i}" in constant value.`);
|
|
923
|
+
} else throw this.unexpected(n);
|
|
924
|
+
return this.parseVariable();
|
|
925
|
+
default:
|
|
926
|
+
throw this.unexpected();
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
parseConstValueLiteral() {
|
|
930
|
+
return this.parseValueLiteral(true);
|
|
931
|
+
}
|
|
932
|
+
parseStringLiteral() {
|
|
933
|
+
let t = this._lexer.token;
|
|
934
|
+
return this.advanceLexer(), this.node(t, { kind: c.STRING, value: t.value, block: t.kind === o.BLOCK_STRING });
|
|
935
|
+
}
|
|
936
|
+
parseList(t) {
|
|
937
|
+
let n = () => this.parseValueLiteral(t);
|
|
938
|
+
return this.node(this._lexer.token, { kind: c.LIST, values: this.any(o.BRACKET_L, n, o.BRACKET_R) });
|
|
939
|
+
}
|
|
940
|
+
parseObject(t) {
|
|
941
|
+
let n = () => this.parseObjectField(t);
|
|
942
|
+
return this.node(this._lexer.token, { kind: c.OBJECT, fields: this.any(o.BRACE_L, n, o.BRACE_R) });
|
|
943
|
+
}
|
|
944
|
+
parseObjectField(t) {
|
|
945
|
+
let n = this._lexer.token, i = this.parseName();
|
|
946
|
+
return this.expectToken(o.COLON), this.node(n, { kind: c.OBJECT_FIELD, name: i, value: this.parseValueLiteral(t) });
|
|
947
|
+
}
|
|
948
|
+
parseDirectives(t) {
|
|
949
|
+
let n = [];
|
|
950
|
+
for (; this.peek(o.AT); ) n.push(this.parseDirective(t));
|
|
951
|
+
return n;
|
|
952
|
+
}
|
|
953
|
+
parseConstDirectives() {
|
|
954
|
+
return this.parseDirectives(true);
|
|
955
|
+
}
|
|
956
|
+
parseDirective(t) {
|
|
957
|
+
let n = this._lexer.token;
|
|
958
|
+
return this.expectToken(o.AT), this.node(n, { kind: c.DIRECTIVE, name: this.parseName(), arguments: this.parseArguments(t) });
|
|
959
|
+
}
|
|
960
|
+
parseTypeReference() {
|
|
961
|
+
let t = this._lexer.token, n;
|
|
962
|
+
if (this.expectOptionalToken(o.BRACKET_L)) {
|
|
963
|
+
let i = this.parseTypeReference();
|
|
964
|
+
this.expectToken(o.BRACKET_R), n = this.node(t, { kind: c.LIST_TYPE, type: i });
|
|
965
|
+
} else n = this.parseNamedType();
|
|
966
|
+
return this.expectOptionalToken(o.BANG) ? this.node(t, { kind: c.NON_NULL_TYPE, type: n }) : n;
|
|
967
|
+
}
|
|
968
|
+
parseNamedType() {
|
|
969
|
+
return this.node(this._lexer.token, { kind: c.NAMED_TYPE, name: this.parseName() });
|
|
970
|
+
}
|
|
971
|
+
peekDescription() {
|
|
972
|
+
return this.peek(o.STRING) || this.peek(o.BLOCK_STRING);
|
|
973
|
+
}
|
|
974
|
+
parseDescription() {
|
|
975
|
+
if (this.peekDescription()) return this.parseStringLiteral();
|
|
976
|
+
}
|
|
977
|
+
parseSchemaDefinition() {
|
|
978
|
+
let t = this._lexer.token, n = this.parseDescription();
|
|
979
|
+
this.expectKeyword("schema");
|
|
980
|
+
let i = this.parseConstDirectives(), r = this.many(o.BRACE_L, this.parseOperationTypeDefinition, o.BRACE_R);
|
|
981
|
+
return this.node(t, { kind: c.SCHEMA_DEFINITION, description: n, directives: i, operationTypes: r });
|
|
982
|
+
}
|
|
983
|
+
parseOperationTypeDefinition() {
|
|
984
|
+
let t = this._lexer.token, n = this.parseOperationType();
|
|
985
|
+
this.expectToken(o.COLON);
|
|
986
|
+
let i = this.parseNamedType();
|
|
987
|
+
return this.node(t, { kind: c.OPERATION_TYPE_DEFINITION, operation: n, type: i });
|
|
988
|
+
}
|
|
989
|
+
parseScalarTypeDefinition() {
|
|
990
|
+
let t = this._lexer.token, n = this.parseDescription();
|
|
991
|
+
this.expectKeyword("scalar");
|
|
992
|
+
let i = this.parseName(), r = this.parseConstDirectives();
|
|
993
|
+
return this.node(t, { kind: c.SCALAR_TYPE_DEFINITION, description: n, name: i, directives: r });
|
|
994
|
+
}
|
|
995
|
+
parseObjectTypeDefinition() {
|
|
996
|
+
let t = this._lexer.token, n = this.parseDescription();
|
|
997
|
+
this.expectKeyword("type");
|
|
998
|
+
let i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), a = this.parseFieldsDefinition();
|
|
999
|
+
return this.node(t, { kind: c.OBJECT_TYPE_DEFINITION, description: n, name: i, interfaces: r, directives: s, fields: a });
|
|
1000
|
+
}
|
|
1001
|
+
parseImplementsInterfaces() {
|
|
1002
|
+
return this.expectOptionalKeyword("implements") ? this.delimitedMany(o.AMP, this.parseNamedType) : [];
|
|
1003
|
+
}
|
|
1004
|
+
parseFieldsDefinition() {
|
|
1005
|
+
return this.optionalMany(o.BRACE_L, this.parseFieldDefinition, o.BRACE_R);
|
|
1006
|
+
}
|
|
1007
|
+
parseFieldDefinition() {
|
|
1008
|
+
let t = this._lexer.token, n = this.parseDescription(), i = this.parseName(), r = this.parseArgumentDefs();
|
|
1009
|
+
this.expectToken(o.COLON);
|
|
1010
|
+
let s = this.parseTypeReference(), a = this.parseConstDirectives();
|
|
1011
|
+
return this.node(t, { kind: c.FIELD_DEFINITION, description: n, name: i, arguments: r, type: s, directives: a });
|
|
1012
|
+
}
|
|
1013
|
+
parseArgumentDefs() {
|
|
1014
|
+
return this.optionalMany(o.PAREN_L, this.parseInputValueDef, o.PAREN_R);
|
|
1015
|
+
}
|
|
1016
|
+
parseInputValueDef() {
|
|
1017
|
+
let t = this._lexer.token, n = this.parseDescription(), i = this.parseName();
|
|
1018
|
+
this.expectToken(o.COLON);
|
|
1019
|
+
let r = this.parseTypeReference(), s;
|
|
1020
|
+
this.expectOptionalToken(o.EQUALS) && (s = this.parseConstValueLiteral());
|
|
1021
|
+
let a = this.parseConstDirectives();
|
|
1022
|
+
return this.node(t, { kind: c.INPUT_VALUE_DEFINITION, description: n, name: i, type: r, defaultValue: s, directives: a });
|
|
1023
|
+
}
|
|
1024
|
+
parseInterfaceTypeDefinition() {
|
|
1025
|
+
let t = this._lexer.token, n = this.parseDescription();
|
|
1026
|
+
this.expectKeyword("interface");
|
|
1027
|
+
let i = this.parseName(), r = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), a = this.parseFieldsDefinition();
|
|
1028
|
+
return this.node(t, { kind: c.INTERFACE_TYPE_DEFINITION, description: n, name: i, interfaces: r, directives: s, fields: a });
|
|
1029
|
+
}
|
|
1030
|
+
parseUnionTypeDefinition() {
|
|
1031
|
+
let t = this._lexer.token, n = this.parseDescription();
|
|
1032
|
+
this.expectKeyword("union");
|
|
1033
|
+
let i = this.parseName(), r = this.parseConstDirectives(), s = this.parseUnionMemberTypes();
|
|
1034
|
+
return this.node(t, { kind: c.UNION_TYPE_DEFINITION, description: n, name: i, directives: r, types: s });
|
|
1035
|
+
}
|
|
1036
|
+
parseUnionMemberTypes() {
|
|
1037
|
+
return this.expectOptionalToken(o.EQUALS) ? this.delimitedMany(o.PIPE, this.parseNamedType) : [];
|
|
1038
|
+
}
|
|
1039
|
+
parseEnumTypeDefinition() {
|
|
1040
|
+
let t = this._lexer.token, n = this.parseDescription();
|
|
1041
|
+
this.expectKeyword("enum");
|
|
1042
|
+
let i = this.parseName(), r = this.parseConstDirectives(), s = this.parseEnumValuesDefinition();
|
|
1043
|
+
return this.node(t, { kind: c.ENUM_TYPE_DEFINITION, description: n, name: i, directives: r, values: s });
|
|
1044
|
+
}
|
|
1045
|
+
parseEnumValuesDefinition() {
|
|
1046
|
+
return this.optionalMany(o.BRACE_L, this.parseEnumValueDefinition, o.BRACE_R);
|
|
1047
|
+
}
|
|
1048
|
+
parseEnumValueDefinition() {
|
|
1049
|
+
let t = this._lexer.token, n = this.parseDescription(), i = this.parseEnumValueName(), r = this.parseConstDirectives();
|
|
1050
|
+
return this.node(t, { kind: c.ENUM_VALUE_DEFINITION, description: n, name: i, directives: r });
|
|
1051
|
+
}
|
|
1052
|
+
parseEnumValueName() {
|
|
1053
|
+
if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null") throw d(this._lexer.source, this._lexer.token.start, `${oe(this._lexer.token)} is reserved and cannot be used for an enum value.`);
|
|
1054
|
+
return this.parseName();
|
|
1055
|
+
}
|
|
1056
|
+
parseInputObjectTypeDefinition() {
|
|
1057
|
+
let t = this._lexer.token, n = this.parseDescription();
|
|
1058
|
+
this.expectKeyword("input");
|
|
1059
|
+
let i = this.parseName(), r = this.parseConstDirectives(), s = this.parseInputFieldsDefinition();
|
|
1060
|
+
return this.node(t, { kind: c.INPUT_OBJECT_TYPE_DEFINITION, description: n, name: i, directives: r, fields: s });
|
|
1061
|
+
}
|
|
1062
|
+
parseInputFieldsDefinition() {
|
|
1063
|
+
return this.optionalMany(o.BRACE_L, this.parseInputValueDef, o.BRACE_R);
|
|
1064
|
+
}
|
|
1065
|
+
parseTypeSystemExtension() {
|
|
1066
|
+
let t = this._lexer.lookahead();
|
|
1067
|
+
if (t.kind === o.NAME) switch (t.value) {
|
|
1068
|
+
case "schema":
|
|
1069
|
+
return this.parseSchemaExtension();
|
|
1070
|
+
case "scalar":
|
|
1071
|
+
return this.parseScalarTypeExtension();
|
|
1072
|
+
case "type":
|
|
1073
|
+
return this.parseObjectTypeExtension();
|
|
1074
|
+
case "interface":
|
|
1075
|
+
return this.parseInterfaceTypeExtension();
|
|
1076
|
+
case "union":
|
|
1077
|
+
return this.parseUnionTypeExtension();
|
|
1078
|
+
case "enum":
|
|
1079
|
+
return this.parseEnumTypeExtension();
|
|
1080
|
+
case "input":
|
|
1081
|
+
return this.parseInputObjectTypeExtension();
|
|
1082
|
+
}
|
|
1083
|
+
throw this.unexpected(t);
|
|
1084
|
+
}
|
|
1085
|
+
parseSchemaExtension() {
|
|
1086
|
+
let t = this._lexer.token;
|
|
1087
|
+
this.expectKeyword("extend"), this.expectKeyword("schema");
|
|
1088
|
+
let n = this.parseConstDirectives(), i = this.optionalMany(o.BRACE_L, this.parseOperationTypeDefinition, o.BRACE_R);
|
|
1089
|
+
if (n.length === 0 && i.length === 0) throw this.unexpected();
|
|
1090
|
+
return this.node(t, { kind: c.SCHEMA_EXTENSION, directives: n, operationTypes: i });
|
|
1091
|
+
}
|
|
1092
|
+
parseScalarTypeExtension() {
|
|
1093
|
+
let t = this._lexer.token;
|
|
1094
|
+
this.expectKeyword("extend"), this.expectKeyword("scalar");
|
|
1095
|
+
let n = this.parseName(), i = this.parseConstDirectives();
|
|
1096
|
+
if (i.length === 0) throw this.unexpected();
|
|
1097
|
+
return this.node(t, { kind: c.SCALAR_TYPE_EXTENSION, name: n, directives: i });
|
|
1098
|
+
}
|
|
1099
|
+
parseObjectTypeExtension() {
|
|
1100
|
+
let t = this._lexer.token;
|
|
1101
|
+
this.expectKeyword("extend"), this.expectKeyword("type");
|
|
1102
|
+
let n = this.parseName(), i = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), s = this.parseFieldsDefinition();
|
|
1103
|
+
if (i.length === 0 && r.length === 0 && s.length === 0) throw this.unexpected();
|
|
1104
|
+
return this.node(t, { kind: c.OBJECT_TYPE_EXTENSION, name: n, interfaces: i, directives: r, fields: s });
|
|
1105
|
+
}
|
|
1106
|
+
parseInterfaceTypeExtension() {
|
|
1107
|
+
let t = this._lexer.token;
|
|
1108
|
+
this.expectKeyword("extend"), this.expectKeyword("interface");
|
|
1109
|
+
let n = this.parseName(), i = this.parseImplementsInterfaces(), r = this.parseConstDirectives(), s = this.parseFieldsDefinition();
|
|
1110
|
+
if (i.length === 0 && r.length === 0 && s.length === 0) throw this.unexpected();
|
|
1111
|
+
return this.node(t, { kind: c.INTERFACE_TYPE_EXTENSION, name: n, interfaces: i, directives: r, fields: s });
|
|
1112
|
+
}
|
|
1113
|
+
parseUnionTypeExtension() {
|
|
1114
|
+
let t = this._lexer.token;
|
|
1115
|
+
this.expectKeyword("extend"), this.expectKeyword("union");
|
|
1116
|
+
let n = this.parseName(), i = this.parseConstDirectives(), r = this.parseUnionMemberTypes();
|
|
1117
|
+
if (i.length === 0 && r.length === 0) throw this.unexpected();
|
|
1118
|
+
return this.node(t, { kind: c.UNION_TYPE_EXTENSION, name: n, directives: i, types: r });
|
|
1119
|
+
}
|
|
1120
|
+
parseEnumTypeExtension() {
|
|
1121
|
+
let t = this._lexer.token;
|
|
1122
|
+
this.expectKeyword("extend"), this.expectKeyword("enum");
|
|
1123
|
+
let n = this.parseName(), i = this.parseConstDirectives(), r = this.parseEnumValuesDefinition();
|
|
1124
|
+
if (i.length === 0 && r.length === 0) throw this.unexpected();
|
|
1125
|
+
return this.node(t, { kind: c.ENUM_TYPE_EXTENSION, name: n, directives: i, values: r });
|
|
1126
|
+
}
|
|
1127
|
+
parseInputObjectTypeExtension() {
|
|
1128
|
+
let t = this._lexer.token;
|
|
1129
|
+
this.expectKeyword("extend"), this.expectKeyword("input");
|
|
1130
|
+
let n = this.parseName(), i = this.parseConstDirectives(), r = this.parseInputFieldsDefinition();
|
|
1131
|
+
if (i.length === 0 && r.length === 0) throw this.unexpected();
|
|
1132
|
+
return this.node(t, { kind: c.INPUT_OBJECT_TYPE_EXTENSION, name: n, directives: i, fields: r });
|
|
1133
|
+
}
|
|
1134
|
+
parseDirectiveDefinition() {
|
|
1135
|
+
let t = this._lexer.token, n = this.parseDescription();
|
|
1136
|
+
this.expectKeyword("directive"), this.expectToken(o.AT);
|
|
1137
|
+
let i = this.parseName(), r = this.parseArgumentDefs(), s = this.expectOptionalKeyword("repeatable");
|
|
1138
|
+
this.expectKeyword("on");
|
|
1139
|
+
let a = this.parseDirectiveLocations();
|
|
1140
|
+
return this.node(t, { kind: c.DIRECTIVE_DEFINITION, description: n, name: i, arguments: r, repeatable: s, locations: a });
|
|
1141
|
+
}
|
|
1142
|
+
parseDirectiveLocations() {
|
|
1143
|
+
return this.delimitedMany(o.PIPE, this.parseDirectiveLocation);
|
|
1144
|
+
}
|
|
1145
|
+
parseDirectiveLocation() {
|
|
1146
|
+
let t = this._lexer.token, n = this.parseName();
|
|
1147
|
+
if (Object.prototype.hasOwnProperty.call(ee, n.value)) return n;
|
|
1148
|
+
throw this.unexpected(t);
|
|
1149
|
+
}
|
|
1150
|
+
node(t, n) {
|
|
1151
|
+
return this._options.noLocation !== true && (n.loc = new Q(t, this._lexer.lastToken, this._lexer.source)), n;
|
|
1152
|
+
}
|
|
1153
|
+
peek(t) {
|
|
1154
|
+
return this._lexer.token.kind === t;
|
|
1155
|
+
}
|
|
1156
|
+
expectToken(t) {
|
|
1157
|
+
let n = this._lexer.token;
|
|
1158
|
+
if (n.kind === t) return this.advanceLexer(), n;
|
|
1159
|
+
throw d(this._lexer.source, n.start, `Expected ${dt(t)}, found ${oe(n)}.`);
|
|
1160
|
+
}
|
|
1161
|
+
expectOptionalToken(t) {
|
|
1162
|
+
return this._lexer.token.kind === t ? (this.advanceLexer(), true) : false;
|
|
1163
|
+
}
|
|
1164
|
+
expectKeyword(t) {
|
|
1165
|
+
let n = this._lexer.token;
|
|
1166
|
+
if (n.kind === o.NAME && n.value === t) this.advanceLexer();
|
|
1167
|
+
else throw d(this._lexer.source, n.start, `Expected "${t}", found ${oe(n)}.`);
|
|
1168
|
+
}
|
|
1169
|
+
expectOptionalKeyword(t) {
|
|
1170
|
+
let n = this._lexer.token;
|
|
1171
|
+
return n.kind === o.NAME && n.value === t ? (this.advanceLexer(), true) : false;
|
|
1172
|
+
}
|
|
1173
|
+
unexpected(t) {
|
|
1174
|
+
let n = _nullishCoalesce(t, () => ( this._lexer.token));
|
|
1175
|
+
return d(this._lexer.source, n.start, `Unexpected ${oe(n)}.`);
|
|
1176
|
+
}
|
|
1177
|
+
any(t, n, i) {
|
|
1178
|
+
this.expectToken(t);
|
|
1179
|
+
let r = [];
|
|
1180
|
+
for (; !this.expectOptionalToken(i); ) r.push(n.call(this));
|
|
1181
|
+
return r;
|
|
1182
|
+
}
|
|
1183
|
+
optionalMany(t, n, i) {
|
|
1184
|
+
if (this.expectOptionalToken(t)) {
|
|
1185
|
+
let r = [];
|
|
1186
|
+
do
|
|
1187
|
+
r.push(n.call(this));
|
|
1188
|
+
while (!this.expectOptionalToken(i));
|
|
1189
|
+
return r;
|
|
1190
|
+
}
|
|
1191
|
+
return [];
|
|
1192
|
+
}
|
|
1193
|
+
many(t, n, i) {
|
|
1194
|
+
this.expectToken(t);
|
|
1195
|
+
let r = [];
|
|
1196
|
+
do
|
|
1197
|
+
r.push(n.call(this));
|
|
1198
|
+
while (!this.expectOptionalToken(i));
|
|
1199
|
+
return r;
|
|
1200
|
+
}
|
|
1201
|
+
delimitedMany(t, n) {
|
|
1202
|
+
this.expectOptionalToken(t);
|
|
1203
|
+
let i = [];
|
|
1204
|
+
do
|
|
1205
|
+
i.push(n.call(this));
|
|
1206
|
+
while (this.expectOptionalToken(t));
|
|
1207
|
+
return i;
|
|
1208
|
+
}
|
|
1209
|
+
advanceLexer() {
|
|
1210
|
+
let { maxTokens: t } = this._options, n = this._lexer.advance();
|
|
1211
|
+
if (n.kind !== o.EOF && (++this._tokenCounter, t !== void 0 && this._tokenCounter > t)) throw d(this._lexer.source, n.start, `Document contains more that ${t} tokens. Parsing aborted.`);
|
|
1212
|
+
}
|
|
1213
|
+
};
|
|
1214
|
+
function oe(e2) {
|
|
1215
|
+
let t = e2.value;
|
|
1216
|
+
return dt(e2.kind) + (t != null ? ` "${t}"` : "");
|
|
1217
|
+
}
|
|
1218
|
+
function dt(e2) {
|
|
1219
|
+
return ct(e2) ? `"${e2}"` : e2;
|
|
1220
|
+
}
|
|
1221
|
+
function sn(e2, t) {
|
|
1222
|
+
let n = new SyntaxError(e2 + " (" + t.loc.start.line + ":" + t.loc.start.column + ")");
|
|
1223
|
+
return Object.assign(n, t);
|
|
1224
|
+
}
|
|
1225
|
+
var mt = sn;
|
|
1226
|
+
function on(e2) {
|
|
1227
|
+
let t = [], { startToken: n, endToken: i } = e2.loc;
|
|
1228
|
+
for (let r = n; r !== i; r = r.next) r.kind === "Comment" && t.push({ ...r, loc: { start: r.start, end: r.end } });
|
|
1229
|
+
return t;
|
|
1230
|
+
}
|
|
1231
|
+
var an = { allowLegacyFragmentVariables: true };
|
|
1232
|
+
function cn(e2) {
|
|
1233
|
+
if ((e2 == null ? void 0 : e2.name) === "GraphQLError") {
|
|
1234
|
+
let { message: t, locations: [n] } = e2;
|
|
1235
|
+
return mt(t, { loc: { start: n }, cause: e2 });
|
|
1236
|
+
}
|
|
1237
|
+
return e2;
|
|
1238
|
+
}
|
|
1239
|
+
function un(e2) {
|
|
1240
|
+
let t;
|
|
1241
|
+
try {
|
|
1242
|
+
t = ht(e2, an);
|
|
1243
|
+
} catch (n) {
|
|
1244
|
+
throw cn(n);
|
|
1245
|
+
}
|
|
1246
|
+
return t.comments = on(t), t;
|
|
1247
|
+
}
|
|
1248
|
+
var ln = { parse: un, astFormat: "graphql", hasPragma: je, hasIgnorePragma: $e, locStart: K, locEnd: z };
|
|
1249
|
+
var pn = { graphql: qe };
|
|
1250
|
+
var Ui = Ne;
|
|
1251
|
+
|
|
1252
|
+
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
|
|
1256
|
+
|
|
1257
|
+
exports.default = Ui; exports.languages = Qe; exports.options = Ke; exports.parsers = _e; exports.printers = pn;
|