Add `graphql.experimental` parsing for react-relay (#2116)

master
adanoff 2017-06-12 17:16:17 -07:00 committed by Christopher Chedeau
parent 4cf94c95c7
commit 44b5da8ade
3 changed files with 33 additions and 3 deletions

View File

@ -94,6 +94,7 @@ function fromBabylonFlowOrTypeScript(path) {
/* /*
* react-relay and graphql-tag * react-relay and graphql-tag
* graphql`...` * graphql`...`
* graphql.experimental`...`
* gql`...` * gql`...`
*/ */
if ( if (
@ -103,9 +104,12 @@ function fromBabylonFlowOrTypeScript(path) {
// ((parentParent.tag.type === "MemberExpression" && // ((parentParent.tag.type === "MemberExpression" &&
// parentParent.tag.object.name === "Relay" && // parentParent.tag.object.name === "Relay" &&
// parentParent.tag.property.name === "QL") || // parentParent.tag.property.name === "QL") ||
(parentParent.tag.type === "Identifier" && ((parentParent.tag.type === "MemberExpression" &&
(parentParent.tag.name === "gql" || parentParent.tag.object.name === "graphql" &&
parentParent.tag.name === "graphql")) parentParent.tag.property.name === "experimental") ||
(parentParent.tag.type === "Identifier" &&
(parentParent.tag.name === "gql" ||
parentParent.tag.name === "graphql")))
) { ) {
return { return {
options: { parser: "graphql" }, options: { parser: "graphql" },

View File

@ -36,6 +36,14 @@ graphql\`
) )
{ markReadNotification(data: $input ) { notification {seenState} } } { markReadNotification(data: $input ) { notification {seenState} } }
\`; \`;
graphql.experimental\`
mutation MarkReadNotificationMutation(
$input
: MarkReadNotificationData!
)
{ markReadNotification(data: $input ) { notification {seenState} } }
\`;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
const { graphql } = require("react-relay"); const { graphql } = require("react-relay");
@ -49,4 +57,14 @@ graphql\`
} }
\`; \`;
graphql.experimental\`
mutation MarkReadNotificationMutation($input: MarkReadNotificationData!) {
markReadNotification(data: $input) {
notification {
seenState
}
}
}
\`;
`; `;

View File

@ -7,3 +7,11 @@ graphql`
) )
{ markReadNotification(data: $input ) { notification {seenState} } } { markReadNotification(data: $input ) { notification {seenState} } }
`; `;
graphql.experimental`
mutation MarkReadNotificationMutation(
$input
: MarkReadNotificationData!
)
{ markReadNotification(data: $input ) { notification {seenState} } }
`;