The Deno team recently released Deno 2. According to the team, Deno 2 provides seamless interoperability with legacy JavaScript infrastructure, a stabilized standard library, a modern registry for sharing JavaScript libraries across runtimes, and more.
Deno 2 touts backward compatibility with Node and npm. The release note explains:
Deno 2 understands
package.json
, thenode_modules
folder, and even npm workspaces, allowing you to run Deno in any Node project using ESM. And if there are minor syntax adjustments needed, you can fix them withdeno lint --fix
.
The aforementioned compatibility enables teams to incrementally adopt Deno and its all-in-one toolchain. Deno developers can import npm packages via the npm:
specifier:
import chalk from "npm:chalk@5.3.0";
console.log(chalk.blue("Hello, world!"));
// Hello, world! (in blue)
Developers can also leverage import maps to set a bare specifier for their npm package:
// deno.json
{
"imports": {
"chalk": "npm:chalk@5.3.0"
}
}
The module can then be used with its bare specifier:
import chalk from "chalk";
console.log(chalk.blue("Hello, world!"));
// Hello, world! (in blue)
Deno 2 also claims to support a large list of commonly used web frameworks (e.g., including Next.js, Astro, Remix, Angular, SvelteKit, QwikCity).
Deno 2 additionally supports dependency management with deno install
, deno add
, and deno remove
. The latter two commands respectively add and remove packages from a package.json
file.
The Deno Standard Library is now stable and included in Deno 2. It consists of dozens of audited utility modules covering data manipulation, web-related logic, JavaScript-specific functionalities, and more. Developers can review the complete list of modules from the standard library on Deno’s JavaScript Registry (JSR), an open source JavaScript registry that embraces ESM (JavaScript native modules), and natively accepts TypeScript packages.
The release note explains the benefits of JSR:
It supports TypeScript natively (you can publish modules as TypeScript source code), handles the module loading intricacies multiple runtimes and environments, only allows ESM, auto-generates documentation from JSDoc-style comments, and can be used with npm- and npx-like systems (yes, JSR turns TypeScript into
.js
and.d.ts
files, as well).
Deno also supports workspaces (also known as “monorepos”) to manage multiple related and interdependent packages simultaneously. Deno workspaces support using a Deno-first package from an existing npm package, easing the migration from npm workspaces.
Developers can install the production release from dotcom–2.deno. Developers are encouraged to review the original release note, which includes the full list of features, improvements, and bug fixes. Deno is open-source software that is available under the MIT license. Contributions are encouraged via the Deno Project and should follow the Deno contribution guidelines.