Function swc_compiler_base::print

source ·
pub fn print<T>(
    cm: Lrc<SourceMap>,
    node: &T,
    source_file_name: Option<&str>,
    output_path: Option<PathBuf>,
    inline_sources_content: bool,
    source_map: SourceMapsConfig,
    source_map_names: &AHashMap<BytePos, JsWord>,
    orig: Option<&SourceMap>,
    comments: Option<&dyn Comments>,
    emit_source_map_columns: bool,
    preamble: &str,
    codegen_config: Config
) -> 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.