Releases: bikallem/webapi
Releases · bikallem/webapi
webapi v0.5.0
v0.4.8
What's Changed
- Move
trimback towebapi/trimpackage (was incorrectly split into separate module) - Fix CI workflow paths for workspace restructure
- Move
gento separatewebapi-genworkspace module - Add
try_catch(on_ok, on_err)for uniform error recovery across JS and wasm-gc targets (#19) - Sort generated spec comments for deterministic codegen output
- Implement Show trait for ArgMbtType and Filename
- Fix build output paths for MoonBit v0.9
v0.4.7
What's Changed
- Add
try_catch(on_ok, on_err)utility for uniform error recovery across JS and wasm-gc targets (#19)- JS: catches abort, panic, and raise errors
- wasm-gc: catches raise errors and JS exceptions (abort traps are unrecoverable by wasm spec)
- Sort generated spec comments for deterministic codegen output
v0.4.6
v0.4.5
v0.4.4
Changed
- Moved examples from
src/examples/toexamples/at project root, removing the symlink.
Fixed
- Fixed wasm-gc
externrefmismatch forCSSOMStringreturns (#18). The code generator now usesjsvalue_to_string()for string alias types instead ofunsafe_cast(), which produced invalid wasm when converting nullableexternrefto non-nullable(ref extern).
v0.4.3
Added
- Added checked downcast method
try_into()on all generated interface types, returningT?with a runtimeinstanceofcheck. - Added
HasConstructortrait andjs_instanceof()FFI to support runtime type checks on both JS and wasm-gc targets. - Added
JsObject::get()method for dynamic property access, complementing the existingset().
Changed
- Renamed the unchecked downcast from
into()tounsafe_into()to clarify intent.
Deprecated
- Deprecated
into()in favor oftry_into()(safe) orunsafe_into()(explicit unchecked).
Fixed
- Fixed deprecated
into()call inJsValue::as_stringtemplate. - Removed accidentally committed dotfiles and stray entries.
v0.4.2
Changed
- Restructured repository to use a single root
moon.mod.jsonwith"source": "src". - Renamed
webapi/tosrc/,webapi_gen/tosrc/gen/,webapi_trim/tosrc/trim/. - Moved
examples/tosrc/examples/with a root-level symlink for navigation. - Flattened
src/gen/cmd/main/intosrc/gen/. - Unified all MoonBit packages under one module;
src/gen/excluded from publishing. - Simplified Makefile and CI for single-module layout.
- Sped up trim by building once and running via
nodeinstead ofmoon runper file.
Fixed
- Added
wasm-toolsinstall step to CI for wasm-gc binary validation. - Fixed Playwright tests 404 by using
src/examples/path instead of symlink.
Removed
- Removed
.githooks/and.claude/from version control.
v0.4.1
Fixed
- Updated the generated global browser accessors to use
document(),window(), andnavigator()consistently across the package and docs. - Fixed the example gallery and example builds after the global accessor API change so
make build-examplespasses again.
Changed
- Simplified
webapi_gen/base.mbtby merging backend-specific*_js.mbtand*_wasm.mbttemplate files into unified#cfg(...)-gated base templates.
Full Changelog: v0.4.0...v0.4.1
v0.4.0
Highlights
- Added first-class
wasm-gcsupport alongside the existing JS target. - Expanded the live demo gallery to 45 examples covering DOM, Fetch, Canvas, Streams, IndexedDB, Web Animations, WebSocket, URLPattern, File System Access, custom elements, and more.
- Broadened generated API coverage with variadic arguments, namespaces, special operations, more specs, richer dictionary support, and improved callback ergonomics.
- Added
webapi_trim, a CLI/tooling path for trimmingwebapi.mjsto only the modules required by a compiled wasm binary.
Breaking Changes
- Promise-returning APIs now use
JsPromise[T]instead of@js_async.Promise[T]. - For JS-only async/await integration, use the
bikallem/webapi/js_promisebridge package to convertJsPromise[T]values.
Added
- Added
JsPromise[T]support for both JS andwasm-gc, includingthen(),catch_(), andfinally_()helpers plus thewebapi/js_promisebridge package. - Added
webapi_trimfor producing minimalwebapi.mjsbundles from wasm imports, including function-level trimming and test coverage. - Added new bindings and examples across a wide range of APIs, including Console, timers, storage, clipboard, notifications, WebSocket, fullscreen, screen orientation, requestIdleCallback, pointer/touch/selection/resize/intersection observers, streams, IndexedDB, Web Animations, permissions, service workers, URLPattern, File System Access, Trusted Types, and more.
- Added custom element helpers and examples such as
wc-counter,wc-edit-word, and the largerwc-todo/wc-calculatorexamples. - Added generator support for WebIDL namespaces, variadic arguments, special operations (getter/setter/deleter), dictionary getters, dynamic
JsObjecthelpers, and additional overload handling.
Changed
- The generated bindings now target both backends throughout the pipeline, and backend-specific FFI is emitted through unified source files guarded with
#cfg(...). - The project layout was consolidated around the
webapi/module, with package metadata, examples, and tests updated to match. - The examples gallery, GitHub Pages deployment, and local development flow were expanded to support both JS and
wasm-gcdemos. - Generated runtime and emitters were refactored substantially to reduce duplication, improve determinism, and make backend behavior easier to reason about.
Fixed
- Fixed multiple
wasm-gcconversion issues, including callback wrapping, nullable returns, string handling, enum conversion, primitive array decoding, andUInt64/Int64BigInt bridging. - Fixed generated JS runtime issues around reserved words, hyphenated CSS property names, overloaded method name collisions, and namespace module key casing.
- Fixed bugs in example behavior and encapsulation, including per-instance component state and broader JS/wasm parity across demos.
- Fixed
webapi_trimrobustness issues, including UTF-8 import decoding, structured parse failures, resilient filtering, and proper non-zero CLI exits on fatal errors. - Fixed several generator correctness issues around dictionary inheritance gaps, stale output reconciliation, lexer position tracking, and nullable method/attribute conversion.
Quality and Tooling
- Grew end-to-end browser coverage to 339 Playwright tests across the example gallery.
- Added broader CI coverage for JS and
wasm-gcchecks, example builds, Pages deployment, andwebapi_trim. - Reworked large parts of the generator and parser internals to use smaller helpers, more deterministic output, and more MoonBit-idiomatic patterns.