Skip to content

Add support for running initialization scripts before content#222

Merged
tschneidereit merged 2 commits intobytecodealliance:mainfrom
tschneidereit:initializer-script
Mar 5, 2025
Merged

Add support for running initialization scripts before content#222
tschneidereit merged 2 commits intobytecodealliance:mainfrom
tschneidereit:initializer-script

Conversation

@tschneidereit
Copy link
Member

This adds the ability to run a script in a separate global before content gets run. This code has access to additional abilities, notably including the defineBuiltinModule function.

Building on this will allow us to change ComponentizeJS to support content using imports from wasi:package-name module names without rewriting the code first. That in turn will enable support for non-bundled content code.

@tschneidereit
Copy link
Member Author

@guybedford looking for your feedback here, because my hope is to build on this in ComponentizeJS to get rid of the content preprocessing, and be able to directly use wasi: imports.

@tschneidereit
Copy link
Member Author

I'm very unsure what's going on with the failing tests: whether that's an infra-issue or something else. It's certainly not related to the code changes in this PR. Will investigate

@andreiltd
Copy link
Member

I'm very unsure what's going on with the failing tests: whether that's an infra-issue or something else. It's certainly not related to the code changes in this PR. Will investigate

This perhaps: rust-lang/rustup#4211 ?

@tschneidereit
Copy link
Member Author

This perhaps: rust-lang/rustup#4211 ?

It was that indeed, yes—fixed over in #212.

This adds the ability to run  a script in a separate global before content gets run. This code has access to additional abilities, notably including the `defineBuiltinModule` function.

Building on this will allow us to change ComponentizeJS to support content using imports from `wasi:package-name` module names without rewriting the code first. That in turn will enable support for non-bundled content code.
@tschneidereit
Copy link
Member Author

@guybedford gave a verbal r+ to this in the BA JS SIG call earlier today.

@tschneidereit tschneidereit merged commit 315c240 into bytecodealliance:main Mar 5, 2025
5 checks passed
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