tursodatabase / tursodatabase/libsql

Update default export for deno?

Open
#1,789 0 comments 18 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
17.2k
Forks
531
Avg merge
1h 12m
Merged PRs (30d)
1

Description

Deno 2 seems to fully support libsql's node client. Would it make sense to update the . export for deno so users get the node client by default?

Or is the intent that Deno users should explicitly import from @libsql/client/node if that's what they want?

I've encountered a problem with Drizzle, which is that it does the import for you, and it just imports from @libsql/client. It doesn't provide any mechanism to request the node or web client specifically. So using a file: DB URL simply does not work with Drizzle on Deno.

It definitely seems like a problem, but it's not clear to me where it should be fixed. So, I've asked about it over there, and now I'm asking here, as well.

Another possible solution could be for the user to specify a custom condition, though Deno doesn't support that yet. Even if/when it does, I think libsql's exports would have to be defined differently for that to work, since currently there's no higher-priority condition than deno you could specify that would give you the node client. I suppose something as simple as this could work?

    "exports": {
        ".": {
            "types": "./lib-esm/node.d.ts",
            "import": {
                "web": "./lib-esm/web.js",
                "node": "./lib-esm/node.js",
                "default": "./lib-esm/web.js"
            },
            "require": "./lib-cjs/node.js"
        },

I believe this would give you the same default on all runtimes, but you could specify "web" on Node or specify "node" elsewhere to get the non-default option.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with packages/libsql-client/package.json at the linked exports entry, then review the related Drizzle discussion and Deno custom-condition issue. Determine the intended default for Deno and the supported web/node conditions; done means the export behavior is agreed and users can use file: database URLs through Drizzle on Deno.

Written by the indexing model from the issue text.

Assessment

Tech stack
deno, node.js
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.