pub enum CompileResult {
Success {
ast: Option<File>,
events: Vec<LoggerEvent>,
ordered_log: Vec<OrderedLogItem>,
renames: Vec<BindingRenameInfo>,
timing: Vec<TimingEntry>,
},
Error {
error: CompilerErrorInfo,
events: Vec<LoggerEvent>,
ordered_log: Vec<OrderedLogItem>,
timing: Vec<TimingEntry>,
},
}Expand description
Main result type returned by the compile function. Serialized to JSON and returned to the JS shim.
Variants§
Success
Compilation succeeded (or no functions needed compilation).
ast is None if no changes were made to the program.
The compiled Babel AST is returned by value so in-process Rust consumers
(the oxc/swc frontends) use it directly instead of round-tripping through
JSON. CompileResult still derives Serialize, so the napi consumer
serializes the whole result (inlining the File) as before.
Fields
events: Vec<LoggerEvent>ordered_log: Vec<OrderedLogItem>Unified ordered log interleaving events and debug entries. Items appear in the order they were emitted during compilation. The JS side uses this as the single source of truth (preferred over separate events/debugLogs arrays).
renames: Vec<BindingRenameInfo>Variable renames from lowering, for applying back to the Babel AST. Each entry maps an original binding name to its renamed version, identified by the binding’s declaration start position in the source.
timing: Vec<TimingEntry>Timing data for profiling. Only populated when __profiling is enabled.
Error
A fatal error occurred and panicThreshold dictates it should throw.
Fields
error: CompilerErrorInfoevents: Vec<LoggerEvent>ordered_log: Vec<OrderedLogItem>timing: Vec<TimingEntry>Timing data for profiling. Only populated when __profiling is enabled.