1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! `compmd-host`: what every host of [CompMD](https://compmd.dev/) documents shares, whatever its platform
//! ([hosting], decision 1).
//!
//! A host builds a **bundle** before anyone reads (`@compmd/vite`, or `buildBundle`): the sandbox's frames under a
//! content hash, the packs it installs by their place, and a `manifest.json` describing it all. This crate reads that
//! bundle ([`Bundle`], [`Manifest`]), keeps the packs it fetches later in a [`Store`], and answers requests for both
//! with [`respond`], the serving contract every adapter puts behind its origin: a Tauri scheme, an Electron protocol,
//! a web server's route.
//!
//! ```
//! use compmd_host::{respond, Bundle, NoStore};
//!
//! let bundle = Bundle::from_files([
//! ("manifest.json", br#"{"format": 1, "frames": {"hash": "1df336e75685de8c"}}"#.to_vec()),
//! ("frames/1df336e75685de8c/strict.html", b"<!doctype html>".to_vec()),
//! ])?;
//! let request = http::Request::get("/frames/1df336e75685de8c/strict.html").body(())?;
//! let response = respond(&bundle, &NoStore, &request);
//! assert_eq!(response.status(), http::StatusCode::OK);
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
//!
//! With the `processor` feature, [`HostPacks`] gives the processor (`compmd`) the same packs the frames load.
//! Packs, releases, places and integrities are `compmd-pack`'s types, re-exported here as [`pack`], the same the
//! processor uses.
//!
//! [hosting]: https://github.com/comp-markdown/compmd/blob/main/docs/hosting.md
/// The names packs and their files are known by.
pub use compmd_pack as pack;
pub use ;
pub use BundleError;
pub use BundledPack;
pub use content_type;
pub use FolderStore;
pub use Frames;
pub use FramesHash;
pub use ;
pub use Library;
pub use ;
pub use ManifestError;
pub use NoStore;
pub use HostPacks;
pub use Refusal;
pub use ;
pub use ;
pub use Store;
pub use StoredRelease;
pub use Trust;