Skip to content

Commit 0ad6314

Browse files
authored
fix(gatsby-graphiql-explorer): Use upstream exporter package (#36966)
1 parent 964265c commit 0ad6314

File tree

6 files changed

+58
-209
lines changed

6 files changed

+58
-209
lines changed

packages/gatsby-graphiql-explorer/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@
3838
"@babel/plugin-transform-runtime": "^7.15.0",
3939
"@babel/preset-env": "^7.15.4",
4040
"@babel/preset-react": "^7.14.0",
41-
"@graphiql/plugin-explorer": "^0.1.3",
42-
"@graphiql/react": "^0.13.0",
43-
"@graphiql/toolkit": "^0.7.3",
41+
"@graphiql/plugin-code-exporter": "^0.1.0",
42+
"@graphiql/plugin-explorer": "^0.1.10",
43+
"@graphiql/react": "^0.13.7",
44+
"@graphiql/toolkit": "^0.8.0",
4445
"babel-loader": "^8.2.2",
4546
"babel-preset-gatsby-package": "^3.0.0-next.1",
4647
"core-js": "^3.22.3",
4748
"cross-env": "^7.0.3",
4849
"css-loader": "^6.2.0",
4950
"del-cli": "^5.0.0",
50-
"graphiql": "^2.0.6",
51-
"graphiql-code-exporter": "^3.0.3",
51+
"graphiql": "^2.0.13",
5252
"html-webpack-plugin": "^5.3.2",
5353
"npm-run-all": "4.1.5",
5454
"react": "^18.2.0",

packages/gatsby-graphiql-explorer/src/app.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import ReactDOM from "react-dom"
66
import { GraphiQL } from "graphiql"
77
import { getIntrospectionQuery } from "graphql"
88
import { useExplorerPlugin } from "@graphiql/plugin-explorer"
9+
import { useExporterPlugin } from "@graphiql/plugin-code-exporter"
910

10-
import { useExporterPlugin } from "./code-exporter/plugin.jsx"
1111
import { snippets } from "./code-exporter/snippets.js"
1212
import { Logo } from "./logo.jsx"
1313
import { fetcher, fetchFragments, locationQuery } from "./utils.js"
@@ -21,6 +21,7 @@ import {
2121

2222
import "graphiql/graphiql.css"
2323
import "@graphiql/plugin-explorer/dist/style.css"
24+
import "@graphiql/plugin-code-exporter/dist/style.css"
2425
import "./app.css"
2526

2627
const parameters = {}

packages/gatsby-graphiql-explorer/src/code-exporter/code-exporter.css

Lines changed: 0 additions & 135 deletions
This file was deleted.

packages/gatsby-graphiql-explorer/src/code-exporter/plugin.jsx

Lines changed: 0 additions & 34 deletions
This file was deleted.

packages/gatsby-graphiql-explorer/src/code-exporter/snippets.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,18 @@ const pageQuery = {
2020
language: `JavaScript`,
2121
codeMirrorMode: `jsx`,
2222
options: [],
23-
generate: arg => `import React from "react"
23+
generate: arg => `import * as React from "react"
2424
import { graphql } from "gatsby"
2525
26-
const Page = ({ data }) => <pre>{JSON.stringify(data, null, 4)}</pre>
26+
const Page = ({ data }) => (
27+
<pre>{JSON.stringify(data, null, 2)}</pre>
28+
)
2729
2830
export const query = graphql\`
2931
${getQuery(arg, 2)}
3032
\`
3133
3234
export default Page
33-
3435
`,
3536
}
3637

@@ -39,7 +40,7 @@ const useStaticQuery = {
3940
language: `JavaScript`,
4041
codeMirrorMode: `jsx`,
4142
options: [],
42-
generate: arg => `import React from "react"
43+
generate: arg => `import * as React from "react"
4344
import { useStaticQuery, graphql } from "gatsby"
4445
4546
const ComponentName = () => {
@@ -61,23 +62,24 @@ const createPages = {
6162
options: [],
6263
generate: arg => `const path = require(\`path\`)
6364
65+
const templatePath = path.resolve(\`PATH/TO/TEMPLATE.js\`)
66+
6467
exports.createPages = async ({ graphql, actions }) => {
6568
const { createPage } = actions
6669
6770
const result = await graphql(\`
6871
${getQuery(arg, 4)}
6972
\`)
70-
const templatePath = path.resolve(\`PATH/TO/TEMPLATE.js\`)
7173
7274
result.data.${
7375
arg.operationDataList[0].operationDefinition.selectionSet.selections[0].name
7476
.value
7577
}.forEach((node) => {
7678
createPage({
77-
path: NODE_SLUG,
79+
path: node.id,
7880
component: templatePath,
7981
context: {
80-
slug: NODE_SLUG,
82+
id: node.id
8183
},
8284
})
8385
})

yarn.lock

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,37 +1662,44 @@
16621662
html-entities "^2.3.3"
16631663
strip-ansi "^6.0.0"
16641664

1665-
"@graphiql/plugin-explorer@^0.1.3":
1666-
version "0.1.3"
1667-
resolved "https://registry.yarnpkg.com/@graphiql/plugin-explorer/-/plugin-explorer-0.1.3.tgz#7e597749b8a9768dc981aaaf31c1c1321be5a701"
1668-
integrity sha512-N3DDex87u5kV2EvpOFLtnhFg0kO37lBZof1TxiBI2bEv1HM1xCu6wgsRYc7MZeXzLysdGZiL4KqLNsxXh2nm+g==
1665+
"@graphiql/plugin-code-exporter@^0.1.0":
1666+
version "0.1.0"
1667+
resolved "https://registry.yarnpkg.com/@graphiql/plugin-code-exporter/-/plugin-code-exporter-0.1.0.tgz#724f61bc0d8d02ecaaabd4ec74412281620523c1"
1668+
integrity sha512-jHpBe+JGCpO4CHnW9yfkYpORdZGSf2/pzEF/EDqhln/VOtgX1FlSu/1OINvY2CSMe2R6LBk7oiuPuLGmxNWmog==
1669+
dependencies:
1670+
graphiql-code-exporter "^3.0.3"
1671+
1672+
"@graphiql/plugin-explorer@^0.1.10":
1673+
version "0.1.10"
1674+
resolved "https://registry.yarnpkg.com/@graphiql/plugin-explorer/-/plugin-explorer-0.1.10.tgz#036d48c5194844b4349f6b15dcf6062e72f86ddb"
1675+
integrity sha512-Zfq8VQ9j9g9GleJ7WfTti4pRBCsp4lWL0ShXWgqJKKyV/3cIhKHt8PJW5PB34O/OACxCshXeANA2ibB2d/y3xg==
16691676
dependencies:
1670-
"@graphiql/react" "^0.13.0"
1677+
"@graphiql/react" "^0.13.7"
16711678
graphiql-explorer "^0.9.0"
16721679

1673-
"@graphiql/react@^0.13.0":
1674-
version "0.13.0"
1675-
resolved "https://registry.yarnpkg.com/@graphiql/react/-/react-0.13.0.tgz#83050db5bdc29fa5fe3306e0b0613074272931dd"
1676-
integrity sha512-n7TR0NxNHWQOl62NRC3V6sM57yrrRRJkBWSM9mb7k+CbQPceAAtrGiwyyvppgNCafNqJE5I4B8ZFzfhFGN5IPA==
1680+
"@graphiql/react@^0.13.7":
1681+
version "0.13.7"
1682+
resolved "https://registry.yarnpkg.com/@graphiql/react/-/react-0.13.7.tgz#23c41d0326893c336942d80e1e6cfb32eb7eac3b"
1683+
integrity sha512-mI+6mXd9AJFDJy39VuZGxCiVLvmBe2XoNidbN3lXgTLe689RZKifPaUw41USitQOu20sASoYDfzJ8i98G4urow==
16771684
dependencies:
1678-
"@graphiql/toolkit" "^0.7.3"
1685+
"@graphiql/toolkit" "^0.8.0"
16791686
"@reach/combobox" "^0.17.0"
16801687
"@reach/dialog" "^0.17.0"
16811688
"@reach/listbox" "^0.17.0"
16821689
"@reach/menu-button" "^0.17.0"
16831690
"@reach/tooltip" "^0.17.0"
16841691
"@reach/visually-hidden" "^0.17.0"
16851692
codemirror "^5.65.3"
1686-
codemirror-graphql "^2.0.0"
1693+
codemirror-graphql "^2.0.2"
16871694
copy-to-clipboard "^3.2.0"
16881695
graphql-language-service "^5.1.0"
16891696
markdown-it "^12.2.0"
16901697
set-value "^4.1.0"
16911698

1692-
"@graphiql/toolkit@^0.7.3":
1693-
version "0.7.3"
1694-
resolved "https://registry.yarnpkg.com/@graphiql/toolkit/-/toolkit-0.7.3.tgz#0f8009a26eef01c0bb2168bb2c2421ee8b6d987a"
1695-
integrity sha512-Scr0fVcwN7Hb+9L315xMuI2NyWynY9ENMy6VEREF6x02XZNSOguG0uK9lzC2/RnIuFy7eA/ejMfgdaX9GGcZKQ==
1699+
"@graphiql/toolkit@^0.8.0":
1700+
version "0.8.0"
1701+
resolved "https://registry.yarnpkg.com/@graphiql/toolkit/-/toolkit-0.8.0.tgz#f778baaab36be7fa7c9c07e8161a3334fc2c23ec"
1702+
integrity sha512-DbMFhEKejpPzB6k8W3Mj+Rl8geXiw49USDF9Wdi06EEk1XLVh1iebDqveYY+4lViITsV4+BeGikxlqi8umfP4g==
16961703
dependencies:
16971704
"@n1ru4l/push-pull-async-iterable-iterator" "^3.1.0"
16981705
meros "^1.1.4"
@@ -7417,12 +7424,12 @@ codegen.macro@^4.1.0:
74177424
dependencies:
74187425
babel-plugin-codegen "^4.1.0"
74197426

7420-
codemirror-graphql@^2.0.0:
7421-
version "2.0.0"
7422-
resolved "https://registry.yarnpkg.com/codemirror-graphql/-/codemirror-graphql-2.0.0.tgz#0705da4e179f0708b249d4460b231598cebaa696"
7423-
integrity sha512-4trIaV9LYo/yRMu3s5qf7ASrKQjcCGrVfqOwaFsdjjcG8koh93gCzZ+csMhe3n6A7lMLWEpPdFWBIepKGV7qQg==
7427+
codemirror-graphql@^2.0.2:
7428+
version "2.0.2"
7429+
resolved "https://registry.yarnpkg.com/codemirror-graphql/-/codemirror-graphql-2.0.2.tgz#df3cbcb53efc2ad63f170888f25647659376f319"
7430+
integrity sha512-9c1cItR+8lG7thmTnDDQ3zI8YesNKiFCp2BnLFkYWCtdhSSuCUHebU/Vurew6ayyUl8MBCldNx3Ev66QAWM5Kw==
74247431
dependencies:
7425-
graphql-language-service "^5.1.0"
7432+
graphql-language-service "5.0.6"
74267433

74277434
codemirror@^5.65.3:
74287435
version "5.65.8"
@@ -11899,13 +11906,13 @@ graphiql-explorer@^0.9.0:
1189911906
resolved "https://registry.yarnpkg.com/graphiql-explorer/-/graphiql-explorer-0.9.0.tgz#25f6b990bfc3e04e88c0cf419e28d12abe2c4fbe"
1190011907
integrity sha512-fZC/wsuatqiQDO2otchxriFO0LaWIo/ovF/CQJ1yOudmY0P7pzDiP+l9CEHUiWbizk3e99x6DQG4XG1VxA+d6A==
1190111908

11902-
graphiql@^2.0.6:
11903-
version "2.0.6"
11904-
resolved "https://registry.yarnpkg.com/graphiql/-/graphiql-2.0.6.tgz#1fe992db6dbc71b494994ea9e4df6789e5c57eea"
11905-
integrity sha512-f7nwDc7wKEFi2Ttqwpbmv9Yk5j/rPgZWgGDXbABSBlopUW5+5agOPyNORtFIv6FrpP2TooAEye/xs8aFYjbR6A==
11909+
graphiql@^2.0.13:
11910+
version "2.0.13"
11911+
resolved "https://registry.yarnpkg.com/graphiql/-/graphiql-2.0.13.tgz#2734382a66e77a8a9232540a1a1da5bbe3e9e8bb"
11912+
integrity sha512-hfqcd40aO2V44Z/rey6lGXYnEsbwseeokeeZGQbFfSImciGtyP0SS8MyE5s5yno6z/M0ymJccpaNaUlC6imSwA==
1190611913
dependencies:
11907-
"@graphiql/react" "^0.13.0"
11908-
"@graphiql/toolkit" "^0.7.3"
11914+
"@graphiql/react" "^0.13.7"
11915+
"@graphiql/toolkit" "^0.8.0"
1190911916
entities "^2.0.0"
1191011917
graphql-language-service "^5.1.0"
1191111918
markdown-it "^12.2.0"
@@ -11922,6 +11929,14 @@ [email protected]:
1192211929
resolved "https://registry.yarnpkg.com/graphql-executor/-/graphql-executor-0.0.23.tgz#205c1764b39ee0fcf611553865770f37b45851a2"
1192311930
integrity sha512-3Ivlyfjaw3BWmGtUSnMpP/a4dcXCp0mJtj0PiPG14OKUizaMKlSEX+LX2Qed0LrxwniIwvU6B4w/koVjEPyWJg==
1192411931

11932+
11933+
version "5.0.6"
11934+
resolved "https://registry.yarnpkg.com/graphql-language-service/-/graphql-language-service-5.0.6.tgz#7fd1e6479e5c3074b070c760fa961d9ad1ed7c72"
11935+
integrity sha512-FjE23aTy45Lr5metxCv3ZgSKEZOzN7ERR+OFC1isV5mHxI0Ob8XxayLTYjQKrs8b3kOpvgTYmSmu6AyXOzYslg==
11936+
dependencies:
11937+
nullthrows "^1.0.0"
11938+
vscode-languageserver-types "^3.15.1"
11939+
1192511940
graphql-language-service@^5.1.0:
1192611941
version "5.1.0"
1192711942
resolved "https://registry.yarnpkg.com/graphql-language-service/-/graphql-language-service-5.1.0.tgz#06f06eab5209daea066441abd1063afece62bfa9"
@@ -25361,7 +25376,7 @@ vlq@^0.2.2:
2536125376
version "0.2.3"
2536225377
resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.3.tgz#8f3e4328cf63b1540c0d67e1b2778386f8975b26"
2536325378

25364-
vscode-languageserver-types@^3.17.1:
25379+
vscode-languageserver-types@^3.15.1, vscode-languageserver-types@^3.17.1:
2536525380
version "3.17.2"
2536625381
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.17.2.tgz#b2c2e7de405ad3d73a883e91989b850170ffc4f2"
2536725382
integrity sha512-zHhCWatviizPIq9B7Vh9uvrH6x3sK8itC84HkamnBWoDFJtzBf7SWlpLCZUit72b3os45h6RWQNC9xHRDF8dRA==

0 commit comments

Comments
 (0)