Simplify logic and speed up the write step on sites with lots of files (#43 by kevinrenskers)
Simplifies Saga’s internal architecture by removing four internal types (FileContainer, ProcessStep<M>, AnyProcessStep, ItemBox<M>) and replacing them with simpler data structures.
File tracking: FileContainer class replaced by a tuple array [(path: Path, relativePath: Path)] with a Set<Path> for handled state and a [String: String] dict for content hashes.
Pipeline steps: Type-erased wrapper classes replaced by closure pairs (read: ReadStep, write: WriteStep) stored directly on Saga.
Writer context: Writer.run now takes a WriterContext<M> struct instead of 6 individual parameters.
Resource lookup: Per-item linear scan of all files replaced by a precomputed dictionary, resulting in a ~2.5x faster write phase on file-heavy sites (it saves 0.5 seconds on loopwerk.io).
Added a new convenience groupedWriter, a version of partitionedWriter that takes a key path. yearWriter now uses it under the hood.
Solved the SendableMetatype warnings for Swift 6 projects.
Add Sendable conformances and @Sendable annotations throughout.
While Saga now uses the Swift 6 toolchain, backwards compatibility with Swift 5 projects is maintained.
Users still on Swift 5 will most likely get warnings about “Converting non-Sendable function value to @Sendable”. This is unfortunate, but it’s not feasible to make Saga compatible and crash-free with Swift 6 while also not introducing these warnings for Swift 5 users. Please upgrade your Package.swift to use swift-tools-version:6.0.
BREAKING CHANGES
Switched from loopwerk/PathKit to loopwerk/SagaPathKit due to name clashes with projects (such as Stencil) that depends on kylef/PathKit. If your code uses import PathKit, you’ll need to change this to import SagaPathKit.
Removed all deprecated methods and properties.
Removed the old watch command. Please use the new saga cli.
Add @Sendable annotations and refactor postProcess/reader pipeline Refactor postProcess to use a postProcessors array, fixing createPage not applying post-processors.
Switched from kylef/PathKit to loopwerk/PathKit The original project seems unmaintained. My fork updated the minimum Swift version to 5.10, added Swift 6 support with Sendable, added Decodable support, and fixed all the unit tests (they didn’t run at all).
Removed the Saga CLI from this package, and into its own repository This should make dependency resolution quicker for Saga users, pulling in fewer dependencies.