Skip to content
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

Merged
merged 4 commits into from Jul 21, 2020

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Jul 17, 2020

Q                       A
Fixed Issues? Closes #11363
Minor: New Feature? Yes
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes? preset-env has two new deps
License MIT

This PR includes commits from #11838, I will rebase once it gets merged.

@JLHwung JLHwung added PR: New Feature 🚀 A type of pull request used for our changelog categories pkg: preset-env pkg: compat-data labels Jul 17, 2020
@JLHwung JLHwung added this to the 7.11.0 milestone Jul 17, 2020
@babel-bot
Copy link
Collaborator

babel-bot commented Jul 17, 2020

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/26144/

@billyjanitsch
Copy link

Thanks @JLHwung! Sorry I didn't get around to working on this.

Comment on lines 289 to 297
shouldTransformExportNamespaceFrom: !(
(modules === "auto" && api.caller?.(supportsExportNamespaceFrom)) ||
(modules === false &&
!isRequired("proposal-export-namespace-from", transformTargets, {
compatData,
includes: include.plugins,
excludes: exclude.plugins,
}))
),
Copy link
Member

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?

Suggested change
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 🤔😅

Copy link
Contributor Author

@JLHwung JLHwung Jul 20, 2020

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.

@codesandbox-ci
Copy link

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:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@JLHwung JLHwung changed the base branch from main to feat-7.11.0/stage-4 July 21, 2020 20:48
@JLHwung
Copy link
Contributor Author

JLHwung commented Jul 21, 2020

I am merging this PR to feat-7.11.0/stage-4 feature branch.

@JLHwung JLHwung merged commit 3784216 into babel:feat-7.11.0/stage-4 Jul 21, 2020
@JLHwung JLHwung deleted the add-export-ns-from branch July 21, 2020 20:56
JLHwung added a commit that referenced this pull request Jul 29, 2020
* feat: add compat-data of proposal-export-namespace-from

* feat: add export-namespace-from to preset-env

* chore: update test fixtures

* address review comments
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 21, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: compat-data pkg: preset-env PR: New Feature 🚀 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add proposal-export-namespace-from to preset-env
5 participants