Deno 1.26 released with experimental improved npm and Node.js compatibility

Deno 1.26 released with experimental improved npm and Node.js compatibility

The Deno project has released version 1.26 with enhancements, including improved support for npm modules, implementations for more Node.js compatibility APIs, and performance improvements which are dramatic in some cases, such as up to 30 times more throughput encoding text into an array.

Deno is an alternative to Node.js founded by Ryan Dahl, who created Node.js. It is built on the V8 runtime (as is Node.js) but with a modern design, with integrated support for TypeScript and ES modules and avoiding the use of a node_modules directory to store dependencies, which can be problematic for its size, performance and hidden files.

The advantage of Deno is that it arrived without the legacy baggage of Node.js and npm, but that is also a disadvantage because of the huge userbase of the existing Node ecosystem. The Deno team is trying to address this with better compatibility, though much of it is still flagged as experimental and unstable.

“You may find cases where an npm package expects itself to be executing from a node_modules directory. To improve compatibility and support those packages, a new –node-modules-dir flag has been added,” the team explains.

Deno also has a Node.js compatibility layer, which has now been updated for Node.js 18.8, from the previous target of Node.js 16.13. There is an updated Node.js streams implementation, additional child_process APIs, and support for getting process user and group identifiers on non-Windows platforms.

Deno’s profile was boosted last month by its adoption by Slack, which has made TypeScript and Deno the foundation of its new application platform. “Just as Typescript evolved out of Javascript and Deno evolved out of Node, so too does this new platform evolve out of the old one,” said the Slack team.

Although Deno is open source, the Deno company is commercial and operates Deno Deploy, a distributed hosting platform. Deno Deploy is one of a new generation of hosting platforms based on near-instant distribution to global servers for low-latency performance. Other examples are CloudFlare Workers and Netlify Edge.

Competition in this space is increasing though, and the recent appearance of Bun has shaken assumptions with the claim of much better performance than either Deno or Node.js. Bun uses JavaScript Core and is written in the Zig language, whereas Deno uses V8 and Rust. The Bun project also aims for npm package compatibility from the first, unlike Deno which is now adding it retrospectively.

The competition is good for developers. The Deno team has responded with a new focus on performance, as evidenced in this release. It is also promising to improve the developer experience. In the new release, the team discusses documentation and discovery of the “vast” JavaScript/TypeScript ecosystem, with things like ranking search results on its web site by actual code usage, rather than GitHub stars which provided “a very skewed view of the Deno third party ecosystem.”

Deno 2.6 has also updated its TypeScript version to 4.8, released in August.