-
Notifications
You must be signed in to change notification settings - Fork 122
Add codegen option for including source #994
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
Conversation
crates/cli/src/commands.rs
Outdated
/// Enable source code compression, which generates smaller WebAssembly | ||
/// files at the cost of increased compile time. | ||
SourceCompression(bool), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update the documentation to reflect that this flag will be a no-op in case -source=n
?
crates/cli/src/commands.rs
Outdated
/// Embed the JavaScript source in the generated WebAssembly module. | ||
Source(bool), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Embed the JavaScript source in the generated WebAssembly module. | |
Source(bool), | |
/// Embed the JavaScript source in custom section the generated WebAssembly module. | |
Source(bool), |
crates/codegen/src/lib.rs
Outdated
@@ -159,7 +159,9 @@ pub struct Generator { | |||
pub(crate) plugin: Plugin, | |||
/// What kind of linking to use when generating a module. | |||
pub(crate) linking: LinkingKind, | |||
/// Whether to embed the compressed JS source in the generated module. | |||
/// Whether to embed the JS source in the generated module. | |||
pub(crate) source: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifically in the codegen crate, can we make source
an enum with three options: omitted
, compressed
, and uncompressed
and remove the source_compression
field?
I think that would make more sense that two booleans given there's only three states and we're going to be releasing a new major version for the crate soon anyway so a breaking change is fine.
You'll need to run |
Thank you for contributing! |
Description of the change
Adds a codegen option that allows for opting out of the
javy_source
custom section. If-C source=n
is specified to the CLI,source-compression
has no effect.Fixes #982
Why am I making this change?
Allows for smaller Wasm modules output by Javy in case the source code is not necesary. Through local testing I was able to shrink my Wasm modules by about one third.
Checklist
javy-cli
,javy-plugin
, andjavy-plugin-processing
do not require updating CHANGELOG files.