Hooks and SRI?
I've been trying to use hooks to run a JS bundler on the output of wasm-bindgen.
Running the bundler works reasonably well (though it's a bit sad that I have to guess the name of the .js file).
I update the .js file in-place in the .stage directory.
However, this does not seem to trigger a re-calculation of the SRI hash.
Would it be feasible to support this use case?
E.g. one option that I've hacked together is support for a data-js-bundler="bun build --outfile=$TRUNK_OUTPUT $TRUNK_INPUT" attribute for rust assets, but based on my reading of #32, that's not a direction you want to take the project in.
Another alternative I could imagine: is re-calculate (or defer calculating) all the SRI hashes to just before writing the final HTML.
I guess I've found a way to make this work by using a fake wasm-bindgen executable, and running the bundler immediately after the actual wasm-bindgen.
It's a bit annoying to use because there doesn't seem to be a way to explicitly provide the path to wasm-bindgen (only its version), but it's doable.
Yea, the SRI stuff is being processed before putting it to the .stage directory IIRC. Maybe it needs another hook type?
Thanks for taking a look at this issue! Just FYI: I reported this while prototyping some things, and ended up not actually needing a bundler. (So this problem doesn't affect me any more).
good idea but maybe for now this can be closed @ctron ("So this problem doesn't affect me any more")
I guess we can leave it open. It's a valid point, isn't it?
I guess we can leave it open. It's a valid point, isn't it?
It is. Still I am asking myself how to offer a better overview for "onboarding developers", like a triage or something like a PRODUCTVISION.md.