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