Skip to content

Processors

A processor is the fundamental unit of transformation in pageflare. Each processor is a self-contained component that:

  1. Declares which file types it handles.
  2. Receives the current content of a file.
  3. Returns the transformed content (or the original content if no change is needed).

Processors are stateless with respect to individual files. They may read the shared asset graph (built during the analyze phase) but do not modify it.

At startup, pageflare assembles an ordered list of active processors for each file category based on the resolved configuration:

  • Feature flags that are true contribute their processor(s) to the active set.
  • Feature flags that are false or absent contribute nothing.
  • Pro-gated features are silently excluded if no valid license is present.

Once assembled, the active set is fixed for the duration of the run. Every file of a given type receives the exact same sequence of transformations.

Multiple processors can act on a single file. They run in a defined order — the output of one processor becomes the input of the next.

For an HTML file with a typical Free-tier config, the chain might look like:

HTML file
→ LazyLoadProcessor (adds loading="lazy" to images)
→ ScriptDeferProcessor (adds defer to scripts)
→ ResourceHintProcessor (injects preload/preconnect links)
→ HtmlMinifyProcessor (minifies the result)

Minification runs last so it compresses the output of all earlier processors rather than content that might subsequently be modified.

Each processor declares the set of file categories it handles. The pipeline looks up all active processors that match the current file’s category and runs them in order.

CategoryProcessors that can match
HTMLLazy load, script defer, resource hints, critical CSS injection, HTML minify, YouTube facades, WP bloat removal, SPA mode
CSSCSS minify, critical CSS extraction
JavaScriptJS minify, script deferral
ImageSize detection, adaptive sizing
FontFont preloading, font-display

Each processor is either Free or Pro. Pro processors are excluded at startup when no valid license is present. There is no per-file license check — the decision is made once when the active set is assembled.

Pro-only processors cover features that require significant compute or deliver the largest gains on high-traffic sites:

FeatureTier
Critical CSS extraction and injectionPRO
YouTube facadesPRO
WordPress bloat removalPRO
SPA mode with View TransitionsPRO
Google Fonts self-hostingPRO
Unicode-range subsettingPRO
Adaptive image sizing (srcset)PRO
Filename hashingPRO
Speculation rulesPRO

Think of the processor setup as a pipeline template stamped out at startup. Every file of a given type gets the exact same sequence of transformations. There is no conditional logic inside the pipeline loop — all decisions about which processors are active were made before processing began.