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

refactor(compile): use async fns (#143) #145

Merged
merged 3 commits into from
Jun 29, 2023
Merged

refactor(compile): use async fns (#143) #145

merged 3 commits into from
Jun 29, 2023

Conversation

STRML
Copy link
Collaborator

@STRML STRML commented Jun 29, 2023

Ping @IMalyugin

Fixes Zalgo (function calling back with errors and/or synchronously throwing) issue as noted in #143 (comment)

@STRML STRML added the bug label Jun 29, 2023
@@ -222,43 +222,42 @@ function generateTempFilename() {
].join(''));
}

function handleFileLoad(filename, callback) {
async function handleFileLoad(filename) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure we can turn the entire system synchronous?
I'm concerned about this comment inside runner.js:
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The loader itself is still synchronous, which is why it makes the pipes synchronously. The function handling the load itself was always async, it just was async with callbacks. Now it's async with promises.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, I see, it was hybrid sync & async, since babel.transformFile is async.
And it doesn't really matter if we make parent process even more async, since runner is kept synchronous and is forced to wait for the synchronous pipe.

babel-watch.js Outdated Show resolved Hide resolved
babel-watch.js Show resolved Hide resolved
@IMalyugin
Copy link
Contributor

LGTM

@STRML STRML merged commit e8e60af into master Jun 29, 2023
@STRML STRML deleted the refactor/async-fns branch June 29, 2023 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants