benchmark formatting

This commit is contained in:
Stephen Grider 2025-06-20 16:37:27 -06:00
parent 0643d25ca3
commit 92451c32bc
3 changed files with 27 additions and 13 deletions

View file

@ -5,12 +5,15 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## Commands
**Testing:**
- `npm test` - Run all tests (linting, unit tests, coverage, TypeScript definitions)
- `npx ava test/<specific-test-file>.js` - Run a specific test file
- `npx xo` - Run linting only
- `npx tsd` - Run TypeScript definition tests only
NO LINTING. DONT ATTEMPT OT LINT
**Benchmarking:**
- `npm run bench` - Run performance benchmarks
## Architecture
@ -18,16 +21,19 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
Chalk is a zero-dependency terminal string styling library built as a pure ESM module. Key architectural elements:
1. **Core Files:**
- `source/index.js` - Main entry point with the chalk factory and chainable API implementation
- `source/utilities.js` - Helper functions for string manipulation and color conversion
- `source/vendor/` - Vendored dependencies (ansi-styles and supports-color) to avoid external dependencies
2. **Internal Symbols:**
- `GENERATOR` - Manages chalk instance creation and configuration
- `STYLER` - Handles style application and chaining
- `IS_EMPTY` - Tracks empty string optimization
3. **API Design:**
- Uses ES6 Proxy for dynamic property access (e.g., `chalk.red.bold`)
- Chainable API with lazy property definition for performance
- Supports nested styles with proper ANSI escape code management
@ -45,4 +51,4 @@ Chalk is a zero-dependency terminal string styling library built as a pure ESM m
- All style properties are dynamically generated via Proxy - there's no hardcoded list
- Performance is critical - run benchmarks before/after changes to core functionality
- The codebase uses symbols for private properties to prevent collisions
- Template literal processing has special handling for newlines and empty strings
- Template literal processing has special handling for newlines and empty strings