Deno
A secure runtime for JavaScript and TypeScript.
Deno aims to provide a productive and secure scripting environment for the modern programmer. It is built on top of V8, Rust, and TypeScript.
Please read the introduction for more specifics.
Category: Rust / Applications |
Watchers: 1.4k |
Star: 90.9k |
Fork: 5.1k |
Last update: Sep 27, 2023 |
A secure runtime for JavaScript and TypeScript.
Deno aims to provide a productive and secure scripting environment for the modern programmer. It is built on top of V8, Rust, and TypeScript.
Please read the introduction for more specifics.
求不要更新了,老子学不动了
I was wondering if there's any plan to support compiling deno scripts into a single executable?
I saw "Single executable" as a feature, but the code that follows seems to suggest it's deno as the single executable, not the programs executed with it.
It'd be awesome to support something like go build main.go
or something like zeit/pkg
.
Is supporting Vite on Deno's radar?
Although many Node.js libraries already work with Deno, Vite is a whole different beast and probably needs changes on Deno's side.
Note that it's not only about supporting Vite, but also its entire ecosystem (SvelteKit, vite-plugin-ssr, etc.).
FYI Bun is working on supporting Vite: https://github.com/oven-sh/bun/issues/250#issuecomment-1195153860.
Import from url is very hard to use. I think is not a good idea. If so,
Like C#\Java, the nuget and maven is good for use. Maybe use that mode can help us manage the packages.
Update April 15, 2020: Still go for May 13.
Update March 6, 2020: There's a difficult balance to be had between trying to get it right and shipping a usable product. The repository continues to see rapid development and we have yet to make substantial progress on the major missing feature: dev tool support. Therefore we are bumping the release date yet again. However instead of blindly estimating several weeks out, we've discussed it at length and decided 2 months would be enough time. This coincidentally is around the 2 year anniversary since the first commit. Therefore we are setting the date of May 13, 2020 as the 1.0 release date. Contributors are encouraged to get any major API changes in before April 20 - after that date we will be polishing and bug fixing. Of course the API will continue to evolve and improve after 1.0, but we will be making explicit stability guarantees for some interfaces.
Update Jan 27, 2020: Massive progress is being made, but we still have not yet accomplished the major feature blocker: devtool support. I hate to keep kicking the release date, but we're still looking at some weeks of development. We hope to ship a 1.0 build with stability promises towards end of February.
Update Dec 23, 2019: There is one major feature we lack that needs to be in 1.0 - that's a way to hook Deno up to Chrome DevTools. Implementing it has induced a rewrite of the bindings to V8 - that work is ongoing https://github.com/denoland/rusty_v8. We want to fork lift Deno onto that system before 1.0 happens. Current estimate for 1.0 is end of January.
[x] replace libdeno with rusty_v8 https://github.com/denoland/deno/issues/3530
[x] "deno --debug" https://github.com/denoland/deno/issues/1120 We need to be able to debug using Chrome Devtools. As the deno userland code base grows, it becomes in increasingly painful to work without a debugger. The way this will work is with a websocket server in Rust (port 9229) which forwards messages to V8 (using V8InspectorClient). https://github.com/denoland/deno/pull/4484
[x] Loading and execution of modules (either JS or TS) needs to be correct. This is the main thing we deliver actually, but there are still many bugs: source maps are sometimes incorrect https://github.com/denoland/deno/issues/2390, double downloads happen https://github.com/denoland/deno/issues/2442, the cache needs to be refactored https://github.com/denoland/deno/issues/2057.
[X] Import maps. It's a very reasonable standard and we can provide support via a command line flag. This allows bare imports. The feature will land very soon https://github.com/denoland/deno/pull/2360.
[x] Dynamic import. 50% complete at the time of writing. https://github.com/denoland/deno/issues/1789
[x] "deno test" test runner https://github.com/denoland/deno_std/issues/193
[x] "deno fmt" is slow on the first run. It download a couple of large prettier bundles. https://github.com/denoland/deno/issues/2490
[x] We need to support d.ts files https://github.com/denoland/deno/issues/1432
[X] "deno bundle" outputs a single AMD bundle of your program. This is useful to share code with websites. Early work has started: https://github.com/denoland/deno/pull/2467
[ ] "deno compile" is a very interesting feature to output an executable. It would be nice to have, but I would let this slip past 1.0. https://github.com/denoland/deno/issues/986 Not for 1.0
[x] "deno install" is a program that creates little shell script aliases to deno programs in your $PATH. This let's people distribute their code easily. https://github.com/denoland/deno_std/issues/471
[x] dlopen / plugins / extension modules. We need some way of calling into Rust land. The way Parcel does it is pretty awesome https://parceljs.org/rust.html - but we need low-level primitives to build that on, as we need to carefully funnel everything through the Op abstraction. @afinch7 has a working patch for loading ops in DLLs https://github.com/denoland/deno/pull/2385, we are still iterating on the exact API. I would allow a true FFI module to slip past 1.0 - we'll get there - but it needs to be built on ops. https://github.com/denoland/deno/pull/3372
[x] Support TLS https://github.com/denoland/deno/issues/3009
[ ] The web-server should be faster.
[X] When you visit a deno.land script url (example https://deno.land/std/http/server.ts) in a web browser, it should do better than redirect. It should look at the Accept header and serve pretty HTML. Solved in https://github.com/denoland/registry/commit/b78e6ae331004859aad7b01ed452f6b00265b035
[X] If you use "docs.deno.land" you will get auto-generated docs. https://github.com/denoland/deno/issues/3094 https://github.com/denoland/deno_website2/pull/49
[x] typescript dependencies are not loaded in parallel #2626 https://github.com/denoland/deno/issues/2994
[x] signal handlers https://github.com/denoland/deno/issues/2339 #3757
[X] fs events https://github.com/denoland/deno/issues/1826 #3452
[ ] TS and source maps are correctly recompiled https://github.com/denoland/deno/issues/2945
[x] Remove tokio_util::block_on https://github.com/denoland/deno/issues/2960
[x] "deno test" is slow (when running on std) https://github.com/denoland/deno/issues/2789
[x] deno lock file https://github.com/denoland/deno/issues/200
Do any major API renames.
import.meta
doesn't work with bundling on browsers. We need to come up with a different scheme for branching if the script is the main.Other minor bugs that are nevertheless blockers:
JS bundlers have a lot of complexity and we do not want to take on all that complexity in Deno. We believe this can be done effectively in "user space" - that is, it doesn't need to be built into the Deno executable. Packup is an example of a Deno program which utilizes esbuild-wasm to provide complex bundling abilities.
Ultimately we'd like to remove swc_bundler dependency completely completely from Deno.
This is required from BYONM.
Part of #18967
Hey, I am curious as to if deno test supports the environment variables? It seems that maybe it doesn't as my tests do not work when they rely on environment variables. Variables are just set in a .env file, should this work with tests?
This PR optimizes DOMException
constructor increasing performance of all Web APIs that throws a DOMException
(ie: AbortSignal
)
main
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.37.1 (x86_64-unknown-linux-gnu)
new DOMException() 9.66 µs/iter 103,476.8 (8.47 µs … 942.71 µs) 9.62 µs 11.29 µs 14.04 µs
abort writeTextFileSync 16.45 µs/iter 60,775.5 (13.65 µs … 1.33 ms) 16.39 µs 20.59 µs 24.12 µs
abort readFile 16.25 µs/iter 61,542.2 (15.12 µs … 621.14 µs) 16.18 µs 19.59 µs 22.33 µs
this PR
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.37.1 (x86_64-unknown-linux-gnu)
benchmark time (avg) iter/s (min … max) p75 p99 p995
----------------------------------------------------------------------------- -----------------------------
new DOMException() 2.37 µs/iter 421,657.0 (2.33 µs … 2.58 µs) 2.37 µs 2.58 µs 2.58 µs
abort writeTextFileSync 7.1 µs/iter 140,760.1 (6.94 µs … 7.68 µs) 7.13 µs 7.68 µs 7.68 µs
abort readFile 5.48 µs/iter 182,648.2 (5.3 µs … 5.69 µs) 5.56 µs 5.69 µs 5.69 µ
Deno.bench("new DOMException()", () => {
new DOMException();
});
Deno.bench("abort writeTextFileSync", () => {
const ac = new AbortController();
ac.abort();
try {
Deno.writeTextFileSync("/tmp/out", "x", { signal: ac.signal });
} catch {}
});
Deno.bench("abort readFile", async () => {
const ac = new AbortController();
ac.abort();
try {
await Deno.readFile("/tmp/out", { signal: ac.signal });
} catch {}
});
Will rebase following merge of #20710 in to main
.
Exposes metadata
to the Deno.jupyter.broadcast
API.
await Deno.jupyter.broadcast(msgType, content, metadata);
The metadata is required for "comm_open"
for with jupyter.widget
target. With this PR I can successfully communicate with the anywidget
frontend, sending frontend ESM via comms with updates :)
Make sure you have anywidget installed:
pip install jupyterlab anywidget
import { display } from "https://deno.land/x/display/mod.ts";
let comm_id = crypto.randomUUID();
await Deno.jupyter.broadcast("comm_open", {
"comm_id": comm_id,
"target_name": "jupyter.widget",
"data": {
"state": {
"_model_module": "anywidget",
"_model_name": "AnyModel",
"_model_module_version": "0.6.5",
"_view_module": "anywidget",
"_view_name": "AnyView",
"_view_module_version": "0.6.5",
"_view_count": null,
}
}
}, {
"version": "2.1.0"
});
// Create an anywidget module (export a "render" function) for the front end
// The `model` is synchronized with `update` messages sent from the comm_msg
let esm = `export ${async function render({ model, el }) {
let { default: confetti } = await import ("https://esm.sh/[email protected]");
model.on("change:value", () => confetti({ angle: model.get("value") }));
confetti();
}.toString()}`;
// Send initial widget state
await Deno.jupyter.broadcast("comm_msg", {
"comm_id": comm_id,
"data": { "method": "update", "state": { "_esm": esm, "_anywidget_id": comm_id } }
});
display({
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 1,
"model_id": comm_id,
}
})
await Deno.jupyter.broadcast("comm_msg", {
"comm_id": comm_id,
"data": { "method": "update", "state": { "value": 50 } },
});
await new Promise(resolve => setTimeout(resolve, 1000));
await Deno.jupyter.broadcast("comm_msg", {
"comm_id": comm_id,
"data": { "method": "update", "state": { "value": 100 } },
});
await new Promise(resolve => setTimeout(resolve, 1000));
This is sooo cool!!
https://github.com/denoland/deno/assets/24403730/cebeeb7a-3be5-4e95-bdd5-5ebab864b647