WACS.ComponentModel.Parser 0.2.2

dotnet add package WACS.ComponentModel.Parser --version 0.2.2
                    
NuGet\Install-Package WACS.ComponentModel.Parser -Version 0.2.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WACS.ComponentModel.Parser" Version="0.2.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WACS.ComponentModel.Parser" Version="0.2.2" />
                    
Directory.Packages.props
<PackageReference Include="WACS.ComponentModel.Parser" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WACS.ComponentModel.Parser --version 0.2.2
                    
#r "nuget: WACS.ComponentModel.Parser, 0.2.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WACS.ComponentModel.Parser@0.2.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WACS.ComponentModel.Parser&version=0.2.2
                    
Install as a Cake Addin
#tool nuget:?package=WACS.ComponentModel.Parser&version=0.2.2
                    
Install as a Cake Tool

WACS.ComponentModel.Parser

AOT-safe binary parser for WebAssembly Component Model .component.wasm files. Pure byte walker — no reflection, no Reflection.Emit, no analyzers required at consumer build time. Multi-targets net8.0 (AOT-marked) and netstandard2.1.

Why it's a separate package

Split out from WACS.ComponentModel so harness / runtime consumers can load components under NativeAOT or Unity IL2CPP without dragging in the full reflective ComponentInstance + ComponentBridge surface.

If all you need is "give me a .component.wasm and tell me what's inside" — types, imports, exports, embedded core modules, the wit-component custom-section blob — this is the package. If you need to actually instantiate and invoke a component, layer WACS.ComponentModel on top.

What's inside

using Wacs.ComponentModel.Runtime;
using Wacs.ComponentModel.Runtime.Parser;

byte[] bytes = File.ReadAllBytes("hello.component.wasm");
using var ms = new MemoryStream(bytes);

ComponentModule cm = ComponentBinaryParser.Parse(ms);

// Top-level sections in file order
foreach (RawComponentSection s in cm.RawSections)
    Console.WriteLine($"{s.Id}: {s.Payload.Length} bytes");

// Embedded core-wasm binaries
foreach (byte[] coreBytes in cm.CoreModuleBinaries)
{
    // Feed to Wacs.Core's BinaryModuleParser, or to wasm-tools, etc.
}

The parser produces:

  • ComponentModule — the parsed container; RawSections, SectionsOf(id), CoreModuleBinaries, NestedComponentBinaries.
  • Structured section readers (one per Component Model section ID): TypeSectionReader, ImportSectionReader, ExportSectionReader, CanonSectionReader, InstanceSectionReader, CoreInstanceSectionReader, AliasSectionReader, CustomSectionReader.
  • ComponentBinaryReader — primitive byte walker; LEB128, preamble check, section framing.

How it relates to the other WACS packages

Package Role
WACS.ComponentModel.Parser this — pure byte walker → ComponentModule
WACS.ComponentModel Builds on the parser; canonical-ABI lift/lower, ComponentInstance.Instantiate, resource handles, ComponentBridge
WACS.ComponentModel.Harness.Lib Build-time IL emitter that consumes ComponentModule to emit typed {World}Harness assemblies
WACS.ComponentModel.Harness.Runtime AOT-safe runtime support emitted harnesses link against
WACS.Transpiler.Lib AOT WASM→IL transpiler; consumes the embedded core modules via this parser

AOT story

  • net8.0 target is annotated IsAotCompatible=true; the parser is verified by the WACS AOT acceptance gate (AotAcceptanceTests) — no new IL warnings.
  • netstandard2.1 target is offered for analyzers and other build-time tooling that can't take a net8.0 dependency.
  • Zero allocations on the section-walk hot path beyond the byte[] payloads themselves; section payloads are sliced out of the input stream once, then handed to per-section readers on demand.

License

Apache-2.0

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on WACS.ComponentModel.Parser:

Package Downloads
WACS.ComponentModel

WebAssembly Component Model support for WACS. Provides the WIT IDL parser, component types, canonical ABI lift/lower, component instantiation, and the host binding surface for running .component.wasm modules on the WACS runtime and AOT transpiler.

WACS.ComponentModel.Harness.Lib

Build-time IL emitter for typed WIT harnesses. Takes a WIT contract (either as a directory of `.wit` files or a pre-parsed CtPackage set) and emits a .NET assembly containing the typed harness class with `LoadFrom(byte[])` + per-export typed methods. Two ergonomic surfaces over one emit core: `EmitToFile` / `EmitToStream` for persisted .dll output (the `wacs harness gen` flow) and `EmitInMemory` for immediate consumption (the `wacs run --wit-dir` flow). Targets net9.0 to use PersistedAssemblyBuilder for the AOT-clean save+load round-trip.

WACS.ComponentModel.Harness.Runtime

AOT-safe runtime support for typed WIT harnesses emitted by WACS.ComponentModel.Harness.Lib. Carries canonical-ABI memory readers / writers, string lift+lower for UTF-8/UTF-16/Latin1, the WitContract typed model for runtime + compile-time validation, and WitContractMismatchException. No reflection — every type here is callable from harness IL transpiled by NativeAOT or Unity IL2CPP.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.2 83 5/28/2026
0.2.1 180 5/28/2026