@thi.ng/wasm-api 1.5.0 → 1.5.2

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-22T09:56:21Z
3
+ - **Last updated**: 2024-04-23T07:02:17Z
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
@@ -21,7 +21,7 @@
21
21
  - [API module auto-initialization](#api-module-auto-initialization)
22
22
  - [Object indices & handles](#object-indices--handles)
23
23
  - [Using the Zig build system](#using-the-zig-build-system)
24
- - [Zig v0.11.0 or newer](#zig-v0110-or-newer)
24
+ - [Zig v0.12 or newer](#zig-v012-or-newer)
25
25
  - [Example projects](#example-projects)
26
26
  - [Naming & structural conventions](#naming--structural-conventions)
27
27
  - [Status](#status)
@@ -315,11 +315,12 @@ This package provides utilities to simplify using hybrid TS/Zig WASM API modules
315
315
  which are distributed as NPM packages. Using these utils, a build file for Zig's
316
316
  built-in build system is as simple as:
317
317
 
318
- ### Zig v0.11.0 or newer
318
+ ### Zig v0.12 or newer
319
319
 
320
320
  **IMPORTANT:** Due to recent [syntax & build system changes in Zig
321
- v0.11.0](https://ziglang.org/download/0.11.0/release-notes.html), support for
322
- older Zig versions had to be removed...
321
+ v0.12.0](https://ziglang.org/download/0.12.0/release-notes.html), older Zig
322
+ versions are not actively unsupported (however build files for v0.10 and v0.11
323
+ are still included)
323
324
 
324
325
  ```zig
325
326
  const std = @import("std");
@@ -470,12 +471,13 @@ scenarios add the supplied .zig file(s) to your `build.zig` and/or source
470
471
  folder):
471
472
 
472
473
  ```bash
473
- # compile WASM binary
474
- zig build-lib \
475
- --pkg-begin wasm-api node_modules/@thi.ng/wasm-api/zig/lib.zig --pkg-end \
476
- -target wasm32-freestanding \
477
- -O ReleaseSmall -dynamic -rdynamic \
478
- hello.zig
474
+ # compile WASM binary (zig v0.12)
475
+ zig build-exe \
476
+ -fno-entry -fstrip -OReleaseSmall -target wasm32-freestanding \
477
+ --name hello -rdynamic --import-symbols \
478
+ --dep wasm-api \
479
+ -Mroot=hello.zig \
480
+ -Mwasm-api=node_modules/@thi.ng/wasm-api/zig/lib.zig
479
481
 
480
482
  # disassemble WASM
481
483
  wasm-dis -o hello.wast hello.wasm
@@ -485,29 +487,24 @@ The resulting WASM:
485
487
 
486
488
  ```wasm
487
489
  (module
488
- (type $i32_i32_=>_none (func (param i32 i32)))
489
- (type $none_=>_none (func))
490
- (type $i32_=>_i32 (func (param i32) (result i32)))
491
- (import "wasmapi" "_printStr" (func $fimport$0 (param i32 i32)))
492
- (global $global$0 (mut i32) (i32.const 1048576))
493
- (memory $0 17)
494
- (data (i32.const 1048576) "hello world!\00")
495
- (export "memory" (memory $0))
496
- (export "start" (func $0))
497
- (export "_wasm_allocate" (func $1))
498
- (export "_wasm_free" (func $2))
499
- (func $0
500
- (call $fimport$0
501
- (i32.const 1048576)
502
- (i32.const 12)
503
- )
504
- )
505
- (func $1 (param $0 i32) (result i32)
506
- (i32.const 0)
507
- )
508
- (func $2 (param $0 i32) (param $1 i32)
509
- )
510
- )
490
+ (type $t0 (func (param i32 i32)))
491
+ (type $t1 (func))
492
+ (type $t2 (func (param i32) (result i32)))
493
+ (import "wasmapi" "_printStr" (func $wasmapi._printStr (type $t0)))
494
+ (func $start (type $t1)
495
+ (call $wasmapi._printStr
496
+ (i32.const 1048576)
497
+ (i32.const 12)))
498
+ (func $_wasm_allocate (type $t2) (param $p0 i32) (result i32)
499
+ (i32.const 0))
500
+ (func $_wasm_free (type $t0) (param $p0 i32) (param $p1 i32))
501
+ (memory $memory 17)
502
+ (global $g0 (mut i32) (i32.const 1048576))
503
+ (export "memory" (memory $memory))
504
+ (export "start" (func $start))
505
+ (export "_wasm_allocate" (func $_wasm_allocate))
506
+ (export "_wasm_free" (func $_wasm_free))
507
+ (data $d0 (i32.const 1048576) "hello world!\00"))
511
508
  ```
512
509
 
513
510
  ### C version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/wasm-api",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Generic, modular, extensible API bridge and infrastructure for hybrid JS & WebAssembly projects",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -27,7 +27,7 @@
27
27
  "build": "yarn build:esbuild && yarn build:decl",
28
28
  "build:decl": "tsc --declaration --emitDeclarationOnly",
29
29
  "build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
30
- "clean": "rimraf --glob '*.js' '*.d.ts' '*.map' doc",
30
+ "clean": "bun ../../tools/src/clean-package.ts",
31
31
  "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
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",
@@ -37,18 +37,17 @@
37
37
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
38
38
  },
39
39
  "dependencies": {
40
- "@thi.ng/api": "^8.11.0",
41
- "@thi.ng/arrays": "^2.9.4",
42
- "@thi.ng/checks": "^3.6.2",
43
- "@thi.ng/errors": "^2.5.5",
44
- "@thi.ng/hex": "^2.3.44",
45
- "@thi.ng/idgen": "^2.2.39",
46
- "@thi.ng/logger": "^3.0.10"
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"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@microsoft/api-extractor": "^7.43.0",
50
50
  "esbuild": "^0.20.2",
51
- "rimraf": "^5.0.5",
52
51
  "typedoc": "^0.25.12",
53
52
  "typescript": "^5.4.3"
54
53
  },
@@ -116,5 +115,5 @@
116
115
  "status": "alpha",
117
116
  "year": 2022
118
117
  },
119
- "gitHead": "4e2bf6b12e35192e678b525fa699429370e357d3\n"
118
+ "gitHead": "5dd66c18a3862a3af69a5b2f49563f7cbdd960c2\n"
120
119
  }
@@ -1,8 +1,10 @@
1
1
  //! DEPRECATED build helpers for using modules/packages distributed via NPM
2
2
  //! Intended for use with https://thi.ng/wasm-api and support packages
3
3
  //!
4
- //! This version of the script is only compatible with Zig v0.10.1 or older
5
- //! Use build-v0.11.zig (in this same directory) for newer Zig versions
4
+ //! This version of the script is only compatible with:
5
+ //! Zig v0.10.1 or older
6
+ //!
7
+ //! Use other build.zig files in this same directory for newer Zig versions
6
8
 
7
9
  const std = @import("std");
8
10
 
@@ -1,10 +1,10 @@
1
- //! Build helpers for using modules/packages distributed via NPM
1
+ //! DEPRECATED build helpers for using modules/packages distributed via NPM
2
2
  //! Intended for use with https://thi.ng/wasm-api and support packages
3
3
  //!
4
4
  //! This version of the script is only compatible with:
5
- //! Zig 0.11.0-dev.3857+7322aa118 or newer
5
+ //! Zig v0.11.0
6
6
  //!
7
- //! Use build.zig (in this same directory) for earlier Zig versions
7
+ //! Use other build.zig files in this same directory for other Zig versions
8
8
 
9
9
  const std = @import("std");
10
10
  const Build = std.Build;
package/zig/build.zig CHANGED
@@ -2,9 +2,9 @@
2
2
  //! Intended for use with https://thi.ng/wasm-api and support packages
3
3
  //!
4
4
  //! This version of the script is only compatible with:
5
- //! Zig 0.11.0-dev.3857+7322aa118 or newer
5
+ //! Zig v0.12.0 or newer
6
6
  //!
7
- //! Use build.zig (in this same directory) for earlier Zig versions
7
+ //! Use other build.zig files in this same directory for older Zig versions
8
8
 
9
9
  const std = @import("std");
10
10
  const Build = std.Build;
File without changes
File without changes
File without changes
File without changes
File without changes