Repository navigation
BridgeJS: Fix building the BridgeJS and PackageToJS plugins on Windows - #838
Merged
kateinoigakukun merged 1 commit intoDec 1, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PTxV5VQUn7st6eUgooE127
kateinoigakukun
approved these changes
Dec 1, 2026
Contributor
Author
|
it seems one runner didn't come online properly |
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.
On a Windows host, a package that uses the BridgeJS or PackageToJS plugin doesn't build, because three host-side files import symbols that don't exist there:
TS2Swift.swiftimportsfunc Foundation.killunconditionally. Its one use is already in the#elsebranch of#if os(Windows), which callsTerminateProcess(Allow Swift projects that use JavaScriptKit to compile on Windows #673), so the import moves into the#elseof the file's existing#if os(Windows)/import WinSDKblock.BridgeJSTool.swiftandPackageToJSPlugin.swiftimportstderrfrom Darwin, Glibc, Musl or Android, with no Windows branch. ucrt definesstderronly as a macro, which Swift can't import; Foundation exports it on Windows, so the new branch importsFoundation.stderr.Nothing changes on other platforms.
Testing
Windows 11, Swift 6.4.1 (
swift-6.4.1-RELEASE_wasmSDK), repository cloned withcore.symlinks=true, Node 26.13.1,npm ci:main(1edf6b3)swift build --package-path Plugins/BridgeJSfunction 'kill' does not exist in module 'Foundation', thencannot find 'stderr' in scope(BridgeJSTool.swift)Examples/ExportSwift:swift build --swift-sdk …cannot find 'stderr' in scope(PackageToJSPlugin.swift)Examples/ExportSwift:swift package --swift-sdk … js --use-cdnMyApp.wasm,bridge-js.js,index.js, …)BridgeJSTool generateonExamples/ImportTS(runs ts2swift through Node)BridgeJS.swiftandBridgeJS.Macros.swift./Utilities/format.swift's swift-format reports no changes to the three files.Not fixed here
These are separate issues I hit on Windows while testing; happy to open issues or follow-up PRs:
which()inTS2Swift.swiftlooks fornode, notnode.exe, so Node is never found onPATHon Windows;bridge-js.config.local.jsonworks around it (JAVASCRIPTKIT_NODE_EXECdoesn't reach the tool under SwiftPM).BridgeJSToolgetsPATHbut notSystemRoot. Without it Winsock can't initialise, andProcess.run()traps in Foundation ("Could not create wakeup socket pair for CFSocket") when ts2swift starts. WithPATHandSystemRootset it works, as in the last row above.mkdtempinTemporaryDirectory.swift), so I couldn't runswift test --package-path ./Plugins/BridgeJSthere; CI's Linux and macOS runs cover this change, which is a no-op on those platforms.Examples/ImportTShas notsconfig.json, which the build plugin requires, so it doesn't build on any platform. I added one locally to test the last row.Written with Claude Code; the tests above were run on my Windows machine.
🤖 Generated with Claude Code
https://claude.ai/code/session_01PTxV5VQUn7st6eUgooE127