2022-08-02 10:25:59 +03:00
|
|
|
[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-08-25 10:07:17 +03:00
|
|
|
version = "0.12.1"
|
2022-08-05 08:11:40 +03:00
|
|
|
[package.metadata.docs.rs]
|
|
|
|
features = [
|
|
|
|
"common_perf",
|
|
|
|
"allocator_node",
|
|
|
|
"base",
|
|
|
|
"base_node",
|
|
|
|
"common",
|
|
|
|
"visit",
|
|
|
|
"quote",
|
|
|
|
"utils",
|
|
|
|
"transforms",
|
|
|
|
"bundler",
|
|
|
|
"loader",
|
|
|
|
"ast",
|
|
|
|
"trace_macro",
|
|
|
|
"plugin_transform",
|
|
|
|
]
|
|
|
|
rustdoc-args = ["--cfg", "docsrs"]
|
2022-08-03 05:30:17 +03:00
|
|
|
|
2022-08-05 10:37:42 +03:00
|
|
|
[lib]
|
|
|
|
doctest = false
|
2022-08-03 06:38:05 +03:00
|
|
|
|
2022-08-02 10:25:59 +03:00
|
|
|
[features]
|
|
|
|
### Public features
|
|
|
|
### Users should opt in necessary features explicitly
|
|
|
|
|
2022-08-03 06:38:05 +03:00
|
|
|
## 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.
|
2022-08-05 08:11:40 +03:00
|
|
|
|
|
|
|
# swc_common/perf
|
|
|
|
common_perf = ["swc_common/perf"]
|
|
|
|
|
2022-08-23 06:43:01 +03:00
|
|
|
# swc_ecma_loader/cache*
|
|
|
|
loader_lru = ["swc_ecma_loader/lru"]
|
|
|
|
loader_parking_lot = ["swc_ecma_loader/parking_lot"]
|
|
|
|
|
|
|
|
# swc_ecma_minifier/concurrent
|
|
|
|
minifier_concurrent = ["swc_ecma_minifier/concurrent"]
|
|
|
|
|
2022-08-24 04:23:20 +03:00
|
|
|
# swc_bundler/concurrent
|
|
|
|
bundler_concurrent = ["swc_bundler/concurrent"]
|
|
|
|
|
2022-08-05 08:11:40 +03:00
|
|
|
# configures specific memory allocator.
|
|
|
|
# node.js binding should depend on this.
|
|
|
|
allocator_node = ["swc_node_base"]
|
2022-08-03 06:38:05 +03:00
|
|
|
|
2022-08-02 10:25:59 +03:00
|
|
|
## General
|
2022-08-05 08:11:40 +03:00
|
|
|
# Enable swc reexports. To avoid confusion between swc_core namespace,
|
|
|
|
# it is named as 'base' instead.
|
|
|
|
base = ["__base"]
|
|
|
|
base_concurrent = ["__base", "swc/concurrent"]
|
2022-08-14 04:15:56 +03:00
|
|
|
# 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",
|
|
|
|
]
|
2022-08-05 08:11:40 +03:00
|
|
|
|
2022-08-03 06:38:05 +03:00
|
|
|
# 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.
|
2022-08-05 08:11:40 +03:00
|
|
|
common = ["__common"]
|
|
|
|
# TODO: internally concurrent / perf refers to the same feature (`parking_lot`)
|
|
|
|
# - can we consolidate them?
|
|
|
|
common_concurrent = ["__common", "swc_common/concurrent"]
|
|
|
|
|
|
|
|
# Enable swc_ecma_visit
|
|
|
|
visit = ["swc_ecma_visit"]
|
2022-08-03 06:38:05 +03:00
|
|
|
|
2022-08-02 10:25:59 +03:00
|
|
|
# Enable `quote!` macro support.
|
2022-08-05 10:37:42 +03:00
|
|
|
quote = [
|
|
|
|
# Dependent features
|
|
|
|
"__common",
|
2022-08-11 13:25:46 +03:00
|
|
|
"ast", # Enable optional package
|
2022-08-05 10:37:42 +03:00
|
|
|
"swc_ecma_quote_macros",
|
|
|
|
]
|
2022-08-02 10:25:59 +03:00
|
|
|
|
2022-08-05 08:11:40 +03:00
|
|
|
# Enable swc_ecma_utils
|
2022-08-05 10:37:42 +03:00
|
|
|
utils = ["__utils", "__common"]
|
2022-08-05 08:11:40 +03:00
|
|
|
|
|
|
|
# Enable swc_ecma_transforms base features
|
2022-08-23 08:17:47 +03:00
|
|
|
transforms = ["__transforms"]
|
2022-08-23 06:43:01 +03:00
|
|
|
transforms_optimization = ["__transforms", "swc_ecma_transforms/optimization"]
|
|
|
|
transforms_react = ["__transforms", "swc_ecma_transforms/react"]
|
|
|
|
transforms_typescript = ["__transforms", "swc_ecma_transforms/typescript"]
|
2022-08-05 08:11:40 +03:00
|
|
|
|
|
|
|
# Enable swc_bundler
|
2022-08-14 04:15:56 +03:00
|
|
|
bundler = ["__bundler"]
|
|
|
|
bundler_node_v1 = ["__bundler", "swc_node_bundler/swc_v1"]
|
|
|
|
bundler_node_v2 = ["__bundler", "swc_node_bundler/swc_v2"]
|
2022-08-05 08:11:40 +03:00
|
|
|
|
|
|
|
# Enable swc_ecma_loader
|
2022-08-23 06:43:01 +03:00
|
|
|
loader = ["__loader"]
|
|
|
|
loader_node = ["__loader", "swc_ecma_loader/node"]
|
|
|
|
loader_tsc = ["__loader", "swc_ecma_loader/tsc"]
|
2022-08-05 08:11:40 +03:00
|
|
|
|
2022-08-09 04:49:06 +03:00
|
|
|
# Enable swc_ecma_transforms_testing
|
|
|
|
testing_transform = ["__testing_transform"]
|
|
|
|
|
2022-08-03 06:38:05 +03:00
|
|
|
# Enable swc_ecma_ast / swc_atoms support.
|
|
|
|
# TODO: currently both are enabled at once, we may want to separate them.
|
|
|
|
ast = ["swc_ecma_ast", "swc_atoms"]
|
|
|
|
|
2022-08-23 06:43:01 +03:00
|
|
|
# Enable swc_ecma_parser support.
|
|
|
|
parser = ["__parser"]
|
|
|
|
parser_typescript = ["__parser", "swc_ecma_parser/typescript"]
|
|
|
|
|
|
|
|
# Enable swc_cached support
|
|
|
|
cached = ["__cached"]
|
|
|
|
|
|
|
|
# Enable swc_ecma_codegen
|
|
|
|
codegen = ["swc_ecma_codegen"]
|
|
|
|
|
|
|
|
# Enable swc_ecma_minifier
|
|
|
|
minifier = ["swc_ecma_minifier"]
|
|
|
|
|
2022-08-24 04:23:20 +03:00
|
|
|
# Enable swc_css
|
|
|
|
css = ["__css"]
|
|
|
|
css_prefixer = ["__css", "swc_css_prefixer"]
|
|
|
|
|
2022-08-03 06:38:05 +03:00
|
|
|
# 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"]
|
|
|
|
|
2022-08-10 06:10:19 +03:00
|
|
|
binding_macro_native = ["__binding_macros", "binding_macros/binding_native"]
|
|
|
|
binding_macro_wasm = ["__binding_macros", "binding_macros/binding_wasm"]
|
|
|
|
|
2022-08-02 10:25:59 +03:00
|
|
|
## Plugins
|
|
|
|
# Top level features should be enabled to write plugins for the custom transform.
|
2022-08-09 04:49:06 +03:00
|
|
|
plugin_transform = [
|
|
|
|
"__plugin_transform",
|
|
|
|
"__plugin_transform_schema_v1",
|
|
|
|
"__testing_transform",
|
|
|
|
]
|
2022-08-03 06:38:05 +03:00
|
|
|
|
|
|
|
# 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)
|
2022-08-05 08:11:40 +03:00
|
|
|
plugin_transform_host_js = [
|
2022-08-02 10:25:59 +03:00
|
|
|
# Dependent features
|
2022-08-03 06:38:05 +03:00
|
|
|
"__plugin_transform_host",
|
|
|
|
"__plugin_transform_host_schema_v1",
|
2022-08-05 08:11:40 +03:00
|
|
|
"__plugin_transform_env_js",
|
2022-08-03 06:38:05 +03:00
|
|
|
]
|
2022-08-05 08:11:40 +03:00
|
|
|
plugin_transform_host_native = [
|
2022-08-03 06:38:05 +03:00
|
|
|
# Dependent features
|
|
|
|
"__plugin_transform_host",
|
|
|
|
"__plugin_transform_host_schema_v1",
|
2022-08-05 08:11:40 +03:00
|
|
|
"__plugin_transform_env_native",
|
2022-08-02 10:25:59 +03:00
|
|
|
]
|
|
|
|
|
|
|
|
### 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.
|
2022-08-03 06:38:05 +03:00
|
|
|
__plugin_transform_host_schema_v1 = [
|
2022-08-05 08:11:40 +03:00
|
|
|
# Dependent features
|
2022-08-11 13:25:46 +03:00
|
|
|
"__plugin_transform_schema_v1", # Enable optional features
|
2022-08-05 08:11:40 +03:00
|
|
|
"swc/plugin_transform_schema_v1",
|
2022-08-03 06:38:05 +03:00
|
|
|
"swc_plugin_runner/plugin_transform_schema_v1",
|
|
|
|
]
|
2022-08-05 08:11:40 +03:00
|
|
|
__plugin_transform_schema_v1 = ["swc_common/plugin_transform_schema_v1"]
|
2022-08-02 10:25:59 +03:00
|
|
|
|
|
|
|
# Do not use: testing purpose only
|
2022-08-03 06:38:05 +03:00
|
|
|
__plugin_transform_host_schema_vtest = [
|
2022-08-05 08:11:40 +03:00
|
|
|
# Dependent features
|
2022-08-11 13:25:46 +03:00
|
|
|
"__plugin_transform_schema_vtest", # Enable optional features
|
2022-08-05 08:11:40 +03:00
|
|
|
"swc/plugin_transform_schema_vtest",
|
2022-08-03 06:38:05 +03:00
|
|
|
"swc_plugin_runner/plugin_transform_schema_vtest",
|
|
|
|
]
|
2022-08-05 08:11:40 +03:00
|
|
|
__plugin_transform_schema_vtest = ["swc_common/plugin_transform_schema_vtest"]
|
2022-08-02 10:25:59 +03:00
|
|
|
|
|
|
|
## Plugins
|
|
|
|
|
2022-08-03 06:38:05 +03:00
|
|
|
__plugin_transform = [
|
2022-08-02 10:25:59 +03:00
|
|
|
# Dependent features
|
2022-08-05 08:11:40 +03:00
|
|
|
"visit",
|
|
|
|
"__common",
|
2022-08-11 13:25:46 +03:00
|
|
|
"ast", # Enable optional packages
|
2022-08-03 06:38:05 +03:00
|
|
|
"swc_ecma_ast/rkyv-impl",
|
2022-08-12 07:36:52 +03:00
|
|
|
"swc_atoms/rkyv-impl",
|
2022-08-02 10:25:59 +03:00
|
|
|
"swc_common/plugin-mode",
|
|
|
|
"swc_plugin_proxy/plugin-mode",
|
|
|
|
"swc_plugin_macro",
|
|
|
|
"swc_plugin",
|
|
|
|
"once_cell",
|
2022-08-12 07:36:52 +03:00
|
|
|
] # Internal flags for any transform plugin feature
|
2022-08-02 10:25:59 +03:00
|
|
|
|
2022-08-03 06:38:05 +03:00
|
|
|
# Internal flags for any transform plugin host feature
|
2022-08-05 08:11:40 +03:00
|
|
|
__plugin_transform_host = [
|
|
|
|
# Dependent features
|
2022-08-12 07:36:52 +03:00
|
|
|
"__common", # Enable optional packages
|
|
|
|
"swc_ecma_ast/rkyv-impl",
|
|
|
|
"swc_atoms/rkyv-impl",
|
|
|
|
"swc_common/plugin-rt",
|
2022-08-05 08:11:40 +03:00
|
|
|
# TODO: we may simply flag around downlevel plugin feature
|
|
|
|
"swc_plugin_proxy/plugin-rt",
|
|
|
|
"swc/plugin",
|
|
|
|
]
|
|
|
|
# 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",
|
|
|
|
]
|
2022-08-02 10:25:59 +03:00
|
|
|
|
2022-08-03 06:38:05 +03:00
|
|
|
# Do not use: testing purpose only
|
|
|
|
# Force enable different version of AST schema
|
|
|
|
__plugin_transform_schema_test = [
|
|
|
|
"__plugin_transform",
|
|
|
|
"__plugin_transform_schema_vtest",
|
|
|
|
]
|
|
|
|
|
|
|
|
## Common
|
2022-08-09 04:49:06 +03:00
|
|
|
__base = ["swc"]
|
2022-08-10 06:10:19 +03:00
|
|
|
__binding_macros = ["common", "__base", "__transforms", "ast", "binding_macros"]
|
2022-08-14 04:15:56 +03:00
|
|
|
__bundler = ["swc_bundler"]
|
2022-08-23 06:43:01 +03:00
|
|
|
__cached = ["swc_cached"]
|
2022-08-09 04:49:06 +03:00
|
|
|
__common = ["swc_common"]
|
2022-08-24 04:23:20 +03:00
|
|
|
__css = ["swc_css"]
|
2022-08-23 06:43:01 +03:00
|
|
|
__loader = ["swc_ecma_loader"]
|
|
|
|
__parser = ["swc_ecma_parser"]
|
2022-08-09 04:49:06 +03:00
|
|
|
__testing_transform = ["swc_ecma_transforms_testing"]
|
|
|
|
__transforms = ["swc_ecma_transforms"]
|
|
|
|
__utils = ["swc_ecma_utils"]
|
2022-08-02 10:25:59 +03:00
|
|
|
|
|
|
|
[dependencies]
|
2022-08-03 06:38:05 +03:00
|
|
|
# 3rd party dependencies
|
2022-08-05 08:11:40 +03:00
|
|
|
once_cell = { optional = true, version = "1.13.0" }
|
2022-08-17 08:18:56 +03:00
|
|
|
wasmer = { optional = true, version = "2.3.0", default-features = false }
|
|
|
|
wasmer-wasi = { optional = true, version = "2.3.0", default-features = false }
|
2022-08-03 06:38:05 +03:00
|
|
|
|
|
|
|
# swc_* dependencies
|
2022-08-25 07:53:03 +03:00
|
|
|
binding_macros = { optional = true, version = "0.7.0", path = "../binding_macros" }
|
2022-08-25 10:07:17 +03:00
|
|
|
swc = { optional = true, version = "0.219.2", path = "../swc" }
|
2022-08-17 08:18:56 +03:00
|
|
|
swc_atoms = { optional = true, version = "0.4.8", path = "../swc_atoms" }
|
2022-08-25 07:53:03 +03:00
|
|
|
swc_bundler = { optional = true, version = "0.180.0", path = "../swc_bundler" }
|
2022-08-23 06:43:01 +03:00
|
|
|
swc_cached = { optional = true, version = "0.3.5", path = "../swc_cached" }
|
2022-08-23 04:10:30 +03:00
|
|
|
swc_common = { optional = true, version = "0.27.12", path = "../swc_common" }
|
2022-08-24 04:23:20 +03:00
|
|
|
swc_css = { optional = true, version = "0.121.0", path = "../swc_css" }
|
|
|
|
swc_css_prefixer = { optional = true, version = "0.119.1", path = "../swc_css_prefixer" }
|
2022-08-17 08:28:18 +03:00
|
|
|
swc_ecma_ast = { optional = true, version = "0.90.10", path = "../swc_ecma_ast" }
|
2022-08-23 06:43:01 +03:00
|
|
|
swc_ecma_codegen = { optional = true, version = "0.122.0", path = "../swc_ecma_codegen" }
|
2022-08-13 13:11:26 +03:00
|
|
|
swc_ecma_loader = { optional = true, version = "0.39.4", path = "../swc_ecma_loader" }
|
2022-08-25 07:53:03 +03:00
|
|
|
swc_ecma_minifier = { optional = true, version = "0.147.0", path = "../swc_ecma_minifier" }
|
2022-08-21 11:33:31 +03:00
|
|
|
swc_ecma_parser = { optional = true, version = "0.118.0", path = "../swc_ecma_parser" }
|
|
|
|
swc_ecma_quote_macros = { optional = true, version = "0.29.0", path = "../swc_ecma_quote_macros" }
|
2022-08-25 07:53:03 +03:00
|
|
|
swc_ecma_transforms = { optional = true, version = "0.186.0", path = "../swc_ecma_transforms" }
|
2022-08-21 11:33:31 +03:00
|
|
|
swc_ecma_transforms_testing = { optional = true, version = "0.106.0", path = "../swc_ecma_transforms_testing" }
|
2022-08-23 04:10:30 +03:00
|
|
|
swc_ecma_utils = { optional = true, version = "0.100.2", path = "../swc_ecma_utils" }
|
2022-08-17 08:28:18 +03:00
|
|
|
swc_ecma_visit = { optional = true, version = "0.76.6", path = "../swc_ecma_visit" }
|
2022-08-09 04:49:06 +03:00
|
|
|
swc_node_base = { optional = true, version = "0.5.5", path = "../swc_node_base" }
|
2022-08-25 07:53:03 +03:00
|
|
|
swc_node_bundler = { optional = true, version = "0.5.0", path = "../swc_node_bundler" }
|
2022-08-14 04:15:56 +03:00
|
|
|
swc_nodejs_common = { optional = true, version = "0.0.1", path = "../swc_nodejs_common" }
|
2022-08-23 02:51:16 +03:00
|
|
|
swc_plugin = { optional = true, version = "0.90.0", path = "../swc_plugin" }
|
2022-08-24 04:23:20 +03:00
|
|
|
swc_plugin_macro = { optional = true, version = "0.9.8", path = "../swc_plugin_macro" }
|
2022-08-17 08:28:18 +03:00
|
|
|
swc_plugin_proxy = { optional = true, version = "0.18.13", path = "../swc_plugin_proxy" }
|
2022-08-13 08:09:52 +03:00
|
|
|
swc_trace_macro = { optional = true, version = "0.1.2", path = "../swc_trace_macro" }
|
2022-08-03 06:38:05 +03:00
|
|
|
# TODO: eventually swc_plugin_runner needs to remove default features
|
2022-08-23 04:10:30 +03:00
|
|
|
swc_plugin_runner = { optional = true, version = "0.73.1", path = "../swc_plugin_runner", default-features = false }
|
2022-08-05 10:37:42 +03:00
|
|
|
|
|
|
|
[dev-dependencies]
|
2022-08-13 13:11:26 +03:00
|
|
|
testing = { version = "0.29.4", path = "../testing" }
|
2022-08-18 07:29:19 +03:00
|
|
|
|
|
|
|
[build-dependencies]
|
|
|
|
vergen = { version = "7.3.2", default-features = false, features = ["cargo"] }
|