Skip to content

Commit d0ddfa6

Browse files
authored
Merge pull request #75 from 4513ECHO/feat/pax.deno.dev
Feat: Add support for pax.deno.dev
2 parents 19adffa + 196ab35 commit d0ddfa6

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ udd supports the following registry domains:
114114
- https://gitlab.com/:user/:repo/-/raw
115115
- https://cdn.jsdelivr.net
116116
- https://x.nest.land
117+
- https://pax.deno.dev
117118

118119
_Create an issue to request additional registries._
119120

registry.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,37 @@ export class Denopkg implements RegistryUrl {
299299
regexp = /https?:\/\/denopkg.com\/[^\/\"\']*?\/[^\/\"\']*?\@[^\'\"]*/;
300300
}
301301

302+
export class PaxDenoDev implements RegistryUrl {
303+
url: string;
304+
305+
owner(): string {
306+
return this.url.split("/")[3];
307+
}
308+
309+
repo(): string {
310+
return defaultName(this);
311+
}
312+
313+
constructor(url: string) {
314+
this.url = url;
315+
}
316+
317+
async all(): Promise<string[]> {
318+
return await githubReleases(this.owner(), this.repo());
319+
}
320+
321+
at(version: string): RegistryUrl {
322+
const url = defaultAt(this, version);
323+
return new PaxDenoDev(url);
324+
}
325+
326+
version(): string {
327+
return defaultVersion(this);
328+
}
329+
330+
regexp = /https?:\/\/pax.deno.dev\/[^\/\"\']*?\/[^\/\"\']*?\@[^\'\"]*/;
331+
}
332+
302333
export class PikaScope implements RegistryUrl {
303334
url: string;
304335

@@ -667,6 +698,7 @@ export const REGISTRIES = [
667698
UnpkgScope,
668699
Unpkg,
669700
Denopkg,
701+
PaxDenoDev,
670702
Jspm,
671703
PikaScope,
672704
Pika,

registry_test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ Deno.test("registryDenopkg", () => {
6060
assertEquals(vAt.url, "https://denopkg.com/bar/foo@0.2.0/foo.ts");
6161
});
6262

63+
Deno.test("registryPaxDenoDev", () => {
64+
const url = "https://pax.deno.dev/bar/foo@0.1.0/foo.ts";
65+
const v = lookup(url, REGISTRIES);
66+
assert(v !== undefined);
67+
68+
const vAt = v.at("0.2.0");
69+
assertEquals(vAt.url, "https://pax.deno.dev/bar/foo@0.2.0/foo.ts");
70+
});
71+
6372
Deno.test("registryJspm", () => {
6473
const url = "https://dev.jspm.io/npm:foo@0.1.0/";
6574
const v = lookup(url, REGISTRIES);

0 commit comments

Comments
 (0)