-
Notifications
You must be signed in to change notification settings - Fork 19
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
Support for Wasm builds #137
base: main
Are you sure you want to change the base?
Conversation
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.
I had to move this project to be a Cargo workspace so that it can host the Rust+WASM projects in the same repo
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.
It should work to have the rust code still in the root directory and that would be preferable. There's an example in https://github.com/denoland/deno_graph/blob/a63963643a56fb664c980149bc20d17484d9513c/Cargo.toml#L13
@@ -1,3 +1,3 @@ | |||
[toolchain] | |||
channel = "1.76.0" | |||
channel = "1.78.0" |
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.
cargo make
only supports >1.78.0
. Although there are more recent Rust versions, I wanted to make the minimum version bump required in this PR to play it safe
description = "Build WASM target for deno_task_shell" | ||
command = "wasm-pack" | ||
install_crate = { crate_name = "wasm-pack", binary = "wasm-pack", test_arg = "-V" } | ||
args = ["build", "--target", "deno", "--scope", "@deno/deno_task_shell"] |
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.
One open question is what the name of this WASM question should be. I think the name @deno/deno_task_shell
is okay, but in reality we're only exposing the task parsing API so maybe it should be something that better conveys the scope like @deno/shell-cmd-processing
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.
I took this file as-is from dax. I'm not sure if there is anything in this file that should be changed, so I left it as-is to start
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.
We should remove console_static_text and once_cell.
@@ -0,0 +1,5 @@ | |||
[tasks.wasm-build] | |||
description = "Build WASM target for deno_task_shell" | |||
command = "wasm-pack" |
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.
Although my PR properly generates a WASM file, it's not clear to me what the best way to publish it would be given the new WASM support in Deno 2.1
I created an issue on JSR & wasm-pack
to try and clarify this: rustwasm/wasm-pack#1454
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.
Probably we should pattern off https://github.com/denoland/deno_graph/tree/main for this. We use https://github.com/denoland/wasmbuild and not wasmpack.
Also, for the name, maybe @deno/task-shell-parser
or something like that?
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true | ||
|
||
[tasks.wasm-build] | ||
# see wasm/Makefile.toml for task definition |
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.
Can you remove this file and instead use a deno.json with tasks? We'd rather not have to add cargo install cargo-make
to the setup instructions.
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.
I tried wasmbuild
but it only generates a single JS file that gets instantiated which felt like the old way to generate things given rustwasm/wasm-bindgen#4287
I'm not sure if the plan is to update wasmbuild
in some way, but I believe this is the issue tracking this: denoland/wasmbuild#145
@@ -19,3 +19,7 @@ let exit_code = deno_task_shell::execute( | |||
Default::default(), // custom commands | |||
).await; | |||
``` | |||
|
|||
## WASM |
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.
## WASM | |
## Wasm |
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.
We should remove console_static_text and once_cell.
Closes #136