@thi.ng/wasm-api 2.4.14 → 2.4.16
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 +2 -2
- package/package.json +13 -12
- package/string.js +4 -4
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 214 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
|
@@ -466,7 +466,7 @@ Browser ESM import:
|
|
|
466
466
|
|
|
467
467
|
[JSDelivr documentation](https://www.jsdelivr.com/)
|
|
468
468
|
|
|
469
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 3.
|
|
469
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 3.13 KB
|
|
470
470
|
|
|
471
471
|
## Dependencies
|
|
472
472
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/wasm-api",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.16",
|
|
4
4
|
"description": "Generic, modular, extensible API bridge and infrastructure for hybrid JS & WebAssembly projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/thi-ng/umbrella.git"
|
|
11
|
+
"url": "git+https://github.com/thi-ng/umbrella.git",
|
|
12
|
+
"directory": "packages/wasm-api"
|
|
12
13
|
},
|
|
13
14
|
"homepage": "https://thi.ng/wasm-api",
|
|
14
15
|
"funding": [
|
|
@@ -42,17 +43,17 @@
|
|
|
42
43
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
43
44
|
},
|
|
44
45
|
"dependencies": {
|
|
45
|
-
"@thi.ng/api": "^8.12.
|
|
46
|
-
"@thi.ng/arrays": "^2.14.
|
|
47
|
-
"@thi.ng/checks": "^3.8.
|
|
48
|
-
"@thi.ng/errors": "^2.6.
|
|
49
|
-
"@thi.ng/hex": "^2.4.
|
|
50
|
-
"@thi.ng/idgen": "^2.2.
|
|
51
|
-
"@thi.ng/logger": "^3.2.
|
|
46
|
+
"@thi.ng/api": "^8.12.14",
|
|
47
|
+
"@thi.ng/arrays": "^2.14.7",
|
|
48
|
+
"@thi.ng/checks": "^3.8.4",
|
|
49
|
+
"@thi.ng/errors": "^2.6.3",
|
|
50
|
+
"@thi.ng/hex": "^2.4.7",
|
|
51
|
+
"@thi.ng/idgen": "^2.2.88",
|
|
52
|
+
"@thi.ng/logger": "^3.2.13"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
|
-
"esbuild": "^0.27.
|
|
55
|
-
"typedoc": "^0.28.
|
|
55
|
+
"esbuild": "^0.27.2",
|
|
56
|
+
"typedoc": "^0.28.16",
|
|
56
57
|
"typescript": "^5.9.3"
|
|
57
58
|
},
|
|
58
59
|
"keywords": [
|
|
@@ -126,5 +127,5 @@
|
|
|
126
127
|
"tag": "wasm",
|
|
127
128
|
"year": 2022
|
|
128
129
|
},
|
|
129
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "4bd1b9d8ae52ba32b90a1b9a55d329c708ca7865\n"
|
|
130
131
|
}
|
package/string.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isNumber } from "@thi.ng/checks/is-number";
|
|
2
|
-
import {
|
|
2
|
+
import { unsupportedOp } from "@thi.ng/errors/unsupported";
|
|
3
3
|
class WasmStringSlice {
|
|
4
4
|
constructor(mem, base, isConst = true, terminated = true) {
|
|
5
5
|
this.mem = mem;
|
|
@@ -50,7 +50,7 @@ class WasmStringSlice {
|
|
|
50
50
|
set(str) {
|
|
51
51
|
this.mem.ensureMemory();
|
|
52
52
|
if (typeof str === "string") {
|
|
53
|
-
if (this.isConst)
|
|
53
|
+
if (this.isConst) unsupportedOp("can't mutate const string");
|
|
54
54
|
this.mem.u32[this.base + 4 >>> 2] = this.mem.setString(
|
|
55
55
|
str,
|
|
56
56
|
this.addr,
|
|
@@ -166,9 +166,9 @@ class WasmStringPtr {
|
|
|
166
166
|
*/
|
|
167
167
|
set(str) {
|
|
168
168
|
const addr = this.addr;
|
|
169
|
-
if (!addr)
|
|
169
|
+
if (!addr) unsupportedOp("can't mutate null pointer");
|
|
170
170
|
if (typeof str === "string") {
|
|
171
|
-
if (this.isConst)
|
|
171
|
+
if (this.isConst) unsupportedOp("can't mutate const string");
|
|
172
172
|
this.mem.ensureMemory();
|
|
173
173
|
this.mem.setString(str, addr, this.mem.u8.byteLength - addr, true);
|
|
174
174
|
} else {
|