-
-
Notifications
You must be signed in to change notification settings - Fork 590
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(commonjs): convert module.exports with
__esModule
property(#939) (
#942) * fix(commonjs): convert module.exports with `__esModule` property(#939) * test(commonjs): add test sample for cjs with esm-property * feat(commonjs): defaultIsModuleExports support module.exports * fix(commonjs): do not check right node in module.exports reassgin when defaultIsModuleExports = false(#935)
- Loading branch information
Showing
23 changed files
with
139 additions
and
0 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
5 changes: 5 additions & 0 deletions
5
...njs/test/fixtures/form/defaultIsModuleExports-auto-reassign-exports-__esModule/_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 = { | ||
options: { | ||
defaultIsModuleExports: 'auto' | ||
} | ||
}; |
1 change: 1 addition & 0 deletions
1
...monjs/test/fixtures/form/defaultIsModuleExports-auto-reassign-exports-__esModule/input.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 @@ | ||
module.exports = { __esModule: true, default: { foo: 'bar' }} |
9 changes: 9 additions & 0 deletions
9
...onjs/test/fixtures/form/defaultIsModuleExports-auto-reassign-exports-__esModule/output.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,9 @@ | ||
import * as commonjsHelpers from "_commonjsHelpers.js"; | ||
import { __module as inputModule, exports as input } from "\u0000fixtures/form/defaultIsModuleExports-auto-reassign-exports-__esModule/input.js?commonjs-module" | ||
|
||
(function (module) { | ||
module.exports = { __esModule: true, default: { foo: 'bar' }} | ||
}(inputModule)); | ||
|
||
export default /*@__PURE__*/commonjsHelpers.getDefaultExportFromCjs(input); | ||
export { input as __moduleExports }; |
5 changes: 5 additions & 0 deletions
5
.../test/fixtures/form/defaultIsModuleExports-auto-reassign-exports-no-__esModule/_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 = { | ||
options: { | ||
defaultIsModuleExports: 'auto' | ||
} | ||
}; |
1 change: 1 addition & 0 deletions
1
...js/test/fixtures/form/defaultIsModuleExports-auto-reassign-exports-no-__esModule/input.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 @@ | ||
module.exports = { default: { foo: 'bar' }} |
6 changes: 6 additions & 0 deletions
6
...s/test/fixtures/form/defaultIsModuleExports-auto-reassign-exports-no-__esModule/output.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 @@ | ||
import * as commonjsHelpers from "_commonjsHelpers.js"; | ||
|
||
var input = { default: { foo: 'bar' }} | ||
|
||
export default input; | ||
export { input as __moduleExports }; |
5 changes: 5 additions & 0 deletions
5
...js/test/fixtures/form/defaultIsModuleExports-false-reassign-exports-__esModule/_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 = { | ||
options: { | ||
defaultIsModuleExports: false | ||
} | ||
}; |
1 change: 1 addition & 0 deletions
1
...onjs/test/fixtures/form/defaultIsModuleExports-false-reassign-exports-__esModule/input.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 @@ | ||
module.exports = { __esModule: true, default: { foo: 'bar' }}; |
9 changes: 9 additions & 0 deletions
9
...njs/test/fixtures/form/defaultIsModuleExports-false-reassign-exports-__esModule/output.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,9 @@ | ||
import * as commonjsHelpers from "_commonjsHelpers.js"; | ||
import { __module as inputModule, exports as input } from "\u0000fixtures/form/defaultIsModuleExports-false-reassign-exports-__esModule/input.js?commonjs-module" | ||
|
||
(function (module) { | ||
module.exports = { __esModule: true, default: { foo: 'bar' }}; | ||
}(inputModule)); | ||
|
||
export default input.default; | ||
export { input as __moduleExports }; |
5 changes: 5 additions & 0 deletions
5
...test/fixtures/form/defaultIsModuleExports-false-reassign-exports-no-__esModule/_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 = { | ||
options: { | ||
defaultIsModuleExports: false | ||
} | ||
}; |
1 change: 1 addition & 0 deletions
1
...s/test/fixtures/form/defaultIsModuleExports-false-reassign-exports-no-__esModule/input.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 @@ | ||
module.exports = { default: { foo: 'bar' }}; |
9 changes: 9 additions & 0 deletions
9
.../test/fixtures/form/defaultIsModuleExports-false-reassign-exports-no-__esModule/output.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,9 @@ | ||
import * as commonjsHelpers from "_commonjsHelpers.js"; | ||
import { __module as inputModule, exports as input } from "\u0000fixtures/form/defaultIsModuleExports-false-reassign-exports-no-__esModule/input.js?commonjs-module" | ||
|
||
(function (module) { | ||
module.exports = { default: { foo: 'bar' }}; | ||
}(inputModule)); | ||
|
||
export default input.default; | ||
export { input as __moduleExports }; |
5 changes: 5 additions & 0 deletions
5
...njs/test/fixtures/form/defaultIsModuleExports-true-reassign-exports-__esModule/_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 = { | ||
options: { | ||
defaultIsModuleExports: true | ||
} | ||
}; |
1 change: 1 addition & 0 deletions
1
...monjs/test/fixtures/form/defaultIsModuleExports-true-reassign-exports-__esModule/input.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 @@ | ||
module.exports = { __esModule: true, default: { foo: 'bar' }}; |
6 changes: 6 additions & 0 deletions
6
...onjs/test/fixtures/form/defaultIsModuleExports-true-reassign-exports-__esModule/output.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 @@ | ||
import * as commonjsHelpers from "_commonjsHelpers.js"; | ||
|
||
var input = { __esModule: true, default: { foo: 'bar' }}; | ||
|
||
export default input; | ||
export { input as __moduleExports }; |
5 changes: 5 additions & 0 deletions
5
.../test/fixtures/form/defaultIsModuleExports-true-reassign-exports-no-__esModule/_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 = { | ||
options: { | ||
defaultIsModuleExports: true | ||
} | ||
}; |
1 change: 1 addition & 0 deletions
1
...js/test/fixtures/form/defaultIsModuleExports-true-reassign-exports-no-__esModule/input.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 @@ | ||
module.exports = { default: { foo: 'bar' }}; |
6 changes: 6 additions & 0 deletions
6
...s/test/fixtures/form/defaultIsModuleExports-true-reassign-exports-no-__esModule/output.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 @@ | ||
import * as commonjsHelpers from "_commonjsHelpers.js"; | ||
|
||
var input = { default: { foo: 'bar' }}; | ||
|
||
export default input; | ||
export { input as __moduleExports }; |
4 changes: 4 additions & 0 deletions
4
packages/commonjs/test/fixtures/samples/cjs-with-esm-property/lib.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 @@ | ||
module.exports = { | ||
"default": () => { console.log('beep') }, | ||
__esModule: true | ||
}; |
3 changes: 3 additions & 0 deletions
3
packages/commonjs/test/fixtures/samples/cjs-with-esm-property/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 fn from './lib' | ||
|
||
fn() |
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