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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//! splicer — plan and generate WebAssembly component compositions.
//!
//! Most users only need the two top-level entry points:
//!
//! - [`splice`] — splice middleware into an existing composition.
//! - [`compose`] — synthesize a composition from N components.
//!
//! Both take a typed request struct and return a typed output struct
//! whose `wac_deps` field is shaped to be handed straight to
//! [`wac_resolver::FileSystemPackageResolver`](https://docs.rs/wac-resolver)
//! (or formatted into a `wac compose ... --dep ...` shell command).
//!
//! Advanced users who want more granular control can reach for the
//! lower-level building blocks under [`lowlevel`], or import the
//! shared types from [`types`].
//!
//! # Quick start
//!
//! ```no_run
//! # fn main() -> anyhow::Result<()> {
//! let rules_yaml = std::fs::read_to_string("splice.yaml")?;
//! let bundle = splicer::splice(splicer::SpliceRequest {
//! composition_wasm: "composition.wasm".into(),
//! rules_yaml,
//! package_name: "example:composition".into(),
//! splits_dir: "./splits".into(),
//! skip_type_check: false,
//! })?;
//!
//! // Compose to a single Wasm component, in-process — no shelling out.
//! let composed: Vec<u8> = bundle.to_wasm()?;
//! std::fs::write("composed.wasm", &composed)?;
//!
//! for adapter in &bundle.generated_adapters {
//! println!(
//! "generated adapter for middleware '{}' at {}",
//! adapter.middleware_name, adapter.adapter_path,
//! );
//! }
//! # Ok(())
//! # }
//! ```
//!
//! # Want to drive `wac compose` yourself?
//!
//! [`Bundle::wac`] and [`Bundle::wac_deps`] expose the raw inputs.
//! Write the WAC to disk and call [`Bundle::wac_compose_cmd`] to get
//! the equivalent `wac compose ... --dep ...` shell command, or feed
//! `wac_deps` directly into
//! [`wac_resolver::FileSystemPackageResolver`](https://docs.rs/wac-resolver)
//! — the keys are fully-qualified WAC package keys, the values are
//! `PathBuf`s, no translation step required.
//!
//! For finer control over the in-process path (e.g. a custom
//! filesystem search base for unresolved package references), reach
//! for [`compose_wac`].
//!
//! # Side effects on disk
//!
//! Both [`splice`] and [`compose`] write files as part of their work:
//!
//! - [`splice`] writes one `.wasm` file per sub-component into
//! `splits_dir` (the splitter pass), and may write
//! `splicer_adapter_*.wasm` files alongside them (the adapter
//! generator). Adapter paths are surfaced in
//! [`Bundle::generated_adapters`] and [`Bundle::wac_deps`].
//! - Neither function writes the generated WAC source — that's
//! returned in [`Bundle::wac`] for the caller to use however they
//! like (typically by passing the bundle to [`Bundle::to_wasm`]).
// ── Top-level entry points ────────────────────────────────────────
pub use ;
/// Re-export so consumers pick up the exact cviz version splicer
/// links against, avoiding version-skew on shared types.
pub use cviz;
// ── Shared types ──────────────────────────────────────────────────
/// Types that appear on the public API surface and may be useful to
/// import directly.
// ── Lower-level building blocks ───────────────────────────────────
/// Direct access to splicer's internal pipeline stages, for callers
/// that need finer control than [`splice`] / [`compose`] offer.
///
/// The function signatures here are not stable in the same way the
/// top-level entry points are — they reflect splicer's internal
/// pipeline shape and may change between releases as the pipeline
/// evolves.