[pull] main from swiftwasm:main by pull[bot] · Pull Request #7 · majacQ/JavaScriptKit
* 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`
…#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 <noreply@anthropic.com> * 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 <noreply@anthropic.com> * 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 <noreply@anthropic.com> * 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 <noreply@anthropic.com> * Disable experimental SwiftSyntax prebuilts for BridgeJS tests * Override swift-syntax version via environment variable --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Yuta Saito <kateinoigakukun@gmail.com>
* 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
* 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 <yuta@goodnotes.com>
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 <git@will.au> Co-authored-by: Max Desiatov <m_desiatov@apple.com>
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