npm install --save babel-core babel-loader babel-polyfill babel-preset-es2015 babel-preset-stage-0
Adding this to entry point file
require("babel-core/register");
require("babel-polyfill");
and having a .babelrc with these presets: {
"presets": ["es2015", "stage-0"]
}
Then you can transpile with babel-cli
( sudo npm install -g babel-cli if you don't have it yet) babel app.js -o transpiled_app.js
Make sure you have npm version 3, or it become too slow to initialise.as @vdaniuk mention Chackra supports it, but did anyone tried this https://github.com/nodejs/node-chakracore?
Is there any other way to get async/await today ?
So you'll have to wait a long time and even so there is absolutely no guarantee async/away will ever make it to the spec. Same deal for decorators, developers shouldn't depend on non ECMA features. Even worse, the final proposal might be totally different from the current Babel/whatever implementation.
V8 doesn't even implement 100% of ES6, yet.
This article is also years old. While it seems to be updated recently I wonder how accurate it still is.
The last thing we want is native support for pre-standard features. As long as it's not in a spec (or draft at least), it's sci-fi.
Besides, node doesn't implement language features, V8 does. Here's the relevant issue: https://bugs.chromium.org/p/v8/issues/detail?id=4483
We'll have to wait for ES2017 at the earliest for async to arrive.
The `http` module is said to be outperformed by `eshttp` [1] by a factor of 2 times, which is written in pure JavaScript.
There is also `node-lwan` [2], an experiment in using `lwan` [3] in place of the built in `http` module. Since its the most performant web server in JSON serialization, according to techempower.com benchmarks [4], performance gains are to be expected.
[1] https://github.com/iefserge/eshttp [2] https://github.com/raadad/node-lwan [3] http://lwan.ws/ [4] https://www.techempower.com/benchmarks/#section=data-r12&hw=...
Does this mean that it can now open a real shell (like iTerm) and execute a script ? or I misunderstood ?
This addition when set to true, will do the wrapping for you in a cross-platform manor.
iTerm is not a shell. bash, zsh, fish, etc are shells. iTerm is a terminal program that opens a shell.
child_process.exec('open -a Terminal.app')
I'm pretty sure you can pass a script arg to the application too, but I haven't done it in a while.
I'm still mind blown every single day about the Node community—for me it's the fastest evolving dev ecosystem which is at the same time high performant and robust.