@nodora/js 0.0.4 → 0.0.6
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/lib/nodora.wasm.gz +0 -0
- package/lib/wasm.browser.js +7 -2
- package/lib/wasm.node.js +8 -1
- package/lib/wasm_exec.js +1 -1
- package/package.json +6 -2
- package/lib/nodora.wasm +0 -0
|
Binary file
|
package/lib/wasm.browser.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
export async function loadWasmBinary() {
|
|
2
|
-
const wasmUrl = new URL("./nodora.wasm", import.meta.url);
|
|
2
|
+
const wasmUrl = new URL("./nodora.wasm.gz", import.meta.url);
|
|
3
3
|
const response = await fetch(wasmUrl.href);
|
|
4
4
|
if (!response.ok) {
|
|
5
5
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
if (response.headers.get("Content-Encoding")?.includes("gzip")) {
|
|
8
|
+
return response.arrayBuffer();
|
|
9
|
+
}
|
|
10
|
+
const ds = new DecompressionStream("gzip");
|
|
11
|
+
const decompressed = response.body.pipeThrough(ds);
|
|
12
|
+
return await new Response(decompressed).arrayBuffer();
|
|
8
13
|
}
|
package/lib/wasm.node.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { readFile } from "fs/promises";
|
|
2
2
|
import { fileURLToPath } from "url";
|
|
3
|
+
import { gunzip } from "zlib";
|
|
4
|
+
import { promisify } from "util";
|
|
5
|
+
|
|
6
|
+
const gunzipAsync = promisify(gunzip);
|
|
3
7
|
|
|
4
8
|
export async function loadWasmBinary() {
|
|
5
|
-
|
|
9
|
+
const compressed = await readFile(
|
|
10
|
+
fileURLToPath(new URL("./nodora.wasm.gz", import.meta.url))
|
|
11
|
+
);
|
|
12
|
+
return gunzipAsync(compressed);
|
|
6
13
|
}
|
package/lib/wasm_exec.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodora/js",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "JS bindings for Nodora rule engine",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -11,7 +11,11 @@
|
|
|
11
11
|
"prepublishOnly": "bun run build"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
|
-
"lib"
|
|
14
|
+
"lib/**/*.js",
|
|
15
|
+
"lib/**/*.d.ts",
|
|
16
|
+
"lib/**/*.wasm.gz",
|
|
17
|
+
"LICENSE",
|
|
18
|
+
"README.md"
|
|
15
19
|
],
|
|
16
20
|
"keywords": [
|
|
17
21
|
"nodora",
|
package/lib/nodora.wasm
DELETED
|
Binary file
|