I'm basing my new filetype plugin/integration off of the vite-plugin-markdown and the mdx integrations in the Astro src repo. The MDX seems to be returning a string of either raw JS or of hscript and the markdown plugin I think is returning a string of hscript as well. I've tried returning a few different things from the plugin and am given various errors based on what is returned. I'm assuming it wants the hAST in some form or another, or maybe the esAST, but I've seen examples of both (I think) being returned and since this is a Vite plugin, which is a rollup plugin, there seems to be just a lot of differing examples and I'm unsure what is needed.
Here is the repo/index.ts for the plugin I'm working on (it's currently a local plugin since that's a whole lot easier to work with for this initial development effort) https://github.com/pard68/astro-blog/blob/master/src/lib/vite-plugin-orgmode/index.ts
The error I am currently getting, when trying to return the hAST as a string is:
error Parse failure: Unexpected token (1:8)
Contents of line 1: [object Object]
Error: Parse failure: Unexpected token (1:8)
Contents of line 1: [object Object]
at ssrTransformScript (file:///Users/ian/git/hub/pard68/astro-blog/node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:52864:15)
at ssrTransform (file:///Users/ian/git/hub/pard68/astro-blog/node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:52839:12)
at Object.ssrTransform (file:///Users/ian/git/hub/pard68/astro-blog/node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:62095:20)
at loadAndTransform (file:///Users/ian/git/hub/pard68/astro-blog/node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:37388:24)
Any idea what I ought to be doing? This currently is generating a proper hAST of the input Org file, it's not the best or most ideal setup right now, this is verbatim ripped out of my NextJS plugin to do the same thing.