Update GraphQL to v17 (#19175)

This commit is contained in:
fisker Cheung authored and GitHub committed 2026-06-05 18:49:38 +08:00
1 parent 43bfbe249a
commit 2e2a23fa08
6 files changed
+40 -26

No files matched your search

+1 -1
View File
@@ -76,7 +76,7 @@
"flow-parser": "0.317.0",
"get-east-asian-width": "1.6.0",
"get-stdin": "9.0.0",
"graphql": "16.14.1",
"graphql": "17.0.0-rc.0",
"hermes-parser": "0.36.1",
"html-element-attributes": "3.5.0",
"html-ua-styles": "0.3.1",
+1 -1
View File
@@ -28,7 +28,7 @@ const packageTransforms = new Map([
transforms["method-at"],
["@glimmer/syntax", "angular-estree-parser", "espree"],
],
[transforms["object-has-own"], ["@babel/parser", "meriyah"]],
[transforms["object-has-own"], ["@babel/parser", "meriyah", "graphql"]],
[transforms["string-raw"], ["camelcase", "@angular/compiler"]],
[transforms["method-is-well-formed"], ["meriyah"]],
/* spell-checker: enable */
+6 -1
View File
@@ -3,6 +3,10 @@ import createError from "../common/parser-create-error.js";
import { locEnd, locStart } from "./loc.js";
import { hasIgnorePragma, hasPragma } from "./pragma.js";
/**
@import {ParseOptions} from "graphql"
*/
function parseComments(ast) {
const comments = [];
const { startToken, endToken } = ast.loc;
@@ -15,8 +19,9 @@ function parseComments(ast) {
return comments;
}
/** @type {ParseOptions} */
const parseOptions = {
allowLegacyFragmentVariables: true,
experimentalFragmentArguments: true,
experimentalDirectivesOnDirectiveDefinitions: true,
};
+20 -17
View File
@@ -71,7 +71,7 @@ function genericPrint(path, options, print) {
return group([
node.alias ? [print("alias"), ": "] : "",
print("name"),
node.arguments.length > 0
isNonEmptyArray(node.arguments)
? group([
"(",
indent([
@@ -142,20 +142,20 @@ function genericPrint(path, options, print) {
]);
case "ObjectValue": {
const bracketSpace =
options.bracketSpacing && node.fields.length > 0 ? " " : "";
const isEmpty = !isNonEmptyArray(node.fields);
const bracketSpace = options.bracketSpacing && !isEmpty ? " " : "";
return group([
"{",
bracketSpace,
printDanglingComments(path, options, { indent: true }),
isNonEmptyArray(node.fields)
? [
isEmpty
? ""
: [
indent([
softline,
join([ifBreak("", ", "), softline], path.map(print, "fields")),
]),
]
: "",
],
softline,
ifBreak("", bracketSpace),
"}",
@@ -170,7 +170,7 @@ function genericPrint(path, options, print) {
return [
"@",
print("name"),
node.arguments.length > 0
isNonEmptyArray(node.arguments)
? group([
"(",
indent([
@@ -223,7 +223,10 @@ function genericPrint(path, options, print) {
}
parts.push(" ", print("name"));
if (!kind.startsWith("InputObjectType") && node.interfaces.length > 0) {
if (
!kind.startsWith("InputObjectType") &&
isNonEmptyArray(node.interfaces)
) {
parts.push(
" implements ",
indent([group([join([" &", line], path.map(print, "interfaces"))])]),
@@ -232,7 +235,7 @@ function genericPrint(path, options, print) {
parts.push(printDirectives(path, print));
if (node.fields.length > 0) {
if (isNonEmptyArray(node.fields)) {
parts.push([
" {",
indent([
@@ -251,7 +254,7 @@ function genericPrint(path, options, print) {
return [
printDescription(path, options, print),
print("name"),
node.arguments.length > 0
isNonEmptyArray(node.arguments)
? group([
"(",
indent([
@@ -276,7 +279,7 @@ function genericPrint(path, options, print) {
"directive ",
"@",
print("name"),
node.arguments.length > 0
isNonEmptyArray(node.arguments)
? group([
"(",
indent([
@@ -311,7 +314,7 @@ function genericPrint(path, options, print) {
"enum ",
print("name"),
printDirectives(path, print),
node.values.length > 0
isNonEmptyArray(node.values)
? [
" {",
indent([
@@ -345,7 +348,7 @@ function genericPrint(path, options, print) {
return [
"extend schema",
printDirectives(path, print),
...(node.operationTypes.length > 0
...(isNonEmptyArray(node.operationTypes)
? [
" {",
indent([
@@ -367,7 +370,7 @@ function genericPrint(path, options, print) {
"schema",
printDirectives(path, print),
" {",
node.operationTypes.length > 0
isNonEmptyArray(node.operationTypes)
? indent([
hardline,
join(
@@ -404,7 +407,7 @@ function genericPrint(path, options, print) {
"union ",
print("name"),
printDirectives(path, print),
node.types.length > 0
isNonEmptyArray(node.types)
? [
" =",
ifBreak("", " "),
@@ -442,7 +445,7 @@ function genericPrint(path, options, print) {
function printDirectives(path, print) {
const { node } = path;
if (node.directives.length === 0) {
if (!isNonEmptyArray(node.directives)) {
return "";
}
+7 -1
View File
@@ -1,4 +1,4 @@
import { QueryDocumentKeys as graphqlVisitorKeys } from "graphql/language/ast.mjs";
import { QueryDocumentKeys as graphqlVisitorKeys } from "graphql/language/ast";
const visitorKeys = { ...graphqlVisitorKeys };
@@ -13,4 +13,10 @@ for (const kind of [
delete visitorKeys[kind];
}
// Not supported yet
visitorKeys.FragmentSpread = visitorKeys.FragmentSpread.filter(
(key) => key !== "arguments",
);
delete visitorKeys.FragmentArgument;
export default visitorKeys;
+5 -5
View File
@@ -5239,10 +5239,10 @@ __metadata:
languageName: node
linkType: hard
"graphql@npm:16.14.1":
version: 16.14.1
resolution: "graphql@npm:16.14.1"
checksum: 10/8e506bdd2a0dac666e3de82461bd3cf337335b9c0a9a209756a4d20c481393a4f664084474ccc1ccd22a1fae174a69695ce4154a59d2b6e1c0de0b2cfc992ca8
"graphql@npm:17.0.0-rc.0":
version: 17.0.0-rc.0
resolution: "graphql@npm:17.0.0-rc.0"
checksum: 10/cb23267a03f556ded9072f4307b445aa82239753d46bd33749be7527db29bd9e956937ed0eda0f949e8443108a8673903ff6626ce7e0ce9d835d7cfb0cb992bc
languageName: node
linkType: hard
@@ -8140,7 +8140,7 @@ __metadata:
get-stdin: "npm:9.0.0"
gfm-test-suite: "npm:0.0.2"
globals: "npm:17.6.0"
graphql: "npm:16.14.1"
graphql: "npm:17.0.0-rc.0"
hermes-parser: "npm:0.36.1"
html-element-attributes: "npm:3.5.0"
html-ua-styles: "npm:0.3.1"