Closed postspectacular closed 1 year ago
Done
Related addition (2024) about the new WasmModuleSpec
-based API module declarations:
Each of the support packages are now also providing the following module specs:
Package name | Module spec |
---|---|
@thi.ng/wasm-api-canvas |
WasmCanvasModule |
@thi.ng/wasm-api-dom |
WasmDomModule |
@thi.ng/wasm-api-schedule |
WasmScheduleModule |
@thi.ng/wasm-api-webgl |
WasmWebGLModule |
See Custom API modules for more info about how these module specs are used...
This issue is intended as a point of reference for the upcoming breaking naming changes in various
wasm-api-*
packages, which are all still in ALPHA, regardless of version number...Naming conventions for custom WASM API modules
The names of each custom WASM API module's TypeScript class should be a PascalCase'd version of the name of its parent package. The name of the interface for declared WASM exports should be the same name, suffixed with
Exports
, e.g.:@thi.ng/wasm-api-canvas
WasmCanvas
WasmCanvasExports
@thi.ng/wasm-api-dom
WasmDom
WasmDomExports
@thi.ng/wasm-api-schedule
WasmSchedule
WasmScheduleExports
C & Zig import paths
Any package exposing headers or libraries for C or Zig should place relevant files into following package structure:
/include/wasmapi_xxx.h
*/zig/lib.zig
* The
xxx
suffix would be related to the actual package name, e.g.wasmapi_dom.h
Zig import names
For consistency, the short name for Zig imports should be the unscoped name of the parent NPM package, instead of the currently somewhat arbitrarily chosen short name. E.g.:
Conclusion
Taken together, these changes will make it much easier for users to determine the correct names and import paths, even without IDE auto-completion...