@echecs/pgn 3.6.2 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,25 @@ and this project adheres to
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [3.7.0] - 2026-03-15
12
+
13
+ ### Added
14
+
15
+ - `onWarning` option for `parse()` and `stream()`: fires once per missing STR
16
+ tag. Emitted in alphabetical key order: `Black`, `Date`, `Event`, `Result`,
17
+ `Round`, `Site`, `White`.
18
+ - `ParseWarning` is now an exported type with the same shape as `ParseError`.
19
+
20
+ ### Fixed
21
+
22
+ - `parse()` and `stream()` now strip a UTF-8 BOM (`\uFEFF`) at the start of
23
+ input. Chessbase and Windows editors commonly produce BOM-prefixed PGN files
24
+ that previously failed silently.
25
+ - Tag values containing escaped quotes (`\"`) or escaped backslashes (`\\`) now
26
+ parse correctly per PGN spec section 7.
27
+ - Games with no tag pairs (bare move list + result) now parse correctly per PGN
28
+ spec section 8.1 ("zero or more tag pairs"). These games return `meta: {}`.
29
+
11
30
  ## [3.6.2] - 2026-03-15
12
31
 
13
32
  ### Performance
package/README.md CHANGED
@@ -135,6 +135,31 @@ for await (const game of stream(chunks, { onError: console.error })) {
135
135
  > (truncated input). Incomplete input at end-of-stream is treated as expected
136
136
  > behaviour, not a parse error.
137
137
 
138
+ ### Warnings
139
+
140
+ Pass `onWarning` to observe spec-compliance issues that do not prevent parsing:
141
+
142
+ ```typescript
143
+ import parse, { type ParseWarning } from '@echecs/pgn';
144
+
145
+ const games = parse(input, {
146
+ onWarning(warn: ParseWarning) {
147
+ console.warn(warn.message);
148
+ },
149
+ });
150
+ ```
151
+
152
+ `onWarning` receives a `ParseWarning` with the same fields as `ParseError`:
153
+ `message`, `offset`, `line`, `column`.
154
+
155
+ Currently fires for: missing STR tags (`Event`, `Site`, `Date`, `Round`,
156
+ `White`, `Black`, `Result`). Warnings are emitted in alphabetical key order.
157
+
158
+ The same option is accepted by `stream()`.
159
+
160
+ > **Note:** `onWarning` position fields (`offset`, `line`, `column`) are nominal
161
+ > placeholders — missing tags have no source location.
162
+
138
163
  ### PGN object
139
164
 
140
165
  ```typescript