@thi.ng/wasm-api 1.4.30 → 1.4.33
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/CHANGELOG.md +7 -1
- package/README.md +1 -1
- package/bridge.d.ts +2 -0
- package/bridge.js +18 -3
- package/object-index.js +4 -1
- package/package.json +14 -15
- package/pointer.js +6 -0
- package/string.js +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2023-
|
|
3
|
+
- **Last updated**: 2023-11-09T10:28:19Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
### [1.4.32](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api@1.4.32) (2023-11-09)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- update all tests (packages T-Z) ([020ef6c](https://github.com/thi-ng/umbrella/commit/020ef6c))
|
|
17
|
+
|
|
12
18
|
### [1.4.13](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api@1.4.13) (2023-08-04)
|
|
13
19
|
|
|
14
20
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
package/bridge.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const Panic: {
|
|
|
7
7
|
name: string;
|
|
8
8
|
message: string;
|
|
9
9
|
stack?: string | undefined;
|
|
10
|
+
cause?: unknown;
|
|
10
11
|
};
|
|
11
12
|
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
|
|
12
13
|
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
@@ -17,6 +18,7 @@ export declare const OutOfMemoryError: {
|
|
|
17
18
|
name: string;
|
|
18
19
|
message: string;
|
|
19
20
|
stack?: string | undefined;
|
|
21
|
+
cause?: unknown;
|
|
20
22
|
};
|
|
21
23
|
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
|
|
22
24
|
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
package/bridge.js
CHANGED
|
@@ -25,11 +25,26 @@ export const OutOfMemoryError = defError(() => "Out of memory");
|
|
|
25
25
|
* support it. No polyfills are provided.
|
|
26
26
|
*/
|
|
27
27
|
let WasmBridge = class WasmBridge {
|
|
28
|
+
logger;
|
|
29
|
+
id = "wasmapi";
|
|
30
|
+
i8;
|
|
31
|
+
u8;
|
|
32
|
+
i16;
|
|
33
|
+
u16;
|
|
34
|
+
i32;
|
|
35
|
+
u32;
|
|
36
|
+
i64;
|
|
37
|
+
u64;
|
|
38
|
+
f32;
|
|
39
|
+
f64;
|
|
40
|
+
utf8Decoder = new TextDecoder();
|
|
41
|
+
utf8Encoder = new TextEncoder();
|
|
42
|
+
imports;
|
|
43
|
+
exports;
|
|
44
|
+
api;
|
|
45
|
+
modules;
|
|
28
46
|
constructor(modules = [], logger = new ConsoleLogger("wasm")) {
|
|
29
47
|
this.logger = logger;
|
|
30
|
-
this.id = "wasmapi";
|
|
31
|
-
this.utf8Decoder = new TextDecoder();
|
|
32
|
-
this.utf8Encoder = new TextEncoder();
|
|
33
48
|
const logN = (x) => this.logger.debug(x);
|
|
34
49
|
const logA = (method) => (addr, len) => this.logger.debug(() => method(addr, len).join(", "));
|
|
35
50
|
this.api = {
|
package/object-index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { assert } from "@thi.ng/errors/assert";
|
|
2
2
|
import { IDGen } from "@thi.ng/idgen";
|
|
3
3
|
export class ObjectIndex {
|
|
4
|
+
name;
|
|
5
|
+
logger;
|
|
6
|
+
idgen;
|
|
7
|
+
items = [];
|
|
4
8
|
constructor(opts) {
|
|
5
|
-
this.items = [];
|
|
6
9
|
this.name = opts.name;
|
|
7
10
|
this.logger = opts.logger;
|
|
8
11
|
this.idgen = new IDGen(opts.bits || 32, 0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/wasm-api",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.33",
|
|
4
4
|
"description": "Generic, modular, extensible API bridge and infrastructure for hybrid JS & WebAssembly projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -28,27 +28,26 @@
|
|
|
28
28
|
"clean": "rimraf --glob '*.js' '*.d.ts' '*.map' doc",
|
|
29
29
|
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
|
|
30
30
|
"doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
|
|
31
|
-
"doc:readme": "
|
|
32
|
-
"doc:stats": "tools:module-stats",
|
|
31
|
+
"doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
|
|
33
32
|
"pub": "yarn npm publish --access public",
|
|
34
|
-
"test": "
|
|
33
|
+
"test": "bun test",
|
|
35
34
|
"test:build-zig": "zig build-lib -O ReleaseSmall -target wasm32-freestanding -dynamic --strip --pkg-begin wasmapi zig/lib.zig --pkg-end test/custom.zig && wasm-dis -o custom.wast custom.wasm && cp custom.wasm test"
|
|
36
35
|
},
|
|
37
36
|
"dependencies": {
|
|
38
|
-
"@thi.ng/api": "^8.9.
|
|
39
|
-
"@thi.ng/arrays": "^2.7.
|
|
40
|
-
"@thi.ng/checks": "^3.4.
|
|
41
|
-
"@thi.ng/errors": "^2.4.
|
|
42
|
-
"@thi.ng/hex": "^2.3.
|
|
43
|
-
"@thi.ng/idgen": "^2.2.
|
|
44
|
-
"@thi.ng/logger": "^1.4.
|
|
37
|
+
"@thi.ng/api": "^8.9.8",
|
|
38
|
+
"@thi.ng/arrays": "^2.7.4",
|
|
39
|
+
"@thi.ng/checks": "^3.4.8",
|
|
40
|
+
"@thi.ng/errors": "^2.4.2",
|
|
41
|
+
"@thi.ng/hex": "^2.3.20",
|
|
42
|
+
"@thi.ng/idgen": "^2.2.11",
|
|
43
|
+
"@thi.ng/logger": "^1.4.24"
|
|
45
44
|
},
|
|
46
45
|
"devDependencies": {
|
|
47
|
-
"@microsoft/api-extractor": "^7.38.
|
|
48
|
-
"@thi.ng/testament": "^0.
|
|
46
|
+
"@microsoft/api-extractor": "^7.38.2",
|
|
47
|
+
"@thi.ng/testament": "^0.4.1",
|
|
49
48
|
"rimraf": "^5.0.5",
|
|
50
49
|
"tools": "^0.0.1",
|
|
51
|
-
"typedoc": "^0.25.
|
|
50
|
+
"typedoc": "^0.25.3",
|
|
52
51
|
"typescript": "^5.2.2"
|
|
53
52
|
},
|
|
54
53
|
"keywords": [
|
|
@@ -115,5 +114,5 @@
|
|
|
115
114
|
"status": "alpha",
|
|
116
115
|
"year": 2022
|
|
117
116
|
},
|
|
118
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "669a3151e4302480244fe3e60eff5e732ea5b7a7\n"
|
|
119
118
|
}
|
package/pointer.js
CHANGED
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
* the pointer is deref'd.
|
|
11
11
|
*/
|
|
12
12
|
export class Pointer {
|
|
13
|
+
mem;
|
|
14
|
+
base;
|
|
15
|
+
fn;
|
|
13
16
|
constructor(mem, base, fn) {
|
|
14
17
|
this.mem = mem;
|
|
15
18
|
this.base = base;
|
|
@@ -37,6 +40,9 @@ export class Pointer {
|
|
|
37
40
|
* the pointer is deref'd.
|
|
38
41
|
*/
|
|
39
42
|
export class Pointer64 {
|
|
43
|
+
mem;
|
|
44
|
+
base;
|
|
45
|
+
fn;
|
|
40
46
|
constructor(mem, base, fn) {
|
|
41
47
|
this.mem = mem;
|
|
42
48
|
this.base = base;
|
package/string.js
CHANGED
|
@@ -11,6 +11,11 @@ import { unsupported } from "@thi.ng/errors/unsupported";
|
|
|
11
11
|
* diff implementation) using bigint addresses (TODO)
|
|
12
12
|
*/
|
|
13
13
|
export class WasmStringSlice {
|
|
14
|
+
mem;
|
|
15
|
+
base;
|
|
16
|
+
isConst;
|
|
17
|
+
terminated;
|
|
18
|
+
maxLen;
|
|
14
19
|
constructor(mem, base, isConst = true, terminated = true) {
|
|
15
20
|
this.mem = mem;
|
|
16
21
|
this.base = base;
|
|
@@ -116,6 +121,9 @@ export class WasmStringSlice {
|
|
|
116
121
|
* {@link WasmStringSlice.deref} and mutated via {@link WasmStringSlice.set}.
|
|
117
122
|
*/
|
|
118
123
|
export class WasmStringPtr {
|
|
124
|
+
mem;
|
|
125
|
+
base;
|
|
126
|
+
isConst;
|
|
119
127
|
constructor(mem, base, isConst = true) {
|
|
120
128
|
this.mem = mem;
|
|
121
129
|
this.base = base;
|