Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Extra suffix slash #58

Open
Xeevis opened this issue Jan 23, 2022 · 3 comments
Open

Extra suffix slash #58

Xeevis opened this issue Jan 23, 2022 · 3 comments

Comments

@Xeevis
Copy link
Contributor

Xeevis commented Jan 23, 2022

When updating module from esm.sh

import confetti from "https://esm.sh/canvas-confetti@1.3.0";

UDD turns it into

import confetti from "https://esm.sh/canvas-confetti@1.4.0/";

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 canvas-confetti@1.4.0 and canvas-confetti@1.4.0/

image

@hayd
Copy link
Owner

hayd commented Jan 23, 2022

cc @takker99 .

Is this the case for all "scoped" urls?

@Xeevis
Copy link
Contributor Author

Xeevis commented Jan 25, 2022

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/foo@0.1.0?pin=63";
  const v = lookup(url, REGISTRIES);
  assert(v !== undefined);

  const vAt = v.at("0.2.0");
  assertEquals(vAt.url, "https://esm.sh/foo@0.2.0?pin=63");
});
    [Diff] Actual / Expected

-   "https://esm.sh/foo@0.2.0/"
+   "https://esm.sh/foo@0.2.0?pin=63"

@omar2205
Copy link

@hayd any update on this? A slash is still being added, which results in errors.

{
  "imports": {
    "twind": "https://esm.sh/twind@0.16.17",
    "twind/": "https://esm.sh/twind@0.16.17/"
    // after
    "twind": "https://esm.sh/twind@1.0.0-next.38/",
    "twind/": "https://esm.sh/twind@1.0.0-next.38//"
  }
}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants