Skip to content

Releases: echecsjs/pgn

v5.0.0

Choose a tag to compare

@github-actions github-actions released this 28 May 14:22
2ae4801

Changed

  • BREAKING: parse is now a named export instead of the default export. Use
    import { parse } from '@echecs/pgn' instead of
    import parse from '@echecs/pgn'.
  • BREAKING: renamed Move type to Notation to avoid confusion with
    coordinate moves.
  • BREAKING: renamed MovePair to NotationPair.
  • BREAKING: renamed MoveList to NotationList.
  • Variation type definition updated to NotationList[] (name unchanged).
  • Re-exported PieceType and PromotionPieceType from @echecs/san instead of
    the removed Piece and PromotionPiece aliases.

v4.1.0

Choose a tag to compare

@github-actions github-actions released this 27 May 22:26
6295039

Changed

  • Re-exported PieceType and PromotionPieceType from @echecs/san instead of
    the removed Piece and PromotionPiece aliases.

v4.0.0

Choose a tag to compare

@github-actions github-actions released this 27 Apr 22:01
c7ee907

Changed

  • Move now extends SAN from @echecs/san — all SAN fields are always
    present (no more optional capture, check, checkmate)
  • piece values changed from uppercase chars to full words ('P' -> 'pawn',
    'N' -> 'knight', 'B' -> 'bishop', 'R' -> 'rook', 'Q' ->
    'queen', 'K' -> 'king')
  • promotion values changed from uppercase chars to full words ('queen',
    'rook', 'bishop', 'knight')
  • castling changed from optional boolean to required boolean, with new long
    boolean field replacing destination-based detection
  • capture, check, checkmate changed from optional to always present
    (default false)
  • to is undefined for castling moves (destination square resolved
    internally)

Added

  • re-exports Piece, PromotionPiece, SAN, Disambiguation, File, Rank,
    Square from @echecs/san

Removed

  • PieceChar type (replaced by Piece from @echecs/san)

v3.12.2

Choose a tag to compare

@github-actions github-actions released this 09 Apr 17:21
70e33bf

Changed

  • updated description to mention stringify
  • removed inaccurate fide keyword
  • added serializer keyword

v3.12.1

Choose a tag to compare

@github-actions github-actions released this 09 Apr 17:00
b669beb

Fixed

  • added missing type exports (Disambiguation, File, PieceChar, Rank,
    Square)
  • replaced non-existent Piece type with PieceChar
  • corrected Move field types (boolean not true)
  • corrected Move.promotion type to PieceChar
  • corrected Arrow and SquareAnnotation field types to Square

v3.10.1

Choose a tag to compare

@github-actions github-actions released this 17 Mar 19:41
a90c773

Changed

  • Build tool replaced with tsdown. The published package now ships a single
    bundled, minified dist/index.js instead of multiple unbundled files.
    Published package size reduced from ~200KB to ~42KB (79% reduction).
    dist/grammar.cjs.map (84KB) is no longer published. Public API unchanged.

v3.10.0

Choose a tag to compare

@github-actions github-actions released this 17 Mar 11:59
c2e888a

Added

  • stringify(input: PGN | PGN[], options?: StringifyOptions): string — converts
    parsed PGN objects back to valid PGN strings (semantic round-trip fidelity).
    Accepts a single game or an array of games. Reconstructs SAN from Move
    fields, re-serializes annotation commands ([%cal], [%csl], [%clk],
    [%eval]) back into comment blocks, and preserves RAVs and NAGs. Fires
    onWarning for recoverable issues (invalid castling destination, negative
    clock).

Changed

  • src/index.ts refactored into focused internal modules (src/types.ts,
    src/parse.ts, src/stream.ts, src/stringify.ts). Public API unchanged.

Fixed

  • Tagless games with no moves (e.g. [Result "*"]\n\n*) now parse correctly.
    Previously the grammar required at least one move in the movetext.

v3.9.1

Choose a tag to compare

@github-actions github-actions released this 16 Mar 20:06
56a37ca

Fixed

  • AnnotationColor now includes 'C' (cyan) and 'O' (orange) in addition to
    'B', 'G', 'R', 'Y' — matching real-world Lichess and ChessBase
    exports. Tokens with these colors were previously silently dropped.
  • Empty [%csl ] and [%cal ] commands (with no token list) are now silently
    stripped from the comment text instead of leaking through as raw strings.

v3.9.0

Choose a tag to compare

@github-actions github-actions released this 16 Mar 19:45
753f314

Added

  • Move now exposes structured fields parsed from embedded PGN comment
    commands:
    • arrows?: Arrow[] — from [%cal ...] (coloured arrows on board)
    • squares?: SquareAnnotation[] — from [%csl ...] (coloured square
      highlights)
    • clock?: number — from [%clk ...] (remaining time in seconds, sub-second
      precision preserved)
    • eval?: Eval — from [%eval ...] (engine evaluation: centipawns or
      mate-in-N, with optional search depth)
  • New exported types: AnnotationColor, Arrow, SquareAnnotation, Eval
  • Command strings are stripped from move.comment; unknown [%...] commands
    are left in the comment string unchanged
  • De-facto standard followed:
    python-chess

v3.8.3

Choose a tag to compare

@github-actions github-actions released this 15 Mar 20:07
6d512f6

Added

  • stream() now accepts a Web Streams ReadableStream<string> in addition to
    AsyncIterable<string>. This covers
    fetch().body.pipeThrough(new TextDecoderStream()) in browser and edge
    runtimes. The type signature is widened accordingly — no behaviour change for
    existing AsyncIterable callers.