Modernize dependency system with Promise-based run blockers#27028
Open
sbc100 wants to merge 1 commit into
Open
Modernize dependency system with Promise-based run blockers#27028sbc100 wants to merge 1 commit into
sbc100 wants to merge 1 commit into
Conversation
Collaborator
Author
|
I'm petty happy about this change. Its something I've tried to do over the years several times and always given up in the end. This time with gemini's help I was able to get to the end of it. The legacy versions of this API are also still supported which is nice. The |
b0f8006 to
b66f862
Compare
kripken
reviewed
May 29, 2026
kripken
reviewed
May 29, 2026
kripken
reviewed
May 29, 2026
Replace the callback-based dependenciesFulfilled/runDependencies system with a modern async/await approach using "run blockers" (Promises). This modernizes the startup sequence, ensuring preRun and other startup hooks are executed exactly once by pausing and resuming execution flow instead of re-running the entry point. To maintain backward compatibility, a bridge is implemented for the existing addRunDependency and removeRunDependency APIs, routing them through the new Promise-based blocking mechanism. - Make run() in postamble.js async to support await. - Implement $addRunBlocker and $resolveRunBlockers in libcore.js. - Bridge $addRunDependency and $removeRunDependency to use $addRunBlocker. - Wrap runDependencies == 0 check in ASSERTIONS guard to avoid empty block in optimized builds (fixes Closure Compiler warnings).
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace the callback-based dependenciesFulfilled/runDependencies system with a modern async/await approach using "run blockers" (Promises).
This modernizes the startup sequence, ensuring preRun and other startup hooks are executed exactly once by pausing and resuming execution flow instead of re-running the entry point.
To maintain backward compatibility, a bridge is implemented for the existing addRunDependency and removeRunDependency APIs, routing them through the new Promise-based blocking mechanism.