4 ways Deno is different
from NodeJS
Brian LeRoux
CTO, Begin.com
- Web developer since
spacer.gif
and<BLINK/>
- Member of Apache and OpenJS foundations
A new JavaScript runtime ✨
Created by members of the original NodeJS core team with a fully clean slate based on V8 and Rust.
This is important to you because
JS evolves faster than Node.
And besides more tools for the toolbox is always helpful.
1. Secure by default
-
All code is sandboxed
Permission to network, env, disk and process is opt in
deno run -A myfile.js
This is important because
security is our job.
Opt in means we have to deal with the consequences of security up front rather than putting it on the backburner.
2. Comprehensive
-
Builtin authortime experience
Format, lint, bundle and test all first class
-
Builtin runtime experience
Runtime library and standard library cover vast majority of common use cases
deno lint --unstable myfile.js
This shed is still being painted… 💅🏾
deno fmt myfile.js
Antidote to Parkinson's law of triviality
deno test
A good overview here.
This is important to because
you are immediately productive.
No more debates about lint config, prettier config, test runner or assertion syntax. Just code.
Supported surface
This is important because we can build with confidence
there will be no unplanned work
due to breaking changes.
Focus on core business value instead of chasing dep fashion around.
3. Web spec standards
-
Yes, this includes ESMODULES
Modules are downloaded and cached first run. Same as npm except not manual!
-
The other big one:
fetch
No more server/client shims! Full browser interop is a goal.
-
Also excite: WASM
deno bundle https://denopkg.com/chiefbiiko/dynamodb/mod.ts
Yes, a builtin bundler!
deno cache --reload https://denopkg.com/chiefbiiko/dynamodb/mod.ts
Cache invalidation made easy?
Whats missing?
- Web crypto
- FileReader
- DOM (eg. HTMLElement)
This is important because the web is the most important
distribution channel in human history.
Focus on core business value instead of fixing brittle compiler chains.
4. Defacto standards
This statement is more perception than data based!
-
TypeScript
Compilation is completely transparent to the end user
-
JSX (TSX)
No compile step 🤯
This is important because TS requires maintenance
which can be handled by the runtime.
Focus on your code instead of tsconfig.json
.