mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 13:51:19 +03:00
feat(es/parser): Allow stripping out typescript parser (#1962)
swc_ecma_parser: - Add a cargo feature to remove typescript parser.
This commit is contained in:
parent
cd4a564eea
commit
85a216ef56
14
Cargo.toml
14
Cargo.toml
@ -9,7 +9,7 @@ edition = "2018"
|
|||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc"
|
name = "swc"
|
||||||
repository = "https://github.com/swc-project/swc.git"
|
repository = "https://github.com/swc-project/swc.git"
|
||||||
version = "0.30.0"
|
version = "0.31.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "swc"
|
name = "swc"
|
||||||
@ -29,15 +29,15 @@ serde = {version = "1", features = ["derive"]}
|
|||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
sourcemap = "6"
|
sourcemap = "6"
|
||||||
swc_atoms = {version = "0.2", path = "./atoms"}
|
swc_atoms = {version = "0.2", path = "./atoms"}
|
||||||
swc_bundler = {version = "0.46.0", path = "./bundler"}
|
swc_bundler = {version = "0.47.0", path = "./bundler"}
|
||||||
swc_common = {version = "0.11.0", path = "./common", features = ["sourcemap", "concurrent"]}
|
swc_common = {version = "0.11.0", path = "./common", features = ["sourcemap", "concurrent"]}
|
||||||
swc_ecma_ast = {version = "0.49.0", path = "./ecmascript/ast"}
|
swc_ecma_ast = {version = "0.49.0", path = "./ecmascript/ast"}
|
||||||
swc_ecma_codegen = {version = "0.62.0", path = "./ecmascript/codegen"}
|
swc_ecma_codegen = {version = "0.63.0", path = "./ecmascript/codegen"}
|
||||||
swc_ecma_ext_transforms = {version = "0.21.0", path = "./ecmascript/ext-transforms"}
|
swc_ecma_ext_transforms = {version = "0.22.0", path = "./ecmascript/ext-transforms"}
|
||||||
swc_ecma_loader = {version = "0.11.0", path = "./ecmascript/loader", features = ["lru", "node", "tsc"]}
|
swc_ecma_loader = {version = "0.11.0", path = "./ecmascript/loader", features = ["lru", "node", "tsc"]}
|
||||||
swc_ecma_parser = {version = "0.63.0", path = "./ecmascript/parser"}
|
swc_ecma_parser = {version = "0.64.0", path = "./ecmascript/parser"}
|
||||||
swc_ecma_preset_env = {version = "0.29.0", path = "./ecmascript/preset-env"}
|
swc_ecma_preset_env = {version = "0.30.0", path = "./ecmascript/preset-env"}
|
||||||
swc_ecma_transforms = {version = "0.59.0", path = "./ecmascript/transforms", features = [
|
swc_ecma_transforms = {version = "0.60.0", path = "./ecmascript/transforms", features = [
|
||||||
"compat",
|
"compat",
|
||||||
"module",
|
"module",
|
||||||
"optimization",
|
"optimization",
|
||||||
|
@ -9,7 +9,7 @@ include = ["Cargo.toml", "build.rs", "src/**/*.rs", "src/**/*.js"]
|
|||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc_bundler"
|
name = "swc_bundler"
|
||||||
repository = "https://github.com/swc-project/swc.git"
|
repository = "https://github.com/swc-project/swc.git"
|
||||||
version = "0.46.0"
|
version = "0.47.0"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
[features]
|
[features]
|
||||||
@ -34,10 +34,10 @@ retain_mut = "0.1.2"
|
|||||||
swc_atoms = {version = "0.2.4", path = "../atoms"}
|
swc_atoms = {version = "0.2.4", path = "../atoms"}
|
||||||
swc_common = {version = "0.11.0", path = "../common"}
|
swc_common = {version = "0.11.0", path = "../common"}
|
||||||
swc_ecma_ast = {version = "0.49.0", path = "../ecmascript/ast"}
|
swc_ecma_ast = {version = "0.49.0", path = "../ecmascript/ast"}
|
||||||
swc_ecma_codegen = {version = "0.62.0", path = "../ecmascript/codegen"}
|
swc_ecma_codegen = {version = "0.63.0", path = "../ecmascript/codegen"}
|
||||||
swc_ecma_loader = {version = "0.11.0", path = "../ecmascript/loader"}
|
swc_ecma_loader = {version = "0.11.0", path = "../ecmascript/loader"}
|
||||||
swc_ecma_parser = {version = "0.63.0", path = "../ecmascript/parser"}
|
swc_ecma_parser = {version = "0.64.0", path = "../ecmascript/parser"}
|
||||||
swc_ecma_transforms = {version = "0.59.0", path = "../ecmascript/transforms", features = ["optimization"]}
|
swc_ecma_transforms = {version = "0.60.0", path = "../ecmascript/transforms", features = ["optimization"]}
|
||||||
swc_ecma_utils = {version = "0.40.0", path = "../ecmascript/utils"}
|
swc_ecma_utils = {version = "0.40.0", path = "../ecmascript/utils"}
|
||||||
swc_ecma_visit = {version = "0.35.0", path = "../ecmascript/visit"}
|
swc_ecma_visit = {version = "0.35.0", path = "../ecmascript/visit"}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ hex = "0.4"
|
|||||||
ntest = "0.7.2"
|
ntest = "0.7.2"
|
||||||
reqwest = {version = "0.10.8", features = ["blocking"]}
|
reqwest = {version = "0.10.8", features = ["blocking"]}
|
||||||
sha-1 = "0.9"
|
sha-1 = "0.9"
|
||||||
swc_ecma_transforms = {version = "0.59.0", path = "../ecmascript/transforms", features = ["react", "typescript"]}
|
swc_ecma_transforms = {version = "0.60.0", path = "../ecmascript/transforms", features = ["react", "typescript"]}
|
||||||
tempfile = "3.1.0"
|
tempfile = "3.1.0"
|
||||||
testing = {version = "0.11.0", path = "../testing"}
|
testing = {version = "0.11.0", path = "../testing"}
|
||||||
url = "2.1.1"
|
url = "2.1.1"
|
||||||
|
@ -6,13 +6,14 @@ edition = "2018"
|
|||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc_ecmascript"
|
name = "swc_ecmascript"
|
||||||
repository = "https://github.com/swc-project/swc.git"
|
repository = "https://github.com/swc-project/swc.git"
|
||||||
version = "0.46.0"
|
version = "0.47.0"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
codegen = ["swc_ecma_codegen"]
|
codegen = ["swc_ecma_codegen"]
|
||||||
|
default = ["typescript-parser"]
|
||||||
dep_graph = ["swc_ecma_dep_graph"]
|
dep_graph = ["swc_ecma_dep_graph"]
|
||||||
minifier = ["swc_ecma_minifier"]
|
minifier = ["swc_ecma_minifier"]
|
||||||
parser = ["swc_ecma_parser"]
|
parser = ["swc_ecma_parser"]
|
||||||
@ -20,20 +21,22 @@ transforms = ["swc_ecma_transforms"]
|
|||||||
utils = ["swc_ecma_utils"]
|
utils = ["swc_ecma_utils"]
|
||||||
visit = ["swc_ecma_visit"]
|
visit = ["swc_ecma_visit"]
|
||||||
|
|
||||||
|
typescript-parser = ["swc_ecma_parser/typescript"]
|
||||||
|
|
||||||
compat = ["swc_ecma_transforms/compat"]
|
compat = ["swc_ecma_transforms/compat"]
|
||||||
module = ["swc_ecma_transforms/module"]
|
module = ["swc_ecma_transforms/module"]
|
||||||
optimization = ["swc_ecma_transforms/optimization"]
|
optimization = ["swc_ecma_transforms/optimization"]
|
||||||
proposal = ["swc_ecma_transforms/proposal"]
|
proposal = ["swc_ecma_transforms/proposal"]
|
||||||
react = ["swc_ecma_transforms/react"]
|
react = ["swc_ecma_transforms/react"]
|
||||||
typescript = ["swc_ecma_transforms/typescript"]
|
typescript = ["typescript-parser", "swc_ecma_transforms/typescript"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
swc_ecma_ast = {version = "0.49.0", path = "./ast"}
|
swc_ecma_ast = {version = "0.49.0", path = "./ast"}
|
||||||
swc_ecma_codegen = {version = "0.62.0", path = "./codegen", optional = true}
|
swc_ecma_codegen = {version = "0.63.0", path = "./codegen", optional = true}
|
||||||
swc_ecma_dep_graph = {version = "0.31.0", path = "./dep-graph", optional = true}
|
swc_ecma_dep_graph = {version = "0.32.0", path = "./dep-graph", optional = true}
|
||||||
swc_ecma_minifier = {version = "0.12.0", path = "./minifier", optional = true}
|
swc_ecma_minifier = {version = "0.13.0", path = "./minifier", optional = true}
|
||||||
swc_ecma_parser = {version = "0.63.0", path = "./parser", optional = true}
|
swc_ecma_parser = {version = "0.64.0", path = "./parser", optional = true, default-features = false}
|
||||||
swc_ecma_transforms = {version = "0.59.0", path = "./transforms", optional = true}
|
swc_ecma_transforms = {version = "0.60.0", path = "./transforms", optional = true}
|
||||||
swc_ecma_utils = {version = "0.40.0", path = "./utils", optional = true}
|
swc_ecma_utils = {version = "0.40.0", path = "./utils", optional = true}
|
||||||
swc_ecma_visit = {version = "0.35.0", path = "./visit", optional = true}
|
swc_ecma_visit = {version = "0.35.0", path = "./visit", optional = true}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
|
|||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc_ecma_codegen"
|
name = "swc_ecma_codegen"
|
||||||
repository = "https://github.com/swc-project/swc.git"
|
repository = "https://github.com/swc-project/swc.git"
|
||||||
version = "0.62.1"
|
version = "0.63.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bitflags = "1"
|
bitflags = "1"
|
||||||
@ -17,7 +17,7 @@ swc_atoms = {version = "0.2", path = "../../atoms"}
|
|||||||
swc_common = {version = "0.11.0", path = "../../common"}
|
swc_common = {version = "0.11.0", path = "../../common"}
|
||||||
swc_ecma_ast = {version = "0.49.0", path = "../ast"}
|
swc_ecma_ast = {version = "0.49.0", path = "../ast"}
|
||||||
swc_ecma_codegen_macros = {version = "0.5.2", path = "./macros"}
|
swc_ecma_codegen_macros = {version = "0.5.2", path = "./macros"}
|
||||||
swc_ecma_parser = {version = "0.63.0", path = "../parser"}
|
swc_ecma_parser = {version = "0.64.0", path = "../parser"}
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
swc_common = {version = "0.11.0", path = "../../common", features = ["sourcemap"]}
|
swc_common = {version = "0.11.0", path = "../../common", features = ["sourcemap"]}
|
||||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
|||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc_ecma_dep_graph"
|
name = "swc_ecma_dep_graph"
|
||||||
repository = "https://github.com/swc-project/swc.git"
|
repository = "https://github.com/swc-project/swc.git"
|
||||||
version = "0.31.0"
|
version = "0.32.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
swc_atoms = {version = "0.2", path = "../../atoms"}
|
swc_atoms = {version = "0.2", path = "../../atoms"}
|
||||||
@ -15,5 +15,5 @@ swc_ecma_ast = {version = "0.49.0", path = "../ast"}
|
|||||||
swc_ecma_visit = {version = "0.35.0", path = "../visit"}
|
swc_ecma_visit = {version = "0.35.0", path = "../visit"}
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
swc_ecma_parser = {version = "0.63.0", path = "../parser"}
|
swc_ecma_parser = {version = "0.64.0", path = "../parser"}
|
||||||
testing = {version = "0.11.0", path = "../../testing"}
|
testing = {version = "0.11.0", path = "../../testing"}
|
||||||
|
@ -5,7 +5,7 @@ documentation = "https://rustdoc.swc.rs/swc_ecma_ext_transforms/"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc_ecma_ext_transforms"
|
name = "swc_ecma_ext_transforms"
|
||||||
version = "0.21.0"
|
version = "0.22.0"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
@ -14,6 +14,6 @@ phf = {version = "0.8.0", features = ["macros"]}
|
|||||||
swc_atoms = {version = "0.2", path = "../../atoms"}
|
swc_atoms = {version = "0.2", path = "../../atoms"}
|
||||||
swc_common = {version = "0.11.0", path = "../../common"}
|
swc_common = {version = "0.11.0", path = "../../common"}
|
||||||
swc_ecma_ast = {version = "0.49.0", path = "../ast"}
|
swc_ecma_ast = {version = "0.49.0", path = "../ast"}
|
||||||
swc_ecma_parser = {version = "0.63.0", path = "../parser"}
|
swc_ecma_parser = {version = "0.64.0", path = "../parser"}
|
||||||
swc_ecma_utils = {version = "0.40.0", path = "../utils"}
|
swc_ecma_utils = {version = "0.40.0", path = "../utils"}
|
||||||
swc_ecma_visit = {version = "0.35.0", path = "../visit"}
|
swc_ecma_visit = {version = "0.35.0", path = "../visit"}
|
||||||
|
@ -5,7 +5,7 @@ documentation = "https://rustdoc.swc.rs/jsdoc/"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "jsdoc"
|
name = "jsdoc"
|
||||||
version = "0.31.0"
|
version = "0.32.0"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
@ -19,6 +19,6 @@ swc_common = {version = "0.11.0", path = "../../common"}
|
|||||||
anyhow = "1"
|
anyhow = "1"
|
||||||
dashmap = "4.0.2"
|
dashmap = "4.0.2"
|
||||||
swc_ecma_ast = {version = "0.49.0", path = "../ast"}
|
swc_ecma_ast = {version = "0.49.0", path = "../ast"}
|
||||||
swc_ecma_parser = {version = "0.63.0", path = "../parser"}
|
swc_ecma_parser = {version = "0.64.0", path = "../parser"}
|
||||||
testing = {version = "0.11.0", path = "../../testing"}
|
testing = {version = "0.11.0", path = "../../testing"}
|
||||||
walkdir = "2"
|
walkdir = "2"
|
||||||
|
@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "src/lists/*.json"]
|
|||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc_ecma_minifier"
|
name = "swc_ecma_minifier"
|
||||||
repository = "https://github.com/swc-project/swc.git"
|
repository = "https://github.com/swc-project/swc.git"
|
||||||
version = "0.12.0"
|
version = "0.13.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
debug = []
|
debug = []
|
||||||
@ -25,10 +25,10 @@ serde_regex = "1.1.0"
|
|||||||
swc_atoms = {version = "0.2", path = "../../atoms"}
|
swc_atoms = {version = "0.2", path = "../../atoms"}
|
||||||
swc_common = {version = "0.11.0", path = "../../common"}
|
swc_common = {version = "0.11.0", path = "../../common"}
|
||||||
swc_ecma_ast = {version = "0.49.0", path = "../ast"}
|
swc_ecma_ast = {version = "0.49.0", path = "../ast"}
|
||||||
swc_ecma_codegen = {version = "0.62.0", path = "../codegen"}
|
swc_ecma_codegen = {version = "0.63.0", path = "../codegen"}
|
||||||
swc_ecma_parser = {version = "0.63.0", path = "../parser"}
|
swc_ecma_parser = {version = "0.64.0", path = "../parser"}
|
||||||
swc_ecma_transforms = {version = "0.59.0", path = "../transforms/", features = ["optimization"]}
|
swc_ecma_transforms = {version = "0.60.0", path = "../transforms/", features = ["optimization"]}
|
||||||
swc_ecma_transforms_base = {version = "0.22.0", path = "../transforms/base"}
|
swc_ecma_transforms_base = {version = "0.23.0", path = "../transforms/base"}
|
||||||
swc_ecma_utils = {version = "0.40.0", path = "../utils"}
|
swc_ecma_utils = {version = "0.40.0", path = "../utils"}
|
||||||
swc_ecma_visit = {version = "0.35.0", path = "../visit"}
|
swc_ecma_visit = {version = "0.35.0", path = "../visit"}
|
||||||
|
|
||||||
|
@ -7,10 +7,14 @@ include = ["Cargo.toml", "src/**/*.rs", "examples/**/*.rs"]
|
|||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc_ecma_parser"
|
name = "swc_ecma_parser"
|
||||||
repository = "https://github.com/swc-project/swc.git"
|
repository = "https://github.com/swc-project/swc.git"
|
||||||
version = "0.63.0"
|
version = "0.64.0"
|
||||||
|
|
||||||
|
[package.metadata.docs.rs]
|
||||||
|
all-features = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = ["typescript"]
|
||||||
|
typescript = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
either = {version = "1.4"}
|
either = {version = "1.4"}
|
||||||
|
@ -127,6 +127,8 @@ pub enum Syntax {
|
|||||||
/// Standard
|
/// Standard
|
||||||
#[serde(rename = "ecmascript")]
|
#[serde(rename = "ecmascript")]
|
||||||
Es(EsConfig),
|
Es(EsConfig),
|
||||||
|
/// This variant requires the cargo feature `typescript` to be enabled.
|
||||||
|
#[cfg(feature = "typescript")]
|
||||||
#[serde(rename = "typescript")]
|
#[serde(rename = "typescript")]
|
||||||
Typescript(TsConfig),
|
Typescript(TsConfig),
|
||||||
}
|
}
|
||||||
@ -230,7 +232,14 @@ impl Syntax {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Should we pare typescript?
|
/// Should we pare typescript?
|
||||||
pub fn typescript(self) -> bool {
|
#[cfg(not(feature = "typescript"))]
|
||||||
|
pub const fn typescript(self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Should we pare typescript?
|
||||||
|
#[cfg(feature = "typescript")]
|
||||||
|
pub const fn typescript(self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
Syntax::Typescript(..) => true,
|
Syntax::Typescript(..) => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
|
@ -546,6 +546,10 @@ impl<I: Tokens> Parser<I> {
|
|||||||
&mut self,
|
&mut self,
|
||||||
token_to_eat: &'static Token,
|
token_to_eat: &'static Token,
|
||||||
) -> PResult<Option<Box<TsType>>> {
|
) -> PResult<Option<Box<TsType>>> {
|
||||||
|
if !cfg!(feature = "typescript") {
|
||||||
|
return Ok(Default::default());
|
||||||
|
}
|
||||||
|
|
||||||
self.in_type().parse_with(|p| {
|
self.in_type().parse_with(|p| {
|
||||||
if !p.input.eat(token_to_eat) {
|
if !p.input.eat(token_to_eat) {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
@ -1191,6 +1195,10 @@ impl<I: Tokens> Parser<I> {
|
|||||||
readonly: bool,
|
readonly: bool,
|
||||||
is_static: bool,
|
is_static: bool,
|
||||||
) -> PResult<Option<TsIndexSignature>> {
|
) -> PResult<Option<TsIndexSignature>> {
|
||||||
|
if !cfg!(feature = "typescript") {
|
||||||
|
return Ok(Default::default());
|
||||||
|
}
|
||||||
|
|
||||||
if !(is!(self, '[') && self.ts_look_ahead(|p| p.is_ts_unambiguously_index_signature())?) {
|
if !(is!(self, '[') && self.ts_look_ahead(|p| p.is_ts_unambiguously_index_signature())?) {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
@ -1576,6 +1584,10 @@ impl<I: Tokens> Parser<I> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn try_parse_ts_tuple_element_name(&mut self) -> Option<Pat> {
|
fn try_parse_ts_tuple_element_name(&mut self) -> Option<Pat> {
|
||||||
|
if !cfg!(feature = "typescript") {
|
||||||
|
return Default::default();
|
||||||
|
}
|
||||||
|
|
||||||
self.try_parse_ts(|p| {
|
self.try_parse_ts(|p| {
|
||||||
let start = cur_pos!(p);
|
let start = cur_pos!(p);
|
||||||
|
|
||||||
@ -1752,6 +1764,10 @@ impl<I: Tokens> Parser<I> {
|
|||||||
|
|
||||||
#[allow(clippy::vec_box)]
|
#[allow(clippy::vec_box)]
|
||||||
fn parse_ts_tpl_type_elements(&mut self) -> PResult<(Vec<Box<TsType>>, Vec<TplElement>)> {
|
fn parse_ts_tpl_type_elements(&mut self) -> PResult<(Vec<Box<TsType>>, Vec<TplElement>)> {
|
||||||
|
if !cfg!(feature = "typescript") {
|
||||||
|
return Ok(Default::default());
|
||||||
|
}
|
||||||
|
|
||||||
trace_cur!(self, parse_tpl_elements);
|
trace_cur!(self, parse_tpl_elements);
|
||||||
|
|
||||||
let mut types = vec![];
|
let mut types = vec![];
|
||||||
@ -1776,6 +1792,10 @@ impl<I: Tokens> Parser<I> {
|
|||||||
///
|
///
|
||||||
/// Eats ')` at the end but does not eat `(` at start.
|
/// Eats ')` at the end but does not eat `(` at start.
|
||||||
fn parse_ts_binding_list_for_signature(&mut self) -> PResult<Vec<TsFnParam>> {
|
fn parse_ts_binding_list_for_signature(&mut self) -> PResult<Vec<TsFnParam>> {
|
||||||
|
if !cfg!(feature = "typescript") {
|
||||||
|
return Ok(Default::default());
|
||||||
|
}
|
||||||
|
|
||||||
debug_assert!(self.input.syntax().typescript());
|
debug_assert!(self.input.syntax().typescript());
|
||||||
|
|
||||||
let params = self.parse_formal_params()?;
|
let params = self.parse_formal_params()?;
|
||||||
@ -1803,6 +1823,10 @@ impl<I: Tokens> Parser<I> {
|
|||||||
///
|
///
|
||||||
/// Used for parsing return types.
|
/// Used for parsing return types.
|
||||||
fn try_parse_ts_type_or_type_predicate_ann(&mut self) -> PResult<Option<TsTypeAnn>> {
|
fn try_parse_ts_type_or_type_predicate_ann(&mut self) -> PResult<Option<TsTypeAnn>> {
|
||||||
|
if !cfg!(feature = "typescript") {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
|
||||||
if is!(self, ':') {
|
if is!(self, ':') {
|
||||||
self.parse_ts_type_or_type_predicate_ann(&tok!(':'))
|
self.parse_ts_type_or_type_predicate_ann(&tok!(':'))
|
||||||
.map(Some)
|
.map(Some)
|
||||||
@ -1813,6 +1837,10 @@ impl<I: Tokens> Parser<I> {
|
|||||||
|
|
||||||
/// `tsTryParseTypeAnnotation`
|
/// `tsTryParseTypeAnnotation`
|
||||||
pub(super) fn try_parse_ts_type_ann(&mut self) -> PResult<Option<TsTypeAnn>> {
|
pub(super) fn try_parse_ts_type_ann(&mut self) -> PResult<Option<TsTypeAnn>> {
|
||||||
|
if !cfg!(feature = "typescript") {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
|
||||||
if is!(self, ':') {
|
if is!(self, ':') {
|
||||||
let pos = cur_pos!(self);
|
let pos = cur_pos!(self);
|
||||||
return self.parse_ts_type_ann(/* eat_colon */ true, pos).map(Some);
|
return self.parse_ts_type_ann(/* eat_colon */ true, pos).map(Some);
|
||||||
@ -1823,11 +1851,19 @@ impl<I: Tokens> Parser<I> {
|
|||||||
|
|
||||||
/// `tsTryParseType`
|
/// `tsTryParseType`
|
||||||
fn try_parse_ts_type(&mut self) -> PResult<Option<Box<TsType>>> {
|
fn try_parse_ts_type(&mut self) -> PResult<Option<Box<TsType>>> {
|
||||||
|
if !cfg!(feature = "typescript") {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
|
||||||
self.eat_then_parse_ts_type(&tok!(':'))
|
self.eat_then_parse_ts_type(&tok!(':'))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `tsTryParseTypeParameters`
|
/// `tsTryParseTypeParameters`
|
||||||
pub(super) fn try_parse_ts_type_params(&mut self) -> PResult<Option<TsTypeParamDecl>> {
|
pub(super) fn try_parse_ts_type_params(&mut self) -> PResult<Option<TsTypeParamDecl>> {
|
||||||
|
if !cfg!(feature = "typescript") {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
|
||||||
if is!(self, '<') {
|
if is!(self, '<') {
|
||||||
return self.parse_ts_type_params().map(Some);
|
return self.parse_ts_type_params().map(Some);
|
||||||
}
|
}
|
||||||
@ -1837,6 +1873,9 @@ impl<I: Tokens> Parser<I> {
|
|||||||
/// `tsParseNonArrayType`
|
/// `tsParseNonArrayType`
|
||||||
#[allow(clippy::cognitive_complexity)]
|
#[allow(clippy::cognitive_complexity)]
|
||||||
fn parse_ts_non_array_type(&mut self) -> PResult<Box<TsType>> {
|
fn parse_ts_non_array_type(&mut self) -> PResult<Box<TsType>> {
|
||||||
|
if !cfg!(feature = "typescript") {
|
||||||
|
unreachable!()
|
||||||
|
}
|
||||||
trace_cur!(self, parse_ts_non_array_type);
|
trace_cur!(self, parse_ts_non_array_type);
|
||||||
debug_assert!(self.input.syntax().typescript());
|
debug_assert!(self.input.syntax().typescript());
|
||||||
|
|
||||||
@ -2091,6 +2130,10 @@ impl<I: Tokens> Parser<I> {
|
|||||||
decorators: Vec<Decorator>,
|
decorators: Vec<Decorator>,
|
||||||
expr: Ident,
|
expr: Ident,
|
||||||
) -> PResult<Option<Decl>> {
|
) -> PResult<Option<Decl>> {
|
||||||
|
if !cfg!(feature = "typescript") {
|
||||||
|
return Ok(Default::default());
|
||||||
|
}
|
||||||
|
|
||||||
let start = expr.span().lo();
|
let start = expr.span().lo();
|
||||||
|
|
||||||
match &*expr.sym {
|
match &*expr.sym {
|
||||||
@ -2161,6 +2204,10 @@ impl<I: Tokens> Parser<I> {
|
|||||||
start: BytePos,
|
start: BytePos,
|
||||||
decorators: Vec<Decorator>,
|
decorators: Vec<Decorator>,
|
||||||
) -> PResult<Option<Decl>> {
|
) -> PResult<Option<Decl>> {
|
||||||
|
if !self.syntax().typescript() {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
!is!(self, "declare"),
|
!is!(self, "declare"),
|
||||||
"try_parse_ts_declare should be called after eating `declare`"
|
"try_parse_ts_declare should be called after eating `declare`"
|
||||||
@ -2280,6 +2327,10 @@ impl<I: Tokens> Parser<I> {
|
|||||||
decorators: Vec<Decorator>,
|
decorators: Vec<Decorator>,
|
||||||
value: JsWord,
|
value: JsWord,
|
||||||
) -> Option<Decl> {
|
) -> Option<Decl> {
|
||||||
|
if !cfg!(feature = "typescript") {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
self.try_parse_ts(|p| {
|
self.try_parse_ts(|p| {
|
||||||
let start = cur_pos!(p);
|
let start = cur_pos!(p);
|
||||||
let opt = p.parse_ts_decl(start, decorators, value, true)?;
|
let opt = p.parse_ts_decl(start, decorators, value, true)?;
|
||||||
@ -2302,6 +2353,10 @@ impl<I: Tokens> Parser<I> {
|
|||||||
value: JsWord,
|
value: JsWord,
|
||||||
next: bool,
|
next: bool,
|
||||||
) -> PResult<Option<Decl>> {
|
) -> PResult<Option<Decl>> {
|
||||||
|
if !cfg!(feature = "typescript") {
|
||||||
|
return Ok(Default::default());
|
||||||
|
}
|
||||||
|
|
||||||
match value {
|
match value {
|
||||||
js_word!("abstract") => {
|
js_word!("abstract") => {
|
||||||
if next || (is!(self, "class") && !self.input.had_line_break_before_cur()) {
|
if next || (is!(self, "class") && !self.input.had_line_break_before_cur()) {
|
||||||
@ -2405,6 +2460,10 @@ impl<I: Tokens> Parser<I> {
|
|||||||
&mut self,
|
&mut self,
|
||||||
start: BytePos,
|
start: BytePos,
|
||||||
) -> PResult<Option<ArrowExpr>> {
|
) -> PResult<Option<ArrowExpr>> {
|
||||||
|
if !cfg!(feature = "typescript") {
|
||||||
|
return Ok(Default::default());
|
||||||
|
}
|
||||||
|
|
||||||
let res = if is_one_of!(self, '<', JSXTagStart) {
|
let res = if is_one_of!(self, '<', JSXTagStart) {
|
||||||
self.try_parse_ts(|p| {
|
self.try_parse_ts(|p| {
|
||||||
let type_params = p.parse_ts_type_params()?;
|
let type_params = p.parse_ts_type_params()?;
|
||||||
|
@ -5,7 +5,7 @@ documentation = "https://rustdoc.swc.rs/swc_ecma_preset_env/"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc_ecma_preset_env"
|
name = "swc_ecma_preset_env"
|
||||||
version = "0.29.0"
|
version = "0.30.0"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
@ -22,13 +22,13 @@ string_enum = {version = "0.3.1", path = "../../macros/string_enum"}
|
|||||||
swc_atoms = {version = "0.2", path = "../../atoms"}
|
swc_atoms = {version = "0.2", path = "../../atoms"}
|
||||||
swc_common = {version = "0.11.0", path = "../../common"}
|
swc_common = {version = "0.11.0", path = "../../common"}
|
||||||
swc_ecma_ast = {version = "0.49.0", path = "../ast"}
|
swc_ecma_ast = {version = "0.49.0", path = "../ast"}
|
||||||
swc_ecma_transforms = {version = "0.59.0", path = "../transforms", features = ["compat", "proposal"]}
|
swc_ecma_transforms = {version = "0.60.0", path = "../transforms", features = ["compat", "proposal"]}
|
||||||
swc_ecma_utils = {version = "0.40.0", path = "../utils"}
|
swc_ecma_utils = {version = "0.40.0", path = "../utils"}
|
||||||
swc_ecma_visit = {version = "0.35.0", path = "../visit"}
|
swc_ecma_visit = {version = "0.35.0", path = "../visit"}
|
||||||
walkdir = "2"
|
walkdir = "2"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
pretty_assertions = "0.6"
|
pretty_assertions = "0.6"
|
||||||
swc_ecma_codegen = {version = "0.62.0", path = "../codegen"}
|
swc_ecma_codegen = {version = "0.63.0", path = "../codegen"}
|
||||||
swc_ecma_parser = {version = "0.63.0", path = "../parser"}
|
swc_ecma_parser = {version = "0.64.0", path = "../parser"}
|
||||||
testing = {version = "0.11.0", path = "../../testing"}
|
testing = {version = "0.11.0", path = "../../testing"}
|
||||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
|||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc_ecma_transforms"
|
name = "swc_ecma_transforms"
|
||||||
repository = "https://github.com/swc-project/swc.git"
|
repository = "https://github.com/swc-project/swc.git"
|
||||||
version = "0.59.0"
|
version = "0.60.0"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
@ -24,14 +24,14 @@ typescript = ["swc_ecma_transforms_typescript"]
|
|||||||
swc_atoms = {version = "0.2.0", path = "../../atoms"}
|
swc_atoms = {version = "0.2.0", path = "../../atoms"}
|
||||||
swc_common = {version = "0.11.0", path = "../../common"}
|
swc_common = {version = "0.11.0", path = "../../common"}
|
||||||
swc_ecma_ast = {version = "0.49.0", path = "../ast"}
|
swc_ecma_ast = {version = "0.49.0", path = "../ast"}
|
||||||
swc_ecma_parser = {version = "0.63.0", path = "../parser"}
|
swc_ecma_parser = {version = "0.64.0", path = "../parser"}
|
||||||
swc_ecma_transforms_base = {version = "0.22.0", path = "./base"}
|
swc_ecma_transforms_base = {version = "0.23.0", path = "./base"}
|
||||||
swc_ecma_transforms_compat = {version = "0.25.0", path = "./compat", optional = true}
|
swc_ecma_transforms_compat = {version = "0.26.0", path = "./compat", optional = true}
|
||||||
swc_ecma_transforms_module = {version = "0.26.0", path = "./module", optional = true}
|
swc_ecma_transforms_module = {version = "0.27.0", path = "./module", optional = true}
|
||||||
swc_ecma_transforms_optimization = {version = "0.29.0", path = "./optimization", optional = true}
|
swc_ecma_transforms_optimization = {version = "0.30.0", path = "./optimization", optional = true}
|
||||||
swc_ecma_transforms_proposal = {version = "0.26.0", path = "./proposal", optional = true}
|
swc_ecma_transforms_proposal = {version = "0.27.0", path = "./proposal", optional = true}
|
||||||
swc_ecma_transforms_react = {version = "0.27.0", path = "./react", optional = true}
|
swc_ecma_transforms_react = {version = "0.28.0", path = "./react", optional = true}
|
||||||
swc_ecma_transforms_typescript = {version = "0.28.0", path = "./typescript", optional = true}
|
swc_ecma_transforms_typescript = {version = "0.29.0", path = "./typescript", optional = true}
|
||||||
swc_ecma_utils = {version = "0.40.0", path = "../utils"}
|
swc_ecma_utils = {version = "0.40.0", path = "../utils"}
|
||||||
swc_ecma_visit = {version = "0.35.0", path = "../visit"}
|
swc_ecma_visit = {version = "0.35.0", path = "../visit"}
|
||||||
unicode-xid = "0.2"
|
unicode-xid = "0.2"
|
||||||
@ -39,8 +39,8 @@ unicode-xid = "0.2"
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
pretty_assertions = "0.6"
|
pretty_assertions = "0.6"
|
||||||
sourcemap = "6"
|
sourcemap = "6"
|
||||||
swc_ecma_codegen = {version = "0.62.0", path = "../codegen"}
|
swc_ecma_codegen = {version = "0.63.0", path = "../codegen"}
|
||||||
swc_ecma_transforms_testing = {version = "0.22.0", path = "./testing"}
|
swc_ecma_transforms_testing = {version = "0.23.0", path = "./testing"}
|
||||||
tempfile = "3"
|
tempfile = "3"
|
||||||
testing = {version = "0.11.0", path = "../../testing"}
|
testing = {version = "0.11.0", path = "../../testing"}
|
||||||
walkdir = "2"
|
walkdir = "2"
|
||||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
|||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc_ecma_transforms_base"
|
name = "swc_ecma_transforms_base"
|
||||||
repository = "https://github.com/swc-project/swc.git"
|
repository = "https://github.com/swc-project/swc.git"
|
||||||
version = "0.22.3"
|
version = "0.23.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
fxhash = "0.2.1"
|
fxhash = "0.2.1"
|
||||||
@ -17,10 +17,10 @@ smallvec = "1.6.0"
|
|||||||
swc_atoms = {version = "0.2", path = "../../../atoms"}
|
swc_atoms = {version = "0.2", path = "../../../atoms"}
|
||||||
swc_common = {version = "0.11.0", path = "../../../common"}
|
swc_common = {version = "0.11.0", path = "../../../common"}
|
||||||
swc_ecma_ast = {version = "0.49.0", path = "../../ast"}
|
swc_ecma_ast = {version = "0.49.0", path = "../../ast"}
|
||||||
swc_ecma_parser = {version = "0.63.0", path = "../../parser"}
|
swc_ecma_parser = {version = "0.64.0", path = "../../parser"}
|
||||||
swc_ecma_utils = {version = "0.40.0", path = "../../utils"}
|
swc_ecma_utils = {version = "0.40.0", path = "../../utils"}
|
||||||
swc_ecma_visit = {version = "0.35.0", path = "../../visit"}
|
swc_ecma_visit = {version = "0.35.0", path = "../../visit"}
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
swc_ecma_codegen = {version = "0.62.0", path = "../../codegen"}
|
swc_ecma_codegen = {version = "0.63.0", path = "../../codegen"}
|
||||||
testing = {version = "0.11.0", path = "../../../testing"}
|
testing = {version = "0.11.0", path = "../../../testing"}
|
||||||
|
@ -6,12 +6,12 @@ edition = "2018"
|
|||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc_ecma_transforms_classes"
|
name = "swc_ecma_transforms_classes"
|
||||||
repository = "https://github.com/swc-project/swc.git"
|
repository = "https://github.com/swc-project/swc.git"
|
||||||
version = "0.8.0"
|
version = "0.9.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
swc_atoms = {version = "0.2.6", path = "../../../atoms"}
|
swc_atoms = {version = "0.2.6", path = "../../../atoms"}
|
||||||
swc_common = {version = "0.11.0", path = "../../../common"}
|
swc_common = {version = "0.11.0", path = "../../../common"}
|
||||||
swc_ecma_ast = {version = "0.49.0", path = "../../ast"}
|
swc_ecma_ast = {version = "0.49.0", path = "../../ast"}
|
||||||
swc_ecma_transforms_base = {version = "0.22.0", path = "../base"}
|
swc_ecma_transforms_base = {version = "0.23.0", path = "../base"}
|
||||||
swc_ecma_utils = {version = "0.40.0", path = "../../utils"}
|
swc_ecma_utils = {version = "0.40.0", path = "../../utils"}
|
||||||
swc_ecma_visit = {version = "0.35.0", path = "../../visit"}
|
swc_ecma_visit = {version = "0.35.0", path = "../../visit"}
|
||||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
|||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc_ecma_transforms_compat"
|
name = "swc_ecma_transforms_compat"
|
||||||
repository = "https://github.com/swc-project/swc.git"
|
repository = "https://github.com/swc-project/swc.git"
|
||||||
version = "0.25.2"
|
version = "0.26.0"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@ -21,13 +21,13 @@ smallvec = "1.6.0"
|
|||||||
swc_atoms = {version = "0.2.5", path = "../../../atoms"}
|
swc_atoms = {version = "0.2.5", path = "../../../atoms"}
|
||||||
swc_common = {version = "0.11.0", path = "../../../common"}
|
swc_common = {version = "0.11.0", path = "../../../common"}
|
||||||
swc_ecma_ast = {version = "0.49.0", path = "../../ast"}
|
swc_ecma_ast = {version = "0.49.0", path = "../../ast"}
|
||||||
swc_ecma_transforms_base = {version = "0.22.0", path = "../base"}
|
swc_ecma_transforms_base = {version = "0.23.0", path = "../base"}
|
||||||
swc_ecma_transforms_classes = {version = "0.8.0", path = "../classes"}
|
swc_ecma_transforms_classes = {version = "0.9.0", path = "../classes"}
|
||||||
swc_ecma_transforms_macros = {version = "0.2.1", path = "../macros"}
|
swc_ecma_transforms_macros = {version = "0.2.1", path = "../macros"}
|
||||||
swc_ecma_utils = {version = "0.40.0", path = "../../utils"}
|
swc_ecma_utils = {version = "0.40.0", path = "../../utils"}
|
||||||
swc_ecma_visit = {version = "0.35.0", path = "../../visit"}
|
swc_ecma_visit = {version = "0.35.0", path = "../../visit"}
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
swc_ecma_parser = {version = "0.63.0", path = "../../parser"}
|
swc_ecma_parser = {version = "0.64.0", path = "../../parser"}
|
||||||
swc_ecma_transforms_testing = {version = "0.22.0", path = "../testing"}
|
swc_ecma_transforms_testing = {version = "0.23.0", path = "../testing"}
|
||||||
testing = {version = "0.11.0", path = "../../../testing"}
|
testing = {version = "0.11.0", path = "../../../testing"}
|
||||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
|||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc_ecma_transforms_module"
|
name = "swc_ecma_transforms_module"
|
||||||
repository = "https://github.com/swc-project/swc.git"
|
repository = "https://github.com/swc-project/swc.git"
|
||||||
version = "0.26.2"
|
version = "0.27.0"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@ -20,12 +20,12 @@ swc_atoms = {version = "0.2", path = "../../../atoms"}
|
|||||||
swc_common = {version = "0.11.0", path = "../../../common"}
|
swc_common = {version = "0.11.0", path = "../../../common"}
|
||||||
swc_ecma_ast = {version = "0.49.0", path = "../../ast"}
|
swc_ecma_ast = {version = "0.49.0", path = "../../ast"}
|
||||||
swc_ecma_loader = {version = "0.11.0", path = "../../loader", features = ["node"]}
|
swc_ecma_loader = {version = "0.11.0", path = "../../loader", features = ["node"]}
|
||||||
swc_ecma_parser = {version = "0.63.0", path = "../../parser"}
|
swc_ecma_parser = {version = "0.64.0", path = "../../parser"}
|
||||||
swc_ecma_transforms_base = {version = "0.22.0", path = "../base"}
|
swc_ecma_transforms_base = {version = "0.23.0", path = "../base"}
|
||||||
swc_ecma_utils = {version = "0.40.0", path = "../../utils"}
|
swc_ecma_utils = {version = "0.40.0", path = "../../utils"}
|
||||||
swc_ecma_visit = {version = "0.35.0", path = "../../visit"}
|
swc_ecma_visit = {version = "0.35.0", path = "../../visit"}
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
swc_ecma_transforms_compat = {version = "0.25.0", path = "../compat"}
|
swc_ecma_transforms_compat = {version = "0.26.0", path = "../compat"}
|
||||||
swc_ecma_transforms_testing = {version = "0.22.0", path = "../testing/"}
|
swc_ecma_transforms_testing = {version = "0.23.0", path = "../testing/"}
|
||||||
testing = {version = "0.11.0", path = "../../../testing/"}
|
testing = {version = "0.11.0", path = "../../../testing/"}
|
||||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
|||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc_ecma_transforms_optimization"
|
name = "swc_ecma_transforms_optimization"
|
||||||
repository = "https://github.com/swc-project/swc.git"
|
repository = "https://github.com/swc-project/swc.git"
|
||||||
version = "0.29.1"
|
version = "0.30.0"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@ -20,16 +20,16 @@ serde_json = "1.0.61"
|
|||||||
swc_atoms = {version = "0.2", path = "../../../atoms"}
|
swc_atoms = {version = "0.2", path = "../../../atoms"}
|
||||||
swc_common = {version = "0.11.0", path = "../../../common"}
|
swc_common = {version = "0.11.0", path = "../../../common"}
|
||||||
swc_ecma_ast = {version = "0.49.0", path = "../../ast"}
|
swc_ecma_ast = {version = "0.49.0", path = "../../ast"}
|
||||||
swc_ecma_parser = {version = "0.63.0", path = "../../parser"}
|
swc_ecma_parser = {version = "0.64.0", path = "../../parser"}
|
||||||
swc_ecma_transforms_base = {version = "0.22.0", path = "../base"}
|
swc_ecma_transforms_base = {version = "0.23.0", path = "../base"}
|
||||||
swc_ecma_utils = {version = "0.40.0", path = "../../utils"}
|
swc_ecma_utils = {version = "0.40.0", path = "../../utils"}
|
||||||
swc_ecma_visit = {version = "0.35.0", path = "../../visit"}
|
swc_ecma_visit = {version = "0.35.0", path = "../../visit"}
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
swc_ecma_transforms_compat = {version = "0.25.0", path = "../compat"}
|
swc_ecma_transforms_compat = {version = "0.26.0", path = "../compat"}
|
||||||
swc_ecma_transforms_module = {version = "0.26.0", path = "../module"}
|
swc_ecma_transforms_module = {version = "0.27.0", path = "../module"}
|
||||||
swc_ecma_transforms_proposal = {version = "0.26.0", path = "../proposal"}
|
swc_ecma_transforms_proposal = {version = "0.27.0", path = "../proposal"}
|
||||||
swc_ecma_transforms_react = {version = "0.27.0", path = "../react"}
|
swc_ecma_transforms_react = {version = "0.28.0", path = "../react"}
|
||||||
swc_ecma_transforms_testing = {version = "0.22.0", path = "../testing"}
|
swc_ecma_transforms_testing = {version = "0.23.0", path = "../testing"}
|
||||||
swc_ecma_transforms_typescript = {version = "0.28.0", path = "../typescript"}
|
swc_ecma_transforms_typescript = {version = "0.29.0", path = "../typescript"}
|
||||||
testing = {version = "0.11.0", path = "../../../testing"}
|
testing = {version = "0.11.0", path = "../../../testing"}
|
||||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
|||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc_ecma_transforms_proposal"
|
name = "swc_ecma_transforms_proposal"
|
||||||
repository = "https://github.com/swc-project/swc.git"
|
repository = "https://github.com/swc-project/swc.git"
|
||||||
version = "0.26.1"
|
version = "0.27.0"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
@ -23,13 +23,13 @@ swc_atoms = {version = "0.2", path = "../../../atoms"}
|
|||||||
swc_common = {version = "0.11.0", path = "../../../common"}
|
swc_common = {version = "0.11.0", path = "../../../common"}
|
||||||
swc_ecma_ast = {version = "0.49.0", path = "../../ast"}
|
swc_ecma_ast = {version = "0.49.0", path = "../../ast"}
|
||||||
swc_ecma_loader = {version = "0.11.0", path = "../../loader", optional = true}
|
swc_ecma_loader = {version = "0.11.0", path = "../../loader", optional = true}
|
||||||
swc_ecma_parser = {version = "0.63.0", path = "../../parser"}
|
swc_ecma_parser = {version = "0.64.0", path = "../../parser"}
|
||||||
swc_ecma_transforms_base = {version = "0.22.0", path = "../base"}
|
swc_ecma_transforms_base = {version = "0.23.0", path = "../base"}
|
||||||
swc_ecma_transforms_classes = {version = "0.8.0", path = "../classes"}
|
swc_ecma_transforms_classes = {version = "0.9.0", path = "../classes"}
|
||||||
swc_ecma_utils = {version = "0.40.0", path = "../../utils"}
|
swc_ecma_utils = {version = "0.40.0", path = "../../utils"}
|
||||||
swc_ecma_visit = {version = "0.35.0", path = "../../visit"}
|
swc_ecma_visit = {version = "0.35.0", path = "../../visit"}
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
swc_ecma_transforms_compat = {version = "0.25.0", path = "../compat"}
|
swc_ecma_transforms_compat = {version = "0.26.0", path = "../compat"}
|
||||||
swc_ecma_transforms_module = {version = "0.26.0", path = "../module"}
|
swc_ecma_transforms_module = {version = "0.27.0", path = "../module"}
|
||||||
swc_ecma_transforms_testing = {version = "0.22.0", path = "../testing"}
|
swc_ecma_transforms_testing = {version = "0.23.0", path = "../testing"}
|
||||||
|
@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
|
|||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc_ecma_transforms_react"
|
name = "swc_ecma_transforms_react"
|
||||||
repository = "https://github.com/swc-project/swc.git"
|
repository = "https://github.com/swc-project/swc.git"
|
||||||
version = "0.27.0"
|
version = "0.28.0"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@ -22,14 +22,14 @@ string_enum = {version = "0.3.1", path = "../../../macros/string_enum"}
|
|||||||
swc_atoms = {version = "0.2", path = "../../../atoms"}
|
swc_atoms = {version = "0.2", path = "../../../atoms"}
|
||||||
swc_common = {version = "0.11.0", path = "../../../common"}
|
swc_common = {version = "0.11.0", path = "../../../common"}
|
||||||
swc_ecma_ast = {version = "0.49.0", path = "../../ast"}
|
swc_ecma_ast = {version = "0.49.0", path = "../../ast"}
|
||||||
swc_ecma_parser = {version = "0.63.0", path = "../../parser"}
|
swc_ecma_parser = {version = "0.64.0", path = "../../parser"}
|
||||||
swc_ecma_transforms_base = {version = "0.22.0", path = "../base"}
|
swc_ecma_transforms_base = {version = "0.23.0", path = "../base"}
|
||||||
swc_ecma_utils = {version = "0.40.0", path = "../../utils"}
|
swc_ecma_utils = {version = "0.40.0", path = "../../utils"}
|
||||||
swc_ecma_visit = {version = "0.35.0", path = "../../visit"}
|
swc_ecma_visit = {version = "0.35.0", path = "../../visit"}
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
swc_ecma_codegen = {version = "0.62.0", path = "../../codegen/"}
|
swc_ecma_codegen = {version = "0.63.0", path = "../../codegen/"}
|
||||||
swc_ecma_transforms_compat = {version = "0.25.0", path = "../compat/"}
|
swc_ecma_transforms_compat = {version = "0.26.0", path = "../compat/"}
|
||||||
swc_ecma_transforms_module = {version = "0.26.0", path = "../module"}
|
swc_ecma_transforms_module = {version = "0.27.0", path = "../module"}
|
||||||
swc_ecma_transforms_testing = {version = "0.22.0", path = "../testing/"}
|
swc_ecma_transforms_testing = {version = "0.23.0", path = "../testing/"}
|
||||||
testing = {version = "0.11.0", path = "../../../testing"}
|
testing = {version = "0.11.0", path = "../../../testing"}
|
||||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
|||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc_ecma_transforms_testing"
|
name = "swc_ecma_transforms_testing"
|
||||||
repository = "https://github.com/swc-project/swc.git"
|
repository = "https://github.com/swc-project/swc.git"
|
||||||
version = "0.22.0"
|
version = "0.23.0"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
@ -16,9 +16,9 @@ serde = "1"
|
|||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
swc_common = {version = "0.11.0", path = "../../../common"}
|
swc_common = {version = "0.11.0", path = "../../../common"}
|
||||||
swc_ecma_ast = {version = "0.49.0", path = "../../ast"}
|
swc_ecma_ast = {version = "0.49.0", path = "../../ast"}
|
||||||
swc_ecma_codegen = {version = "0.62.0", path = "../../codegen"}
|
swc_ecma_codegen = {version = "0.63.0", path = "../../codegen"}
|
||||||
swc_ecma_parser = {version = "0.63.0", path = "../../parser"}
|
swc_ecma_parser = {version = "0.64.0", path = "../../parser"}
|
||||||
swc_ecma_transforms_base = {version = "0.22.0", path = "../base"}
|
swc_ecma_transforms_base = {version = "0.23.0", path = "../base"}
|
||||||
swc_ecma_utils = {version = "0.40.0", path = "../../utils"}
|
swc_ecma_utils = {version = "0.40.0", path = "../../utils"}
|
||||||
swc_ecma_visit = {version = "0.35.0", path = "../../visit"}
|
swc_ecma_visit = {version = "0.35.0", path = "../../visit"}
|
||||||
tempfile = "3.1.0"
|
tempfile = "3.1.0"
|
||||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
|||||||
license = "Apache-2.0/MIT"
|
license = "Apache-2.0/MIT"
|
||||||
name = "swc_ecma_transforms_typescript"
|
name = "swc_ecma_transforms_typescript"
|
||||||
repository = "https://github.com/swc-project/swc.git"
|
repository = "https://github.com/swc-project/swc.git"
|
||||||
version = "0.28.2"
|
version = "0.29.0"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@ -15,16 +15,16 @@ serde = {version = "1.0.118", features = ["derive"]}
|
|||||||
swc_atoms = {version = "0.2", path = "../../../atoms"}
|
swc_atoms = {version = "0.2", path = "../../../atoms"}
|
||||||
swc_common = {version = "0.11.0", path = "../../../common"}
|
swc_common = {version = "0.11.0", path = "../../../common"}
|
||||||
swc_ecma_ast = {version = "0.49.0", path = "../../ast"}
|
swc_ecma_ast = {version = "0.49.0", path = "../../ast"}
|
||||||
swc_ecma_parser = {version = "0.63.0", path = "../../parser"}
|
swc_ecma_parser = {version = "0.64.0", path = "../../parser"}
|
||||||
swc_ecma_transforms_base = {version = "0.22.0", path = "../base"}
|
swc_ecma_transforms_base = {version = "0.23.0", path = "../base"}
|
||||||
swc_ecma_utils = {version = "0.40.0", path = "../../utils"}
|
swc_ecma_utils = {version = "0.40.0", path = "../../utils"}
|
||||||
swc_ecma_visit = {version = "0.35.0", path = "../../visit"}
|
swc_ecma_visit = {version = "0.35.0", path = "../../visit"}
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
swc_ecma_codegen = {version = "0.62.0", path = "../../codegen"}
|
swc_ecma_codegen = {version = "0.63.0", path = "../../codegen"}
|
||||||
swc_ecma_transforms_compat = {version = "0.25.0", path = "../compat"}
|
swc_ecma_transforms_compat = {version = "0.26.0", path = "../compat"}
|
||||||
swc_ecma_transforms_module = {version = "0.26.0", path = "../module"}
|
swc_ecma_transforms_module = {version = "0.27.0", path = "../module"}
|
||||||
swc_ecma_transforms_proposal = {version = "0.26.0", path = "../proposal/"}
|
swc_ecma_transforms_proposal = {version = "0.27.0", path = "../proposal/"}
|
||||||
swc_ecma_transforms_testing = {version = "0.22.0", path = "../testing"}
|
swc_ecma_transforms_testing = {version = "0.23.0", path = "../testing"}
|
||||||
testing = {version = "0.11.0", path = "../../../testing"}
|
testing = {version = "0.11.0", path = "../../../testing"}
|
||||||
walkdir = "2.3.1"
|
walkdir = "2.3.1"
|
||||||
|
@ -129,17 +129,18 @@ var load = __spack_require__.bind(void 0, function(module, exports) {
|
|||||||
// don't natively support it.
|
// don't natively support it.
|
||||||
var IteratorPrototype = {
|
var IteratorPrototype = {
|
||||||
};
|
};
|
||||||
IteratorPrototype[iteratorSymbol] = function() {
|
define(IteratorPrototype, iteratorSymbol, function() {
|
||||||
return this;
|
return this;
|
||||||
};
|
});
|
||||||
var getProto = Object.getPrototypeOf;
|
var getProto = Object.getPrototypeOf;
|
||||||
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
||||||
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) // This environment has a native %IteratorPrototype%; use it instead
|
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) // This environment has a native %IteratorPrototype%; use it instead
|
||||||
// of the polyfill.
|
// of the polyfill.
|
||||||
IteratorPrototype = NativeIteratorPrototype;
|
IteratorPrototype = NativeIteratorPrototype;
|
||||||
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
||||||
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
||||||
GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
define(Gp, "constructor", GeneratorFunctionPrototype);
|
||||||
|
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
||||||
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
||||||
// Helper for defining the .next, .throw, and .return methods of the
|
// Helper for defining the .next, .throw, and .return methods of the
|
||||||
// Iterator interface in terms of a single ._invoke method.
|
// Iterator interface in terms of a single ._invoke method.
|
||||||
@ -231,9 +232,9 @@ var load = __spack_require__.bind(void 0, function(module, exports) {
|
|||||||
this._invoke = enqueue;
|
this._invoke = enqueue;
|
||||||
}
|
}
|
||||||
defineIteratorMethods(AsyncIterator.prototype);
|
defineIteratorMethods(AsyncIterator.prototype);
|
||||||
AsyncIterator.prototype[asyncIteratorSymbol] = function() {
|
define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
|
||||||
return this;
|
return this;
|
||||||
};
|
});
|
||||||
exports1.AsyncIterator = AsyncIterator;
|
exports1.AsyncIterator = AsyncIterator;
|
||||||
// Note that simple async functions are implemented on top of
|
// Note that simple async functions are implemented on top of
|
||||||
// AsyncIterator objects; they just return a Promise for the value of
|
// AsyncIterator objects; they just return a Promise for the value of
|
||||||
@ -371,12 +372,12 @@ var load = __spack_require__.bind(void 0, function(module, exports) {
|
|||||||
// iterator prototype chain incorrectly implement this, causing the Generator
|
// iterator prototype chain incorrectly implement this, causing the Generator
|
||||||
// object to not be returned from this call. This ensures that doesn't happen.
|
// object to not be returned from this call. This ensures that doesn't happen.
|
||||||
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
||||||
Gp[iteratorSymbol] = function() {
|
define(Gp, iteratorSymbol, function() {
|
||||||
return this;
|
return this;
|
||||||
};
|
});
|
||||||
Gp.toString = function() {
|
define(Gp, "toString", function() {
|
||||||
return "[object Generator]";
|
return "[object Generator]";
|
||||||
};
|
});
|
||||||
function pushTryEntry(locs) {
|
function pushTryEntry(locs) {
|
||||||
var entry = {
|
var entry = {
|
||||||
tryLoc: locs[0]
|
tryLoc: locs[0]
|
||||||
@ -607,14 +608,16 @@ var load = __spack_require__.bind(void 0, function(module, exports) {
|
|||||||
} catch (accidentalStrictMode) {
|
} catch (accidentalStrictMode) {
|
||||||
// This module should not be running in strict mode, so the above
|
// This module should not be running in strict mode, so the above
|
||||||
// assignment should always work unless something is misconfigured. Just
|
// assignment should always work unless something is misconfigured. Just
|
||||||
// in case runtime.js accidentally runs in strict mode, we can escape
|
// in case runtime.js accidentally runs in strict mode, in modern engines
|
||||||
|
// we can explicitly access globalThis. In older engines we can escape
|
||||||
// strict mode using a global Function call. This could conceivably fail
|
// strict mode using a global Function call. This could conceivably fail
|
||||||
// if a Content Security Policy forbids using Function, but in that case
|
// if a Content Security Policy forbids using Function, but in that case
|
||||||
// the proper solution is to fix the accidental strict mode problem. If
|
// the proper solution is to fix the accidental strict mode problem. If
|
||||||
// you've misconfigured your bundler to force strict mode and applied a
|
// you've misconfigured your bundler to force strict mode and applied a
|
||||||
// CSP to forbid Function, and you're not willing to fix either of those
|
// CSP to forbid Function, and you're not willing to fix either of those
|
||||||
// problems, please detail your unique predicament in a GitHub issue.
|
// problems, please detail your unique predicament in a GitHub issue.
|
||||||
Function("r", "regeneratorRuntime = r")(runtime);
|
if (typeof globalThis === "object") globalThis.regeneratorRuntime = runtime;
|
||||||
|
else Function("r", "regeneratorRuntime = r")(runtime);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var { default: regeneratorRuntime } = load();
|
var { default: regeneratorRuntime } = load();
|
||||||
|
Loading…
Reference in New Issue
Block a user