Releases: dsisco11/TinyPreprocessor
Release list
v0.4
Release Notes — Authoritative Resolved IDs for Merge (Breaking Change)
Highlights
- Merge-stage consumers can now use the authoritative dependency identity returned by the resolver, enabling non-path-like reference mapping (e.g., domain-prefixed shader include IDs).
Fixed
- Eliminates merge failures caused by re-deriving dependency IDs from raw directive references (path heuristics) when the resolver maps references to a different canonical
ResourceId.
Changed
- The preprocessing pipeline now records, per directive occurrence, the resolved target
ResourceIdproduced during resolution and provides it to merge viaMergeContext.
Breaking
MergeContext<TContent, TDirective>constructor signature changed: it now requires aResolvedReferencesmapping.- Any downstream/custom merge strategy that constructs or expects the prior
MergeContextsignature must be updated.
How to use (for downstream merge strategies)
- When inlining/expanding directives in merge, look up the resolved dependency via
MergeContext.ResolvedReferences(keyed by(requestingResourceId, directiveIndex)) and then fetch the content fromMergeContext.ResolvedCache. - Do not compute a
ResourceIdfrom the raw reference string.
Diagnostics & Docs
- Documentation now clarifies phase responsibilities: resolution errors come from resolver stage; merge diagnostics are for merge-time issues only.
- Docs describe
ResolvedReferencesas the source of truth for resolved dependency identity.
v0.3
Release Notes — TinyPreprocessor v0.3
Breaking changes
- The library is now generic over content representation (
TContent) instead of a symbol type (TSymbol+ReadOnlyMemory<TSymbol>). Preprocessor<…>now requires anIContentModel<TContent>instance to define:- how content length is measured
- how content is sliced
- what a source-map “offset” means (“content units”)
- Public interfaces updated accordingly:
IResource<TContent>/Resource<TContent>now storeTContent ContentIResourceResolver<TContent>andResourceResolutionResult<TContent>IDirectiveParser<TContent, TDirective>parsesTContentdirectlyIMergeStrategy<TContent, TDirective, TContext>,ResolvedResource<TContent, TDirective>,MergeContext<TContent, TDirective>PreprocessResult<TContent>now returnsTContent Content
New
- Added
IContentModel<TContent>abstraction. - Added a text implementation for the default text pipeline (
ReadOnlyMemory<char>).
Text pipeline
ConcatenatingMergeStrategyupdated to the new merge contracts and continues to operate as the default text merge strategy usingTContent = ReadOnlyMemory<char>.
Source maps
- Source mapping remains offset-based; documentation now reflects the current implementation.
- Offsets are now explicitly “content units” as defined by the supplied
IContentModel<TContent>.
Documentation
- README and architecture docs updated to match the new
TContent+IContentModel<TContent>APIs and examples.
Testing
- Test suite updated to the new API and remains green (109 tests passing).
- Existing xUnit analyzer warnings remain (no behavioral change implied).
Upgrade guidance (high level)
- Replace
TSymbolusages withTContentin your implementations. - Provide an
IContentModel<TContent>when constructingPreprocessor<…>. - If you’re using the text pipeline, use
TContent = ReadOnlyMemory<char>andReadOnlyMemoryCharContentModel.
v0.2
Release Notes (v0.2)
-
Core API is now fully generic over symbol type (
TSymbol)- Resources, resolvers, merge strategies, and the preprocessor pipeline now operate on
ReadOnlyMemory<TSymbol>rather than being text-only.
- Resources, resolvers, merge strategies, and the preprocessor pipeline now operate on
-
Offset-only source maps
- Source mapping is now based on generated/original offsets (not line/column), with APIs like
SourceMap.Query(int generatedOffset)andQueryRangeByLength(...).
- Source mapping is now based on generated/original offsets (not line/column), with APIs like
-
New
IDirectiveModel<TDirective>abstraction- Directive semantics (location + dependency reference extraction) are supplied via
IDirectiveModel<TDirective>, so directive types no longer need to implement library interfaces.
- Directive semantics (location + dependency reference extraction) are supplied via
-
Text-specific functionality consolidated under Text layer
- The default concatenating merge behavior and related text diagnostics live in
TinyPreprocessor.Text.
- The default concatenating merge behavior and related text diagnostics live in
-
Legacy directive interfaces removed
- Removed the old
IDirective/IIncludeDirectiveinterfaces to avoid confusion and reduce required coupling for consumers.
- Removed the old
-
Docs and examples updated
- README now includes a simpler in-memory “Quick Start” and updated examples reflecting the new generic + offset-based APIs.
Breaking Changes
Preprocessoris nowPreprocessor<TSymbol, TDirective, TContext>and requires anIDirectiveModel<TDirective>.IResource,Resource,IResourceResolver, andResourceResolutionResultare now generic (<TSymbol>).- Source map APIs are offset-based (line/column querying is removed).
Compatibility
- Requires .NET 8+ (unchanged).
Testing
- Full test suite passing (
dotnet test).
v0.1
TinyPreprocessor v0.1.0 — Initial preview (2026-01-09)
A lightweight, extensible preprocessing library for .NET that resolves dependencies, merges resources, and generates source maps.
Highlights
- Recursive dependency resolution with cycle detection
- Extensible pipeline: bring your own directive parser, resource resolver, and merge strategy
- Source maps for tracing generated output back to original sources
- Diagnostics-first design with “continue on error” support
- Thread-safe concurrent
ProcessAsynccalls (isolated per-call state)
What’s included
- Core abstractions:
ResourceId,IResource,IDirective,IDirectiveParser<TDirective>,IResourceResolver - Preprocessor orchestrator:
Preprocessor<TDirective, TContext>.ProcessAsync(...) - Dependency graph:
ResourceDependencyGraph(cycle detection + topological ordering) - Diagnostics:
DiagnosticCollection+ built-in diagnostics for common failure modes - Source mapping:
SourceMap/SourceMapBuilderwith query support - Default merge strategy:
ConcatenatingMergeStrategy<TContext>(concatenation + directive stripping + line mappings)
Install
dotnet add package TinyPreprocessor --version 0.1.0
Requirements
- .NET 8+ (
net8.0)
Notes / Known limitations
DeduplicateIncludesis currently effectively always-on (resources are cached per call and won’t be merged multiple times, even if set tofalse).- If cycles are present, a circular-dependency diagnostic is emitted; merged output may be incomplete or not strictly dependency-correct.
Documentation
- See the docs folder in the repo: core abstractions, diagnostics, dependency graph, source mapping, merge system, and orchestrator design.