Skip to content

Commit

Permalink
fix: allow scope to start with number
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister committed Jul 5, 2024
1 parent 5212ce7 commit 15f6fe0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export function logDebug(msg: string) {
}
}

const EXTRACT_REG = /^@([a-z][a-z0-9-]+)\/([a-z0-9-]+)(@(.+))?$/;
const EXTRACT_REG_PROXY = /^@jsr\/([a-z][a-z0-9-]+)__([a-z0-9-]+)(@(.+))?$/;
const EXTRACT_REG = /^@([a-z0-9-]+)\/([a-z0-9-]+)(@(.+))?$/;
const EXTRACT_REG_PROXY = /^@jsr\/([a-z0-9-]+)__([a-z0-9-]+)(@(.+))?$/;

export class JsrPackageNameError extends Error {}

Expand Down
8 changes: 8 additions & 0 deletions test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as path from "node:path";
import { runInTempDir } from "./test_utils";
import {
findProjectDir,
JsrPackage,
PkgJson,
writeJson,
writeTextFile,
Expand Down Expand Up @@ -94,3 +95,10 @@ describe("findProjectDir", () => {
});
});
});

describe("JsrPackage", () => {
it("should allow scopes starting with a number", () => {
JsrPackage.from("@0abc/foo");
JsrPackage.from("@jsr/0abc__foo");
});
});

0 comments on commit 15f6fe0

Please sign in to comment.