Skip to content

Commit 188881b

Browse files
committed
Removes depencency on babel-runtime.
Simplifies babel transform using "loose" options and removing some transforms. This results in a subset of ES2015 environment, but this source has been pretty careful to avoid the more novel features in order to support more environments. The result for those using graphql via npm is fewer dependencies and less reliance on a modern JS environment, both good things when wanting to use graphql as a depencency in a client-side tool, like Apollo or Relay. Fixes #414
1 parent c7700f2 commit 188881b

File tree

4 files changed

+42
-16
lines changed

4 files changed

+42
-16
lines changed

.babelrc

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
{
2-
"presets": [
3-
"es2015"
4-
],
52
"plugins": [
63
"syntax-async-functions",
74
"transform-class-properties",
85
"transform-flow-strip-types",
96
"transform-object-rest-spread",
7+
"transform-es2015-template-literals",
8+
"transform-es2015-literals",
9+
"transform-es2015-function-name",
10+
"transform-es2015-arrow-functions",
11+
"transform-es2015-block-scoped-functions",
12+
["transform-es2015-classes", {loose: true}],
13+
"transform-es2015-object-super",
14+
"transform-es2015-shorthand-properties",
15+
"transform-es2015-duplicate-keys",
16+
"transform-es2015-computed-properties",
17+
"check-es2015-constants",
18+
["transform-es2015-spread", {loose: true}],
19+
"transform-es2015-parameters",
20+
["transform-es2015-destructuring", {loose: true}],
21+
"transform-es2015-block-scoping",
22+
"transform-es2015-modules-commonjs",
1023
"transform-regenerator",
11-
"transform-runtime"
1224
]
1325
}

package.json

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,36 @@
3434
"preversion": ". ./resources/checkgit.sh && npm test",
3535
"prepublish": ". ./resources/prepublish.sh"
3636
},
37-
"dependencies": {
38-
"babel-runtime": ">=6.0.0"
39-
},
4037
"devDependencies": {
41-
"babel-cli": "6.9.0",
42-
"babel-eslint": "6.0.4",
38+
"babel-cli": "6.10.1",
39+
"babel-eslint": "6.1.0",
40+
"babel-plugin-check-es2015-constants": "6.8.0",
4341
"babel-plugin-syntax-async-functions": "6.8.0",
44-
"babel-plugin-transform-class-properties": "6.9.1",
42+
"babel-plugin-transform-class-properties": "6.10.2",
43+
"babel-plugin-transform-es2015-arrow-functions": "6.8.0",
44+
"babel-plugin-transform-es2015-block-scoped-functions": "6.8.0",
45+
"babel-plugin-transform-es2015-block-scoping": "6.10.1",
46+
"babel-plugin-transform-es2015-classes": "6.9.0",
47+
"babel-plugin-transform-es2015-computed-properties": "6.8.0",
48+
"babel-plugin-transform-es2015-destructuring": "6.9.0",
49+
"babel-plugin-transform-es2015-duplicate-keys": "6.8.0",
50+
"babel-plugin-transform-es2015-function-name": "6.9.0",
51+
"babel-plugin-transform-es2015-literals": "6.8.0",
52+
"babel-plugin-transform-es2015-modules-commonjs": "6.10.3",
53+
"babel-plugin-transform-es2015-object-super": "6.8.0",
54+
"babel-plugin-transform-es2015-parameters": "6.9.0",
55+
"babel-plugin-transform-es2015-shorthand-properties": "6.8.0",
56+
"babel-plugin-transform-es2015-spread": "6.8.0",
57+
"babel-plugin-transform-es2015-template-literals": "6.8.0",
4558
"babel-plugin-transform-flow-strip-types": "6.8.0",
4659
"babel-plugin-transform-object-rest-spread": "6.8.0",
4760
"babel-plugin-transform-regenerator": "6.9.0",
48-
"babel-plugin-transform-runtime": "6.9.0",
49-
"babel-preset-es2015": "6.6.0",
5061
"chai": "3.5.0",
5162
"chai-subset": "1.2.2",
5263
"coveralls": "2.11.9",
5364
"eslint": "2.11.1",
5465
"eslint-plugin-babel": "3.2.0",
55-
"eslint-plugin-flow-vars": "^0.4.0",
66+
"eslint-plugin-flow-vars": "0.4.0",
5667
"eslint-plugin-flowtype": "2.2.7",
5768
"flow-bin": "0.28.0",
5869
"isparta": "4.0.0",

resources/prepublish.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@ babel src --ignore __tests__ --out-dir ./
2626
# Ensure a vanilla package.json before deploying so other tools do not interpret
2727
# The built output as requiring any further transformation.
2828
node -e "var package = require('./package.json'); \
29-
delete package.babel; delete package.scripts; delete package.options; \
29+
delete package.babel; \
30+
delete package.scripts; \
31+
delete package.options; \
32+
delete package.devDependencies; \
3033
require('fs').writeFileSync('package.json', JSON.stringify(package));"

src/language/visitor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ export function visit(root, visitor, keyMap) {
181181
}
182182
let editOffset = 0;
183183
for (let ii = 0; ii < edits.length; ii++) {
184-
let [ editKey ] = edits[ii];
185-
const [ , editValue ] = edits[ii];
184+
let editKey = edits[ii][0];
185+
const editValue = edits[ii][1];
186186
if (inArray) {
187187
editKey -= editOffset;
188188
}

0 commit comments

Comments
 (0)