deno_registry2
deno_registry2 copied to clipboard
support semver
Like this https://dsr.edjopato.de/
Related: https://github.com/denoland/deno_website2/issues/606
(That issue is even linked at https://dsr.edjopato.de.)
I suppose https://deno.land/x/[email protected] would have the registry first look for a verbatim 1.x tag as per current resolution, and only if it doesn't exist would it get a list of tags that appear to be semver and choose the highest in the specified range.
For a syntax "spec", I think we should use cargo over npm. It's concise enough to implement exactly and keep as a reference, plus all of it is URL-friendly unlike the latter. I'm bringing these options up from the get-go because using cargo would mean never supporting 1.x in favour of only 1.* (which is great).
Also denoland/dotland#153
I'm not necessarily against this feature, but just to offer some counter-arguments:
What if a module uses something else than semver? I'm a fan of calver myself, or someone might want to use funky names for releases like Ubuntu. We'd have to make the semver resolution play nice with those, or accept that they're not first-class citizen on our registry.
There's also the case of content changing from the under one's feet. deno.land/x/foo@^1.2 might change from 1.2.0 to 1.2.3 and we go back to the "have you tried deleting your node_modules" except in this case it's gonna be "have you tried with --reload"
I have no opinions as to which spec to implement (cargo vs npm vs whatever), I'd need to research them a bit more, but one thing I am confident about is that we should send back redirects to the client rather than fetching the appropriate source and sending back the content directly, that'll play much nicer with the local cache.
I created a drop-in replacement of deno.land.
lib.deno.dev, https://github.com/tani/lib.deno.dev
// node-semver style
import abc from "https://lib.deno.dev/x/abc@~1.3/mod.ts"
import abc from "https://lib.deno.dev/x/abc@>=1.2/mod.ts"
import abc from "https://lib.deno.dev/x/abc@^1.2/mod.ts"
import abc from "https://lib.deno.dev/x/abc@1/mod.ts"
// weak semver style
import abc from "https://lib.deno.dev/x/abc@v1/mod.ts"
import abc from "https://lib.deno.dev/x/[email protected]/mod.ts"
import abc from "https://lib.deno.dev/x/[email protected]/mod.ts"
// ↓
import abc from "https://deno.land/x/[email protected]/mode.ts"
Closing in favour of denoland/website_feedback#1