Hacker News new | ask | show | jobs
by simonw 1021 days ago
What syntax would you suggest for importing a specific version of a library?
1 comments

import ... from "dino@1.1/utils"

idk i just think there's many options besides a full url in your code

In Deno you can load your code from any URL on the Internet, instead of relying on a namespace within a single package manager.
Unfortunately, having a URL is only the beginning. After that it gets complicated, because the "source" you get by following a URL in Deno (or a web browser) has often been put through the blender, repackaged and minified by some CDN. It's hard to read and VS Code's debugger doesn't handle it well. Sometimes I'm left just looking at type definitions and it's unclear where the source code for the implementation is at all. Aren't source maps supposed to help here?

So, I look at the repo instead, but now I don't know how it matches up with the code I'm actually running.

I find Go modules to be easier to understand. They are similarly distributed (many source repos will work), but when you navigate to the source code, you get the actual source.

Yes, people do all kinds of things to their code, but this makes it possible for you to download your own.