forked from esm-dev/esm.sh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix module path with "/v135/*PKG/" (esm-dev#1044)
- Loading branch information
Showing
3 changed files
with
66 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,6 +72,19 @@ Deno.test("legacy routes", async () => { | |
assertEquals(res.headers.get("X-TypeScript-Types"), "http://localhost:8080/v135/@types/react-dom@~18.3/index.d.ts"); | ||
assertStringIncludes(await res.text(), "/v135/[email protected]/es2022/react-dom.development.mjs"); | ||
} | ||
{ | ||
const res = await fetch("http://localhost:8080/react-dom@18&pin=v135&dev", { | ||
redirect: "manual", | ||
headers: { | ||
"User-Agent": | ||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36", | ||
}, | ||
}); | ||
res.body?.cancel(); | ||
assertEquals(res.status, 302); | ||
assert(res.headers.get("Location")?.startsWith("http://localhost:8080/react-dom@18.")); | ||
assert(res.headers.get("Location")?.endsWith("&pin=v135&dev")); | ||
} | ||
{ | ||
const res = await fetch("http://localhost:8080/[email protected]/client?pin=v135", { | ||
headers: { | ||
|
@@ -136,6 +149,29 @@ Deno.test("legacy routes", async () => { | |
assert(res.headers.get("Location")?.startsWith("http://localhost:8080/v135/@emotion/sheet@")); | ||
assert(res.headers.get("Location")?.endsWith("?external=react,react-dom")); | ||
} | ||
{ | ||
const res = await fetch("http://localhost:8080/v135/[email protected]/client?external=*"); | ||
assertEquals(res.status, 200); | ||
assertStringIncludes(await res.text(), "/v135/[email protected]/X-ZS8q/denonext/client.js"); | ||
} | ||
{ | ||
const res = await fetch("http://localhost:8080/*[email protected]/client?pin=v135"); | ||
assertEquals(res.status, 200); | ||
assertStringIncludes(await res.text(), "/v135/[email protected]/X-ZS8q/denonext/client.js"); | ||
} | ||
{ | ||
const res = await fetch("http://localhost:8080/v135/*[email protected]/client"); | ||
assertEquals(res.status, 200); | ||
assertStringIncludes(await res.text(), "/v135/[email protected]/X-ZS8q/denonext/client.js"); | ||
} | ||
{ | ||
const res = await fetch("http://localhost:8080/v135/*react-dom@19/client", { | ||
redirect: "manual", | ||
}); | ||
res.body?.cancel(); | ||
assertEquals(res.status, 302); | ||
assert(res.headers.get("Location")?.startsWith("http://localhost:8080/v135/*react-dom@19.")); | ||
} | ||
{ | ||
const res = await fetch("http://localhost:8080/v135/@types/react-dom@~18.3/index.d.ts", { | ||
redirect: "manual", | ||
|