Skip to content

Commit

Permalink
Fix Wasm in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
penberg committed Jan 19, 2024
1 parent 3015afb commit ebf2827
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 47 deletions.
12 changes: 9 additions & 3 deletions packages/libsql-client-wasm/examples/browser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@

## Building

Run the following in top-level directory of this repository:
Run the following in the `packages/libsql-client-wasm` directory:

```
npm run build
```

Then run the following in this directory:
Then run:

```
npm i
```

Finally, run the following in this directory:

```
./node_modules/.bin/esbuild --target=safari16 index.js --bundle --outfile=dist/out.js --format=esm
Expand All @@ -17,5 +23,5 @@ Then run the following in this directory:
and open the app in browser:

```
npx http-server -o .
npx http-server -o
```
12 changes: 6 additions & 6 deletions packages/libsql-client-wasm/examples/browser/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 0 additions & 34 deletions packages/libsql-client-wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,48 +28,14 @@
".": {
"types": "./lib-esm/wasm.d.ts",
"import": {
"workerd": "./lib-esm/web.js",
"deno": "./lib-esm/web.js",
"edge-light": "./lib-esm/web.js",
"netlify": "./lib-esm/web.js",
"wasm": "./lib-esm/wasm.js",
"browser": "./lib-esm/web.js",
"default": "./lib-esm/wasm.js"
}
},
"./http": {
"types": "./lib-esm/http.d.ts",
"import": "./lib-esm/http.js"
},
"./ws": {
"types": "./lib-esm/ws.d.ts",
"import": "./lib-esm/ws.js"
},
"./wasm": {
"types": "./lib-esm/wasm.d.ts",
"import": "./lib-esm/wasm.js"
},
"./web": {
"types": "./lib-esm/web.d.ts",
"import": "./lib-esm/web.js"
}
},
"typesVersions": {
"*": {
".": [
"./lib-esm/wasm.d.ts"
],
"http": [
"./lib-esm/http.d.ts"
],
"hrana": [
"./lib-esm/hrana.d.ts"
],
"wasm": [
"./lib-esm/wasm.d.ts"
],
"web": [
"./lib-esm/web.d.ts"
]
}
},
Expand Down
4 changes: 0 additions & 4 deletions packages/libsql-client-wasm/src/wasm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,6 @@ function valueFromSql(sqlValue: unknown, intMode: IntMode): Value {
} else {
throw new Error("Invalid value for IntMode");
}
} else if (sqlValue instanceof Buffer) {
return sqlValue.buffer;
}
return sqlValue as Value;
}
Expand Down Expand Up @@ -341,8 +339,6 @@ function valueToSql(value: InValue, intMode: IntMode): SqlValue {
default:
return value ? 1 : 0;
}
} else if (value instanceof ArrayBuffer) {
return Buffer.from(value);
} else if (value instanceof Date) {
return value.valueOf();
} else if (value === undefined) {
Expand Down

0 comments on commit ebf2827

Please sign in to comment.