-
Notifications
You must be signed in to change notification settings - Fork 548
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: hoisted import declaration (#80)
- Loading branch information
Showing
15 changed files
with
90 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
crates/rolldown/tests/esbuild/default/es6_from_common_js/artifacts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
source: crates/rolldown/tests/common/case.rs | ||
expression: content | ||
input_file: crates/rolldown/tests/esbuild/default/es6_from_common_js | ||
--- | ||
# main.js | ||
|
||
```js | ||
// bar.js | ||
var require_bar = __commonJS({ | ||
'bar.js'(exports, module) { | ||
exports.bar = function() { | ||
return 'bar' | ||
} | ||
} | ||
}); | ||
// foo.js | ||
var require_foo = __commonJS({ | ||
'foo.js'(exports, module) { | ||
exports.foo = function() { | ||
return 'foo' | ||
} | ||
} | ||
}); | ||
// main.js | ||
var foo_ns = __toESM(require_foo()); | ||
var foo = foo_ns.foo; | ||
var bar_ns = __toESM(require_bar()); | ||
var bar = bar_ns.bar; | ||
|
||
console.log(foo(), bar()) | ||
// This should be hoisted | ||
``` |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions
24
crates/rolldown/tests/esbuild/default/nested_es6_from_common_js/artifacts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/esbuild/default/nested_es6_from_common_js | ||
--- | ||
# main.js | ||
|
||
```js | ||
// foo.js | ||
var require_foo = __commonJS({ | ||
'foo.js'(exports, module) { | ||
exports.fn = function() { | ||
return 123 | ||
} | ||
} | ||
}); | ||
// main.js | ||
var foo_ns = __toESM(require_foo()); | ||
var fn = foo_ns.fn; | ||
|
||
(() => { | ||
console.log(fn()) | ||
})() | ||
``` |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters