fix(es): Fix bugs (#1347)

swc_ecma_parser:
 - Do not emit strict mode error while backtracking. (#1252)

swc_ecma_transforms_proposal:
 - Handle decorator on methods with computed key.
This commit is contained in:
강동윤 2021-01-23 15:46:42 +09:00 committed by GitHub
parent 6a1c3da326
commit d4df2cece8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 504 additions and 88 deletions

View File

@ -9,7 +9,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc"
repository = "https://github.com/swc-project/swc.git"
version = "0.2.2"
version = "0.2.3"
[lib]
name = "swc"
@ -28,11 +28,11 @@ sourcemap = "6"
swc_atoms = {version = "0.2", path = "./atoms"}
swc_common = {version = "0.10", path = "./common", features = ["sourcemap", "concurrent"]}
swc_ecma_ast = {version = "0.37.1", path = "./ecmascript/ast"}
swc_ecma_codegen = {version = "0.43.2", path = "./ecmascript/codegen"}
swc_ecma_ext_transforms = {version = "0.2.1", path = "./ecmascript/ext-transforms"}
swc_ecma_parser = {version = "0.45.1", path = "./ecmascript/parser"}
swc_ecma_preset_env = {version = "0.3.2", path = "./ecmascript/preset_env"}
swc_ecma_transforms = {version = "0.33.2", path = "./ecmascript/transforms", features = [
swc_ecma_codegen = {version = "0.43.3", path = "./ecmascript/codegen"}
swc_ecma_ext_transforms = {version = "0.2.2", path = "./ecmascript/ext-transforms"}
swc_ecma_parser = {version = "0.45.2", path = "./ecmascript/parser"}
swc_ecma_preset_env = {version = "0.3.3", path = "./ecmascript/preset_env"}
swc_ecma_transforms = {version = "0.33.3", path = "./ecmascript/transforms", features = [
"compat",
"module",
"optimization",

View File

@ -9,7 +9,7 @@ include = ["Cargo.toml", "build.rs", "src/**/*.rs", "src/**/*.js"]
license = "Apache-2.0/MIT"
name = "swc_bundler"
repository = "https://github.com/swc-project/swc.git"
version = "0.20.2"
version = "0.20.3"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
@ -32,9 +32,9 @@ retain_mut = "0.1.2"
swc_atoms = {version = "0.2.4", path = "../atoms"}
swc_common = {version = "0.10.0", path = "../common"}
swc_ecma_ast = {version = "0.37.1", path = "../ecmascript/ast"}
swc_ecma_codegen = {version = "0.43.2", path = "../ecmascript/codegen"}
swc_ecma_parser = {version = "0.45.1", path = "../ecmascript/parser"}
swc_ecma_transforms = {version = "0.33.2", path = "../ecmascript/transforms", features = ["optimization"]}
swc_ecma_codegen = {version = "0.43.3", path = "../ecmascript/codegen"}
swc_ecma_parser = {version = "0.45.2", path = "../ecmascript/parser"}
swc_ecma_transforms = {version = "0.33.3", path = "../ecmascript/transforms", features = ["optimization"]}
swc_ecma_utils = {version = "0.27.1", path = "../ecmascript/utils"}
swc_ecma_visit = {version = "0.23.1", path = "../ecmascript/visit"}
@ -43,7 +43,7 @@ hex = "0.4"
ntest = "0.7.2"
reqwest = {version = "0.10.8", features = ["blocking"]}
sha-1 = "0.9"
swc_ecma_transforms = {version = "0.33.2", path = "../ecmascript/transforms", features = ["react", "typescript"]}
swc_ecma_transforms = {version = "0.33.3", path = "../ecmascript/transforms", features = ["react", "typescript"]}
tempfile = "3.1.0"
testing = {version = "0.10.0", path = "../testing"}
url = "2.1.1"

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecmascript"
repository = "https://github.com/swc-project/swc.git"
version = "0.18.2"
version = "0.18.3"
[features]
codegen = ["swc_ecma_codegen"]
@ -25,10 +25,10 @@ typescript = ["swc_ecma_transforms/typescript"]
[dependencies]
swc_ecma_ast = {version = "0.37.1", path = "./ast"}
swc_ecma_codegen = {version = "0.43.2", path = "./codegen", optional = true}
swc_ecma_dep_graph = {version = "0.12.1", path = "./dep-graph", optional = true}
swc_ecma_parser = {version = "0.45.1", path = "./parser", optional = true}
swc_ecma_transforms = {version = "0.33.2", path = "./transforms", optional = true}
swc_ecma_codegen = {version = "0.43.3", path = "./codegen", optional = true}
swc_ecma_dep_graph = {version = "0.12.2", path = "./dep-graph", optional = true}
swc_ecma_parser = {version = "0.45.2", path = "./parser", optional = true}
swc_ecma_transforms = {version = "0.33.3", path = "./transforms", optional = true}
swc_ecma_utils = {version = "0.27.1", path = "./utils", optional = true}
swc_ecma_visit = {version = "0.23.1", path = "./visit", optional = true}

View File

@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"]
license = "Apache-2.0/MIT"
name = "swc_ecma_codegen"
repository = "https://github.com/swc-project/swc.git"
version = "0.43.2"
version = "0.43.3"
[dependencies]
bitflags = "1"
@ -17,7 +17,7 @@ swc_atoms = {version = "0.2", path = "../../atoms"}
swc_common = {version = "0.10.0", path = "../../common"}
swc_ecma_ast = {version = "0.37.1", path = "../ast"}
swc_ecma_codegen_macros = {version = "0.5", path = "./macros"}
swc_ecma_parser = {version = "0.45.1", path = "../parser"}
swc_ecma_parser = {version = "0.45.2", path = "../parser"}
[dev-dependencies]
swc_common = {version = "0.10.0", path = "../../common", features = ["sourcemap"]}

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_dep_graph"
repository = "https://github.com/swc-project/swc.git"
version = "0.12.1"
version = "0.12.2"
[dependencies]
swc_atoms = {version = "0.2", path = "../../atoms"}
@ -15,5 +15,5 @@ swc_ecma_ast = {version = "0.37.1", path = "../ast"}
swc_ecma_visit = {version = "0.23.1", path = "../visit"}
[dev-dependencies]
swc_ecma_parser = {version = "0.45.1", path = "../parser"}
swc_ecma_parser = {version = "0.45.2", path = "../parser"}
testing = {version = "0.10.0", path = "../../testing"}

View File

@ -5,7 +5,7 @@ documentation = "https://swc.rs/rustdoc/swc_ecma_ext_transforms/"
edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_ext_transforms"
version = "0.2.1"
version = "0.2.2"
# 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_common = {version = "0.10", path = "../../common"}
swc_ecma_ast = {version = "0.37.1", path = "../ast"}
swc_ecma_parser = {version = "0.45.1", path = "../parser"}
swc_ecma_parser = {version = "0.45.2", path = "../parser"}
swc_ecma_utils = {version = "0.27.1", path = "../utils"}
swc_ecma_visit = {version = "0.23.1", path = "../visit"}

View File

@ -5,7 +5,7 @@ documentation = "https://swc.rs/rustdoc/jsdoc/"
edition = "2018"
license = "Apache-2.0/MIT"
name = "jsdoc"
version = "0.13.1"
version = "0.13.2"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -19,6 +19,6 @@ swc_common = {version = "0.10.0", path = "../../common"}
anyhow = "1"
dashmap = "3"
swc_ecma_ast = {version = "0.37.1", path = "../ast"}
swc_ecma_parser = {version = "0.45.1", path = "../parser"}
swc_ecma_parser = {version = "0.45.2", path = "../parser"}
testing = {version = "0.10.0", path = "../../testing"}
walkdir = "2"

View File

@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "examples/**/*.rs"]
license = "Apache-2.0/MIT"
name = "swc_ecma_parser"
repository = "https://github.com/swc-project/swc.git"
version = "0.45.1"
version = "0.45.2"
[features]
default = []

View File

@ -220,6 +220,9 @@ impl<I: Tokens> Parser<I> {
#[cold]
fn emit_strict_mode_err(&self, span: Span, error: SyntaxError) {
if !self.emit_err {
return;
}
let error = Error {
error: Box::new((span, error)),
};

View File

@ -0,0 +1,4 @@
export const then = <R>(callback: (...args: TupleReturns<Ws>) => R) => {
let returns: R
let called: boolean
}

View File

@ -0,0 +1,352 @@
{
"type": "Module",
"span": {
"start": 0,
"end": 117,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 0,
"end": 117,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 7,
"end": 117,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 13,
"end": 117,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 13,
"end": 17,
"ctxt": 0
},
"value": "then",
"typeAnnotation": null,
"optional": false
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 23,
"end": 117,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 24,
"end": 66,
"ctxt": 0
},
"value": "callback",
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 32,
"end": 66,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 34,
"end": 66,
"ctxt": 0
},
"params": [
{
"type": "RestElement",
"span": {
"start": 35,
"end": 60,
"ctxt": 0
},
"rest": {
"start": 35,
"end": 38,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 38,
"end": 42,
"ctxt": 0
},
"value": "args",
"typeAnnotation": null,
"optional": false
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 42,
"end": 60,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 44,
"end": 60,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 44,
"end": 56,
"ctxt": 0
},
"value": "TupleReturns",
"typeAnnotation": null,
"optional": false
},
"typeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 56,
"end": 60,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 57,
"end": 59,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 57,
"end": 59,
"ctxt": 0
},
"value": "Ws",
"typeAnnotation": null,
"optional": false
},
"typeParams": null
}
]
}
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 62,
"end": 66,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 65,
"end": 66,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 65,
"end": 66,
"ctxt": 0
},
"value": "R",
"typeAnnotation": null,
"optional": false
},
"typeParams": null
}
}
}
},
"optional": false
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 71,
"end": 117,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 77,
"end": 91,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 81,
"end": 91,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 81,
"end": 88,
"ctxt": 0
},
"value": "returns",
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 88,
"end": 91,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 90,
"end": 91,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 90,
"end": 91,
"ctxt": 0
},
"value": "R",
"typeAnnotation": null,
"optional": false
},
"typeParams": null
}
},
"optional": false
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 96,
"end": 115,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 100,
"end": 115,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 100,
"end": 106,
"ctxt": 0
},
"value": "called",
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 106,
"end": 115,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 108,
"end": 115,
"ctxt": 0
},
"kind": "boolean"
}
},
"optional": false
},
"init": null,
"definite": false
}
]
}
]
},
"async": false,
"generator": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 20,
"end": 23,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"value": "R",
"typeAnnotation": null,
"optional": false
},
"constraint": null,
"default": null
}
]
},
"returnType": null
},
"definite": false
}
]
}
}
],
"interpreter": null
}

