Skip to content

[pull] main from swiftwasm:main#7

Open
pull[bot] wants to merge 1140 commits intomajacQ:mainfrom
swiftwasm:main
Open

[pull] main from swiftwasm:main#7
pull[bot] wants to merge 1140 commits intomajacQ:mainfrom
swiftwasm:main

Conversation

@pull
Copy link

@pull pull bot commented Jul 19, 2021

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 : )

@pull pull bot added ⤵️ pull merge-conflict Resolve conflicts manually labels Jul 19, 2021
@atomist atomist bot added auto-branch-delete:on-close Delete branch when pull request gets closed auto-merge-method:merge Auto-merge with merge commit auto-merge:on-bpr-success Auto-merge on passed branch protection rule labels Jul 19, 2021
@pull pull bot removed auto-branch-delete:on-close Delete branch when pull request gets closed auto-merge-method:merge Auto-merge with merge commit auto-merge:on-bpr-success Auto-merge on passed branch protection rule labels Jul 19, 2021
krodak and others added 22 commits January 26, 2026 19:07
BridgeJS: support closure types in imported JS APIs
…arget non-Swift/quoted JS property names (`Sources/JavaScriptKit/Macros.swift`).

- Plumbed `jsName` through the imported-property IR (`Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift`) and extraction (`Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift`).
- Updated TS→Swift generation to no longer drop quoted/invalid TS property names; it now emits Swift-safe identifiers plus `@JSGetter(jsName: ...)` / `@JSSetter(jsName: ...)` as needed (`Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js`).
- Updated JS glue + generated `.d.ts` to use bracket property access and quote invalid TS property keys (`Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift`).
- Updated snapshots; `swift test --package-path ./Plugins/BridgeJS` now passes (requires `npm ci` at repo root to provide `typescript`).
…erty name is a normal identifier, falling back to bracket access only when needed.

- Implementation: `Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift`
- Updated snapshots (including `Plugins/BridgeJS/Tests/BridgeJSToolTests/__Snapshots__/BridgeJSLinkTests/InvalidPropertyNames.Import.js:215`)
- `swift test --package-path ./Plugins/BridgeJS` passes
- Updated macro APIs: `Sources/JavaScriptKit/Macros.swift`
- Plumbed `jsName` through the imported skeleton + Swift parser: `Plugins/BridgeJS/Sources/BridgeJSSkeleton/BridgeJSSkeleton.swift`, `Plugins/BridgeJS/Sources/BridgeJSCore/SwiftToSkeleton.swift`
- Updated JS glue + generated `.d.ts` to use the JS names (dot access when possible, bracket access when needed): `Plugins/BridgeJS/Sources/BridgeJSLink/BridgeJSLink.swift`
- Updated TS→Swift generator to emit `@JSClass(jsName: ...)` / `@JSFunction(jsName: ...)` when it has to sanitize names: `Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js`
- Added coverage for a renamed class + quoted method name: `Plugins/BridgeJS/Tests/BridgeJSToolTests/Inputs/InvalidPropertyNames.d.ts` (snapshots refreshed; `swift test --package-path ./Plugins/BridgeJS` passes)
…ecl`, then again via `visitStructuredType` when the same type showed up in `seenTypes`), which caused the duplicate `_Weird` interface in `InvalidPropertyNames.Import.d.ts`.

- Change: `Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js` now records emitted class names in `emittedStructuredTypeNames` so the structured-type pass skips them.
- Snapshots refreshed; `swift test --package-path ./Plugins/BridgeJS` passes.
…ass`.

- Added new import API + XCTest: `Tests/BridgeJSRuntimeTests/bridge-js.d.ts`, `Tests/BridgeJSRuntimeTests/ImportAPITests.swift`
- Wired JS-side implementations: `Tests/prelude.mjs`
- Regenerated pre-generated files: `./Utilities/bridge-js-generate.sh` (updated `Tests/BridgeJSRuntimeTests/Generated/*`)
- Verified: `SWIFT_SDK_ID=DEVELOPMENT-SNAPSHOT-2025-11-03-a-wasm32-unknown-wasip1 make unittest` passes
Add struct-level helpers for copying values out of a backing JS object and raising a new JS object from a Swift struct.

This makes it possible to round-trip JSON-style plain objects without manual field mapping, while keeping the default value semantics of exported structs.
BridgeJS: support jsName for imported bindings
* BridgeJS: support UnsafePointer-family types

Allow UnsafePointer/UnsafeRawPointer/OpaquePointer as BridgeJS parameter/return and struct field types by lowering them to WASM pointers.

Updates codegen/runtime intrinsics and adds coverage in generator snapshots + runtime exports.

* Format
BridgeJS: add init(unsafelyCopying:) for @js structs
Add an opt-in from: .global source for @js* import macros so bindings can resolve values from globalThis without routing through the imports object.

Teach ts2swift/BridgeJSTool to accept --global <d.ts> inputs (e.g. bridge-js.global.d.ts) so global declarations are separated cleanly, and update generated artifacts + snapshots.
BridgeJS: allow imports from globalThis
* Benchmarks: add optional-return cases and improve runner

* Benchmarks: pass iterations without globals

* Run ./Utilities/bridge-js-generate.sh

---------

Co-authored-by: Krzysztof Rodak <krodak.konta@gmail.com>
BridgeJS: Use let for non-mutated __bjs_self in generated toJSObject()
BridgeJS: Support `@JS` Swift struct types in imported JS signatures
BridgeJS: Align naming for stack based types from "raise" to "lift"
kateinoigakukun and others added 30 commits February 20, 2026 01:01
BridgeJS: Fix memory management of SwiftHeapObject
BridgeJS: Fix `Array<@jsclass struct>` support on imported interfaces
…cess

BridgeJS: fix namespaced Swift class access in JS codegen
BridgeJS: Fix stack ordering for optional arrays and dictionaries
Now `Optional` conforms to `_BridgedSwiftStackType` whenever `Wrapped`
conforms to `_BridgedSwiftStackType`. This makes generic programming
easier and reduces boilerplate in intrinsics and codegen.

For specialized handling of certain types like associated value enums,
where the presence of a value is encoded as a sentinel case ID (-1),
we implement `bridgeJSStack{Push,Pop}AsOptional` methods, which is on
the witness table of `_BridgedSwiftStackType`.

Also now some of optional types no longer pushes placeholders values for
`nil` cases when pushing in JS and popping in Swift.
…9941ebaf3ac11

BridgeJS: Remove inline array lifting/lowering codegen
BridgeJS: Cover more Array cases in runtime tests
…#679)

BridgeJS: Move out default argument tests into a separate suite
…odegen

BridgeJS: Fix property codegen using unqualified type name for namespace-nested classes
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⤵️ pull merge-conflict Resolve conflicts manually

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants