GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — PackageToJS: Derive WASI and shared memory support from wasm imports by kateinoigakukun · Pull Request #807 · swiftwasm/JavaScriptKit

Conversation

@kateinoigakukun

@kateinoigakukun kateinoigakukun commented Aug 18, 2026

Copy link
Copy Markdown
Member

The SwiftBuild backend's build directory doesn't encode the target triple, so detect the traits derived from it by parsing the imports of the product binary instead. The imports are now parsed as a part of the packaging build graph.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kateinoigakukun kateinoigakukun mentioned this pull request Aug 18, 2026
SwiftBuild support #791
Closed
@kateinoigakukun
PackageToJS: Derive WASI and shared memory support from wasm imports
9b9828e
The SwiftBuild backend's build directory doesn't encode the target triple, so
detect the traits derived from it by parsing the imports of the product binary
instead. The imports are now parsed as a part of the packaging build graph.
@kateinoigakukun
kateinoigakukun force-pushed the yt/rework-swiftbuild-support branch from 3f6620f to 9b9828e Compare August 18, 2026 12:24
@kateinoigakukun
Avoid import var Foundation.stderr
9544834
```
$ echo "@preconcurrency import var Foundation.stderr" | swiftly run +main-snapshot-2026-08-11 swiftc  - -o /dev/null
<stdin>:1:28: error: ambiguous name 'stderr' in module 'Foundation'
1 | @preconcurrency import var Foundation.stderr
  |                            `- error: ambiguous name 'stderr' in module 'Foundation'
2 |

Glibc.stderr:1:32: note: found this candidate
1 | nonisolated(unsafe) public var stderr: UnsafeMutablePointer<FILE>! { get }
  |                                `- note: found this candidate

/usr/include/stdio.h:151:14: note: found this candidate
149 | extern FILE *stdin;               /* Standard input stream.  */
150 | extern FILE *stdout;              /* Standard output stream.  */
151 | extern FILE *stderr;              /* Standard error output stream.  */
    |              `- note: found this candidate
152 | /* C89/C99 say they're macros.  Make them happy.  */
153 | #define stdin stdin
```

swiftlang/swift#89891
@kateinoigakukun
kateinoigakukun force-pushed the yt/rework-swiftbuild-support branch from 0a9d143 to 9544834 Compare August 18, 2026 13:10
kateinoigakukun and others added 6 commits August 19, 2026 09:19
@kateinoigakukun
CI: Install Swift toolchain preserving its usr/bin layout
e6cdd9d
Flattening the tarball into /usr/local makes SwiftPM derive a bogus
toolchain root, so the swiftbuild build system cannot find swiftc.
@kateinoigakukun
PackageToJS: Record every import kind while parsing wasm imports
0c6e582
Only memory imports were collected, so `WasmFeatures.isWASI` never saw
`wasi_snapshot_preview1` and the generated node.js dropped the WASI import
while still constructing a WASI instance.
@kateinoigakukun
PackageToJS: run per-target test runners under the swiftbuild build s…
ec72a95
…ystem

`swift package js test` assumed the native build system's single combined
`<Package>PackageTests` binary: it looked for one `.wasm`/`.xctest` under
`.build/<config>/`, packaged it, and ran it.

SwiftBuild produces no combined test binary. It emits one
`<TestTarget>-test-runner.wasm` per test target under `.build/out/Products/`,
plus an aggregate target that only orchestrates building them, so the old
lookup failed with "Failed to find 'JavaScriptKitPackageTests.wasm'".

(cherry picked from commit c12c7e9)
@kateinoigakukun
Install the JS event loop executor in async test targets
2b02b72
Because SwiftBuild mode produces a linked executable for each test
target.

(cherry picked from commit 0a1f926)
@kateinoigakukun
BridgeJS: Skip type handle registration for unlinked modules
35088fc
`js test` generates the glue from every test target's skeletons, but the
SwiftBuild build system links one binary per test target, so the eager
registration hit a missing export.
@kateinoigakukun
PackageToJS: Share the linked JS modules with the aggregated glue
bd8494b
The per-runner `bridge-js.js` copied to the base output directory for test
preludes imports its JavaScript modules relative to itself, so copy the
`bridge-js-modules` directory next to it.
@kateinoigakukun
kateinoigakukun marked this pull request as ready for review August 21, 2026 17:56
kateinoigakukun added 2 commits August 22, 2026 15:22
@kateinoigakukun
BridgeJS: Require the imports object for static-only imported types
281249a
An imported type looked up from `getImports` contributes its static methods
too, but only a constructor marked the imports object as needed, so the glue
referenced an undeclared `imports`.
@kateinoigakukun
PackageToJS: Generate each test bundle's glue from what its binary li…
137e41d
…nks in

`js test` generated the glue from every test target's skeletons and handed
the same copy to each SwiftBuild per-target runner, which described exports
those binaries don't have. Package the aggregated glue once into the shared
base directory, where preludes import it by a fixed path, and give each
runner glue scoped to the target it links in.

This supersedes the registration guard in the JS code generator.
@kateinoigakukun
kateinoigakukun merged commit cadafdc into main Aug 22, 2026
16 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@kateinoigakukun
kateinoigakukun deleted the yt/rework-swiftbuild-support branch August 22, 2026 08:46
This was referenced Aug 22, 2026
View conditions on @State do not work in embedded mode elementary-swift/elementary-ui#120
Closed
[SwiftBuild] PackageToJS plugin fails to generate correct js initializer code #796
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@kateinoigakukun
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.