Skip to content

v3.0.0-beta.0

Pre-release
Pre-release

Choose a tag to compare

@tmlmt tmlmt released this 26 Oct 17:36
· 12 commits to main since this release

compare changes

⚠️ Breaking changes

  • This release introducing a better handling of potential errors by
    having a more consistant collection of diagnostics during parsing and changes the way the parse() functions behave. Recipe, CategoryConfig, Pantry, and ProductCatalog now collect diagnostics and can return despite recoverable errors. Fatal diagnostics i.e. diagnostics triggers by
    errors which are recoverable but can not be fully tested now throw DiagnosticError; recipe parsing can also stop early with ParseStoppedError. Code that relied on catching a specific parse-time error should instead inspect error.diagnostics or the instance’s diagnostics.
  • Reusing a Recipe instance now replaces its previous parsed state. Each parse() call resets the recipe instead of retaining or accumulating prior state.
  • NoProductMatchError.code was renamed to reason. code now contains the diagnostic identifier, so callers checking the previous reason value must use reason instead.
  • Malformed Pantry or ProductCatalog TOML now throws a library-specific error (InvalidPantryTomlError or InvalidProductCatalogTomlError) instead of the TOML parser’s raw error. Update catches that depend on the old error type.
  • Mixed text and numeric quantities no longer throw in the affected aggregation path; they produce a warning instead. Callers that depended on the exception to detect or reject this input need to check diagnostics.

🚀 Enhancements

  • Add diagnostics (#109)
  • parse: ⚠️ Throw only on fatal errors (#116)
  • diagnostics: Emit warning when same ingredient as existing one with same flags and preparation is added again (#119)
  • playground: Improve layout and show diagnostics (#122)

🩹 Fixes

  • Report division by zero as error (#112)
  • Report warning instead of throwing when encountering a mix of text and numeric quantities (#113)
  • recipe: Collect RatioNotComputableError(E9401 during final quantity aggregation (#121)
  • playground: Remove space between ingredient name and comma before preparation (#123)
  • playground: Display ingredient preparations within steps (#124)

🏡 Chore

  • Bump @types/node to v24 and bump pnpm to v12.15.0 (#114)
  • playground: Remove unreachable branch (#118)
  • Rethrow non-explicitly-listed errors to avoid future regressions (#120)
  • smol-toml: Do not use deprecated import method (7657441)
  • test: Remove unused import (5d1c8d3)
  • Fix linting (930b6f8)

✅ Tests

  • diagnostics: Add customer matcher for cleaner checks and error display (#115)

⚠️ Breaking Changes

  • parse: ⚠️ Throw only on fatal errors (#116)

❤️ Contributors