View File

@ -5,7 +5,7 @@ documentation = "https://swc.rs/rustdoc/swc_ecma_preset_env/"
edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_preset_env"
version = "0.3.2"
version = "0.3.3"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -21,13 +21,13 @@ string_enum = {version = "0.3", path = "../../macros/string_enum"}
swc_atoms = {version = "0.2", path = "../../atoms"}
swc_common = {version = "0.10", path = "../../common"}
swc_ecma_ast = {version = "0.37.1", path = "../ast"}
swc_ecma_transforms = {version = "0.33.2", path = "../transforms", features = ["compat", "proposal"]}
swc_ecma_transforms = {version = "0.33.3", path = "../transforms", features = ["compat", "proposal"]}
swc_ecma_utils = {version = "0.27.1", path = "../utils"}
swc_ecma_visit = {version = "0.23.1", path = "../visit"}
walkdir = "2"
[dev-dependencies]
pretty_assertions = "0.6"
swc_ecma_codegen = {version = "0.43.2", path = "../codegen"}
swc_ecma_parser = {version = "0.45.1", path = "../parser"}
swc_ecma_codegen = {version = "0.43.3", path = "../codegen"}
swc_ecma_parser = {version = "0.45.2", path = "../parser"}
testing = {version = "0.10", path = "../../testing"}

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms"
repository = "https://github.com/swc-project/swc.git"
version = "0.33.2"
version = "0.33.3"
[features]
compat = ["swc_ecma_transforms_compat"]
@ -20,14 +20,14 @@ typescript = ["swc_ecma_transforms_typescript"]
swc_atoms = {version = "0.2.0", path = "../../atoms"}
swc_common = {version = "0.10.0", path = "../../common"}
swc_ecma_ast = {version = "0.37.1", path = "../ast"}
swc_ecma_parser = {version = "0.45.1", path = "../parser"}
swc_ecma_transforms_base = {version = "0.2.2", path = "./base"}
swc_ecma_transforms_compat = {version = "0.3.1", path = "./compat", optional = true}
swc_ecma_transforms_module = {version = "0.3.1", path = "./module", optional = true}
swc_ecma_transforms_optimization = {version = "0.3.2", path = "./optimization", optional = true}
swc_ecma_transforms_proposal = {version = "0.3.1", path = "./proposal", optional = true}
swc_ecma_transforms_react = {version = "0.3.1", path = "./react", optional = true}
swc_ecma_transforms_typescript = {version = "0.3.2", path = "./typescript", optional = true}
swc_ecma_parser = {version = "0.45.2", path = "../parser"}
swc_ecma_transforms_base = {version = "0.2.3", path = "./base"}
swc_ecma_transforms_compat = {version = "0.3.2", path = "./compat", optional = true}
swc_ecma_transforms_module = {version = "0.3.2", path = "./module", optional = true}
swc_ecma_transforms_optimization = {version = "0.3.3", path = "./optimization", optional = true}
swc_ecma_transforms_proposal = {version = "0.3.2", path = "./proposal", optional = true}
swc_ecma_transforms_react = {version = "0.3.2", path = "./react", optional = true}
swc_ecma_transforms_typescript = {version = "0.3.3", path = "./typescript", optional = true}
swc_ecma_utils = {version = "0.27.1", path = "../utils"}
swc_ecma_visit = {version = "0.23.1", path = "../visit"}
unicode-xid = "0.2"
@ -35,8 +35,8 @@ unicode-xid = "0.2"
[dev-dependencies]
pretty_assertions = "0.6"
sourcemap = "6"
swc_ecma_codegen = {version = "0.43.2", path = "../codegen"}
swc_ecma_transforms_testing = {version = "0.2.1", path = "./testing"}
swc_ecma_codegen = {version = "0.43.3", path = "../codegen"}
swc_ecma_transforms_testing = {version = "0.2.2", path = "./testing"}
tempfile = "3"
testing = {version = "0.10.0", path = "../../testing"}
walkdir = "2"

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_base"
repository = "https://github.com/swc-project/swc.git"
version = "0.2.2"
version = "0.2.3"
[dependencies]
fxhash = "0.2.1"
@ -17,10 +17,10 @@ smallvec = "1.6.0"
swc_atoms = {version = "0.2", path = "../../../atoms"}
swc_common = {version = "0.10", path = "../../../common"}
swc_ecma_ast = {version = "0.37.1", path = "../../ast"}
swc_ecma_parser = {version = "0.45.1", path = "../../parser"}
swc_ecma_parser = {version = "0.45.2", path = "../../parser"}
swc_ecma_utils = {version = "0.27.1", path = "../../utils"}
swc_ecma_visit = {version = "0.23.1", path = "../../visit"}
[dev-dependencies]
swc_ecma_codegen = {version = "0.43.2", path = "../../codegen"}
swc_ecma_codegen = {version = "0.43.3", path = "../../codegen"}
testing = {version = "0.10", path = "../../../testing"}

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_compat"
repository = "https://github.com/swc-project/swc.git"
version = "0.3.1"
version = "0.3.2"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
@ -21,12 +21,12 @@ smallvec = "1.6.0"
swc_atoms = {version = "0.2.5", path = "../../../atoms"}
swc_common = {version = "0.10.8", path = "../../../common"}
swc_ecma_ast = {version = "0.37.1", path = "../../ast"}
swc_ecma_transforms_base = {version = "0.2.2", path = "../base"}
swc_ecma_transforms_base = {version = "0.2.3", path = "../base"}
swc_ecma_transforms_macros = {version = "0.2.0", path = "../macros"}
swc_ecma_utils = {version = "0.27.1", path = "../../utils"}
swc_ecma_visit = {version = "0.23.1", path = "../../visit"}
[dev-dependencies]
swc_ecma_parser = {version = "0.45.1", path = "../../parser"}
swc_ecma_transforms_testing = {version = "0.2.1", path = "../testing"}
swc_ecma_parser = {version = "0.45.2", path = "../../parser"}
swc_ecma_transforms_testing = {version = "0.2.2", path = "../testing"}
testing = {version = "0.10.2", path = "../../../testing"}

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_module"
repository = "https://github.com/swc-project/swc.git"
version = "0.3.1"
version = "0.3.2"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
@ -17,12 +17,12 @@ serde = {version = "1.0.118", features = ["derive"]}
swc_atoms = {version = "0.2", path = "../../../atoms"}
swc_common = {version = "0.10", path = "../../../common"}
swc_ecma_ast = {version = "0.37.1", path = "../../ast"}
swc_ecma_parser = {version = "0.45.1", path = "../../parser"}
swc_ecma_transforms_base = {version = "0.2.2", path = "../base"}
swc_ecma_parser = {version = "0.45.2", path = "../../parser"}
swc_ecma_transforms_base = {version = "0.2.3", path = "../base"}
swc_ecma_utils = {version = "0.27.1", path = "../../utils"}
swc_ecma_visit = {version = "0.23.1", path = "../../visit"}
[dev-dependencies]
swc_ecma_transforms_compat = {version = "0.3.1", path = "../compat"}
swc_ecma_transforms_testing = {version = "0.2.1", path = "../testing/"}
swc_ecma_transforms_compat = {version = "0.3.2", path = "../compat"}
swc_ecma_transforms_testing = {version = "0.2.2", path = "../testing/"}
testing = {version = "0.10", path = "../../../testing/"}

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_optimization"
repository = "https://github.com/swc-project/swc.git"
version = "0.3.2"
version = "0.3.3"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
@ -20,15 +20,15 @@ serde_json = "1.0.61"
swc_atoms = {version = "0.2", path = "../../../atoms"}
swc_common = {version = "0.10", path = "../../../common"}
swc_ecma_ast = {version = "0.37.1", path = "../../ast"}
swc_ecma_parser = {version = "0.45.1", path = "../../parser"}
swc_ecma_transforms_base = {version = "0.2.2", path = "../base"}
swc_ecma_parser = {version = "0.45.2", path = "../../parser"}
swc_ecma_transforms_base = {version = "0.2.3", path = "../base"}
swc_ecma_utils = {version = "0.27.1", path = "../../utils"}
swc_ecma_visit = {version = "0.23.1", path = "../../visit"}
[dev-dependencies]
swc_ecma_transforms_compat = {version = "0.3.1", path = "../compat"}
swc_ecma_transforms_module = {version = "0.3.1", path = "../module"}
swc_ecma_transforms_proposal = {version = "0.3.1", path = "../proposal"}
swc_ecma_transforms_react = {version = "0.3.1", path = "../react"}
swc_ecma_transforms_testing = {version = "0.2.1", path = "../testing"}
swc_ecma_transforms_typescript = {version = "0.3.2", path = "../typescript"}
swc_ecma_transforms_compat = {version = "0.3.2", path = "../compat"}
swc_ecma_transforms_module = {version = "0.3.2", path = "../module"}
swc_ecma_transforms_proposal = {version = "0.3.2", path = "../proposal"}
swc_ecma_transforms_react = {version = "0.3.2", path = "../react"}
swc_ecma_transforms_testing = {version = "0.2.2", path = "../testing"}
swc_ecma_transforms_typescript = {version = "0.3.3", path = "../typescript"}

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_proposal"
repository = "https://github.com/swc-project/swc.git"
version = "0.3.1"
version = "0.3.2"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -18,12 +18,12 @@ smallvec = "1.6.0"
swc_atoms = {version = "0.2", path = "../../../atoms"}
swc_common = {version = "0.10", path = "../../../common"}
swc_ecma_ast = {version = "0.37.1", path = "../../ast"}
swc_ecma_parser = {version = "0.45.1", path = "../../parser"}
swc_ecma_transforms_base = {version = "0.2.2", path = "../base"}
swc_ecma_parser = {version = "0.45.2", path = "../../parser"}
swc_ecma_transforms_base = {version = "0.2.3", path = "../base"}
swc_ecma_utils = {version = "0.27.1", path = "../../utils"}
swc_ecma_visit = {version = "0.23.1", path = "../../visit"}
[dev-dependencies]
swc_ecma_transforms_compat = {version = "0.3.1", path = "../compat"}
swc_ecma_transforms_module = {version = "0.3.1", path = "../module"}
swc_ecma_transforms_testing = {version = "0.2.1", path = "../testing"}
swc_ecma_transforms_compat = {version = "0.3.2", path = "../compat"}
swc_ecma_transforms_module = {version = "0.3.2", path = "../module"}
swc_ecma_transforms_testing = {version = "0.2.2", path = "../testing"}

