pub fn detect_component_kind(wasm_bytes: &[u8]) -> ComponentKindExpand description
Detect whether a WASM binary is a Component Model module or a raw core module by inspecting its magic prefix and component section.
Component Model modules begin with the standard WASM magic (\0asm) and
version 1 header, then contain a component-section (ID = 3 for
core modules, but components use section ID 0x0b = 3 for the
component section after the core module envelope). We detect the
component section by checking for the 0x0b (component section) byte
at an appropriate position after the header.
If the binary is too short to contain a valid header, we return Raw
(the safest default).