State of Deno in 2022
如果无法正常显示,请先停止浏览器的去广告插件。
1. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
第
十
六
届
D
2 前
坛
端
技
术
论
State of Deno 2022
Bartek Iwańczuk
2. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
What is Deno?
What’s the state of Deno coming into 2022?
Contents The Deno company
目录 Deno Deploy
3. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
What is Deno?
4. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
- Deno is a new command-line runtime for JavaScript and TypeScript
- It aims to be fun and productive
- A good scripting platform is too useful of a tool to accept the status quo
5. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
- First introduced on 13th May, 2018 in “10 Things I Regret About Node.js” talk
- 1.0 was released on 13th May, 2020
- Currently at version 1.17
6. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
Feature highlights
- Deno is a single executable file
- It will always be distributed this way
- This single executable is all you need to run any Deno program
- Work on Linux, Mac and Windows
7. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
Feature highlights
- TypeScript support out of the box
- TypeScript compiler is part of the Deno binary, uses V8 snapshots
to start up the compiler quickly for type checking
- Transpilation, bundling and static analysis are done using SWC
(Rust based JS/TS parser)
8. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
Feature highlights
- Secure execution by default
- We want to enable people to run untrusted third part code
> deno run https://deno.land/std/examples/welcome.ts
Welcome to Deno ?
- To access disk, network or subprocesses the user must opt in
with command line flags:
—allow-read=/tmp
—allow-net=google.com
9. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
Feature highlights
- Link to third party modules using URLs - Not dependent on a centralised server
import { magenta } from “https://deno.land/std/fmt/colors.ts"; - The runtime fetches, caches and compile code transparently
- Simple, browser compatible module system.
No notion of node_modules or index.js
(not really, more on that later)
10. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
Feature highlights
Deno uses Web Standard APIs wherever possible.
If there’s an existing Web API that makes sense in the server
environment Deno uses it, instead of inventing proprietary APIs.
Deno uses Web Platform Tests to ensure compatibility.
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
fetch
Web Crypto
Web Streams
Web Workers
Web Storage
Web Sockets
AbortController
WebGPU
Blob
Location
EventTarget
TextEncoder
TextDecoder
onload,
prompt(), confirm(), alert()
many more...
11. Deno is listed on MDN’s compatibility tables
D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
12. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
Feature highlights
Deno includes whole JavaScript and TypeScript toolchain
in a single executable. Everything you need to kickstart
A project is already there.
SUBCOMMANDS:
bundle
cache
compile
completions
coverage
doc
eval
fmt
help
info
install
lint
lsp
repl
run
test
types
upgrade
Bundle module and dependencies into single file
Cache the dependencies
UNSTABLE: Compile the script into a self contained executable
Generate shell completions
Print coverage reports
Show documentation for a module
Eval script
Format source files
Prints this message or the help of the given subcommand(s)
Show info about cache or info related to source file
Install script as an executable
UNSTABLE: Lint source files
Start the language server
Read Eval Print Loop
Run a JavaScript or TypeScript program
Run tests
Print runtime TypeScript declarations
Upgrade deno executable to given version
13. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
Demo
-
-
-
-
import { magenta } from "https://deno.land/std/fmt/colors.ts";
const url = Deno.args[0];
let res = await fetch(url);
let server = res.headers.get("server")!;
console.log("server:", magenta(server));
Get URL from the first command line argument
Fetch URL
Get “Server” header
Print header to console (in magenta)
$ deno run --allow-net curl.ts https://postman.com
Server: nginx
$ deno run --allow-net curl.ts https://www.cloudflare.com
Server: cloudflare
$ deno run --allow-net curl.ts https://github.com
Server: GitHub.com
14. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
Taking advantage of many technologies
-
-
-
-
-
-
-
V8 (Chrome’s JavaScript VM)
Rust
TypeScript (Microsoft)
Tokio (async I/O framework for Rust)
SWC (JS/TS parser)
Rustls (TLS implementation)
Hyper and Reqwest (HTTP server and client libraries)
-
-
-
-
-
-
-
wpgu (WebGPU backend)
tungstenite (Websockets)
trust-dns (Async DNS queries)
rustyline (readline/REPL)
notify (file system notifications)
lspower (LSP framework for talking to IDEs)
dprint (code formatter)
15. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
What’s state of Deno coming into 2022?
16. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
What’s state of Deno coming into 2022?
- There’s one minor release and 2 to 4 patch releases every month (train model)
- There were 17 minor versions and close to 100 patch versions released since May 2020
- We will continue to focus on web compatibility, better TypeScript support, and security
- Standard library is seeing steady stream of updates and new APIs
17. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
Increasing adoption
Next generation data access API
https://next.github.com/projects/flat-data
18. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
Increasing adoption
Next generation development platform from Slack
https://api.slack.com/future
19. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
Increasing adoption
Jake Archibald
20. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
What’s state of Deno coming into 2022?
- Deno is production ready, but there are many opinions that it can’t be used because it’s too different from Node.js ecosystem
- In Autumn of 2021 we started a major effort of providing first-class Node.js compatibility (—compat mode)
- Steady progress over the last two months, currently working on major modules like: http, https, tls, zlib
- Aiming to achieve Node.js compatibility in Q2 of 2022
- Targeting wide frontend developers audience by providing compatibility with popular tools like Vite and Next.js
21. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
Some existing Node.js tools already work in —compat mode
22. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
The Deno company
23. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
The Deno company
- Deno remains free, MIT licensed
- Commercial offering with Deno Deploy
- 10 engineers and growing, including:
- Ryan Dahl
- Bert Belder
- Ben Noordhuis
- Kitson Kelly
- Luca Caponato
- David Sherret
24. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
Deno Deploy
25. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
Deno Deploy
https://deno.com/deploy
Deno Deploy is built using the same infrastructure as Deno CLI
26. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
Deno Deploy
https://deno.com/deploy
- Playgrounds for quick and fun prototyping
- Instant deployments across the world
- Can be embedded in webpages or shared via a link
27. Contributing to Deno
Contributions are welcome and much appreciated!
- Deno has already over 600 contributors!
- See https://deno.land/manual/contributing for the list of project you can contribute to.
D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
28. D2 前 端 技 术 论 坛
D 2 F R O N T E N D T E C H N O LO G Y F O R U M
Thank you!
Time for questions!
E-mail: bartek@deno.com
https://deno.land
https://deno.com