Skip to content

Make more use of async/await for file packging#27034

Merged
sbc100 merged 1 commit into
emscripten-core:mainfrom
sbc100:loadPackage
Jun 5, 2026
Merged

Make more use of async/await for file packging#27034
sbc100 merged 1 commit into
emscripten-core:mainfrom
sbc100:loadPackage

Conversation

@sbc100

@sbc100 sbc100 commented May 29, 2026

Copy link
Copy Markdown
Collaborator

Simplify the file packager and LZ4 loading code by leveraging modern
async/await features.

Previously, we tracked the loading of each individual preloaded file by
adding and removing separate run dependencies (fp ${name}). This
introduced complexity and extra boilerplate.

Now, we make loadPackage and processPackageData async functions and
directly await the preloading of each file (including running any
preload plugins). The main package-level run dependency
(datafile_${name}) is held until all files are fully processed and
then removed.

This reduces code complexity, eliminates the need for granular run
dependencies, and reduces the generated JS code size by ~100 bytes.

Split out from #27028

@sbc100 sbc100 requested a review from kripken May 29, 2026 22:46
@sbc100 sbc100 requested a review from dschuff May 29, 2026 22:54
@sbc100 sbc100 force-pushed the loadPackage branch 3 times, most recently from d95ebd3 to 354a06d Compare May 29, 2026 23:07
Comment thread tools/file_packager.py
@sbc100 sbc100 changed the title Use async/await for LZ4.loadPackage Make more use of async/await for file packaging Jun 1, 2026
@sbc100 sbc100 changed the title Make more use of async/await for file packaging Make more use of async/await for file packging Jun 1, 2026
…ependencies

Simplify the file packager and LZ4 loading code by leveraging modern
async/await features.

Previously, we tracked the loading of each individual preloaded file by
adding and removing separate run dependencies (`fp ${name}`). This
introduced complexity and extra boilerplate.

Now, we make `loadPackage` and `processPackageData` async functions and
directly `await` the preloading of each file (including running any
preload plugins). The main package-level run dependency
(`datafile_${name}`) is held until all files are fully processed and
then removed.

This reduces code complexity, eliminates the need for granular run
dependencies, and reduces the generated JS code size by ~100 bytes.

Split out from emscripten-core#27028
@sbc100 sbc100 requested a review from kripken June 1, 2026 22:14
@sbc100 sbc100 merged commit 8e9e425 into emscripten-core:main Jun 5, 2026
37 of 39 checks passed
@sbc100 sbc100 deleted the loadPackage branch June 5, 2026 01:02
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.

2 participants