class RevisionCompiler implements CompilerInterface
Traits
Constants
| EMPTY_REVISION |
|
Properties
| protected callable[] | $sourcesCallbacks | from HasSources |
|
|
| protected array<string, string> | $pendingSidecars | Sidecar files (e.g. JsCompiler's `.map`) queued by renderOutput() during the current commit, written only if the primary file is — so an unchanged bundle rewrites nothing at all. |
|
Methods
No description
Recompile this asset and record its revision. Files are only written when the compiled output actually differs from what the revision manifest says is on disk (or the file has gone missing) — so routine rebuilds of unchanged assets are complete no-ops with zero writes.
Whether the committed file is really the output its revision claims.
Produce the exact bytes to write to the primary asset file, or null when there is nothing to write (empty sources). This is what the revision is hashed from, so it must be identical to what gets committed — subclasses that transform or add to the output (e.g. JsCompiler's sourcemap handling) override this and queue any sidecar files (like the `.map`) on {$pendingSidecars} rather than writing them, so sidecars are only written when the bundle itself is.
Details
in HasSources
at
line 25
void
addSources(callable $callback)
in HasSources
at
line 33
protected array
getSources()
at
line 218
protected array
allowedSourceTypes()
at
line 28
__construct( Cloud $assetsDir, string $filename, SettingsRepositoryInterface $settings, VersionerInterface $versioner)
at
line 36
string|null
getFilename()
at
line 41
void
setFilename(string $filename)
at
line 57
void
commit(bool $force = false)
Recompile this asset and record its revision. Files are only written when the compiled output actually differs from what the revision manifest says is on disk (or the file has gone missing) — so routine rebuilds of unchanged assets are complete no-ops with zero writes.
at
line 111
protected void
writePendingSidecars()
at
line 118
protected string
hashOutput(string $content)
at
line 129
protected bool
committedFileMatches(string $output)
Whether the committed file is really the output its revision claims.
Read back and compared rather than assumed: a recorded revision is only evidence about the file if the write that recorded it also landed.
at
line 151
protected string|null
renderOutput(array $sources)
Produce the exact bytes to write to the primary asset file, or null when there is nothing to write (empty sources). This is what the revision is hashed from, so it must be identical to what gets committed — subclasses that transform or add to the output (e.g. JsCompiler's sourcemap handling) override this and queue any sidecar files (like the `.map`) on {$pendingSidecars} rather than writing them, so sidecars are only written when the bundle itself is.