Skip to content

Commit

Permalink
fix: clean up render exports from external module (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
underfin committed Dec 11, 2023
1 parent ec20c03 commit e51a69a
Show file tree
Hide file tree
Showing 15 changed files with 78 additions and 46 deletions.
2 changes: 1 addition & 1 deletion crates/rolldown/src/bundler/renderer/render_esm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl<'r> AstRenderer<'r> {
);
}
}
Module::External(_) => unreachable!(), // TODO
Module::External(_) => {}
}
self.ctx.remove_node(named_decl.span);
RenderControl::Skip
Expand Down
2 changes: 1 addition & 1 deletion crates/rolldown/src/bundler/renderer/render_wrapped_esm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl<'r> AstRenderer<'r> {
);
}
}
Module::External(_) => {} // TODO
Module::External(_) => {}
}
self.ctx.remove_node(named_decl.span);
} else {
Expand Down
4 changes: 1 addition & 3 deletions crates/rolldown/src/bundler/stages/bundle_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,7 @@ impl<'a> BundleStage<'a> {
}
}
}
Module::External(_) => {
// TODO: process external module
}
Module::External(_) => {}
}
}

Expand Down
20 changes: 0 additions & 20 deletions crates/rolldown/tests/fixtures/.export_external/artifacts.snap

This file was deleted.

This file was deleted.

18 changes: 0 additions & 18 deletions crates/rolldown/tests/fixtures/.import_external/artifacts.snap

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
source: crates/rolldown/tests/common/case.rs
expression: content
input_file: crates/rolldown/tests/fixtures/export_external
---
# Assets

## main.mjs

```js
import * as ext1 from "external";
import * as ext from "external";
import { a, a as a$1, a as a1, b, b as b$1, b as b1 } from "external";
// foo.js
const a1$1 = 1;
console.log(a1$1);
// main.js
console.log(ext, a1, b1, ext1, a, b)
export { a$1 as a, b$1 as b };
```
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import * as ext from 'external'
import { a, b } from 'external'
import { a1, b1, ext1 } from './foo'
console.log(ext, a1, b1, ext1, a, b)
console.log(ext, a1, b1, ext1, a, b)

export { a, b } from 'external'
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"input": {
"external": [
"external"
],
"treeshake": false
},
"expectExecuted": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
source: crates/rolldown/tests/common/case.rs
expression: content
input_file: crates/rolldown/tests/fixtures/external/import_external
---
# Assets

## main.mjs

```js
import * as ext$1 from "external";
import * as ext from "external";
import { a, a as a$1, b, b as b$1 } from "external";
// foo.js
console.log(ext$1, a$1, b$1)
// main.js
console.log(ext, a, b)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"input": {
"external": [
"external"
],
"treeshake": false
},
"expectExecuted": false
}

0 comments on commit e51a69a

Please sign in to comment.