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

optimize: Simplify the export-default-from transform #14768

Merged
merged 2 commits into from Jul 19, 2022
Merged

optimize: Simplify the export-default-from transform #14768

merged 2 commits into from Jul 19, 2022

Conversation

magic-akari
Copy link
Contributor

@magic-akari magic-akari commented Jul 19, 2022

Q                       A
Fixed Issues? No
Patch: Bug Fix? No
Major: Breaking Change? No
Minor: New Feature? No
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

See the test cases

@@ -1,3 +1,2 @@
import _v from "mod";
export { _v as v };
export { default as v } from "mod";
export { x, y as w } from "mod";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Further optimization idea: we can merge { default as v } with the next specifier if exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. And here come a case

export v, * as ns, { x, y as w } from "mod"; 

if there is a namespace compound, should we merge it?

// a.js
export { default as v,  x, y as w} from "mod";
export * as ns from "mod";

The export order will change.

import * as ns from "a.js";
Object.keys(ns) // order changed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, it will be merged if there is no namespace export.

@JLHwung JLHwung added Spec: export-default-from PR: Output optimization 🔬 A type of pull request used for our changelog categories labels Jul 19, 2022
Copy link
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@JLHwung JLHwung merged commit f2ba41b into babel:main Jul 19, 2022
@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 19, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 19, 2022
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 PR: Output optimization 🔬 A type of pull request used for our changelog categories Spec: export-default-from
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants