(program: ScannedProgram)
| 1761 | |
| 1762 | // what each module would read, before any writes a validator, or why one fails to precompile |
| 1763 | private planProgram(program: ScannedProgram): ProgramPlan | string { |
| 1764 | const plan: ProgramPlan = { |
| 1765 | sources: {}, |
| 1766 | planned: new Map(), |
| 1767 | precompiled: [] |
| 1768 | } |
| 1769 | for (const id in program.modules) { |
| 1770 | const { source, transformed, mappings } = program.modules[id] |
| 1771 | plan.sources[id] = source |
| 1772 | if ( |
| 1773 | transformed && |
| 1774 | this.isTransformed(id) && |
| 1775 | this.importsArk(source, id) |
| 1776 | ) { |
| 1777 | const runtime = this.plannedRuntimeOf(source, id, mappings) |
| 1778 | // a bundle building the module as read fails, reporting why |
| 1779 | if (!runtime) { |
| 1780 | return writeUnprunedMessage( |
| 1781 | `${this.graph.pathOf(id)} fails to precompile` |
| 1782 | ) |
| 1783 | } |
| 1784 | plan.planned.set(id, runtime) |
| 1785 | plan.precompiled.push(id) |
| 1786 | } else plan.planned.set(id, unprecompiled(this.graph.add(id, source))) |
| 1787 | } |
| 1788 | return plan |
| 1789 | } |
| 1790 | |
| 1791 | private writeProgram( |
| 1792 | program: ScannedProgram, |
no test coverage detected