mirror of
https://github.com/CompeyDev/bun-lune-loader.git
synced 2024-12-12 12:50:39 +00:00
19 lines
451 B
TypeScript
19 lines
451 B
TypeScript
import plugin from "../src/index";
|
|
|
|
export async function buildFromSource(entrypoint: string): Promise<void> {
|
|
const out = await Bun.build({
|
|
plugins: [plugin],
|
|
entrypoints: [entrypoint],
|
|
});
|
|
|
|
if (out.success) {
|
|
eval(await out.outputs[0].text());
|
|
|
|
Promise.resolve();
|
|
} else {
|
|
console.warn("Build failed:");
|
|
console.warn(out.logs.map((v) => " " + v.message).join("\n"));
|
|
|
|
Promise.reject("failed to build");
|
|
}
|
|
}
|