Skip to content

Commit

Permalink
fix(swc): Fix bugs (swc-project#1372)
Browse files Browse the repository at this point in the history
swc_ecma_ast:
 - Support import assertions for exports.

swc_ecma_parser:
 - Support import assertions for exports.

swc_ecma_transform_typescript:
 - Strip `declare globals` correctly. (swc-project#1383)

spack:
 - Re-enable multi-entry tests.
  • Loading branch information
kdy1 authored Feb 10, 2021
1 parent 79e991b commit bf445a7
Show file tree
Hide file tree
Showing 145 changed files with 806 additions and 317 deletions.
18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc"
repository = "https://github.com/swc-project/swc.git"
version = "0.2.7"
version = "0.3.0"

[lib]
name = "swc"
Expand All @@ -27,21 +27,21 @@ serde_json = "1"
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.3", path = "./ecmascript/ast"}
swc_ecma_codegen = {version = "0.43.7", path = "./ecmascript/codegen"}
swc_ecma_ext_transforms = {version = "0.2.5", path = "./ecmascript/ext-transforms"}
swc_ecma_parser = {version = "0.45.6", path = "./ecmascript/parser"}
swc_ecma_preset_env = {version = "0.3.7", path = "./ecmascript/preset_env"}
swc_ecma_transforms = {version = "0.33.8", path = "./ecmascript/transforms", features = [
swc_ecma_ast = {version = "0.38.0", path = "./ecmascript/ast"}
swc_ecma_codegen = {version = "0.44.0", path = "./ecmascript/codegen"}
swc_ecma_ext_transforms = {version = "0.3.0", path = "./ecmascript/ext-transforms"}
swc_ecma_parser = {version = "0.46.0", path = "./ecmascript/parser"}
swc_ecma_preset_env = {version = "0.4.0", path = "./ecmascript/preset_env"}
swc_ecma_transforms = {version = "0.34.0", path = "./ecmascript/transforms", features = [
"compat",
"module",
"optimization",
"proposal",
"react",
"typescript",
]}
swc_ecma_utils = {version = "0.27.3", path = "./ecmascript/utils"}
swc_ecma_visit = {version = "0.23.3", path = "./ecmascript/visit"}
swc_ecma_utils = {version = "0.28.0", path = "./ecmascript/utils"}
swc_ecma_visit = {version = "0.24.0", path = "./ecmascript/visit"}
swc_visit = {version = "0.2", path = "./visit"}

[dev-dependencies]
Expand Down
16 changes: 8 additions & 8 deletions bundler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.9"
version = "0.21.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
Expand All @@ -31,19 +31,19 @@ relative-path = "1.2"
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.3", path = "../ecmascript/ast"}
swc_ecma_codegen = {version = "0.43.7", path = "../ecmascript/codegen"}
swc_ecma_parser = {version = "0.45.6", path = "../ecmascript/parser"}
swc_ecma_transforms = {version = "0.33.8", path = "../ecmascript/transforms", features = ["optimization"]}
swc_ecma_utils = {version = "0.27.3", path = "../ecmascript/utils"}
swc_ecma_visit = {version = "0.23.3", path = "../ecmascript/visit"}
swc_ecma_ast = {version = "0.38.0", path = "../ecmascript/ast"}
swc_ecma_codegen = {version = "0.44.0", path = "../ecmascript/codegen"}
swc_ecma_parser = {version = "0.46.0", path = "../ecmascript/parser"}
swc_ecma_transforms = {version = "0.34.0", path = "../ecmascript/transforms", features = ["optimization"]}
swc_ecma_utils = {version = "0.28.0", path = "../ecmascript/utils"}
swc_ecma_visit = {version = "0.24.0", path = "../ecmascript/visit"}

[dev-dependencies]
hex = "0.4"
ntest = "0.7.2"
reqwest = {version = "0.10.8", features = ["blocking"]}
sha-1 = "0.9"
swc_ecma_transforms = {version = "0.33.8", path = "../ecmascript/transforms", features = ["react", "typescript"]}
swc_ecma_transforms = {version = "0.34.0", path = "../ecmascript/transforms", features = ["react", "typescript"]}
tempfile = "3.1.0"
testing = {version = "0.10.0", path = "../testing"}
url = "2.1.1"
Expand Down
1 change: 1 addition & 0 deletions bundler/src/bundler/chunk/circular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ where
specifiers: exports,
src: None,
type_only: false,
asserts: None,
},
)));
}
Expand Down
1 change: 1 addition & 0 deletions bundler/src/bundler/chunk/computed_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ where
specifiers: vec![specifier],
src: None,
type_only: false,
asserts: None,
}),
));
}
Expand Down
2 changes: 2 additions & 0 deletions bundler/src/bundler/chunk/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,15 @@ pub(super) fn inject_export(
exported: None,
})],
type_only: false,
asserts: None,
}));
} else {
*item = ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(NamedExport {
span: export.span,
specifiers: export.specifiers.take(),
src: None,
type_only: false,
asserts: None,
}))
}
}
Expand Down
4 changes: 4 additions & 0 deletions bundler/src/bundler/chunk/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,7 @@ where
specifiers: vec![specifier],
src: None,
type_only: false,
asserts: None,
},
)));
}
Expand Down Expand Up @@ -1004,6 +1005,7 @@ where
specifiers: vec![specifier],
src: None,
type_only: false,
asserts: None,
},
)));
}
Expand Down Expand Up @@ -1052,6 +1054,7 @@ where
.collect(),
src: None,
type_only: false,
asserts: None,
},
)));
continue;
Expand All @@ -1077,6 +1080,7 @@ where
specifiers: vec![specifier],
src: None,
type_only: false,
asserts: None,
},
)));
}
Expand Down
2 changes: 1 addition & 1 deletion bundler/tests/deno-exec/deno-8725/case1/entry.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from 'https://raw.githubusercontent.com/nats-io/nats.ws/deno-1.6.0/src/mod.ts'
export * from 'https://raw.githubusercontent.com/nats-io/nats.ws/master/src/mod.ts'
2 changes: 1 addition & 1 deletion bundler/tests/deno-exec/deno-8725/case2/entry.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://raw.githubusercontent.com/nats-io/nats.ws/deno-1.6.0/src/mod.ts";
export * from "https://raw.githubusercontent.com/nats-io/nats.ws/master/src/mod.ts";
2 changes: 1 addition & 1 deletion bundler/tests/deno-exec/deno-8725/case4/entry.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://raw.githubusercontent.com/nats-io/nats.ws/deno-1.6.0/src/nats-base-client.ts";
export * from "https://raw.githubusercontent.com/nats-io/nats.ws/master/src/nats-base-client.ts";
2 changes: 1 addition & 1 deletion bundler/tests/deno-exec/deno-8725/case5/deps.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from 'https://raw.githubusercontent.com/nats-io/nats.ws/deno-1.6.0/src/mod.ts'
export * from 'https://raw.githubusercontent.com/nats-io/nats.ws/master/src/mod.ts'
2 changes: 1 addition & 1 deletion bundler/tests/deno-exec/issue-8302/entry.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import axiod from 'https://deno.land/x/axiod/mod.ts';
import axiod from 'https://deno.land/x/axiod@0.20.0-0/mod.ts';
console.log(axiod)
16 changes: 8 additions & 8 deletions ecmascript/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.8"
version = "0.19.0"

