aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_utils/to_document.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-05 16:31:51 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-10-05 16:43:07 +0200
commite50fb638f73528e96ceb88f7c3feee613c397344 (patch)
treea1cdf61f37dbd64208d85b94164f0c5fbeef4169 /tests/test_utils/to_document.rs
parent9d90e35d51555d9f853f2eccfa771f47d71a6bc1 (diff)
downloadmarkdown-rs-e50fb638f73528e96ceb88f7c3feee613c397344.tar.gz
markdown-rs-e50fb638f73528e96ceb88f7c3feee613c397344.tar.bz2
markdown-rs-e50fb638f73528e96ceb88f7c3feee613c397344.zip
Add support for rewriting JSX
Diffstat (limited to 'tests/test_utils/to_document.rs')
-rw-r--r--tests/test_utils/to_document.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/test_utils/to_document.rs b/tests/test_utils/to_document.rs
index 96e9d7f..91fc134 100644
--- a/tests/test_utils/to_document.rs
+++ b/tests/test_utils/to_document.rs
@@ -300,8 +300,16 @@ pub fn to_document(mut program: Program, options: &Options) -> Result<Program, S
));
}
}
- swc_ecma_ast::ModuleItem::ModuleDecl(swc_ecma_ast::ModuleDecl::Import(_))
- | swc_ecma_ast::ModuleItem::ModuleDecl(swc_ecma_ast::ModuleDecl::ExportDecl(_))
+ swc_ecma_ast::ModuleItem::ModuleDecl(swc_ecma_ast::ModuleDecl::Import(mut x)) => {
+ // SWC is currently crashing when generating code, w/o source
+ // map, if an actual location is set on this node.
+ x.span = swc_common::DUMMY_SP;
+ // Pass through.
+ replacements.push(swc_ecma_ast::ModuleItem::ModuleDecl(
+ swc_ecma_ast::ModuleDecl::Import(x),
+ ));
+ }
+ swc_ecma_ast::ModuleItem::ModuleDecl(swc_ecma_ast::ModuleDecl::ExportDecl(_))
| swc_ecma_ast::ModuleItem::ModuleDecl(swc_ecma_ast::ModuleDecl::ExportAll(_))
| swc_ecma_ast::ModuleItem::ModuleDecl(swc_ecma_ast::ModuleDecl::TsImportEquals(_))
| swc_ecma_ast::ModuleItem::ModuleDecl(swc_ecma_ast::ModuleDecl::TsExportAssignment(