diff --git a/src/utils.ts b/src/utils.ts index a83fcb0..2c6670d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -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 {} diff --git a/test/utils.test.ts b/test/utils.test.ts index 74f7488..9e712ef 100644 --- a/test/utils.test.ts +++ b/test/utils.test.ts @@ -3,6 +3,7 @@ import * as path from "node:path"; import { runInTempDir } from "./test_utils"; import { findProjectDir, + JsrPackage, PkgJson, writeJson, writeTextFile, @@ -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"); + }); +});