文件历史

109 次代码提交

作者 SHA1 备注 提交日期
Phumrapee Limpianchop 1336074d43 fix(decode): prevent false array header detection for unquoted keys c… (#314)
CI / ci (push) Has been cancelled
Deploy Docs / Deploy Docs (push) Has been cancelled
* fix(decode): prevent false array header detection for unquoted keys containing brackets and colons

* test(decode): pin stream parity for an unquoted bracket-colon scalar

* chore(toon): bump `@toon-format/spec` to ^3.3.2

---------

Co-authored-by: Johann Schopplich <johann@schopplich.com>
2026-07-18 21:15:25 +02:00
Johann Schopplich 352a5b017d chore: release v2.3.1
Release + Publish / Release (push) Has been cancelled
2026-07-16 08:06:50 +02:00
Johann Schopplich e2003970dd chore: revert v2.3.1 version bump and quote build filter glob 2026-07-16 08:02:04 +02:00
Johann Schopplich 2013a7e09c chore: release v2.3.1 2026-07-16 07:26:53 +02:00
Johann Schopplich 9024af9e6a fix(decode): treat quoted spans as opaque in line classification 2026-07-16 07:22:49 +02:00
Johann Schopplich 27b65c2931 chore: upgrade dependencies 2026-07-15 23:07:17 +02:00
Chris Korhonen 94a2b7560b fix: harden encode and decode against prototype pollution (#316)
* fix: prevent prototype pollution during decode

* fix: preserve __proto__ during encode

* fix: ignore inherited tabular fields

* refactor: consolidate own-property helper and tighten __proto__ regression tests

* perf: fast-path setOwnProperty for non-__proto__ keys

* docs: trim object-utils remarks to rationale

* chore: update comment

---------

Co-authored-by: Johann Schopplich <johann@schopplich.com>
2026-07-15 22:58:34 +02:00
Johann Schopplich 09a7b38f2c test: cover malformed array length marker error context 2026-07-15 18:30:22 +02:00
Johann Schopplich 702301231c fix(decode): slice key-value rest at key token end offset 2026-07-15 18:30:22 +02:00
Johann Schopplich a956757de0 test: align canonical number form titles with file conventions
Drop the (§2 carve-out) suffix from the describe block — no other test in this file references spec sections. Switch it() titles from 'emits X' to 'encodes X as Y' to match the existing converts/normalizes verb pattern.
2026-05-21 10:39:05 +02:00
Johann Schopplich c0af15e592 chore: close v3.3 release cleanup
- docs/guide/format-overview.md: drop duplicated Type Conversions table; link to canonical api.md#type-normalization (drift surface 3 -> 2 tables)
- packages/toon/test/normalization.test.ts: add 7 §2 carve-out boundary tests (encode + round-trip per value); locks current conformance against future String(value) refactors
2026-05-21 10:33:14 +02:00
Johann Schopplich 5b66523e42 chore: align with spec v3.3
- bump @toon-format/spec to ^3.3.0; update SPEC.md pointer and badges
- docs: align number-form prose with §2 carve-out (canonical in [1e-6, 1e21) or zero; exponent form permitted outside)
- docs/reference/spec.md: add lowercase booleans/null to encoder checklist; add Java to Appendix F language list
- docs/reference/efficiency-formalization.md: drop overstated "matching TOON's requirement" claim
- packages/toon/README.md: drop "What's New in v3.2" section (now stale)

All 593 tests pass (packages/toon: 497, packages/cli: 96). Encoder remains conformant by default under the v3.3 §2 carve-out via String(value).
2026-05-21 10:10:20 +02:00
Johann Schopplich 3c66a1bead chore: release v2.3.0
Release + Publish / Release (push) Has been cancelled
2026-05-20 11:48:16 +02:00
Johann Schopplich 4b8aa998c3 chore(toon): bump @toon-format/spec to ^3.2.0
Matches the lockfile bumped in d6c64d2; CI's frozen-lockfile install
fails until the manifest catches up. The dep was skip-worktree'd during
the v3.2 development window.
2026-05-20 11:42:26 +02:00
Johann Schopplich 1d23fa36d2 chore: fix linting issues 2026-05-20 11:38:55 +02:00
Johann Schopplich dd856fe590 docs: align prose with v3.2 spec wording
- packages/toon/README.md: drop two v3.1 bullets that crept into the
  "What's new in v3.2" list (canonical empty-array form and \uXXXX
  escape both landed in v3.1).
- docs/reference/api.md: rename "Delimiter mismatches" entry to
  "Header delimiter mismatch" and cite §14.2 – the previous wording
  invited the false reading that non-active delimiter chars in row
  data are an error. Add §14.4 cross-ref to the duplicate-key entry.
- docs/reference/spec.md: include \uXXXX in the §7 escape list; soften
  the charset MUST claim to match §17; en-dash the §-ranges in the
  glance table.
- docs/reference/syntax-cheatsheet.md: rename "Strings with Active
  Delimiter" to "Strings Containing Delimiters" and distinguish
  active-delim (array scope) from document-delim (object field
  values) per §11.1.
- docs/guide/format-overview.md: same active-vs-document distinction
  in the delimiter paragraph; drop incorrect "strict mode" qualifier
  from the unknown-escape error claim (§7.1 rejects unconditionally);
  trim redundant "with leading zeros" parenthetical.
- docs/guide/llm-prompts.md: fix two broken anchors
  (/reference/api#decode → #decode-input-options, similar for
  encodelines); use -o instead of --output for CLI example
  consistency.
- packages/cli/README.md: enumerate what --no-strict actually skips
  in the options table; replace "delimiter consistency" with the
  more specific "header delimiter mismatches" in the Lenient Decoding
  prose to avoid the same false reading the api.md fix addresses.
2026-05-20 10:57:48 +02:00
Johann Schopplich d514942fc0 fix(decode): reject whitespace gap in array header per §6
The bracket-to-colon and bracket-to-fields checks previously trimmed
before comparing, so `items[2] :` and `items[2] {a,b}:` slipped through
strict mode. Tighten both checks to reject any non-empty gap and
distinguish whitespace-only gaps in the error message.
2026-05-20 09:32:55 +02:00
Johann Schopplich 979152508d docs(toon): bump SPEC badge to v3.2, add What's new section, fix §17 anchor
The README now flips the shields.io SPEC badge to v3.2 (the conformance
work just landed), adds a six-bullet "What's new in v3.2" subsection
between Key Features and Media Type, and fixes the stale §18.2 anchor
in the Media Type paragraph to point at §17 IANA Considerations.
2026-05-20 07:04:50 +02:00
Johann Schopplich 1446cae85d docs(cli): widen --no-strict description for v3.2 semantics
In v3.2, --no-strict no longer just skips count/indent/delimiter
validation - it also applies last-write-wins on duplicate sibling
keys and tolerates malformed array headers as plain key-value lines.
The previous "faster processing" framing didn't reflect any of this.

- Lenient Decoding sections in cli docs and packages/cli/README spell
  out which checks the decoder stops enforcing
- Options table description shifts from "Disable strict validation"
  to "Skip decode validation; last-write-wins on duplicate keys"
- --strict help text in the CLI reads "Strict decode validation
  (disable with --no-strict)"
- §17 IANA anchor fix in the cli docs media-type note
2026-05-20 07:04:41 +02:00
Johann Schopplich bc1ae4e194 docs: refresh decode/encode JSDoc examples
Updates the JSDoc `@example` blocks for `encode` and `decode` to reflect
v3.2 output: tabular header is `users[2]{id}:` not `users[]:`, and
empty arrays render as `tags: []`.
2026-05-19 21:11:36 +02:00
Johann Schopplich a13dcb5eec feat(decode): strict-mode error coverage for §6/§9.1/§14
Widens decoder behavior to match v3.2 strict-mode normative rules:

- Accepts the canonical `[]` empty-array form on all decode paths
  (root, key-value, list-item-after-hyphen — sync and async)
- §6: parseBracketSegment now uses an anchored regex for the length
  (rejects 0x10, 01, 1e5, -0, etc.) and throws in strict mode on
  malformed bracket segments
- §14.2: parser scans the fields segment for any unquoted candidate
  delimiter that mismatches the bracket-declared one and throws in
  strict mode
- §14.4: assertNoDuplicateKey rejects duplicate sibling keys in strict
  mode at every nested object site (root, child objects, list-item
  objects, tabular-first list items)
- Strict flag now threads through parseArrayHeaderLine so header
  diagnostics surface as decode errors rather than silent fallthrough
- Multi-line root that starts with a bare token now errors in strict
  mode with a clear diagnostic
2026-05-19 21:11:25 +02:00
Johann Schopplich e6d97d232e feat(encode): emit canonical empty-array form key: []
Per §9.1 v3.2, empty arrays MUST emit as `key: []` (and `- []` after a
list-item marker), not as `key[0]:`. The header-only emission is now
reserved for non-empty arrays.
2026-05-19 21:11:10 +02:00
Johann Schopplich 178207636d fix(decode): support \uXXXX escape per §7.1
Per the v3.2 spec, control characters U+0000–U+001F outside of \n, \r, \t
encode as \uXXXX escapes and decode them back. Lone surrogates are rejected.

- escapeString emits \uXXXX for any remaining U+0000–U+001F byte
- unescapeString recognises \uXXXX (4 hex digits) and rejects D800–DFFF
- isSafeUnquoted widens the control-char check to cover the full range
2026-05-19 21:10:53 +02:00
Father of chain caa59ae4dc docs: surface tooner mcp proxy across readme and docs site (#283)
Adds the [Tooner](https://github.com/chaindead/tooner) MCP proxy entry to the Tools & Integration list in the package README and to docs/ecosystem/tools-and-playgrounds.md.
2026-05-17 18:55:28 +02:00
swetasanghi2004-prog 90a04bd34b feat(docs): add YAML input to Playground with tests (#303)
* feat(docs): add YAML input to Playground with tests

- Add input format selector and YAML parsing (YAML 1.2, merge keys off)
- Extract parse/stringify helpers for testability and SPEC-aligned encoding
- Add Vitest for docs package and playground parse tests
- Update Playground copy in package README and ecosystem docs

* refactor(docs): simplify Playground YAML support

- Inline parse/stringify helpers into the component, drop the separate
  parse-input module and its tests
- Rename input state from `jsonInput`/`formattedJson`/`jsonTokens` to
  `inputText`/`formattedInput`/`inputTokens` so names no longer lie when
  YAML is selected
- Hide the JSON Baseline selector in YAML mode and make the token-count
  tooltip conditional on input format
- Store input under `state.input` with a fallback read of legacy
  `state.json` so existing share URLs keep working
- Drop redundant YAML parse options (merge/version match library
  defaults); use lineWidth: 0 for editor display so long scalars do not
  fold mid-sentence
- Remove the duplicated vitest devDep, docs vitest.config.ts, and `test`
  script – the playground is verified through the dev server

* chore(docs): tighten Playground wording and drop empty-string fallback

- "in real-time" → "in real time" (real-time only hyphenates as a
  compound modifier before a noun)
- Header copy now matches the ecosystem page: "Convert JSON or YAML to
  TOON in real time"
- Token-count tooltip unified across input formats; the JSON baseline
  selector is right next to it and already communicates the format
- Drop `?? ''` fallback on state.input — decodeState already gates on
  successful JSON parse; the chain falls through to the legacy
  state.json field

---------

Co-authored-by: Sweta <sweta@Swetas-MacBook-Air.local>
Co-authored-by: Johann Schopplich <johann@schopplich.com>
2026-05-17 18:04:07 +02:00
Johann Schopplich dd70538e0b chore: release v2.2.0
Release + Publish / Release (push) Has been cancelled
2026-05-08 23:18:34 +02:00
Johann Schopplich 4819128859 docs: harmonize prose and fix tab delimiter examples 2026-05-08 23:17:10 +02:00
Johann Schopplich 476e4a1784 refactor: variable name 2026-05-08 22:30:55 +02:00
Johann Schopplich 18864cbd1f docs: add error handling guide 2026-05-08 22:27:28 +02:00
Johann Schopplich d826be75d7 chore: upgrade dependencies 2026-05-08 22:23:54 +02:00
Johann Schopplich 3d99b7b9ae feat(cli): render decode error with line context, source, and caret 2026-05-08 22:18:43 +02:00
Johann Schopplich 1181b14bd7 feat: throw ToonDecodeError on error 2026-05-08 22:03:25 +02:00
Johann Schopplich 0f0b1b3217 test: remove unneeded comments 2026-05-08 22:03:03 +02:00
Johann Schopplich 7dabdb303b test: remove duplications 2026-05-08 21:53:18 +02:00
Johann Schopplich 6edc9ac5e7 chore: upgrade dependencies 2026-03-06 07:52:26 +01:00
Johann Schopplich 47c6d3d712 chore: update README with benchmarks for Gemini 3 Flash and Grok 4.1 2026-03-03 15:39:56 +01:00
Eugene Bann a42c87bdb6 docs: fix link to full list of implementations (#282) 2026-02-25 15:32:40 +01:00
Johann Schopplich 6f699bd4f5 fix(decode): reject array headers with trailing content between bracket and colon 2026-02-23 10:27:22 +01:00
Johann Schopplich c6ab05141f fix: preserve empty-string keys in array headers across encode/decode (closes #281) 2026-02-22 19:06:45 +01:00
Johann Schopplich 8073392822 refactor(cli): simplify args typings 2026-02-19 14:26:04 +01:00
Johann Schopplich 932f26189e test(cli): update tests for citty v0.2.x 2026-02-19 14:25:10 +01:00
Johann Schopplich 2a335341cc docs: update implementations section in README 2026-02-19 14:18:15 +01:00
Johann Schopplich 68f66bb5d6 chore: upgrade dependencies 2026-02-19 14:13:39 +01:00
Johann Schopplich 9bb97ce103 perf: remove tsx usage 2026-02-15 10:16:40 +01:00
Johann Schopplich b1413925b7 chore: simplify tsdown config 2026-01-23 08:17:45 +01:00
Mischa Sigtermans cc0a1b8e69 docs: update Laravel implementation to spec-compliant package (#266) 2026-01-21 16:34:19 +01:00
Yoshifumi Kawai 626ea62889 docs: add one more C# implmentation (ToonEncoder) 2026-01-16 18:57:37 +01:00
Davide Usberti f15619de6c docs: add TOONc (TOON library for C) to the community implementations (#255)
* Add C implementation link to community section

* Add C implementation to ecosystem documentation
2026-01-03 18:42:55 +01:00
Johann Schopplich 189bbfa9bc chore: upgrade dependencies 2025-12-15 14:26:31 +01:00
Johann Schopplich bbd7e8cf58 docs: add Swift implementation to official and community lists 2025-12-07 17:40:02 +01:00