[GH-ISSUE #355] Feature request: Remove top-level await to enable bytecode compilation #92

Open
opened 2026-03-02 23:44:29 +03:00 by kerem · 0 comments
Owner

Originally created by @remorses on GitHub (Nov 27, 2025).
Original GitHub issue: https://github.com/anomalyco/opentui/issues/355

Bun's bytecode compilation reduces startup from ~520ms to ~44ms but requires no top-level await. This is blocking https://github.com/sst/opencode/issues/4843

There are 3 top-level await locations:

yoga-layout WASM

github.com/sst/opentui@5dbe0b4be9/packages/core/src/index.ts (L18)

yoga-layout uses async WebAssembly.instantiate() internally. Consider using FFI to native Yoga instead.

Platform import

github.com/sst/opentui@5dbe0b4be9/packages/core/src/zig.ts (L22)

Can use sync require() instead.

Native lib path resolution

github.com/sst/opentui@5dbe0b4be9/packages/core/scripts/build.ts (L139-L142)

Can use sync require.resolve() instead.

The platform import and native lib path are straightforward. Yoga is the main blocker.

Originally created by @remorses on GitHub (Nov 27, 2025). Original GitHub issue: https://github.com/anomalyco/opentui/issues/355 Bun's bytecode compilation reduces startup from ~520ms to ~44ms but requires no top-level await. This is blocking https://github.com/sst/opencode/issues/4843 There are 3 top-level await locations: **yoga-layout WASM** https://github.com/sst/opentui/blob/5dbe0b4be9b647f2d10ac90b63acdecf1a6998d8/packages/core/src/index.ts#L18 yoga-layout uses async `WebAssembly.instantiate()` internally. Consider using FFI to native Yoga instead. **Platform import** https://github.com/sst/opentui/blob/5dbe0b4be9b647f2d10ac90b63acdecf1a6998d8/packages/core/src/zig.ts#L22 Can use sync `require()` instead. **Native lib path resolution** https://github.com/sst/opentui/blob/5dbe0b4be9b647f2d10ac90b63acdecf1a6998d8/packages/core/scripts/build.ts#L139-L142 Can use sync `require.resolve()` instead. The platform import and native lib path are straightforward. Yoga is the main blocker.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#92
No description provided.