Skip to main content

Crate tauri_plugin_compmd

Crate tauri_plugin_compmd 

Source
Expand description

tauri-plugin-compmd: the Tauri adapter of CompMD’s hosting (docs/tauri-plugin.md, docs/hosting.md).

What every host does is shared: the configuration, the bundle @compmd/vite builds from the page’s own @compmd/sandbox, the pack store and the serving contract (compmd-host). The plugin does the four things only Tauri can: it embeds the bundle in the app, serves it on the scheme the bundle was built for, gives the page the origin, and gives the store a folder.

The bundle is written by @compmd/vite (compmd({ out: "src-tauri/compmd", source: "compmd://localhost/" })); the app’s build.rs embeds it, with the build feature:

tauri_plugin_compmd::build::bundle("compmd");

and its main passes it to the plugin:

ⓘ
tauri::Builder::default().plugin(tauri_plugin_compmd::init(tauri_plugin_compmd::include_bundle!()))

The page then takes everything from its own bundle and the origin from the plugin, and passes nothing:

import { sandbox } from "virtual:compmd";
const view = createSandbox({ ...sandbox, page: "host" }).open(container, { components });

Re-exports§

pub use compmd_host;

Macros§

include_bundle
The bundle build::bundle embedded in the app, or None when the build found none (with a warning then): the plugin then serves nothing, and the page reports that its frames didn’t load.

Structs§

Compmd
The bundle the app serves, where, and the store of the packs it fetches, as the app’s state (app.compmd()). The bundle and the store are shared, so the processor can keep them as its packs (packs).

Traits§

CompmdExt
What the plugin gives Rust code of the app.

Functions§

init
The plugin, serving bundle on the scheme its manifest names (compmd), with the origin given to the app’s pages and the pack store in the app’s data folder.