MCPcopy
hub / github.com/vercel/next.js / getClientBuildManifestLoaderChunkUrlPath

Function getClientBuildManifestLoaderChunkUrlPath

test/lib/next-test-utils.ts:1374–1390  ·  view source on GitHub ↗
(
  dir: string,
  page: string
)

Source from the content-addressed store, hash-verified

1372}
1373
1374export function getClientBuildManifestLoaderChunkUrlPath(
1375 dir: string,
1376 page: string
1377) {
1378 let manifest = getClientBuildManifest(dir)
1379 let chunk: string[] | undefined = manifest[page]
1380 if (chunk == null) {
1381 throw new Error(`Couldn't find page "${page}" in _buildManifest.js`)
1382 }
1383 if (chunk.length !== 1) {
1384 throw new Error(
1385 `Expected a single chunk, but found ${chunk.length} for "${page}" in _buildManifest.js`
1386 )
1387 }
1388 // Remove leading './' so that this can be used in a `url.contains(chunk)` check.
1389 return encodeURI(chunk[0].replace(/^\.\//, ''))
1390}
1391
1392function runSuite(
1393 suiteName: string,

Callers 6

index.test.tsFile · 0.90
index.test.tsFile · 0.90
index.test.tsFile · 0.90
clientNavigationFunction · 0.90
didPrefetchFunction · 0.90
basepath.test.tsFile · 0.90

Calls 2

getClientBuildManifestFunction · 0.70
replaceMethod · 0.65

Tested by 2

clientNavigationFunction · 0.72
didPrefetchFunction · 0.72