Latest Deno release supports NPM packages

Flowers, celebration, surprise

Deno 1.34, the latest release of the JavaScript and TypeScript runtime positioned as an alternative to Node.js, improves compatibility with NPM and Node.js and enhances the developer experience, according to proponents.

With Deno 1.34, unveiled on May 25, deno compile supports NPM packages. Since Deno 1.6, introduced in December 2020, deno compile has allowed the compilation of projects into a single binary executable, which lets developers distribute and execute binaries on all major platforms without installing Deno dependencies. This feature—which simplifies deployment and speeds up startup time—has now been extended to NPM.

Prior to the Deno 1.34 release, deno compile also added support for web workers and dynamic imports. More work is on the horizon for this feature, including minimizing total binary size.

Like last month’s Deno 1.33 release, Deno 1.34 is a precursor to a planned Deno 2 release. Other new capabilities include:

  • Globs, which are patterns specifying sets of filenames with wildcard characters, are supported in the configuration file deno.json, deno.task, and CLI arguments for specifying files. The glob syntax is cross-platform, so it can be used on Windows, MacOS, or Linux.
  • TLS (transport layer security) certificates containing IP addresses are supported. This is useful for purposes such as Kubernetes pods, which often use IP addresses instead of domain names, and for DNS over HTTP/TLS, which needs an IP address for the server to avoid circular dependency on name resolution.
  • For NPM and Node.js compatibility, deno vendor handles NPM specifiers and will no longer raise an error when encountering them. Also, deno task runs pre and post scripts if present when executing a script from a package.json file similar to NPM.
  • It’s possible to specify a nodeModulesDir property in the deno.json file for explicitly enabling or disabling Deno’s use of the node_modules directory.
  • Deno 1.34 ships with the Google V8 11.5 JavaScript and TypeScript engine and TypeScript 5.04.

Copyright © 2023 IDG Communications, Inc.