MCPcopy
hub / github.com/vitejs/vite / getDepJs

Function getDepJs

playground/js-sourcemap/__tests__/js-sourcemap.spec.ts:25–38  ·  view source on GitHub ↗
(entry: string, depIdFragment: string)

Source from the content-addressed store, hash-verified

23}
24
25async function getDepJs(entry: string, depIdFragment: string) {
26 const res = await page.request.get(new URL(entry, page.url()).href)
27 const js = await res.text()
28 const depUrlMatch = js.match(
29 new RegExp(`from\\s+"([^"]*${depIdFragment}[^"]*)"`),
30 )
31 expect(depUrlMatch).toBeTruthy()
32
33 const depUrl = depUrlMatch![1]
34 expect(depUrl).toContain('/deps/')
35
36 const depRes = await page.request.get(new URL(depUrl, page.url()).href)
37 return depRes.text()
38}
39
40function expectConsoleLogArgumentMapsToOriginalX(
41 depJs: string,

Callers 1

Calls 3

urlMethod · 0.80
textMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected