Core Node.js support for ECMAScript modules + other node updates from this week. #49 / 2019

RisingStack
Node.js Collection
Published in
4 min readDec 6, 2019

Below you can find a collection of the most important Node.js updates, tutorials & announcements from this week — curated by RisingStack’s Node.js Consultants.

Latest Node.js Updates here: Node v13.3.0 / LTS v12.13.1

The Big News:

Announcing core Node.js support for ECMAScript modules

Node.js 13.2.0 ships support for ECMAScript modules, known for their import and export statements. This support was previously behind the --experimental-module flag, which is no longer required; however the implementation remains experimental and subject to change.

This article discusses

  • how you can enable this feature,
  • import and export syntax,
  • files and the package.json “type” field,
  • package entry points and the package.json “exports” field,
  • and common gotchas.

.

npm publishing guidelines from the Node.js package maintenance team.

We established a baseline and a recommendation guide for publishing packages without meta files, using either the exclude or include support from npm.

Node.js Updates (Current and LTS)

Changelog for Node v12.13.1 (LTS)

  • Experimental support for building Node.js with Python 3 is improved.
  • ICU time zone data is updated to version 2019c. This fixes the date offset in Brazil.

.

Changelog for Node 13.3.0 (Current)

  • fs: Reworked experimental recursive rmdir(). The maxBusyTries option is renamed to maxRetries, and its default is set to 0. The emfileWait option has been removed, and EMFILE errors use the same retry logic as other errors. The retryDelay option is now supported. ENFILE errors are now retried.
  • http: Make maximum header size configurable per-stream or per-server
  • http2: Make maximum tolerated rejected streams configurable. Allow to configure maximum tolerated invalid frames.
  • wasi: Introduce initial WASI support

.

Changelog for Node 13.2.0 (Current)

  • addons: Deprecate one- and two-argument AtExit(). Use the three-argument variant of AtExit() or AddEnvironmentCleanupHook() instead
  • child_process,cluster:
    The serialization option is added that allows child process IPC to use the V8 serialization API (to e.g., pass through data types like sets or maps)
  • deps: Update V8 to 7.9, Update npm to 6.13.1
  • embedder: Exposes the ability to pass cli flags / options through an API as embedder. Allow adding linked bindings to Environment.
  • esm: Unflag --experimental-modules
  • stream: Add writable.writableCorked property
  • worker: Allow specifying resource limits
  • v8: The Serialization API is now stable

Awesome Node.js & JavaScript Tutorials:

The observer pattern in Node.js

This is one of the pillars of Node and crucial for using many core modules so treating it isolated due to the importance.

.

Using Events in Node.js (Part 1)

The core feature of Node.js is asynchronous programming. This means that code in Node.js may not be executed sequentially. Therefore, data may not be determined in a fixed amount of time. This means that to get all the data we need, we have to pass data around the app when the data is obtained.

This can be done by emitting, listening to, and handling events in a Node.js app.

.

Automating lights with Computer Vision & Node.js

This solution is implemented with opencv4Nodejs, which is a Node.js wrapper for popular open-source Computer Vision library OpenCV. Along with socket.io and express for rendering a web app to display a live stream of video and to simulate the turning on and off of lights.

.

Natural language processing for Node.js

Python is usually the go-to language when the topic is NLP (or ML and AI) because of its wealth of language processing packages like Natural Language Toolkit. However, JavaScript is growing rapidly and the existence of NPM (Node Package Manager) gives its developers access to a large number of packages, including packages to perform NLP for different languages.

This post will be useful for developers who already use NLP with Python but want to transition to achieve the same results with Node. Complete newbies will also learn a lot about NLP as a technology and its usage with Node.

.

Node.js: Let It Crash!

This talk presents a series of best practices on how to deal with uncaughtExceptions and unhandledRejections in a way that gives developers visibility on errors, post-mortem information and how to handle graceful shutdowns.

Interesting JS & Node Discussions:

Optional Chaining just achieved Stage 4 at TC39!

Also making it to stage 4:

  • Nullish coalescing Operator
  • for-in order

The agenda has a pretty decent proposal list, as well as items for “Operator overloading for Stage 1” and “BigDecimal for Stage 1” which is pretty exciting.

.

Pika — A JavaScript package registry for the modern web

Pika is a new kind of package registry for the modern web.
100% ESM. Write once, run natively on every platform.

.

If you care about user privacy, don’t use Facebook JavaScript SDK

Some SDKs (I’m looking at you Facebook!) inject an iframe in your website to display the Continue as {MyName} or Login with Facebook button. Loading this iframe allows Facebook to know that this specific user is currently on your website. Facebook therefore knows about user browsing behaviour without user’s explicit consent.

Originally published at https://community.risingstack.com on December 6, 2019.

--

--

RisingStack
Node.js Collection

Consulting, training & development services — with a strong focus on JavaScript, Node.js, DevOps, Microservices & Kubernetes | contact: info@risingstack.com