Software:Deno

From HandWiki
Short description: Secure JavaScript and TypeScript runtime
Deno
Deno 2021.svg
Original author(s)Ryan Dahl
Developer(s)Deno Land Inc[1] and contributors
Initial releaseMay 13, 2018; 5 years ago (2018-05-13)[2]
Repositorygithub.com/denoland/deno
Written inTypeScript, JavaScript, Rust, C++ (V8 bindings)
Operating systemLinux, macOS, Microsoft Windows
TypeRuntime environment
LicenseMIT License[3]

Deno /dn/[4] is a runtime for JavaScript, TypeScript, and WebAssembly that is based on the V8 JavaScript engine and the Rust programming language. Deno was co-created by Ryan Dahl, who also created Node.js.[5]

Deno explicitly takes on the role of both runtime and package manager within a single executable, rather than requiring a separate package-management program.[4][6]

History

Deno was announced at JSConf EU 2018 by Ryan Dahl in his talk "10 Things I Regret About Node.js".[7] 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 design, usage of the legacy build system GYP, node_modules and package.json, leaving out file extensions, magical module resolution with index.js and breaking the sandboxed environment of V8.[8] He eventually presented the prototype of Deno, aiming to achieve system call bindings through message passing with serialization tools such as Protocol Buffers, and to provide command line flags for access control.

Deno was initially written in Go and used Protocol Buffers for serialization between privileged (Go, with system call access) and unprivileged (V8) sides.[9] However, Go was soon replaced with Rust due to concerns of double runtime and garbage collection pressure.[10] Tokio was introduced in place of libuv as the asynchronous event-driven platform,[11] and FlatBuffers was adopted for faster, "zero-copy" serialization and deserialization[12] but later in August 2019, FlatBuffers was removed[13] after publishing benchmarks that measured a significant overhead of serialization in April 2019.[14]

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.[15]

The official Deno 1.0 was released on May 13, 2020.[16]

Deno Deploy, inspired by Cloudflare Workers,[17] was released on June 23, 2021.[18] 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.[19]

Deno Fresh 1.0 was announced June 28, 2022.[20] 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 deployment times. Version 1.1 was released September 8, 2022.[21]

Deno SaaSKit beta was announced April 4, 2023.[22] It is an open-source, modern SaaS template built with Fresh and Deno.

Overview

Deno aims to be a productive and secure scripting environment for the modern programmer.[4] Similar to Node.js, Deno emphasizes event-driven architecture, providing a set of non-blocking core I/O utilities, along with their blocking versions. Deno could be used to create web servers, perform scientific computations, etc. Deno is open source software under the MIT License.[23]

Comparison with Node.js

Deno and Node.js are both runtimes built on Google's V8 JavaScript engine, the same engine used in Google Chrome. They both have internal event loops and provide command-line interfaces for running scripts and a wide range of system utilities.

Deno mainly deviates from Node.js in the following aspects:[4]

  1. Supports only ES Modules like browsers where Node.js supports both ES Modules and CommonJS. CommonJS support in Deno is possible by using a compatibility layer.[24][25]
  2. Supports URLs for loading local or remote dependencies, similar to browsers, and uses module specifiers like npm: and node: to import NPM or polyfill Node.JS modules. Node.js supports both URLs [26] and modules.
  3. Does not require a package manager for resource fetching, thus no need for a registry like npm.[27]
  4. Supports TypeScript out of the box,[28] using a snapshotted TypeScript compiler or the swc compiler [29] with caching mechanisms.
  5. Aims for better compatibility with browsers with a wide range of Web APIs.
  6. Restricts file system and network access by default in order to run sandboxed code.
  7. Supports a single API to utilize promises, ES6 and TypeScript features whereas Node.js supports both promise and callback APIs.
  8. Minimizes core API size, while providing a large standard library with no external dependencies.
  9. 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, Mozilla Corporation and a few others. It was established to further the development of Deno and provide a commercial offering to users.[1]

A year on, Deno announced a further $21 million in Series A funding led by Sequoia Capital.[30]

Release history

The tables below were created using the official Releases page.[31]

Deno

