Currently the Bun example doesn't work, arguments can only be literal strings, objects and arrays in unplugin-macros.
import {getText} from './getText.ts' with { type: 'macro' };
import {getFoo} from './getFoo.ts' with { type: 'macro' };
export function howLong() {
// this works because getFoo() is statically known
const foo = getFoo();
const text = getText(`https://example.com/${foo}`);
console.log("The page is", text.length, "characters long");
}
Clear and concise description of the problem
Currently the Bun example doesn't work, arguments can only be literal strings, objects and arrays in
unplugin-macros
.Suggested solution
Support macro functions as arguments. Not sure if the implementation of https://github.com/unplugin/unplugin-macros/issues/12 would solve this.
Alternative
No response
Additional context
No response
Validations