April 24, 2018 - by Colin J. Ihrig
Today, the Node.js core team is proud to release version 10.0.0 of the Node runtime. The Node.js project makes various releases year round which include minor improvements, bug fixes, and new features. Twice per year, in April and October, the project cuts a new major release. Each major release is the culmination of six months of code changes, some of which may break compatibility with previous versions. This release process is captured in the following image.
The image shows several things:
Before looking at Node 10.0.0 in detail, it's important to set some expectations:
Major releases of Node.js are generally uninteresting.
If major releases contain all of the breaking changes, how can they possibly be boring? The answer to this question has several components.
New APIs, new language features, and V8 updates typically generate the most excitement among developers. With the exception of backward incompatible V8 updates, these are usually classified as semver minor changes, or feature additions. Since semver minor releases are made on an ongoing basis, the "exciting" changes don't need to wait for a new major release line.
The project tries really hard not to break existing code. When breaking changes are made, they are typically not very drastic. Instead, they focus on small, incremental improvements that just happen to be backward incompatible. The bulk of these changes involve the deprecation or removal of legacy APIs. Furthermore, before an API is removed, the core team attempts to gauge ecosystem usage and impact. If a particular API is widely used, it may not be removed.
Now that it is available, the 10.x release line will receive all non-breaking changes that land in the master branch until Node 11.0.0 is released in October. While it is expected that no breaking changes will be introduced in Node 10.x, history has shown that there will likely be some accidental breakage. Until it transitions to LTS in October, Node 10.x does not come with the same stability guarantees as an existing LTS release line.
If you (or your company) can safely exist closer to the bleeding edge, tolerate possible unexpected breakage, and can easily switch between Node.js versions, then Node.js 10.x is a viable option for you now.
If you are running Node.js in mission-critical areas, require the utmost level of stability, or cannot easily move between Node.js versions, then Node.js 10.x is not a viable option for you at this time. If you fall into this category, you absolutely should be running an LTS release.
This section lists some of the notable changes in Node.js 10.0.0. Some of the items in this list arrived very recently in Node 9.x, but warrant mentioning here.
Buffer()
constructor is being deprecated when called outside of a node_modules
directory. Certain uses of the Buffer()
constructor are considered security risks. The constructor has been deprecated in the documentation for several years. However, its widespread use, and the deeply nested nature of Node.js application dependency trees has made displaying a runtime deprecation message impractical. Node 10.0.0 attempts to discourage use of the Buffer()
constructor in new code by displaying a deprecation message if the call comes from an application, but not a dependency in a node_modules
directory.util.types
has been introduced. It is an object that provides a number of type checking functions. These functions are significant because they execute at the C++ level, where JavaScript type checking can be done much more reliably.fs.copyFile()
. The original goal of fs.copyFile()
was to provide a file copy mechanism that was cross-platform, but with better performance than a JavaScript implementation. These flags take that goal one step further by avoiding a copy operation unless the file is modified.await
in the REPL is available behind a flag. This makes await
significantly easier to use in the REPL because an async
function wrapper is not necessary.node
binary, they are critical to the success of Node.js, and make up the bulk of every release. For those reasons, they are included in this list. And, in case you were curious, Node.js core currently has approximately 94% and 92% code coverage in the JavaScript and C++ layers, respectively.This post has explored the Node.js 10.0.0 release at a high level. It also detailed who is a prospective user of Node.js 10.0.0, and who should be using an existing LTS release line instead. If anything in this post is unclear, please reach out. Joyent offers comprehensive Node.js support and would love to help you succeed.