View File

@ -361,9 +361,19 @@ impl Legacy {
dec_exprs.push(Some(i.as_arg()))
}
let name = match m.key {
PropName::Computed(..) => {
unimplemented!("decorators on methods with computed key")
let name = match &m.key {
PropName::Computed(e) => {
let (name, aliased) = alias_if_required(&e.expr, "key");
if aliased {
self.initialized_vars.push(VarDeclarator {
span: DUMMY_SP,
name: Pat::Ident(name.clone()),
init: Some(e.expr.clone()),
definite: Default::default(),
})
}
Expr::Ident(name)
}
_ => prop_name_to_expr_value(m.key.clone()),
};

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_react"
repository = "https://github.com/swc-project/swc.git"
version = "0.3.1"
version = "0.3.2"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
@ -17,12 +17,12 @@ serde = {version = "1.0.118", features = ["derive"]}
swc_atoms = {version = "0.2", path = "../../../atoms"}
swc_common = {version = "0.10", path = "../../../common"}
swc_ecma_ast = {version = "0.37.1", path = "../../ast"}
swc_ecma_parser = {version = "0.45.1", path = "../../parser"}
swc_ecma_transforms_base = {version = "0.2.2", path = "../base"}
swc_ecma_parser = {version = "0.45.2", path = "../../parser"}
swc_ecma_transforms_base = {version = "0.2.3", path = "../base"}
swc_ecma_utils = {version = "0.27.1", path = "../../utils"}
swc_ecma_visit = {version = "0.23.1", path = "../../visit"}
[dev-dependencies]
swc_ecma_transforms_compat = {version = "0.3.1", path = "../compat/"}
swc_ecma_transforms_module = {version = "0.3.1", path = "../module"}
swc_ecma_transforms_testing = {version = "0.2.1", path = "../testing/"}
swc_ecma_transforms_compat = {version = "0.3.2", path = "../compat/"}
swc_ecma_transforms_module = {version = "0.3.2", path = "../module"}
swc_ecma_transforms_testing = {version = "0.2.2", path = "../testing/"}

View File

@ -6,16 +6,16 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_testing"
repository = "https://github.com/swc-project/swc.git"
version = "0.2.1"
version = "0.2.2"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
swc_common = {version = "0.10", path = "../../../common"}
swc_ecma_ast = {version = "0.37.1", path = "../../ast"}
swc_ecma_codegen = {version = "0.43.2", path = "../../codegen"}
swc_ecma_parser = {version = "0.45.1", path = "../../parser"}
swc_ecma_transforms_base = {version = "0.2.2", path = "../base"}
swc_ecma_codegen = {version = "0.43.3", path = "../../codegen"}
swc_ecma_parser = {version = "0.45.2", path = "../../parser"}
swc_ecma_transforms_base = {version = "0.2.3", path = "../base"}
swc_ecma_utils = {version = "0.27.1", path = "../../utils"}
swc_ecma_visit = {version = "0.23.1", path = "../../visit"}
tempfile = "3.1.0"

View File

@ -5667,3 +5667,28 @@ eval: function _eval() {
"#
);
test!(
ts(),
|_| decorators(decorators::Config {
legacy: true,
..Default::default()
}),
swc_node_210,
"
class Foo{
@dec
[foo]() {
}
}
",
"
var _class;
let Foo = ((_class = class Foo {
[foo]() {
}
}) || _class, _applyDecoratedDescriptor(_class.prototype, foo, [
dec
], Object.getOwnPropertyDescriptor(_class.prototype, foo), _class.prototype), _class);
"
);

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_typescript"
repository = "https://github.com/swc-project/swc.git"
version = "0.3.2"
version = "0.3.3"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
@ -15,16 +15,16 @@ serde = {version = "1.0.118", features = ["derive"]}
swc_atoms = {version = "0.2", path = "../../../atoms"}
swc_common = {version = "0.10.9", path = "../../../common"}
swc_ecma_ast = {version = "0.37.1", path = "../../ast"}
swc_ecma_parser = {version = "0.45.1", path = "../../parser"}
swc_ecma_transforms_base = {version = "0.2.2", path = "../base"}
swc_ecma_parser = {version = "0.45.2", path = "../../parser"}
swc_ecma_transforms_base = {version = "0.2.3", path = "../base"}
swc_ecma_utils = {version = "0.27.1", path = "../../utils"}
swc_ecma_visit = {version = "0.23.1", path = "../../visit"}
[dev-dependencies]
swc_ecma_codegen = {version = "0.43.2", path = "../../codegen"}
swc_ecma_transforms_compat = {version = "0.3.1", path = "../compat"}
swc_ecma_transforms_module = {version = "0.3.1", path = "../module"}
swc_ecma_transforms_proposal = {version = "0.3.1", path = "../proposal/"}
swc_ecma_transforms_testing = {version = "0.2.1", path = "../testing"}
swc_ecma_codegen = {version = "0.43.3", path = "../../codegen"}
swc_ecma_transforms_compat = {version = "0.3.2", path = "../compat"}
swc_ecma_transforms_module = {version = "0.3.2", path = "../module"}
swc_ecma_transforms_proposal = {version = "0.3.2", path = "../proposal/"}
swc_ecma_transforms_testing = {version = "0.2.2", path = "../testing"}
testing = {version = "0.10.2", path = "../../../testing"}
walkdir = "2.3.1"

View File

@ -0,0 +1,8 @@
{
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true
}
}
}

View File

@ -0,0 +1,4 @@
export const then = <R>(callback: (...args: TupleReturns<Ws>) => R) => {
let returns: R
let called: boolean
}

View File

@ -0,0 +1,4 @@
export var then = function(callback) {
var returns;
var called;
};

View File

@ -0,0 +1,5 @@
const text = `
hello world
`;

View File

@ -0,0 +1 @@
var text = "\n\nhello world\n\n";