PackageToJS: Fix skeleton file discovery path for build plugin output#591
Merged
krodak merged 1 commit intoswiftwasm:mainfrom Feb 5, 2026
Merged
Conversation
The SkeletonCollector was looking for BridgeJS.json at the wrong path for build-time generated files. Since commit 91d2f06, BridgeJSTool writes skeleton files to `destination/BridgeJS/JavaScript/BridgeJS.json`, but PackageToJS was searching in `destination/BridgeJS/BridgeJS.json` (missing the JavaScript/ subdirectory). This caused projects using dynamic BridgeJS generation via the build plugin to fail - PackageToJS couldn't find the skeleton files, resulting in HAS_BRIDGE=false and stub implementations in instantiate.js.
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.
Overview
Fixes skeleton file discovery in
SkeletonCollectorfor projects using the BridgeJS build plugin workflow.Since commit 91d2f06,
BridgeJSToolwrites skeleton files todestination/BridgeJS/JavaScript/BridgeJS.json, butPackageToJSwas searching indestination/BridgeJS/BridgeJS.json(missing theJavaScript/subdirectory).Issue
Projects using the BridgeJS build plugin for automatic code generation fail to produce
bridge-js.jsbecause PackageToJS cannot find the skeleton files:This results in
HAS_BRIDGE=falseand stub implementations ininstantiate.js.Example
A project using the build plugin workflow:
When building with
swift package js, the skeleton is generated but not discovered, resulting in missing exports inbridge-js.js.Root Cause
When the unified
generatesubcommand was introduced in 91d2f06, the output path was changed to includeJavaScript/subdirectory, but only one of the two search paths inSkeletonCollectorwas updated:target.directoryURL/Generated/JavaScript- works for command plugin / pre-generated filesdestination/BridgeJS- missing/JavaScriptFix
Add
/JavaScriptto the second search path to match the actual output location.Testing
Tested with a project using the BridgeJS build plugin workflow. After the fix,
bridge-js.jsis correctly generated with exported functions at the specified namespace.