Version Latest patch release Release date Date of last patch release Description
0.1.0 0.1.12 2018-08-23 2018-11-12 Rust rewrite and V8 snapshot
0.2.0 0.2.11 2018-11-27 2019-02-08 Mildly usable
0.3.0 0.3.10 2019-02-18 2019-04-25 Instead of importing a "deno" module, there is now a global variable called "Deno"
1.0.0 1.0.5 2020-05-13 2020-06-03 Initial production release with CLI, first-class TypeScript Support, Rust APIs and improvements in HTTP server performance
1.1.0 1.1.3 2020-06-12 2020-07-03 Various additions and fixes to the CLI, Rust 1.44.0
1.2.0 1.2.3 2020-07-13 2020-08-08 Various additions and fixes to the CLI
1.3.0 1.3.3 2020-08-13 2020-09-04 Various additions and fixes to the CLI, various improvements to the Deno language, TypeScript 3.9.7
1.4.0 1.4.6 2020-09-13 2020-10-10 New web standard WebSocket API, automatic restarts on file change, integrated test coverage
1.5.0 1.5.4 2020-10-27 2020-11-23 Faster tree-shaking and bundling, refactored REPL
1.6.0 1.6.3 2020-12-08 2020-12-30 Compile standalone binaries via "deno compile", support TypeScript 4.1, experimental support for Mac ARM64
1.7.0 1.7.5 2021-02-05 2021-02-19 Cross compilation and 60% smaller binaries for deno compile, a DNS resolver API, support for data URLs in import statements and web workers
1.8.0 1.8.3 2021-03-02 2021-04-02 Experimental support for WebGPU API, built-in internationalization APIs enabled, support for fetching private modules, revamped coverage tooling, support for TypeScript 4.2
1.9.0 1.9.2 2021-04-13 2021-04-23 Native HTTP/2 web server, Faster calls into Rust with serde_v8, Blob URL support & improvements to fetch api, Import completions in the LSP, Interactive permission prompt
1.10.0 1.10.2 2021-05-11 2021-05-17 Improvements to the built in test runner, structured clone support in Web Workers, Web Storage API, support for remote import maps
1.11.0 1.11.3 2021-06-08 2021-06-29 Official docker images, more web crypto APIs added, BroadcastChannel, abortable fetch, deno lint stabilized
1.12.0 1.12.2 2021-07-13 2021-07-26 Support for generateKey, sign and verify web crypto APIs, native WebSocket server support, TypeScript support in REPL, support for MessagePort and MessageChannel
1.13.0 1.13.2 2021-08-10 2021-08-23 Native HTTP web server stabilization, support for self.structuredClone(), AbortSignal support, support for navigator.hardwareConcurrency API, experimental WebSocketStream API, FFI replaces native plugin system
1.14.0 1.14.3 2021-09-14 2021-10-04 URLPattern, file locking APIs, mutual TLS support in fetch, TypeScript 4.4, URL parsing and std/http performance improvements
1.15.0 1.15.3 2021-10-12 2021-10-25 New crypto APIs, deno uninstall subcommand, nested testing API, FFI improvements, new—compat flag for improved Node compatibility
1.16.0 1.16.4 2021-11-09 2021-12-03 Fetch support for file URLs, new unstable signal listener API, support for specifying a reason when aborting an AbortSignal, improvements to Web Streams API, findLast and findLastIndex array methods, Deno to npm package build tool
1.17.0 1.17.3 2021-12-16 2022-01-12 Import assertions and JSON modules, improvements to the Web Cryptography API, unref timers, unstable support for negotiating ALPN, TypeScript 4.5
1.18.0 1.18.0 2022-01-20 2022-01-20 Config file auto-discovery, completion of Web Cryptography API, stabilization of test steps API, FFI improvements, LSP improvements
1.19.0 1.19.3 2022-02-17 2022-03-10 New Deno vendor dependency, default permission prompt, new web streams for files, network sockets and stdio, CompressionStream and DecompressionStream supported, better errors for ops and resource sanistizers, improved console log
1.20.1 1.20.6 2022-04-14 2022-03-16 Faster calls into Rust, auto-compression for HTTP response bodies, new subcommands (deno bench, deno task), security improvements, stricter defaults in programmatic permission, TypeScript 4.6, V8 10.0
1.21.0 1.21.3 2022-04-20 2022-05-12 Various improvements to the Deno language, VSCode extension, and REPL. Improvements in Deno Test
1.22.0 1.22.3 2022-05-18 2022-06-09 Updated default type checking behavior, various improvements to the Deno language, updates to the test runner
1.23.0 1.23.4 2022-06-15 2022-07-12 No type-checking by default, various improvements to the Deno language, force a new line in REPL, TypeScript 4.7
1.24.0 1.24.3 2022-07-20 2022-08-11 Type checking and emitting performance improvements, various improvements to the Deno language, Deno Test improvements, Updates to the new subprocess API, LSP improvements, addition of semver module
1.25.0 1.25.4 2022-08-24 2022-09-22 deno init subcommand, experimental npm support, new HTTP server API, improvements to startup time, FFI API improvements
1.26.0 1.26.2 2022-09-29 2022-10-17 Cache Web API, WebCrypto Secure Curves, --allow-sys permission flag, improvements to npm and Node.JS support, improvements to Deno.serve() API, improved module download UI, developer experience improvement, TypeScript 4.8
1.27.0 1.27.2 2022-10-27 2022-11-08 Major IDE improvements, Improvements to npm compatibility, navigator.language Web API, Improvements to deno task, Upgrade checker, Changes to Deno APIs, Updates to deno lint, V8 10.8, Node.js compatibility improvements, Changes to standard library APIs
1.28.0 1.28.3 2022-11-13 2022-12-01 Various fixes and feature stabilisations, NPM package importer, auto discovery of the lock file, V8 10.9
1.29.0 1.29.4 2022-12-14 2023-01-16 npm compatibility improvements, REPL changes, Quality of life improvements, Changes to Deno APIs, TypeScript 4.9, Changes to the standard modules
1.30.0 1.30.3 2023-01-26 2023-02-07 Support for built-in Node.js modules (import "node:fs"), deno.json becomes an import map, deno fmt supports configuring semicolons
1.31.0 1.31.1 2023-02-24 2023-02-25 Support for package.json, Stabilization of Node-API, Node compatibility layer for NodeJS moved to the Deno runtime itself, Stabilizations in Deno API, Change to pointer type in FFI API
1.32.0 1.32.5 2023-03-23 2023-04-18 Enhanced Node.js compatibility, deno compile support for web workers and dynamic import, changes to Deno APIs, changes to Web APIs, changes to the standard library, TypeScript 5.0, V8 11.2
1.33.0 1.33.4 2023-04-28 2023-05-18 Built in Key-value database, flatter configuration, no permission check for dynamic imports, further enhanced Node.js/npm compatibility, performance improvements, CLI improvements, changes to Deno APIs, V8 11.4
1.34.0 1.34.3 2023-05-23 2023-6-15 Deno compile support for npm packages, glob support in Deno.json and CLI flags, support for IP addresses in TLS certificates, configuration file improvements, API Changes, Node.js compatibility improvements, TypeScript 5.0.4, V8 11.5
1.35.0 1.35.3 2023-07-05 2023-07-26 New stable web server API, Node.js compatibility improvements, Deno API changes, Web API changes, LSP improvements, updates to standard library, TypeScript 5.1.6, V8 11.6
1.36.0 1.36.2 2023-08-03 2023-08-21 More flexible security and expanded testing APIs
{{{2}}}


