feat(native): expose a minimal macOS WebView host - #107
Open
pranavp311 wants to merge 9 commits into
Open
Conversation
Extract the system-WebView window primitive behind mer.native so downstream apps can present an existing loopback server without adopting the larger bridge, updater, or packaging roadmap. The host accepts only validated loopback inputs and terminates after the last window closes. Co-Authored-By: Codegraff <blackfloofie@codegraff.com>
Replace the duplicated Objective-C shell in the desktop example with mer.native and repair its Zig 0.16 ServerReady calls. The example now demonstrates the consumer-facing seam while preserving loopback-only server startup and process-lifetime ownership. Co-Authored-By: Codegraff <blackfloofie@codegraff.com>
Document the reusable loopback host and its explicit non-goals so bridge, packaging, signing, and cross-platform work stay out of this restart. Also make the desktop target regenerate routes before compiling to keep the example build reproducible. Co-Authored-By: Codegraff <blackfloofie@codegraff.com>
Reject invalid UTF-8 and off-main-thread launches before entering AppKit, and release owned Objective-C objects after the event loop exits. Document the contract and add a release-targeted macOS CI build so the framework's only native path is compiled and linked on its host platform. Co-Authored-By: Codegraff <blackfloofie@codegraff.com>
Convert the generated URL bytes to NSString before calling NSURL so WKWebView never receives a raw pointer as an Objective-C object. Extend native verification to release branches and tag releases, including framework tests and plist validation on macOS. Co-Authored-By: Codegraff <blackfloofie@codegraff.com>
Stop the AppKit event loop when the final window closes instead of entering NSApplication's process-termination path, preserving the public return contract. Match the activation-policy ABI and harden dynamic delegate registration against class collisions and failed setup. Co-Authored-By: Codegraff <blackfloofie@codegraff.com>
Objective-C class names are process-global, so verify that any reused delegate class resolves to this host's exact callback implementation. Retry lookup after an allocation race and reject collisions rather than invoking foreign lifecycle code. Co-Authored-By: Codegraff <blackfloofie@codegraff.com>
Initialize merjs's global std.Io backend before spawning the desktop server thread and wire the runtime module into the target. Without this, the app could compile successfully but fail immediately when Server.listen used uninitialized I/O state. Co-Authored-By: Codegraff <blackfloofie@codegraff.com>
Preserve the existing desktop guide structure while documenting only the new public host seam and current non-goals. This keeps the replacement PR within the repository's default 500-line review budget without weakening its runtime contract. Co-Authored-By: Codegraff <blackfloofie@codegraff.com>
This was referenced Aug 4, 2026
Author
|
Hosted validation update:\n\n- Fork macOS job passed framework tests, ReleaseSmall desktop compile/link, executable check, and |
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.
Supersedes #100 with the first deliberately small native macOS slice.
What changed
mer.native.runLoopback, a minimal public API that presents an already-bound loopback server in the systemNSWindow+WKWebView.Why
ServerReadyAPI, and could use the server beforeruntime.init. The previous native proposal grew to hundreds of files and mixed the shell with bridges, updaters, signing, packages, and unrelated framework work.Server.listenhas no graceful stop API yet.Validation
zig build test --summary all— 25 passed, 2 skippedzig build prodzig build clizig build desktop -Doptimize=ReleaseSmallplutil -lint zig-out/MerApp.app/Contents/Info.plistzig fmt --checkgit diff --check