Node.js v6.0 Released
nodejs.org
nodejs.org
{
"compilerOptions": {
"target": "es2015",
"module": "commonjs"
}
}
Assuming you're not using that 7% (http://node.green/) :)Just make sure to update your package.json to take a hard dependency on Node 6+ if you do that:
{ "engines" : { "node" : ">=6.0.0" } }
This will make it so that ES6-compat is assumed and TS won't transpile ES6 functionality, but it will use commonjs for modules, which means your TS will almost be a 1:1 mapping with the compiled JS and everything should just work. semver.satisfies('7.0.0-rc1', '>=6.0.0')
falseI guess the argument is that, if you're going to use ">=6.0.0" to choose a version of node.js, and your options are 6.1.0 and 7.0.0-rc1, you don't want a random release candidate. But if you're going to use it to verify an existing version of node.js, a 7.0.0-rc1 that someone else chose should be considered acceptable. Their semver rules can't distinguish these two cases.
PEP 440 seems to handle this by decoupling the prerelease rules and the version-comparison rules: https://www.python.org/dev/peps/pep-0440/#handling-of-pre-re... "Pre-releases of any kind, including developmental releases, are implicitly excluded from all version specifiers, unless they are already present on the system, explicitly requested by the user, or if the only available version that satisfies the version specifier is a pre-release."
It is so PHPsque.
No sane people should use it for anything serious, except some lightweight browser scripting.
I cannot grok how can people chose this stack to create any product in it.
Personally, I prefer ruby whenever its an option, but I've worked with node in the past and it's a decent platform that worked very well for the company (a commercial app servicing about 840k api and page requests per month).
I just don't understand the hate.
JavaScript is a terrible language, and imho es2015 fixes a lot of broken stuff in the only backwards-compatible way it can. That said, I find the entire micropackage culture around npm and node, coupled with the hundreds of packages that typically constitute build scripts for even a smallish node project make me realize just how brittle it is compared to competing platforms.
Regarding your own complaints with Node. You're over-generalising. Nobody says you must use small modules. Larger libraries and frameworks exist. Same goes for build scripts. Also read this to get more context on small modules: https://github.com/sindresorhus/ama/issues/10
Your "micropackage" complaint is daft; if you don't like small modules don't use them. Why is the language to blame for free, open-source code that you don't have to use? How is this even a legitimate complaint? You don't need hundreds of packages for anything and you can find examples of this in any language.
Professional, I have used or am using C/C++, Python, Ruby, Javascript, some Java, some C#, Golang.
Our of all of those the only one I don't really hate is Golang. In every other language/eco-system I can point to at least a dozen things that are awful. In Golang - maybe only 9.
Node has NPM with a huge eco-system. It's fast. Javascript, if written correctly, can be a pleasure to use, IMO. And even if you can't use it idiomatically for some reason, you can use Cofeescript/Typescript or whatever that forces some sort of code structure/discipline.
Node itself is decent if you understand how to ignore callback-pyramid-of-death with Promises and reactive-type programming.
I have used most of those you listed, and some esoteric/legacy/proprietary stuff.
To me, with all its flaws, C#, Java, Scala, Python were the best, with goodness decreasing. I need to try F# as I feel I'd like it very much. Generally I believe in static type systems with proper generics support catching a lot of bugs up front, and are a pleasure to use, as my personal experience also shows this. You may not have enough experience with Java, or especially with C#, and I suspect that you may even find some of the greatest features there mere annoyances.
After being an experienced C programmer and having same JS experience I can say JS has the much same problems. Bad design decisions initially. Then sticking to the legacy. Lack of expressive power.
Writing correct code in JS or C is a struggle. For some reason both are overrepresented here on HN.
Lack of proper module module system makes JS inferior to most modern languages (C#, Go, Rust,...). (npm solves some of it), and it could be continued for pages, but for a believer/zealot it wouldn't matter.
Edit: of course right after I say it isn't released, it is released. :)
Release post: https://nodejs.org/en/blog/release/v6.0.0/
$ nvm ls v6
N/A
$ echo ':('
:(
On a more serious note this really is an awesome release. Kudos to everyone that works on Node.js!Ever since the "reunification" of node.js/io.js there's been a whirlwind of great activity both in adding features as well as LTS releases (which are critical for long term adoption of the platform).
nvm install v6.0.0 $ nvm ls-remote v6
v6.0.0
$ echo ':)'
:)
Sweet!Current formula still points to v5.11: https://github.com/Homebrew/homebrew-core/blob/master/Formul...
EDIT: PR created: https://github.com/Homebrew/homebrew-core/pull/633
Sidenote - was just messing with Homebrew a few days ago, and found it a little bizarre that all of the recipes are in source control and require a pull to update, rather than being on a server somewhere.
https://github.com/CocoaPods/CocoaPods/issues/4989#issuecomm...
> all of the recipes are in source control and require a pull to update AND so they are on a server somewhere.
Edit: Thanks for all the answers. I just went through the list of unsupported features and as I'm not using any of the remaining 7%, I might be able to get rid of Babel during development if I'm lucky.
Edit 2: Oops, still no es6 module support :(
At least exponentiation is slightly cool. Hasta la ES8 siempre I guess.
And be sensible about how much transpilation you want, you can use newer presets that don't need to transform the code as much, while still having the ability to layer in newer features (async/await, ES7, etc).
So take the Node 6.0 compatibility table, find out what features it supports and create a "Babel preset" that has those excluded.
Also opened a PR for discussion about adding an environment award preset in babel or supporting it in core at https://github.com/babel/babel/pull/3476.
Maybe an http2 server that uses browser detection to push polyfills so that your app can just assume everything works without transpiling up front?
I'm super hopeful http2 with es2015 modules will make web dev tooling drastically more streamlined in the nearish future.
You can have Rollup spit out CommonJS require commands for things that aren't part of your project, or you can use rollup-plugin-commonjs to wrap your entire app into one big bundle, including the CommonJS includes.
And as much faster as Node 6 has gotten with module importing, it almost can't be as fast as Rollup's module loader, which is more optimal than Browserify and WebPack, in that ES6 modules don't even get wrapped in "requires", but instead included inline. It just parses the code to ensure no variable names collide.
Notable changes summarized here: https://github.com/nodejs/node/pull/6383
The future, as I see it, is incredibly bright.
Example app running v6.0.0: http://nodejs600.appspot.com/
Any solution that requires extra work (file extension, another file to maintain) is a non-starter.
Frankly it should work how Babel transpiles it - because there's no reason for it not to.
Yet they were solved for that.
Why can't node parse a file to detect if it's a module? The presence of a top-level import or export means it's a module. If it's not, then the parsed file can be kept if the file is also in strict mode. If it's sloppy, it'll have to be re-parsed. Seems like a small penalty if the goal is to enable migration.
Also, why worry about ES modules importing Common JS? Just disallow that and let projects migrate to ES modules bottom-up. Then you don't have to worry about executing a Common JS module to determine what its exports are or circular dependency problems.
http://blog.jetbrains.com/webstorm/2015/05/ecmascript-6-in-w...
I'm using node 5.9.1 and webstorm creates a -compiled.js and -compiled.js.map file for each transpiled file.
If I use Node 6 which I understand is now up to 95% support for ES6, do I still need to transpile to ES5.1? Is anyone else using webstorm with ES6 and are you also going through this transpiling step?
Does this refer to growth in number of users or in number of modules? Or maybe just counting the number of lines of code?
If I could offer any advice to anyone who is relatively new to all this, I would say choose anything else: Ruby/Rails, PHP/Symfony, Python/Django, Java/Spring, C#/.NET, whatever. You'll be doing yourself a favor. Learn how to do things correctly, in an tech stack that actually exists and works properly and makes sense, then see where things stand for JS on the server in a couple years. The bad habits, mistaken assumptions, and rampant misinformation being spread in the JS world these days is just amazing.
I think another factor is the level of conservatism of the programmer in question: would you rather work on stable but somewhat boring platforms at a large enterprise, or do you want to be on that new-new at a hip startup? (These options obviously exist on a spectrum.)
If you want to be in the fastest-moving, most exciting ecosystem around, it seems to me that JS is the train you want to be on.
Are there any tools that statically or otherwise checks any potentially breaking pieces in the Node v4+ codebase/dependencies?
But yeah, I'm not seeing where the 6.0 was cut. It doesn't appear on their releases tab: https://github.com/nodejs/node/releases
Edit: It's released!
New one is running, and should be out soon-ish.
I assumed that meant it was not yet downloadable.
Somewhat related there is no optimization for passing arbitrary length arrays with `...` to function having `...rest` as the last argument, which means [].splice is still a footgun:(
Further, if you have a project that for whatever reason is not feasible to update to run on modern Current Node, you can use `nvm` or `n` to choose which Node release you want to use: i.e. `nvm exec 0.12 node old-project.js` and `nvm exec 6.0 node fresh-project.js`. v6 (and the versions that preceded it) has made Javascript really enjoyable to write.
Feel free to try: https://github.com/SeleniumHQ/selenium/compare/selenium-2.47...
It's a dependency of a dependency with multiple language versions in the one repository.
1: https://nodesource.com/blog/essential-steps-long-term-suppor...
[0] https://github.com/nodejs/node/pull/6383#issue-151012738
Just today I had to deal with the fact that babel wraps ALL your generators in some shit function.
Why ? just why ? generation function was supported in browsers longer then the age all the babel maintainers combined.
The worst part is I do not use babel myself - I wouldn't touch it with a ten foot pole but am forced to use it due to my stupid cowokers writing everything using babel - ( why does babel need .babelrc file ?? - is babel such a prominent part of your life that you need .rc files ?? and why does the .rc file need to be specified in every freaking folder ! )
1) babel's docs are also terrible
2) The people maintaining babel seem to actively market babel and then at the same time ignore questions and requests for better docs from the community.
3) Slowest compiler I have had the pleasure of dealing with - my babel watch process consumes a grand total of 150 MB of memory !!
Edit - had to follow HN guidelines
That is not my main concern. Babel can wrap the code in 10 functions for all I care ( performance is also not a concern since we are not sending rockets to mars - just another technology sweatshops trying to sell viagra )
The wrapped function throws errors - since apparently you need to download some babel plugins for it to work. (ノಠ益ಠ)ノ彡
Generators are unsupported on all of them.
Babel code is actually faster than the native implementation of most of the ES2015/6 features atm.
>The wrapped function throws errors - since apparently you need to download some babel plugins for it to work. (ノಠ益ಠ)ノ彡
So you forgot to download some plugins and it's Babel's fault?
And, sorry, where does the entitlement come from? It's you who needs and uses Babel, even imperfect and buggy as it is, to get the job done, not the inverse.
Its the entire web community writing code in a barely function compiler.
So maybe not the best person to comment on the state of its tools?
>Its the entire web community writing code in a barely function compiler.
"I didn't include some plugins so the compiler couldn't work" != "barely functioning compiler".
- babel by itself doesn't actually do anything. It depends on the preset you chose. There are now a bunch of presets that leave parts of ES6 alone (i. e. to use ES6 import with webpack).
- I have actually never looked at the docs :). Never had a problem with it (unlike the package manager from config file hell, i.e. webpack).
Please resist commenting about being downvoted.
It never does any good, and it makes boring reading.
Please don't bait other users by inviting them to downvote
you or announce that you expect to get downvoted.Which unfortunately loses the ES7 features.
In fairness though, you can configure babel to use native generators if you intend to only support platforms which implement them. However, generators have also not been well supported for very long: http://kangax.github.io/compat-table/es6/#test-generators
I agree that Babel is slow. Hey, there's always Buble: http://buble.surge.sh/, but then you lose a lot of configurability. There's always a trade-off.
And yes, the generator stuff is far more verbose than it needs to be, but because Babel is trying to cover all browsers by default. It's like jQuery. Good news is you can opt out.
When I look at the compat tables, everything is getting green, looks like a bright future, without the need of Babel anymore.
But I find myself using post-ES2015 features all the time, because, why not? Babel gets me the latest fix.
(static) class properties, decorators, bind... Also JSX! Even if all browsers are completely on ES2015 in the next months, I can't throw Babel out :D
But luckily it seems like the next ES releases are all much smaller, so maybe the browser-manufacturers will have caught up in 2016...