data-of-loathing 3.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -0
- package/package.json +17 -3
package/README.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
1
|
# data-of-loathing
|
|
2
2
|
|
|
3
3
|
A client SDK for the data-of-loathing service.
|
|
4
|
+
|
|
5
|
+
## Browser usage
|
|
6
|
+
|
|
7
|
+
The browser client uses [SQLocal](https://sqlocal.dev) (SQLite over WASM) under the hood. To use it in a browser app you will need to install the optional peer dependencies as dev dependencies:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install -D sqlocal vite-plugin-node-polyfills
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Vite
|
|
14
|
+
|
|
15
|
+
A Vite plugin is provided that handles the required configuration:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
// vite.config.ts
|
|
19
|
+
import { defineConfig } from "vite";
|
|
20
|
+
import dol from "data-of-loathing/vite";
|
|
21
|
+
|
|
22
|
+
export default defineConfig({
|
|
23
|
+
plugins: [dol()],
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The plugin does three things:
|
|
28
|
+
|
|
29
|
+
- Configures Vite's dependency optimiser and worker format for SQLocal's WASM worker
|
|
30
|
+
- Polyfills `Buffer` (required by the underlying SQLite driver)
|
|
31
|
+
- Sets `Cross-Origin-Embedder-Policy: credentialless` and `Cross-Origin-Opener-Policy: same-origin` on the dev server so SharedArrayBuffer is available without blocking cross-origin images — for production you must set these headers at the hosting layer (e.g. Netlify `_headers`, Vercel `headers` config, nginx)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "data-of-loathing",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"packageManager": "yarn@4.6.0",
|
|
6
6
|
"repository": {
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
},
|
|
15
15
|
"types": "./dist/node.d.ts",
|
|
16
16
|
"default": "./dist/node.js"
|
|
17
|
+
},
|
|
18
|
+
"./vite": {
|
|
19
|
+
"types": "./dist/vite.d.ts",
|
|
20
|
+
"default": "./dist/vite.js"
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
23
|
"files": [
|
|
@@ -29,14 +33,24 @@
|
|
|
29
33
|
"devDependencies": {
|
|
30
34
|
"@types/node": "^25.0.2",
|
|
31
35
|
"sqlocal": "^0.18.0",
|
|
32
|
-
"typescript": "^5.9.3"
|
|
36
|
+
"typescript": "^5.9.3",
|
|
37
|
+
"vite": "^6.0.0",
|
|
38
|
+
"vite-plugin-node-polyfills": "^0.26.0"
|
|
33
39
|
},
|
|
34
40
|
"peerDependencies": {
|
|
35
|
-
"sqlocal": "^0.18.0"
|
|
41
|
+
"sqlocal": "^0.18.0",
|
|
42
|
+
"vite": ">=5.0.0",
|
|
43
|
+
"vite-plugin-node-polyfills": "^0.26.0"
|
|
36
44
|
},
|
|
37
45
|
"peerDependenciesMeta": {
|
|
38
46
|
"sqlocal": {
|
|
39
47
|
"optional": true
|
|
48
|
+
},
|
|
49
|
+
"vite": {
|
|
50
|
+
"optional": true
|
|
51
|
+
},
|
|
52
|
+
"vite-plugin-node-polyfills": {
|
|
53
|
+
"optional": true
|
|
40
54
|
}
|
|
41
55
|
}
|
|
42
56
|
}
|