| 1372 | } |
| 1373 | |
| 1374 | export 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 | |
| 1392 | function runSuite( |
| 1393 | suiteName: string, |