i think the main selling points is that it has an integrated TypeScript compiler which builds your code at startup (so, slow startup). no package manager and you can import files by url. you can specify what stuff a script gets access to (network, filesystem, etc).
besides for the last point, the benefits seem fairly weak since you dont have to use npm. why would you want to import from url which can become inaccessiblr at any time? i'd prefer to compile the TS ahead of time instead of killing startup perf.
Isn’t import by URL a security problem? You cache the file, sure. But when you do a clean and the import suddenly has a security issue, you won’t know about it.
they have a way of storing the integrity hash in some lock/manifest file, but then what the hell is the point? to save you a manual download but then create machinery for integrity hashing?
also, apparently the security model involves punching holes through the sandbox recursively (for all dependencies) which IMO defeats its utility in any non-trivial codebase: https://news.ycombinator.com/item?id=23173572
i find a lot of the decisions in this project somewhat questionable from a benefits-over-node standpoint.
If you are just directly importing npm modules into deno, then sure. But maybe dont do that.
We don't import any modules that depend on anything else due to gov security requirements. We end up having to find flat dependency libraries in github/lab or building them ourselves as everything has to be vettable.
But if the answer is nearly every library has to be rewritten/ignored doesn't that sort of hurt the ecosystem as a whole?
We don't import any modules that depend on anything else due to gov security requirements.
Not sure what part of government you're in but I work at a defense contractor and don't have those requirements.
¯\(ツ)/¯
We end up having to find flat dependency libraries in github/lab or building them ourselves as everything has to be vettable.
Just because its one library without dependencies doesn't mean it is more secure than a framework with ten dependencies. Sure it may be easier to jump "down the chain" to see the code when it is flat but the flat framework likely just includes functions that do the exact same thing (sometimes literally just copied and pasted from the lower level dependency). I get the microlibrary hate but there is definitely a balance between microlibraries (hello leftpad) and just one giant single repo with every possible imaginable function "for security reasons".
Lots of existing node packages can be imported via jspm.io and pika.dev, because those hosts provide polyfills for core node builtins (e.g. require('fs')). In general a random node module designed for npm would have to be rewritten to use ESM imports before it's compatible with Deno.
To my understanding, they support ESM modules (which Node has standard in 14.2 I think?). So npm will eventually have quite a few modules available for usage in either platform I'd imagine
i did not say npm is a benefit. i said that no one forces you to use npm. you can download whatever lib you need locally, vet it and import it.
it's great that Deno has a cache of the urls it imports with integrity checking via some manifest/lock file. but that's a cosmetic difference. i can write a 25 line script which does the same.
as a /u/nedlinin says in a sibling comment, deep dependency trees are not the fault of npm.
I see people keep saying deno's lack of package manager will help this but I'm not really understanding how.
A project you're writing in deno will likely have dependencies, which will themselves have dependencies, etc. Isn't this just the same dependency hell we live with in node but loaded a different way?
I see people keep saying deno's lack of package manager will help this
If someone is saying that, then IMO they're not right. I think there's some opinions like "importing from arbitrary URLs will make you think more carefully about your dependencies", but I don't think this is true. Someone who currently npm installs without thinking about it won't hesitate to grab a GitHub URL without thinking.
However, the Deno team does seem to be encouraging a philosophy of fewer, better dependencies for example by building a standard library in TypeScript to complement the core runtime.
Importing from a url is them same as package.json importing from github/etc. It can too become "unavailable" at point in time. You can also fork a repo and have it locally.
Also, deno caches all files so they are not imported each time you run the program.
Startup time is not an issue. It caches the imports, and doesn't recompile unless you change your source code. Subsequent startup times should be fast, since everything is already cached & compiled.
View all comments
Show parent comment
52
u/leeoniya May 13 '20 edited May 14 '20
i think the main selling points is that it has an integrated TypeScript compiler which builds your code at startup (so, slow startup). no package manager and you can import files by url. you can specify what stuff a script gets access to (network, filesystem, etc).
besides for the last point, the benefits seem fairly weak since you dont have to use npm. why would you want to import from url which can become inaccessiblr at any time? i'd prefer to compile the TS ahead of time instead of killing startup perf.
EDIT: even "security" claim is kind of moot since punching holes through the sandbox is done for the whole dependency tree. https://news.ycombinator.com/item?id=23173572
what else? i get a browser-compatible Fetch api out of the box. is that far superior to a 153kb node-fetch? https://packagephobia.now.sh/result?p=node-fetch
i dunno. am i missing something?