Compare commits

...

4 Commits

Author SHA1 Message Date
Nicholas Dobie 9a41843d5f
Merge 4238f8f3df into 026e1deac3 2025-05-12 16:54:09 +00:00
Nicholas Dobie 4238f8f3df
fixed package.json 2025-05-12 11:54:05 -05:00
github-actions[bot] 026e1deac3
Version Packages (#1156)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-05-12 17:59:40 +09:00
Thomas Orlowski 7d3aa32e79
feat(graphql-server): upgrade GraphiQL (#1155) 2025-05-12 17:56:13 +09:00
4 changed files with 75 additions and 59 deletions

View File

@ -35,7 +35,7 @@
"repository": {
"type": "git",
"url": "git+https://github.com/honojs/middleware.git",
"directory": "packages/hello"
"directory": "packages/bun-compress"
},
"homepage": "https://github.com/honojs/middleware",
"peerDependencies": {

View File

@ -1,5 +1,11 @@
# @hono/graphql-server
## 0.6.0
### Minor Changes
- [#1155](https://github.com/honojs/middleware/pull/1155) [`7d3aa32e7987289a6585a0023ff63624ec4430cc`](https://github.com/honojs/middleware/commit/7d3aa32e7987289a6585a0023ff63624ec4430cc) Thanks [@ThomOrlo](https://github.com/ThomOrlo)! - feat: upgrade GraphiQL
## 0.5.1
### Patch Changes

View File

@ -1,6 +1,6 @@
{
"name": "@hono/graphql-server",
"version": "0.5.1",
"version": "0.6.0",
"repository": "git@github.com:honojs/middleware.git",
"author": "Minghe Huang <h.minghe@gmail.com>",
"type": "module",

View File

@ -233,7 +233,7 @@ export const errorMessages = (
}
export const respondWithGraphiQL = (c: Context) => {
// https://github.com/graphql/graphiql/blob/85edb9e0505db8ff963c9ad4674bc8fa2e02a35a/examples/graphiql-cdn/index.html
// https://github.com/graphql/graphiql/blob/03171d5614c61fb345763636d120da2b536d54a0/examples/graphiql-cdn/index.html
return c.html(`<!--
* Copyright (c) 2021 GraphQL Contributors
* All rights reserved.
@ -244,74 +244,84 @@ export const respondWithGraphiQL = (c: Context) => {
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GraphiQL</title>
<style>
body {
height: 100%;
margin: 0;
width: 100%;
overflow: hidden;
overflow: hidden; /* in Firefox */
}
#graphiql {
height: 100vh;
height: 100dvh;
}
.loading {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
font-size: 4rem;
}
</style>
<!--
This GraphiQL example depends on Promise and fetch, which are available in
modern browsers, but can be "polyfilled" for older browsers.
GraphiQL itself depends on React DOM.
If you do not want to rely on a CDN, you can host these files locally or
include them directly in your favored resource bundler.
-->
<script
crossorigin
src="https://unpkg.com/react@18/umd/react.development.js"
></script>
<script
crossorigin
src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"
></script>
<!--
These two files can be found in the npm module, however you may wish to
copy them directly into your environment, or perhaps include them in your
favored resource bundler.
-->
<script
src="https://unpkg.com/graphiql/graphiql.min.js"
type="application/javascript"
></script>
<link rel="stylesheet" href="https://unpkg.com/graphiql/graphiql.min.css" />
<!--
These are imports for the GraphIQL Explorer plugin.
-->
<script
src="https://unpkg.com/@graphiql/plugin-explorer/dist/index.umd.js"
crossorigin
></script>
<link
rel="stylesheet"
href="https://unpkg.com/@graphiql/plugin-explorer/dist/style.css"
href="https://esm.sh/graphiql@4.0.0/dist/style.css"
/>
</head>
<link
rel="stylesheet"
href="https://esm.sh/@graphiql/plugin-explorer@4.0.0/dist/style.css"
/>
<!-- Note: the ?standalone flag bundles the module along with all of its \`dependencies\`, excluding \`peerDependencies\`, into a single JavaScript file. -->
<script type="importmap">
{
"imports": {
"react": "https://esm.sh/react@19.1.0",
"react/jsx-runtime": "https://esm.sh/react@19.1.0/jsx-runtime",
<body>
<div id="graphiql">Loading...</div>
<script>
const root = ReactDOM.createRoot(document.getElementById('graphiql'));
const fetcher = GraphiQL.createFetcher({
"react-dom": "https://esm.sh/react-dom@19.1.0",
"react-dom/client": "https://esm.sh/react-dom@19.1.0/client",
"graphiql": "https://esm.sh/graphiql@4.0.0?standalone&external=react,react/jsx-runtime,react-dom,@graphiql/react",
"@graphiql/plugin-explorer": "https://esm.sh/@graphiql/plugin-explorer@4.0.0?standalone&external=react,react/jsx-runtime,react-dom,@graphiql/react,graphql",
"@graphiql/react": "https://esm.sh/@graphiql/react@0.30.0?standalone&external=react,react/jsx-runtime,react-dom,graphql,@graphiql/toolkit",
"@graphiql/toolkit": "https://esm.sh/@graphiql/toolkit@0.11.2?standalone&external=graphql",
"graphql": "https://esm.sh/graphql@16.11.0"
}
}
</script>
<script type="module">
// Import React and ReactDOM
import React from 'react';
import ReactDOM from 'react-dom/client';
// Import GraphiQL and the Explorer plugin
import { GraphiQL } from 'graphiql';
import { createGraphiQLFetcher } from '@graphiql/toolkit';
import { explorerPlugin } from '@graphiql/plugin-explorer';
const fetcher = createGraphiQLFetcher({
url: '${c.req.path}',
});
const explorerPlugin = GraphiQLPluginExplorer.explorerPlugin();
root.render(
React.createElement(GraphiQL, {
const explorer = explorerPlugin();
function App() {
return React.createElement(GraphiQL, {
fetcher,
defaultEditorToolsVisibility: true,
plugins: [explorerPlugin],
}),
);
plugins: [explorer],
});
}
const container = document.getElementById('graphiql');
const root = ReactDOM.createRoot(container);
root.render(React.createElement(App));
</script>
</head>
<body>
<div id="graphiql">
<div class="loading">Loading</div>
</div>
</body>
</html>
`)