Deno Fresh

Version Latest patch release Release date Date of last patch release Description
1.0.0 1.0.0 2022-06-28 2022-06-28 Initial release
1.1.0 1.1.6 2022-08-09 2023-05-23 Automatic JSX, new twind plug-in, Preact Signals support, Preact DevTools support, explicit rendering of 404 pages, stacked middleware, experimental Deno.serve support, showcase & "Made with Fresh" badges
1.2.0 1.2.0 2023-06-15 2023-06-15 More datatypes supported in island props, support for passing JSX to islands and nesting islands, support for importing packages from npm, custom HEAD request handlers, overrides for headers and status from ctx.render, asynchronous plugin rendering, simplified testing
1.3.0 1.3.1 2023-07-18 2023-07-21 Async Route Components. adding routes and/or middlewares from plugin. 500 error template fallback, error Boundaries, export multiple islands in the same file, Fresh linting rules, support for Deno.serve
1.4.0 1.4.3 2023-08-16 2023-09-06 Faster page loads with ahead-of-time compilation, custom html, head and body tags, layouts (async layouts and async app wrapper, quicker typing with define functions
{{{2}}}

Deno SaasKit

Version Latest patch release Release date Date of last patch release Description
beta beta 2023-04-04 2022-04-04 Initial release
{{{2}}}

Examples

A basic Hello, World! program in Deno:

console.log("Hello, World!");

Global Deno namespaces expose APIs that are not available in the browser. An implementation of the Unix cat program: [1]

/**
 * cat.ts
 */
for (const filename of Deno.args) {
  const file = await Deno.open(filename);
  await file.readable.pipeTo(Deno.stdout.writable, { preventClose: true });
}

A simple Web server: [2]

Deno.serve((req) => new Response("hello world"));

Deno automatically downloads and caches the remote standard library files when the script is run, and then compiles the code.

Similarly, it can run a standard library script (such as a file server) 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

  1. 1.0 1.1 Ryan Dahl, Bert Belder (2021-03-29). "Announcing the Deno Company". https://deno.com/blog/the-deno-company. 
  2. "Contributors, denoland/deno, Github". https://github.com/denoland/deno/graphs/contributors. 
  3. "deno/LICENSE at main". https://github.com/denoland/deno/blob/main/LICENSE. 
  4. 4.0 4.1 4.2 4.3 "Deno Manual". https://deno.land/manual. 
  5. Schiemann, Dylan (December 26, 2018). "Deno: Secure V8 TypeScript Runtime from Original Node.js Creator" (in en-US). https://www.infoq.com/news/2018/12/deno-v8-typescript. 
  6. Paul Krill (2018-06-21). "Ryan Dahl's Node.js regrets lead to Deno". InfoWorld. https://www.infoworld.com/article/3283250/ryan-dahls-nodejs-regrets-lead-to-deno.html. 
  7. JSConf (2018-06-06), 10 Things I Regret About Node.js - Ryan Dahl - JSConf EU 2018, https://www.youtube.com/watch?v=M3BM9TB-8yA, retrieved 2019-05-17 
  8. Dahl, Ryan (2018-06-06). "Design mistakes in Node". https://github.com/denolib/awesome-deno/blob/main/resources/design-mistakes-in-node/design-mistakes-in-node.pdf. 
  9. "denoland/deno, branch "golang"". https://github.com/denoland/deno/tree/golang. 
  10. "Suggestion: Look into porting to Rust and using Tokio". https://github.com/denoland/deno/issues/205. 
  11. "Tokio - The asynchronous run-time for the Rust programming language.". https://tokio.rs/. 
  12. "Protobuf seems like a lot of overhead for this use case?". https://github.com/denoland/deno/issues/269. 
  13. "Remove flatbuffers". https://github.com/denoland/deno/pull/2818. 
  14. "Replace flatbuffers" (in en-US). April 15, 2019. https://github.com/denoland/deno/issues/2121. 
  15. "denoland/deno_std: deno standard modules". 3 March 2022. https://github.com/denoland/deno_std. 
  16. "Deno 1.0". https://deno.land/v1. 
  17. Dahl, Ryan (4 May 2022). "JavaScript Containers". https://tinyclouds.org/javascript_containers. 
  18. Krill, Paul (2021-06-24). "Deno Company unveils server-side JavaScript hosting service" (in en). https://www.infoworld.com/article/3622914/deno-company-unveils-server-side-javascript-hosting-service.html. 
  19. Krill, Paul (2022-06-03). "Deno Deploy moves toward GA, adds paid plan" (in en). https://www.infoworld.com/article/3663129/deno-deploy-moves-toward-ga-adds-paid-plan.html. 
  20. Luca, Casonato (2022-07-22). "Introduction Fresh 1.0 as new full stack web framework for Deno" (in en). https://deno.com/blog/fresh-is-stable. 
  21. Casonato, Luca (2022-09-08). "Fresh 1.1 - automatic JSX, plugins, DevTools, and more" (in en). https://deno.com/blog/fresh-1.1. 
  22. Jiang, Andy (2023-04-04). "Announcing Deno SaaSKit: an open-source SaaS template built with Fresh" (in en). https://deno.com/blog/announcing-deno-saaskit. 
  23. "Deno Is Ready for Production" (in en). https://www.infoq.com/news/2020/06/deno-1-ready-production/. 
  24. "Modules: ECMAScript modules | Node.js v17.6.0 Documentation". https://nodejs.org/api/esm.html. 
  25. "Deno - A modern runtime for JavaScript and TypeScript". https://deno.land/manual. 
  26. "Modules: ECMAScript modules | Node.js v17.6.0 Documentation". https://nodejs.org/api/esm.html#https-and-http-imports. 
  27. "Deno - A modern runtime for JavaScript and TypeScript". https://deno.land/manual/examples/manage_dependencies. 
  28. "Deno.js in Production. Key Takeaways.". https://medium.com/@sdesalas/deno-js-in-production-main-takeaways-247a2fd2d198. 
  29. "Documentation". 3 March 2022. https://github.com/swc-project/swc. 
  30. "Deno raises $21M". https://deno.com/blog/series-a. 
  31. "Releases". 2020-12-30. https://github.com/denoland/deno/blob/main/Releases.md. 

External links