Add a mixin for Pipeline compilers supporting sourcemaps.

Review Request #12760 — Created Jan. 2, 2023 and submitted

Information

Djblets
release-4.x

Reviewers

This introduces a new djblets.pipeline.compilers.mixins module, which
currently contains SourceMapStaleCheckMixin. 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.

Summary ID
Add a mixin for Pipeline compilers supporting sourcemaps.
This introduces a new `djblets.pipeline.compilers.mixins` module, which currently contains `SourceMapStaleCheckMixin`. 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.
954e0e51a9457f9a36a853ae71dbd34e41d2b551
Description From Last Updated

It looks like you updated this with the wrong commit (replaced the sourcemap change with rollup)

daviddavid
david
  1. Ship It!
  2. 
      
chipx86
david
  1. 
      
  2. Show all issues

    It looks like you updated this with the wrong commit (replaced the sourcemap change with rollup)

  3. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-4.x (ad2e2dd)