@thi.ng/wasm-api 1.5.2 → 1.5.4

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**: 2024-04-23T07:02:17Z
3
+ - **Last updated**: 2024-05-08T18:24:32Z
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.
@@ -15,6 +15,8 @@ and/or version bumps of transitive dependencies.
15
15
 
16
16
  - update build script for zig v0.12.0 (incomplete) ([99a1916](https://github.com/thi-ng/umbrella/commit/99a1916))
17
17
  - store existing script as build-v0.11.zig
18
+ - update build script for zig v0.12.0 (incomplete) ([d4fcc54](https://github.com/thi-ng/umbrella/commit/d4fcc54))
19
+ - store existing script as build-v0.11.zig
18
20
 
19
21
  #### 🩹 Bug fixes
20
22
 
@@ -23,6 +25,7 @@ and/or version bumps of transitive dependencies.
23
25
  #### ♻️ Refactoring
24
26
 
25
27
  - minor zig v0.12.0 updates ([4a0751c](https://github.com/thi-ng/umbrella/commit/4a0751c))
28
+ - minor zig v0.12.0 updates ([e3e074d](https://github.com/thi-ng/umbrella/commit/e3e074d))
26
29
 
27
30
  ### [1.4.69](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api@1.4.69) (2024-04-20)
28
31
 
package/bridge.js CHANGED
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
5
5
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
6
  if (decorator = decorators[i])
7
7
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result)
9
- __defProp(target, key, result);
8
+ if (kind && result) __defProp(target, key, result);
10
9
  return result;
11
10
  };
12
11
  import { INotifyMixin } from "@thi.ng/api/mixins/inotify";
@@ -138,8 +137,7 @@ let WasmBridge = class {
138
137
  assert(!!this.modules[id], `missing API module: ${id}`);
139
138
  this.logger.debug(`initializing API module: ${id}`);
140
139
  const status = await this.modules[id].init(this);
141
- if (!status)
142
- return false;
140
+ if (!status) return false;
143
141
  }
144
142
  this.notify({ id: EVENT_MEMORY_CHANGED, value: this.exports.memory });
145
143
  return true;
@@ -155,8 +153,7 @@ let WasmBridge = class {
155
153
  */
156
154
  ensureMemory(notify = true) {
157
155
  const buf = this.exports.memory.buffer;
158
- if (this.u8 && this.u8.buffer === buf)
159
- return;
156
+ if (this.u8 && this.u8.buffer === buf) return;
160
157
  this.i8 = new Int8Array(buf);
161
158
  this.u8 = new Uint8Array(buf);
162
159
  this.i16 = new Int16Array(buf);
package/object-index.js CHANGED
@@ -70,8 +70,7 @@ class ObjectIndex {
70
70
  */
71
71
  find(pred, ensure = true) {
72
72
  for (let id of this.idgen) {
73
- if (pred(this.items[id]))
74
- return id;
73
+ if (pred(this.items[id])) return id;
75
74
  }
76
75
  assert(!ensure, `given predicate matched no ${this.name}`);
77
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/wasm-api",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "Generic, modular, extensible API bridge and infrastructure for hybrid JS & WebAssembly projects",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -32,24 +32,24 @@
32
32
  "doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
33
33
  "doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
34
34
  "pub": "yarn npm publish --access public",
35
- "test": "bun test",
35
+ "test": "zig test zig/managed-index.zig && bun test",
36
36
  "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",
37
37
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
38
38
  },
39
39
  "dependencies": {
40
- "@thi.ng/api": "^8.11.1",
41
- "@thi.ng/arrays": "^2.9.5",
42
- "@thi.ng/checks": "^3.6.3",
43
- "@thi.ng/errors": "^2.5.6",
44
- "@thi.ng/hex": "^2.3.45",
45
- "@thi.ng/idgen": "^2.2.40",
46
- "@thi.ng/logger": "^3.0.11"
40
+ "@thi.ng/api": "^8.11.2",
41
+ "@thi.ng/arrays": "^2.9.6",
42
+ "@thi.ng/checks": "^3.6.4",
43
+ "@thi.ng/errors": "^2.5.7",
44
+ "@thi.ng/hex": "^2.3.46",
45
+ "@thi.ng/idgen": "^2.2.41",
46
+ "@thi.ng/logger": "^3.0.12"
47
47
  },
48
48
  "devDependencies": {
49
- "@microsoft/api-extractor": "^7.43.0",
50
- "esbuild": "^0.20.2",
51
- "typedoc": "^0.25.12",
52
- "typescript": "^5.4.3"
49
+ "@microsoft/api-extractor": "^7.43.2",
50
+ "esbuild": "^0.21.1",
51
+ "typedoc": "^0.25.13",
52
+ "typescript": "^5.4.5"
53
53
  },
54
54
  "keywords": [
55
55
  "allocator",
@@ -115,5 +115,5 @@
115
115
  "status": "alpha",
116
116
  "year": 2022
117
117
  },
118
- "gitHead": "5dd66c18a3862a3af69a5b2f49563f7cbdd960c2\n"
118
+ "gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
119
119
  }
package/string.js CHANGED
@@ -50,8 +50,7 @@ class WasmStringSlice {
50
50
  set(str) {
51
51
  this.mem.ensureMemory();
52
52
  if (typeof str === "string") {
53
- if (this.isConst)
54
- unsupported("can't mutate const string");
53
+ if (this.isConst) unsupported("can't mutate const string");
55
54
  this.mem.u32[this.base + 4 >>> 2] = this.mem.setString(
56
55
  str,
57
56
  this.addr,
@@ -158,8 +157,7 @@ class WasmStringPtr {
158
157
  set(str) {
159
158
  const addr = this.addr;
160
159
  if (typeof str === "string") {
161
- if (this.isConst)
162
- unsupported("can't mutate const string");
160
+ if (this.isConst) unsupported("can't mutate const string");
163
161
  this.mem.ensureMemory();
164
162
  this.mem.setString(str, addr, this.mem.u8.byteLength - addr, true);
165
163
  } else {
File without changes
File without changes