Open
Description
I'd like to use Vercel KV as my storage. It's an implementation of Redis, but it doesn't expose a Redis URL. Instead, there's a JavaScript client library that supports the same methods.
Ideally, there would be some contract, expressed as a TypeScript interface, for a custom storage. I'd then be able to pass in my own factory instead of "memory"
or "redis"
.
const factory = SplitFactory({
storage: () => new MyCustomVercelKVStorage(),
})
Currently, that's impossible because getStorage
is closure-scoped, as is getModules
, which calls it.
Some additional benefits of this approach:
- people could use other storage mechanisms like
localStorage
or Cloudflare KV - bundlers would be able to tree-shake this library better. As-is, they have to include both the memory and redis storage options because they're both required statically and resolved by a ternary statement
Metadata
Metadata
Assignees
Labels
No labels