swc_compiler_base

Function print

source
pub fn print<T>(
    cm: Lrc<SourceMap>,
    node: &T,
    _: PrintArgs<'_>,
) -> Result<TransformOutput, Error>
where T: Node + VisitWith<IdentCollector>,
Expand description

Converts ast node to source string and sourcemap.

This method receives target file path, but does not write file to the path. See: https://github.com/swc-project/swc/issues/1255

This should be called in a scope of [swc_common::GLOBALS].