Async/await and new function bind syntax support

This commit is contained in:
SleepWalker 2017-01-14 21:38:38 +02:00
parent bdbc34b163
commit ca7c0ed94c
5 changed files with 59 additions and 5 deletions

View File

@ -1,7 +1,8 @@
{ {
"presets": ["react", "es2015", "stage-0"], "presets": ["react", "es2015", "es2017", "stage-0"],
"plugins": [ "plugins": [
["transform-runtime", {"polyfill": false}], ["transform-runtime", {"polyfill": false}],
"transform-function-bind",
["react-intl", {"messagesDir": "./dist/messages/"}] ["react-intl", {"messagesDir": "./dist/messages/"}]
], ],
"env": { "env": {

42
npm-shrinkwrap.json generated
View File

@ -461,6 +461,26 @@
} }
} }
}, },
"babel-cli": {
"version": "6.18.0",
"from": "babel-cli@latest",
"resolved": "https://registry.npmjs.org/babel-cli/-/babel-cli-6.18.0.tgz",
"dev": true,
"dependencies": {
"fs-readdir-recursive": {
"version": "1.0.0",
"from": "fs-readdir-recursive@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.0.0.tgz",
"dev": true
},
"glob": {
"version": "5.0.15",
"from": "glob@>=5.0.5 <6.0.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz",
"dev": true
}
}
},
"babel-code-frame": { "babel-code-frame": {
"version": "6.16.0", "version": "6.16.0",
"from": "babel-code-frame@>=6.16.0 <7.0.0", "from": "babel-code-frame@>=6.16.0 <7.0.0",
@ -889,7 +909,7 @@
}, },
"babel-plugin-transform-function-bind": { "babel-plugin-transform-function-bind": {
"version": "6.8.0", "version": "6.8.0",
"from": "babel-plugin-transform-function-bind@>=6.3.13 <7.0.0", "from": "https://registry.npmjs.org/babel-plugin-transform-function-bind/-/babel-plugin-transform-function-bind-6.8.0.tgz",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-function-bind/-/babel-plugin-transform-function-bind-6.8.0.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-transform-function-bind/-/babel-plugin-transform-function-bind-6.8.0.tgz",
"dev": true "dev": true
}, },
@ -970,6 +990,12 @@
"resolved": "https://registry.npmjs.org/babel-preset-es2015-without-strict/-/babel-preset-es2015-without-strict-0.0.4.tgz", "resolved": "https://registry.npmjs.org/babel-preset-es2015-without-strict/-/babel-preset-es2015-without-strict-0.0.4.tgz",
"dev": true "dev": true
}, },
"babel-preset-es2017": {
"version": "6.16.0",
"from": "babel-preset-es2017@latest",
"resolved": "https://registry.npmjs.org/babel-preset-es2017/-/babel-preset-es2017-6.16.0.tgz",
"dev": true
},
"babel-preset-react": { "babel-preset-react": {
"version": "6.16.0", "version": "6.16.0",
"from": "babel-preset-react@>=6.3.13 <7.0.0", "from": "babel-preset-react@>=6.3.13 <7.0.0",
@ -6672,6 +6698,20 @@
"resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz",
"dev": true "dev": true
}, },
"v8flags": {
"version": "2.0.11",
"from": "v8flags@>=2.0.10 <3.0.0",
"resolved": "https://registry.npmjs.org/v8flags/-/v8flags-2.0.11.tgz",
"dev": true,
"dependencies": {
"user-home": {
"version": "1.1.1",
"from": "user-home@>=1.1.1 <2.0.0",
"resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz",
"dev": true
}
}
},
"validate-npm-package-license": { "validate-npm-package-license": {
"version": "3.0.1", "version": "3.0.1",
"from": "validate-npm-package-license@>=3.0.1 <4.0.0", "from": "validate-npm-package-license@>=3.0.1 <4.0.0",

View File

@ -45,13 +45,16 @@
"whatwg-fetch": "^2.0.0" "whatwg-fetch": "^2.0.0"
}, },
"devDependencies": { "devDependencies": {
"babel-cli": "^6.18.0",
"babel-core": "^6.0.0", "babel-core": "^6.0.0",
"babel-eslint": "^7.0.0", "babel-eslint": "^7.0.0",
"babel-loader": "^6.0.0", "babel-loader": "^6.0.0",
"babel-plugin-react-intl": "^2.0.0", "babel-plugin-react-intl": "^2.0.0",
"babel-plugin-transform-function-bind": "https://registry.npmjs.org/babel-plugin-transform-function-bind/-/babel-plugin-transform-function-bind-6.8.0.tgz",
"babel-plugin-transform-runtime": "^6.3.13", "babel-plugin-transform-runtime": "^6.3.13",
"babel-preset-airbnb": "^2.0.0", "babel-preset-airbnb": "^2.0.0",
"babel-preset-es2015": "^6.3.13", "babel-preset-es2015": "^6.3.13",
"babel-preset-es2017": "^6.16.0",
"babel-preset-react": "^6.3.13", "babel-preset-react": "^6.3.13",
"babel-preset-react-hmre": "^1.0.1", "babel-preset-react-hmre": "^1.0.1",
"babel-preset-stage-0": "^6.3.13", "babel-preset-stage-0": "^6.3.13",

View File

@ -1,3 +0,0 @@
{
"breakConfig": true
}

View File

@ -0,0 +1,13 @@
const test = async () => {
};
const obj = {a: 1, b: 1};
const {a, b} = obj;
console.log(a, b, 'ok');
// how to:
// cd to frontend
// > ./node_modules/.bin/babel-node --presets es2015,es2017,stage-0 ./scripts/test-async-await.js