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

Add support for --target web #567

Merged
merged 1 commit into from
Mar 8, 2019

Conversation

alexcrichton
Copy link
Contributor

This commit adds support for the new --web flag in wasm-bindgen
under the flag name --target web. To ensure that it was plubmed around
the stringly-typed target type was switched to an enum Target to
ensure that all cases it's looked at are handled appropriately for the
new web target.

Copy link
Member

@ashleygwilliams ashleygwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this all looks great to me, we just need to make sure to update the docs! the comments in the code would be great to simply copy over into the docs in my opinion. let me know if you want to do that or i can take it on for you.

@@ -203,9 +203,10 @@ pub fn wasm_bindgen_build(
"--typescript"
};
let target_arg = match target {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for making this an enum it's a clear improvement!

Target::Nodejs => "--nodejs",
Target::NoModules => "--no-modules",
Target::Web => "--web",
Target::Bundler => "--browser",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we perhaps deprecate --browser and add a --bundler alias in wasm-bindgen? (you might already be on this, in which case linking to a PR/issue would be great)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that long term we may want to but for now it serves a purpose we haven't displaced, so it can't be removed just yet

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to open a tracking issue? let me know what you think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've opened up rustwasm/wasm-bindgen#1332 for this

@ashleygwilliams ashleygwilliams added needs docs please add docs to this PR changelog - feature labels Mar 7, 2019
@ashleygwilliams ashleygwilliams added this to the 0.7.0 milestone Mar 7, 2019
@ashleygwilliams
Copy link
Member

rebase to include the panic fix for the tests should make this green!

@alexcrichton
Copy link
Contributor Author

Sure, I've updated the documentation

Copy link
Member

@ashleygwilliams ashleygwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one small nit - otherwise i think this is great! thank you! excited to have this ship, i think it's gonna help a bunch of folks!

docs/src/commands/build.md Outdated Show resolved Hide resolved
@ashleygwilliams ashleygwilliams added waiting on response and removed needs docs please add docs to this PR labels Mar 7, 2019
| `nodejs` | Outputs JS that uses CommonJS modules, for use with a `require` statement. `main` key in `package.json`. |
| `no-modules` | Outputs JS that use no modules. `browser` key in `package.json`. |
| `browser` | Outputs JS that uses ES6 modules, primarily for use with `import` statements and/or bundlers such as `webpack`. `module` key in `package.json`. `sideEffects: false` by default. |
| Option | Deployment | Description |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @alexcrichton sorry for the nit but the word "Deployment" is still used in this chart- could we change it to Usage? thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, updated

This commit adds support for the new `--web` flag in `wasm-bindgen`
under the flag name `--target web`. To ensure that it was plubmed around
the stringly-typed `target` type was switched to an `enum Target` to
ensure that all cases it's looked at are handled appropriately for the
new `web` target.
Copy link
Member

@ashleygwilliams ashleygwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much @alexcrichton - this looks great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants