@thi.ng/wasm-api 0.13.1 → 0.15.0

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-10-04T17:35:45Z
3
+ - **Last updated**: 2022-10-26T12:46:53Z
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,53 @@ 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
+ ## [0.15.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api@0.15.0) (2022-10-26)
13
+
14
+ #### 🚀 Features
15
+
16
+ - import ManagedIndex, migrate Zig API ([d8bb3ee](https://github.com/thi-ng/umbrella/commit/d8bb3ee))
17
+ - migrate ManagedIndex from [@thi.ng/wasm-api-dom](https://github.com/thi-ng/umbrella/tree/main/packages/wasm-api-dom)
18
+ - move all Zig sources from /include => /zig
19
+ - update pkg
20
+ - add codegen support for union types ([bbc1f98](https://github.com/thi-ng/umbrella/commit/bbc1f98))
21
+ - add Union type, update TopLevelType
22
+ - update all codegens (C,TS,Zig)
23
+ - update alignOf(), sizeOf()
24
+ - update selectAlignment()
25
+ - add/update codegen alignment logic ([9c19ad9](https://github.com/thi-ng/umbrella/commit/9c19ad9))
26
+ - add AlignmentStrategy & impls
27
+ - update alignOf(), sizeOf(), prepareType()
28
+ - extract DEFAULT_CODEGEN_OPTS
29
+ - add Struct.align config option
30
+ - add WasmTarget codegen opt & usize support ([62c049b](https://github.com/thi-ng/umbrella/commit/62c049b))
31
+
32
+ #### 🩹 Bug fixes
33
+
34
+ - update CLI wrapper to allow unions ([904716c](https://github.com/thi-ng/umbrella/commit/904716c))
35
+ - fix i64/u64 handling in sizeof() ([825add3](https://github.com/thi-ng/umbrella/commit/825add3))
36
+ - fix padding in Zig packed structs ([8d70cf6](https://github.com/thi-ng/umbrella/commit/8d70cf6))
37
+ - since packed structs can't contain `[n]u8` types,
38
+ generate padding as potentially multiple `uXXX` fields
39
+
40
+ #### ♻️ Refactoring
41
+
42
+ - rename types, use predicates ([4148e1e](https://github.com/thi-ng/umbrella/commit/4148e1e))
43
+ - rename StructField => Field
44
+ - update codegens to use more predicates instead of inline checks
45
+ - minor updates C & Zig codegens ([a94e1cc](https://github.com/thi-ng/umbrella/commit/a94e1cc))
46
+
47
+ ## [0.14.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api@0.14.0) (2022-10-17)
48
+
49
+ #### 🚀 Features
50
+
51
+ - add ptrCast() zig helper ([72a9406](https://github.com/thi-ng/umbrella/commit/72a9406))
52
+ - add Zig Slice & String wrappers ([28d057e](https://github.com/thi-ng/umbrella/commit/28d057e))
53
+ - allows expressing & converting slices for `extern struct`s
54
+ - ensure memory in WasmStringSlice/Ptr ([c55c6f0](https://github.com/thi-ng/umbrella/commit/c55c6f0))
55
+ - update IWasmMemoryAccess ([28bfff6](https://github.com/thi-ng/umbrella/commit/28bfff6))
56
+ - add IWasmMemoryAccess.ensureMemory()
57
+ - update WasmBridge.setString() to ensure memory
58
+
12
59
  ## [0.13.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api@0.13.0) (2022-10-04)
13
60
 
14
61
  #### 🚀 Features
package/README.md CHANGED
@@ -45,24 +45,27 @@ applications.
45
45
  Additionally, a number of support modules for [DOM
46
46
  manipulation](https://github.com/thi-ng/umbrella/tree/develop/packages/wasm-api-dom/),
47
47
  WebGL, WebGPU, WebAudio etc. is being actively worked on.
48
- 3. [Include files for C11/C++ and
49
- Zig](https://github.com/thi-ng/umbrella/tree/develop/packages/wasm-api/include),
50
- defining WASM imports of the extern JS [core
48
+ 3. Include files for
49
+ [C11/C++](https://github.com/thi-ng/umbrella/tree/develop/packages/wasm-api/include)
50
+ and
51
+ [Zig](https://github.com/thi-ng/umbrella/tree/develop/packages/wasm-api/zig),
52
+ defining glue code for the JS [core
51
53
  API](https://docs.thi.ng/umbrella/wasm-api/interfaces/CoreAPI.html) defined
52
54
  by this package
53
- 4. Extensible shared datatype code generators for (currently) C11, TypeScript &
54
- [Zig](https://ziglang.org). The latter also generates fully type checked
55
- memory-mapped (zero-copy) accessors of WASM-side data. In general, all
56
- languages with a WebAssembly target are supported, however currently only
57
- bindings for these mentioned langs are included.
55
+ 4. Extensible shared datatype code generators for (currently) C11, Zig &
56
+ TypeScript. The latter also generates fully type checked memory-mapped
57
+ (zero-copy) accessors of WASM-side data. In general, all languages with a
58
+ WebAssembly target are supported, however currently only bindings for these
59
+ mentioned langs are included. Other languages require custom bindings, e.g.
60
+ based on the flexible primitives provided here.
58
61
  5. [CLI frontend/utility](#cli-generator) to invoke the code generator(s)
59
62
 
60
63
  ### Data bindings & code generators
61
64
 
62
65
  The package provides an extensible codegeneration framework to simplify the
63
66
  bilateral design & exchange of data structures shared between the WASM & JS host
64
- env. Currently, code generators for TypeScript & Zig are supplied (more are
65
- planned). A CLI wrapper is available too. See the
67
+ env. Currently, code generators for TypeScript, Zig and C11 are supplied. A CLI
68
+ wrapper is available too. See the
66
69
  [@thi.ng/wasm-api-dom](https://github.com/thi-ng/umbrella/tree/develop/packages/wasm-api-dom/)
67
70
  support package for a more thorough realworld example...
68
71
 
@@ -78,7 +81,7 @@ $ npx @thi.ng/wasm-api
78
81
 
79
82
  █ █ █ │
80
83
  ██ █ │
81
- █ █ █ █ █ █ █ █ │ @thi.ng/wasm-api 0.12.0
84
+ █ █ █ █ █ █ █ █ │ @thi.ng/wasm-api 0.15.0
82
85
  █ █ █ █ █ █ █ █ █ │ Multi-language data bindings code generator
83
86
  █ │
84
87
  █ █ │
@@ -88,7 +91,7 @@ usage: wasm-api [OPTS] JSON-INPUT-FILE(S) ...
88
91
 
89
92
  Flags:
90
93
 
91
- -d, --debug enable debug output
94
+ -d, --debug enable debug output & functions
92
95
  --dry-run enable dry run (don't overwrite files)
93
96
 
94
97
  Main:
@@ -102,8 +105,8 @@ Main:
102
105
 
103
106
  By default, the CLI generates sources for TypeScript and Zig (in this order!).
104
107
  Order is important, since the output file paths must be given in the same order
105
- as the target languages. It's recommended to be more explicit with this. An
106
- example invocation looks like:
108
+ as the target languages. It's recommended to be explicit with this. An example
109
+ invocation looks like:
107
110
 
108
111
  ```bash
109
112
  wasm-api \
@@ -145,53 +148,62 @@ external files by specifying their file paths using `@` as prefix, e.g.
145
148
 
146
149
  #### Data type definitions
147
150
 
148
- Currently, the code generator supports structs and enums. See API docs for
151
+ Currently, the code generator supports enums, structs and unions. See API docs for
149
152
  further details:
150
153
 
151
154
  - [`Enum`](https://docs.thi.ng/umbrella/wasm-api/interfaces/Enum.html)
152
- - [`EnumValue`](https://docs.thi.ng/umbrella/wasm-api/interfaces/EnumValue.html)
155
+ - [`EnumValue`](https://docs.thi.ng/umbrella/wasm-api/interfaces/EnumValue.html) (individual enum value spec)
156
+ - [`Field`](https://docs.thi.ng/umbrella/wasm-api/interfaces/Field.html) (individual spec for values contained in structs/unions)
153
157
  - [`Struct`](https://docs.thi.ng/umbrella/wasm-api/interfaces/Struct.html)
154
- - [`StructField`](https://docs.thi.ng/umbrella/wasm-api/interfaces/StructField.html)
158
+ - [`Union`](https://docs.thi.ng/umbrella/wasm-api/interfaces/Union.html)
155
159
  - [`TopLevelType`](https://docs.thi.ng/umbrella/wasm-api/interfaces/TopLevelType.html)
156
160
 
157
161
  #### Example usage
158
162
 
159
- Below is an example file with JSON type definitions and the resulting source
160
- codes:
163
+ The following example defines 1x enum, 2x structs and 1x union. Shown here are
164
+ the JSON type definitions and the resulting source codes:
161
165
 
162
166
  **⬇︎ CLICK TO EXPAND EACH CODE BLOCK ⬇︎**
163
167
 
164
168
  <details><summary>types.json (Type definitions)</summary>
165
169
 
166
- ```json
170
+ ```json tangle:export/readme-types.json
167
171
  [
168
172
  {
169
- "name": "Foo",
173
+ "name": "EventType",
174
+ "type": "enum",
175
+ "tag": "u8",
176
+ "values": [
177
+ "unknown",
178
+ { "name": "mouse", "value": 16 },
179
+ { "name": "key", "value": 32 }
180
+ ]
181
+ },
182
+ {
183
+ "name": "MouseEvent",
170
184
  "type": "struct",
171
185
  "doc": "Example struct",
172
- "auto": true,
173
186
  "fields": [
174
- { "name": "id", "type": "u8", "doc": "Unique ID" },
175
- { "name": "bars", "type": "Bar", "tag": "array", "len": 3 },
176
- { "name": "color", "type": "f32", "tag": "vec", "len": 4 }
187
+ { "name": "type", "type": "EventType" },
188
+ { "name": "pos", "type": "u16", "tag": "vec", "len": 2 }
177
189
  ]
178
190
  },
179
191
  {
180
- "name": "Bar",
192
+ "name": "KeyEvent",
181
193
  "type": "struct",
194
+ "doc": "Example struct",
182
195
  "fields": [
183
- { "name": "kind", "type": "Kind" },
184
- { "name": "flags", "type": "u32" }
196
+ { "name": "type", "type": "EventType" },
197
+ { "name": "key", "type": "string" },
198
+ { "name": "modifiers", "type": "u8", "doc": "Bitmask of modifier keys" }
185
199
  ]
186
200
  },
187
201
  {
188
- "name": "Kind",
189
- "type": "enum",
190
- "tag": "u16",
191
- "values": [
192
- "unknown",
193
- { "name": "good", "value": 100 },
194
- { "name": "best", "value": 1000 }
202
+ "name": "Event",
203
+ "type": "union",
204
+ "fields": [
205
+ { "name": "mouse", "type": "MouseEvent" },
206
+ { "name": "key", "type": "KeyEvent" }
195
207
  ]
196
208
  }
197
209
  ]
@@ -202,71 +214,113 @@ codes:
202
214
 
203
215
  ```ts
204
216
  /**
205
- * Generated by @thi.ng/wasm-api at 2022-10-03T15:32:12.339Z - DO NOT EDIT!
217
+ * Generated by @thi.ng/wasm-api at 2022-10-26T08:36:16.825Z - DO NOT EDIT!
206
218
  */
207
219
 
208
220
  // @ts-ignore possibly includes unused imports
209
221
  import { Pointer, WasmStringSlice, WasmTypeBase, WasmTypeConstructor } from "@thi.ng/wasm-api";
210
222
 
223
+ export enum EventType {
224
+ UNKNOWN,
225
+ MOUSE = 16,
226
+ KEY = 32,
227
+ }
228
+
229
+ /**
230
+ * Example struct
231
+ */
232
+ export interface MouseEvent extends WasmTypeBase {
233
+ type: EventType;
234
+ pos: Uint16Array;
235
+ }
236
+
237
+ export const $MouseEvent: WasmTypeConstructor<MouseEvent> = (mem) => ({
238
+ get align() {
239
+ return 4;
240
+ },
241
+ get size() {
242
+ return 8;
243
+ },
244
+ instance: (base) => {
245
+ return {
246
+ get __base() {
247
+ return base;
248
+ },
249
+ get __bytes() {
250
+ return mem.u8.subarray(base, base + 8);
251
+ },
252
+ get type(): EventType {
253
+ return mem.u8[base];
254
+ },
255
+ set type(x: EventType) {
256
+ mem.u8[base] = x;
257
+ },
258
+ get pos(): Uint16Array {
259
+ const addr = (base + 4) >>> 1;
260
+ return mem.u16.subarray(addr, addr + 2);
261
+ },
262
+ };
263
+ }
264
+ });
265
+
211
266
  /**
212
267
  * Example struct
213
268
  */
214
- export interface Foo extends WasmTypeBase {
215
- color: Float32Array;
216
- bars: Bar[];
269
+ export interface KeyEvent extends WasmTypeBase {
270
+ type: EventType;
271
+ key: WasmStringSlice;
217
272
  /**
218
- * Unique ID
273
+ * Bitmask of modifier keys
219
274
  */
220
- id: number;
275
+ modifiers: number;
221
276
  }
222
277
 
223
- export const $Foo: WasmTypeConstructor<Foo> = (mem) => ({
278
+ export const $KeyEvent: WasmTypeConstructor<KeyEvent> = (mem) => ({
224
279
  get align() {
225
- return 16;
280
+ return 4;
226
281
  },
227
282
  get size() {
228
- return 48;
283
+ return 16;
229
284
  },
230
285
  instance: (base) => {
286
+ let $key: WasmStringSlice | null = null;
231
287
  return {
232
288
  get __base() {
233
289
  return base;
234
290
  },
235
291
  get __bytes() {
236
- return mem.u8.subarray(base, base + 48);
292
+ return mem.u8.subarray(base, base + 16);
293
+ },
294
+ get type(): EventType {
295
+ return mem.u8[base];
237
296
  },
238
- get color(): Float32Array {
239
- const addr = base >>> 2;
240
- return mem.f32.subarray(addr, addr + 4);
297
+ set type(x: EventType) {
298
+ mem.u8[base] = x;
241
299
  },
242
- get bars(): Bar[] {
243
- const addr = (base + 16);
244
- const inst = $Bar(mem);
245
- const slice: Bar[] = [];
246
- for(let i = 0; i < 3; i++) slice.push(inst.instance(addr + i * 24));
247
- return slice;
300
+ get key(): WasmStringSlice {
301
+ return $key || ($key = new WasmStringSlice(mem, (base + 4), true));
248
302
  },
249
- get id(): number {
250
- return mem.u8[(base + 40)];
303
+ get modifiers(): number {
304
+ return mem.u8[(base + 12)];
251
305
  },
252
- set id(x: number) {
253
- mem.u8[(base + 40)] = x;
306
+ set modifiers(x: number) {
307
+ mem.u8[(base + 12)] = x;
254
308
  },
255
309
  };
256
310
  }
257
311
  });
258
312
 
259
- export interface Bar extends WasmTypeBase {
260
- kind: Kind;
261
- flags: number;
313
+ export interface Event extends WasmTypeBase {
314
+ mouse: MouseEvent;
315
+ key: KeyEvent;
262
316
  }
263
317
 
264
- export const $Bar: WasmTypeConstructor<Bar> = (mem) => ({
318
+ export const $Event: WasmTypeConstructor<Event> = (mem) => ({
265
319
  get align() {
266
320
  return 4;
267
321
  },
268
322
  get size() {
269
- return 8;
323
+ return 16;
270
324
  },
271
325
  instance: (base) => {
272
326
  return {
@@ -274,91 +328,92 @@ export const $Bar: WasmTypeConstructor<Bar> = (mem) => ({
274
328
  return base;
275
329
  },
276
330
  get __bytes() {
277
- return mem.u8.subarray(base, base + 8);
331
+ return mem.u8.subarray(base, base + 16);
278
332
  },
279
- get kind(): Kind {
280
- return mem.u16[base >>> 1];
333
+ get mouse(): MouseEvent {
334
+ return $MouseEvent(mem).instance(base);
281
335
  },
282
- set kind(x: Kind) {
283
- mem.u16[base >>> 1] = x;
336
+ set mouse(x: MouseEvent) {
337
+ mem.u8.set(x.__bytes, base);
284
338
  },
285
- get flags(): number {
286
- return mem.u32[(base + 4) >>> 2];
339
+ get key(): KeyEvent {
340
+ return $KeyEvent(mem).instance(base);
287
341
  },
288
- set flags(x: number) {
289
- mem.u32[(base + 4) >>> 2] = x;
342
+ set key(x: KeyEvent) {
343
+ mem.u8.set(x.__bytes, base);
290
344
  },
291
345
  };
292
346
  }
293
347
  });
294
-
295
- export enum Kind {
296
- UNKNOWN,
297
- GOOD = 100,
298
- BEST = 1000,
299
- }
300
348
  ```
301
349
  </details>
302
350
 
303
351
  <details><summary>generated.zig (generated Zig source)</summary>
304
352
 
305
353
  ```zig
306
- //! Generated by @thi.ng/wasm-api at 2022-10-03T15:32:12.341Z - DO NOT EDIT!
354
+ //! Generated by @thi.ng/wasm-api at 2022-10-26T08:36:16.827Z - DO NOT EDIT!
307
355
 
308
356
  const std = @import("std");
309
357
 
358
+ pub const EventType = enum(u8) {
359
+ UNKNOWN,
360
+ MOUSE = 16,
361
+ KEY = 32,
362
+ };
363
+
310
364
  /// Example struct
311
- pub const Foo = struct {
312
- color: @Vector(4, f32),
313
- bars: [3]Bar,
314
- /// Unique ID
315
- id: u8,
365
+ pub const MouseEvent = struct {
366
+ type: EventType,
367
+ pos: @Vector(2, u16),
316
368
  };
317
369
 
318
- pub const Bar = struct {
319
- kind: Kind,
320
- flags: u32,
370
+ /// Example struct
371
+ pub const KeyEvent = struct {
372
+ type: EventType,
373
+ key: []const u8,
374
+ /// Bitmask of modifier keys
375
+ modifiers: u8,
321
376
  };
322
377
 
323
- pub const Kind = enum(u16) {
324
- UNKNOWN,
325
- GOOD = 100,
326
- BEST = 1000,
378
+ pub const Event = union {
379
+ mouse: MouseEvent,
380
+ key: KeyEvent,
327
381
  };
328
382
  ```
329
383
  </details>
330
384
 
331
- On the TypeScript/JS side, the memory-mapped wrappers (e.g. `$Foo` and `$Bar`)
385
+ On the TypeScript/JS side, the memory-mapped wrappers (e.g. `$Event`)
332
386
  can be used in combination with the `WasmBridge` to obtain fully typed views
333
387
  (according to the generated types) of the underlying WASM memory. Basic usage is
334
388
  like:
335
389
 
336
390
  ```ts
337
391
  import { WasmBridge } from "@thi.ng/wasm-api";
338
- import { $Foo, Kind } from "./generated.ts";
392
+ import { $Event, EventType } from "./generated.ts";
339
393
 
340
394
  const bridge = new WasmBridge();
341
395
  // bridge initialization omitted here (see other examples below)
342
396
  // ...
343
397
 
344
398
  // Create an instance using the bridge's memory views
345
- // and mapping a `Foo` struct from given address
399
+ // and mapping a `Event` union from given address
346
400
  // (e.g. obtained from an exported WASM function/value)
347
- const foo = $Foo(bridge).instance(0x10000);
401
+ const event = $Event(bridge).instance(0x10000);
348
402
 
349
403
  // then use like normal JS object
350
- foo.color
351
- // Float32Array(4) [0.1, 0.2, 0.3, 0.4]
352
-
353
- // this even applies to arrays using other types
354
- foo.bars[2].kind = Kind.BEST;
404
+ event.mouse.pos
405
+ // Uint16Array(2) [100, 200]
355
406
 
356
407
  // IMPORTANT: any modifications like this are directly
357
408
  // applied to the underlying WASM memory...
409
+ event.mouse.pos[0] = 300;
410
+
411
+ event.mouse.type === EventType.MOUSE
412
+ // true
358
413
  ```
359
414
 
360
- **IMPORTANT:** Struct field setters are currently only supported for single
361
- values, incl. enums, strings, structs. The latter 2 will always be copied by
415
+ **IMPORTANT:** Field setters are currently only supported for single values,
416
+ incl. enums, strings, structs, unions. The latter 2 will always be copied by
362
417
  value (mem copy). Arrays or slices of strings do not currently provide write
363
418
  access...
364
419
 
@@ -395,9 +450,9 @@ The actual allocator is implementation specific and suitable generic mechanisms
395
450
  are defined for both the included Zig & C bindings. Please see for further
396
451
  reference:
397
452
 
398
- - [`/include/wasmapi.zig`](https://github.com/thi-ng/umbrella/blob/develop/packages/wasm-api/include/wasmapi.zig#L6):
453
+ - [`/zig/wasmapi.zig`](https://github.com/thi-ng/umbrella/blob/develop/packages/wasm-api/zig/wasmapi.zig#L64):
399
454
  comments about WASM-side allocator handling in Zig
400
- - [`/include/wasmapi.h`](https://github.com/thi-ng/umbrella/blob/develop/packages/wasm-api/include/wasmapi.h#L19):
455
+ - [`/include/wasmapi.h`](https://github.com/thi-ng/umbrella/blob/develop/packages/wasm-api/include/wasmapi.h#L18):
401
456
  comments about WASM-side allocator handling in C/C++
402
457
  - [`WasmBridge.allocate()`](https://docs.thi.ng/umbrella/wasm-api/classes/WasmBridge.html#allocate):
403
458
  allocating memory from JS side
@@ -490,6 +545,8 @@ API like so (Please also see
490
545
  [tests](https://github.com/thi-ng/umbrella/tree/develop/packages/wasm-api/test)
491
546
  & other examples in this readme):
492
547
 
548
+ Bindings file / lib:
549
+
493
550
  ```zig
494
551
  //! custom.zig - extern definitions of custom JS API
495
552
 
@@ -498,9 +555,11 @@ API like so (Please also see
498
555
  /// Here we declare an external binding belonging to the "custom" import group
499
556
  ///
500
557
  /// The bridge core API uses "wasmapi" as reserved import group name
501
- extern "custom" fn fillRandom(addr: usize, num: usize) void;
558
+ extern "custom" fn fillRandom(addr: [*]f32, num: usize) void;
502
559
  ```
503
560
 
561
+ Main Zig file:
562
+
504
563
  ```zig
505
564
  // Import JS core API
506
565
  const js = @import("wasmapi");
@@ -513,7 +572,7 @@ export fn test_randomVec4() void {
513
572
  js.printF32Array(foo[0..]);
514
573
 
515
574
  // populate foo with random numbers
516
- custom.fillRandom(@ptrToInt(&foo), foo.len);
575
+ custom.fillRandom(&foo, foo.len);
517
576
 
518
577
  // print result
519
578
  js.printF32Array(foo[0..]);
@@ -567,6 +626,12 @@ canvases.delete(0);
567
626
  // true
568
627
  ```
569
628
 
629
+ Since v0.15.0, the supplied Zig core bindings lib also includes a
630
+ [`ManagedIndex`](https://github.com/thi-ng/umbrella/blob/develop/packages/wasm-api/zig/managed-index.zig)
631
+ for similar dealings on the Zig side of the application. For example, in the
632
+ [@thi.ng/wasm-api-dom](https://github.com/thi-ng/umbrella/blob/develop/packages/wasm-api-dom/)
633
+ module this is used to manage Zig event listeners.
634
+
570
635
  ## Status
571
636
 
572
637
  **ALPHA** - bleeding edge / work-in-progress
@@ -600,7 +665,7 @@ node --experimental-repl-await
600
665
  > const wasmApi = await import("@thi.ng/wasm-api");
601
666
  ```
602
667
 
603
- Package sizes (gzipped, pre-treeshake): ESM: 6.29 KB
668
+ Package sizes (gzipped, pre-treeshake): ESM: 6.84 KB
604
669
 
605
670
  **IMPORTANT:** The package includes code generators for various languages which
606
671
  are **not** required for just using the API bridge. Hence, the usual package
@@ -691,7 +756,7 @@ folder):
691
756
  ```bash
692
757
  # compile WASM binary
693
758
  zig build-lib \
694
- --pkg-begin wasmapi node_modules/@thi.ng/wasm-api/include/wasmapi.zig --pkg-end \
759
+ --pkg-begin wasmapi node_modules/@thi.ng/wasm-api/zig/wasmapi.zig --pkg-end \
695
760
  -target wasm32-freestanding \
696
761
  -O ReleaseSmall -dynamic --strip \
697
762
  hello.zig