The creator of Node.js has introduced the secure JavaScript platform Deno 1.0

After two years of development introduced the first significant release Deno 1.0, a platform for the isolated execution of applications in JavaScript and TypeScript, which can be used to create server-side handlers. The platform is developed by Ryan Dahl (Ryan Dahl), the creator of Node.js. Like Node.js, Deno uses the JavaScript engine V8, which is also used in Chromium-based browsers. However, Deno is not a fork of Node.js, but rather a completely new project created from scratch. The project's code is distributed is licensed under the MIT License. Builds are prepared are available for Linux, Windows, and macOS.

The significant version number is associated with the stabilization of the APIs in the Deno namespace, which are responsible for the interaction of applications with the OS. APIs that are currently unstable, are hidden by default and accessible only when run in the "—unstable" mode. As new versions are released, such APIs will gradually be moved to stable status. The APIs in the global namespace, which include common functions like setTimeout() and fetch(), are designed to be as close as possible to the APIs of regular web browsers and are developed in accordance with web standards for browsers. The provided Rust APIs, which are used directly in the platform's code, as well as the interface for developing plugins for the Deno runtime, are currently unstable and continue to evolve.

The key motivations for creating the new JavaScript platform were the desire to eliminate conceptual errors that were made in the architecture of Node.js, and to provide users with a more secure environment. To enhance security, the wrapper around the V8 engine is written in Rust, which helps avoid many vulnerabilities that arise from low-level memory operations, such as accessing memory after it's been freed, dereferencing null pointers, and buffer overflows. For handling requests in a non-blocking manner, the platform uses Tokio, also written in Rust. Tokio allows the creation of high-performance applications based on event-driven architecture, supporting multithreading and asynchronous network request handling.

Key Features Deno:

  • Security orientation in the default configuration. File access, network capabilities, and access to environment variables are blocked by default and require explicit enabling. Default applications run in isolated sandbox environments and cannot access system capabilities without explicit permissions.
  • Built-in support for TypeScript language in addition to JavaScript. The default TypeScript compiler is used for type checking and JavaScript generation, resulting in reduced performance compared to parsing JavaScript in V8. A dedicated TypeScript type checking system implementation is planned for the future, which will significantly improve TypeScript processing performance.
  • The runtime is provided as a single self-contained executable file (‘deno’). To run applications with Deno, it is sufficient to download the executable file for your platform, approximately 20 MB in size, without external dependencies and requiring no special installation in the system. Deno is not a monolithic application but a collection of Rust crate packages (deno_core, rusty_v8), which can be used separately.
  • When running a program, as well as for loading modules, addressable URL referencing can be used. For example, to run the program welcome.js, you can use the command “deno https://deno.land/std/examples/welcome.js”. Code from external sources is downloaded and cached on the local system but is never automatically updated (updating requires explicitly running the application with the flag “—reload”).
  • Efficient handling of HTTP network requests in applications; the platform is designed for creating 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 undergone additional auditing and compatibility checking.
  • In addition to runtime, the Deno platform also functions as a package manager and allows referencing modules via URL within the code. For example, to load a module, you can specify in the code "import * as log from 'https://deno.land/std/log/mod.ts'. Files loaded from external servers via URL are cached. Version binding of modules is defined through version numbers specified within the URL, for example, 'https://unpkg.com/liltest@0.0.5/dist/liltest.js';
  • The system includes a dependency inspection tool (the 'deno info' command) and a code formatting utility (deno fmt);
  • All application scripts can be bundled into a single JavaScript file.

Differences from Node.js:

  • Deno does not use the npm package manager
    and does not rely on repositories; modules are addressed via URL or file path, and the modules can be hosted on any site;
  • Deno does not use 'package.json' to define modules;
  • API differences, all asynchronous actions in Deno return promises;
  • Deno requires explicit permission definitions for files, network access, and environment variables;
  • All errors not equipped with handlers lead to the termination of application execution;
  • Deno uses the ECMAScript module system and does not support require();
  • The built-in HTTP server of Deno is written in TypeScript and operates over native TCP sockets, while the HTTP server of Node.js is written in C and provides bindings for JavaScript. Deno developers have focused on optimizing the entire layer of TCP sockets and providing a more general interface. The Deno HTTP server offers lower throughput but guarantees predictable low latencies. For example, in a test, a simple application based on the Deno HTTP server was able to handle 25,000 requests per second with a maximum latency of 1.3 milliseconds. In Node.js, a similar application processed 34,000 requests per second, but latencies ranged from 2 to 300 milliseconds.
  • Deno is not compatible with Node.js packages (NPM), but it is being developed separately is used for compatibility with the Node.js standard library, as its development progresses, more applications written for Node.js will be able to run on Deno.
  • Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster