What is Deno?
What led to the Deno Project?
- A poorly designed module system of NodeJS, with the centralized distribution.
- Lots of legacy APIs that must be supported.
- Less security in NodeJs and some other programming languages.
- The complete details that Ryan had a regret about NodeJS can be found in the video below.
Features of Deno
- Secure by default. That means the script should run without a file system or network write access by default; until you explicitly specify those permissions while running the script. You will get the full list of permissions by running deno run -h
- Decentralized packages. One of the issues with NodeJs is the centralized approach. If you install any package as a dependency via npm in your NodeJs application, all the dependencies for that package are also going to be installed and that makes the node modules bigger and bigger. Deno uses a decentralized approach in package management. If you need any third-party packages, you can import it from the URL. It will be cached to the hard drive once it is loaded. It doesn’t update the cache until you run the code with the reload flag.
- Single executable file. Deno itself serves as a runtime as well as a package manager. For a NodeJs program to run, all the dependencies have to be installed using a package manager such as npm or yarn.
- Top-level Promise. With Deno, we can use await in the global scope without explicitly wrapping it in an async function.
- Deno has a set of standard modules reviewed by the Deno core team. Each of these modules are written in TypeScript and doesn’t have any other external dependencies.
- Tokio for asynchronous operations. It doesn’t use callbacks like NodeJS. Also the Tokio is developed and supported by the Rust core team.
Will it replace NodeJS?
Deno is not a replacement for Node. Ryan Dahl has clarified that the NodeJs is not going anywhere. Check the video below;
NodeJS has a huge community and it is still a great programming language. So if you are new to NodeJs, continue with NodeJs as it is pretty stable now and has a lot of tutorials.
Deno has only got its first version as of now, and it will be growing gradually and might compete with NodeJS later on.
Comparison – NodeJS vs Deno
|Dependency package management||Centralized||Decentralized|
|Module system||CommonJS require() syntax||ES module import statement|
|TypeScript support||Possible using TypeScript compiler||Supports TypeScript out of the box.|
Bigger refactors on Deno Internals:
Deno Team is working on some major refactors to the internals of Deno. Incremental compile time, separate compilers for build-time and run-time, etc are some of the problems they are looking into. Removing all TS type checking from internal code is one of the solutions they have concluded. This won’t affect any TypeScript support in general; it’s all about the internal code. You can find the details here (https://github.com/denoland/deno/issues/5858)