Deno: Deno is a runtime for JavaScript and TypeScript that is based on the V8 JavaScript engine and the Rust Programming Language. It was created by Ryan Dahl, Original Creator of Node JS, and is focused on productivity. It was announced by Dahl in 2018 during his talk “10 Things I Regret about Node JS”.
Deno explicitly takes on the role of both run time package managers within a single executable, rather than requiring a separate package management program. Among the most important of Deno’s features is its focus is on security. Deno by default executes the code in a sandbox, which means that runtime has no access to:
The File System
The Network
Execution of Other Scripts
The Environment Variables
Deno aims to be browser compatible. Technically speaking, when using the ES module, we don’t have to use any build tools webpack to make our application ready to use in the browser. However, Tools like babel will transpile the code to the ES5 version of JavaScript and as a result, the code can be run even in order browsers that don’t support all the newest features of the language. But that also comes at the price of including a lot of unnecessary code in the final file and bloating the output file.
Deno makes it easy to use typescript without the need for any config files. Still, it is possible to write programs in plain JavaScript and execute them with Deno without any trouble.
Node JS: Node JS is an open-source, cross-platform, backend JavaScript run-time environment that executes JavaScript code outside a web browser. Node JS lets developers use JavaScript to write command-line tools and for server-side scripting- running scripts server-side to produce dynamic web page content before the page is sent to the user’s web browser. Consequently, Node JS represents a “JavaScript Everywhere” paradigm, unifying web-application around a single programming language, rather than different languages for server-side and client-side rendering.
Node JS was initially written by Ryan Dhal in 2009, about thirteen years after the introduction of the first server-side JavaScript environment, Netscape’s Livewire pro web.
Node JS allows the creation of web servers and networking tools using JavaScript and a collection of “modules” that handle various core functionalities. Modules are provided for file system I/O, Networking, binary data, cryptography functions, data streams, and other core functions. Node JS uses an API designed to reduce the complexity of writing server applications.
JavaScript is the only language that Node JS supports natively, but many compiles to JS languages are available. Node JS applications can be written in Coffee Script, Dart, TypeScript, Clojure Script, and others.
Node.JS is primarily used to build network programs such as Web Servers. Node JS is officially supported on Linux, Mac OS, and Windows 8.1 and server 2012, with tier 2 support for Smart OS and IBM AIX.
Node JS brings event-driven programming to Web Servers, enabling development for fast web servers in JavaScript.
If you like Node JS but not it’s package manager npm, or You want a more secure JavaScript runtime environment than Node JS. You might find the new open source project Deno of interest. On the other hand, if you are using Node JS in production, there is nothing to see here, move along – Deno is still “very much under development”.
Deno is a program for running JavaScript and TypeScript code outside of a browser. It’s the most recent effort spearhead by Ryan Dahl, who founded the Node JS project in 2009, and it is an attempt to reimagine Node JS in light of the advances in JavaScript since 2009, including the typescript compiler. Node JS, Deno is essentially a shell around the Google V8 JavaScript engine, although unlike Node JS it includes the typescript compiler in its executable image.
According to Dahl, who after all did design both Node JS and Deno, Node JS sufferers from three major design issues:
A Poorly design module system, with centralized distribution;
Lot’s of legacy API that must be supported
And lack of security.
The way Deno improves security over Node JS is simple. By default, Deno won’t let a program access disk, network subprocesses, or environmental variables. Another security improvement by Deno is that it always dies on uncaught errors, unlike Node js, which will allow execution to proceed after uncaught errors with results that may not be predictable.
In Node JS, you load common JS modules using the required keyword and they all standard and third party alike, implicitly come from npmjs.com. In Deno, you can load ES modules using the import keyword and explicitly state the URL.
At this point, Deno is a reasonable and fun environment to use for building small private scripting projects in TypeScript. According to Dahl, Deno will never really affects the success of Node JS.