Skip to content

Commit 0ab04e4

Browse files
committed
Improve jsr support from homepage
1 parent b4591d2 commit 0ab04e4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/resolve.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export async function findModuleSlug(modUrl: string) {
1414
return `https/raw.githubusercontent.com/${owner}/${repo}/${ref}/${path.join('/') || 'deps.ts'}`;
1515
}
1616
}
17+
// convert jsr URLs into jsr specifiers
18+
if (url.host === 'jsr.io') {
19+
return `jsr/${url.pathname.slice(1)}`;
20+
}
1721

1822
return `${url.protocol.slice(0, -1)}/${url.host}${url.pathname}`;
1923
}

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ <h2>
6868
<form id="dependencies-of" action="/dependencies-of/" method="GET"
6969
style="display: flex; flex-direction: row;">
7070
<input type="url" name="url" class="url" required autofocus style="flex: 1;"
71-
placeholder="Module URL (e.g. https://deno.land/x/opine/mod.ts)" pattern="https://.+" />
71+
placeholder="Module URL (e.g. https://deno.land/x/opine/mod.ts, jsr:@dbushell/http-tunnel)" pattern="https://.+|jsr:.+" />
7272
<button type="submit">Visualize!</button>
7373
</form>
7474

0 commit comments

Comments
 (0)