Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bundler): Fix inlining pass #1495

Merged
merged 5 commits into from Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundler/Cargo.toml
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.29.1"
version = "0.29.2"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
Expand Down
2 changes: 1 addition & 1 deletion bundler/src/inline.rs
Expand Up @@ -126,7 +126,7 @@ impl VisitMut for Inliner {
Prop::Shorthand(i) => {
let orig = i.clone();
i.visit_mut_with(self);
if i.span.ctxt != orig.span.ctxt {
if i.span.ctxt == orig.span.ctxt {
return;
}
if i.sym != orig.sym {
Expand Down
5 changes: 5 additions & 0 deletions bundler/tests/fixture/deno-9868/case1/input/entry.ts
@@ -0,0 +1,5 @@
import { foo } from './temp2.ts';

console.log({
foo
});
2 changes: 2 additions & 0 deletions bundler/tests/fixture/deno-9868/case1/input/temp2.ts
@@ -0,0 +1,2 @@
const bar = 1;
export { bar as foo };
3 changes: 3 additions & 0 deletions bundler/tests/fixture/deno-9868/case1/output/entry.inlined.ts
@@ -0,0 +1,3 @@
console.log({
foo: 1
});
4 changes: 4 additions & 0 deletions bundler/tests/fixture/deno-9868/case1/output/entry.ts
@@ -0,0 +1,4 @@
const bar = 1;
console.log({
foo: bar
});