Node 21.7 and TypeScript 5.4

March 12, 2024 By Mark Otto 0

Node.js Weekly

Shiki 1.0: A Powerful Syntax Highlighter — A few months ago, we linked to Shikiji, a fork of Shiki that was created to push the project forward. Happily, the creators of both libraries decided to join forces and Shiki 1.0 was born. It’s a syntax highlighter based on TextMate grammar and themes, the same engine as used by VS Code. The docs are good.

Pine Wu, Anthony Fu

Node v21.7.0 (Current) Released — Sometimes minor Node versions have little beyond bug fixes, but other times you get some new features, and 21.7 doesn’t disappoint. Node gains a new util.styleText() function for formatting text (including with color!), new functions to work with .env files, multi-line value support for .env files, a crypto.hash() function to more quickly compute digests in one shot (example), and more.

The Node.js Core Team

Lydia Hallie Tests Your JavaScript Knowledge — Challenge your core knowledge with 50 interactive quiz questions covering topics like the event loop, scopes and closures, classes and prototypes, garbage collection, and more. After each question, you’ll get an in-depth visual explanation from Lydia to deepen your understanding of fundamental JS concepts.

Frontend Masters

TypeScript 5.4 Released — Another evolutionary step for the typed JavaScript superset and toolchain. Of particular interest to Node users may be auto-import’s new support for subpath imports. As the PR says: “This treats package.json#imports as roughly equivalent to compilerOptions#paths in terms of deciding which specifier to use, it also prefers package.json#imports over compilerOptions#paths.

Daniel Rosenwasser

💡 Lars Kappert has also written about using subpath imports & path aliases more generally, and how to use them even if you’re not using TypeScript 5.4 yet.

Ultimate Guide to Visual Testing with PlaywrightUltimate or not, this tutorial is pretty thorough and will get you several steps down the road of fetching pages and making visual comparisons, all from JavaScript.

Mike Stop Continues (BrowserCat)

How npm install Scripts Can Be Weaponized — A quick look at a real world example of how npm pre-install and post-install scripts can serve as ways to inject malicious code into open source packages.

Edward Thomson

🛠 Code & Tools