sveltekit-superforms
sveltekit-superforms copied to clipboard
Export createAdapter to make writing custom adapters easier
Is your feature request related to a problem? Please describe.
I was having issues with the typebox adapter because the environment (cloudflare pages) doesn't allow type compiling. Trying to validate would result in a code generation error. To work around this, I wanted to use createAdapter and implement validate without compiling, however, it isn't exported. I ended up having to patch sveltekit-superforms/adapters/index.js.
https://github.com/ciscoheat/sveltekit-superforms/blob/eabcb20e4984817b0578d73d0aaa9254ce396ff1/src/lib/adapters/typebox.ts#L25
Describe the solution you'd like
Export createAdapter and other useful types to make it easier to implement custom adapters.
https://github.com/ciscoheat/sveltekit-superforms/blob/main/src/lib/adapters/index.ts
It would be nice to have a version of the typebox adapter without compiling, maybe a typeboxNoCompile. I do realize it might be niche, so exposing createAdapter with some documentation about writing adapters would be a more general solution.