Files
bun.sh/test/js
Claude Bot 427bb66604 Add Bun.TOON API for Token-Oriented Object Notation
Implements basic infrastructure for Bun.TOON.parse() and Bun.TOON.stringify().
TOON is a compact, human-readable format designed for passing structured data
to Large Language Models with significantly reduced token usage.

This commit adds:
- Phase 1 complete: Full API wiring for Bun.TOON object
- Bun.TOON.stringify() with support for:
  - Primitives (null, boolean, number, string)
  - Proper quote detection and escaping
  - Space parameter support (number or string)
  - Circular reference detection
- Bun.TOON.parse() stub (returns SyntaxError for now)
- Test suite with passing tests for stringify primitives
- Analytics tracking for toon_parse and toon_stringify

Files added:
- src/bun.js/api/TOONObject.zig: API wrapper calling into interchange layer
- src/interchange/toon.zig: Parser and stringifier implementation
- test/js/bun/toon/toon.test.ts: Test suite

Modified files:
- src/bun.js/bindings/BunObject.cpp: Added TOON property callback
- src/bun.js/bindings/BunObject+exports.h: Export TOON getter
- src/bun.js/api/BunObject.zig: Wire up TOON lazy property
- src/bun.js/api.zig: Export TOONObject
- src/interchange.zig: Export toon module
- src/analytics.zig: Add toon_parse and toon_stringify metrics

Phase 2 remaining: Full TOON parser and advanced stringifier features
(objects, arrays, tabular format) to be implemented in follow-up PRs.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 18:16:53 +00:00
..
2025-10-26 14:29:31 -07:00