Skip to content

Tags: swiftwasm/JavaScriptKit

Tags

0.51.0

Toggle 0.51.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
[BridgeJS] Synthesize typed-closure init access from declaration surf…

…ace (#709) (#727)

* [BridgeJS] Synthesize typed-closure init access from declaration surface

Resolves #709: a public `@JSClass` exposing a
`JSTypedClosure<...>` parameter could not be consumed from another target
because the synthesized `extension JSTypedClosure { init(...) }` was always
internal, leaving downstream callers no way to construct the closure value
without hand-rolling a public wrapper.

Imported skeleton entries now record the source access level
(`public`/`package`/`internal`); the closure-signature collector takes the
maximum across every surface that references a given signature, and
`ClosureCodegen` prefixes the synthesized init with the resulting modifier
(internal stays bare). This matches the pattern `JSClassMacro` already uses
for `init(unsafelyWrapping:)`.

* [BridgeJS] Address PR feedback and refresh generated artifacts

- Make `accessLevel` decode-tolerant on imported skeleton structs
  (`ImportedFunctionSkeleton`, `ImportedConstructorSkeleton`,
  `ImportedGetterSkeleton`, `ImportedSetterSkeleton`,
  `ImportedTypeSkeleton`) by writing explicit `init(from:)` decoders
  that fall back to `.internal` when the key is missing. Without this,
  any pre-existing skeleton JSON without the new field fails decoding —
  the `build-examples` CI job hit `DecodingError.keyNotFound` for
  `accessLevel` against externally consumed skeletons.
- Extract a private `recordSignature` helper so `visitClosure` and
  `recordInjectedSignature` share a single merge implementation.
- Assert in `withAccessLevel(rawLevel:)` so unknown access strings
  ("open", "private", future schema additions) surface in debug
  builds instead of silently inheriting the outer level.
- Document the `.internal` seeding assumption on
  `ClosureSignatureCollectorVisitor.init(moduleName:signatures:)`.
- Regenerate the BridgeJS pre-generated artifacts under Benchmarks/,
  Examples/PlayBridgeJS/, Tests/BridgeJSIdentityTests/, and
  Tests/BridgeJSRuntimeTests/ via `./Utilities/bridge-js-generate.sh`,
  per CONTRIBUTING.md. The runtime-tests Swift output now emits
  `public init` on three `JSTypedClosure` extensions whose signatures
  surface through public exported types.

* [BridgeJS] Refresh identity tests skeleton after merge with main

#731 added the GC lifecycle test (with new imported function entries)
to main while this branch was open. Re-running the BridgeJS regen
against the merged tree fills in the `accessLevel` field on the new
entries that were absent at merge time.

* ci: retry flaky JSPromiseTests.testPromiseAndTimer

0.50.2

Toggle 0.50.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Merge pull request #717 from PassiveLogic/kr/fix-class-static-method-ts

BridgeJS: Emit static methods and properties on namespaced class entries

0.50.1

Toggle 0.50.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
relax swift-syntax version constraint to allow 603 (#714)

* relax swift-syntax version constraint to allow 603

Packages are updating to 603 and this can fail the dependency solver.

* .. and also test against it

0.50.0

Toggle 0.50.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Add JSRemote<JSObject> (#711)

Add `JSRemote<JSObject>` API for accessing JSObjects without transfer

The new API allows creating a handle for a `JSObject` that remains
on its original JavaScript thread and hopping back to that thread
to access the object when needed. This is useful for cases where the
object cannot be transferred to another thread, but occasional access
is still required or when we want to guarantee that an object is always
accessed on the same thread for safety (it should be statically
guaranteed with strict Sendable checking, but modules with language mode
5 don't have that).

Example:

```swift
let document = JSObject.global.document.object!
let remoteDocument = JSRemote(document)

let executor = try await WebWorkerTaskExecutor(numberOfThreads: 1)
let title = try await Task(executorPreference: executor) {
    try await remoteDocument.withJSObject { document in
        document.title.string ?? ""
    }
}.value
```

0.49.0

Toggle 0.49.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
BridgeJS: support imports of JS `Promise` as `async` Swift (#707)

* 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]>

0.48.0

Toggle 0.48.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Gate `ExperimentalCustomExecutors` usage behind Swift 6.4 compiler ch…

…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

0.47.1

Toggle 0.47.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Merge pull request #699 from PassiveLogic/kr/protocol-in-closure

BridgeJS: Support protocol types in closure parameters and returns

0.47.0

Toggle 0.47.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Merge pull request #693 from PassiveLogic/kr/fix-declare-global-class…

…-stubs

BridgeJS: Include properties and release() in declare global class stubs

0.46.5

Toggle 0.46.5's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Merge pull request #687 from gn-adin-b/adin/property-access-tracing

Add property access tracing to JSTracing

0.46.4

Toggle 0.46.4's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Merge pull request #683 from PassiveLogic/kr/namespace-abi-names

BridgeJS: Include namespace prefix in ABI names for namespace-nested classes and structs