MCPcopy Create free account
hub / github.com/arktypeio/arktype / planProgram

Method planProgram

ark/aot/precompile.ts:1763–1789  ·  view source on GitHub ↗
(program: ScannedProgram)

Source from the content-addressed store, hash-verified

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,

Callers 1

scanMethod · 0.95

Calls 9

isTransformedMethod · 0.95
importsArkMethod · 0.95
plannedRuntimeOfMethod · 0.95
writeUnprunedMessageFunction · 0.90
unprecompiledFunction · 0.90
pathOfMethod · 0.45
setMethod · 0.45
pushMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected