swc/crates/swc_core/Cargo.toml

360 lines
14 KiB
TOML
Raw Normal View History

[package]
2022-08-11 13:00:43 +03:00
authors = ["강동윤 <kdy1997.dev@gmail.com>", "OJ Kwon <kwon.ohjoong@gmail.com>"]
description = "TBD"
documentation = "https://rustdoc.swc.rs/swc_core/"
edition = "2021"
license = "Apache-2.0"
name = "swc_core"
repository = "https://github.com/swc-project/swc.git"
2022-10-01 06:36:56 +03:00
version = "0.28.14"
[package.metadata.docs.rs]
features = [
"common_perf",
"allocator_node",
"base",
"base_node",
"common",
"ecma_visit",
"quote",
"utils",
"ecma_transforms",
"bundler",
"loader",
"ecma_ast",
"trace_macro",
"plugin_transform",
]
rustdoc-args = ["--cfg", "docsrs"]
2022-08-03 05:30:17 +03:00
[lib]
doctest = false
[features]
### 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.
# swc_common/perf
common_perf = ["swc_common/perf"]
# swc_ecma_loader/cache*
ecma_loader_lru = ["swc_ecma_loader/lru"]
ecna_loader_parking_lot = ["swc_ecma_loader/parking_lot"]
# swc_ecma_minifier/concurrent
ecma_minifier_concurrent = ["swc_ecma_minifier/concurrent"]
# swc_bundler/concurrent
bundler_concurrent = ["swc_bundler/concurrent"]
# configures specific memory allocator.
# node.js binding should depend on this.
allocator_node = ["swc_node_base"]
## General
# Enable swc reexports. To avoid confusion between swc_core namespace,
# it is named as 'base' instead.
base = ["__base"]
base_concurrent = ["__base", "swc/concurrent"]
# Enables n-api related features.
base_node = [
"__base",
"swc/node",
# Assume if anyone enables n-api related codes, they may would like to use
# some utility functions as well.
"swc_nodejs_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 = ["__common"]
common_sourcemap = ["__common", "swc_common/sourcemap"]
# TODO: internally concurrent / perf refers to the same feature (`parking_lot`)
# - can we consolidate them?
common_concurrent = ["__common", "swc_common/concurrent"]
common_tty = ["__common", "swc_common/tty-emitter"]
# Enable swc_ecma_visit
ecma_visit = ["__visit"]
ecma_visit_path = ["__visit", "swc_ecma_visit/path"]
# Enable `quote!` macro support.
ecma_quote = [
# Dependent features
"__common",
"ecma_ast", # Enable optional package
"swc_ecma_quote_macros",
]
# Enable swc_ecma_utils
ecma_utils = ["__utils", "__common"]
# Enable swc_ecma_transforms base features
ecma_transforms = ["__ecma_transforms"]
ecma_transforms_module = ["__ecma_transforms", "swc_ecma_transforms_module"]
ecma_transforms_optimization = [
"__ecma_transforms",
"swc_ecma_transforms_optimization",
]
ecma_transforms_react = ["__ecma_transforms", "swc_ecma_transforms_react"]
ecma_transforms_typescript = [
"__ecma_transforms",
"swc_ecma_transforms_typescript",
]
# Enable swc_bundler
bundler = ["__bundler"]
bundler_node_v1 = ["__bundler", "swc_node_bundler/swc_v1"]
bundler_node_v2 = ["__bundler", "swc_node_bundler/swc_v2"]
# Enable swc_ecma_loader
ecma_loader = ["__ecma_loader"]
ecma_loader_node = ["__ecma_loader", "swc_ecma_loader/node"]
ecma_loader_tsc = ["__ecma_loader", "swc_ecma_loader/tsc"]
# Enable swc_ecma_transforms_testing
testing_transform = ["__ecma", "__testing_transform"]
# Enable swc_ecma_ast / swc_atoms support.
# TODO: currently both are enabled at once, we may want to separate them.
ecma_ast = ["__ecma", "swc_ecma_ast", "swc_atoms"]
# Enable swc_ecma_parser support.
ecma_parser = ["__parser"]
ecma_parser_typescript = ["__parser", "swc_ecma_parser/typescript"]
# Enable swc_cached support
cached = ["__cached"]
# Enable swc_ecma_codegen
ecma_codegen = ["__ecma", "swc_ecma_codegen"]
# Enable swc_ecma_minifier
ecma_minifier = ["__ecma", "swc_ecma_minifier"]
# Enable swc_css
css_ast = ["__css", "swc_css_ast"]
css_codegen = ["__css", "swc_css_codegen"]
css_minifier = ["__css", "swc_css_minifier"]
css_parser = ["__css", "swc_css_parser"]
css_prefixer = ["__css", "swc_css_prefixer"]
css_utils = ["__css", "swc_css_utils"]
css_visit = ["__css", "swc_css_visit"]
css_visit_path = ["__css", "swc_css_visit/path"]
# Utilities for testing.
testing = ["dep:testing"]
# Enable trace macro support.
# TODO: Once all top-level package (node, wasm, cli..) imports swc_core,
# we may encapsulate `tracing` package into swc_core.
trace_macro = ["swc_trace_macro"]
binding_macro_native = ["__binding_macros", "binding_macros/binding_native"]
binding_macro_wasm = ["__binding_macros", "binding_macros/binding_wasm"]
## Plugins
# Top level features should be enabled to write plugins for the custom transform.
plugin_transform = [
"__plugin_transform",
"__plugin_transform_schema_v1",
"__testing_transform",
]
# 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)
plugin_transform_host_js = [
# Dependent features
"__plugin_transform_host",
"__plugin_transform_host_schema_v1",
"__plugin_transform_env_js",
]
plugin_transform_host_native = [
# Dependent features
"__plugin_transform_host",
"__plugin_transform_host_schema_v1",
"__plugin_transform_env_native",
]
### Internal features that public features are relying on.
### This is not supposed to be used directly, and does not gaurantee
### stability across each versions.
# Specify version of AST schema will be used.
# This'll be automatically selected via transform_plugin features,
# SWC upstream decides which version to be used for specific version of
# swc_core.
__plugin_transform_host_schema_v1 = [
# Dependent features
"__plugin_transform_schema_v1", # Enable optional features
"swc/plugin_transform_schema_v1",
"swc_plugin_runner/plugin_transform_schema_v1",
]
__plugin_transform_schema_v1 = ["swc_common/plugin_transform_schema_v1"]
# Do not use: testing purpose only
__plugin_transform_host_schema_vtest = [
# Dependent features
"__plugin_transform_schema_vtest", # Enable optional features
"swc/plugin_transform_schema_vtest",
"swc_plugin_runner/plugin_transform_schema_vtest",
]
__plugin_transform_schema_vtest = ["swc_common/plugin_transform_schema_vtest"]
## Plugins
# Internal flags for any transform plugin feature
__plugin_transform = [
# Dependent features
"ecma_visit",
"__common",
"ecma_ast", # Enable optional packages
"swc_ecma_ast/rkyv-impl",
"swc_atoms/rkyv-impl",
"swc_common/plugin-mode",
"swc_plugin_proxy/plugin-mode",
"swc_plugin_macro",
"swc_plugin",
"once_cell",
]
__plugin_transform_bytecheck = [
# Dependent features
"ecma_visit",
"__common",
"ecma_ast",
"swc_ecma_ast/rkyv-bytecheck-impl",
"swc_atoms/rkyv-bytecheck-impl",
"swc_common/plugin-bytecheck-mode",
"swc_plugin_proxy/plugin-bytecheck-mode",
"swc_plugin_macro",
"swc_plugin",
"once_cell",
]
# Internal flags for any transform plugin host feature
__plugin_transform_host = [
# Dependent features
"__common", # Enable optional packages
"swc_ecma_ast/rkyv-impl",
"swc_atoms/rkyv-impl",
"swc_common/plugin-rt",
"swc_plugin_runner/rkyv-impl",
# TODO: we may simply flag around downlevel plugin feature
"swc_plugin_proxy/plugin-rt",
"swc/plugin",
]
# Internal flags for the transform plugin host, if it needs to enable bytecheck
__plugin_transform_host_bytecheck = [
"__common",
"swc_atoms/rkyv-bytecheck-impl",
"swc_common/plugin-bytecheck-rt",
"swc_ecma_ast/rkyv-bytecheck-impl",
"swc_plugin_proxy/plugin-bytecheck-rt",
"swc/plugin-bytecheck",
]
# Internal flags to control plugin environment
__plugin_transform_env_native = [
"swc_plugin_runner/filesystem_cache",
"wasmer/default",
"wasmer-wasi/default",
]
__plugin_transform_env_js = [
"swc_plugin_runner/memory_cache",
"wasmer/js-default",
"wasmer-wasi/js-default",
]
# Do not use: testing purpose only
# Force enable different version of AST schema
__plugin_transform_schema_test = [
"__plugin_transform",
"__plugin_transform_schema_vtest",
]
## Common
__base = ["swc"]
__binding_macros = [
"__ecma",
"common",
"__base",
"__ecma_transforms",
"ecma_ast",
"binding_macros",
]
__bundler = ["swc_bundler"]
__cached = ["swc_cached"]
__common = ["swc_common"]
__css = []
__ecma = ["swc_ecma_transforms_base"]
__ecma_loader = ["__ecma", "swc_ecma_loader"]
__ecma_transforms = ["__ecma"]
__parser = ["__ecma", "swc_ecma_parser"]
__testing_transform = ["__ecma", "swc_ecma_transforms_testing"]
__utils = ["__ecma", "swc_ecma_utils"]
__visit = ["__ecma", "swc_ecma_visit"]
[dependencies]
# 3rd party dependencies
once_cell = { optional = true, version = "1.13.0" }
wasmer = { optional = true, version = "2.3.0", default-features = false }
wasmer-wasi = { optional = true, version = "2.3.0", default-features = false }
# swc_* dependencies
2022-10-01 06:36:56 +03:00
binding_macros = { optional = true, version = "0.18.12", path = "../binding_macros" }
swc = { optional = true, version = "0.230.13", path = "../swc" }
2022-09-29 01:57:51 +03:00
swc_atoms = { optional = true, version = "0.4.18", path = "../swc_atoms" }
2022-10-01 06:36:56 +03:00
swc_bundler = { optional = true, version = "0.190.25", path = "../swc_bundler" }
2022-09-29 01:57:51 +03:00
swc_cached = { optional = true, version = "0.3.14", path = "../swc_cached" }
swc_common = { optional = true, version = "0.29.3", path = "../swc_common" }
2022-09-29 04:39:48 +03:00
swc_css_ast = { optional = true, version = "0.114.4", path = "../swc_css_ast" }
swc_css_codegen = { optional = true, version = "0.124.4", path = "../swc_css_codegen" }
swc_css_minifier = { optional = true, version = "0.89.5", path = "../swc_css_minifier" }
swc_css_parser = { optional = true, version = "0.123.4", path = "../swc_css_parser" }
swc_css_prefixer = { optional = true, version = "0.125.4", path = "../swc_css_prefixer" }
swc_css_utils = { optional = true, version = "0.111.4", path = "../swc_css_utils/" }
swc_css_visit = { optional = true, version = "0.113.4", path = "../swc_css_visit" }
2022-09-29 01:57:51 +03:00
swc_ecma_ast = { optional = true, version = "0.94.3", path = "../swc_ecma_ast" }
2022-09-30 10:16:28 +03:00
swc_ecma_codegen = { optional = true, version = "0.127.6", path = "../swc_ecma_codegen" }
2022-09-29 01:57:51 +03:00
swc_ecma_loader = { optional = true, version = "0.41.3", path = "../swc_ecma_loader" }
2022-10-01 06:36:56 +03:00
swc_ecma_minifier = { optional = true, version = "0.157.26", path = "../swc_ecma_minifier" }
2022-09-29 01:57:51 +03:00
swc_ecma_parser = { optional = true, version = "0.122.4", path = "../swc_ecma_parser" }
swc_ecma_quote_macros = { optional = true, version = "0.33.4", path = "../swc_ecma_quote_macros" }
2022-10-01 06:36:56 +03:00
swc_ecma_transforms_base = { optional = true, version = "0.111.10", path = "../swc_ecma_transforms_base" }
swc_ecma_transforms_module = { optional = true, version = "0.151.11", path = "../swc_ecma_transforms_module" }
swc_ecma_transforms_optimization = { optional = true, version = "0.165.12", path = "../swc_ecma_transforms_optimization" }
swc_ecma_transforms_proposal = { optional = true, version = "0.142.12", path = "../swc_ecma_transforms_proposal" }
swc_ecma_transforms_react = { optional = true, version = "0.153.11", path = "../swc_ecma_transforms_react" }
swc_ecma_transforms_testing = { optional = true, version = "0.113.10", path = "../swc_ecma_transforms_testing" }
swc_ecma_transforms_typescript = { optional = true, version = "0.157.12", path = "../swc_ecma_transforms_typescript" }
2022-09-29 01:57:51 +03:00
swc_ecma_utils = { optional = true, version = "0.105.5", path = "../swc_ecma_utils" }
swc_ecma_visit = { optional = true, version = "0.80.3", path = "../swc_ecma_visit" }
swc_node_base = { optional = true, version = "0.5.5", path = "../swc_node_base" }
2022-10-01 06:36:56 +03:00
swc_node_bundler = { optional = true, version = "0.16.12", path = "../swc_node_bundler" }
swc_nodejs_common = { optional = true, version = "0.0.1", path = "../swc_nodejs_common" }
swc_plugin = { optional = true, version = "0.90.0", path = "../swc_plugin" }
swc_plugin_macro = { optional = true, version = "0.9.8", path = "../swc_plugin_macro" }
2022-09-29 01:57:51 +03:00
swc_plugin_proxy = { optional = true, version = "0.22.3", path = "../swc_plugin_proxy" }
swc_trace_macro = { optional = true, version = "0.1.2", path = "../swc_trace_macro" }
2022-09-29 01:57:51 +03:00
testing = { optional = true, version = "0.31.3", path = "../testing" }
# TODO: eventually swc_plugin_runner needs to remove default features
2022-09-29 01:57:51 +03:00
swc_plugin_runner = { optional = true, version = "0.77.4", path = "../swc_plugin_runner", default-features = false }
[build-dependencies]
vergen = { version = "7.3.2", default-features = false, features = ["cargo"] }