Struct swc::Compiler [−][src]
Fields
cm: Arc<SourceMap>
CodeMap
handler: Arc<Handler>
Implementations
impl Compiler
[src]
These are low-level apis.
pub fn globals(&self) -> &Globals
[src]
pub fn comments(&self) -> &SwcComments
[src]
pub fn run<R, F>(&self, op: F) -> R where
F: FnOnce() -> R,
[src]
F: FnOnce() -> R,
Runs op
in current compiler’s context.
Note: Other methods of Compiler
already uses this internally.
pub fn parse_js(
&self,
fm: Arc<SourceFile>,
target: JscTarget,
syntax: Syntax,
is_module: bool,
parse_comments: bool
) -> Result<Program, Error>
[src]
&self,
fm: Arc<SourceFile>,
target: JscTarget,
syntax: Syntax,
is_module: bool,
parse_comments: bool
) -> Result<Program, Error>
This method parses a javascript / typescript file
pub fn print<T>(
&self,
node: &T,
target: JscTarget,
source_map: SourceMapsConfig,
orig: Option<&SourceMap>,
minify: bool
) -> Result<TransformOutput, Error> where
T: Node,
[src]
&self,
node: &T,
target: JscTarget,
source_map: SourceMapsConfig,
orig: Option<&SourceMap>,
minify: bool
) -> Result<TransformOutput, Error> where
T: Node,
impl Compiler
[src]
High-level apis.
pub fn new(cm: Arc<SourceMap>, handler: Arc<Handler>) -> Self
[src]
pub fn read_config(
&self,
opts: &Options,
name: &FileName
) -> Result<Option<Config>, Error>
[src]
&self,
opts: &Options,
name: &FileName
) -> Result<Option<Config>, Error>
pub fn config_for_file<'a>(
&'a self,
opts: &Options,
name: &FileName
) -> Result<Option<BuiltConfig<impl 'a + Fold>>, Error>
[src]
&'a self,
opts: &Options,
name: &FileName
) -> Result<Option<BuiltConfig<impl 'a + Fold>>, Error>
This method returns None if a file should be skipped.
This method handles merging of config.
This method does not parse module.
pub fn run_transform<F, Ret>(&self, external_helpers: bool, op: F) -> Ret where
F: FnOnce() -> Ret,
[src]
F: FnOnce() -> Ret,
pub fn transform(
&self,
program: Program,
external_helpers: bool,
pass: impl Fold
) -> Program
[src]
&self,
program: Program,
external_helpers: bool,
pass: impl Fold
) -> Program
pub fn process_js_with_custom_pass<P>(
&self,
fm: Arc<SourceFile>,
opts: &Options,
custom_after_pass: P
) -> Result<TransformOutput, Error> where
P: Fold,
[src]
&self,
fm: Arc<SourceFile>,
opts: &Options,
custom_after_pass: P
) -> Result<TransformOutput, Error> where
P: Fold,
custom_after_pass
is applied after swc transforms are applied.
pub fn process_js_file(
&self,
fm: Arc<SourceFile>,
opts: &Options
) -> Result<TransformOutput, Error>
[src]
&self,
fm: Arc<SourceFile>,
opts: &Options
) -> Result<TransformOutput, Error>
pub fn process_js(
&self,
program: Program,
opts: &Options
) -> Result<TransformOutput, Error>
[src]
&self,
program: Program,
opts: &Options
) -> Result<TransformOutput, Error>
You can use custom pass with this method.
There exists a PassBuilder to help building custom passes.
Auto Trait Implementations
impl !RefUnwindSafe for Compiler
impl Send for Compiler
impl Sync for Compiler
impl Unpin for Compiler
impl !UnwindSafe for Compiler
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Node for T where
T: Any + ?Sized,
[src]
T: Any + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,