[features]
codegen = ["swc_ecma_codegen"]
Expand All @@ -24,12 +24,12 @@ react = ["swc_ecma_transforms/react"]
typescript = ["swc_ecma_transforms/typescript"]

[dependencies]
swc_ecma_ast = {version = "0.37.3", path = "./ast"}
swc_ecma_codegen = {version = "0.43.7", path = "./codegen", optional = true}
swc_ecma_dep_graph = {version = "0.12.5", path = "./dep-graph", optional = true}
swc_ecma_parser = {version = "0.45.6", path = "./parser", optional = true}
swc_ecma_transforms = {version = "0.33.8", path = "./transforms", optional = true}
swc_ecma_utils = {version = "0.27.3", path = "./utils", optional = true}
swc_ecma_visit = {version = "0.23.3", path = "./visit", optional = true}
swc_ecma_ast = {version = "0.38.0", path = "./ast"}
swc_ecma_codegen = {version = "0.44.0", path = "./codegen", optional = true}
swc_ecma_dep_graph = {version = "0.13.0", path = "./dep-graph", optional = true}
swc_ecma_parser = {version = "0.46.0", path = "./parser", optional = true}
swc_ecma_transforms = {version = "0.34.0", path = "./transforms", optional = true}
swc_ecma_utils = {version = "0.28.0", path = "./utils", optional = true}
swc_ecma_visit = {version = "0.24.0", path = "./visit", optional = true}

[dev-dependencies]
2 changes: 1 addition & 1 deletion ecmascript/ast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_ast"
repository = "https://github.com/swc-project/swc.git"
version = "0.37.3"
version = "0.38.0"

