deno-udd
deno-udd copied to clipboard
Extra suffix slash
When updating module from esm.sh
import confetti from "https://esm.sh/[email protected]";
UDD turns it into
import confetti from "https://esm.sh/[email protected]/";
It's a convention to not include extra slash and it's not just cosmetic, it actually invalidates the cache, as Deno will keep separate copies for both [email protected] and [email protected]/

cc @takker99 .
Is this the case for all "scoped" urls?
I see in tests that suffix slash is always created for paths that don't end with extension. There shouldn't be any assumptions about the final string, only the version portion from original string needs to be changed (applies to all registries). For example this test needs to pass, but currently doesn't and even output may be different than expected because of missing pin (esm.sh engine version).
Deno.test("registryEsmShPinned", () => {
const url = "https://esm.sh/[email protected]?pin=63";
const v = lookup(url, REGISTRIES);
assert(v !== undefined);
const vAt = v.at("0.2.0");
assertEquals(vAt.url, "https://esm.sh/[email protected]?pin=63");
});
[Diff] Actual / Expected
- "https://esm.sh/[email protected]/"
+ "https://esm.sh/[email protected]?pin=63"
@hayd any update on this? A slash is still being added, which results in errors.
{
"imports": {
"twind": "https://esm.sh/[email protected]",
"twind/": "https://esm.sh/[email protected]/"
// after
"twind": "https://esm.sh/[email protected]/",
"twind/": "https://esm.sh/[email protected]//"
}
}