Skip to content

Commit

Permalink
Rename index.ts to node.ts and add ./node import
Browse files Browse the repository at this point in the history
  • Loading branch information
honzasp committed Aug 28, 2023
1 parent 2e5b182 commit c6c9abd
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Updated `@libsql/hrana-client` to version 0.5.0, which implements Hrana 3
- Dropped workarounds for broken WebSocket support in Miniflare 2
- Added a `@libsql/client/node` import for explicit Node.js-specific module

## 0.3.1 -- 2023-07-20

Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,13 @@ For environments that don't have a local filesystem, but support HTTP or WebSock

- Browsers
- CloudFlare Workers
- Vercel Edge Functions
- Netlify Edge Functions

```typescript
import { createClient } from "@libsql/client/web";
```

For environments that only support HTTP, including Vercel Edge Functions:

```typescript
import { createClient } from "@libsql/client/http";
```

For Deno:

```typescript
Expand Down
17 changes: 12 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,25 @@
"license": "MIT",

"type": "module",
"main": "lib-cjs/index.js",
"types": "lib-esm/index.d.ts",
"main": "lib-cjs/node.js",
"types": "lib-esm/node.d.ts",
"exports": {
".": {
"types": "./lib-esm/index.d.ts",
"types": "./lib-esm/node.d.ts",
"import": {
"workerd": "./lib-esm/web.js",
"deno": "./lib-esm/web.js",
"edge-light": "./lib-esm/web.js",
"netlify": "./lib-esm/web.js",
"default": "./lib-esm/index.js"
"node": "./lib-esm/node.js",
"default": "./lib-esm/node.js"
},
"require": "./lib-cjs/index.js"
"require": "./lib-cjs/node.js"
},
"./node": {
"types": "./lib-esm/node.d.ts",
"import": "./lib-esm/node.js",
"require": "./lib-cjs/node.js"
},
"./http": {
"types": "./lib-esm/http.d.ts",
Expand All @@ -60,6 +66,7 @@
},
"typesVersions": {
"*": {
".": ["./lib-esm/node.d.ts"],
"http": ["./lib-esm/http.d.ts"],
"hrana": ["./lib-esm/hrana.d.ts"],
"sqlite3": ["./lib-esm/sqlite3.d.ts"],
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { fetch } from "@libsql/hrana-client";

import "./helpers.js";

import type * as libsql from "..";
import { createClient } from "..";
import type * as libsql from "../node.js";
import { createClient } from "../node.js";

const config = {
url: process.env.URL ?? "ws://localhost:8080",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from "@jest/globals";
import type { MatcherFunction } from "expect";

import { LibsqlError } from "..";
import { LibsqlError } from "../node.js";

const toBeLibsqlError: MatcherFunction<[code?: string, message?: RegExp]> =
function (actual, code?, messageRe?) {
Expand Down
File renamed without changes.

0 comments on commit c6c9abd

Please sign in to comment.