mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-08 18:51:24 +03:00
37d973754b
Co-authored-by: Hona <10430890+Hona@users.noreply.github.com>
21 lines
691 B
TypeScript
21 lines
691 B
TypeScript
import { plugin } from "bun"
|
|
|
|
// Bun transpiles TSX against the tsconfig `jsxImportSource`, but `solid-js/jsx-runtime` has no runtime
|
|
// exports because Solid's compiler normally replaces JSX. Tests run without that compiler, so compile
|
|
// JSX against Solid's hyperscript runtime instead.
|
|
const transpiler = new Bun.Transpiler({
|
|
loader: "tsx",
|
|
trimUnusedImports: true,
|
|
tsconfig: { compilerOptions: { jsx: "react-jsx", jsxImportSource: "solid-js/h" } },
|
|
})
|
|
|
|
plugin({
|
|
name: "solid-jsx-runtime",
|
|
setup(build) {
|
|
build.onLoad({ filter: /\.[jt]sx$/ }, async (args) => ({
|
|
contents: transpiler.transformSync(await Bun.file(args.path).text()),
|
|
loader: "js",
|
|
}))
|
|
},
|
|
})
|