BT

InfoQ Homepage News Node.js 14.0 Improves Diagnostics and Internationalization, Adds Web Assembly System Interface

Node.js 14.0 Improves Diagnostics and Internationalization, Adds Web Assembly System Interface

Bookmarks

The Node.js project recently released Node.js version 14.0.0, adding diagnostic reports, internationalization, experimental async local storage, native N-API module improvements, refinements to ES modules, and numerous other updates since the Node.js version 12 release. The release also adds experimental Web Assembly System Interface support.

The Node.js project follows a Long Term Support (LTS) strategy. Developers should remember that the new 14.0 release is not production-ready until it reaches LTS, expected in October 2020. Until then, developers are encouraged to report issues they find in using Node.js 14 so that issues can get resolved before the LTS version gets completed. Node.js 12 remains the recommended version for use in production applications until Node.js 14 reaches LTS.

The new Node.js Diagnostic Report writes a JSON-formatted diagnostic summary to a file, providing troubleshooting support in development, testing, and production environments. The diagnostic report includes JavaScript and native stack traces, platform details, memory heap information, resource consumption, and other key metrics. The report gets generated upon various configurable triggers, including unhandled exceptions, fatal errors, user signals, and programmatic API calls.

Node.js contributors from IBM are very supportive of this addition and provide a separate report-toolkit package to improve the workflow of diagnostic reports. IBM also provides a guide for getting started with Node.js diagnostic reports.

As explained by Michael Dawson, IBM Node.js community lead, IBM Cloud and Cognitive Software:

We have found this capability to be important for supporting our customers across languages, including Node.js, Java, and Swift. With Diagnostic Report built into Node.js as a stable feature, you can feel confident about using it in production and have it ready to quickly resolve your problems.

Node.js 14 also improves internationalization support with full International Components for Unicode (ICU) data. Added in Node.js 13, this allows users of Node.js to run and support applications in native locales. A recent Weather Company case study describes the switch for weather.com to support 230 locales across 60 languages leveraging Node.js' built-in ICU support.

Another significant addition in Node.js 14 is experimental support for Async Local Storage, creating asynchronous state within callbacks and promise chains. This new API stores data throughout the lifetime of a web request or other asynchronous operations. Async local storage is analogous to thread-local storage in other programming languages.

Node.js provides support for native modules or addons with N-API. Node.js 14 includes N-API version 6, which includes BigInt support and other improvements.

In some scenarios, packages authored in Web Assembly for Node.js improve performance and cross-platform support. Node.js 14 adds an experimental implementation of the Web Assembly System Interface (WASI). The Node.js team seems potential for WASI to significantly simplify the native module experience.

ES Module support continues to improve in Node.js 14. While developers no longer need to include the --experimental-modules flag, but the ES module loader is still considered experimental at this time. There are some current caveats with ES modules in Node.js, explained by Node.js release manager Bethany Nicolle Griggs:

Please keep in mind that the implementation of ESM in Node.js differs from the developer experience you might be familiar with. Most transpilation workflows support features such as optional file extensions or JSON modules that the Node.js ESM implementation does not support. It is highly likely that modules from transpiled environments will require a certain degree of refactoring to work in Node.js. It is worth mentioning that many of our design decisions were made with two primary goals. Spec compliance and Web Compatibility. It is our belief that the current implementation offers a future proof model to authoring ESM modules that paves the path to Universal JavaScript. The ESM implementation in Node.js is still experimental but we do believe that we are getting very close to being able to call ESM in Node.js “stable”. Removing the warning is a huge step in that direction.

The underlying version of the Node.js JavaScript engine, V8, is updated to version 8.1 of V8, providing recent advances in ECMAScript including optional chaining, nullish coalescing, and various internationalization improvements.

Node.js 14 improves the implementation of the Node.js Stream API through a variety of refinements to more closely align different areas of the Node.js core APIs. For example, http.OutgoingMessage is comparable to stream.Writable and net.Socket now behaves consistently with stream.Duplex

For more information on the release, Griggs and Dawson discuss the Node.js 14 release:

Node.js is open-source software available under the MIT license from the Open JS Foundation. Contributions and feedback are encouraged via the Node.js contribution guidelines and code of conduct.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.