@thi.ng/wasm-api 1.2.2 → 1.2.3
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 +1 -1
- package/README.md +14 -17
- package/api.d.ts +4 -4
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<!-- This file is generated - DO NOT EDIT! -->
|
|
2
2
|
|
|
3
|
-
# 
|
|
3
|
+
# 
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@thi.ng/wasm-api)
|
|
6
6
|

|
|
7
|
-
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
This project is part of the
|
|
10
10
|
[@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo.
|
|
@@ -31,7 +31,7 @@ This project is part of the
|
|
|
31
31
|
|
|
32
32
|
## About
|
|
33
33
|
|
|
34
|
-
Generic, modular, extensible API bridge and infrastructure for hybrid JS & WebAssembly projects
|
|
34
|
+
Generic, modular, extensible API bridge and infrastructure for hybrid JS & WebAssembly projects
|
|
35
35
|
|
|
36
36
|
This package provides the following:
|
|
37
37
|
|
|
@@ -313,8 +313,8 @@ built-in build system is as simple as:
|
|
|
313
313
|
const std = @import("std");
|
|
314
314
|
|
|
315
315
|
pub fn build(b: *std.build.Builder) void {
|
|
316
|
-
|
|
317
|
-
|
|
316
|
+
// obtain a standard std.build.LibExeObjStep, pre-configured w/ given options
|
|
317
|
+
// see source comments in imported build.zig for further details...
|
|
318
318
|
var lib = @import("node_modules/@thi.ng/wasm-api/zig/build.zig").wasmLib(b, .{
|
|
319
319
|
// Declare extra WASM API packages to use
|
|
320
320
|
// Each package can also declare dependencies to other such packages
|
|
@@ -324,14 +324,14 @@ pub fn build(b: *std.build.Builder) void {
|
|
|
324
324
|
.{ .id = "wasm-api-schedule", .path = "@thi.ng/wasm-api-schedule/zig/lib.zig" },
|
|
325
325
|
},
|
|
326
326
|
// (optional) build mode override
|
|
327
|
-
|
|
327
|
+
// if commented out, we can pass CLI args to choose build mode (default: .Debug)
|
|
328
328
|
.mode = .ReleaseSmall,
|
|
329
329
|
});
|
|
330
|
-
|
|
331
|
-
|
|
330
|
+
// optionally, add further custom configuration
|
|
331
|
+
// ...
|
|
332
332
|
|
|
333
|
-
|
|
334
|
-
|
|
333
|
+
// finally trigger build
|
|
334
|
+
lib.install();
|
|
335
335
|
}
|
|
336
336
|
```
|
|
337
337
|
|
|
@@ -374,11 +374,8 @@ ES module import:
|
|
|
374
374
|
|
|
375
375
|
For Node.js REPL:
|
|
376
376
|
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
node --experimental-repl-await
|
|
380
|
-
|
|
381
|
-
> const wasmApi = await import("@thi.ng/wasm-api");
|
|
377
|
+
```js
|
|
378
|
+
const wasmApi = await import("@thi.ng/wasm-api");
|
|
382
379
|
```
|
|
383
380
|
|
|
384
381
|
Package sizes (brotli'd, pre-treeshake): ESM: 2.47 KB
|
|
@@ -521,7 +518,7 @@ emcc -Os -Inode_modules/@thi.ng/wasm-api/include \
|
|
|
521
518
|
|
|
522
519
|
## Authors
|
|
523
520
|
|
|
524
|
-
Karsten Schmidt
|
|
521
|
+
- [Karsten Schmidt](https://thi.ng)
|
|
525
522
|
|
|
526
523
|
If this project contributes to an academic publication, please cite it as:
|
|
527
524
|
|
|
@@ -536,4 +533,4 @@ If this project contributes to an academic publication, please cite it as:
|
|
|
536
533
|
|
|
537
534
|
## License
|
|
538
535
|
|
|
539
|
-
© 2022 Karsten Schmidt // Apache
|
|
536
|
+
© 2022 Karsten Schmidt // Apache License 2.0
|
package/api.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { Fn, IDeref, ILength } from "@thi.ng/api";
|
|
|
2
2
|
import type { WasmBridge } from "./bridge.js";
|
|
3
3
|
export declare const EVENT_MEMORY_CHANGED = "memory-changed";
|
|
4
4
|
export declare const EVENT_PANIC = "panic";
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export type BigIntArray = bigint[] | BigInt64Array | BigUint64Array;
|
|
6
|
+
export type ReadonlyWasmString = IDeref<string> & ILength & {
|
|
7
7
|
readonly addr: number;
|
|
8
8
|
};
|
|
9
9
|
export interface WasmTypeBase {
|
|
@@ -21,7 +21,7 @@ export interface WasmType<T> {
|
|
|
21
21
|
readonly size: number;
|
|
22
22
|
instance: Fn<number, T>;
|
|
23
23
|
}
|
|
24
|
-
export
|
|
24
|
+
export type WasmTypeConstructor<T> = Fn<IWasmMemoryAccess, WasmType<T>>;
|
|
25
25
|
/**
|
|
26
26
|
* Common interface for WASM/JS child APIs which will be used in combination
|
|
27
27
|
* with a parent {@link WasmBridge}.
|
|
@@ -111,7 +111,7 @@ export interface WasmExports {
|
|
|
111
111
|
*/
|
|
112
112
|
_wasm_free(addr: number, numBytes: number): void;
|
|
113
113
|
}
|
|
114
|
-
export
|
|
114
|
+
export type MemorySlice = [addr: number, len: number];
|
|
115
115
|
export interface IWasmMemoryAccess {
|
|
116
116
|
i8: Int8Array;
|
|
117
117
|
u8: Uint8Array;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/wasm-api",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Generic, modular, extensible API bridge and infrastructure for hybrid JS & WebAssembly projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/thi-ng/umbrella.git"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://github.com/thi-ng/umbrella/tree/
|
|
13
|
+
"homepage": "https://github.com/thi-ng/umbrella/tree/develop/packages/wasm-api#readme",
|
|
14
14
|
"funding": [
|
|
15
15
|
{
|
|
16
16
|
"type": "github",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "https://patreon.com/thing_umbrella"
|
|
22
22
|
}
|
|
23
23
|
],
|
|
24
|
-
"author": "Karsten Schmidt
|
|
24
|
+
"author": "Karsten Schmidt (https://thi.ng)",
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "yarn clean && tsc --declaration",
|
|
@@ -35,21 +35,21 @@
|
|
|
35
35
|
"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
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@thi.ng/api": "^8.
|
|
39
|
-
"@thi.ng/arrays": "^2.4.
|
|
40
|
-
"@thi.ng/checks": "^3.3.
|
|
41
|
-
"@thi.ng/errors": "^2.2.
|
|
42
|
-
"@thi.ng/hex": "^2.3.
|
|
43
|
-
"@thi.ng/idgen": "^2.1.
|
|
44
|
-
"@thi.ng/logger": "^1.4.
|
|
38
|
+
"@thi.ng/api": "^8.6.0",
|
|
39
|
+
"@thi.ng/arrays": "^2.4.5",
|
|
40
|
+
"@thi.ng/checks": "^3.3.5",
|
|
41
|
+
"@thi.ng/errors": "^2.2.6",
|
|
42
|
+
"@thi.ng/hex": "^2.3.2",
|
|
43
|
+
"@thi.ng/idgen": "^2.1.21",
|
|
44
|
+
"@thi.ng/logger": "^1.4.5"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@microsoft/api-extractor": "^7.33.
|
|
48
|
-
"@thi.ng/testament": "^0.3.
|
|
47
|
+
"@microsoft/api-extractor": "^7.33.7",
|
|
48
|
+
"@thi.ng/testament": "^0.3.7",
|
|
49
49
|
"rimraf": "^3.0.2",
|
|
50
50
|
"tools": "^0.0.1",
|
|
51
|
-
"typedoc": "^0.23.
|
|
52
|
-
"typescript": "^4.
|
|
51
|
+
"typedoc": "^0.23.22",
|
|
52
|
+
"typescript": "^4.9.4"
|
|
53
53
|
},
|
|
54
54
|
"keywords": [
|
|
55
55
|
"allocator",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"status": "alpha",
|
|
116
116
|
"year": 2022
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "f445a9cc8022bcdebbf6ff91fd66ced016d72f01\n"
|
|
119
119
|
}
|