Skip to content

Releases: dsisco11/TinyPreprocessor

v0.4

Choose a tag to compare

@dsisco11 dsisco11 released this 11 Jan 07:16
140f645

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 ResourceId produced during resolution and provides it to merge via MergeContext.

Breaking

  • MergeContext<TContent, TDirective> constructor signature changed: it now requires a ResolvedReferences mapping.
  • Any downstream/custom merge strategy that constructs or expects the prior MergeContext signature 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 from MergeContext.ResolvedCache.
  • Do not compute a ResourceId from 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 ResolvedReferences as the source of truth for resolved dependency identity.

v0.3

Choose a tag to compare

@dsisco11 dsisco11 released this 10 Jan 10:24
e5a20e4

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 an IContentModel<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 store TContent Content
    • IResourceResolver<TContent> and ResourceResolutionResult<TContent>
    • IDirectiveParser<TContent, TDirective> parses TContent directly
    • IMergeStrategy<TContent, TDirective, TContext>, ResolvedResource<TContent, TDirective>, MergeContext<TContent, TDirective>
    • PreprocessResult<TContent> now returns TContent Content

New

  • Added IContentModel<TContent> abstraction.
  • Added a text implementation for the default text pipeline (ReadOnlyMemory<char>).

Text pipeline

  • ConcatenatingMergeStrategy updated to the new merge contracts and continues to operate as the default text merge strategy using TContent = 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 TSymbol usages with TContent in your implementations.
  • Provide an IContentModel<TContent> when constructing Preprocessor<…>.
  • If you’re using the text pipeline, use TContent = ReadOnlyMemory<char> and ReadOnlyMemoryCharContentModel.

v0.2

Choose a tag to compare

@dsisco11 dsisco11 released this 10 Jan 09:13
b4e7848

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.
  • Offset-only source maps

    • Source mapping is now based on generated/original offsets (not line/column), with APIs like SourceMap.Query(int generatedOffset) and QueryRangeByLength(...).
  • 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.
  • Text-specific functionality consolidated under Text layer

    • The default concatenating merge behavior and related text diagnostics live in TinyPreprocessor.Text.
  • Legacy directive interfaces removed

    • Removed the old IDirective / IIncludeDirective interfaces to avoid confusion and reduce required coupling for consumers.
  • 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

  • Preprocessor is now Preprocessor<TSymbol, TDirective, TContext> and requires an IDirectiveModel<TDirective>.
  • IResource, Resource, IResourceResolver, and ResourceResolutionResult are 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

Choose a tag to compare

@dsisco11 dsisco11 released this 10 Jan 05:33

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 ProcessAsync calls (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 / SourceMapBuilder with 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

  • DeduplicateIncludes is currently effectively always-on (resources are cached per call and won’t be merged multiple times, even if set to false).
  • 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.