Skip to content

Commit

Permalink
Merge pull request #98 from oscarotero/master
Browse files Browse the repository at this point in the history
fixed npm regexp
  • Loading branch information
hayd authored Nov 30, 2022
2 parents cc15788 + 414c226 commit 37b9d11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class Npm implements RegistryUrl {
return version;
}

regexp = /npm:(\@[^/]+\/[^@/]+|[^@/]+)(?:\@([^/]+))?[^\'\"]/;
regexp = /npm:(\@[^/]+\/[^@/]+|[^@/]+)(?:\@([^\/\"\']+))?[^\'\"]/;
}

async function unpkgVersions(name: string): Promise<string[]> {
Expand Down
4 changes: 4 additions & 0 deletions search_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Deno.test("denolandImports", () => {
const expected = [
"https://deno.land/std@0.35.0/foo.ts",
"https://deno.land/x/foo@0.35.0/foo.ts",
"npm:preact@10.11.2",
"npm:preact@10.11.2/",
];
// const ts = `
// import { foo } from "${expected[0]}";
Expand All @@ -14,6 +16,8 @@ Deno.test("denolandImports", () => {
const ts = `
import { foo } from "https://deno.land/std@0.35.0/foo.ts";
import { bar } from "https://deno.land/x/foo@0.35.0/foo.ts";
export * as preact from "npm:preact@10.11.2";
export * as hooks from "npm:preact@10.11.2/hooks";
`;

const urls = importUrls(ts, REGISTRIES);
Expand Down

0 comments on commit 37b9d11

Please sign in to comment.