I'm working on a custom astro integration for a lesser known framework (hyperapp). The client and server renderers are working and now I'd like to add jsx support.
Hyperapp gets jsx-compatibility from the package hyperapp-jsx-pragma . The default export from it can be set as the jsx-pragma with a magic comment //@jsx h. Here is a full working example of this:
I'd prefer to use the new "automatic" form of jsx processing so I don't have to import anything in my components. hyperapp-jsx-pragma/jsx-runtime exports jsx and jsxs functions to do just this. So I tried configuring my integration this way:
export default () => ({
name: 'hyperapp',
hooks: {
'astro:config:setup': ({ addRenderer }) => {
addRenderer({
name: 'hyperapp',
clientEntrypoint: './astrojs-hyperapp/renderer-client.js',
serverEntrypoint: './astrojs-hyperapp/renderer-server.js',
jsxImportSource: 'hyperapp-jsx-pragma/jsx-runtime',
});
},
},
});
...but it simply does not work. npm run dev task fails with console output that React is not defined (trying to use React.createElement for my jsx apparently)
How do I use jsxImportSource or alternatively jsxTransformOptions to explain to astro, that when using my hyperapp renderer, it should use 'hyperapp-jsx-pragma' to process jsx files?
EDIT: After playing around with the jsxImportSource and jsxTransformOptions options a bit, I'm starting to get the feeling that they are being completely ignored, and that somewhere else, the assumption is made that jsx should be parsed with React.createElement.