Skip to content

Commit e7c436b

Browse files
authored
extract history plugin from @graphiql/react and publish as @graphiql/plugin-history package (#3911)
* initial commit * initial commit * update react vite example * vite and vitest * tsconfig pkg * rm history from react * upd graphiql * upd graphiql * upd graphiql react * upd graphiql react * upd history * upd history * upd history * upd * upd * upd * upd * upd * upd * upd * upd * upd * fix unit tests * upd * fix e2e * upd * prettier * fix react-compiler error * polish * Apply suggestions from code review * Update .changeset/grumpy-knives-smile.md * upd * fix unit * ok e2e tests were fixed * initial tab values should have the same behavior as new tab
1 parent 03171d5 commit e7c436b

File tree

49 files changed

+484
-347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+484
-347
lines changed

.changeset/grumpy-knives-smile.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
'@graphiql/plugin-history': patch
3+
'@graphiql/react': minor
4+
'graphiql': patch
5+
---
6+
7+
- export `cn` from `@graphiql/react`
8+
9+
- remove following exports from `@graphiql/react` and move them in `@graphiql/plugin-history` package:
10+
- `History`
11+
- `HistoryContext`
12+
- `HistoryContextType`
13+
- `HistoryContextProvider`
14+
- `useHistoryContext`
15+
- `HISTORY_PLUGIN`
16+
17+
- remove types from `@graphiql/react` (use `ComponentProps<typeof MyContextProviderProps>` instead):
18+
- `HistoryContextProviderProps`
19+
- `ExecutionContextProviderProps`
20+
- `EditorContextProviderProps`
21+
- `ExplorerContextProviderProps`
22+
- `PluginContextProviderProps`
23+
- `SchemaContextProviderProps`
24+
- `StorageContextProviderProps`
25+
- `GraphiQLProviderProps`

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ This repository is managed by EasyCLA. Project participants must sign the free
190190
[GraphQL Specification Membership agreement](https://preview-spec-membership.graphql.org)
191191
before making a contribution. You only need to do this one time, and it can be
192192
signed by
193-
[individual contributors](http://individual-spec-membership.graphql.org/) or
194-
their [employers](http://corporate-spec-membership.graphql.org/).
193+
[individual contributors](http://individual-spec-membership.graphql.org) or
194+
their [employers](http://corporate-spec-membership.graphql.org).
195195

196196
To initiate the signature process please open a PR against this repo. The
197197
EasyCLA bot will block the merge if we still need a membership agreement from

examples/monaco-graphql-react-vite/index.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,21 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<link rel="stylesheet" href="/src/style.css" />
77
<title>Monaco React Vite Example</title>
8+
<style>
9+
.loading {
10+
height: 100%;
11+
display: flex;
12+
align-items: center;
13+
justify-content: center;
14+
font-size: 4rem;
15+
width: 100%;
16+
}
17+
</style>
818
</head>
919
<body>
10-
<div id="__next">Loading...</div>
20+
<div id="__next">
21+
<div class="loading">Loading…</div>
22+
</div>
1123
<script type="module" src="/src/index.tsx"></script>
1224
</body>
1325
</html>

examples/monaco-graphql-react-vite/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
"version": "0.0.0",
55
"dependencies": {
66
"@graphiql/toolkit": "^0.11.2",
7-
"graphql": "^16.9.0",
7+
"graphql": "^16.11.0",
88
"graphql-language-service": "^5.3.1",
99
"jsonc-parser": "^3.2.0",
10-
"monaco-editor": "^0.39.0",
10+
"monaco-editor": "^0.52.2",
1111
"monaco-graphql": "^1.6.1",
1212
"prettier": "3.3.2",
1313
"react": "^19.1.0",
1414
"react-dom": "^19.1.0"
1515
},
1616
"devDependencies": {
1717
"@vitejs/plugin-react": "^4.4.1",
18-
"vite": "^5.4.18",
18+
"vite": "^6.3.4",
1919
"vite-plugin-monaco-editor": "^1.1.0"
2020
},
2121
"scripts": {

examples/monaco-graphql-react-vite/vite.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ function watchPackages(packageNames: string[]) {
2828

2929
return {
3030
name: 'vite-plugin-watch-packages',
31-
3231
buildStart() {
3332
if (!isWatching) {
3433
for (const packageName of packageNames) {

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145
"vscode-languageserver-types": "3.17.3",
146146
"markdown-it": "14.1.0",
147147
"react": "18.3.1",
148-
"react-dom": "18.3.1"
148+
"react-dom": "18.3.1",
149+
"vite": "6.3.4"
149150
}
150151
}

packages/codemirror-graphql/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,5 @@ CodeMirror.fromTextArea(myTextarea, {
121121
});
122122
```
123123

124-
Build for the web with [webpack](http://webpack.github.io/) or
125-
[browserify](http://browserify.org/).
124+
Build for the web with [webpack](http://webpack.github.io) or
125+
[browserify](http://browserify.org).

packages/codemirror-graphql/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"description": "GraphQL mode and helpers for CodeMirror.",
55
"contributors": [
66
"Hyohyeon Jeong <[email protected]>",
7-
"Lee Byron <[email protected]> (http://leebyron.com/)",
7+
"Lee Byron <[email protected]> (https://leebyron.com)",
88
"Angel Gomez Salazar <[email protected]>"
99
],
1010
"homepage": "https://github.com/graphql/graphiql/tree/main/packages/codemirror-graphql#readme",
1111
"repository": {
1212
"type": "git",
13-
"url": "http://github.com/graphql/graphiql",
13+
"url": "https://github.com/graphql/graphiql",
1414
"directory": "packages/codemirror-graphql"
1515
},
1616
"bugs": {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# `@graphiql/plugin-history`
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"name": "@graphiql/plugin-history",
3+
"version": "0.0.0",
4+
"sideEffects": false,
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/graphql/graphiql",
8+
"directory": "packages/graphiql-plugin-history"
9+
},
10+
"homepage": "https://github.com/graphql/graphiql/tree/master/packages/graphiql-plugin-history#readme",
11+
"bugs": {
12+
"url": "https://github.com/graphql/graphiql/issues?q=issue+label:@graphiql/plugin-history"
13+
},
14+
"license": "MIT",
15+
"exports": {
16+
"./package.json": "./package.json",
17+
"./style.css": "./dist/style.css",
18+
".": "./dist/index.js"
19+
},
20+
"types": "dist/index.d.ts",
21+
"keywords": [
22+
"react",
23+
"graphql",
24+
"graphiql",
25+
"plugin",
26+
"history"
27+
],
28+
"files": [
29+
"dist"
30+
],
31+
"scripts": {
32+
"dev": "vite build --watch",
33+
"build": "vite build",
34+
"test": "vitest",
35+
"types:check": "tsc --noEmit"
36+
},
37+
"peerDependencies": {
38+
"react": "^18 || ^19",
39+
"react-dom": "^18 || ^19"
40+
},
41+
"dependencies": {
42+
"react-compiler-runtime": "19.1.0-rc.1",
43+
"@graphiql/toolkit": "^0.11.2",
44+
"@graphiql/react": "^0.30.0"
45+
},
46+
"devDependencies": {
47+
"@testing-library/react": "^16.1.0",
48+
"@vitejs/plugin-react": "^4.4.1",
49+
"vite-plugin-dts": "^4.5.3",
50+
"babel-plugin-react-compiler": "19.1.0-rc.1",
51+
"react": "^19.1.0",
52+
"react-dom": "^19.1.0",
53+
"vite": "^6.3.4"
54+
}
55+
}

0 commit comments

Comments
 (0)