Closed pi0 closed 1 year ago
Assuming we solve this https://github.com/unjs/nitro/issues/1371 This is going to be an annoying export map to follow https://github.com/libsql/libsql-client-ts/blob/main/package.json
Because we need different versions for 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";
Easiest to solve this would be to create different presets, but that isn't magical ...
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.
https://github.com/libsql/libsql