Skip to content

Commit 93d819f

Browse files
committed
fix
1 parent c3ce8b0 commit 93d819f

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

core/utils/cdn.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,13 @@ export function isFromCdn(specifier: string): boolean {
5454
}
5555

5656
export function getFile(specifier: string): string {
57-
const result = parseNpm(specifier) || parseGh(specifier);
58-
if (!result) {
57+
if (specifier.startsWith("npm:")) {
58+
return specifier.replace("npm:", "https://cdn.jsdelivr.net/npm/");
59+
} else if (specifier.startsWith("gh:")) {
60+
return specifier.replace("gh:", "https://cdn.jsdelivr.net/gh/");
61+
} else {
5962
throw new Error(`Invalid specifier: ${specifier}`);
6063
}
61-
62-
const [type, name, version, filename] = result;
63-
64-
if (filename.includes("*")) {
65-
throw new Error(`Specifier must not contain glob pattern: ${specifier}`);
66-
}
67-
68-
return `https://cdn.jsdelivr.net/${type}/${name}@${version}${filename}`;
6964
}
7065

7166
export async function getVersion(

0 commit comments

Comments
 (0)