-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v3] migrate graphiql to vite and react compiler #3826
base: main
Are you sure you want to change the base?
Changes from all commits
f590ae4
810b0b2
8066724
4039e39
4b7e458
777eac5
3786aca
e1260f4
1c5c46f
16424ae
dae03ba
e1b3cc5
67a2250
2be769b
785c103
9a0a3cd
a862023
3f3472a
5fd2901
be801e4
398b087
a337e82
731082d
f69cd78
ce223e3
6f6f481
a04d46d
1be7078
adf7725
d6f62d4
3ecae05
8092f10
ab2fec8
63bb7b4
25129f5
d2fb423
1968198
d7e2434
57348be
b28be43
3546a58
cc537f6
4031182
1878a0b
7453fe4
63674ed
dfb7578
4993c1c
12cd0b6
1b91371
2f829f8
4a23084
6e95096
948fef0
8c34ceb
8410fed
d89dc49
346a936
460b51e
42f65cc
65778d2
d4d9062
107e0b6
8cc4fcf
e0949ac
ad75cda
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'graphiql': minor | ||
--- | ||
|
||
migrate `graphiql` to `vite` and `react compiler` |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// @ts-expect-error -- fixme | ||
export default (on, config) => { | ||
return config; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/resources/logo.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>GraphiQL</title> | ||
<style> | ||
body { | ||
margin: 0; | ||
overflow: hidden; /* in Firefox */ | ||
} | ||
|
||
#graphiql { | ||
height: 100dvh; | ||
} | ||
|
||
.loading { | ||
height: 100%; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
font-size: 4rem; | ||
} | ||
</style> | ||
<!--vite-replace-start--> | ||
<script | ||
crossorigin | ||
src="https://unpkg.com/react@18/umd/react.production.min.js" | ||
></script> | ||
<script | ||
crossorigin | ||
src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js" | ||
></script> | ||
<script src="/dist/index.umd.js"></script> | ||
<link href="/dist/style.css" rel="stylesheet" /> | ||
<!--vite-replace-end--> | ||
</head> | ||
<body> | ||
<div id="graphiql"> | ||
<div class="loading">Loading…</div> | ||
</div> | ||
<script type="module" src="resources/renderExample.js"></script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -17,37 +17,39 @@ | |||
}, | ||||
"license": "MIT", | ||||
"main": "dist/index.js", | ||||
"module": "esm/index.js", | ||||
"module": "dist/index.mjs", | ||||
"types": "dist/index.d.ts", | ||||
"files": [ | ||||
"dist", | ||||
"esm", | ||||
"src", | ||||
"graphiql.js", | ||||
"graphiql.min.js", | ||||
"graphiql.min.js.map", | ||||
"graphiql.css", | ||||
"graphiql.min.css", | ||||
"graphiql.min.css.map" | ||||
"graphiql.min.css" | ||||
], | ||||
"exports": { | ||||
"./package.json": "./package.json", | ||||
"./style.css": "./dist/style.css", | ||||
"./graphiql.css": "./dist/style.css", | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exports don't work with jsdelivr/unpkg unfortunately, we must publish to npm with these exact files There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is for backward compatibility since I added I added graphiql/packages/graphiql/package.json Line 48 in ad75cda
|
||||
".": { | ||||
"require": "./dist/index.js", | ||||
"import": "./dist/index.mjs", | ||||
"types": "./dist/index.d.ts" | ||||
} | ||||
}, | ||||
"scripts": { | ||||
"analyze-bundle": "cross-env NODE_ENV=production ANALYZE=1 yarn webpack -p", | ||||
"build": "yarn build-clean && yarn build-cjs && yarn build-esm", | ||||
"build-bundles": "yarn build-bundles-clean && yarn build-bundles-webpack", | ||||
"build-bundles-clean": "rimraf 'graphiql.*{js,css}' *.html", | ||||
"build-bundles-webpack": "cross-env yarn webpack --mode development --bail", | ||||
"build-cjs": "tsc", | ||||
"build-clean": "rimraf esm dist webpack *.html", | ||||
"build-esm": "tsc --project ./tsconfig.esm.json", | ||||
"check": "tsc --noEmit", | ||||
"cypress-open": "yarn e2e-server 'cypress open'", | ||||
"dev": "cross-env NODE_ENV=development webpack-dev-server --config resources/webpack.config.js", | ||||
"prebuild": "yarn types:check", | ||||
"types:check": "tsc --noEmit", | ||||
"build": "vite build && UMD=true vite build", | ||||
"cypress-open": "yarn dev 'cypress open'", | ||||
"dev": "concurrently 'cross-env PORT=8080 node test/e2e-server' vite", | ||||
"e2e": "yarn e2e-server 'cypress run'", | ||||
"e2e-server": "start-server-and-test 'cross-env PORT=8080 node test/e2e-server' 'http-get://localhost:8080/graphql?query={test { id }}'", | ||||
"webpack": "webpack-cli --config resources/webpack.config.js", | ||||
"prepublishOnly": "cp dist/index.umd.js graphiql.js && cp dist/index.umd.js.map graphiql.js.map && cp dist/index.umd.js graphiql.min.js && cp dist/index.umd.js.map graphiql.min.js.map && cp dist/style.css graphiql.css && cp dist/style.css graphiql.min.css", | ||||
"test": "vitest" | ||||
}, | ||||
"dependencies": { | ||||
"react-compiler-runtime": "19.0.0-beta-37ed2a7-20241206", | ||||
"@graphiql/react": "^0.28.0" | ||||
}, | ||||
"peerDependencies": { | ||||
|
@@ -56,42 +58,28 @@ | |||
"react-dom": "^16.8.0 || ^17 || ^18" | ||||
}, | ||||
"devDependencies": { | ||||
"babel-plugin-react-compiler": "19.0.0-beta-37ed2a7-20241206", | ||||
"vite-plugin-dts": "^4.3.0", | ||||
"vite-plugin-commonjs": "^0.10.4", | ||||
"vite": "^5.3.6", | ||||
"postcss-lightningcss": "^1.0.1", | ||||
"@vitejs/plugin-react": "^4.3.1", | ||||
"@graphiql/toolkit": "^0.11.0", | ||||
"@testing-library/jest-dom": "^6.6.3", | ||||
"@testing-library/react": "^16.1.0", | ||||
"babel-loader": "^9.1.2", | ||||
"babel-plugin-macros": "^3.1.0", | ||||
"cross-env": "^7.0.2", | ||||
"css-loader": "^6.7.3", | ||||
"cssnano": "^5.1.15", | ||||
"cypress": "^13.13.2", | ||||
"express": "^4.20.0", | ||||
"fork-ts-checker-webpack-plugin": "7.3.0", | ||||
"graphql": "^16.9.0", | ||||
"graphql-http": "^1.22.1", | ||||
"graphql-subscriptions": "^2.0.0", | ||||
"html-webpack-plugin": "^5.5.0", | ||||
"identity-obj-proxy": "^3.0.0", | ||||
"mini-css-extract-plugin": "^2.7.2", | ||||
"postcss": "8.4.31", | ||||
"postcss-import": "15.1.0", | ||||
"postcss-loader": "7.0.2", | ||||
"postcss-preset-env": "^8.0.1", | ||||
"react": "^18.2.0", | ||||
"react-dom": "^18.2.0", | ||||
"react-hot-loader": "^4.12.20", | ||||
"react-test-renderer": "^18.2.0", | ||||
"require-context.macro": "^1.2.2", | ||||
"rimraf": "^3.0.2", | ||||
"serve": "^11.3.0", | ||||
"start-server-and-test": "^1.10.11", | ||||
"style-loader": "^3.3.1", | ||||
"subscriptions-transport-ws": "0.11.0", | ||||
"typescript": "^4.6.3", | ||||
"webpack": "5.76.0", | ||||
"webpack-bundle-analyzer": "^3.6.1", | ||||
"webpack-cli": "^5.0.1", | ||||
"webpack-dev-server": "^4.11.1", | ||||
"ws": "8.17.1" | ||||
} | ||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
module.exports = | ||
process.env.NODE_ENV === 'test' | ||
? {} | ||
: ({ options, webpackLoaderContext }) => ({ | ||
plugins: { | ||
// https://github.com/postcss/postcss-import/issues/442#issuecomment-822427606 | ||
'postcss-import': { root: webpackLoaderContext.context }, | ||
// contains autoprefixer, etc | ||
'postcss-preset-env': options['postcss-preset-env'] || false, | ||
cssnano: | ||
process.env.NODE_ENV === 'production' ? options.cssnano : false, | ||
}, | ||
}); | ||
module.exports = { | ||
plugins: { | ||
// https://github.com/postcss/postcss-import/issues/442#issuecomment-822427606 | ||
'postcss-import': '', | ||
'postcss-lightningcss': { | ||
browsers: '>= .25%', | ||
}, | ||
}, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be graphiql.js or else it will break all the unpkg implementations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean by
it will break all the unpkg implementations
?/dist/index.umd.js === /graphql.js
/dist/index.umd.js === /graphql.min.js