This diff enables to browse swh-web with its JavaScript features enabled while
using the LibreJS Firefox plugin (https://www.gnu.org/software/librejs/index.html).
The compliance is obtained through the following:
- Generate a WebLabels HTML page through the help of a homemade webpack plugin referencing all the generated JavaScript assets we distribute. For each asset, all bundled source files in it are referenced along with their license and a link to their non-minified source code.
- Slightly modify some Django templates to state the license of scripts directly included in the HTML.
Regarding the link to non-minified source files, I preferred to copy them to our web
server and serve them directly from there. Linking to external locations is also feasible
but there is currently no generic method to compute the relevant urls (some are easy to
compute but some are not, especially for not maintained npm modules). So in order to be
fully compliant with LibreJS specification, this is currently the best method to use.
In the future, we should be able to link directly to the swh archive using the source files
checksums, but this requires npm packages to be loaded in a regular basis into it which
is currently not the case.
That diff introduces a draft webpack plugin to ease the generation of the WebLabels page.
There is still a lot of improvements to add to it but I think it could be useful to other
FOSS web applications using webpack to generate static assets. It could be moved to a
dedicated repository in our forge and published on npm once it gets to a release state.
Related T1512