days
-1
-6
hours
-1
-5
minutes
0
-3
seconds
-4
-6
search
It's finally here!

Node.js 8 doesn’t come away empty-handed — Developers also receive npm@5

Gabriela Motroc

© Shutterstock / Iconic Bestiary

Delivered on time! The Node.js team chose to delay the release of version 8.0.0 but users can finally take it for a spin. Let’s see if the wait was worth it.

Node.js 8 doesn’t come away empty-handed! In addition to a plethora of-of significant changes and additions, this release also brings version 5.0.0 of the npm client. As a result, developers who download and install Node.js 8 will automatically receive npm@5 as well.

Say hello to V8 5.8

When Myles Borins, Developer Advocate for Node.js on Google Cloud Platform, announced the decision to delay Node.js 8, he revealed that it all began with a conversation with Node.js TSC member James Snell. Myles explained that, after various meetings with the V8 team, the project had decided to keep the new release on the Crankshaft and full-codegen pipeline. “We would land a version of V8 with the TurboFan + Ignition enable into Node.js 9.0.0,” he said.  

This decision was taken in order to “give the V8 team time to improve performance and bugs in the pipeline and to offer a known and stable experience for an LTS release line. Since V8 5.9 was scheduled to be released in early June, it meant that Node.js 8.x would only have a limited amount of time in which support for the old pipeline would be offered by the V8 team. According to Myles, “the team has projected large amounts of churn in the pipeline between V8 5.9 and 6.0, which would make backporting to V8 5.7 or 5.8 fairly difficult.”

Another problem was that the Chrome team does constant security audits on V8 but if the project were to move forward on the old pipeline, the team would have been forced to fly blind for three years.

There were three options:

  1. Do nothing (ship with V8 5.7)
  2. Ship on time with a version of V8 5.8 that is ABI compatible to 5.9
  3. Delay the release to allow us to ship with a version of V8 5.8 that is ABI compatible to 6.0

They chose to delay the release and now V8 5.8 is here. According to the blog post announcing the release, “most significant for Node.js developers is the fact that V8 5.8 is guaranteed to have forwards ABI compatibility with V8 5.9 and the upcoming V8 6.0, which will help to ensure stability of the Node.js native addon ecosystem.”

During Node.js 8’s lifetime, we plan to move to 5.9 and possibly even 6.0.

Furthermore, the V8 5.8 engine “helps set up a pending transition to the new TurboFan + Ignition compiler pipeline, which promises to provide significant new performance optimizations for all Node.js applications. TurboFan and Ignition will be enabled by default for the first time in V8 5.9.”

Node.js 8: Brand new experimental Node.js API (N-API)

“The new experimental Node.js API (N-API) is a significant advancement over the existing Native Abstractions for Node.js (nan) that will allow native addons to be compiled once on a system and used across multiple versions of Node.js,” James Snell and Colin Ihrig wrote in the blog post.

Keep in mind that since the N-API is experimental in Node.js 8, one should expect significant changes in the implementation and API.

Buffer API: Changes

The Buffer API has received sone changes, too. For example, calling the deprecated Buffer(num) constructor (with or without the new keyword) will return a zero-filled Bufferinstance. Prior versions of Node.js would return uninitialized memory, which could contain potentially sensitive data.

A new set of Buffer construction methods were introduced in Node.js 6 as an alternative to calling the Buffer(num) constructor with the aim to address a number of security and usability concerns. “The existing constructor, however, is used extensively throughout the Node.js ecosystem, making it infeasible for us to fully deprecate or disable it without causing significant breakage,” Snell and Ihrig explained.

What’s more, zero-filling new instances of Buffer(num) by default will have a significant impact on performance. Developers should move to the new Buffer.allocUnsafe(num) API if they wish to allocate Buffer instances with uninitialized memory.

Although there are no current plans to remove the Buffer(num) constructor from Node.js, its continued use is deprecated.

Experimental inspector JavaScript API

“A new experimental JavaScript API for the Inspector protocol has been introduced enabling developers new ways of leveraging the debug protocol to inspect running Node.js processes.”

const inspector = require('inspector');

const session = new inspector.Session();
session.connect();

// Listen for inspector events
session.on('inspectorNotification', (message) => { /** ... **/ });

// Send messages to the inspector
session.post(message);

session.disconnect();

Keep in mind that the inspector API is experimental and may change significantly.

Long Term Support (LTS)

Node.js 8 is the next release line to enter Long Term Support (LTS), which will happen in October 2017. After the current release transitions to LTS, it will receive the code name Carbon.

Long Term Support (LTS)

One final observation: although previous versions were commonly referred to as v0.10, v0.12, v4, v6, etc., the team has dropped the “v” in Node.js 8 in order to avoid confusion with V8, the underlying JavaScript engine.

Check out the entire list of changes and additions here

Author
Gabriela Motroc
Gabriela Motroc is editor of JAXenter.com and JAX Magazine. Before working at Software & Support Media Group, she studied International Communication Management at the Hague University of Applied Sciences.

Leave a Reply

Be the First to Comment!

avatar
400
  Subscribe  
Notify of