FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Expose wether a module has TLA or not as `.extra.async` by nicolo-ribaudo · Pull Request #16480 · babel/babel · GitHub

/ babel Public

Expose wether a module has TLA or not as .extra.async - #16480

Merged
nicolo-ribaudo merged 7 commits into
babel:mainfrom
nicolo-ribaudo:parser-module-async
Jul 26, 2024
Merged

nicolo-ribaudo merged 7 commits into
babel:mainfrom
nicolo-ribaudo:parser-module-async

Conversation

nicolo-ribaudo commented May 7, 2024
edited
Loading

Copy link
Copy Markdown
Member
Q                       A
Fixed Issues? Fixes #16471
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature? Yes
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

The parser already has this info, and having to detect it by yourself is error prone (due to computed keys and decorators).

We can also use this to warn in the CJS transform when there is top-level await (in a follow-up).

nicolo-ribaudo added PR: New Feature 🚀 A type of pull request used for our changelog categories pkg: parser labels May 7, 2024

babel-bot commented May 7, 2024
edited
Loading

Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
Member

Would it be better to just use topLevelAwait as the name?
Can we put hasTopLevelAwait in BaseParser together with sawUnambiguousESM, which would save a place, since 1 << 11 is already there :)

nicolo-ribaudo force-pushed the parser-module-async branch from 64070c7 to 0b4799c Compare May 7, 2024 07:57

Copy link
Copy Markdown
Member Author

Renamed to topLevelAwait. I prefer to keep this in .state.flags, because currently we have still 20 bits of space that are being "wasted" there :) If anything, I would move sawUnambiguousESM to there.

nicolo-ribaudo force-pushed the parser-module-async branch from 5e72f56 to d3dd293 Compare May 7, 2024 09:36

JLHwung left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can you add a test case for module expressions if there aren't such test? The current implementation should already work.

nicolo-ribaudo added this to the v7.25.0 milestone May 14, 2024
nicolo-ribaudo added the PR: Ready to be Merged A pull request with already two approvals, but waiting for the next minor release label May 16, 2024
github-actions Bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 26, 2024
github-actions Bot locked as resolved and limited conversation to collaborators Oct 26, 2024
This file contains hidden or 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
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: parser PR: New Feature 🚀 A type of pull request used for our changelog categories PR: Ready to be Merged A pull request with already two approvals, but waiting for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[parser] Expose somehing like program.extra.async to easily know if a module uses top-level await

4 participants


Back | FazBrowse Home | New Git URL