@rexeus/typeweaver 0.2.1 → 0.3.1
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/README.md +30 -10
- package/dist/{acorn-CJ4HNU11.js → acorn-TNAGPKCR.js} +1076 -998
- package/dist/acorn-ZFAHQIG7.js +3131 -0
- package/dist/angular-3KXBV3WD.js +3030 -0
- package/dist/angular-WMVKTHFF.js +3031 -0
- package/dist/babel-5QZSVJOE.js +7297 -0
- package/dist/babel-V7SGJWS6.js +7296 -0
- package/dist/chunk-4ST7XK4F.js +34641 -0
- package/dist/chunk-K3NQKI34.js +10 -0
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/cli-GOSMI5D3.js +34642 -0
- package/dist/cli.cjs +116222 -0
- package/dist/cli.d.cts +2 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +2 -0
- package/dist/entry.js +31 -0
- package/dist/estree-QSPT5I7I.js +4612 -0
- package/dist/estree-Y36AM62I.js +4613 -0
- package/dist/flow-7LH7X5GA.js +27547 -0
- package/dist/flow-WHVBWPDR.js +27546 -0
- package/dist/{glimmer-DiXjs4DB.js → glimmer-BHRIPYOK.js} +1317 -1051
- package/dist/glimmer-CBYXJR5M.js +2895 -0
- package/dist/{graphql-DLJHmbDb.js → graphql-7EJJJFHU.js} +343 -307
- package/dist/graphql-KKVSZXX7.js +1267 -0
- package/dist/html-M3WOAMIJ.js +2927 -0
- package/dist/html-YM5TKPVB.js +2926 -0
- package/dist/index.cjs +116228 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -16
- package/dist/markdown-FIK6SNTF.js +3551 -0
- package/dist/markdown-X6DQGEVV.js +3552 -0
- package/dist/meriyah-FBUICA5T.js +2684 -0
- package/dist/meriyah-GWPOVAHY.js +2685 -0
- package/dist/postcss-N2W7KQ6Q.js +5081 -0
- package/dist/{postcss-DUOVol6C.js → postcss-ODV7XV5T.js} +1779 -1641
- package/dist/tsx-loader-3QUDYASH.js +4 -0
- package/dist/typescript-BG63TNYD.js +13203 -0
- package/dist/typescript-IYJMK2NE.js +13204 -0
- package/dist/yaml-5FEMTYXO.js +4225 -0
- package/dist/{yaml-Bd8DkW_K.js → yaml-DV3ZI4ZT.js} +1140 -1058
- package/package.json +33 -33
- package/dist/angular-wXs0C_R2.js +0 -2626
- package/dist/babel-DNmSIBHM.js +0 -7201
- package/dist/cli-D5DHO8r6.js +0 -20691
- package/dist/estree-BfVT8G2n.js +0 -4301
- package/dist/flow-DgzFy9Js.js +0 -27138
- package/dist/html-BwjSBi_v.js +0 -2677
- package/dist/markdown-DWIPYE8e.js +0 -3363
- package/dist/meriyah-CbAY3E55.js +0 -2603
- package/dist/run-cli-with-tsx.js +0 -18
- package/dist/typescript-DDNbhgng.js +0 -12972
|
@@ -1,39 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import "./chunk-MLKGABMK.js";
|
|
2
|
+
|
|
3
|
+
// ../../node_modules/.pnpm/prettier@3.7.4/node_modules/prettier/plugins/graphql.mjs
|
|
4
|
+
var pt = Object.defineProperty;
|
|
5
|
+
var de = (e2, t) => {
|
|
6
|
+
for (var n in t) pt(e2, n, { get: t[n], enumerable: true });
|
|
4
7
|
};
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
var ut = {};
|
|
9
|
+
de(ut, { languages: () => Ye, options: () => $e, parsers: () => he, printers: () => nn });
|
|
10
|
+
var me = (e2, t) => (n, i, ...r) => n | 1 && i == null ? void 0 : (t.call(i) ?? i[e2]).apply(i, r);
|
|
11
|
+
var lt = String.prototype.replaceAll ?? function(e2, t) {
|
|
12
|
+
return e2.global ? this.replace(e2, t) : this.split(e2).join(t);
|
|
13
|
+
};
|
|
14
|
+
var ft = me("replaceAll", function() {
|
|
15
|
+
if (typeof this == "string") return lt;
|
|
16
|
+
});
|
|
17
|
+
var U = ft;
|
|
18
|
+
var ht = () => {
|
|
19
|
+
};
|
|
20
|
+
var ie = ht;
|
|
21
|
+
var Ee = "indent";
|
|
22
|
+
var Te = "group";
|
|
23
|
+
var Ne = "if-break";
|
|
24
|
+
var G = "line";
|
|
25
|
+
var xe = "break-parent";
|
|
26
|
+
var S = ie;
|
|
27
|
+
var Y = ie;
|
|
28
|
+
function x(e2) {
|
|
29
|
+
return S(e2), { type: Ee, contents: e2 };
|
|
30
|
+
}
|
|
31
|
+
var _e = { type: xe };
|
|
20
32
|
function y(e2, t = {}) {
|
|
21
|
-
return
|
|
33
|
+
return S(e2), Y(t.expandedStates, true), { type: Te, id: t.id, contents: e2, break: !!t.shouldBreak, expandedStates: t.expandedStates };
|
|
22
34
|
}
|
|
23
35
|
function I(e2, t = "", n = {}) {
|
|
24
|
-
return { type:
|
|
36
|
+
return S(e2), t !== "" && S(t), { type: Ne, breakContents: e2, flatContents: t, groupId: n.groupId };
|
|
25
37
|
}
|
|
26
|
-
var yt = { type: X };
|
|
27
|
-
var Ot = { type: S, hard: true };
|
|
28
|
-
var k = { type: S }, p = { type: S, soft: true }, f = [Ot, yt];
|
|
29
38
|
function E(e2, t) {
|
|
39
|
+
S(e2), Y(t);
|
|
30
40
|
let n = [];
|
|
31
41
|
for (let i = 0; i < t.length; i++) i !== 0 && n.push(e2), n.push(t[i]);
|
|
32
42
|
return n;
|
|
33
43
|
}
|
|
34
|
-
|
|
44
|
+
var k = { type: G };
|
|
45
|
+
var l = { type: G, soft: true };
|
|
46
|
+
var dt = { type: G, hard: true };
|
|
47
|
+
var f = [dt, _e];
|
|
48
|
+
function j(e2) {
|
|
35
49
|
return (t, n, i) => {
|
|
36
|
-
let r = !!
|
|
50
|
+
let r = !!i?.backwards;
|
|
37
51
|
if (n === false) return false;
|
|
38
52
|
let { length: s } = t, a = n;
|
|
39
53
|
for (; a >= 0 && a < s; ) {
|
|
@@ -46,73 +60,77 @@ function H(e2) {
|
|
|
46
60
|
return a === -1 || a === s ? a : false;
|
|
47
61
|
};
|
|
48
62
|
}
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
|
|
63
|
+
var kn = j(/\s/u);
|
|
64
|
+
var $ = j(" ");
|
|
65
|
+
var ye = j(",; ");
|
|
66
|
+
var Ae = j(/[^\n\r]/u);
|
|
67
|
+
var Oe = (e2) => e2 === `
|
|
68
|
+
` || e2 === "\r" || e2 === "\u2028" || e2 === "\u2029";
|
|
69
|
+
function mt(e2, t, n) {
|
|
70
|
+
let i = !!n?.backwards;
|
|
52
71
|
if (t === false) return false;
|
|
53
72
|
let r = e2.charAt(t);
|
|
54
73
|
if (i) {
|
|
55
74
|
if (e2.charAt(t - 1) === "\r" && r === `
|
|
56
75
|
`) return t - 2;
|
|
57
|
-
if (r
|
|
58
|
-
` || r === "\r" || r === "\u2028" || r === "\u2029") return t - 1;
|
|
76
|
+
if (Oe(r)) return t - 1;
|
|
59
77
|
} else {
|
|
60
78
|
if (r === "\r" && e2.charAt(t + 1) === `
|
|
61
79
|
`) return t + 2;
|
|
62
|
-
if (r
|
|
63
|
-
` || r === "\r" || r === "\u2028" || r === "\u2029") return t + 1;
|
|
80
|
+
if (Oe(r)) return t + 1;
|
|
64
81
|
}
|
|
65
82
|
return t;
|
|
66
83
|
}
|
|
67
|
-
var
|
|
68
|
-
function
|
|
69
|
-
let i =
|
|
84
|
+
var X = mt;
|
|
85
|
+
function Et(e2, t, n = {}) {
|
|
86
|
+
let i = $(e2, n.backwards ? t - 1 : t, n), r = X(e2, i, n);
|
|
70
87
|
return i !== r;
|
|
71
88
|
}
|
|
72
|
-
var
|
|
73
|
-
function
|
|
89
|
+
var Ie = Et;
|
|
90
|
+
function Tt(e2, t) {
|
|
74
91
|
if (t === false) return false;
|
|
75
92
|
if (e2.charAt(t) === "/" && e2.charAt(t + 1) === "*") {
|
|
76
93
|
for (let n = t + 2; n < e2.length; ++n) if (e2.charAt(n) === "*" && e2.charAt(n + 1) === "/") return n + 2;
|
|
77
94
|
}
|
|
78
95
|
return t;
|
|
79
96
|
}
|
|
80
|
-
var
|
|
81
|
-
function
|
|
82
|
-
return t === false ? false : e2.charAt(t) === "/" && e2.charAt(t + 1) === "/" ?
|
|
97
|
+
var De = Tt;
|
|
98
|
+
function Nt(e2, t) {
|
|
99
|
+
return t === false ? false : e2.charAt(t) === "/" && e2.charAt(t + 1) === "/" ? Ae(e2, t) : t;
|
|
83
100
|
}
|
|
84
|
-
var
|
|
85
|
-
function
|
|
101
|
+
var ge = Nt;
|
|
102
|
+
function xt(e2, t) {
|
|
86
103
|
let n = null, i = t;
|
|
87
|
-
for (; i !== n; ) n = i, i =
|
|
88
|
-
return i =
|
|
104
|
+
for (; i !== n; ) n = i, i = ye(e2, i), i = De(e2, i), i = $(e2, i);
|
|
105
|
+
return i = ge(e2, i), i = X(e2, i), i !== false && Ie(e2, i);
|
|
89
106
|
}
|
|
90
|
-
var
|
|
91
|
-
function
|
|
107
|
+
var Se = xt;
|
|
108
|
+
function _t(e2) {
|
|
92
109
|
return Array.isArray(e2) && e2.length > 0;
|
|
93
110
|
}
|
|
94
|
-
var
|
|
95
|
-
var
|
|
111
|
+
var se = _t;
|
|
112
|
+
var oe = class extends Error {
|
|
96
113
|
name = "UnexpectedNodeError";
|
|
97
114
|
constructor(t, n, i = "type") {
|
|
98
115
|
super(`Unexpected ${n} node ${i}: ${JSON.stringify(t[i])}.`), this.node = t;
|
|
99
116
|
}
|
|
100
|
-
}
|
|
101
|
-
var
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
};
|
|
118
|
+
var ke = oe;
|
|
119
|
+
var P = null;
|
|
120
|
+
function w(e2) {
|
|
121
|
+
if (P !== null && typeof P.property) {
|
|
122
|
+
let t = P;
|
|
123
|
+
return P = w.prototype = null, t;
|
|
124
|
+
}
|
|
125
|
+
return P = w.prototype = e2 ?? /* @__PURE__ */ Object.create(null), new w();
|
|
126
|
+
}
|
|
127
|
+
var yt = 10;
|
|
128
|
+
for (let e2 = 0; e2 <= yt; e2++) w();
|
|
129
|
+
function ae(e2) {
|
|
130
|
+
return w(e2);
|
|
131
|
+
}
|
|
132
|
+
function At(e2, t = "type") {
|
|
133
|
+
ae(e2);
|
|
116
134
|
function n(i) {
|
|
117
135
|
let r = i[t], s = e2[r];
|
|
118
136
|
if (!Array.isArray(s)) throw Object.assign(new Error(`Missing visitor keys for '${r}'.`), { node: i });
|
|
@@ -120,8 +138,8 @@ function Rt(e2, t = "type") {
|
|
|
120
138
|
}
|
|
121
139
|
return n;
|
|
122
140
|
}
|
|
123
|
-
var
|
|
124
|
-
var
|
|
141
|
+
var Ce = At;
|
|
142
|
+
var H = class {
|
|
125
143
|
constructor(t, n, i) {
|
|
126
144
|
this.start = t.start, this.end = n.end, this.startToken = t, this.endToken = n, this.source = i;
|
|
127
145
|
}
|
|
@@ -131,7 +149,8 @@ var Q = class {
|
|
|
131
149
|
toJSON() {
|
|
132
150
|
return { start: this.start, end: this.end };
|
|
133
151
|
}
|
|
134
|
-
}
|
|
152
|
+
};
|
|
153
|
+
var F = class {
|
|
135
154
|
constructor(t, n, i, r, s, a) {
|
|
136
155
|
this.kind = t, this.start = n, this.end = i, this.line = r, this.column = s, this.value = a, this.prev = null, this.next = null;
|
|
137
156
|
}
|
|
@@ -141,62 +160,60 @@ var Q = class {
|
|
|
141
160
|
toJSON() {
|
|
142
161
|
return { kind: this.kind, value: this.value, line: this.line, column: this.column };
|
|
143
162
|
}
|
|
144
|
-
}
|
|
163
|
+
};
|
|
164
|
+
var ce = { Name: [], Document: ["definitions"], OperationDefinition: ["description", "name", "variableDefinitions", "directives", "selectionSet"], VariableDefinition: ["description", "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: ["description", "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"], TypeCoordinate: ["name"], MemberCoordinate: ["name", "memberName"], ArgumentCoordinate: ["name", "fieldName", "argumentName"], DirectiveCoordinate: ["name"], DirectiveArgumentCoordinate: ["name", "argumentName"] };
|
|
165
|
+
var qn = new Set(Object.keys(ce));
|
|
145
166
|
var C;
|
|
146
167
|
(function(e2) {
|
|
147
168
|
e2.QUERY = "query", e2.MUTATION = "mutation", e2.SUBSCRIPTION = "subscription";
|
|
148
169
|
})(C || (C = {}));
|
|
149
|
-
var
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
var
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
function Xe(e2) {
|
|
164
|
-
return `# @${Ve}
|
|
170
|
+
var Re = { ...ce };
|
|
171
|
+
for (let e2 of ["ArgumentCoordinate", "DirectiveArgumentCoordinate", "DirectiveCoordinate", "MemberCoordinate", "TypeCoordinate"]) delete Re[e2];
|
|
172
|
+
var ve = Re;
|
|
173
|
+
var Ot = Ce(ve, "kind");
|
|
174
|
+
var be = Ot;
|
|
175
|
+
var J = (e2) => e2.loc.start;
|
|
176
|
+
var q = (e2) => e2.loc.end;
|
|
177
|
+
var Le = "format";
|
|
178
|
+
var Pe = /^\s*#[^\S\n]*@(?:noformat|noprettier)\s*(?:\n|$)/u;
|
|
179
|
+
var we = /^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/u;
|
|
180
|
+
var Fe = (e2) => we.test(e2);
|
|
181
|
+
var Me = (e2) => Pe.test(e2);
|
|
182
|
+
var Ve = (e2) => `# @${Le}
|
|
165
183
|
|
|
166
184
|
${e2}`;
|
|
167
|
-
|
|
168
|
-
function Lt(e2, t, n) {
|
|
185
|
+
function It(e2, t, n) {
|
|
169
186
|
let { node: i } = e2;
|
|
170
187
|
if (!i.description) return "";
|
|
171
188
|
let r = [n("description")];
|
|
172
189
|
return i.kind === "InputValueDefinition" && !i.description.block ? r.push(k) : r.push(f), r;
|
|
173
190
|
}
|
|
174
|
-
var
|
|
175
|
-
function
|
|
191
|
+
var A = It;
|
|
192
|
+
function Dt(e2, t, n) {
|
|
176
193
|
let { node: i } = e2;
|
|
177
194
|
switch (i.kind) {
|
|
178
195
|
case "Document":
|
|
179
196
|
return [...E(f, g(e2, t, n, "definitions")), f];
|
|
180
197
|
case "OperationDefinition": {
|
|
181
|
-
let r = t.originalText[
|
|
182
|
-
return [r ? i.operation : "", r && s ? [" ", n("name")] : "", r && !s &&
|
|
198
|
+
let r = t.originalText[J(i)] !== "{", s = !!i.name;
|
|
199
|
+
return [A(e2, t, n), r ? i.operation : "", r && s ? [" ", n("name")] : "", r && !s && se(i.variableDefinitions) ? " " : "", Be(e2, n), _(e2, n, i), !r && !s ? "" : " ", n("selectionSet")];
|
|
183
200
|
}
|
|
184
201
|
case "FragmentDefinition":
|
|
185
|
-
return ["fragment ", n("name"),
|
|
202
|
+
return [A(e2, t, n), "fragment ", n("name"), Be(e2, n), " on ", n("typeCondition"), _(e2, n, i), " ", n("selectionSet")];
|
|
186
203
|
case "SelectionSet":
|
|
187
|
-
return ["{",
|
|
204
|
+
return ["{", x([f, E(f, g(e2, t, n, "selections"))]), f, "}"];
|
|
188
205
|
case "Field":
|
|
189
|
-
return y([i.alias ? [n("alias"), ": "] : "", n("name"), i.arguments.length > 0 ? y(["(",
|
|
206
|
+
return y([i.alias ? [n("alias"), ": "] : "", n("name"), i.arguments.length > 0 ? y(["(", x([l, E([I("", ", "), l], g(e2, t, n, "arguments"))]), l, ")"]) : "", _(e2, n, i), i.selectionSet ? " " : "", n("selectionSet")]);
|
|
190
207
|
case "Name":
|
|
191
208
|
return i.value;
|
|
192
209
|
case "StringValue":
|
|
193
210
|
if (i.block) {
|
|
194
|
-
let r =
|
|
211
|
+
let r = U(0, i.value, '"""', '\\"""').split(`
|
|
195
212
|
`);
|
|
196
213
|
return r.length === 1 && (r[0] = r[0].trim()), r.every((s) => s === "") && (r.length = 0), E(f, ['"""', ...r, '"""']);
|
|
197
214
|
}
|
|
198
|
-
return ['"',
|
|
199
|
-
`,
|
|
215
|
+
return ['"', U(0, U(0, i.value, /["\\]/gu, "\\$&"), `
|
|
216
|
+
`, "\\n"), '"'];
|
|
200
217
|
case "IntValue":
|
|
201
218
|
case "FloatValue":
|
|
202
219
|
case "EnumValue":
|
|
@@ -208,20 +225,20 @@ function bt(e2, t, n) {
|
|
|
208
225
|
case "Variable":
|
|
209
226
|
return ["$", n("name")];
|
|
210
227
|
case "ListValue":
|
|
211
|
-
return y(["[",
|
|
228
|
+
return y(["[", x([l, E([I("", ", "), l], e2.map(n, "values"))]), l, "]"]);
|
|
212
229
|
case "ObjectValue": {
|
|
213
230
|
let r = t.bracketSpacing && i.fields.length > 0 ? " " : "";
|
|
214
|
-
return y(["{", r,
|
|
231
|
+
return y(["{", r, x([l, E([I("", ", "), l], e2.map(n, "fields"))]), l, I("", r), "}"]);
|
|
215
232
|
}
|
|
216
233
|
case "ObjectField":
|
|
217
234
|
case "Argument":
|
|
218
235
|
return [n("name"), ": ", n("value")];
|
|
219
236
|
case "Directive":
|
|
220
|
-
return ["@", n("name"), i.arguments.length > 0 ? y(["(",
|
|
237
|
+
return ["@", n("name"), i.arguments.length > 0 ? y(["(", x([l, E([I("", ", "), l], g(e2, t, n, "arguments"))]), l, ")"]) : ""];
|
|
221
238
|
case "NamedType":
|
|
222
239
|
return n("name");
|
|
223
240
|
case "VariableDefinition":
|
|
224
|
-
return [n("variable"), ": ", n("type"), i.defaultValue ? [" = ", n("defaultValue")] : "",
|
|
241
|
+
return [A(e2, t, n), n("variable"), ": ", n("type"), i.defaultValue ? [" = ", n("defaultValue")] : "", _(e2, n, i)];
|
|
225
242
|
case "ObjectTypeExtension":
|
|
226
243
|
case "ObjectTypeDefinition":
|
|
227
244
|
case "InputObjectTypeExtension":
|
|
@@ -229,141 +246,141 @@ function bt(e2, t, n) {
|
|
|
229
246
|
case "InterfaceTypeExtension":
|
|
230
247
|
case "InterfaceTypeDefinition": {
|
|
231
248
|
let { kind: r } = i, s = [];
|
|
232
|
-
return r.endsWith("TypeDefinition") ? s.push(
|
|
249
|
+
return r.endsWith("TypeDefinition") ? s.push(A(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 ", ...kt(e2, t, n)), s.push(_(e2, n, i)), i.fields.length > 0 && s.push([" {", x([f, E(f, g(e2, t, n, "fields"))]), f, "}"]), s;
|
|
233
250
|
}
|
|
234
251
|
case "FieldDefinition":
|
|
235
|
-
return [
|
|
252
|
+
return [A(e2, t, n), n("name"), i.arguments.length > 0 ? y(["(", x([l, E([I("", ", "), l], g(e2, t, n, "arguments"))]), l, ")"]) : "", ": ", n("type"), _(e2, n, i)];
|
|
236
253
|
case "DirectiveDefinition":
|
|
237
|
-
return [
|
|
254
|
+
return [A(e2, t, n), "directive ", "@", n("name"), i.arguments.length > 0 ? y(["(", x([l, E([I("", ", "), l], g(e2, t, n, "arguments"))]), l, ")"]) : "", i.repeatable ? " repeatable" : "", " on ", ...E(" | ", e2.map(n, "locations"))];
|
|
238
255
|
case "EnumTypeExtension":
|
|
239
256
|
case "EnumTypeDefinition":
|
|
240
|
-
return [
|
|
257
|
+
return [A(e2, t, n), i.kind === "EnumTypeExtension" ? "extend " : "", "enum ", n("name"), _(e2, n, i), i.values.length > 0 ? [" {", x([f, E(f, g(e2, t, n, "values"))]), f, "}"] : ""];
|
|
241
258
|
case "EnumValueDefinition":
|
|
242
|
-
return [
|
|
259
|
+
return [A(e2, t, n), n("name"), _(e2, n, i)];
|
|
243
260
|
case "InputValueDefinition":
|
|
244
|
-
return [
|
|
261
|
+
return [A(e2, t, n), n("name"), ": ", n("type"), i.defaultValue ? [" = ", n("defaultValue")] : "", _(e2, n, i)];
|
|
245
262
|
case "SchemaExtension":
|
|
246
|
-
return ["extend schema",
|
|
263
|
+
return ["extend schema", _(e2, n, i), ...i.operationTypes.length > 0 ? [" {", x([f, E(f, g(e2, t, n, "operationTypes"))]), f, "}"] : []];
|
|
247
264
|
case "SchemaDefinition":
|
|
248
|
-
return [
|
|
265
|
+
return [A(e2, t, n), "schema", _(e2, n, i), " {", i.operationTypes.length > 0 ? x([f, E(f, g(e2, t, n, "operationTypes"))]) : "", f, "}"];
|
|
249
266
|
case "OperationTypeDefinition":
|
|
250
267
|
return [i.operation, ": ", n("type")];
|
|
251
268
|
case "FragmentSpread":
|
|
252
|
-
return ["...", n("name"),
|
|
269
|
+
return ["...", n("name"), _(e2, n, i)];
|
|
253
270
|
case "InlineFragment":
|
|
254
|
-
return ["...", i.typeCondition ? [" on ", n("typeCondition")] : "",
|
|
271
|
+
return ["...", i.typeCondition ? [" on ", n("typeCondition")] : "", _(e2, n, i), " ", n("selectionSet")];
|
|
255
272
|
case "UnionTypeExtension":
|
|
256
273
|
case "UnionTypeDefinition":
|
|
257
|
-
return y([
|
|
274
|
+
return y([A(e2, t, n), y([i.kind === "UnionTypeExtension" ? "extend " : "", "union ", n("name"), _(e2, n, i), i.types.length > 0 ? [" =", I("", " "), x([I([k, "| "]), E([k, "| "], e2.map(n, "types"))])] : ""])]);
|
|
258
275
|
case "ScalarTypeExtension":
|
|
259
276
|
case "ScalarTypeDefinition":
|
|
260
|
-
return [
|
|
277
|
+
return [A(e2, t, n), i.kind === "ScalarTypeExtension" ? "extend " : "", "scalar ", n("name"), _(e2, n, i)];
|
|
261
278
|
case "NonNullType":
|
|
262
279
|
return [n("type"), "!"];
|
|
263
280
|
case "ListType":
|
|
264
281
|
return ["[", n("type"), "]"];
|
|
265
282
|
default:
|
|
266
|
-
throw new
|
|
283
|
+
throw new ke(i, "Graphql", "kind");
|
|
267
284
|
}
|
|
268
285
|
}
|
|
269
|
-
function
|
|
286
|
+
function _(e2, t, n) {
|
|
270
287
|
if (n.directives.length === 0) return "";
|
|
271
288
|
let i = E(k, e2.map(t, "directives"));
|
|
272
|
-
return n.kind === "FragmentDefinition" || n.kind === "OperationDefinition" ? y([k, i]) : [" ", y(
|
|
289
|
+
return n.kind === "FragmentDefinition" || n.kind === "OperationDefinition" ? y([k, i]) : [" ", y(x([l, i]))];
|
|
273
290
|
}
|
|
274
291
|
function g(e2, t, n, i) {
|
|
275
292
|
return e2.map(({ isLast: r, node: s }) => {
|
|
276
293
|
let a = n();
|
|
277
|
-
return !r &&
|
|
294
|
+
return !r && Se(t.originalText, q(s)) ? [a, f] : a;
|
|
278
295
|
}, i);
|
|
279
296
|
}
|
|
280
|
-
function
|
|
297
|
+
function gt(e2) {
|
|
281
298
|
return e2.kind !== "Comment";
|
|
282
299
|
}
|
|
283
|
-
function
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
throw new Error("Not a comment: " + JSON.stringify(t));
|
|
300
|
+
function St({ node: e2 }) {
|
|
301
|
+
if (e2.kind === "Comment") return "#" + e2.value.trimEnd();
|
|
302
|
+
throw new Error("Not a comment: " + JSON.stringify(e2));
|
|
287
303
|
}
|
|
288
|
-
function
|
|
304
|
+
function kt(e2, t, n) {
|
|
289
305
|
let { node: i } = e2, r = [], { interfaces: s } = i, a = e2.map(n, "interfaces");
|
|
290
306
|
for (let u = 0; u < s.length; u++) {
|
|
291
|
-
let
|
|
307
|
+
let p = s[u];
|
|
292
308
|
r.push(a[u]);
|
|
293
309
|
let T = s[u + 1];
|
|
294
310
|
if (T) {
|
|
295
|
-
let
|
|
296
|
-
r.push(" &",
|
|
311
|
+
let D = t.originalText.slice(p.loc.end, T.loc.start).includes("#");
|
|
312
|
+
r.push(" &", D ? k : " ");
|
|
297
313
|
}
|
|
298
314
|
}
|
|
299
315
|
return r;
|
|
300
316
|
}
|
|
301
|
-
function
|
|
317
|
+
function Be(e2, t) {
|
|
302
318
|
let { node: n } = e2;
|
|
303
|
-
return
|
|
319
|
+
return se(n.variableDefinitions) ? y(["(", x([l, E([I("", ", "), l], e2.map(t, "variableDefinitions"))]), l, ")"]) : "";
|
|
304
320
|
}
|
|
305
|
-
function
|
|
321
|
+
function Ue(e2, t) {
|
|
306
322
|
e2.kind === "StringValue" && e2.block && !e2.value.includes(`
|
|
307
323
|
`) && (t.value = e2.value.trim());
|
|
308
324
|
}
|
|
309
|
-
|
|
310
|
-
function
|
|
311
|
-
var n;
|
|
325
|
+
Ue.ignoredProperties = /* @__PURE__ */ new Set(["loc", "comments"]);
|
|
326
|
+
function Ct(e2) {
|
|
312
327
|
let { node: t } = e2;
|
|
313
|
-
return
|
|
314
|
-
}
|
|
315
|
-
var
|
|
316
|
-
var
|
|
317
|
-
var
|
|
318
|
-
var
|
|
319
|
-
var
|
|
320
|
-
|
|
321
|
-
|
|
328
|
+
return t?.comments?.some((n) => n.value.trim() === "prettier-ignore");
|
|
329
|
+
}
|
|
330
|
+
var Rt = { print: Dt, massageAstNode: Ue, hasPrettierIgnore: Ct, insertPragma: Ve, printComment: St, canAttachComment: gt, getVisitorKeys: be };
|
|
331
|
+
var Ge = Rt;
|
|
332
|
+
var Ye = [{ name: "GraphQL", type: "data", aceMode: "graphqlschema", extensions: [".graphql", ".gql", ".graphqls"], tmScope: "source.graphql", parsers: ["graphql"], vscodeLanguageIds: ["graphql"], linguistLanguageId: 139 }];
|
|
333
|
+
var je = { 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." } };
|
|
334
|
+
var vt = { bracketSpacing: je.bracketSpacing };
|
|
335
|
+
var $e = vt;
|
|
336
|
+
var he = {};
|
|
337
|
+
de(he, { graphql: () => tn });
|
|
338
|
+
function Xe(e2) {
|
|
322
339
|
return typeof e2 == "object" && e2 !== null;
|
|
323
340
|
}
|
|
324
|
-
function
|
|
325
|
-
throw new Error("Unexpected invariant triggered.");
|
|
341
|
+
function He(e2, t) {
|
|
342
|
+
if (!!!e2) throw new Error(t ?? "Unexpected invariant triggered.");
|
|
326
343
|
}
|
|
327
|
-
var
|
|
344
|
+
var bt = /\r\n|[\n\r]/g;
|
|
328
345
|
function M(e2, t) {
|
|
329
346
|
let n = 0, i = 1;
|
|
330
|
-
for (let r of e2.body.matchAll(
|
|
331
|
-
if (typeof r.index == "number" ||
|
|
347
|
+
for (let r of e2.body.matchAll(bt)) {
|
|
348
|
+
if (typeof r.index == "number" || He(false), r.index >= t) break;
|
|
332
349
|
n = r.index + r[0].length, i += 1;
|
|
333
350
|
}
|
|
334
351
|
return { line: i, column: t + 1 - n };
|
|
335
352
|
}
|
|
336
|
-
function
|
|
337
|
-
return
|
|
353
|
+
function qe(e2) {
|
|
354
|
+
return ue(e2.source, M(e2.source, e2.start));
|
|
338
355
|
}
|
|
339
|
-
function
|
|
340
|
-
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,
|
|
341
|
-
`,
|
|
342
|
-
if (
|
|
343
|
-
let O = Math.floor(
|
|
344
|
-
for (let v = 0; v <
|
|
345
|
-
return T +
|
|
356
|
+
function ue(e2, t) {
|
|
357
|
+
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, p = t.column + u, T = `${e2.name}:${a}:${p}
|
|
358
|
+
`, d = i.split(/\r\n|[\n\r]/g), D = d[r];
|
|
359
|
+
if (D.length > 120) {
|
|
360
|
+
let O = Math.floor(p / 80), re = p % 80, N = [];
|
|
361
|
+
for (let v = 0; v < D.length; v += 80) N.push(D.slice(v, v + 80));
|
|
362
|
+
return T + Je([[`${a} |`, N[0]], ...N.slice(1, O + 1).map((v) => ["|", v]), ["|", "^".padStart(re)], ["|", N[O + 1]]]);
|
|
346
363
|
}
|
|
347
|
-
return T +
|
|
364
|
+
return T + Je([[`${a - 1} |`, d[r - 1]], [`${a} |`, D], ["|", "^".padStart(p)], [`${a + 1} |`, d[r + 1]]]);
|
|
348
365
|
}
|
|
349
|
-
function
|
|
366
|
+
function Je(e2) {
|
|
350
367
|
let t = e2.filter(([i, r]) => r !== void 0), n = Math.max(...t.map(([i]) => i.length));
|
|
351
368
|
return t.map(([i, r]) => i.padStart(n) + (r ? " " + r : "")).join(`
|
|
352
369
|
`);
|
|
353
370
|
}
|
|
354
|
-
function
|
|
371
|
+
function Lt(e2) {
|
|
355
372
|
let t = e2[0];
|
|
356
373
|
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;
|
|
357
374
|
}
|
|
358
|
-
var
|
|
375
|
+
var Q = class e extends Error {
|
|
359
376
|
constructor(t, ...n) {
|
|
360
377
|
var i, r, s;
|
|
361
|
-
let { nodes: a, source: u, positions:
|
|
362
|
-
super(t), this.name = "GraphQLError", this.path = T ?? void 0, this.originalError =
|
|
363
|
-
let O =
|
|
364
|
-
this.source = u ?? (O == null || (r = O[0]) === null || r === void 0 ? void 0 : r.source), this.positions =
|
|
365
|
-
let
|
|
366
|
-
this.extensions = (s =
|
|
378
|
+
let { nodes: a, source: u, positions: p, path: T, originalError: d, extensions: D } = Lt(n);
|
|
379
|
+
super(t), this.name = "GraphQLError", this.path = T ?? void 0, this.originalError = d ?? void 0, this.nodes = Qe(Array.isArray(a) ? a : a ? [a] : void 0);
|
|
380
|
+
let O = Qe((i = this.nodes) === null || i === void 0 ? void 0 : i.map((N) => N.loc).filter((N) => N != null));
|
|
381
|
+
this.source = u ?? (O == null || (r = O[0]) === null || r === void 0 ? void 0 : r.source), this.positions = p ?? O?.map((N) => N.start), this.locations = p && u ? p.map((N) => M(u, N)) : O?.map((N) => M(N.source, N.start));
|
|
382
|
+
let re = Xe(d?.extensions) ? d?.extensions : void 0;
|
|
383
|
+
this.extensions = (s = D ?? re) !== 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 } }), d != null && d.stack ? Object.defineProperty(this, "stack", { value: d.stack, writable: true, configurable: true }) : Error.captureStackTrace ? Error.captureStackTrace(this, e) : Object.defineProperty(this, "stack", { value: Error().stack, writable: true, configurable: true });
|
|
367
384
|
}
|
|
368
385
|
get [Symbol.toStringTag]() {
|
|
369
386
|
return "GraphQLError";
|
|
@@ -372,10 +389,10 @@ var Z = class e extends Error {
|
|
|
372
389
|
let t = this.message;
|
|
373
390
|
if (this.nodes) for (let n of this.nodes) n.loc && (t += `
|
|
374
391
|
|
|
375
|
-
` +
|
|
392
|
+
` + qe(n.loc));
|
|
376
393
|
else if (this.source && this.locations) for (let n of this.locations) t += `
|
|
377
394
|
|
|
378
|
-
` +
|
|
395
|
+
` + ue(this.source, n);
|
|
379
396
|
return t;
|
|
380
397
|
}
|
|
381
398
|
toJSON() {
|
|
@@ -383,57 +400,57 @@ var Z = class e extends Error {
|
|
|
383
400
|
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;
|
|
384
401
|
}
|
|
385
402
|
};
|
|
386
|
-
function
|
|
403
|
+
function Qe(e2) {
|
|
387
404
|
return e2 === void 0 || e2.length === 0 ? void 0 : e2;
|
|
388
405
|
}
|
|
389
|
-
function
|
|
390
|
-
return new
|
|
406
|
+
function h(e2, t, n) {
|
|
407
|
+
return new Q(`Syntax Error: ${n}`, { source: e2, positions: [t] });
|
|
391
408
|
}
|
|
392
|
-
var
|
|
409
|
+
var W;
|
|
393
410
|
(function(e2) {
|
|
394
411
|
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";
|
|
395
|
-
})(
|
|
412
|
+
})(W || (W = {}));
|
|
396
413
|
var c;
|
|
397
414
|
(function(e2) {
|
|
398
|
-
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";
|
|
415
|
+
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", e2.TYPE_COORDINATE = "TypeCoordinate", e2.MEMBER_COORDINATE = "MemberCoordinate", e2.ARGUMENT_COORDINATE = "ArgumentCoordinate", e2.DIRECTIVE_COORDINATE = "DirectiveCoordinate", e2.DIRECTIVE_ARGUMENT_COORDINATE = "DirectiveArgumentCoordinate";
|
|
399
416
|
})(c || (c = {}));
|
|
400
|
-
function
|
|
417
|
+
function We(e2) {
|
|
401
418
|
return e2 === 9 || e2 === 32;
|
|
402
419
|
}
|
|
403
420
|
function b(e2) {
|
|
404
421
|
return e2 >= 48 && e2 <= 57;
|
|
405
422
|
}
|
|
406
|
-
function
|
|
423
|
+
function ze(e2) {
|
|
407
424
|
return e2 >= 97 && e2 <= 122 || e2 >= 65 && e2 <= 90;
|
|
408
425
|
}
|
|
409
|
-
function
|
|
410
|
-
return
|
|
426
|
+
function pe(e2) {
|
|
427
|
+
return ze(e2) || e2 === 95;
|
|
411
428
|
}
|
|
412
|
-
function
|
|
413
|
-
return
|
|
429
|
+
function Ke(e2) {
|
|
430
|
+
return ze(e2) || b(e2) || e2 === 95;
|
|
414
431
|
}
|
|
415
|
-
function
|
|
432
|
+
function Ze(e2) {
|
|
416
433
|
var t;
|
|
417
434
|
let n = Number.MAX_SAFE_INTEGER, i = null, r = -1;
|
|
418
435
|
for (let a = 0; a < e2.length; ++a) {
|
|
419
436
|
var s;
|
|
420
|
-
let u = e2[a],
|
|
421
|
-
|
|
437
|
+
let u = e2[a], p = Pt(u);
|
|
438
|
+
p !== u.length && (i = (s = i) !== null && s !== void 0 ? s : a, r = a, a !== 0 && p < n && (n = p));
|
|
422
439
|
}
|
|
423
440
|
return e2.map((a, u) => u === 0 ? a : a.slice(n)).slice((t = i) !== null && t !== void 0 ? t : 0, r + 1);
|
|
424
441
|
}
|
|
425
|
-
function
|
|
442
|
+
function Pt(e2) {
|
|
426
443
|
let t = 0;
|
|
427
|
-
for (; t < e2.length &&
|
|
444
|
+
for (; t < e2.length && We(e2.charCodeAt(t)); ) ++t;
|
|
428
445
|
return t;
|
|
429
446
|
}
|
|
430
447
|
var o;
|
|
431
448
|
(function(e2) {
|
|
432
|
-
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";
|
|
449
|
+
e2.SOF = "<SOF>", e2.EOF = "<EOF>", e2.BANG = "!", e2.DOLLAR = "$", e2.AMP = "&", e2.PAREN_L = "(", e2.PAREN_R = ")", e2.DOT = ".", 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";
|
|
433
450
|
})(o || (o = {}));
|
|
434
|
-
var
|
|
451
|
+
var z = class {
|
|
435
452
|
constructor(t) {
|
|
436
|
-
let n = new
|
|
453
|
+
let n = new F(o.SOF, 0, 0, 0, 0);
|
|
437
454
|
this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
|
|
438
455
|
}
|
|
439
456
|
get [Symbol.toStringTag]() {
|
|
@@ -447,26 +464,26 @@ var te = class {
|
|
|
447
464
|
if (t.kind !== o.EOF) do
|
|
448
465
|
if (t.next) t = t.next;
|
|
449
466
|
else {
|
|
450
|
-
let n =
|
|
467
|
+
let n = wt(this, t.end);
|
|
451
468
|
t.next = n, n.prev = t, t = n;
|
|
452
469
|
}
|
|
453
470
|
while (t.kind === o.COMMENT);
|
|
454
471
|
return t;
|
|
455
472
|
}
|
|
456
473
|
};
|
|
457
|
-
function
|
|
458
|
-
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;
|
|
474
|
+
function tt(e2) {
|
|
475
|
+
return e2 === o.BANG || e2 === o.DOLLAR || e2 === o.AMP || e2 === o.PAREN_L || e2 === o.PAREN_R || e2 === o.DOT || 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;
|
|
459
476
|
}
|
|
460
|
-
function
|
|
477
|
+
function L(e2) {
|
|
461
478
|
return e2 >= 0 && e2 <= 55295 || e2 >= 57344 && e2 <= 1114111;
|
|
462
479
|
}
|
|
463
|
-
function
|
|
464
|
-
return
|
|
480
|
+
function K(e2, t) {
|
|
481
|
+
return nt(e2.charCodeAt(t)) && rt(e2.charCodeAt(t + 1));
|
|
465
482
|
}
|
|
466
|
-
function
|
|
483
|
+
function nt(e2) {
|
|
467
484
|
return e2 >= 55296 && e2 <= 56319;
|
|
468
485
|
}
|
|
469
|
-
function
|
|
486
|
+
function rt(e2) {
|
|
470
487
|
return e2 >= 56320 && e2 <= 57343;
|
|
471
488
|
}
|
|
472
489
|
function R(e2, t) {
|
|
@@ -480,9 +497,9 @@ function R(e2, t) {
|
|
|
480
497
|
}
|
|
481
498
|
function m(e2, t, n, i, r) {
|
|
482
499
|
let s = e2.line, a = 1 + n - e2.lineStart;
|
|
483
|
-
return new
|
|
500
|
+
return new F(t, n, i, s, a, r);
|
|
484
501
|
}
|
|
485
|
-
function
|
|
502
|
+
function wt(e2, t) {
|
|
486
503
|
let n = e2.source.body, i = n.length, r = t;
|
|
487
504
|
for (; r < i; ) {
|
|
488
505
|
let s = n.charCodeAt(r);
|
|
@@ -500,7 +517,7 @@ function jt(e2, t) {
|
|
|
500
517
|
n.charCodeAt(r + 1) === 10 ? r += 2 : ++r, ++e2.line, e2.lineStart = r;
|
|
501
518
|
continue;
|
|
502
519
|
case 35:
|
|
503
|
-
return
|
|
520
|
+
return Ft(e2, r);
|
|
504
521
|
case 33:
|
|
505
522
|
return m(e2, o.BANG, r, r + 1);
|
|
506
523
|
case 36:
|
|
@@ -531,85 +548,85 @@ function jt(e2, t) {
|
|
|
531
548
|
case 125:
|
|
532
549
|
return m(e2, o.BRACE_R, r, r + 1);
|
|
533
550
|
case 34:
|
|
534
|
-
return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ?
|
|
551
|
+
return n.charCodeAt(r + 1) === 34 && n.charCodeAt(r + 2) === 34 ? Yt(e2, r) : Vt(e2, r);
|
|
535
552
|
}
|
|
536
|
-
if (b(s) || s === 45) return
|
|
537
|
-
if (
|
|
538
|
-
throw
|
|
553
|
+
if (b(s) || s === 45) return Mt(e2, r, s);
|
|
554
|
+
if (pe(s)) return jt(e2, r);
|
|
555
|
+
throw h(e2.source, r, s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : L(s) || K(n, r) ? `Unexpected character: ${R(e2, r)}.` : `Invalid character: ${R(e2, r)}.`);
|
|
539
556
|
}
|
|
540
557
|
return m(e2, o.EOF, i, i);
|
|
541
558
|
}
|
|
542
|
-
function
|
|
559
|
+
function Ft(e2, t) {
|
|
543
560
|
let n = e2.source.body, i = n.length, r = t + 1;
|
|
544
561
|
for (; r < i; ) {
|
|
545
562
|
let s = n.charCodeAt(r);
|
|
546
563
|
if (s === 10 || s === 13) break;
|
|
547
|
-
if (
|
|
548
|
-
else if (
|
|
564
|
+
if (L(s)) ++r;
|
|
565
|
+
else if (K(n, r)) r += 2;
|
|
549
566
|
else break;
|
|
550
567
|
}
|
|
551
568
|
return m(e2, o.COMMENT, t, r, n.slice(t + 1, r));
|
|
552
569
|
}
|
|
553
|
-
function
|
|
570
|
+
function Mt(e2, t, n) {
|
|
554
571
|
let i = e2.source.body, r = t, s = n, a = false;
|
|
555
572
|
if (s === 45 && (s = i.charCodeAt(++r)), s === 48) {
|
|
556
|
-
if (s = i.charCodeAt(++r), b(s)) throw
|
|
557
|
-
} else r =
|
|
558
|
-
if (s === 46 && (a = true, s = i.charCodeAt(++r), r =
|
|
573
|
+
if (s = i.charCodeAt(++r), b(s)) throw h(e2.source, r, `Invalid number, unexpected digit after 0: ${R(e2, r)}.`);
|
|
574
|
+
} else r = le(e2, r, s), s = i.charCodeAt(r);
|
|
575
|
+
if (s === 46 && (a = true, s = i.charCodeAt(++r), r = le(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 = le(e2, r, s), s = i.charCodeAt(r)), s === 46 || pe(s)) throw h(e2.source, r, `Invalid number, expected digit but got: ${R(e2, r)}.`);
|
|
559
576
|
return m(e2, a ? o.FLOAT : o.INT, t, r, i.slice(t, r));
|
|
560
577
|
}
|
|
561
|
-
function
|
|
562
|
-
if (!b(n)) throw
|
|
578
|
+
function le(e2, t, n) {
|
|
579
|
+
if (!b(n)) throw h(e2.source, t, `Invalid number, expected digit but got: ${R(e2, t)}.`);
|
|
563
580
|
let i = e2.source.body, r = t + 1;
|
|
564
581
|
for (; b(i.charCodeAt(r)); ) ++r;
|
|
565
582
|
return r;
|
|
566
583
|
}
|
|
567
|
-
function
|
|
584
|
+
function Vt(e2, t) {
|
|
568
585
|
let n = e2.source.body, i = n.length, r = t + 1, s = r, a = "";
|
|
569
586
|
for (; r < i; ) {
|
|
570
587
|
let u = n.charCodeAt(r);
|
|
571
588
|
if (u === 34) return a += n.slice(s, r), m(e2, o.STRING, t, r + 1, a);
|
|
572
589
|
if (u === 92) {
|
|
573
590
|
a += n.slice(s, r);
|
|
574
|
-
let
|
|
575
|
-
a +=
|
|
591
|
+
let p = n.charCodeAt(r + 1) === 117 ? n.charCodeAt(r + 2) === 123 ? Bt(e2, r) : Ut(e2, r) : Gt(e2, r);
|
|
592
|
+
a += p.value, r += p.size, s = r;
|
|
576
593
|
continue;
|
|
577
594
|
}
|
|
578
595
|
if (u === 10 || u === 13) break;
|
|
579
|
-
if (
|
|
580
|
-
else if (
|
|
581
|
-
else throw
|
|
596
|
+
if (L(u)) ++r;
|
|
597
|
+
else if (K(n, r)) r += 2;
|
|
598
|
+
else throw h(e2.source, r, `Invalid character within String: ${R(e2, r)}.`);
|
|
582
599
|
}
|
|
583
|
-
throw
|
|
600
|
+
throw h(e2.source, r, "Unterminated string.");
|
|
584
601
|
}
|
|
585
|
-
function
|
|
602
|
+
function Bt(e2, t) {
|
|
586
603
|
let n = e2.source.body, i = 0, r = 3;
|
|
587
604
|
for (; r < 12; ) {
|
|
588
605
|
let s = n.charCodeAt(t + r++);
|
|
589
606
|
if (s === 125) {
|
|
590
|
-
if (r < 5 || !
|
|
607
|
+
if (r < 5 || !L(i)) break;
|
|
591
608
|
return { value: String.fromCodePoint(i), size: r };
|
|
592
609
|
}
|
|
593
610
|
if (i = i << 4 | V(s), i < 0) break;
|
|
594
611
|
}
|
|
595
|
-
throw
|
|
612
|
+
throw h(e2.source, t, `Invalid Unicode escape sequence: "${n.slice(t, t + r)}".`);
|
|
596
613
|
}
|
|
597
|
-
function
|
|
598
|
-
let n = e2.source.body, i =
|
|
599
|
-
if (
|
|
600
|
-
if (
|
|
601
|
-
let r =
|
|
602
|
-
if (
|
|
614
|
+
function Ut(e2, t) {
|
|
615
|
+
let n = e2.source.body, i = et(n, t + 2);
|
|
616
|
+
if (L(i)) return { value: String.fromCodePoint(i), size: 6 };
|
|
617
|
+
if (nt(i) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
|
|
618
|
+
let r = et(n, t + 8);
|
|
619
|
+
if (rt(r)) return { value: String.fromCodePoint(i, r), size: 12 };
|
|
603
620
|
}
|
|
604
|
-
throw
|
|
621
|
+
throw h(e2.source, t, `Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`);
|
|
605
622
|
}
|
|
606
|
-
function
|
|
623
|
+
function et(e2, t) {
|
|
607
624
|
return V(e2.charCodeAt(t)) << 12 | V(e2.charCodeAt(t + 1)) << 8 | V(e2.charCodeAt(t + 2)) << 4 | V(e2.charCodeAt(t + 3));
|
|
608
625
|
}
|
|
609
626
|
function V(e2) {
|
|
610
627
|
return e2 >= 48 && e2 <= 57 ? e2 - 48 : e2 >= 65 && e2 <= 70 ? e2 - 55 : e2 >= 97 && e2 <= 102 ? e2 - 87 : -1;
|
|
611
628
|
}
|
|
612
|
-
function
|
|
629
|
+
function Gt(e2, t) {
|
|
613
630
|
let n = e2.source.body;
|
|
614
631
|
switch (n.charCodeAt(t + 1)) {
|
|
615
632
|
case 34:
|
|
@@ -630,84 +647,84 @@ function Qt(e2, t) {
|
|
|
630
647
|
case 116:
|
|
631
648
|
return { value: " ", size: 2 };
|
|
632
649
|
}
|
|
633
|
-
throw
|
|
650
|
+
throw h(e2.source, t, `Invalid character escape sequence: "${n.slice(t, t + 2)}".`);
|
|
634
651
|
}
|
|
635
|
-
function
|
|
636
|
-
let n = e2.source.body, i = n.length, r = e2.lineStart, s = t + 3, a = s, u = "",
|
|
652
|
+
function Yt(e2, t) {
|
|
653
|
+
let n = e2.source.body, i = n.length, r = e2.lineStart, s = t + 3, a = s, u = "", p = [];
|
|
637
654
|
for (; s < i; ) {
|
|
638
655
|
let T = n.charCodeAt(s);
|
|
639
656
|
if (T === 34 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34) {
|
|
640
|
-
u += n.slice(a, s),
|
|
641
|
-
let
|
|
657
|
+
u += n.slice(a, s), p.push(u);
|
|
658
|
+
let d = m(e2, o.BLOCK_STRING, t, s + 3, Ze(p).join(`
|
|
642
659
|
`));
|
|
643
|
-
return e2.line +=
|
|
660
|
+
return e2.line += p.length - 1, e2.lineStart = r, d;
|
|
644
661
|
}
|
|
645
662
|
if (T === 92 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34 && n.charCodeAt(s + 3) === 34) {
|
|
646
663
|
u += n.slice(a, s), a = s + 1, s += 4;
|
|
647
664
|
continue;
|
|
648
665
|
}
|
|
649
666
|
if (T === 10 || T === 13) {
|
|
650
|
-
u += n.slice(a, s),
|
|
667
|
+
u += n.slice(a, s), p.push(u), T === 13 && n.charCodeAt(s + 1) === 10 ? s += 2 : ++s, u = "", a = s, r = s;
|
|
651
668
|
continue;
|
|
652
669
|
}
|
|
653
|
-
if (
|
|
654
|
-
else if (
|
|
655
|
-
else throw
|
|
670
|
+
if (L(T)) ++s;
|
|
671
|
+
else if (K(n, s)) s += 2;
|
|
672
|
+
else throw h(e2.source, s, `Invalid character within String: ${R(e2, s)}.`);
|
|
656
673
|
}
|
|
657
|
-
throw
|
|
674
|
+
throw h(e2.source, s, "Unterminated string.");
|
|
658
675
|
}
|
|
659
|
-
function
|
|
676
|
+
function jt(e2, t) {
|
|
660
677
|
let n = e2.source.body, i = n.length, r = t + 1;
|
|
661
678
|
for (; r < i; ) {
|
|
662
679
|
let s = n.charCodeAt(r);
|
|
663
|
-
if (
|
|
680
|
+
if (Ke(s)) ++r;
|
|
664
681
|
else break;
|
|
665
682
|
}
|
|
666
683
|
return m(e2, o.NAME, t, r, n.slice(t, r));
|
|
667
684
|
}
|
|
668
|
-
function
|
|
669
|
-
throw new Error(t);
|
|
685
|
+
function Z(e2, t) {
|
|
686
|
+
if (!!!e2) throw new Error(t);
|
|
670
687
|
}
|
|
671
|
-
function
|
|
672
|
-
return
|
|
688
|
+
function ee(e2) {
|
|
689
|
+
return te(e2, []);
|
|
673
690
|
}
|
|
674
|
-
function
|
|
691
|
+
function te(e2, t) {
|
|
675
692
|
switch (typeof e2) {
|
|
676
693
|
case "string":
|
|
677
694
|
return JSON.stringify(e2);
|
|
678
695
|
case "function":
|
|
679
696
|
return e2.name ? `[function ${e2.name}]` : "[function]";
|
|
680
697
|
case "object":
|
|
681
|
-
return
|
|
698
|
+
return $t(e2, t);
|
|
682
699
|
default:
|
|
683
700
|
return String(e2);
|
|
684
701
|
}
|
|
685
702
|
}
|
|
686
|
-
function
|
|
703
|
+
function $t(e2, t) {
|
|
687
704
|
if (e2 === null) return "null";
|
|
688
705
|
if (t.includes(e2)) return "[Circular]";
|
|
689
706
|
let n = [...t, e2];
|
|
690
|
-
if (
|
|
707
|
+
if (Xt(e2)) {
|
|
691
708
|
let i = e2.toJSON();
|
|
692
|
-
if (i !== e2) return typeof i == "string" ? i :
|
|
693
|
-
} else if (Array.isArray(e2)) return
|
|
694
|
-
return
|
|
709
|
+
if (i !== e2) return typeof i == "string" ? i : te(i, n);
|
|
710
|
+
} else if (Array.isArray(e2)) return Jt(e2, n);
|
|
711
|
+
return Ht(e2, n);
|
|
695
712
|
}
|
|
696
|
-
function
|
|
713
|
+
function Xt(e2) {
|
|
697
714
|
return typeof e2.toJSON == "function";
|
|
698
715
|
}
|
|
699
|
-
function
|
|
716
|
+
function Ht(e2, t) {
|
|
700
717
|
let n = Object.entries(e2);
|
|
701
|
-
return n.length === 0 ? "{}" : t.length > 2 ? "[" +
|
|
718
|
+
return n.length === 0 ? "{}" : t.length > 2 ? "[" + qt(e2) + "]" : "{ " + n.map(([r, s]) => r + ": " + te(s, t)).join(", ") + " }";
|
|
702
719
|
}
|
|
703
|
-
function
|
|
720
|
+
function Jt(e2, t) {
|
|
704
721
|
if (e2.length === 0) return "[]";
|
|
705
722
|
if (t.length > 2) return "[Array]";
|
|
706
723
|
let n = Math.min(10, e2.length), i = e2.length - n, r = [];
|
|
707
|
-
for (let s = 0; s < n; ++s) r.push(
|
|
724
|
+
for (let s = 0; s < n; ++s) r.push(te(e2[s], t));
|
|
708
725
|
return i === 1 ? r.push("... 1 more item") : i > 1 && r.push(`... ${i} more items`), "[" + r.join(", ") + "]";
|
|
709
726
|
}
|
|
710
|
-
function
|
|
727
|
+
function qt(e2) {
|
|
711
728
|
let t = Object.prototype.toString.call(e2).replace(/^\[object /, "").replace(/]$/, "");
|
|
712
729
|
if (t === "Object" && typeof e2.constructor == "function") {
|
|
713
730
|
let n = e2.constructor.name;
|
|
@@ -715,7 +732,8 @@ function nn(e2) {
|
|
|
715
732
|
}
|
|
716
733
|
return t;
|
|
717
734
|
}
|
|
718
|
-
var
|
|
735
|
+
var Qt = globalThis.process && true;
|
|
736
|
+
var it = Qt ? function(t, n) {
|
|
719
737
|
return t instanceof n;
|
|
720
738
|
} : function(t, n) {
|
|
721
739
|
if (t instanceof n) return true;
|
|
@@ -723,7 +741,7 @@ var rn = globalThis.process && true, pt = rn ? function(t, n) {
|
|
|
723
741
|
var i;
|
|
724
742
|
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;
|
|
725
743
|
if (r === s) {
|
|
726
|
-
let a =
|
|
744
|
+
let a = ee(t);
|
|
727
745
|
throw new Error(`Cannot use ${r} "${a}" from another module or realm.
|
|
728
746
|
|
|
729
747
|
Ensure that there is only one instance of "graphql" in the node_modules
|
|
@@ -740,25 +758,30 @@ spurious results.`);
|
|
|
740
758
|
}
|
|
741
759
|
return false;
|
|
742
760
|
};
|
|
743
|
-
var
|
|
761
|
+
var B = class {
|
|
744
762
|
constructor(t, n = "GraphQL request", i = { line: 1, column: 1 }) {
|
|
745
|
-
typeof t == "string" ||
|
|
763
|
+
typeof t == "string" || Z(false, `Body must be a string. Received: ${ee(t)}.`), this.body = t, this.name = n, this.locationOffset = i, this.locationOffset.line > 0 || Z(false, "line in locationOffset is 1-indexed and must be positive."), this.locationOffset.column > 0 || Z(false, "column in locationOffset is 1-indexed and must be positive.");
|
|
746
764
|
}
|
|
747
765
|
get [Symbol.toStringTag]() {
|
|
748
766
|
return "Source";
|
|
749
767
|
}
|
|
750
768
|
};
|
|
751
|
-
function
|
|
752
|
-
return
|
|
769
|
+
function st(e2) {
|
|
770
|
+
return it(e2, B);
|
|
753
771
|
}
|
|
754
|
-
function
|
|
755
|
-
let n = new
|
|
772
|
+
function ot(e2, t) {
|
|
773
|
+
let n = new fe(e2, t), i = n.parseDocument();
|
|
756
774
|
return Object.defineProperty(i, "tokenCount", { enumerable: false, value: n.tokenCount }), i;
|
|
757
775
|
}
|
|
758
|
-
var
|
|
776
|
+
var fe = class {
|
|
759
777
|
constructor(t, n = {}) {
|
|
760
|
-
let
|
|
761
|
-
|
|
778
|
+
let { lexer: i, ...r } = n;
|
|
779
|
+
if (i) this._lexer = i;
|
|
780
|
+
else {
|
|
781
|
+
let s = st(t) ? t : new B(t);
|
|
782
|
+
this._lexer = new z(s);
|
|
783
|
+
}
|
|
784
|
+
this._options = r, this._tokenCounter = 0;
|
|
762
785
|
}
|
|
763
786
|
get tokenCount() {
|
|
764
787
|
return this._tokenCounter;
|
|
@@ -773,6 +796,7 @@ var Te = class {
|
|
|
773
796
|
parseDefinition() {
|
|
774
797
|
if (this.peek(o.BRACE_L)) return this.parseOperationDefinition();
|
|
775
798
|
let t = this.peekDescription(), n = t ? this._lexer.lookahead() : this._lexer.token;
|
|
799
|
+
if (t && n.kind === o.BRACE_L) throw h(this._lexer.source, this._lexer.token.start, "Unexpected description, descriptions are not supported on shorthand queries.");
|
|
776
800
|
if (n.kind === o.NAME) {
|
|
777
801
|
switch (n.value) {
|
|
778
802
|
case "schema":
|
|
@@ -792,7 +816,6 @@ var Te = class {
|
|
|
792
816
|
case "directive":
|
|
793
817
|
return this.parseDirectiveDefinition();
|
|
794
818
|
}
|
|
795
|
-
if (t) throw d(this._lexer.source, this._lexer.token.start, "Unexpected description, descriptions are supported only on type definitions.");
|
|
796
819
|
switch (n.value) {
|
|
797
820
|
case "query":
|
|
798
821
|
case "mutation":
|
|
@@ -800,6 +823,9 @@ var Te = class {
|
|
|
800
823
|
return this.parseOperationDefinition();
|
|
801
824
|
case "fragment":
|
|
802
825
|
return this.parseFragmentDefinition();
|
|
826
|
+
}
|
|
827
|
+
if (t) throw h(this._lexer.source, this._lexer.token.start, "Unexpected description, only GraphQL definitions support descriptions.");
|
|
828
|
+
switch (n.value) {
|
|
803
829
|
case "extend":
|
|
804
830
|
return this.parseTypeSystemExtension();
|
|
805
831
|
}
|
|
@@ -808,9 +834,9 @@ var Te = class {
|
|
|
808
834
|
}
|
|
809
835
|
parseOperationDefinition() {
|
|
810
836
|
let t = this._lexer.token;
|
|
811
|
-
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() });
|
|
812
|
-
let n = this.parseOperationType(),
|
|
813
|
-
return this.peek(o.NAME) && (
|
|
837
|
+
if (this.peek(o.BRACE_L)) return this.node(t, { kind: c.OPERATION_DEFINITION, operation: C.QUERY, description: void 0, name: void 0, variableDefinitions: [], directives: [], selectionSet: this.parseSelectionSet() });
|
|
838
|
+
let n = this.parseDescription(), i = this.parseOperationType(), r;
|
|
839
|
+
return this.peek(o.NAME) && (r = this.parseName()), this.node(t, { kind: c.OPERATION_DEFINITION, operation: i, description: n, name: r, variableDefinitions: this.parseVariableDefinitions(), directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet() });
|
|
814
840
|
}
|
|
815
841
|
parseOperationType() {
|
|
816
842
|
let t = this.expectToken(o.NAME);
|
|
@@ -828,7 +854,7 @@ var Te = class {
|
|
|
828
854
|
return this.optionalMany(o.PAREN_L, this.parseVariableDefinition, o.PAREN_R);
|
|
829
855
|
}
|
|
830
856
|
parseVariableDefinition() {
|
|
831
|
-
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() });
|
|
857
|
+
return this.node(this._lexer.token, { kind: c.VARIABLE_DEFINITION, description: this.parseDescription(), variable: this.parseVariable(), type: (this.expectToken(o.COLON), this.parseTypeReference()), defaultValue: this.expectOptionalToken(o.EQUALS) ? this.parseConstValueLiteral() : void 0, directives: this.parseConstDirectives() });
|
|
832
858
|
}
|
|
833
859
|
parseVariable() {
|
|
834
860
|
let t = this._lexer.token;
|
|
@@ -862,8 +888,8 @@ var Te = class {
|
|
|
862
888
|
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() });
|
|
863
889
|
}
|
|
864
890
|
parseFragmentDefinition() {
|
|
865
|
-
let t = this._lexer.token;
|
|
866
|
-
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() });
|
|
891
|
+
let t = this._lexer.token, n = this.parseDescription();
|
|
892
|
+
return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === true ? this.node(t, { kind: c.FRAGMENT_DEFINITION, description: n, 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, description: n, name: this.parseFragmentName(), typeCondition: (this.expectKeyword("on"), this.parseNamedType()), directives: this.parseDirectives(false), selectionSet: this.parseSelectionSet() });
|
|
867
893
|
}
|
|
868
894
|
parseFragmentName() {
|
|
869
895
|
if (this._lexer.token.value === "on") throw this.unexpected();
|
|
@@ -897,7 +923,7 @@ var Te = class {
|
|
|
897
923
|
case o.DOLLAR:
|
|
898
924
|
if (t) if (this.expectToken(o.DOLLAR), this._lexer.token.kind === o.NAME) {
|
|
899
925
|
let i = this._lexer.token.value;
|
|
900
|
-
throw
|
|
926
|
+
throw h(this._lexer.source, n.start, `Unexpected variable "$${i}" in constant value.`);
|
|
901
927
|
} else throw this.unexpected(n);
|
|
902
928
|
return this.parseVariable();
|
|
903
929
|
default:
|
|
@@ -1028,7 +1054,7 @@ var Te = class {
|
|
|
1028
1054
|
return this.node(t, { kind: c.ENUM_VALUE_DEFINITION, description: n, name: i, directives: r });
|
|
1029
1055
|
}
|
|
1030
1056
|
parseEnumValueName() {
|
|
1031
|
-
if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null") throw
|
|
1057
|
+
if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null") throw h(this._lexer.source, this._lexer.token.start, `${ne(this._lexer.token)} is reserved and cannot be used for an enum value.`);
|
|
1032
1058
|
return this.parseName();
|
|
1033
1059
|
}
|
|
1034
1060
|
parseInputObjectTypeDefinition() {
|
|
@@ -1122,11 +1148,17 @@ var Te = class {
|
|
|
1122
1148
|
}
|
|
1123
1149
|
parseDirectiveLocation() {
|
|
1124
1150
|
let t = this._lexer.token, n = this.parseName();
|
|
1125
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
1151
|
+
if (Object.prototype.hasOwnProperty.call(W, n.value)) return n;
|
|
1126
1152
|
throw this.unexpected(t);
|
|
1127
1153
|
}
|
|
1154
|
+
parseSchemaCoordinate() {
|
|
1155
|
+
let t = this._lexer.token, n = this.expectOptionalToken(o.AT), i = this.parseName(), r;
|
|
1156
|
+
!n && this.expectOptionalToken(o.DOT) && (r = this.parseName());
|
|
1157
|
+
let s;
|
|
1158
|
+
return (n || r) && this.expectOptionalToken(o.PAREN_L) && (s = this.parseName(), this.expectToken(o.COLON), this.expectToken(o.PAREN_R)), n ? s ? this.node(t, { kind: c.DIRECTIVE_ARGUMENT_COORDINATE, name: i, argumentName: s }) : this.node(t, { kind: c.DIRECTIVE_COORDINATE, name: i }) : r ? s ? this.node(t, { kind: c.ARGUMENT_COORDINATE, name: i, fieldName: r, argumentName: s }) : this.node(t, { kind: c.MEMBER_COORDINATE, name: i, memberName: r }) : this.node(t, { kind: c.TYPE_COORDINATE, name: i });
|
|
1159
|
+
}
|
|
1128
1160
|
node(t, n) {
|
|
1129
|
-
return this._options.noLocation !== true && (n.loc = new
|
|
1161
|
+
return this._options.noLocation !== true && (n.loc = new H(t, this._lexer.lastToken, this._lexer.source)), n;
|
|
1130
1162
|
}
|
|
1131
1163
|
peek(t) {
|
|
1132
1164
|
return this._lexer.token.kind === t;
|
|
@@ -1134,7 +1166,7 @@ var Te = class {
|
|
|
1134
1166
|
expectToken(t) {
|
|
1135
1167
|
let n = this._lexer.token;
|
|
1136
1168
|
if (n.kind === t) return this.advanceLexer(), n;
|
|
1137
|
-
throw
|
|
1169
|
+
throw h(this._lexer.source, n.start, `Expected ${at(t)}, found ${ne(n)}.`);
|
|
1138
1170
|
}
|
|
1139
1171
|
expectOptionalToken(t) {
|
|
1140
1172
|
return this._lexer.token.kind === t ? (this.advanceLexer(), true) : false;
|
|
@@ -1142,7 +1174,7 @@ var Te = class {
|
|
|
1142
1174
|
expectKeyword(t) {
|
|
1143
1175
|
let n = this._lexer.token;
|
|
1144
1176
|
if (n.kind === o.NAME && n.value === t) this.advanceLexer();
|
|
1145
|
-
else throw
|
|
1177
|
+
else throw h(this._lexer.source, n.start, `Expected "${t}", found ${ne(n)}.`);
|
|
1146
1178
|
}
|
|
1147
1179
|
expectOptionalKeyword(t) {
|
|
1148
1180
|
let n = this._lexer.token;
|
|
@@ -1150,7 +1182,7 @@ var Te = class {
|
|
|
1150
1182
|
}
|
|
1151
1183
|
unexpected(t) {
|
|
1152
1184
|
let n = t ?? this._lexer.token;
|
|
1153
|
-
return
|
|
1185
|
+
return h(this._lexer.source, n.start, `Unexpected ${ne(n)}.`);
|
|
1154
1186
|
}
|
|
1155
1187
|
any(t, n, i) {
|
|
1156
1188
|
this.expectToken(t);
|
|
@@ -1186,45 +1218,49 @@ var Te = class {
|
|
|
1186
1218
|
}
|
|
1187
1219
|
advanceLexer() {
|
|
1188
1220
|
let { maxTokens: t } = this._options, n = this._lexer.advance();
|
|
1189
|
-
if (n.kind !== o.EOF && (++this._tokenCounter, t !== void 0 && this._tokenCounter > t)) throw
|
|
1221
|
+
if (n.kind !== o.EOF && (++this._tokenCounter, t !== void 0 && this._tokenCounter > t)) throw h(this._lexer.source, n.start, `Document contains more that ${t} tokens. Parsing aborted.`);
|
|
1190
1222
|
}
|
|
1191
1223
|
};
|
|
1192
|
-
function
|
|
1224
|
+
function ne(e2) {
|
|
1193
1225
|
let t = e2.value;
|
|
1194
|
-
return
|
|
1226
|
+
return at(e2.kind) + (t != null ? ` "${t}"` : "");
|
|
1195
1227
|
}
|
|
1196
|
-
function
|
|
1197
|
-
return
|
|
1228
|
+
function at(e2) {
|
|
1229
|
+
return tt(e2) ? `"${e2}"` : e2;
|
|
1198
1230
|
}
|
|
1199
|
-
function
|
|
1231
|
+
function Wt(e2, t) {
|
|
1200
1232
|
let n = new SyntaxError(e2 + " (" + t.loc.start.line + ":" + t.loc.start.column + ")");
|
|
1201
1233
|
return Object.assign(n, t);
|
|
1202
1234
|
}
|
|
1203
|
-
var
|
|
1204
|
-
function
|
|
1235
|
+
var ct = Wt;
|
|
1236
|
+
function zt(e2) {
|
|
1205
1237
|
let t = [], { startToken: n, endToken: i } = e2.loc;
|
|
1206
1238
|
for (let r = n; r !== i; r = r.next) r.kind === "Comment" && t.push({ ...r, loc: { start: r.start, end: r.end } });
|
|
1207
1239
|
return t;
|
|
1208
1240
|
}
|
|
1209
|
-
var
|
|
1210
|
-
function
|
|
1211
|
-
if (
|
|
1241
|
+
var Kt = { allowLegacyFragmentVariables: true };
|
|
1242
|
+
function Zt(e2) {
|
|
1243
|
+
if (e2?.name === "GraphQLError") {
|
|
1212
1244
|
let { message: t, locations: [n] } = e2;
|
|
1213
|
-
return
|
|
1245
|
+
return ct(t, { loc: { start: n }, cause: e2 });
|
|
1214
1246
|
}
|
|
1215
1247
|
return e2;
|
|
1216
1248
|
}
|
|
1217
|
-
function
|
|
1249
|
+
function en(e2) {
|
|
1218
1250
|
let t;
|
|
1219
1251
|
try {
|
|
1220
|
-
t =
|
|
1252
|
+
t = ot(e2, Kt);
|
|
1221
1253
|
} catch (n) {
|
|
1222
|
-
throw
|
|
1223
|
-
}
|
|
1224
|
-
return t.comments =
|
|
1225
|
-
}
|
|
1226
|
-
var
|
|
1227
|
-
var
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1254
|
+
throw Zt(n);
|
|
1255
|
+
}
|
|
1256
|
+
return t.comments = zt(t), t;
|
|
1257
|
+
}
|
|
1258
|
+
var tn = { parse: en, astFormat: "graphql", hasPragma: Fe, hasIgnorePragma: Me, locStart: J, locEnd: q };
|
|
1259
|
+
var nn = { graphql: Ge };
|
|
1260
|
+
export {
|
|
1261
|
+
ut as default,
|
|
1262
|
+
Ye as languages,
|
|
1263
|
+
$e as options,
|
|
1264
|
+
he as parsers,
|
|
1265
|
+
nn as printers
|
|
1266
|
+
};
|