Open
Conversation
* Built an opt-in tracing surface and wired it through the bridge when enabled by a new trait. Implemented `JSTracing` (start/end hooks for Swift→JS calls and JSClosure invocations) with per-thread storage in `Sources/JavaScriptKit/JSTracing.swift`. Added tracing entry points to Swift→JS calls (functions, methods via dynamic members with method names, constructors, and throwing calls) and JS→Swift closures so hooks fire around each bridge crossing when compiled with tracing; closure creation now records `StaticString` file IDs for reporting (`Sources/JavaScriptKit/FundamentalObjects/JSObject+CallAsFunction.swift`, `Sources/JavaScriptKit/FundamentalObjects/JSObject.swift`, `Sources/JavaScriptKit/FundamentalObjects/JSThrowingFunction.swift`, `Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift`). Introduced a `JavaScriptKitTracing` package trait that gates `JAVASCRIPTKIT_ENABLE_TRACING` and updated docs with enablement and usage guidance (`Package.swift`, `Sources/JavaScriptKit/Documentation.docc/Articles/Debugging.md`). Verified the manifest parses with `swift package dump-package`. Notes: Hooks are compiled out unless `--traits JavaScriptKitTracing` is provided, and JSClosure initializers now take `StaticString` for `file`. Next steps: try `swift build --traits JavaScriptKitTracing` and exercise hooks in your app; consider adding focused tests for tracing callbacks if desired. Tests not run (not requested). * Applied the review feedback: hooked tracing to the “Tracing” trait and removed the extra compdef, made JSClosure tracing use `String` file IDs, and avoided unknown placeholders for method names by allowing nil method names. - Updated trait name and removed redundant define; tracing is now gated by trait “Tracing” and uses `#if Tracing` (`Package.swift`). - Hooks now accept optional method names and closure file IDs as `String`, with all tracing conditionals using the trait flag (`Sources/JavaScriptKit/JSTracing.swift`, `Sources/JavaScriptKit/FundamentalObjects/JSObject+CallAsFunction.swift`, `Sources/JavaScriptKit/FundamentalObjects/JSThrowingFunction.swift`, `Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift`, `Sources/JavaScriptKit/FundamentalObjects/JSObject.swift`). - Documentation updated to instruct enabling tracing via `--traits Tracing` (`Sources/JavaScriptKit/Documentation.docc/Articles/Debugging.md`). Tests not run. Suggest running `swift build --traits Tracing` to verify the tracing variant compiles. * Added tracing unit coverage and wired the trait into the Makefile’s `unittest` target. - New `Tests/JavaScriptKitTests/JSTracingTests.swift` exercises JS→JS call hooks (ensures method info/method name/args) and JSClosure hooks (verifies file/line metadata and end callbacks) under `#if Tracing`. - Refactored tracing-overloaded helpers to avoid conditional parameters and added `Sendable` to `JSTracing` to satisfy Swift 6 safety (`Sources/JavaScriptKit/FundamentalObjects/JSObject+CallAsFunction.swift`, `Sources/JavaScriptKit/JSTracing.swift`). - `make unittest` now enables the `Tracing` trait so tracing hooks compile during test runs (`Makefile`). I attempted `swift test --traits Tracing`; the build passed the new tracing warnings but the compiler crashed later with an unrelated wasm memory.grow codegen bug, so tests didn’t finish. You can rerun `make unittest SWIFT_SDK_ID=<id>`; expect the same toolchain crash until Swift fixes that issue. * Add Swift 6.2 manifest and trait opt-out * Add Swift 6.2 manifest with tracing trait * Make tracing trait opt-out via env only * Add option to disable tracing trait in JavaScriptKit tests * Revert changes in Package.swift * Remove metadata fields from non-tracing builds
The custom executor feature is now hidden behind the `ExperimentalCustomExecutors` SPI until it goes through the evolution process. swiftlang/swift#86808
- `swift_js_pop_param_int32` -> `swift_js_pop_i32` - `swift_js_pop_param_f32` -> `swift_js_pop_f32` - `swift_js_pop_param_f64` -> `swift_js_pop_f64`
[BridgeJS] Formalizing ABI Part 1
…#556) Fix: Ensure BridgeJS.Macros.swift is processed by SwiftToSkeleton Regenerate BridgeJS files
* Fix missing comma in @_expose attribute for SwiftSyntax602 The SwiftSyntax602 code path in `buildExposeAttributes` was using array literal syntax to construct `LabeledExprListSyntax`, which doesn't set `trailingComma` on the AST nodes. This resulted in malformed attributes: `@_expose(wasm "name")` instead of `@_expose(wasm, "name")`. The fix uses the result builder syntax with explicit `.with(\.trailingComma, .commaToken())` to ensure the comma is present in the generated code. Also adds a dedicated `bridgejs-test` CI job that tests BridgeJS with multiple Swift/SwiftSyntax version combinations to ensure both code paths (pre-602 and 602+) are exercised: - Swift 6.0.3 with SwiftSyntax 600.0.1 - Swift 6.1.2 with SwiftSyntax 601.0.1 - Swift 6.2 with SwiftSyntax 602.0.0 Co-Authored-By: Claude Opus 4.5 <[email protected]> * Rename CI job to test-bridgejs-against-swift-versions * Simplify CI: let SPM resolve SwiftSyntax version naturally Remove sed-based version pinning that caused linker errors on Swift 6.2. Swift 6.2 ships with prebuilt SwiftSyntax 602.0.0, and forcing an exact version caused duplicate symbol errors during linking. Each Swift version naturally resolves to compatible SwiftSyntax: - Swift 6.0.x → SwiftSyntax 600.x - Swift 6.1.x → SwiftSyntax 601.x - Swift 6.2.x → SwiftSyntax 602.x Co-Authored-By: Claude Opus 4.5 <[email protected]> * Remove Swift 6.0.3 from test matrix The codebase uses trailing commas in argument lists (BridgeJSToolInternal.swift) which requires Swift 6.1+. Testing with 6.1.2 and 6.2 covers both SwiftSyntax code paths (non-602 and 602). Co-Authored-By: Claude Opus 4.5 <[email protected]> * Force SwiftSyntax 602.x for Swift 6.2 CI job On Swift 6.2, SPM resolves to SwiftSyntax 600.0.1 by default (per Package.swift), which doesn't have the SwiftSyntax602 module. Use sed to temporarily force SwiftSyntax 602.x so we actually test the SwiftSyntax602 code path. This also may avoid the prebuilt binary linker conflicts that occur with SwiftSyntax 600.0.1 on Swift 6.2. Co-Authored-By: Claude Opus 4.5 <[email protected]> * Disable experimental SwiftSyntax prebuilts for BridgeJS tests * Override swift-syntax version via environment variable --------- Co-authored-by: Claude Opus 4.5 <[email protected]> Co-authored-by: Yuta Saito <[email protected]>
* BridgeJS: Fix macro test suites silently ignoring failures * BridgeJS: Fix macro unit tests and macro implementations to pass tests
…or Swift glue code generation to use them (#554) BridgeJS: Add reusable intrinsics for stack-based types
BridgeJS: Enforce throws(JSException) on @js protocol methods
BridgeJS: Enforce throws(JSException) on @js protocol methods
BridgeJS: Add JSObject and @jsclass struct support for arrays and struct
…061feae89f16f BridgeJS: Remove `_BridgedSwiftDictionaryStackType` protocol
BridgeJS: Include namespace prefix in ABI names for namespace-nested classes and structs
…9798ee0a74047 BridgeJS: Migrate Dictionary tests to use conventional style
Add property access tracing to JSTracing
fix use-after-free
* pass unretained strings as tuple * Generalize lowering parameters with borrowing scope * factored out decodeString global * formatting * format (with Swift 6.2) --------- Co-authored-by: Yuta Saito <[email protected]>
…-stubs BridgeJS: Include properties and release() in declare global class stubs
…-lowering BridgeJS: Fix protocol existential lowering in Swift-to-JS direction
BridgeJS: Support protocol types in closure parameters and returns
BridgeJS: expand integer and raw-value enum support
BridgeJS: Correctly emit @js methods in extensions
* Bump Swift toolchain snapshots in `test.yml` Bumping to `2026-03-05` for 6.3 and `2026-03-09` for `main`. * Fix concurrency `@_spi` * Downgrade `main` snapshot to old version * Fix 6.3 build error * EmbeddedApp/main.swift: Fix capitalization in print statement * Add `Examples/EmbeddedConcurrency` * EmbeddedConcurrency: don't use `-c release` for SwiftSyntax Remove the '-c release' option from the build command. * Fix warnings with untyped throws, fix npm install error # Conflicts: # Examples/EmbeddedConcurrency/build.sh * Fix formatting * Bump `build-examples` snapshots to 2026-03-14 * Use 2026-03-09 for `main` development snapshots * Add Swift version check before building examples * Exercise `await` on `JSPromise/value` * Address PR feedback * Move `EmbeddedConcurrencyApp` to fixtures * Temporarily disable `main` snapshots * Removing crashing test from the PR
…eck (#705) Gate `ExperimentalCustomExecutors` usage behind Swift 6.4 for non-Wasm targets Seems like it's dropped in Swift 6.3 rc shipped along with Xcode 26.4 RC in the last minute
* BridgeJS: Correctly emit @js methods in extensions * BridgeJS: Improve test coverage for @js methods and properties in extensions * Fix formatting * Update test code to avoid accidentally introduced failure * Fix CI: update snapshots, formatting, runtime test, add docs and review feedback * BridgeJS: Regenerate snapshots and runtime bindings against current main --------- Co-authored-by: William Taylor <[email protected]> Co-authored-by: Max Desiatov <[email protected]>
* BridgeJS: support imports of `Promise` JS as `async` Swift * E2e testing of bridging Promise<interface> returns * fix formatting * `JSTypedClosure`-based approach * Clean up `BridgeJSLink` * Fix missing `import _Concurrency` * Fix formatting * Use `JSTypedClosure` without wrapping the result value * Make closure parameters as `sending` * Check more stack ABI types * Add support for `async` in `@JSFunction` * Use namespaced import * Fix missing `fetchWeatherData` * Bring back `fetchWeatherData` * Regenerate `fetchWeatherData` bridging code * BridgeJS: Centralize closure sig collection in BridgeSkeletonWalker * BridgeJS: Stop spreading isAsync handling outside of CallJSEmission * BridgeJS: Remove error-prone default effects in thunk generation * BridgeJSLink: Centralize async handling in ImportedThunkBuilder * BridgeJS: Remove reundant returnType from `call` family of methods in ImportedThunkBuilder --------- Co-authored-by: Yuta Saito <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )