Deno is secure runtime for JavaScript and TypeScript built with V8, Rust and Tokio.
After his speech in 2018 on “10 things I regret about Node.js”, Ryan Dahl the creator of Node.js announced the arrival of Deno. The objective of this project? Fix Node.js design errors and offer a new modern development environment.
“Trying to reimagine Node.js in light of the progress made in JavaScript since 2009, including the TypeScript compiler. Like Node.js, Deno is essentially a shell around the Google V8 JavaScript engine. But unlike Node.js, it includes the TypeScript compiler in its executable image.
Note that one of the most important features of Deno is its focus on safety and productivity.
What is Deno?
As seen earlier, Deno is a JavaScript / TypeScript runtime with secure defaults that provides an excellent developer experience. It is built on V8, Rust and Tokio.
Deno brings together many of the best open source technologies and offers a complete solution in a small executable file.
Being written in TypeScript means that it benefits from the many advantages of this language, even if you choose to write your code in simple JavaScript. Executing TypeScript code with Deno does not require a compilation step because Deno does it for you automatically.
In addition, Deno modules can be hosted anywhere and security is integrated.
Similarities and differences with Node.js
Since Deno is essentially a replacement for Node.js, it is therefore useful to compare the two directly. These two platforms have the same objective, but use different mechanisms. Deno uses ES modules as the default module system, while Node.js uses CommonJS. The most important difference in our opinion is the way the modules are imported.
Like Node, Deno mainly works on a command line interface, which facilitates calls from other programs. It is built in Rust to be fast and includes a plugin API.
For many, the most important feature of Deno will be native TypeScript support. TypeScript has had a huge impact on the JavaScript landscape, but it needs to be transposed to JavaScript in order to take advantage of its full potential.
But with Deno, TypeScript is now a first-class language. You can save yourself the trouble of debugging typos without worrying about a complex construction chain.
The popularity of TypeScript has increased recently, largely thanks to the ease of maintenance and debugging offered by the language but also due to its adoption by front devs like Angular and React.
By removing the build step, Deno removes an additional reason not to switch to TypeScript.
Deno like Node.js- will support a vast ecosystem of modules and dependencies. Node.js did this with npm, but although it has a central repository with npm, it could not prevent the downsides as some previously useful packages were updated and dragged malicious code, thus exposing the difficulties of automatic updates.
Deno has been the subject of criticism on his way of managing addictions. Instead of passing them through a package manager, Deno specifies each dependency module as a simple URL. You no longer have the protection of a central manager, but there is no guarantee that this repository offers more protection than a direct link to this code.
Like any modern browser, Deno runs all of the code in a sandbox; it cannot access the hard drive, network connections or input / output devices without explicit permissions. All code must be executed with a flag that allows activities other than those of the sandbox. And the permissions are granular: you can grant access to a single hard drive or a single location on the network.
We have to see if this changes the situation for web applications or if it is a useful update that does not gain a foothold. But at first glance, it could make the most recent progress towards standard JavaScript (like TypeScript) in server-side code.
Conclusion
Will Deno replace Node.js?
You may want to use Deno because it could do the same thing as Node.js, but in a more efficient way. Deno is still in the early stages of development and Node.js is used in many projects, which means that Node.js is not going to disappear from the game anytime soon.
Deno is only the culmination of about 2 years of work on an idea.
It has not yet been tested in production systems nor has it been reviewed and implemented in specific use cases.
Maybe a year from now we will start hearing from companies who will tell us about their experience with this system, how they have solved the new shortcomings, and ultimately the community that supports it will adapt it so that it is useful.
Will it replace Node then? Who knows ? We will have to wait and see.
Comments are closed.