Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e-tests/adapters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"gatsby-cypress": "^3.13.1",
"netlify-cli": "^17.25.0",
"npm-run-all": "^4.1.5",
"start-server-and-test": "^2.0.3",
"start-server-and-test": "2.1.1",
"typescript": "^5.3.3"
}
}
2 changes: 1 addition & 1 deletion e2e-tests/contentful/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"gatsby-cypress": "next",
"prettier": "^2.8.8",
"srcset": "^5.0.0",
"start-server-and-test": "^2.0.3",
"start-server-and-test": "2.1.1",
"typescript": "^5.3.3"
},
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/development-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"gatsby-cypress": "next",
"is-ci": "^3.0.1",
"prettier": "^2.8.8",
"start-server-and-test": "^2.0.3",
"start-server-and-test": "2.1.1",
"typescript": "^5.3.3",
"yargs": "^17.7.2"
},
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"gatsby-cypress": "next",
"is-ci": "^3.0.1",
"prettier": "^2.8.8",
"start-server-and-test": "^2.0.3",
"start-server-and-test": "2.1.1",
"typescript": "^5.3.3"
}
}
2 changes: 1 addition & 1 deletion e2e-tests/path-prefix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"make-dir-cli": "^3.1.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.8",
"start-server-and-test": "^2.0.3",
"start-server-and-test": "2.1.1",
"typescript": "^5.3.3",
"wait-on": "^7.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/production-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"gatsby-core-utils": "next",
"is-ci": "^3.0.1",
"prettier": "^2.8.8",
"start-server-and-test": "^2.0.3",
"start-server-and-test": "2.1.1",
"typescript": "^5.3.3"
},
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/themes/development-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
"gatsby-cypress": "next",
"is-ci": "^3.0.1",
"prettier": "^2.8.8",
"start-server-and-test": "^2.0.3",
"start-server-and-test": "2.1.1",
"typescript": "^5.3.3"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-default"
}
}
}
4 changes: 2 additions & 2 deletions e2e-tests/themes/production-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
"gatsby-cypress": "next",
"is-ci": "^3.0.1",
"prettier": "^2.8.8",
"start-server-and-test": "^2.0.3",
"start-server-and-test": "2.1.1",
"typescript": "^5.3.3"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-default"
}
}
}
2 changes: 1 addition & 1 deletion e2e-tests/trailing-slash/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"gatsby-cypress": "next",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.8",
"start-server-and-test": "^2.0.3",
"start-server-and-test": "2.1.1",
"typescript": "^5.3.3"
}
}
2 changes: 1 addition & 1 deletion e2e-tests/visual-regression/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"gatsby-cypress": "next",
"is-ci": "^3.0.1",
"prettier": "^2.8.8",
"start-server-and-test": "^2.0.3",
"start-server-and-test": "2.1.1",
"typescript": "^5.3.3"
},
"repository": {
Expand Down
10 changes: 5 additions & 5 deletions packages/gatsby-graphiql-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@
"@babel/plugin-transform-runtime": "^7.19.6",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@graphiql/plugin-code-exporter": "^0.2.0",
"@graphiql/plugin-explorer": "^0.2.0",
"@graphiql/react": "^0.18.0",
"@graphiql/toolkit": "^0.8.4",
"@graphiql/plugin-code-exporter": "^3.1.5",
"@graphiql/plugin-explorer": "^3.2.6",
"@graphiql/react": "^0.29.0",
"@graphiql/toolkit": "^0.11.2",
"babel-loader": "^9.1.2",
"babel-preset-gatsby-package": "^3.16.0-next.0",
"core-js": "^3.31.0",
"cross-env": "^7.0.3",
"css-loader": "^6.8.1",
"del-cli": "^5.0.0",
"graphiql": "^3.0.0",
"graphiql": "^3.9.0",
"html-webpack-plugin": "^5.5.3",
"npm-run-all": "4.1.5",
"react": "^18.2.0",
Expand Down
33 changes: 16 additions & 17 deletions packages/gatsby-graphiql-explorer/src/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import * as React from "react"
import { createRoot } from "react-dom/client"
import { GraphiQL } from "graphiql"
import { getIntrospectionQuery } from "graphql"
import { useExplorerPlugin } from "@graphiql/plugin-explorer"
import { useExporterPlugin } from "@graphiql/plugin-code-exporter"
import { explorerPlugin } from "@graphiql/plugin-explorer"
import { codeExporterPlugin } from "@graphiql/plugin-code-exporter"

import { snippets } from "./code-exporter/snippets.js"
import { Logo } from "./logo.jsx"
Expand Down Expand Up @@ -72,6 +72,12 @@ function updateURL() {
history.replaceState(null, null, locationQuery(parameters))
}

const explorer = explorerPlugin()

const codeExporter = codeExporterPlugin({
snippets,
})

async function graphQLIntrospection() {
const res = await fetch(GRAPHIQL_URL, {
method: `POST`,
Expand Down Expand Up @@ -113,7 +119,8 @@ const App = ({ initialExternalFragments }) => {
switch (typeof enableRefresh) {
case `string`: {
const lowerCased = enableRefresh.toLowerCase()
enableRefresh = lowerCased === `1` || lowerCased === `true`
enableRefresh =
lowerCased === `1` || lowerCased === `true` || lowerCased === `y`
break
}
case `number`:
Expand All @@ -130,16 +137,6 @@ const App = ({ initialExternalFragments }) => {
fetchData()
}, [])

const explorerPlugin = useExplorerPlugin({
query,
onEdit: setQuery,
})

const exporterPlugin = useExporterPlugin({
query,
snippets,
})

const refreshExternalDataSource = () => {
const options = { method: `POST` }
if (refreshState.refreshToken) {
Expand Down Expand Up @@ -169,12 +166,14 @@ const App = ({ initialExternalFragments }) => {
onEditHeaders={onEditHeaders}
onTabChange={onTabChange}
toolbar={{
additionalContent: refreshState.enableRefresh && (
<RefreshDataSourceButton onClick={refreshExternalDataSource} />
),
additionalComponent:
refreshState.enableRefresh &&
(() => (
<RefreshDataSourceButton onClick={refreshExternalDataSource} />
)),
}}
externalFragments={externalFragments}
plugins={[explorerPlugin, exporterPlugin]}
plugins={[explorer, codeExporter]}
/>
)
}
Expand Down
7 changes: 7 additions & 0 deletions packages/gatsby-graphiql-explorer/src/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ module.exports = {
},
],
},
resolve: {
alias: {
"@graphiql/react": path.dirname(
require.resolve(`@graphiql/react/package.json`)
),
},
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, `index.html.ejs`),
Expand Down
Loading