Skip to content

Commit 2fcd9e8

Browse files
authored
chore: drop IE support, remove regenerator runtime (#1628)
use es6 as default typescript target use browserslist always remove all usage of regenerator runtime
1 parent 21af822 commit 2fcd9e8

File tree

17 files changed

+44
-91
lines changed

17 files changed

+44
-91
lines changed

.browserslistrc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
ie 11
2-
ios 10
3-
last 2 chrome versions
4-
last 2 edge versions
5-
last 2 firefox versions
1+
last 2 versions
2+
Firefox ESR
3+
not dead
4+
not IE 11
5+
not ios 10
6+
maintained node versions

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,29 @@ An online immutable parser for [GraphQL](http://graphql.org/), designed to be us
128128

129129
Utilities to support the [GraphQL Language Service](packages/graphql-language-service#readme).
130130

131+
## Browser & Runtime Support
132+
133+
Many of these packages need to work in multiple environments.
134+
135+
By default, all typescript packages target `es6`.
136+
137+
`graphql-language-service-server` and `graphql-language-service-cli` are made for the node runtime, so they target `es2017`
138+
139+
`codemirror-graphql` and the `graphiql` browser bundle use the [`.browserslistrc`](./.browserlistrc), which targets modern browsers to keep bundle size small and keep the language services performant where async/await is used, and especially to avoid the requirement of `rengenerator-runtime` or special babel configuration.
140+
141+
### [`.browserslistrc`](./.browserlistrc):
142+
143+
```
144+
last 2 versions
145+
Firefox ESR
146+
not dead
147+
not IE 11
148+
not ios 10
149+
maintained node versions
150+
```
151+
152+
To be clear, we do _not_ support Internet Explorer or older versions of evergreen browsers.
153+
131154
## Development
132155

133156
To get setup for local development of this monorepo, refer to [DEVELOPMENT.md](./DEVELOPMENT.md)

babel.config.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
// for ESM don't transpile modules
22

33
const envConfig = {
4-
ignoreBrowserslistConfig: true,
54
modules: 'commonjs',
6-
targets: { node: true },
7-
bugfixes: true,
85
};
96

107
if (process.env.ESM) {
118
envConfig.modules = false;
9+
envConfig.targets = { node: true };
10+
envConfig.bugfixes = true;
1211
}
1312

1413
if (process.env.CDN) {
15-
envConfig.modules = 'amd';
14+
envConfig.modules = 'umd';
1615
envConfig.targets = null;
17-
envConfig.ignoreBrowserslistConfig = false;
1816
}
1917

2018
module.exports = {
@@ -32,8 +30,5 @@ module.exports = {
3230
compact: false,
3331
},
3432
},
35-
plugins: [
36-
require.resolve('@babel/plugin-proposal-class-properties'),
37-
require.resolve('@babel/plugin-syntax-dynamic-import'),
38-
],
33+
plugins: [require.resolve('@babel/plugin-proposal-class-properties')],
3934
};

examples/graphiql-webpack/babel.config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,5 @@ module.exports = {
1010
],
1111
require.resolve('@babel/preset-react'),
1212
],
13-
plugins: [
14-
require.resolve('@babel/plugin-syntax-dynamic-import'),
15-
require.resolve('@babel/plugin-proposal-class-properties'),
16-
],
13+
plugins: [require.resolve('@babel/plugin-proposal-class-properties')],
1714
};

examples/monaco-graphql-webpack/babel.config.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,11 @@ module.exports = {
44
[
55
require.resolve('@babel/preset-env'),
66
{
7-
// corejs: { version: 3, proposals: true },
8-
// useBuiltIns: 'usage',
97
targets: { browsers: ['last 2 chrome versions'] },
108
bugfixes: true,
119
},
1210
],
1311
[require.resolve('@babel/preset-typescript'), {}],
1412
],
15-
plugins: [
16-
require.resolve('@babel/plugin-syntax-dynamic-import'),
17-
require.resolve('@babel/plugin-proposal-class-properties'),
18-
[
19-
'@babel/plugin-transform-runtime',
20-
{
21-
regenerator: true,
22-
},
23-
],
24-
],
13+
plugins: [require.resolve('@babel/plugin-proposal-class-properties')],
2514
};

examples/monaco-graphql-webpack/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
/* global monaco */
22

3-
import 'regenerator-runtime/runtime';
4-
53
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
64

75
import { api as GraphQLAPI } from 'monaco-graphql';

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@
6565
"@babel/core": "^7.9.0",
6666
"@babel/node": "^7.8.7",
6767
"@babel/plugin-proposal-class-properties": "^7.8.3",
68-
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
69-
"@babel/plugin-transform-runtime": "^7.9.0",
7068
"@babel/polyfill": "^7.8.7",
7169
"@babel/preset-env": "7.9.5",
7270
"@babel/preset-flow": "7.9.0",

packages/graphiql/index.html

Lines changed: 0 additions & 40 deletions
This file was deleted.

packages/graphiql/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
"build": "yarn build-clean && yarn build-cjs && yarn build-esm",
2929
"build-cjs": "tsc",
3030
"build-esm": "tsc --project ./tsconfig.esm.json",
31-
"build-clean": "rimraf webpack *.html bundle",
31+
"build-clean": "rimraf webpack bundle monaco",
3232
"build-bundles": "yarn build-bundles-clean && yarn build-bundles-dev && yarn build-bundles-min",
3333
"build-bundles-dev": "cross-env NODE_ENV=development CDN=1 yarn webpack -d --bail && copy 'resources/renderExample.js' bundle/dev/",
3434
"build-bundles-min": "cross-env ANALYZE=1 NODE_ENV=production CDN=1 yarn webpack -p --bail && copy 'resources/renderExample.js' bundle/dist/",
35-
"build-bundles-clean": "rimraf 'graphiql.*{js,css}' *.html",
35+
"build-bundles-clean": "rimraf 'graphiql.*{js,css}'",
3636
"build-demo": "build-storybook -o ./storybook",
3737
"dev": "cross-env NODE_ENV=development webpack-dev-server --config resources/webpack.config.js",
3838
"cypress-open": "yarn e2e-server 'cypress open'",
@@ -53,7 +53,6 @@
5353
"i18next-browser-languagedetector": "^4.1.1",
5454
"monaco-editor": "^0.20.0",
5555
"react-i18next": "^11.4.0",
56-
"regenerator-runtime": "^0.13.5",
5756
"theme-ui": "^0.3.1",
5857
"@theme-ui/core": "^0.4.0-alpha.1"
5958
},

packages/graphiql/resources/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const resultConfig = {
2424
output: {
2525
path: isDev ? rootPath('bundle/dev') : rootPath('bundle/dist'),
2626
// library: 'GraphiQL',
27-
libraryTarget: 'umd',
27+
libraryTarget: 'window',
2828
// libraryExport: 'default',
2929
filename: '[name].js',
3030
globalObject: 'this',

0 commit comments

Comments
 (0)