Pipeline
pipeline
Smelt pipeline — detect, count, compact.
check(text=None, *, parsed=None)
Analyze text without transforming it.
The report carries two distinct savings figures:
strategy_estimatesmaps each registry strategy to the reduction it achieves in isolation, measured against the unmutated input. These estimates are independent and non-additive: summing them overstates the achievable gain, because strategies overlap (e.g.minifyalready removes whitespace thatcollapse_whitespacewould also target).savings_pctis the real cumulative gain — the reduction obtained by chaining the default strategy set (resolve_strategies(None, None), i.e. thesafepreset, exactly what :func:smeltapplies with no explicit strategies). It equals what a user would actually get fromsmelt(text).
original and compacted stay identical: check never transforms
its input, it only measures.
Source code in packages/axm-smelt/src/axm_smelt/core/pipeline.py
resolve_input(text, parsed)
Normalize inputs into (text, parsed).
Source code in packages/axm-smelt/src/axm_smelt/core/pipeline.py
resolve_strategies(strategies, preset)
Return strategy instances from explicit names, a preset, or the default.
Source code in packages/axm-smelt/src/axm_smelt/core/pipeline.py
smelt(text=None, strategies=None, preset=None, *, parsed=None)
Run the compaction pipeline and return a report.
Baseline for savings_pct:
text=path: the baseline is the provided raw string, unchanged.parsed=path: the baseline is the pretty serializationjson.dumps(parsed, indent=2, ensure_ascii=False), not the compact dump. A parsed object has no canonical textual form, so measuring savings against an already-minified compact baseline would structurally under-report the reduction. The pretty baseline reflects the indented form a user would otherwise have read, sosavings_pctmatches the perceived reduction.report.originalstill holds the compact serialization (the pipeline's working text).