Skip to content

Commit cb29e9f

Browse files
dimaMachinaTallTed
andauthored
[v3] migrate graphiql to vite and react compiler (#3826)
* aa * aa * aa * aa * aa * aa * aa * aa * aa * aa * aa * aa * aa * [skip ci] * fix * migrate `graphiql` from `jest` to `vitest` * add .js extension * add .js extension * upd * upd * upd * upd * upd * upd * upd * upd * upd * upd * add * upd * upd * upd * upd * upd * upd * upd * upd * clean up deps * clean up deps * clean up deps * clean up deps * clean up deps * upd * upd * more changes from graphiql v4 * more * fix path isn't exported * fix integration tests * fix e2e * bump * add changeset * remove unneeded beforeDevServer.js * found case which was not optimized * Delete .changeset/sour-onions-rhyme.md * Delete .changeset/silly-nails-double.md * polish graphiql tests setup * polish graphiql tests setup * should be good * prettier * upd * remove `vite-plugin-commonjs` * remove react compiler patch, and use 19.1.0-rc.1 version * remove react compiler patch, and use 19.1.0-rc.1 version * lock update * use requestAnimationFrame instead of setTimeout * use requestAnimationFrame instead of setTimeout * Update packages/graphiql-react/src/editor/hooks.ts Co-authored-by: Ted Thibodeau Jr <[email protected]> * upd * fix cypress failing test --------- Co-authored-by: Ted Thibodeau Jr <[email protected]>
1 parent 91e7df6 commit cb29e9f

Some content is hidden

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

61 files changed

+1077
-1836
lines changed

.changeset/dull-toys-cross.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@graphiql/react': minor
3+
'graphiql': minor
4+
---
5+
6+
- remove react compiler custom patch
7+
- update `react-compiler-runtime` to use `19.1.0-rc.1` version

.changeset/stupid-lamps-search.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'graphiql': minor
3+
---
4+
5+
migrate `graphiql` to `vite` and `react compiler`

.eslintrc.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module.exports = {
5757
'plugin:import-x/recommended',
5858
'plugin:import-x/typescript',
5959
'plugin:react/recommended',
60-
'plugin:react-hooks/recommended',
60+
'plugin:react-hooks/recommended-legacy',
6161
'plugin:react/jsx-runtime',
6262
'prettier',
6363
],
@@ -462,8 +462,7 @@ module.exports = {
462462
},
463463
},
464464
{
465-
files: ['packages/graphiql-react/**'],
466-
plugins: ['react-compiler'],
465+
files: ['packages/{graphiql-react,graphiql}/**'],
467466
rules: {
468467
'@typescript-eslint/no-restricted-imports': [
469468
'error',
@@ -473,7 +472,7 @@ module.exports = {
473472
importNames: ['memo', 'useCallback', 'useMemo'],
474473
},
475474
],
476-
'react-compiler/react-compiler': 'error',
475+
'react-hooks/react-compiler': 'error',
477476
},
478477
},
479478
{

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,10 @@ packages/codemirror-graphql/*.d.ts
4141
packages/codemirror-graphql/*.map
4242
!packages/codemirror-graphql/*.config.js
4343

44-
packages/graphiql/index.html
45-
packages/graphiql/dev.html
46-
packages/graphiql/analyzer.html
4744
packages/graphiql/graphiql*.js
4845
packages/graphiql/*.css
4946
packages/graphiql/*.map
5047
packages/graphiql/cypress/screenshots/
5148
packages/graphiql/typedoc/
52-
packages/graphiql/webpack/
49+
50+
packages/graphiql/cypress/downloads/

examples/monaco-graphql-webpack/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@
3030
"cross-env": "^7.0.2",
3131
"css-loader": "^6.7.3",
3232
"file-loader": "6.2.0",
33+
"fork-ts-checker-webpack-plugin": "7.3.0",
3334
"html-webpack-plugin": "^5.5.0",
3435
"monaco-editor-webpack-plugin": "^7.0.1",
3536
"style-loader": "^3.3.1",
3637
"typescript": "^4.6.3",
3738
"webpack": "5.76.0",
39+
"webpack-bundle-analyzer": "^3.6.1",
3840
"webpack-cli": "^5.0.1",
3941
"webpack-dev-server": "^4.11.1"
4042
}

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"scripts": {
3434
"build": "yarn build-clean && yarn tsc && yarn build:nontsc",
3535
"build-bundles": "yarn prebuild-bundles && yarn wsrun:noexamples --stages build-bundles",
36-
"build-bundles-clean": "rimraf '{packages,examples,plugins}/**/{bundle,cdn,webpack}' && yarn workspace graphiql build-bundles-clean",
36+
"build-bundles-clean": "rimraf '{packages,examples}/**/{bundle,cdn,webpack}'",
3737
"build-clean": "yarn tsc --clean",
3838
"build-docs": "rimraf packages/graphiql/typedoc && typedoc packages",
3939
"build:nontsc": "yarn wsrun:noexamples --exclude-missing --serial build",
@@ -46,8 +46,7 @@
4646
"check": "yarn tsc --noEmit",
4747
"cypress-open": "yarn workspace graphiql cypress-open",
4848
"dev-graphiql": "yarn workspace graphiql dev",
49-
"e2e": "yarn run e2e:build && yarn workspace graphiql e2e",
50-
"e2e:build": "WEBPACK_SERVE=1 yarn workspace graphiql build-bundles",
49+
"e2e": "yarn workspace graphiql e2e",
5150
"eslint": "NODE_OPTIONS=--max-old-space-size=4096 ESLINT_USE_FLAT_CONFIG=false eslint --max-warnings=0 --ignore-path .gitignore --cache .",
5251
"format": "yarn eslint --fix && yarn pretty",
5352
"jest": "jest",
@@ -78,7 +77,6 @@
7877
"gen-agenda": "wgutils agenda gen"
7978
},
8079
"dependencies": {
81-
"eslint-plugin-react-compiler": "19.0.0-beta-37ed2a7-20241206",
8280
"graphql-http": "^1.22.1",
8381
"@babel/cli": "^7.21.0",
8482
"@babel/core": "^7.21.0",
@@ -106,24 +104,26 @@
106104
"@typescript-eslint/eslint-plugin": "^7.17.0",
107105
"@typescript-eslint/parser": "^7.17.0",
108106
"babel-jest": "^29.4.3",
107+
"babel-plugin-macros": "^3.1.0",
109108
"babel-plugin-transform-import-meta": "^2.2.1",
110109
"concurrently": "^7.0.0",
111110
"copy": "^0.3.2",
112111
"cspell": "^5.15.2",
113112
"eslint": "9.14.0",
114113
"eslint-config-prettier": "^9.1.0",
115114
"eslint-import-resolver-typescript": "^3.6.1",
116-
"eslint-plugin-cypress": "^3.4.0",
115+
"eslint-plugin-cypress": "^4.1.0",
117116
"eslint-plugin-import-x": "^3.1.0",
118117
"eslint-plugin-jest": "^28.6.0",
119118
"eslint-plugin-mdx": "^3.1.5",
120119
"eslint-plugin-promise": "^7.0.0",
121120
"eslint-plugin-react": "^7.37.2",
122-
"eslint-plugin-react-hooks": "^5.1.0",
121+
"eslint-plugin-react-hooks": "^6.0.0-rc.1",
123122
"eslint-plugin-sonar": "^0.14.1",
124123
"eslint-plugin-sonarjs": "^1.0.4",
125124
"eslint-plugin-unicorn": "^55.0.0",
126125
"execa": "^7.1.1",
126+
"identity-obj-proxy": "^3.0.0",
127127
"fetch-mock": "6.5.2",
128128
"husky": "^4.2.3",
129129
"jest": "^27.5.1",

packages/graphiql-plugin-explorer/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@
312312

313313
### Patch Changes
314314

315-
- [#3124](https://github.com/graphql/graphiql/pull/3124) [`c645932c`](https://github.com/graphql/graphiql/commit/c645932c7973e11ad917e1d1d897fd409f8c042f) Thanks [@B2o5T](https://github.com/B2o5T)! - avoid unecessary renders by using useMemo or useCallback
315+
- [#3124](https://github.com/graphql/graphiql/pull/3124) [`c645932c`](https://github.com/graphql/graphiql/commit/c645932c7973e11ad917e1d1d897fd409f8c042f) Thanks [@B2o5T](https://github.com/B2o5T)! - avoid unnecessary renders by using useMemo or useCallback
316316

317317
- Updated dependencies [[`911cf3e0`](https://github.com/graphql/graphiql/commit/911cf3e0b0fa13268245463c8db8299279e5c461), [`c645932c`](https://github.com/graphql/graphiql/commit/c645932c7973e11ad917e1d1d897fd409f8c042f), [`2ca4841b`](https://github.com/graphql/graphiql/commit/2ca4841baf74e87a3f067b3415f8da3347ee3898), [`7bf90929`](https://github.com/graphql/graphiql/commit/7bf90929f62ba812c0946e0424f9f843f7b6b0ff), [`431b7fe1`](https://github.com/graphql/graphiql/commit/431b7fe1efefa4867f0ea617adc436b1117052e8)]:
318318
- @graphiql/react@0.17.6

packages/graphiql-react/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@
311311

312312
- [#3194](https://github.com/graphql/graphiql/pull/3194) [`911cf3e0`](https://github.com/graphql/graphiql/commit/911cf3e0b0fa13268245463c8db8299279e5c461) Thanks [@dwwoelfel](https://github.com/dwwoelfel)! - fix tab content getting replaced on `changeTab`
313313

314-
- [#3124](https://github.com/graphql/graphiql/pull/3124) [`c645932c`](https://github.com/graphql/graphiql/commit/c645932c7973e11ad917e1d1d897fd409f8c042f) Thanks [@B2o5T](https://github.com/B2o5T)! - avoid unecessary renders by using useMemo or useCallback
314+
- [#3124](https://github.com/graphql/graphiql/pull/3124) [`c645932c`](https://github.com/graphql/graphiql/commit/c645932c7973e11ad917e1d1d897fd409f8c042f) Thanks [@B2o5T](https://github.com/B2o5T)! - avoid unnecessary renders by using useMemo or useCallback
315315

316316
- [#3197](https://github.com/graphql/graphiql/pull/3197) [`2ca4841b`](https://github.com/graphql/graphiql/commit/2ca4841baf74e87a3f067b3415f8da3347ee3898) Thanks [@B2o5T](https://github.com/B2o5T)! - remove confusing ligatures, set `font-variant-ligatures: none`
317317

packages/graphiql-react/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"react-dom": "^16.8.0 || ^17 || ^18"
5050
},
5151
"dependencies": {
52-
"react-compiler-runtime": "19.0.0-beta-37ed2a7-20241206",
52+
"react-compiler-runtime": "19.1.0-rc.1",
5353
"@graphiql/toolkit": "^0.11.0",
5454
"@headlessui/react": "^1.7.15",
5555
"@radix-ui/react-dialog": "^1.0.4",
@@ -68,7 +68,7 @@
6868
"set-value": "^4.1.0"
6969
},
7070
"devDependencies": {
71-
"babel-plugin-react-compiler": "19.0.0-beta-37ed2a7-20241206",
71+
"babel-plugin-react-compiler": "19.1.0-rc.1",
7272
"@types/react-dom": "^18.3.1",
7373
"@babel/helper-string-parser": "^7.19.4",
7474
"@testing-library/dom": "^10.4.0",

packages/graphiql-react/src/editor/__tests__/common.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use no memo';
2-
31
import { importCodeMirror } from '../common';
42

53
describe('importCodeMirror', () => {

0 commit comments

Comments
 (0)