github elementary-swift/elementary-ui 0.7.0

4 hours ago

📦 Goodbye, bundled JavaScript runtime 📦

This release changes how ElementaryUI integrates with JavaScriptKit.

Until now, ElementaryUI bundled its own JavaScript browser runtime in the form of the now deprecated runApplication bootstrap function. With @elementary-swift/vite-plugin-swift-wasm 0.2, this is no longer necessary: the Vite plugin now integrates directly with JavaScriptKit’s SwiftPM plugin and uses its generated package output.

This removes the duplicated runtime setup from ElementaryUI and lets JavaScriptKit fully own the Swift ↔ JavaScript build integration - including BridgeJS - going forward.

When upgrading an existing project:

# Add JavaScriptKit as a dependency
swift package add-dependency https://github.com/swiftwasm/JavaScriptKit --from "0.58.0"
# Remove the bundled browser runtime from your package.json
npm remove elementary-ui-browser-runtime
# Upgrade the Vite plugin
npm install -D @elementary-swift/vite-plugin-swift-wasm@~0.2

Then adjust how you initialize the Swift module:

-import { runApplication } from "elementary-ui-browser-runtime";
-import appInit from "virtual:swift-wasm?init";
+import { init } from "virtual:swift-wasm?js";

-await runApplication(appInit);
+await init();

The ?js mode uses JavaScriptKit’s generated runtime and takes care of initializing it together with your Swift WebAssembly binary.

What's Changed

⚠️ JavaScriptKit runtime update (one last time)

# install/update the local BrowserRuntime package
npm install
# clear vite dev build cache
rm -rf node_modules/.vite

Full Changelog: 0.6.1...0.7.0

Don't miss a new elementary-ui release

NewReleases is sending notifications on new releases.