What’s New in Node 10
An overview of the Node.js v10 features
Note: this will be updated throughout the day as we dig in to the new features
Version 10 is the newest release of Node.js, and it is packed with features. Going under the codename “Dubnium”, Node 10 was released April 24, 2018 and will enter Long Term Support (LTS) in October 2018. JavaScript developers have been excitedly awaiting today, so let’s take a look at the most notable features of this huge release.
Check out JavaScript Feed for the all the JS news >
Adding Error Codes
Errors in Node have now been standardized to have consistent codes with a repeatable pattern.
Errors have been a pain to work with in the Node environment. Previously they only contained a string message with no other identifier associated. If a developer wanted the program to take actions based on a specific message, the only option was to do a string comparison of the error content.
Since error handling required exact string matching, even the smallest updates to messages could not be added until the next major Node release so that it would not break SemVer. By decoupling the error from the message, it will make them easier to work with for developers and allow Node to improve on error messages without introducing breaking changes. To learn more read Michael Dawson’s article Node error codes.
N-API is no longer experimental
The Node documentation describes N-API as an API for building native Addons. It is independent from the underlying JavaScript runtime (ex V8) and is maintained as part of Node.js itself. This API will be Application Binary Interface (ABI) stable across versions of Node.js. It is intended to insulate Addons from changes in the underlying JavaScript engine and allow modules compiled for one version to run on later versions of Node.js without recompilation.
N-API was experimentally introduced in Node 8 and is going to be to be stable beginning in Node 10. Upgrading between Node versions will no longer cause concern for module breakage. It will also be ported backwards for Node.js v6.x and v8.x compatability.
Performance improvements with V8 Engine v6.6
Node is powered off the V8 JavaScript Engine used in Chromium, and Node.js v10 comes equipped with the latest release. For the browser, the V8 Engine v6.6 which ships with Chrome 66 and provides reduction of around 20–40% in both parse and compilation time of JavaScript. Therefore, we can expect Node 10 to also realize a huge benefit in this area. It also provides improvements for promise and async functions.
With software, speed is king, and the latest release doesn’t disappoint in improving there. Check out the article by the V8 team to learn more.
Improved diagnostic trace and post mortem
Trace events have been added to provide developers more visibility into their Node.js applications. This new insight can provide improved metrics around timing and performance issues. The API allows for users to turn the events on or off at runtime which enables the ability to diagnose issues on demand.
npm v6 ships immediately
npm has recently upgraded from v5.7 to v6.0, and Node 10 will ship with the update immediately. This major version increase in npm provides improvements in all areas including performance, security, and stability. Read more about npm v6 on their blog.
Upgrade to OpenSSL version 1.1.0
Node comes equipped with modern cryptographic support which enables the highly anticipated ChaCha20 cipher and Poly1305 authenticator. TLS 1.3 was recently finalized, and by the time Node.js v10 reaches LTS in October, it will now fully support the standard.
Experimental promise version of the ‘fs’ functions
Interacting with the file system is a staple of many Node apps, and Node 10 will be shipping experimental version of the fs package with promises. Previously these functions handled asynchronous actions through callbacks but could be converted
using the util.promisify() function that shipped with Node 8. Now developers can utilize fs with promises without needing the extra step.
Wrapping up a big day for Node
The Node team continues to add features that make the life of us developers more enjoyable while also allowing us to create better experiences for our users. Node 10 pushes the bleeding edge of technology further and makes it more convenient to assess errors, building native addons, or get visibility into our apps — among many other improvements.
Node 10 will remain in LTS from October 2018 until April 2021. The Node team follows a specific even/odd release cycle. Upon going into LTS, Node 11 will also be released in October. Odd-numbered releases are meant for experimentation and even-numbered are the LTS releases. It will also mark the deprecation of long-term support for Node 4.
Happy JavaScripting!
