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

feat: Allow async initialization logic #2918

Merged
merged 5 commits into from
Dec 9, 2024

Conversation

FrederikBolding
Copy link
Member

@FrederikBolding FrederikBolding commented Dec 2, 2024

Allow async initialization logic for Snaps by altering the CLI config to do direct assignment of the exports to module.exports. This lets Snap developers use async initialization logic such as top-level await (which has been re-enabled) and asynchronous instantiation of WASM modules (which has been introduced in favor of sync). A minor change was also made to the execution environment to await the exposed module after evaluating it.

Snaps are still subject to a 60 second initialization timeout, so the asynchronous logic must finish before that timer runs out.

Closes #2919
Closes #2359

@FrederikBolding FrederikBolding force-pushed the fb/async-modules-experiment branch from 8e0f188 to f216494 Compare December 9, 2024 09:51
Copy link

codecov bot commented Dec 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.49%. Comparing base (f1d3cd6) to head (bd2e1dd).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2918   +/-   ##
=======================================
  Coverage   94.49%   94.49%           
=======================================
  Files         487      487           
  Lines       10441    10442    +1     
  Branches     1600     1600           
=======================================
+ Hits         9866     9867    +1     
  Misses        575      575           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@FrederikBolding FrederikBolding changed the title Experiment with async modules feat: Allow async initialization logic Dec 9, 2024
@FrederikBolding FrederikBolding marked this pull request as ready for review December 9, 2024 11:04
@FrederikBolding FrederikBolding requested a review from a team as a code owner December 9, 2024 11:04
@FrederikBolding FrederikBolding merged commit d07227b into main Dec 9, 2024
166 checks passed
@FrederikBolding FrederikBolding deleted the fb/async-modules-experiment branch December 9, 2024 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider supporting more module types Improve error message when trying to use top-level await
2 participants