Skip to content

Commit 8f33b74

Browse files
fix: allow scope to start with number (#87)
1 parent 5212ce7 commit 8f33b74

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export function logDebug(msg: string) {
1414
}
1515
}
1616

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

2020
export class JsrPackageNameError extends Error {}
2121

test/utils.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as path from "node:path";
33
import { runInTempDir } from "./test_utils";
44
import {
55
findProjectDir,
6+
JsrPackage,
67
PkgJson,
78
writeJson,
89
writeTextFile,
@@ -94,3 +95,10 @@ describe("findProjectDir", () => {
9495
});
9596
});
9697
});
98+
99+
describe("JsrPackage", () => {
100+
it("should allow scopes starting with a number", () => {
101+
JsrPackage.from("@0abc/foo");
102+
JsrPackage.from("@jsr/0abc__foo");
103+
});
104+
});

0 commit comments

Comments
 (0)