@thi.ng/wasm-api 1.2.1 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2022-12-02T14:13:34Z
3
+ - **Last updated**: 2022-12-16T12:52:25Z
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.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  <!-- This file is generated - DO NOT EDIT! -->
2
2
 
3
- # ![wasm-api](https://media.thi.ng/umbrella/banners-20220914/thing-wasm-api.svg?be328da7)
3
+ # ![@thi.ng/wasm-api](https://media.thi.ng/umbrella/banners-20220914/thing-wasm-api.svg?be328da7)
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@thi.ng/wasm-api.svg)](https://www.npmjs.com/package/@thi.ng/wasm-api)
6
6
  ![npm downloads](https://img.shields.io/npm/dm/@thi.ng/wasm-api.svg)
7
- [![Twitter Follow](https://img.shields.io/twitter/follow/thing_umbrella.svg?style=flat-square&label=twitter)](https://twitter.com/thing_umbrella)
7
+ [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](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
 
@@ -56,8 +56,8 @@ WebGL, WebGPU, WebAudio etc. is being actively worked on.
56
56
  defining glue code for the TypeScript [core
57
57
  API](https://docs.thi.ng/umbrella/wasm-api/interfaces/CoreAPI.html) defined
58
58
  by this package
59
- 7. [Zig build files]() to simplify using hybrid TS/Zig packages with the
60
- built-in build system
59
+ 7. [Zig build files](#using-the-zig-build-system) to simplify using hybrid
60
+ TS/Zig packages with the built-in build system
61
61
  8. Extensible shared [datatype code generator
62
62
  infrastructure](https://github.com/thi-ng/umbrella/tree/develop/packages/wasm-api-bindgen/)
63
63
  for (currently) Zig & TypeScript and C11. For TS fully type checked and
@@ -305,13 +305,17 @@ packages this is used to manage Zig-side event listeners.
305
305
 
306
306
  ## Using the Zig build system
307
307
 
308
- This package provides utilities to simplify using hybrid TS/Zig WASM API modules which are distributed as NPM packages. Using these utils, a build file for Zig's built-in build system is as simple as:
308
+ This package provides utilities to simplify using hybrid TS/Zig WASM API modules
309
+ which are distributed as NPM packages. Using these utils, a build file for Zig's
310
+ built-in build system is as simple as:
309
311
 
310
312
  ```zig
311
313
  const std = @import("std");
312
314
 
313
315
  pub fn build(b: *std.build.Builder) void {
314
- @import("node_modules/@thi.ng/wasm-api/zig/build.zig").wasmLib(b, .{
316
+ // obtain a standard std.build.LibExeObjStep, pre-configured w/ given options
317
+ // see source comments in imported build.zig for further details...
318
+ var lib = @import("node_modules/@thi.ng/wasm-api/zig/build.zig").wasmLib(b, .{
315
319
  // Declare extra WASM API packages to use
316
320
  // Each package can also declare dependencies to other such packages
317
321
  // (wasm-api and wasm-api-bindgen are made available everywhere)
@@ -320,9 +324,14 @@ pub fn build(b: *std.build.Builder) void {
320
324
  .{ .id = "wasm-api-schedule", .path = "@thi.ng/wasm-api-schedule/zig/lib.zig" },
321
325
  },
322
326
  // (optional) build mode override
323
- // if commented out, we can pass CLI args to choose build mode (default: .Debug)
327
+ // if commented out, we can pass CLI args to choose build mode (default: .Debug)
324
328
  .mode = .ReleaseSmall,
325
- }).install();
329
+ });
330
+ // optionally, add further custom configuration
331
+ // ...
332
+
333
+ // finally trigger build
334
+ lib.install();
326
335
  }
327
336
  ```
328
337
 
@@ -365,11 +374,8 @@ ES module import:
365
374
 
366
375
  For Node.js REPL:
367
376
 
368
- ```text
369
- # with flag only for < v16
370
- node --experimental-repl-await
371
-
372
- > const wasmApi = await import("@thi.ng/wasm-api");
377
+ ```js
378
+ const wasmApi = await import("@thi.ng/wasm-api");
373
379
  ```
374
380
 
375
381
  Package sizes (brotli'd, pre-treeshake): ESM: 2.47 KB
@@ -512,7 +518,7 @@ emcc -Os -Inode_modules/@thi.ng/wasm-api/include \
512
518
 
513
519
  ## Authors
514
520
 
515
- Karsten Schmidt
521
+ - [Karsten Schmidt](https://thi.ng)
516
522
 
517
523
  If this project contributes to an academic publication, please cite it as:
518
524
 
@@ -527,4 +533,4 @@ If this project contributes to an academic publication, please cite it as:
527
533
 
528
534
  ## License
529
535
 
530
- &copy; 2022 Karsten Schmidt // Apache Software License 2.0
536
+ &copy; 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 declare type BigIntArray = bigint[] | BigInt64Array | BigUint64Array;
6
- export declare type ReadonlyWasmString = IDeref<string> & ILength & {
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 declare type WasmTypeConstructor<T> = Fn<IWasmMemoryAccess, WasmType<T>>;
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 declare type MemorySlice = [addr: number, len: number];
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.1",
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/master/packages/wasm-api#readme",
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 <k+npm@thi.ng>",
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.5.1",
39
- "@thi.ng/arrays": "^2.4.4",
40
- "@thi.ng/checks": "^3.3.4",
41
- "@thi.ng/errors": "^2.2.5",
42
- "@thi.ng/hex": "^2.3.1",
43
- "@thi.ng/idgen": "^2.1.20",
44
- "@thi.ng/logger": "^1.4.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.5",
48
- "@thi.ng/testament": "^0.3.6",
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.20",
52
- "typescript": "^4.8.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": "7d1e314f207299ff3c1a782d287ad99120b40b85\n"
118
+ "gitHead": "f445a9cc8022bcdebbf6ff91fd66ced016d72f01\n"
119
119
  }