@multirepo/mirror
v0.0.1
Published
> Utility functions for reflection on TS files. Mainly for use as a Bun macro to do some meta programming.
Readme
Mirror
Utility functions for reflection on TS files. Mainly for use as a Bun macro to do some meta programming.
Usage
We can use it as a Bun plugin or a macro. See src/example.ts.
a. Bun plugin
bun --preload preload.tspreload.ts
import {plugin} from 'bun'
import {bunPluginLive} from '@live/compiler/bun-plugin'
// Must be referenced or it is shaken away.
bunPluginLive
plugin(bunPluginLive({}))b. Macro
import {getFileInfo} from '@live/mirror' with {type: 'macro'}
const filePath = import.meta.path // NOTE: This is segfaulting as of 20230722Sat
await getFileInfo(filePath)Notes
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.
