Run the desktop's model layer in the browser (#557)

This commit is contained in:
Gregory Schier
2026-08-16 07:34:48 -07:00
committed by GitHub
parent 32e92d484b
commit 6f91f76064
36 changed files with 3266 additions and 24 deletions
+23
View File
@@ -0,0 +1,23 @@
import { setPlatform } from "./registry";
import { createWebPlatform } from "./web";
/**
* The package entry for browser builds, selected by aliasing
* `@yaakapp-internal/platform` to this file (see `YAAK_TARGET=web` in the
* client's vite.config.ts).
*
* A separate entry rather than a branch inside `index.ts`, because a branch
* would still leave `import "@tauri-apps/api"` in the module graph: the folded
* `if` disappears, but the imports it guarded do not, and those modules cannot
* be proven side-effect free. Splitting the entry means a web build never
* mentions Tauri at all — and it keeps `index.ts` exactly as the desktop has
* always had it.
*
* Like `index.ts`, this must install the host eagerly and synchronously:
* boot-time modules call commands while the module graph is still evaluating.
*/
setPlatform(createWebPlatform());
export * from "./capabilities";
export { platform, setPlatform } from "./registry";
export * from "./types";