dsherret / dax

Cross-platform shell tools for Deno and Node.js inspired by zx.
MIT License
1.01k stars 35 forks source link

Wasm cache versionning #44

Closed sigmaSd closed 1 year ago

sigmaSd commented 1 year ago

I didn't run into a problem yet, but just reading the code, it seems like wasm caching just checks if the file exists locally

So if the wasm file gets new apis, it wont be re-downloaded again because it exists already

Maybe the wasm caching need to be aware of dax version

dsherret commented 1 year ago

It should be. Does your cache not store a version number?

dsherret commented 1 year ago

https://github.com/dsherret/dax/blob/760f04dc12354e1691efea9d47eececbefd96f42/src/lib/mod.ts#L27

sigmaSd commented 1 year ago

Ah so the version is in the file name cool

sigmaSd commented 1 year ago

What about adding this to deno wasm build somewhere seems useful, maybe also worth mentioning serde_wasm_bindgen

dsherret commented 1 year ago

Yeah, it would be probably better if wasmbuild just handled this or had an option to generate code that does. One restriction in wasmbuild is it probably shouldn’t have any external dependencies so it works well in a web browser. We would also probably have to have more general caching (maybe a hash of the url for the filename in a general wasmbuild cache folder). Would you like to implement this?

sigmaSd commented 1 year ago

Sure I'll look into it, I'll start by opening an issue there