Skip to content

Commit

Permalink
use export ns pass in bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsonk committed Oct 5, 2020
1 parent e062714 commit 25cf91e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ rustyline-derive = "0.3.1"
serde = { version = "1.0.116", features = ["derive"] }
sys-info = "0.7.0"
sourcemap = "6.0.1"
swc_bundler = "0.9.0"
swc_bundler = "0.9.1"
swc_common = { version = "=0.10.3", features = ["sourcemap"] }
swc_ecmascript = { version = "=0.8.3", features = ["codegen", "dep_graph", "parser", "react", "transforms", "visit"] }
tempfile = "3.1.0"
Expand Down
9 changes: 6 additions & 3 deletions cli/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use swc_ecmascript::parser::TsConfig;
use swc_ecmascript::transforms::fixer;
use swc_ecmascript::transforms::helpers;
use swc_ecmascript::transforms::pass::Optional;
use swc_ecmascript::transforms::proposals::decorators;
use swc_ecmascript::transforms::proposals;
use swc_ecmascript::transforms::react;
use swc_ecmascript::transforms::typescript;
use swc_ecmascript::visit::FoldWith;
Expand Down Expand Up @@ -293,7 +293,7 @@ impl ParsedModule {
);
let mut passes = chain!(
Optional::new(jsx_pass, options.transform_jsx),
decorators::decorators(decorators::Config {
proposals::decorators::decorators(proposals::decorators::Config {
legacy: true,
emit_metadata: options.emit_metadata
}),
Expand Down Expand Up @@ -471,6 +471,7 @@ impl swc_bundler::Load for BundleLoader<'_> {
Err(err) => bail!("Parsing failed: {:?}", err),
};

// TODO(@kitsonk) DRY-up with ::transpile()
let jsx_pass = react::react(
self.cm.clone(),
Some(&comments),
Expand All @@ -485,10 +486,12 @@ impl swc_bundler::Load for BundleLoader<'_> {
);
let mut passes = chain!(
Optional::new(jsx_pass, self.emit_options.transform_jsx),
decorators::decorators(decorators::Config {
proposals::decorators::decorators(proposals::decorators::Config {
legacy: true,
emit_metadata: self.emit_options.emit_metadata
}),
// TODO(@kitsonk) remove when swc-project/swc#1137 is resolved
proposals::export(),
typescript::strip(),
fixer(Some(&comments)),
);
Expand Down

0 comments on commit 25cf91e

Please sign in to comment.