> Utility functions for reflection on TS files. Mainly for use as a Bun macro to do some meta programming.
npm install @multirepo/mirror> Utility functions for reflection on TS files. Mainly for use as a Bun macro to do some meta programming.
We can use it as a Bun plugin or a macro. See src/example.ts.
```
bun --preload preload.ts
__preload.ts__
`
import {plugin} from 'bun'
import {bunPluginLive} from '@live/compiler/bun-plugin'
// Must be referenced or it is shaken away.
bunPluginLive
plugin(bunPluginLive({}))
`
`
import {getFileInfo} from '@live/mirror' with {type: 'macro'}
const filePath = import.meta.path // NOTE: This is segfaulting as of 20230722Sat
await getFileInfo(filePath)
``
We use this in Bun as a macro. Would also work at runtime too. But not in browser!
For Reflection duh!!!
Utils to read stuff from the current file's AST.