3 New Features of Deno that Most JS Devs Don't Know About

Photo by Joyce Adams on Unsplash

3 New Features of Deno that Most JS Devs Don't Know About

...And Just Might Convert You Too!

Β·

3 min read

Deno is a modern, secure, and performant runtime for JavaScript and TypeScript. It is often compared to its progenitor NodeJS, and its zippy younger brother BunJS.

Among Deno's main features are:

  1. Built-in Modules: Deno comes with a standard library that provides several built-in modules, eliminating the need to install external packages, reducing the dependency on package managers, and streamlining the development process. Similar to NodeJS's fs, path, process.

  2. Security: Deno prioritizes security by default, it runs scripts in a sandboxed environment, avoiding access to the file system, environment variables, and network unless explicitly granted. This means that you can run all those public apps / scripts / libs with high confidence that nothing untoward will happen to your machine (format C:\ anyone?), unless you grant it permission; then it's your fault!

  3. TypeScript Support: Deno natively supports TypeScript, with no transpilation or build steps required! This enables developers to take advantage of TypeScript's type-checking and other features without adding extra complexity to their workflow. Don't want to use TypeScript? It's completely optional too!

Deno was created by Ryan Dahl, who also created NodeJS. It was announced in 2018 and released in May 2020. Since its release, Deno has gained a significant following and is seen as a potential successor to NodeJS. It's being used in a variety of applications and is actively being developed with new features and improvements.

And now, for 3 NEW features you'll want to try..... (πŸ₯πŸ₯πŸ₯):

  1. npm (since v1.28): Now you can import npm packages directly! Originally, Deno had the deno.land/x/ public registry for its packages' code (i.e. hopefully code written specifically for Deno!). Now, you can also prefix your package dependency with npm: specifier, and you've unlocked thousands of more libraries to help crash your app. Just kidding! (mostly) Some libraries may still cause compat issues, YMMV.

  2. lint: Deno ships with a built-in linter! And it's really fast (~10x faster than eslint).

  3. fmt: Deno ships with a built-in formatter! It will auto-format .js, .jsx, .ts, .tsx, .md, and .json. It comes with minimal config options (ala prettier) and supports ignoring sections of your code with comment markers.

  4. compile: (Did I say 3? I meant 4!) Deno ships with a built-in compiler! That's right, go ahead and build your executable now without hunting down the latest-and-greatest lib from npm. You can compile binaries for various platforms by adding the --target CLI flag. Deno currently supports compiling to: Windows x64, macOS x64, macOS ARM and Linux x64.

Bonus: Check out the Fresh UI framework.

And there you have it! πŸŽ‰ If you haven't yet tried out Deno, I highly recommend you do. Especially if you have any experience with NodeJS, it's a small leap with potentially HUGE rewards. I bet you'll keep saying "sweeeet" under your breath like I did. Go forth, and enjoy coding!

You can follow me on Twitter and YouTube. Let’s continue interesting conversations about Sr JS development together!

Did you find this article valuable?

Support Steven Olsen by becoming a sponsor. Any amount is appreciated!

Β