Add a mixin for Pipeline compilers supporting sourcemaps.
Review Request #12760 — Created Jan. 2, 2023 and submitted — Latest diff uploaded
This introduces a new
djblets.pipeline.compilers.mixins
module, which
currently containsSourceMapStaleCheckMixin
. This new mixin allows
Pipeline compilers to efficiently check whether a file in a bundle needs
to be rebuilt, based on any files that contributed to its sourcemap.This works by looking up all the source files in the sourcemap and
comparing timestamps. If any timestamps are newer than that of the built
file or sourcemap, or if any files are missing, then the built file is
considered stale and needs to be rebuilt.The list of files are extracted from the sourcemap and cached for a
period of 1 hour, to avoid having to re-parse the sourcemap every time.This will be used for the upcoming rollup.js support for bundling
module-based JavaScript files. Unfortunately, it can't currently be used
for LessCSS due to a broken sourcemap implementation that prevents some
files from being included, but that may be tackled separately via a new
plugin or build step.
Tested this thoroughly with the upcoming rollup.js support.