146 lines
4.8 KiB
JavaScript
146 lines
4.8 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: 939e07c76f4b30f0.294c1bf0d6.js
|
|
* Module id: 714646
|
|
* For reading/searching only; this factory depends on the original Turbopack runtime.
|
|
*/
|
|
|
|
const moduleFactory = (e, t, i) => {
|
|
"use strict";
|
|
function r(e) {
|
|
(e.languages.graphql = {
|
|
comment: /#.*/,
|
|
description: {
|
|
pattern:
|
|
/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,
|
|
greedy: !0,
|
|
alias: "string",
|
|
inside: {
|
|
"language-markdown": {
|
|
pattern: /(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,
|
|
lookbehind: !0,
|
|
inside: e.languages.markdown,
|
|
},
|
|
},
|
|
},
|
|
string: {
|
|
pattern: /"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,
|
|
greedy: !0,
|
|
},
|
|
number: /(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
|
|
boolean: /\b(?:false|true)\b/,
|
|
variable: /\$[a-z_]\w*/i,
|
|
directive: { pattern: /@[a-z_]\w*/i, alias: "function" },
|
|
"attr-name": {
|
|
pattern:
|
|
/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,
|
|
greedy: !0,
|
|
},
|
|
"atom-input": { pattern: /\b[A-Z]\w*Input\b/, alias: "class-name" },
|
|
scalar: /\b(?:Boolean|Float|ID|Int|String)\b/,
|
|
constant: /\b[A-Z][A-Z_\d]*\b/,
|
|
"class-name": {
|
|
pattern:
|
|
/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,
|
|
lookbehind: !0,
|
|
},
|
|
fragment: {
|
|
pattern: /(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,
|
|
lookbehind: !0,
|
|
alias: "function",
|
|
},
|
|
"definition-mutation": {
|
|
pattern: /(\bmutation\s+)[a-zA-Z_]\w*/,
|
|
lookbehind: !0,
|
|
alias: "function",
|
|
},
|
|
"definition-query": {
|
|
pattern: /(\bquery\s+)[a-zA-Z_]\w*/,
|
|
lookbehind: !0,
|
|
alias: "function",
|
|
},
|
|
keyword:
|
|
/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,
|
|
operator: /[!=|&]|\.{3}/,
|
|
"property-query": /\w+(?=\s*\()/,
|
|
object: /\w+(?=\s*\{)/,
|
|
punctuation: /[!(){}\[\]:=,]/,
|
|
property: /\w+/,
|
|
}),
|
|
e.hooks.add("after-tokenize", function (e) {
|
|
if ("graphql" === e.language)
|
|
for (
|
|
var t = e.tokens.filter(function (e) {
|
|
return (
|
|
"string" != typeof e &&
|
|
"comment" !== e.type &&
|
|
"scalar" !== e.type
|
|
);
|
|
}),
|
|
i = 0;
|
|
i < t.length;
|
|
|
|
) {
|
|
var r = t[i++];
|
|
if ("keyword" === r.type && "mutation" === r.content) {
|
|
var a = [];
|
|
if (
|
|
c(["definition-mutation", "punctuation"]) &&
|
|
"(" === t[i + 1].content
|
|
) {
|
|
i += 2;
|
|
var n = d(/^\($/, /^\)$/);
|
|
if (-1 === n) continue;
|
|
for (; i < n; i++) {
|
|
var A = t[i + 0];
|
|
"variable" === A.type &&
|
|
(u(A, "variable-input"), a.push(A.content));
|
|
}
|
|
i = n + 1;
|
|
}
|
|
if (
|
|
c(["punctuation", "property-query"]) &&
|
|
"{" === t[i + 0].content &&
|
|
(u(t[++i + 0], "property-mutation"), a.length > 0)
|
|
) {
|
|
var s = d(/^\{$/, /^\}$/);
|
|
if (-1 === s) continue;
|
|
for (var o = i; o < s; o++) {
|
|
var l = t[o];
|
|
"variable" === l.type &&
|
|
a.indexOf(l.content) >= 0 &&
|
|
u(l, "variable-input");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function c(e, r) {
|
|
r = r || 0;
|
|
for (var a = 0; a < e.length; a++) {
|
|
var n = t[i + (a + r)];
|
|
if (!n || n.type !== e[a]) return !1;
|
|
}
|
|
return !0;
|
|
}
|
|
function d(e, r) {
|
|
for (var a = 1, n = i; n < t.length; n++) {
|
|
var A = t[n],
|
|
s = A.content;
|
|
if ("punctuation" === A.type && "string" == typeof s) {
|
|
if (e.test(s)) a++;
|
|
else if (r.test(s) && 0 == --a) return n;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
function u(e, t) {
|
|
var i = e.alias;
|
|
i ? Array.isArray(i) || (e.alias = i = [i]) : (e.alias = i = []),
|
|
i.push(t);
|
|
}
|
|
});
|
|
}
|
|
(t.exports = r), (r.displayName = "graphql"), (r.aliases = []);
|
|
};
|
|
|
|
export default moduleFactory;
|