Releases: echecsjs/pgn
Releases · echecsjs/pgn
Release list
v5.0.0
Changed
- BREAKING:
parseis now a named export instead of the default export. Use
import { parse } from '@echecs/pgn'instead of
import parse from '@echecs/pgn'. - BREAKING: renamed
Movetype toNotationto avoid confusion with
coordinate moves. - BREAKING: renamed
MovePairtoNotationPair. - BREAKING: renamed
MoveListtoNotationList. Variationtype definition updated toNotationList[](name unchanged).- Re-exported
PieceTypeandPromotionPieceTypefrom@echecs/saninstead of
the removedPieceandPromotionPiecealiases.
v4.1.0
Changed
- Re-exported
PieceTypeandPromotionPieceTypefrom@echecs/saninstead of
the removedPieceandPromotionPiecealiases.
v4.0.0
Changed
Movenow extendsSANfrom@echecs/san— all SAN fields are always
present (no more optionalcapture,check,checkmate)piecevalues changed from uppercase chars to full words ('P'->'pawn',
'N'->'knight','B'->'bishop','R'->'rook','Q'->
'queen','K'->'king')promotionvalues changed from uppercase chars to full words ('queen',
'rook','bishop','knight')castlingchanged from optional boolean to required boolean, with newlong
boolean field replacing destination-based detectioncapture,check,checkmatechanged from optional to always present
(defaultfalse)toisundefinedfor castling moves (destination square resolved
internally)
Added
- re-exports
Piece,PromotionPiece,SAN,Disambiguation,File,Rank,
Squarefrom@echecs/san
Removed
PieceChartype (replaced byPiecefrom@echecs/san)
v3.12.2
Changed
- updated description to mention stringify
- removed inaccurate
fidekeyword - added
serializerkeyword
v3.12.1
Fixed
- added missing type exports (
Disambiguation,File,PieceChar,Rank,
Square) - replaced non-existent
Piecetype withPieceChar - corrected
Movefield types (booleannottrue) - corrected
Move.promotiontype toPieceChar - corrected
ArrowandSquareAnnotationfield types toSquare
v3.10.1
Changed
- Build tool replaced with
tsdown. The published package now ships a single
bundled, minifieddist/index.jsinstead 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
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 fromMove
fields, re-serializes annotation commands ([%cal],[%csl],[%clk],
[%eval]) back into comment blocks, and preserves RAVs and NAGs. Fires
onWarningfor recoverable issues (invalid castling destination, negative
clock).
Changed
src/index.tsrefactored 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
Fixed
AnnotationColornow 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
Added
Movenow 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
Added
stream()now accepts a Web StreamsReadableStream<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
existingAsyncIterablecallers.