Skip to content

Commit

Permalink
Removes depencency on babel-runtime.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
leebyron committed Jul 6, 2016
1 parent c7700f2 commit 188881b
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 16 deletions.
20 changes: 16 additions & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
{
"presets": [
"es2015"
],
"plugins": [
"syntax-async-functions",
"transform-class-properties",
"transform-flow-strip-types",
"transform-object-rest-spread",
"transform-es2015-template-literals",
"transform-es2015-literals",
"transform-es2015-function-name",
"transform-es2015-arrow-functions",
"transform-es2015-block-scoped-functions",
["transform-es2015-classes", {loose: true}],
"transform-es2015-object-super",
"transform-es2015-shorthand-properties",
"transform-es2015-duplicate-keys",
"transform-es2015-computed-properties",
"check-es2015-constants",
["transform-es2015-spread", {loose: true}],
"transform-es2015-parameters",
["transform-es2015-destructuring", {loose: true}],
"transform-es2015-block-scoping",
"transform-es2015-modules-commonjs",
"transform-regenerator",
"transform-runtime"
]
}
29 changes: 20 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,36 @@
"preversion": ". ./resources/checkgit.sh && npm test",
"prepublish": ". ./resources/prepublish.sh"
},
"dependencies": {
"babel-runtime": ">=6.0.0"
},
"devDependencies": {
"babel-cli": "6.9.0",
"babel-eslint": "6.0.4",
"babel-cli": "6.10.1",
"babel-eslint": "6.1.0",
"babel-plugin-check-es2015-constants": "6.8.0",
"babel-plugin-syntax-async-functions": "6.8.0",
"babel-plugin-transform-class-properties": "6.9.1",
"babel-plugin-transform-class-properties": "6.10.2",
"babel-plugin-transform-es2015-arrow-functions": "6.8.0",
"babel-plugin-transform-es2015-block-scoped-functions": "6.8.0",
"babel-plugin-transform-es2015-block-scoping": "6.10.1",
"babel-plugin-transform-es2015-classes": "6.9.0",
"babel-plugin-transform-es2015-computed-properties": "6.8.0",
"babel-plugin-transform-es2015-destructuring": "6.9.0",
"babel-plugin-transform-es2015-duplicate-keys": "6.8.0",
"babel-plugin-transform-es2015-function-name": "6.9.0",
"babel-plugin-transform-es2015-literals": "6.8.0",
"babel-plugin-transform-es2015-modules-commonjs": "6.10.3",
"babel-plugin-transform-es2015-object-super": "6.8.0",
"babel-plugin-transform-es2015-parameters": "6.9.0",
"babel-plugin-transform-es2015-shorthand-properties": "6.8.0",
"babel-plugin-transform-es2015-spread": "6.8.0",
"babel-plugin-transform-es2015-template-literals": "6.8.0",
"babel-plugin-transform-flow-strip-types": "6.8.0",
"babel-plugin-transform-object-rest-spread": "6.8.0",
"babel-plugin-transform-regenerator": "6.9.0",
"babel-plugin-transform-runtime": "6.9.0",
"babel-preset-es2015": "6.6.0",
"chai": "3.5.0",
"chai-subset": "1.2.2",
"coveralls": "2.11.9",
"eslint": "2.11.1",
"eslint-plugin-babel": "3.2.0",
"eslint-plugin-flow-vars": "^0.4.0",
"eslint-plugin-flow-vars": "0.4.0",
"eslint-plugin-flowtype": "2.2.7",
"flow-bin": "0.28.0",
"isparta": "4.0.0",
Expand Down
5 changes: 4 additions & 1 deletion resources/prepublish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@ babel src --ignore __tests__ --out-dir ./
# Ensure a vanilla package.json before deploying so other tools do not interpret
# The built output as requiring any further transformation.
node -e "var package = require('./package.json'); \
delete package.babel; delete package.scripts; delete package.options; \
delete package.babel; \
delete package.scripts; \
delete package.options; \
delete package.devDependencies; \
require('fs').writeFileSync('package.json', JSON.stringify(package));"
4 changes: 2 additions & 2 deletions src/language/visitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ export function visit(root, visitor, keyMap) {
}
let editOffset = 0;
for (let ii = 0; ii < edits.length; ii++) {
let [ editKey ] = edits[ii];
const [ , editValue ] = edits[ii];
let editKey = edits[ii][0];
const editValue = edits[ii][1];
if (inArray) {
editKey -= editOffset;
}
Expand Down

0 comments on commit 188881b

Please sign in to comment.