Skip to content

Commit bda9f1f

Browse files
authored
fix(gatsby): Remove relay compiler & use our own (#19665)
* Remove relay compiler dependency This also reimplements fragment global scoping from Relay * Fix latest issues
1 parent 613304c commit bda9f1f

File tree

11 files changed

+3558
-1781
lines changed

11 files changed

+3558
-1781
lines changed

packages/gatsby-cli/src/structured-errors/error-map.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ const errorMap = {
4343
},
4444
"85908": {
4545
text: context => {
46-
const closetFragment = context.closestFragment
46+
const closestFragment = context.closestFragment
4747
? `\n\nDid you mean to use ` + `"${context.closestFragment}"?`
4848
: ``
4949

50-
return `There was an error in your GraphQL query:\n\nThe fragment "${context.fragmentName}" does not exist.${closetFragment}`
50+
return `There was an error in your GraphQL query:\n\nThe fragment "${context.fragmentName}" does not exist.\n\n${context.codeFrame}${closestFragment}`
5151
},
5252
type: `GRAPHQL`,
5353
level: `ERROR`,
@@ -131,6 +131,21 @@ const errorMap = {
131131
type: `GRAPHQL`,
132132
level: `ERROR`,
133133
},
134+
// Duplicate fragment
135+
"85919": {
136+
text: context =>
137+
stripIndent(`
138+
Found two different GraphQL fragments with identical name "${context.fragmentName}". Fragment names must be unique
139+
140+
File: ${context.leftFragment.filePath}
141+
${context.leftFragment.codeFrame}
142+
143+
File: ${context.rightFragment.filePath}
144+
${context.rightFragment.codeFrame}
145+
`),
146+
type: `GRAPHQL`,
147+
level: `ERROR`,
148+
},
134149
// Config errors
135150
"10123": {
136151
text: context =>
@@ -253,7 +268,7 @@ const errorMap = {
253268
[
254269
stripIndent(`
255270
Your plugins must export known APIs from their gatsby-${context.exportType}.js.
256-
271+
257272
See https://www.gatsbyjs.org/docs/${context.exportType}-apis/ for the list of Gatsby ${context.exportType} APIs.
258273
`),
259274
]

packages/gatsby/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"@babel/polyfill": "^7.7.0",
1717
"@babel/runtime": "^7.7.4",
1818
"@babel/traverse": "^7.7.4",
19-
"@gatsbyjs/relay-compiler": "2.0.0-printer-fix.4",
2019
"@hapi/joi": "^15.1.1",
2120
"@mikaelkristiansson/domready": "^1.0.9",
2221
"@pieh/friendly-errors-webpack-plugin": "1.7.0-chalk-2",

0 commit comments

Comments
 (0)