◐ Shell
clean mode source ↗

BridgeJS: Remove `@JS protocol` in favor of `@JSClass struct` by kateinoigakukun · Pull Request #560 · swiftwasm/JavaScriptKit

added 2 commits

February 3, 2026 14:13
…ss` interfaces.

- `Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift` now rejects `@JS protocol` with a clear diagnostic pointing to `@JSClass struct`; updated `ImportTS.swift` messaging accordingly.
- Dropped protocol fixtures/snapshots (`Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/Protocol.swift` and related snapshots); README/type-modeling notes now steer interface modeling toward `@JSClass` (`Plugins/BridgeJS/README.md`).
- Rewrote the DocC article to document `@JSClass` interface usage and migration steps (`Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md`).
- Removed protocol-based runtime APIs/tests, refreshed JS harness, and regenerated bridge outputs to align (`Tests/BridgeJSRuntimeTests/ExportAPITests.swift`, `Tests/prelude.mjs`, `Tests/BridgeJSRuntimeTests/Generated/*`).

Tests run:
- `swift test --package-path Plugins/BridgeJS`
…SClass`:

- Introduced a JSClass-based interface and manager to exercise property/method dispatch from Swift into plain JS objects (`Tests/BridgeJSRuntimeTests/ExportAPITests.swift`), using throwing JS calls via `try!` where required.
- Added a new JS-side scenario to drive the manager and verify interactions, backup swapping, tagging, labeling, and message passing (`Tests/prelude.mjs`).
- Regenerated BridgeJS outputs to reflect the new runtime APIs (`Tests/BridgeJSRuntimeTests/Generated/*`).

Tests: `make unittest SWIFT_SDK_ID=DEVELOPMENT-SNAPSHOT-2025-11-03-a-wasm32-unknown-wasip1` passed.

@kateinoigakukun kateinoigakukun changed the title Remove @JS protocol in favor of @JSClass Remove @JS protocol in favor of @JSClass struct

Feb 3, 2026

@kateinoigakukun kateinoigakukun changed the title Remove @JS protocol in favor of @JSClass struct BridgeJS: Remove @JS protocol in favor of @JSClass struct

Feb 3, 2026