The main crate of the swc project.
This is documentation for building custom build tools on top of swc.
swc has swc_css, which re-exports required modules.
See [testing] and swc_ecma_transform_testing.
It’s basically an interned string. See swc_atoms.
See swc_atoms for detailed description.
See swc_visit for detailed description.
See the doc on swc_ecma_ast::Ident or on [swc_ecma_transforms_base::resolver::resolver_with_mark].
See [swc_ecma_utils::Id]. You can use [swc_ecma_utils::IdentLike::to_id] to extract important parts of an swc_ecma_ast::Ident.
If you want to prepend statements to the beginning of a file, you can use
swc_ecma_utils::prepend_stmts or [swc_ecma_utils::prepend] if
len == 1.
These methods are aware of the fact that
"use strict" directive should be
first in a file, and insert statements after directives.
Each stuffs are documented at itself.
If you want to create swc_ecma_ast::MemberExpr, you can use [swc_ecma_utils::ExprFactory::as_obj] to create object field.
The visitor expands to a lot of code. You can reduce it by using macros like
Note that this will make typescript-related nodes not processed, but it’s
typically fine as
typescript::strip is invoked at the start and it removes