HOME

TheInfoList



OR:

Deno is a runtime for
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
,
TypeScript TypeScript is a free and open source programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are ...
, and
WebAssembly WebAssembly (sometimes abbreviated Wasm) defines a portable binary-code format and a corresponding text format for executable programs as well as software interfaces for facilitating interactions between such programs and their host environment ...
that is based on the V8 JavaScript engine and the
Rust Rust is an iron oxide, a usually reddish-brown oxide formed by the reaction of iron and oxygen in the catalytic presence of water or air moisture. Rust consists of hydrous iron(III) oxides (Fe2O3·nH2O) and iron(III) oxide-hydroxide (FeO(OH ...
programming language. Deno was co-created by
Ryan Dahl Ryan Dahl (born 1981) is an American software engineer who is best known for creating the Node.js JavaScript runtime as well as the Deno JavaScript/TypeScript runtime. Biography Dahl grew up in San Diego, California. His mother bought him an ...
, who also created
Node.js Node.js is an open-source server environment. Node.js is cross-platform and runs on Windows, Linux, Unix, and macOS. Node.js is a back-end JavaScript runtime environment. Node.js runs on the V8 JavaScript Engine and executes JavaScript code o ...
. Deno explicitly takes on the role of both runtime and
package manager A package manager or package-management system is a collection of software tools that automates the process of installing, upgrading, configuring, and removing computer programs for a computer in a consistent manner. A package manager deals wi ...
within a single
executable In computing, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, causes a computer "to perform indicated tasks according to encoded instruction (computer science), instructi ...
, rather than requiring a separate package-management program.


History

Deno was announced o
JSConf EU 2018
by
Ryan Dahl Ryan Dahl (born 1981) is an American software engineer who is best known for creating the Node.js JavaScript runtime as well as the Deno JavaScript/TypeScript runtime. Biography Dahl grew up in San Diego, California. His mother bought him an ...
in his talk "10 Things I Regret About Node.js". In his talk, Dahl mentioned his regrets about the initial design decisions with Node.js, focusing on his choices of not using promises in
API An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
design, usage of the legacy build system GYP, node_modules and package.json, leaving out
file File or filing may refer to: Mechanical tools and processes * File (tool), a tool used to ''remove'' fine amounts of material from a workpiece **Filing (metalworking), a material removal process in manufacturing ** Nail file, a tool used to gent ...
extensions, magical module resolution with index.js and breaking the sandboxed environment of V8. He eventually presented the prototype of Deno, aiming to achieve system call bindings through message passing with serialization tools such as
Protocol Buffers Protocol Buffers (Protobuf) is a free and open-source cross-platform data format used to serialize structured data. It is useful in developing programs to communicate with each other over a network or for storing data. The method involves an i ...
, and to provide command line flags for
access control In the fields of physical security and information security, access control (AC) is the selective restriction of access to a place or other resource, while access management describes the process. The act of ''accessing'' may mean consuming ...
. Deno was initially written in Go and used
Protocol Buffers Protocol Buffers (Protobuf) is a free and open-source cross-platform data format used to serialize structured data. It is useful in developing programs to communicate with each other over a network or for storing data. The method involves an i ...
for serialization between privileged (Go, with system call access) and unprivileged (V8) sides. However, Go was soon replaced with
Rust Rust is an iron oxide, a usually reddish-brown oxide formed by the reaction of iron and oxygen in the catalytic presence of water or air moisture. Rust consists of hydrous iron(III) oxides (Fe2O3·nH2O) and iron(III) oxide-hydroxide (FeO(OH ...
due to concerns of double runtime and
garbage collection Waste collection is a part of the process of waste management. It is the transfer of solid waste from the point of use and disposal to the point of treatment or landfill. Waste collection also includes the curbside collection of recyclabl ...
pressure. Tokio was introduced in place of
libuv libuv is a multi-platform C library that provides support for asynchronous I/O based on event loops. It supports epoll(4), kqueue(2), Windows IOCP, and Solaris event ports. It is primarily designed for use in Node.js but it is also used b ...
as the asynchronous event-driven platform, and FlatBuffers was adopted for faster, "zero-copy" serialization and deserialization but later in August 2019, FlatBuffers was removed after publishing benchmarks that measured a significant overhead of serialization in April 2019. A standard library, modeled after Go's standard library, was created in November 2018 to provide extensive tools and utilities, partially solving Node.js' dependency tree explosion problem. The official Deno 1.0 was released on May 13, 2020. Deno Deploy, inspired by
Cloudflare Cloudflare, Inc. is an American content delivery network and DDoS mitigation company, founded in 2009. It primarily acts as a reverse proxy between a website's visitor and the Cloudflare customer's hosting provider. Its headquarters are in San ...
Workers, was released on June 23, 2021. Announced May 4, 2022 Beta 4 improves the dashboard and adds billing functionality. General availability of Deno Deploy is eyed for the third quarter of 2022. Deno Fresh 1.0 was announced June 28, 2022. It features a new full stack web framework for Deno that sends zero JavaScript to the client. The framework has no build step which allows for an order of magnitude improvements in deployments times. Version 1.1 was released September 8, 2022.


Overview

Deno aims to be a productive and secure scripting environment for the modern programmer. Similar to Node.js, Deno emphasizes
event-driven architecture Event-driven architecture (EDA) is a software architecture paradigm promoting the production, detection, consumption of, and reaction to events. Overview An ''event'' can be defined as "a significant change in state". For example, when a consumer p ...
, providing a set of non-blocking core I/O utilities, along with their blocking versions. Deno could be used to create
web server A web server is computer software and underlying hardware that accepts requests via HTTP (the network protocol created to distribute web content) or its secure variant HTTPS. A user agent, commonly a web browser or web crawler, initiate ...
s, perform scientific computations, etc. Deno is
open source software Open-source software (OSS) is computer software that is released under a license in which the copyright holder grants users the rights to use, study, change, and distribute the software and its source code to anyone and for any purpose. Open ...
under the
MIT License The MIT License is a permissive free software license originating at the Massachusetts Institute of Technology (MIT) in the late 1980s. As a permissive license, it puts only very limited restriction on reuse and has, therefore, high license comp ...
.


Comparison with Node.js

Deno and Node.js are both runtimes built on Google's
V8 JavaScript engine V8 is a free and open-source JavaScript engine developed by the Chromium Project for Google Chrome and Chromium web browsers. The project’s creator is Lars Bak. The first version of the V8 engine was released at the same time as the first v ...
, the same engine used in
Google Chrome Google Chrome is a cross-platform web browser developed by Google. It was first released in 2008 for Microsoft Windows, built with free software components from Apple WebKit and Mozilla Firefox. Versions were later released for Linux, macOS ...
. They both have internal
event loop In computer science, the event loop is a programming construct or design pattern that waits for and dispatches events or messages in a program. The event loop works by making a request to some internal or external "event provider" (that generally ...
s and provide
command-line interface A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
s for running scripts and a wide range of system utilities. Deno mainly deviates from Node.js in the following aspects: # Supports only ES Modules like browsers where Node.js supports both ES Modules and
CommonJS CommonJS is a project with the goal to establish conventions on the module ecosystem for JavaScript outside of the web browser. The primary reason for its creation was a major lack of commonly accepted forms of JavaScript module units which could ...
. CommonJS support in Deno is possible by using a compatibility layer. # Supports only URLs for loading local or remote dependencies, similar to
browsers Browse, browser or browsing may refer to: Programs * Web browser, a program used to access the World Wide Web *Code browser, a program for navigating source code * File browser or file manager, a program used to manage files and related objects * ...
. Node.js supports both URLs and modules. # Does not require a package manager for resource fetching, thus no need for a registry like npm. # Supports TypeScript out of the box, using a snapshotted TypeScript
compiler In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
or the swc compiler with caching mechanisms. # Aims for better compatibility with browsers with a wide range of Web APIs. # Restricts file system and network access by default in order to run sandboxed code. # Supports a single API to utilize promises,
ES6 ECMAScript (; ES) is a JavaScript standard intended to ensure the interoperability of web pages across different browsers. It is standardized by Ecma International in the documenECMA-262 ECMAScript is commonly used for client-side scripting o ...
and TypeScript features whereas Node.js supports both promise and callback APIs. # Minimizes core API size, while providing a large standard library with no external dependencies. # Uses message passing channels for invoking privileged system APIs and using bindings.


Funding

On March 29, 2021, Deno Land Inc was announced, with backing in millions of dollars from
Shasta Ventures Shasta Ventures is an early-stage venture capital investment firm located in Silicon Valley that invests in enterprise and technology consumer startups. It is located on Sand Hill Road in Menlo Park. Funds Shasta's second fund of US$250 milli ...
,
Mozilla Corporation The Mozilla Corporation (stylized as moz://a) is a wholly owned subsidiary of the Mozilla Foundation that coordinates and integrates the development of Internet-related applications such as the Firefox web browser, by a global community of ope ...
and a few others. It was established to further the development of Deno and provide a commercial offering to users. A year on, Deno announced a further $21 million in Series A funding led by
Sequoia Capital Sequoia Capital is an American venture capital firm. The firm is headquartered in Menlo Park, California, and specializes in seed stage, early stage, and growth stage investments in private companies across technology sectors. , Sequoia's total a ...
.


Releases Deno

The table above was created using the official Releases page.


Releases Deno Fresh

The table above was created using the official Releases page.


Examples

Run a Deno script without any file system or network permissions ( sandbox mode): deno run main.ts Explicit flags are required to enable permissions: deno run --allow-read --allow-net main.ts To inspect the dependency tree of the script, use the info subcommand: deno info main.ts A basic Hello, World! program in Deno (similar to Node.js): console.log("Hello, World!"); Global Deno namespaces expose APIs that are not available in the browser.
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
cat program could be implemented as follows: /* cat.ts */ /* Deno APIs are exposed through the `Deno` namespace. */ const = Deno; // Top-level await is supported for (let i = 0; i < args.length; i++) Note:Deno.copy function used above is similar to Go's io.Copy, where stdout (
standard output In computer programming, standard streams are interconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin ...
) is the destination Writer, and file is the source Reader. To run this program, we need to enable read permission to the
filesystem In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one larg ...
: deno run --allow-read cat.ts myfile Deno script for a basic
HTTP server An HTTP server is a computer (software) program (or even a software component included in an other program) that plays the role of a server in a client–server model by implementing the ''server part'' of the HTTP and/or HTTPS network protoco ...
: // Imports `serve` from the remote Deno standard library, using URL. import from "https://deno.land/std@v0.21.0/http/server.ts"; // `serve` function returns an asynchronous iterator, yielding a stream of requests for await (const req of serve()) Deno automatically downloads and caches the remote standard library files when the script is run, and then compile the code. Similarly, we can run a standard library script (such as a
file server In computing, a file server (or fileserver) is a computer attached to a network that provides a location for shared disk access, i.e. storage of computer files (such as text, image, sound, video) that can be accessed by the workstations that are ab ...
) directly without explicitly downloading, by providing the URL as the input filename (-A turns on all permissions): $ deno run -A https://deno.land/std/http/file_server.ts Download https://deno.land/std/http/file_server.ts Compile https://deno.land/std/http/file_server.ts ... HTTP server listening on http://0.0.0.0:4500/


References


External links

*
Official Deno manual
{{JavaScript 2018 software Free software JavaScript programming tools Package management systems Run-time systems Free software programmed in Rust