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: JavaScript / Miscellaneous |
Watchers: 1.5k |
Star: 87.6k |
Fork: 4.7k |
Last update: Feb 1, 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
.
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:
Okay, this project looks really interesting so far. While watching the talk I just noticed one thing that might be a problem for some developers. That's just allowing imports with relative path's (besides URLs). There are a lot of questions on the internet on how one can import a file in TS/Webpack/whatever relative to the project root. With relative paths people will end up with things like import { foo } from '../../../../modules/featureA/foo.ts'
. Or was it just ../../../modules/...
? What if I move my files around? Yes, you have to update your imports anyway. But figuring out how many directories you have to go up is a very tedious task on its own.
In the talk, you/Ryan talked about browser compatibility. I haven't tried out ES modules in the browser just yet. But I'm pretty sure it also supports absolute paths. Absolute in that context means relative to the web root. It would be really handy if we were able to just write import { foo } from '/modules/featureA/foo.ts'
.
Of course, now there's the question: What is the root directory of a deno application? The only thing that makes sense to me right now is the folder that contains the entry file ‒ basically what process.cwd()
is in node. But I also think it's fine to place the entry file in the most top-level directory of the project, isn't it?
Or is there any problem about absolute paths I didn't think about so far? What do you think about that?
Originally posted by kitsonk November 30, 2020
Instead of --no-check
consider type checking TypeScript as an opt-in with a --check
option.
The core team has discussed this and reviewed the feedback from the community. Based on that, we are going to move forward with the following:
--check
flag will be implemented for the appropriate subcommands. This will use the built-in tsc
for type checking and use tsc
for the emit (except for bundles where we will use swc
). We may in the future use swc
for the emit here as well. This is basically the current default behaviour of Deno.--no-check
flag will be deprecated and issue a warning that it is deprecated. The behaviour will not change from its current for now.swc
(this is basically the behaviour of --no-check
now).We will raise the PRs necessary to implement this and tentatively aim to introduce this in 1.13.
The goal of the Deno CLI is to be a fun and productive scripting language. A user should be able to hack on some code and quickly see the results of their endeavour. The more "hurdles" that are in the way, the less fun and productive the experience becomes. We ❤️ TypeScript, we want people to use TypeScript more and more, but there are two major challenges with that:
--no-check
takes under 100ms.While on the surface it might seem like we are "watering" down Deno, we are motivated to make it easier to use Deno. If you are just starting out, maybe not having used TypeScript in strict mode before, or are just trying to hack a few lines of TypeScript and don't have all of your type annotations right, or you have imported a 3rd party library whose globals conflict with another 3rd party library, you have to spend all your time sorting that out to just find out if your code runs. Again, that isn't fun for anyone and certainly isn't productive.
Also, we have tried to put a lot of effort into the language server, and realistically that is where most people type check their code anyways, in their editor, which means to the majority of people type checking is not the default need they have when running on the command line. It is something they need as a final check, maybe in their CI, maybe before they commit, not every time they want to see if the code runs.
So, we acknowledge that in the discussion there wasn't overwhelming broad support for this, but we think we need to do this not for those already using Deno on a daily basis, but for those experimenting with Deno and TypeScript.
Would like some scripts and documentation on how to deploy to AWS Lambda, Serverless, GCloud functions, Azure Functions, etc.
This change will enable dynamic imports and web workers to use modules not reachable from the main module, by passing a list of extra side module roots as options to deno compile
.
This PR builds on top of #17657, which adds support for web workers to deno compile
.
The option name --extra-side-modules
is up for bikeshedding, as well as the exact way to specify such list of modules. I suspect this list could be added to deno.json
.
Hello guys,
I would like to propose a new rule or to modify the existing one for lineWidth
to allow imports to be preserved to a single line.
dprint
eslint
"lineWidth": [
{
"width": 80,
"ignorePattern": "^import"
}
]
I understand no-one wants to add new rules or configs to an opinionated formatter, but this doesn't need to be a new rule necessarily.
This PR removes the UNSTABLE
mentions from the CLI docs for deno test --coverage/doc/shuffle
.
Fixes https://github.com/denoland/deno/issues/17659.
The CLI docs for deno test
have three flags still listed as unstable: --coverage
, --doc
, and --shuffle
. All of these have been around for quite some time and they seem to be working well, so perhaps they could be stabilized?
if (false) {
await import("https://deno.land/[email protected]/node/module.ts")
}
> % deno run foo.js
⚠️ ┌ Deno requests net access to "deno.land".
├ Requested by `import()` API
├ Run again with --allow-net to bypass this prompt.
└ Allow? [y/n] (y = yes, allow; n = no, deny) >
I feel like it's only supposed to request access the moment the await import()
is called, or am I missing something?
For the moment a workaround is to keep the import specifier in a separate variable:
if (false) {
const str = "https://deno.land/[email protected]/node/module.ts";
const mod = await import(str);
}
But this removes type safety and turns mod
into any
.
When running the following code from a node module, an error occurs:
require.resolve('anything', {paths:['any path']})
Error: Empty filepath.
at pathDirname (deno:ext/node/02_require.js:50:13)
at new Module (deno:ext/node/02_require.js:257:17)
at Function.Module._resolveFilename (deno:ext/node/02_require.js:566:30)
at Function.resolve (deno:ext/node/02_require.js:824:21)
This is caused by using an empty string for the fake package's id:
https://github.com/denoland/deno/blob/a09296322e1fd4451e903515a497d9e02e14ace6/ext/node/02_require.js#L566
while at the same time enforcing package id to be non-empty:
https://github.com/denoland/deno/blob/a09296322e1fd4451e903515a497d9e02e14ace6/ext/node/02_require.js#L48-L51
Since the fake package is only used for package resolution and its id and path are not used anywhere, I just filled it with "fake-module"
and the above error is gone.
Related issue: https://github.com/denoland/deno/issues/17175 https://github.com/denoland/deno/issues/17176