| 2276 | // a program without each module as the loaders after the plugin built it, |
| 2277 | // which it reads only once it wrote the program |
| 2278 | const withoutBuilt = ( |
| 2279 | program: ScannedProgram |
| 2280 | ): [program: ScannedProgram, built: Record<string, string>] => { |
| 2281 | const built: Record<string, string> = {} |
| 2282 | const modules: Record<string, ScannedModule> = {} |
| 2283 | for (const id in program.modules) { |
| 2284 | const { built: code, ...module } = program.modules[id] |
| 2285 | modules[id] = module |
| 2286 | if (code !== undefined) built[id] = code |
| 2287 | } |
| 2288 | return [{ ...program, modules }, built] |
| 2289 | } |
| 2290 | |
| 2291 | // each module a compilation's entries reach, as the plugin reads them |
| 2292 | const builtEntriesOf = ( |