jsr-io / jsr

The open-source package registry for modern JavaScript and TypeScript
https://jsr.io
MIT License
2.44k stars 107 forks source link

jsr generates faulty import/export urls when using submodules #400

Closed Hexagon closed 6 months ago

Hexagon commented 6 months ago

With deno.json:

{
   "imports": {
       "@hexagon/bundlee": "jsr:@hexagon/bundlee@^0.9.6"
   }
}

Permalink -> https://github.com/Hexagon/pup/blob/7d06bb367dcbc6f3321bbc93cef5bed4b95271db/deno.json#L43

pup/plugins/web-interface/deps.ts

export { Bundlee } from "@hexagon/bundlee/mod.ts"

Permalink -> https://github.com/Hexagon/pup/blob/7d06bb367dcbc6f3321bbc93cef5bed4b95271db/plugins/web-interface/deps.ts#L3

Is transpiled to the following on jsr.io (notice the extra slash before @):

export { Bundlee } from "jsr:/@hexagon/bundlee@^0.9.6/mod.ts"

Permalink > https://jsr.io/@pup/pup/1.0.0-rc.24/plugins/web-interface/deps.ts#L3

The same thing happened here https://jsr.io/@hexagon/bundlee/0.9.5/mod.ts#L3, which were later worked around by specifying the full path to base64url submodule in deno.json, like:

{
   "imports": {
       "@std/encoding/base64url": "jsr:@std/encoding@^0.223.0/base64url",
   }
}
lucacasonato commented 6 months ago

That slash is actually fine - jsr: and jsr:/ are equivalent :)

The same also applies to npm: and npm:/.

Hexagon commented 6 months ago

Oh, but keep this open, the reason i reacted was that something failed. I'll check what it was asap.

Hexagon commented 6 months ago

Ehm, can't reproduce this now. I'll get back if I manage to figure out what was going wrong :)