Cargo Features
swc_core has no features set by default.
[dependencies]
swc_core = { version = "5.0.2", features = ["scoped-alloc", "common_ahash", "transform_common", "ecma_loader_lru", "ecma_loader_parking_lot", "ecma_minifier_concurrent", "bundler_concurrent", "allocator_node", "base", "base_concurrent", "base_node", "common", "common_sourcemap", "common_concurrent", "common_tty", "ecma_visit", "ecma_visit_path", "ecma_quote", "ecma_utils", "ecma_lints", "ecma_transforms", "ecma_transforms_compat", "ecma_transforms_module", "ecma_transforms_optimization", "ecma_transforms_proposal", "ecma_transforms_react", "ecma_transforms_typescript", "bundler", "bundler_node_v1", "bundler_node_v2", "ecma_loader", "ecma_loader_node", "ecma_loader_tsc", "testing_transform", "ecma_ast", "ecma_ast_serde", "ecma_parser", "ecma_parser_typescript", "cached", "ecma_codegen", "ecma_minifier", "ecma_preset_env", "ecma_usage_analyzer", "css_ast", "css_ast_serde", "css_codegen", "css_compat", "css_minifier", "css_modules", "css_parser", "css_prefixer", "css_utils", "css_visit", "css_visit_path", "testing", "trace_macro", "binding_macro_native", "binding_macro_wasm", "common_plugin_transform", "css_plugin_transform", "ecma_plugin_transform", "stacker", "typescript", "plugin_transform_host_js", "plugin_transform_host_native", "plugin_transform_host_native_filesystem_cache", "plugin_transform_host_native_shared_runtime", "swc_transform_common"] }
- scoped-alloc
-
Public features
Users should opt in necessary features explicitly
Flags to opt into certain optimizations. In most cases this won't expose new interfaces,
but changes internal logics to perform differently. These flag should be turned on in combination with actual features. Refer build.rs for more details.Enables scoped of swc_allocator
TODO: eventually swc_plugin_runner needs to remove default features
- common_ahash
-
swc_common/ahash
Enables ahash of swc_common
- transform_common
-
Affects
swc_core::transform_common
… - ecma_loader_lru
-
swc_ecma_loader/cache*
Enables lru of swc_ecma_loader
- ecma_loader_parking_lot
-
Enables parking_lot of swc_ecma_loader
- ecma_minifier_concurrent
-
swc_ecma_minifier/concurrent
Enables concurrent of swc_ecma_minifier
- bundler_concurrent
-
swc_bundler/concurrent
Enables concurrent of swc_bundler
- allocator_node = swc_malloc
-
configures specific memory allocator.
node.js binding should depend on this. - base = __base
-
General
Enable swc reexports. To avoid confusion between swc_core namespace,
it is named as 'base' instead. - base_concurrent = __base
-
Enables concurrent of swc
swc:
TODO: This may need reorganization with swc_core - swc_core allows to optionally enable each features (minifier, transforms..) but swc includes all of them.
- base_node = __base, swc_nodejs_common
-
Enables n-api related features.
Affects
swc_core::node
… - common __binding_macros? = __common
-
Enable swc_common reexports.
In most cases, top-level features (i.e plugin, or plugin_host) will include this, so no need to explicitly opt in. However, if top-level feature should be controlled by feature as opt-in and some other dependent feature need this, can be manually selected.
refer binding_core_wasm for example: it has plugin_transform_host feature, but it has to be a feature to be enabled by compile time flag to avoid cargo's feature collision,
while it also need to access 'common' exports by default for cargo check / or clippy. - common_sourcemap = __common
-
Enables sourcemap of swc_common
- common_concurrent = __common
-
TODO: internally concurrent / perf refers to the same feature (
parking_lot
)- can we consolidate them?
Enables concurrent of swc_common
- common_tty = __common
-
Enables tty-emitter of swc_common
- ecma_visit __common_plugin_transform? __ecma_plugin_transform? = __visit
-
Enable swc_ecma_visit
- ecma_visit_path = __visit
-
Enables path of swc_ecma_visit
- ecma_quote = __common, ecma_ast, swc_ecma_quote_macros
-
Enable
quote!
macro support.Affects
swc_core::quote
… - ecma_utils = __common, __utils
-
Enable swc_ecma_utils
- ecma_lints = __common, swc_ecma_lints
-
Affects
swc_core::ecma.lints
… - ecma_transforms = __ecma_transforms
-
Enable swc_ecma_transforms base features
- ecma_transforms_compat = __ecma_transforms, swc_ecma_transforms_compat
-
Affects
swc_core::transforms.compat
… - ecma_transforms_module = __ecma_transforms, swc_ecma_transforms_module
-
Affects
swc_core::transforms.module
… - ecma_transforms_optimization = __ecma_transforms, swc_ecma_transforms_optimization
-
Affects
swc_core::transforms.optimization
… - ecma_transforms_proposal = __ecma_transforms, swc_ecma_transforms_proposal
-
Affects
swc_core::transforms.proposal
… - ecma_transforms_react = __ecma_transforms, swc_ecma_transforms_react
-
Affects
swc_core::transforms.react
… - ecma_transforms_typescript = __ecma_transforms, swc_ecma_transforms_typescript
-
Affects
swc_core::transforms.typescript
… - bundler = __bundler
-
Enable swc_bundler
- bundler_node_v1 = __bundler
-
Enables swc_v1 of swc_node_bundler
Affects
swc_core::bundler.node
… - bundler_node_v2 = __bundler
-
Enables swc_v2 of swc_node_bundler
Affects
swc_core::bundler.node
… - ecma_loader = __ecma_loader
-
Enable swc_ecma_loader
- ecma_loader_node = __ecma_loader
-
Enables node of swc_ecma_loader
swc_ecma_loader:
Enable node js resolver
- ecma_loader_tsc = __ecma_loader
-
Enables tsc of swc_ecma_loader
swc_ecma_loader:
Enable support for
paths
of tsconfig.json - testing_transform = __ecma, __testing_transform
-
Enable swc_ecma_transforms_testing
- ecma_ast __binding_macros? __ecma_plugin_transform? ecma_ast_serde? ecma_quote? = __ecma, swc_atoms, swc_ecma_ast
-
Enable swc_ecma_ast / swc_atoms support.
TODO: currently both are enabled at once, we may want to separate them.Affects
swc_core::ecma.ast
,swc_core::ecma.atoms
… - ecma_ast_serde = ecma_ast
-
Enables serde-impl of swc_ecma_ast, serde of swc_ecma_visit
- ecma_parser = __parser
-
Enable swc_ecma_parser support.
- ecma_parser_typescript = __parser
-
Enables typescript of swc_ecma_parser
- cached = __cached
-
Enable swc_cached support
- ecma_codegen = __ecma, swc_ecma_codegen
-
Enable swc_ecma_codegen
Affects
swc_core::ecma.codegen
… - ecma_minifier = __ecma, swc_ecma_minifier
-
Enable swc_ecma_minifier
Affects
swc_core::ecma.minifier
… - ecma_preset_env = __ecma, swc_ecma_preset_env
-
Enable swc_ecma_preset_env
Affects
swc_core::ecma.preset_env
… - ecma_usage_analyzer = __ecma, swc_ecma_usage_analyzer
-
Enable swc_ecma_usage_analyzer
Affects
swc_core::ecma.usage_analyzer
… - css_ast __css_plugin_transform? css_ast_serde? = __css, swc_css_ast
-
Enable swc_css
Affects
swc_core::css.ast
… - css_ast_serde = css_ast
-
Enables serde-impl of swc_css_ast
- css_codegen = __css, swc_css_codegen
-
Affects
swc_core::css.codegen
… - css_compat = __css, swc_css_compat
-
Affects
swc_core::css.compat
… - css_minifier = __css, swc_css_minifier
-
Affects
swc_core::css.minifier
… - css_modules = __css, swc_css_modules
-
Affects
swc_core::css.modules
… - css_parser = __css, swc_css_parser
-
Affects
swc_core::css.parser
… - css_prefixer = __css, swc_css_prefixer
-
Affects
swc_core::css.prefixer
… - css_utils = __css, swc_css_utils
-
Affects
swc_core::css.utils
… - css_visit __css_plugin_transform? = __css, swc_css_visit
-
Affects
swc_core::css.visit
… - css_visit_path = __css
-
Enables path of swc_css_visit
- testing
-
Utilities for testing.
Enables testing
Affects
swc_core::testing
… - trace_macro = swc_trace_macro
-
Enable trace macro support. TODO: Once all top-level package (node, wasm, cli..) imports swc_core, we may encapsulate
tracing
package into swc_core.Affects
swc_core::trace_macro
… - binding_macro_native = __binding_macros
-
Enables binding_native of binding_macros
swc_* dependencies
- binding_macro_wasm = __binding_macros
-
Enables binding_wasm of binding_macros
- common_plugin_transform css_plugin_transform? ecma_plugin_transform? = __common_plugin_transform, __testing_transform
-
Plugins
Top level features should be enabled to write plugins for the custom transform.Enables plugin_transform_schema_v1 of swc_common
- css_plugin_transform = __css_plugin_transform, common_plugin_transform
- ecma_plugin_transform = __ecma_plugin_transform, common_plugin_transform
- stacker
-
Use
stacker
to avoid stack overflow.Enables stacker of swc_ecma_parser and swc_ecma_utils
- typescript = swc_typescript
-
Affects
swc_core::typescript
… - plugin_transform_host_js = __plugin_transform_host
-
Host features to enable plugin
runner
runtime. native feature is for the host environment does not have, or cannot access to the wasm runtime (i.e cli, or @swc/core node bindings). js feature is for the environment can access wasm runtime (i.e @swc/wasm)Enables plugin_transform_host_js and plugin_transform_schema_v1 of swc, plugin_transform_schema_v1 of swc_common, plugin_transform_host_js and plugin_transform_schema_v1 of swc_plugin_runner
- plugin_transform_host_native = __plugin_transform_host
-
Enables plugin_transform_host_native and plugin_transform_schema_v1 of swc, plugin_transform_schema_v1 of swc_common, plugin_transform_host_native and plugin_transform_schema_v1 of swc_plugin_runner
- plugin_transform_host_native_filesystem_cache
-
Enables FileSystemCache support for the plugin runner.
Enables filesystem_cache of swc_plugin_runner
-
Enables plugin_transform…shared_runtime of swc_plugin_runner
- __common_plugin_transform __css_plugin_transform? __ecma_plugin_transform? common_plugin_transform? = __common, ecma_visit, once_cell, swc_plugin, swc_plugin_macro
-
Plugins
Internal flags for any transform plugin featureEnables rkyv-impl of swc_atoms
Affects
plugin::memory
,swc_core::plugin
,plugin::proxies
,plugin::errors
,plugin::metadata
… - __css_plugin_transform css_plugin_transform? = __common_plugin_transform, css_ast, css_visit
-
Enables plugin-mode of swc_common, rkyv-impl of swc_css_ast, plugin-mode of swc_plugin_proxy
Affects
plugin::errors
,plugin::metadata
… - __ecma_plugin_transform ecma_plugin_transform? = __common_plugin_transform, ecma_ast, ecma_visit
-
Enables plugin-mode of swc_common, rkyv-impl of swc_ecma_ast and plugin-mode of swc_plugin_proxy
swc_plugin_proxy:
swc/core, which runs plugin
Affects
plugin::errors
,plugin::metadata
… - __plugin_transform_host plugin_transform_host_js? plugin_transform_host_native? = __common
-
Internal flags for any transform plugin host feature
Enables plugin of swc, rkyv-impl of swc_atoms, plugin-rt of swc_common, rkyv-impl of swc_ecma_ast, plugin-rt of swc_plugin_proxy, rkyv-impl of swc_plugin_runner
Affects
swc_core::plugin_runner
,swc_core::plugin
,plugin::proxies
… - __base __binding_macros? base? base_concurrent? base_node? = swc
-
Common
Affects
swc_core::base
… - __utils ecma_utils? = __ecma, swc_ecma_utils
-
Affects
swc_core::ecma.utils
… - __cached cached? = swc_cached
-
Affects
swc_core::cached
… - __binding_macros binding_macro_native? binding_macro_wasm? = __base, __ecma, __ecma_transforms, binding_macros, common, ecma_ast
-
Affects
swc_core::binding_macros
… - __parser ecma_parser? ecma_parser_typescript? = __ecma, swc_ecma_parser
-
Affects
swc_core::ecma.parser
… - __testing_transform common_plugin_transform? testing_transform? = __ecma, swc_ecma_transforms_testing
-
Affects
swc_core::transforms.testing
,swc_core::ecma.transforms
… - __visit ecma_visit? ecma_visit_path? = __ecma, swc_ecma_visit
-
Affects
swc_core::ecma.visit
… - __ecma_loader ecma_loader? ecma_loader_node? ecma_loader_tsc? = __ecma, swc_ecma_loader
-
Affects
swc_core::ecma.loader
… - __bundler bundler? bundler_node_v1? bundler_node_v2? = swc_bundler
-
Affects
swc_core::bundler
… - __ecma_transforms __binding_macros? ecma_transforms? ecma_transforms_compat? ecma_transforms_module? ecma_transforms_optimization? ecma_transforms_proposal? ecma_transforms_react? ecma_transforms_typescript? = __ecma
-
Affects
swc_core::ecma.transforms
… - __common __common_plugin_transform? __plugin_transform_host? common? common_concurrent? common_sourcemap? common_tty? ecma_lints? ecma_quote? ecma_utils? = swc_common
-
Affects
swc_core::common
… - __css css_ast? css_codegen? css_compat? css_minifier? css_modules? css_parser? css_prefixer? css_utils? css_visit? css_visit_path?
-
Affects
swc_core::css
… - __ecma __binding_macros? __ecma_loader? __ecma_transforms? __parser? __testing_transform? __utils? __visit? ecma_ast? ecma_codegen? ecma_minifier? ecma_preset_env? ecma_usage_analyzer? testing_transform? = swc_ecma_transforms_base
-
Affects
swc_core::ecma
…
Features from optional dependencies
In crates that don't use the dep:
syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.
- once_cell __common_plugin_transform?
-
Enables once_cell
3rd party dependencies
- binding_macros __binding_macros? binding_macro_native? binding_macro_wasm?
- swc __base? __plugin_transform_host? base_concurrent? base_node? plugin_transform_host_js? plugin_transform_host_native?
- swc_atoms __common_plugin_transform? __plugin_transform_host? ecma_ast?
- swc_bundler __bundler? bundler_concurrent?
- swc_cached __cached?
- swc_common __common? __css_plugin_transform? __ecma_plugin_transform? __plugin_transform_host? common_ahash? common_concurrent? common_plugin_transform? common_sourcemap? common_tty? plugin_transform_host_js? plugin_transform_host_native?
- swc_css_ast __css_plugin_transform? css_ast? css_ast_serde?
- swc_css_codegen css_codegen?
- swc_css_compat css_compat?
- swc_css_minifier css_minifier?
- swc_css_modules css_modules?
- swc_css_parser css_parser?
- swc_css_prefixer css_prefixer?
- swc_css_utils css_utils?
- swc_css_visit css_visit? css_visit_path?
- swc_ecma_ast __ecma_plugin_transform? __plugin_transform_host? ecma_ast? ecma_ast_serde?
- swc_ecma_codegen ecma_codegen?
- swc_ecma_lints ecma_lints?
- swc_ecma_loader __ecma_loader? ecma_loader_lru? ecma_loader_node? ecma_loader_parking_lot? ecma_loader_tsc?
- swc_ecma_minifier ecma_minifier? ecma_minifier_concurrent?
- swc_ecma_parser __parser? ecma_parser_typescript? stacker?
- swc_ecma_preset_env ecma_preset_env?
- swc_ecma_quote_macros ecma_quote?
- swc_ecma_transforms_base __ecma?
- swc_ecma_transforms_compat ecma_transforms_compat?
- swc_ecma_transforms_module ecma_transforms_module?
- swc_ecma_transforms_optimization ecma_transforms_optimization?
- swc_ecma_transforms_proposal ecma_transforms_proposal?
- swc_ecma_transforms_react ecma_transforms_react?
- swc_ecma_transforms_testing __testing_transform?
- swc_ecma_transforms_typescript ecma_transforms_typescript?
- swc_ecma_usage_analyzer ecma_usage_analyzer?
- swc_ecma_utils __utils? stacker?
- swc_ecma_visit __visit? ecma_ast_serde? ecma_visit_path?
- swc_malloc allocator_node?
- swc_node_bundler bundler_node_v1? bundler_node_v2?
- swc_nodejs_common base_node?
- swc_plugin __common_plugin_transform?
- swc_plugin_macro __common_plugin_transform?
- swc_plugin_proxy __css_plugin_transform? __ecma_plugin_transform? __plugin_transform_host?
- swc_trace_macro trace_macro?
- swc_transform_common implicit feature
-
Enables swc_transform_common
swc_transform_common:
Common utilities for swc transforms for any language
- swc_typescript typescript?
- swc_plugin_runner __plugin_transform_host? plugin_transform_host_js? plugin_transform_host_native? plugin_transform…filesystem_cache? plugin_transform…shared_runtime?