@thi.ng/wasm-api 2.2.0 → 2.2.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 +8 -1
- package/deftype.js +12 -9
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-11-
|
|
3
|
+
- **Last updated**: 2024-11-13T12:46:52Z
|
|
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,13 @@ 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
|
+
### [2.2.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api@2.2.1) (2024-11-10)
|
|
13
|
+
|
|
14
|
+
#### 🩹 Bug fixes
|
|
15
|
+
|
|
16
|
+
- fix defType() property handling ([37bebee](https://github.com/thi-ng/umbrella/commit/37bebee))
|
|
17
|
+
- inject `__base` and `__bytes` getters using `Object.defineProperties()`
|
|
18
|
+
|
|
12
19
|
## [2.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/wasm-api@2.2.0) (2024-11-10)
|
|
13
20
|
|
|
14
21
|
#### 🚀 Features
|
package/deftype.js
CHANGED
|
@@ -9,15 +9,18 @@ const defType = (align, size, instance) => (mem) => ({
|
|
|
9
9
|
instanceArray(base, num) {
|
|
10
10
|
return __instanceArray(this, base, num);
|
|
11
11
|
},
|
|
12
|
-
instance: (base) =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
instance: (base) => {
|
|
13
|
+
const inst = instance(mem, base);
|
|
14
|
+
Object.defineProperties(inst, {
|
|
15
|
+
__base: { value: base },
|
|
16
|
+
__bytes: {
|
|
17
|
+
get() {
|
|
18
|
+
return mem.u8.subarray(base, base + size);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return inst;
|
|
23
|
+
}
|
|
21
24
|
});
|
|
22
25
|
export {
|
|
23
26
|
defType
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/wasm-api",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.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",
|
|
@@ -32,10 +32,10 @@
|
|
|
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": "zig test zig/tests.zig && bun test",
|
|
36
|
-
"test:build-zig-allocators": "zig build-exe -fno-entry -fstrip --stack 4096 -OReleaseSmall -target wasm32-freestanding --dep
|
|
37
|
-
"test:build-zig-custom": "zig build-exe -fno-entry -fstrip --stack 4096 -OReleaseSmall -target wasm32-freestanding --dep
|
|
38
|
-
"test:
|
|
35
|
+
"test": "zig test zig/tests.zig && yarn test:prepare && bun test",
|
|
36
|
+
"test:build-zig-allocators": "zig build-exe -fno-entry -fstrip --stack 4096 -OReleaseSmall -target wasm32-freestanding --dep wasm-api -Mroot=test/allocators.zig -Mwasm-api=zig/lib.zig --name allocators -rdynamic --import-symbols && mv allocators.wasm test",
|
|
37
|
+
"test:build-zig-custom": "zig build-exe -fno-entry -fstrip --stack 4096 -OReleaseSmall -target wasm32-freestanding --dep wasm-api -Mroot=test/custom.zig -Mwasm-api=zig/lib.zig --name custom -rdynamic --import-symbols && mv custom.wasm test",
|
|
38
|
+
"test:prepare": "yarn test:build-zig-allocators && yarn test:build-zig-custom",
|
|
39
39
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"status": "alpha",
|
|
125
125
|
"year": 2022
|
|
126
126
|
},
|
|
127
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "10a1633519e744335853d3c64d9d23d06d63cda4\n"
|
|
128
128
|
}
|