Deno 2.0, a platform for standalone execution of JavaScript and TypeScript server applications using the V8 engine, used in Chromium-based browsers, has been released. The Deno project is being developed by Ryan Dahl, the creator of Node.js, with the goal of providing a more secure environment and eliminating conceptual errors in the Node.js architecture. To improve security, the V8 engine wrapper is written in Rust, and the Tokio platform is used for non-blocking request processing. The project code is distributed under the MIT license. Builds are prepared for Linux, Windows и macOS.
The focus of this new branch was on compatibility with the old JavaScript infrastructure and expanding the range of supported JavaScript projects without compromising security. Changes include:
- Backwards compatibility with Node.js and npm is implemented, allowing you to run unmodified applications built for Node.js. Node.js support also allows you to gradually migrate existing Node.js projects to use Deno, or to include NPM dependencies in Deno projects by specifying the "npm:" specifier when importing packages in deno.json.
- Added built-in support for the package.json file and the node_modules directory used by Node.js.
- Support for private NPM repositories defined via .npmrc files has been added.
- Added support for popular JavaScript frameworks such as Next.js, Astro, Remix, Angular, SvelteKit and QwikCity.
- Added support for npm workspaces and monorepositories with separate dependency handling.
- New package management commands have been added: "deno install" for installing dependencies, "deno add" for adding packages to package.json or deno.json, "deno remove" for removing packages. It is noted that "deno install" works about 15% faster than npm when there are no packages in the cache and 90% faster when there is a package in the cache (both node_modules and native global cache are supported).
- The standard library has been stabilized.
- Long term support (LTS) is provided.
- JSR is a repository of JavaScript and TypeScript libraries that can be used in various JavaScript Runtimes.
- The "deno fmt" command now has the ability to format content in HTML, CSS and YAML formats.
- The "deno lint" command has been updated to support Node.js-specific rules and fixes.
- The "deno test" command now allows you to run tests created using node:test.
- The "deno task" command now supports running scripts via package.json.
- The "deno compile" command now has the ability to certify code with a digital signature.
- The "deno serve" command implements parallelization of HTTP server operations using multiple CPU cores.
- The "deno coverage" command now supports saving reports in HTML format.
- Performance optimization has been carried out.

Main features of Deno:
- Focus on security in the default configuration. File access, networking, and environment variable access are blocked by default and must be explicitly enabled. Applications run in sandboxed environments by default and cannot access system capabilities without explicit permissions;
- Built-in TypeScript language support in addition to JavaScript. To check the types and generate JavaScript, the regular TypeScript compiler is used, which leads to a drop in performance compared to parsing JavaScript in V8;
- Runtime comes in the form of a single self-contained executable ("deno"). To run applications using Deno, it is enough to download one executable file for your platform, about 40 MB in size, which does not have external dependencies and does not require any special installation on the system. At the same time, deno is not a monolithic application, but a collection of Rust crate packages (deno_core, rusty_v8) that can be used separately;
- When starting the program, as well as for loading modules, addressing via URL can be used. For example, to run the welcome.js program, you can use the command "deno https://deno.land/std/examples/welcome.js". Code from external resources is downloaded and cached on the local system, but is never automatically updated (updating requires explicitly launching the application with the "--reload" flag);
- Efficient processing in applications of network requests via HTTP, the platform is designed to create high-performance network applications;
- The ability to create universal web applications that can run both in Deno and in a regular web browser;
- The presence of a standard set of modules, the use of which does not require binding to external dependencies. Modules from the standard collection have been additionally audited and tested for compatibility;
- In addition to runtime, the Deno platform also functions as a package manager and allows you to access modules by URL within your code. For example, to load a module, you can specify "import * as log from "https://deno.land/std/log/mod.ts" in your code. Files loaded from external servers by URL, cached. Linking to module versions is determined by specifying version numbers within the URL, for example, "https://unpkg.com/liltest@0.0.5/dist/liltest.js";
- Focus on using Web standards, support for Promise, fetch and ECMAScript modules.
- Compatibility with packages hosted in the NPM repository and built for the Node.js platform.
- The package includes an integrated dependency inspection system (“deno info” command) and a code formatting utility (deno fmt);
- All application scripts can be combined into one JavaScript file.
Source: opennet.ru

