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.0.1 / LTS v12.13.0
Apologies, we've been busy in the previous weeks and missed a few installments, therefore content in this article is not exclusively from the previous week.
The Big News:
esm: unflag --experimental-modules
Learn what's new in 13 and why you should start thinking about migrating to Node.js 12.
A feature npm shipped in this version is a new funding property in package.json - in a bid to help the open source community npm decided to add a new command:
npm fund that will provide more visibility to npm users on what dependencies are actively looking for ways to fund their work.
As part of that change, npm install will also show a single message at the end in order to let the user aware that dependencies are looking for funding, it looks like this:
$ npm install 3 packages are looking for funding. Run "npm fund" to find out more.
Slides for the prezentation of Dominykas Blyžė & Michael Dawson who share the challenges and opportunities in trying to ensure a healthy and successful package ecosystem.
Yes, the company was acquired and is now a part of i2.
Many of you may have been wondering, “What happened to NodeSource?”, a company that seemed so solid in the Node.js ecosystem, suddenly there was a restructuring of the organization and many of the staff were impacted.
Top-level await enables developers to use the await keyword outside of async functions. It acts like a big async function causing other modules who import them to wait before they start evaluating their body.
A great prezentation by James Simpson during NordicJS.
There are two ways to interface C/C++ code with Node.js:
- NAN (Native Abstraction for Node.js) – this is a set of tools for making the interface with V8 simpler and more stable across versions of Node.js. Our code could be broken by changes made on V8 API. It needs to be compiled for each major version of Node.js
- N-API – this is a stable and V8-independent API for building add-ons for Node.js. You compile it once and it will run on all versions of Node.js that support N-API.
Building tests with your application enables you to:
- Quickly verify that changes to a project do not break expected behavior
- Act as pseudo documentation as path flows are documented
- Easily demonstrate application behaviors
- Quickly take a review of your application’s health and codebase
From the two days of talks, roundtables, and hallway conversations, some exciting themes emerged at Summit:
- GraphQL is mature and growing. It’s here to stay, and it’s poised to become the preferred API convention as client-side UI demands grow in complexity.
- The data graph provides numerous architectural advantages for companies with rich client-side experiences. It simplifies client-side data fetching, ensures a much more pleasant developer experience, and improves developer velocity ⚡.
- The React Hooks (useQuery) + Apollo stack is solid. And just fun to code with.
- There’s no free lunch in software. Large-scale GraphQL deployments encounter challenges similar to any other service-based architecture. But teams can mitigate those challenges with tools like 🏘️ federation (to prevent error-prone monoliths and enable the development of separate graphs by cross-cutting teams) and 🔒 schema change validation (to ensure that schema changes don’t break live queries in production).
Interesting JS & Node Discussions:
Some of the changes proposed by TC39 Committee (body responsible for EcmaScript standard) arouse more resistance than others. A proposal that recently caused a lot of negative reactions was class fields proposal that — among others — tries to add to the language private class fields.
As broofa in the thread pointed out: This fixes two huge issues that have plagued the JS ecosystem for 10+ years:
- Having a consistent module import syntax on all major JS platforms makes it easier for JS devs to work across server/client code bases and, more importantly (imho), module owners no longer have to worry about supporting different module schemes.
- Because ESM modules are statically resolved, packagers can do tree-shaking, to remove not just unused modules, but unused code within those modules.
An active discussion on r/node about being an advanced Node.js dev.
There are only two kinds of languages: the ones people complain about and the ones nobody uses. — Bjarne Stroustrup