duojs / duo

A next-generation package manager for the front-end
3.42k stars 118 forks source link

Adding a public hash function to the API #478

Closed dominicbarnes closed 9 years ago

dominicbarnes commented 9 years ago

This adds a really basic helper function for generating quick hashes. The thinking here is that plugins can consume this to quickly generate cache keys. (in conjunction with #477 to give as much power to plugin authors as possible)

At first, I had duo calculating hashes on each file as it went, (as well as the results of duo-pack before running alternate plugins) but I didn't want to add any unnecessary overhead for people who aren't using plugins. (it's not much, but still decided better to restrain myself there)

I'm open to alternatives here, maybe since this is geared primarilly towards caching, it should be a part of duo-cache directly?