Features
- x9_root - this can be implemented as a macro
Plan
- Analyze file and add markers
- Instrumentation
- Wrap top-level class declarations in IIFEs so static props and decorators don't break down tree-shaking.
- Must run before: TreeShaking
- Make top-level declarations lazy
- This transform doesn't "add" or "remove" anything.
- Must run after:
Transformers
- removeUnusedTopLevelBlocks(focusedBlock?: Location)
- searches for top level blocks (test, playground)
- replacePrevalExpressionsWithPlaceholders()
- replaceSolvedPrevalExpressionsWithOutputAST()
- instrumentTopLevelTestBlocks()
- instrument()
- instruments
console.log
- instrument
//?
- instrument expressions in block playgrounds
- insertConvertCalls
- needs Program
- replaces
x9.convert<A>(b)
with call to conversion function (if any)
- removeDeadCode()
- we should do this often because we don’t want to run more macros than we need to
Bundling for slices
- for “slice” builds (run playground, tests, etc) use esbuild with an esbuild plugin, from the plugin we can call ts-transformers