-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: support export default null #22
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe updates primarily involve refining the Changes
Sequence Diagram(s)sequenceDiagram
participant Tester
participant ImportModule
participant CJSModule
participant ESMModule
Tester->>ImportModule: importModule('module-exports-null.js')
ImportModule->>CJSModule: require('module-exports-null.js')
CJSModule-->>ImportModule: returns null
ImportModule-->>Tester: returns null
Tester->>ImportModule: importModule('export-default-null.js')
ImportModule->>ESMModule: import('export-default-null.js')
ESMModule-->>ImportModule: returns { default: null }
ImportModule-->>Tester: returns null
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- src/import.ts (2 hunks)
- test/fixtures/cjs/module-exports-null.js (1 hunks)
- test/fixtures/esm/export-default-null.js (1 hunks)
- test/import.test.ts (1 hunks)
Files skipped from review due to trivial changes (2)
- test/fixtures/cjs/module-exports-null.js
- test/fixtures/esm/export-default-null.js
Additional comments not posted (4)
src/import.ts (2)
38-38
: Ensure compatibility with CommonJS modules simulating ES modules by checking for the existence of the 'default' key.
75-75
: Ensure that theimportDefaultOnly
option correctly handles scenarios where only the default export should be imported.test/import.test.ts (2)
87-97
: The new test cases effectively verify the functionality of handlingmodule.exports = null
with bothimportDefaultOnly
true and false.
99-109
: The new test cases effectively verify the functionality of handlingexport default null
with bothimportDefaultOnly
true and false.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #22 +/- ##
=======================================
Coverage 87.65% 87.65%
=======================================
Files 6 6
Lines 413 413
Branches 53 53
=======================================
Hits 362 362
Misses 51 51 ☔ View full report in Codecov by Sentry. |
[skip ci] ## [4.0.1](v4.0.0...v4.0.1) (2024-06-17) ### Bug Fixes * support export default null ([#22](#22)) ([61a8a98](61a8a98))
Summary by CodeRabbit
Bug Fixes
Tests
null
as the default export.