Skip to content

Commit

Permalink
Merge branch 'main' into improved-bindings-for-string-enums
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Oct 8, 2024
2 parents f8b7e9a + 2a0022a commit a4fba63
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
* Fixed error when importing very large JS files.
[#4146](https://github.com/rustwasm/wasm-bindgen/pull/4146)

* Specify `"type": "module"` when deploying to nodejs-module
[#4092](https://github.com/rustwasm/wasm-bindgen/pull/4092)

* Fixed string enums not generating TypeScript types.
[#4147](https://github.com/rustwasm/wasm-bindgen/pull/4147)

Expand Down
6 changes: 5 additions & 1 deletion crates/cli-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -661,12 +661,16 @@ impl Output {
.with_context(|| format!("failed to write `{}`", path.display()))?;
}

if !gen.npm_dependencies.is_empty() {
let is_genmode_nodemodule = matches!(gen.mode, OutputMode::Node { module: true });
if !gen.npm_dependencies.is_empty() || is_genmode_nodemodule {
#[derive(serde::Serialize)]
struct PackageJson<'a> {
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
ty: Option<&'static str>,
dependencies: BTreeMap<&'a str, &'a str>,
}
let pj = PackageJson {
ty: is_genmode_nodemodule.then_some("module"),
dependencies: gen
.npm_dependencies
.iter()
Expand Down

0 comments on commit a4fba63

Please sign in to comment.