Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ab19ba9
BridgeJS: support imports of `Promise` JS as `async` Swift
MaxDesiatov Mar 23, 2026
d741dce
E2e testing of bridging Promise<interface> returns
MaxDesiatov Mar 23, 2026
d0b207c
fix formatting
MaxDesiatov Mar 23, 2026
2b8bcaf
`JSTypedClosure`-based approach
MaxDesiatov Mar 24, 2026
7864617
Clean up `BridgeJSLink`
MaxDesiatov Mar 24, 2026
0e84003
Fix missing `import _Concurrency`
MaxDesiatov Mar 24, 2026
3044b3a
Fix formatting
MaxDesiatov Mar 24, 2026
8d4472e
Use `JSTypedClosure` without wrapping the result value
MaxDesiatov Mar 24, 2026
4244627
Merge branch 'main' into maxd/async-bridgejs
MaxDesiatov Mar 24, 2026
61fe95e
Make closure parameters as `sending`
MaxDesiatov Mar 24, 2026
cdb8013
Check more stack ABI types
MaxDesiatov Mar 26, 2026
695a715
Add support for `async` in `@JSFunction`
MaxDesiatov Mar 26, 2026
67ff8e6
Use namespaced import
MaxDesiatov Mar 26, 2026
ae831f1
Fix missing `fetchWeatherData`
MaxDesiatov Mar 26, 2026
a250ab3
Bring back `fetchWeatherData`
MaxDesiatov Mar 26, 2026
6d36763
Regenerate `fetchWeatherData` bridging code
MaxDesiatov Mar 26, 2026
b472133
BridgeJS: Centralize closure sig collection in BridgeSkeletonWalker
kateinoigakukun Mar 26, 2026
14561d4
BridgeJS: Stop spreading isAsync handling outside of CallJSEmission
kateinoigakukun Mar 26, 2026
4bfdfe7
BridgeJS: Remove error-prone default effects in thunk generation
kateinoigakukun Mar 26, 2026
a03b585
BridgeJSLink: Centralize async handling in ImportedThunkBuilder
kateinoigakukun Mar 26, 2026
22e7434
BridgeJS: Remove reundant returnType from `call` family of methods in…
kateinoigakukun Mar 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Benchmarks/Sources/Generated/JavaScript/BridgeJS.json
Original file line number Diff line number Diff line change
Expand Up @@ -2839,6 +2839,11 @@
{
"functions" : [
{
"effects" : {
"isAsync" : false,
"isStatic" : false,
"isThrows" : true
},
"name" : "benchmarkHelperNoop",
"parameters" : [

Expand All @@ -2850,6 +2855,11 @@
}
},
{
"effects" : {
"isAsync" : false,
"isStatic" : false,
"isThrows" : true
},
"name" : "benchmarkHelperNoopWithNumber",
"parameters" : [
{
Expand All @@ -2868,6 +2878,11 @@
}
},
{
"effects" : {
"isAsync" : false,
"isStatic" : false,
"isThrows" : true
},
"name" : "benchmarkRunner",
"parameters" : [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@
{
"functions" : [
{
"effects" : {
"isAsync" : false,
"isStatic" : false,
"isThrows" : true
},
"name" : "createTS2Swift",
"parameters" : [

Expand All @@ -260,6 +265,11 @@
],
"methods" : [
{
"effects" : {
"isAsync" : false,
"isStatic" : false,
"isThrows" : true
},
"name" : "convert",
"parameters" : [
{
Expand Down
11 changes: 7 additions & 4 deletions Plugins/BridgeJS/Sources/BridgeJSCore/ClosureCodegen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ public struct ClosureCodegen {
public init() {}

private func swiftClosureType(for signature: ClosureSignature) -> String {
let closureParams = signature.parameters.map { "\($0.closureSwiftType)" }.joined(separator: ", ")
let sendingPrefix = signature.sendingParameters ? "sending " : ""
let closureParams = signature.parameters.map { "\(sendingPrefix)\($0.closureSwiftType)" }.joined(
separator: ", "
)
let swiftEffects = (signature.isAsync ? " async" : "") + (signature.isThrows ? " throws" : "")
let swiftReturnType = signature.returnType.closureSwiftType
return "(\(closureParams))\(swiftEffects) -> \(swiftReturnType)"
Expand All @@ -29,6 +32,7 @@ public struct ClosureCodegen {
let builder = try ImportTS.CallJSEmission(
moduleName: "bjs",
abiName: externName,
effects: Effects(isAsync: signature.isAsync, isThrows: signature.isThrows),
returnType: signature.returnType,
context: .exportSwift
)
Expand Down Expand Up @@ -185,11 +189,10 @@ public struct ClosureCodegen {
}

public func renderSupport(for skeleton: BridgeJSSkeleton) throws -> String? {
let collector = ClosureSignatureCollectorVisitor()
var walker = BridgeTypeWalker(visitor: collector)
let collector = ClosureSignatureCollectorVisitor(moduleName: skeleton.moduleName)
var walker = BridgeSkeletonWalker(visitor: collector)
walker.walk(skeleton)
let closureSignatures = walker.visitor.signatures

guard !closureSignatures.isEmpty else { return nil }

var decls: [DeclSyntax] = []
Expand Down
3 changes: 3 additions & 0 deletions Plugins/BridgeJS/Sources/BridgeJSCore/ExportSwift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,7 @@ struct ProtocolCodegen {
let builder = try ImportTS.CallJSEmission(
moduleName: moduleName,
abiName: "_extern_\(method.name)",
effects: method.effects,
returnType: method.returnType,
context: .exportSwift
)
Expand Down Expand Up @@ -1327,6 +1328,7 @@ struct ProtocolCodegen {
let getterBuilder = try ImportTS.CallJSEmission(
moduleName: moduleName,
abiName: getterAbiName,
effects: Effects(isAsync: false, isThrows: false),
returnType: property.type,
context: .exportSwift
)
Expand Down Expand Up @@ -1360,6 +1362,7 @@ struct ProtocolCodegen {
let setterBuilder = try ImportTS.CallJSEmission(
moduleName: moduleName,
abiName: setterAbiName,
effects: Effects(isAsync: false, isThrows: false),
returnType: .void,
context: .exportSwift
)
Expand Down
Loading
Loading