djblets.pipeline.compilers.mixins¶
Mixins for writing Pipeline compilers.
New in version 4.0.
- class SourceMapStaleCheckMixin¶
Bases:
object
Pipeline compiler mixin for using sourcemaps for stale file checks.
This mixin allows Pipeline compilers to use generated sourcemaps to determine which files were used to generate a compiled file, and to check each of those to see if the compile file is stale.
This requires that the tool performing either CSS or JavaScript compilation is capable of generating a sourcemap that includes a comprehensive set of all files used in its compilation. Some tools (such as LessCSS) generate sourcemaps that only contain a subset, and those cannot be used without additional post-processing.
The list of sources from parsing a sourcemap are cached for an hour, and will be invalidated any time the timestamp of the sourcemap or compiled file changes.
New in version 4.0.
- get_sourcemap_filename(infile: str, outfile: str) str ¶
Return the filename for the sourcemap.
This defaults to adding
.map
to the end of the compiled file path. Subclasses can change this if they need to look for a file in a different location or with a different name.
- is_outdated(infile: str, outfile: str) bool ¶
Return whether a compiled file is out of date.
This will check the timestamps of the source file, compiled file, sourcemap, and all files referenced by the sourcemap. If the source file or any of the sourcemap’s source files have changed (or are missing), this will trigger recompilation.
If a sourcemap is missing, this will log an error and will flag the file as being out of date.
- __annotations__ = {'_SOURCES_CACHE_TIME_SECS': <class 'int'>}¶