-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support
InputOptions#shimMissingExports
(#772)
<!-- Thank you for contributing! --> ### Description <!-- Please insert your description here and provide especially info about the "what" this PR is solving -->
- Loading branch information
Showing
30 changed files
with
226 additions
and
15 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
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
5 changes: 5 additions & 0 deletions
5
crates/rolldown/tests/fixtures/function/shim_missing_exports/basic/_config.json
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,5 @@ | ||
{ | ||
"config": { | ||
"shimMissingExports": true | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
crates/rolldown/tests/fixtures/function/shim_missing_exports/basic/_test.js
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,4 @@ | ||
import nodeAssert from 'assert' | ||
import { missing } from './dist/main.mjs' | ||
|
||
nodeAssert.strictEqual(missing, undefined) |
15 changes: 15 additions & 0 deletions
15
crates/rolldown/tests/fixtures/function/shim_missing_exports/basic/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,15 @@ | ||
--- | ||
source: crates/rolldown/tests/common/case.rs | ||
expression: content | ||
input_file: crates/rolldown/tests/fixtures/function/shim_missing_exports/basic | ||
--- | ||
# Assets | ||
|
||
## main.mjs | ||
|
||
```js | ||
// foo.js | ||
var missing = void 0; | ||
|
||
export { missing }; | ||
``` |
1 change: 1 addition & 0 deletions
1
crates/rolldown/tests/fixtures/function/shim_missing_exports/basic/foo.js
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 @@ | ||
export {} |
3 changes: 3 additions & 0 deletions
3
crates/rolldown/tests/fixtures/function/shim_missing_exports/basic/main.js
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,3 @@ | ||
import { missing } from './foo' | ||
|
||
export { missing } |
5 changes: 5 additions & 0 deletions
5
crates/rolldown/tests/fixtures/function/shim_missing_exports/basic_wrapped_esm/_config.json
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,5 @@ | ||
{ | ||
"config": { | ||
"shimMissingExports": true | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
crates/rolldown/tests/fixtures/function/shim_missing_exports/basic_wrapped_esm/_test.js
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,4 @@ | ||
import nodeAssert from 'assert' | ||
import { missing } from './dist/main.mjs' | ||
|
||
nodeAssert.strictEqual(missing, undefined) |
25 changes: 25 additions & 0 deletions
25
...es/rolldown/tests/fixtures/function/shim_missing_exports/basic_wrapped_esm/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,25 @@ | ||
--- | ||
source: crates/rolldown/tests/common/case.rs | ||
expression: content | ||
input_file: crates/rolldown/tests/fixtures/function/shim_missing_exports/basic_wrapped_esm | ||
--- | ||
# Assets | ||
|
||
## main.mjs | ||
|
||
```js | ||
import { __esmMin, __toCommonJS } from "./$runtime$.mjs"; | ||
|
||
// foo.js | ||
var foo_ns, missing; | ||
var init_foo = __esmMin(() => { | ||
foo_ns = {}; | ||
missing = void 0; | ||
}); | ||
|
||
// main.js | ||
init_foo(); | ||
init_foo(),__toCommonJS(foo_ns); | ||
|
||
export { missing }; | ||
``` |
1 change: 1 addition & 0 deletions
1
crates/rolldown/tests/fixtures/function/shim_missing_exports/basic_wrapped_esm/foo.js
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 @@ | ||
export {} |
5 changes: 5 additions & 0 deletions
5
crates/rolldown/tests/fixtures/function/shim_missing_exports/basic_wrapped_esm/main.js
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,5 @@ | ||
import { missing } from './foo' | ||
|
||
require('./foo') | ||
|
||
export { missing } |
5 changes: 5 additions & 0 deletions
5
...wn/tests/fixtures/function/shim_missing_exports/shake_unused_shimmed_exports/_config.json
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,5 @@ | ||
{ | ||
"config": { | ||
"shimMissingExports": true | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...lldown/tests/fixtures/function/shim_missing_exports/shake_unused_shimmed_exports/_test.js
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,4 @@ | ||
import nodeAssert from 'assert' | ||
import { missing } from './dist/main.mjs' | ||
|
||
nodeAssert.strictEqual(missing, undefined) |
15 changes: 15 additions & 0 deletions
15
.../tests/fixtures/function/shim_missing_exports/shake_unused_shimmed_exports/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,15 @@ | ||
--- | ||
source: crates/rolldown/tests/common/case.rs | ||
expression: content | ||
input_file: crates/rolldown/tests/fixtures/function/shim_missing_exports/shake_unused_shimmed_exports | ||
--- | ||
# Assets | ||
|
||
## main.mjs | ||
|
||
```js | ||
// foo.js | ||
var missing = void 0; | ||
|
||
export { missing }; | ||
``` |
1 change: 1 addition & 0 deletions
1
...rolldown/tests/fixtures/function/shim_missing_exports/shake_unused_shimmed_exports/foo.js
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 @@ | ||
export {} |
3 changes: 3 additions & 0 deletions
3
...olldown/tests/fixtures/function/shim_missing_exports/shake_unused_shimmed_exports/main.js
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,3 @@ | ||
import { missing, unusedMissing } from './foo' | ||
|
||
export { missing } |
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
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
Oops, something went wrong.