Specified upstream RFC 8 is a way for NPM dependencies to work transitively throughout the crate graph. The first phase of supporting this is now implemented in wasm-bindgen and the next phase is in wasm-pack itself. Thankfully it shouldn't be too hard!
Currently today wasm-pack will write out a package.json, but this will overwrite a package.json created by wasm-bindgen, if one exists. Instead what wasm-pack should do is:
- When creating
package.json, first check to see if one already exists at the target location
- Deserialize the
dependencies map, if it exists, otherwise start with an empty object
- Add in all the current configuration (name, scope, urls, etc)
- Write out the
package.json again, overwriting what was previously there.
Basically the package.json that wasm-pack writes should just be merged with the package.json emitted by wasm-bindgen if it's already there.
Specified upstream RFC 8 is a way for NPM dependencies to work transitively throughout the crate graph. The first phase of supporting this is now implemented in wasm-bindgen and the next phase is in
wasm-packitself. Thankfully it shouldn't be too hard!Currently today
wasm-packwill write out apackage.json, but this will overwrite apackage.jsoncreated bywasm-bindgen, if one exists. Instead whatwasm-packshould do is:package.json, first check to see if one already exists at the target locationdependenciesmap, if it exists, otherwise start with an empty objectpackage.jsonagain, overwriting what was previously there.Basically the
package.jsonthatwasm-packwrites should just be merged with thepackage.jsonemitted bywasm-bindgenif it's already there.