| 25 | ) |
| 26 | |
| 27 | async function readFilesNext( |
| 28 | next: NextInstance |
| 29 | ): Promise<Map<string, Map<string, string>>> { |
| 30 | // These are cosmetic files which aren't deployed. |
| 31 | const IGNORE = /^trace$|^trace-build$/ |
| 32 | |
| 33 | const files = ( |
| 34 | (await glob('**/*', { |
| 35 | cwd: path.join(next.testDir, next.distDir), |
| 36 | nodir: true, |
| 37 | dot: true, |
| 38 | })) as string[] |
| 39 | ) |
| 40 | .filter((f) => !IGNORE.test(f) && !IGNORE_CONTENT_NEXT_REGEX.test(f)) |
| 41 | .sort() |
| 42 | |
| 43 | return new Map([ |
| 44 | [ |
| 45 | 'next', |
| 46 | new Map( |
| 47 | await Promise.all( |
| 48 | files.map(async (f) => { |
| 49 | const content = await next.readFile(path.join(next.distDir, f)) |
| 50 | return [f, content] as const |
| 51 | }) |
| 52 | ) |
| 53 | ), |
| 54 | ], |
| 55 | ]) |
| 56 | } |
| 57 | |
| 58 | async function readFilesBuilder( |
| 59 | next: NextInstance |