Skip to content

Commit 22bebb4

Browse files
authored
Merge pull request #45 from sqlite/remove-sqliteclient
Remove `SqliteClient`
2 parents 3ff3a75 + 1fa0e23 commit 22bebb4

File tree

12 files changed

+5
-572
lines changed

12 files changed

+5
-572
lines changed

README.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -103,34 +103,6 @@ sqlite3InitModule({
103103
});
104104
```
105105

106-
## Usage with the bundled `SQLiteClient` (with OPFS if available):
107-
108-
> **Warning**
109-
>
110-
> For this to work, you need to set the following headers on your server:
111-
>
112-
> `Cross-Origin-Opener-Policy: same-origin`
113-
>
114-
> `Cross-Origin-Embedder-Policy: require-corp`
115-
116-
Import the `@sqlite.org/sqlite-wasm` library in your code and use it as such:
117-
118-
```js
119-
import { SqliteClient } from '@sqlite.org/sqlite-wasm';
120-
121-
// Must correspond to the path in your final deployed build.
122-
const sqliteWorkerPath = 'assets/js/sqlite-worker.js';
123-
// This is the name of your database. It corresponds to the path in the OPFS.
124-
const filename = '/test.sqlite3';
125-
126-
const sqlite = new SqliteClient(filename, sqliteWorkerPath);
127-
await sqlite.init();
128-
129-
await sqlite.executeSql('CREATE TABLE IF NOT EXISTS test(a,b)');
130-
await sqlite.executeSql('INSERT INTO test VALUES(?, ?)', [6, 7]);
131-
const results = await sqlite.executeSql('SELECT * FROM test');
132-
```
133-
134106
## Usage with vite
135107

136108
If you are using [vite](https://vitejs.dev/), you need to add the following

bin/index.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,6 @@ async function main() {
3838
const sqliteWasmLink = await getSqliteWasmDownloadLink();
3939
await downloadAndUnzipSqliteWasm(sqliteWasmLink);
4040
try {
41-
fs.copyFileSync(
42-
'./node_modules/comlink/dist/esm/comlink.mjs',
43-
'./src/comlink.mjs',
44-
);
45-
fs.copyFileSync(
46-
'./node_modules/comlink/dist/esm/comlink.mjs.map',
47-
'./src/comlink.mjs.map',
48-
);
4941
fs.copyFileSync(
5042
'./node_modules/module-workers-polyfill/module-workers-polyfill.min.js',
5143
'./demo/module-workers-polyfill.min.js',

demo/comlink.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

demo/index.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@
55
<title>SQLite Wasm Demo</title>
66
<script type="module" src="script.js"></script>
77
<script type="module" src="main-thread.js"></script>
8-
<script type="module" src="comlink.js"></script>
98
</head>
109
<body>
1110
<h1>SQLite Wasm Demo</h1>
1211
<h2>Main thread</h2>
1312
<div class="main-thread"></div>
1413
<h2>Worker</h2>
1514
<div class="worker"></div>
16-
<h2>Main thread using Worker via Comlink</h2>
17-
<div class="comlink"></div>
1815
</body>
1916
</html>

index.d.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8025,17 +8025,3 @@ declare type CAPI = {
80258025
SQLITE_FAIL: 3;
80268026
SQLITE_REPLACE: 5;
80278027
};
8028-
8029-
export class SqliteClient {
8030-
dbFile: string;
8031-
sqliteWorkerPath: string;
8032-
8033-
constructor(dFile: string, sqliteWorkerPath: string);
8034-
8035-
init(): Promise<void>;
8036-
8037-
executeSql(
8038-
sqlStatement: string,
8039-
bindParameters: SqlValue[],
8040-
): Promise<SqlValue[][]>;
8041-
}

index.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
import { default as sqlite3InitModule } from './sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs';
22

33
export default sqlite3InitModule;
4-
export * from './src/sqlite-client.mjs';

package-lock.json

Lines changed: 2 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sqlite.org/sqlite-wasm",
3-
"version": "3.43.2-prebuild1",
3+
"version": "3.43.2-build1",
44
"description": "SQLite Wasm conveniently wrapped as an ES Module.",
55
"keywords": [
66
"sqlite",
@@ -18,22 +18,18 @@
1818
"files": [
1919
"index.d.ts",
2020
"index.mjs",
21-
"sqlite-wasm/",
22-
"src/"
21+
"sqlite-wasm/"
2322
],
2423
"types": "index.d.ts",
2524
"exports": {
2625
".": {
2726
"types": "./index.d.ts",
2827
"import": "./index.mjs",
2928
"main": "./index.mjs",
30-
"browser": "./index.mjs",
31-
"types": "./index.d.ts"
29+
"browser": "./index.mjs"
3230
},
33-
"./src/comlink.mjs": "./src/comlink.mjs",
3431
"./package.json": "./package.json"
3532
},
36-
"types": "./index.d.ts",
3733
"bin": {
3834
"sqlite-wasm": "bin/index.js"
3935
},
@@ -66,8 +62,5 @@
6662
"publint": "^0.2.4",
6763
"prettier-plugin-jsdoc": "^1.1.1",
6864
"shx": "^0.3.4"
69-
},
70-
"optionalDependencies": {
71-
"comlink": "^4.4.1"
7265
}
7366
}

0 commit comments

Comments
 (0)