[features]
default = []
Expand Down
6 changes: 6 additions & 0 deletions ecmascript/ast/src/module_decl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ pub struct ExportAll {

#[serde(rename = "source")]
pub src: Str,

#[serde(default)]
pub asserts: Option<ObjectLit>,
}

/// `export { foo } from 'mod'`
Expand All @@ -107,6 +110,9 @@ pub struct NamedExport {

#[serde(rename = "typeOnly")]
pub type_only: bool,

#[serde(default)]
pub asserts: Option<ObjectLit>,
}

#[ast_node("ExportDefaultDeclaration")]
Expand Down
6 changes: 3 additions & 3 deletions ecmascript/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ 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.8"
version = "0.44.0"

[dependencies]
bitflags = "1"
num-bigint = {version = "0.2", features = ["serde"]}
sourcemap = "6"
swc_atoms = {version = "0.2", path = "../../atoms"}
swc_common = {version = "0.10.0", path = "../../common"}
swc_ecma_ast = {version = "0.37.3", path = "../ast"}
swc_ecma_ast = {version = "0.38.0", path = "../ast"}
swc_ecma_codegen_macros = {version = "0.5", path = "./macros"}
swc_ecma_parser = {version = "0.45.6", path = "../parser"}
swc_ecma_parser = {version = "0.46.0", path = "../parser"}

[dev-dependencies]
swc_common = {version = "0.10.0", path = "../../common", features = ["sourcemap"]}
Expand Down
8 changes: 4 additions & 4 deletions ecmascript/dep-graph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_dep_graph"
repository = "https://github.com/swc-project/swc.git"
version = "0.12.5"
version = "0.13.0"

[dependencies]
swc_atoms = {version = "0.2", path = "../../atoms"}
swc_common = {version = "0.10.1", path = "../../common"}
swc_ecma_ast = {version = "0.37.3", path = "../ast"}
swc_ecma_visit = {version = "0.23.3", path = "../visit"}
swc_ecma_ast = {version = "0.38.0", path = "../ast"}
swc_ecma_visit = {version = "0.24.0", path = "../visit"}

[dev-dependencies]
swc_ecma_parser = {version = "0.45.6", path = "../parser"}
swc_ecma_parser = {version = "0.46.0", path = "../parser"}
testing = {version = "0.10.0", path = "../../testing"}
10 changes: 5 additions & 5 deletions ecmascript/ext-transforms/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ documentation = "https://swc.rs/rustdoc/swc_ecma_ext_transforms/"
edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_ext_transforms"
version = "0.2.5"
version = "0.3.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
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.3", path = "../ast"}
swc_ecma_parser = {version = "0.45.6", path = "../parser"}
swc_ecma_utils = {version = "0.27.3", path = "../utils"}
swc_ecma_visit = {version = "0.23.3", path = "../visit"}
swc_ecma_ast = {version = "0.38.0", path = "../ast"}
swc_ecma_parser = {version = "0.46.0", path = "../parser"}
swc_ecma_utils = {version = "0.28.0", path = "../utils"}
swc_ecma_visit = {version = "0.24.0", path = "../visit"}
6 changes: 3 additions & 3 deletions ecmascript/jsdoc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ documentation = "https://swc.rs/rustdoc/jsdoc/"
edition = "2018"
license = "Apache-2.0/MIT"
name = "jsdoc"
version = "0.13.5"
version = "0.14.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -18,7 +18,7 @@ swc_common = {version = "0.10.0", path = "../../common"}
[dev-dependencies]
anyhow = "1"
dashmap = "3"
swc_ecma_ast = {version = "0.37.3", path = "../ast"}
swc_ecma_parser = {version = "0.45.6", path = "../parser"}
swc_ecma_ast = {version = "0.38.0", path = "../ast"}
swc_ecma_parser = {version = "0.46.0", path = "../parser"}
testing = {version = "0.10.0", path = "../../testing"}
walkdir = "2"
6 changes: 3 additions & 3 deletions ecmascript/parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.6"
version = "0.46.0"

[features]
default = []
Expand All @@ -22,8 +22,8 @@ serde = {version = "1", features = ["derive"]}
smallvec = "1"
swc_atoms = {version = "0.2.3", path = "../../atoms"}
swc_common = {version = "0.10.0", path = "../../common"}
swc_ecma_ast = {version = "0.37.3", path = "../ast"}
swc_ecma_visit = {version = "0.23.3", path = "../visit"}
swc_ecma_ast = {version = "0.38.0", path = "../ast"}
swc_ecma_visit = {version = "0.24.0", path = "../visit"}
unicode-xid = "0.2"

[dev-dependencies]
Expand Down
Loading

0 comments on commit bf445a7

Please sign in to comment.