Shipping updates
Replace a bundle without an app release, and fall back safely when an update does not fit the installed app.
A native bundle is a plain folder (app.hbc, app.baked, app.css, manifest.json). Your app loads it from a URL, so the folder does not have to live inside the app: you can download a newer one and launch that instead. This is how hot updates work with BakeNative.
Moving an existing app to BakeNative
BakeNative host protocol 4 changes the Hermes bindings used by bundles. Rebuild the embedded native host and the JavaScript bundle with the matching toolchain, then ship them in the same app update. Keep older installed hosts on their compatible OTA channel. A protocol 4 OTA requires the new host. A package loader that rejects an incompatible download can open the compatible embedded bundle.
The update unit
Ship the whole folder bake build produced for that target, every time. The pieces belong together:
app.bakedwas baked from that exactapp.hbc, and records its hash.manifest.jsonrecords the bytecode version, the host protocol, what the bundle requires from the app (requires), and a SHA-256 for each file, so your update server and the app agree on what a bundle is.
Replace app.hbc, app.baked and app.css together: write the new folder next to the old one and switch to it, never file by file.
BakeNative checks the pair before it shows anything. A snapshot baked from a different app.hbc is never on screen, not even for one frame, whether it comes from app.baked or from the on-device cache. The screen renders from JavaScript instead, no early input is replayed onto the wrong elements, and the next launch uses a first screen cached from the new app.hbc. A mixed folder still costs that first screen, so catch it before it ships:
bake release check dist/ios --against MyApp.xcframework
# ✗ dist/ios/manifest.json must not ship to MyApp 1.0.0 (the device would reject it and run the embedded bundle):
# app.hbc: not the file this manifest.json was built with (sha256 3f1c0a…, manifest 96ca16…)
# app.baked was baked from another app.hbc: the device would not show it (ship the app.hbc and app.baked of one build)Given the folder, bake release check also checks that its files are one build's: each file manifest.json lists is there with the SHA-256 it records, and app.baked was baked from this app.hbc.
Check before you launch
An update built by a newer bake may need a newer app. Check the downloaded bundle before you show it, and fall back to the one inside your app:
let downloaded = BakeNativeBundle(directory: updateDirectory)
let embedded = BakeNativeBundle(directory: Bundle.main.url(forResource: "ios", withExtension: nil)!)
let bundle = downloaded.isSupported ? downloaded : embedded
if let reason = downloaded.incompatibility {
print("skipping update:", reason) // e.g. "bundle host protocol 5 > supported 4"
}
let screen = BakeNativeViewController(bundle: bundle)A bundle is refused when:
| Reason | Meaning |
|---|---|
manifest.json missing | Bundles loaded from a folder must have their manifest |
bundle host protocol N > supported M | Built by a CLI that speaks a newer protocol than this app's BakeNative |
app.hbc missing or not Hermes bytecode | The download is incomplete or corrupted |
app.hbc is Hermes bytecode vX, this runtime runs vY | Compiled for a different Hermes version |
When a view launches, before anything is drawn, the Rust core also refuses a bundle whose requires this app's runtime does not provide, naming every missing or changed item:
| Reason | Meaning |
|---|---|
renderer batch op `X`: this runtime no longer reads it | The bundle writes a renderer op this runtime dropped |
renderer batch op `X`: its fields changed (bundle …, runtime …) | The op exists, with other fields |
event `X`: this runtime no longer dispatches it | The bundle listens to an event this runtime does not deliver |
style property `X`: this runtime no longer supports it | The bundle's CSS uses a property this runtime does not know |
runtime V is outside the bundle's range R | The app declared a runtime range |
Only what the bundle uses counts. A newer runtime that adds ops, events or properties, or numbers its renderer ops differently, runs older bundles unchanged. In an app package the package's own native modules are checked the same way (see Packaging: OTA compatibility), and bake release check <bundle> --against <package> gives the same answer in CI before you publish.
BakeNative runs these checks itself when a view launches. Checking first just lets you choose the fallback.
When something still goes wrong
BakeNative fails closed instead of leaving a screen that looks alive but is not:
- A snapshot file it cannot read is reported as an
.errorevent and skipped; the screen renders from JavaScript. - If hydration fails (the bytecode throws, or never renders), the snapshot is cleared and held input is dropped, so users are never tapping a dead screen. Listen for
.errorevents, or.metricswhosephaseis.failed(reason), to fall back to your embedded bundle.
On iOS, cached first screens follow the bundle
The on-device first-screen cache is keyed by the bundle's bytecode and CSS (the SHA-256s manifest.json records for them). A new bundle gets a new cache entry automatically; you do not have to clear anything. Each cached first screen also records the app.hbc it was made from and is checked like app.baked, so a folder whose app.hbc was replaced without its manifest.json never shows the old build's cached screen.
Ship as an Android AAR
Build the BakeNative runtime for Android into a Maven AAR with one native library per ABI, and add it to an app that has no BakeNative checkout.
Releasing to npm
How @bake-native/core and its toolchain packages are versioned, checked against the version table, and released with Changesets and npm trusted publishing.