expose multiple libsql exports
Closed this issue · 0 comments
## Description
We need different versions exports different environments :
import { createClient } from "@libsql/client";
For environments that don't have a local filesystem, but support HTTP or WebSockets, including:
Browsers
CloudFlare Workers
Netlify Edge Functions
import { createClient } from "@libsql/client/web";
For environments that only support HTTP, including Vercel Edge Functions:
import { createClient } from "@libsql/client/http";
For Deno:
// replace [version] with the client version
import { createClient } from "https://esm.sh/@libsql/client@[version]/web";
Strategy
We shall expose drivers extending a base like db0/connectors/turso-http, etc. And db0/connectors/turso with subpath conditions for each platform. Once nitro adds such conditions per platform, usage will be easier, however since it is always not possible to apply conditions, db0 would probably be best to expose each via explicit name.
by @pi0 #14 (comment)
That gives a total of 8 connectors :
- [libsql, client] * ["", web, http, deno]
Extra
Assuming we solve this nitrojs/nitro#1371 we could try to follow the export map to allow the correct package to be followed without specifying its path. https://github.com/libsql/libsql-client-ts/blob/main/package.json