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
Add export-namespace-from
to preset-env
#11849
Add export-namespace-from
to preset-env
#11849
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/26144/ |
Thanks @JLHwung! Sorry I didn't get around to working on this. |
shouldTransformExportNamespaceFrom: !( | ||
(modules === "auto" && api.caller?.(supportsExportNamespaceFrom)) || | ||
(modules === false && | ||
!isRequired("proposal-export-namespace-from", transformTargets, { | ||
compatData, | ||
includes: include.plugins, | ||
excludes: exclude.plugins, | ||
})) | ||
), |
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.
Nit: This is a bit hard to follow. Could we move the !
inside to match the same !
/||
pattern used in the lines above?
shouldTransformExportNamespaceFrom: !( | |
(modules === "auto" && api.caller?.(supportsExportNamespaceFrom)) || | |
(modules === false && | |
!isRequired("proposal-export-namespace-from", transformTargets, { | |
compatData, | |
includes: include.plugins, | |
excludes: exclude.plugins, | |
})) | |
), | |
shouldTransformExportNamespaceFrom: | |
(modules !== "auto" || !api.caller?.(supportsExportNamespaceFrom)) && | |
(modules !== false || isRequired("proposal-export-namespace-from", transformTargets, { | |
compatData, | |
includes: include.plugins, | |
excludes: exclude.plugins, | |
})) | |
), |
Or maybe even this doesn't change the readability 🤔😅
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.
Well I initially unwrap !
but I realized that these two modules !== false || something
seems pretty mind-jiggling to me. I end up with current patterns. I can wrap these conditions into a new shouldSkipExportNamespaceFrom
and it should be more straightforward.
3ffcda3
to
cfe0b43
Compare
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit cfe0b43:
|
I am merging this PR to |
* feat: add compat-data of proposal-export-namespace-from * feat: add export-namespace-from to preset-env * chore: update test fixtures * address review comments
preset-env
has two new depsmdn-browser-compat-data
supportsExportNamespaceFrom
, we should also updatebabel-loader
and@rollup/plugin-babel
since both two have supportedexport * as ns
.modules: false
(preserve ES modules) is specified, compat-data is used to determine whetherexport * as ns
should be transpiledThis PR includes commits from #11838, I will rebase once it gets merged.