-
-
Notifications
You must be signed in to change notification settings - Fork 591
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(commonjs): set syntheticNamedExports for commonjs modules (#149)
BREAKING CHANGE: The namedExports option has been removed, now requires rollup >= 2.3.4. Instead of manually defining named exports, rollup now handles this automatically for you. * feat(commonjs): set syntheticNamedExports for commonjs modules * feat(commonjs): remove namedExports option * chore: merge with upstream * chore(commonjs): restrict rollup version * chore(commonjs): remove unused fixtures
- Loading branch information
1 parent
c09509f
commit 5d2dcf4
Showing
38 changed files
with
265 additions
and
292 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
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 |
---|---|---|
|
@@ -2,4 +2,3 @@ import * as x from './answer'; | |
|
||
t.truthy('answer' in x); | ||
t.truthy('default' in x); | ||
t.truthy(!('__esModule' in x)); |
3 changes: 3 additions & 0 deletions
3
packages/commonjs/test/fixtures/function/named-exports-conditional/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 { named } from './x.js'; | ||
|
||
t.is(named, 'foo'); |
5 changes: 5 additions & 0 deletions
5
packages/commonjs/test/fixtures/function/named-exports-conditional/x.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 @@ | ||
if (typeof someUnknownGlobal !== 'undefined') { | ||
module.exports = { named: 'bar' }; | ||
} else { | ||
module.exports = { named: 'foo' }; | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/commonjs/test/fixtures/function/named-exports-dynamic/_config.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 @@ | ||
module.exports = { | ||
context: { | ||
window: {} | ||
} | ||
}; |
7 changes: 7 additions & 0 deletions
7
packages/commonjs/test/fixtures/function/named-exports-dynamic/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,7 @@ | ||
import { named } from './x.js'; | ||
|
||
t.is(named, undefined); | ||
|
||
window.addExport('named', 'foo'); | ||
|
||
t.is(named, 'foo'); |
3 changes: 3 additions & 0 deletions
3
packages/commonjs/test/fixtures/function/named-exports-dynamic/x.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 @@ | ||
window.addExport = (key, value) => { | ||
module.exports[key] = value; | ||
}; |
3 changes: 3 additions & 0 deletions
3
packages/commonjs/test/fixtures/function/named-exports-object-define/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 { named } from './x.js'; | ||
|
||
t.is(named, 'foo'); |
6 changes: 6 additions & 0 deletions
6
packages/commonjs/test/fixtures/function/named-exports-object-define/x.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,6 @@ | ||
Object.defineProperty(module.exports, 'named', { | ||
enumerable: true, | ||
get: function get() { | ||
return 'foo'; | ||
} | ||
}); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
packages/commonjs/test/fixtures/function/named-exports-reexport-named/export.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 @@ | ||
exports.named = 2; |
3 changes: 3 additions & 0 deletions
3
packages/commonjs/test/fixtures/function/named-exports-reexport-named/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 { named } from './reexport.js'; | ||
|
||
t.is(named, 2); |
3 changes: 3 additions & 0 deletions
3
packages/commonjs/test/fixtures/function/named-exports-reexport-named/reexport.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 @@ | ||
const myModule = require('./export.js'); | ||
|
||
module.exports.named = myModule.named; |
3 changes: 3 additions & 0 deletions
3
packages/commonjs/test/fixtures/function/named-exports-unexported/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 { nonExisting } from './x.js'; | ||
|
||
t.is(nonExisting, undefined); |
1 change: 1 addition & 0 deletions
1
packages/commonjs/test/fixtures/function/named-exports-unexported/x.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 @@ | ||
exports.named = 2; |
9 changes: 0 additions & 9 deletions
9
packages/commonjs/test/fixtures/function/reexports/_config.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
packages/commonjs/test/fixtures/samples/custom-named-exports-browser-shims/main.js
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
packages/commonjs/test/fixtures/samples/custom-named-exports-false-positive/main.js
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
packages/commonjs/test/fixtures/samples/custom-named-exports-false-positive/other.js
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
packages/commonjs/test/fixtures/samples/custom-named-exports-warn-builtins/main.js
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
packages/commonjs/test/fixtures/samples/custom-named-exports/main.js
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
packages/commonjs/test/fixtures/samples/custom-named-exports/secret-named-exporter.js
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
packages/commonjs/test/fixtures/samples/define-property/foo.js
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
packages/commonjs/test/fixtures/samples/define-property/main.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.