Deno stabilizes NPM compatibility

With Deno 1.28, developers now can import more than 1.3 million NPM modules, as well as run NPM scripts and CLIs and execute NPM packages with subcommands.

Thinkstock

NPM compatibility in the Deno JavaScript/TypeScript runtime has reached the stable stage, meaning developers leveraging Deno now can import more than 1.3 million NPM modules.

NPM compatibility is featured in Deno 1.28, unveiled November 14. NPM support makes it easier to build apps, the Deno developers said, because developers now can use persistent data modules such as MySQL, Mongoose, and Prisma, and front end frameworks such as React and Vue. The project has posted instructions for getting started with Prisma, Mongoose, and Apollo.

Deno’s builders said using NPM is safer with Deno, due to Deno’s secure-by-default, opt-in permissions model. Importing NPM modules is done through URLs in a standard-compliant fashion. Developers can use NPM packages by importing an npm: specifier.

Deno’s developers intend to make as many NPM modules compatible with Deno as possible. Some modules may not yet be compatible because of edge cases, post-install scripts, or assumptions some packages make about executing a folder with a typical Node.js setup. Plans call for addressing these issues in coming months.

Also with Deno 1.28, the lock file will be automatically discovered and used if a configuration file ( deno.json(c) ) is discovered. In this case, a lock file will be automatically created if one does not yet exist, next to the configuration file, with the deno.lock name. The lock file will be updated if new dependencies become part of the module graph.

Deno 1.28 also upgrades to the V8 10.9 JavaScript/WebAssembly engine. Deno 1.28 follows predecessor Deno 1.27, which was released last month.