-
-
Notifications
You must be signed in to change notification settings - Fork 7
feat: Add token output format and refactor code architecture #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Refactors the codebase to support a cleaner architecture with generic type narrowing for output formats. Token output now returns the full TokensResult (including bg, fg, tokens) instead of just ThemedToken[][]. Architecture changes: - Extract output transformers to lib/output.ts - Extract options builder to lib/options.ts - Use generics for type-safe return values based on outputFormat - Component restricts outputFormat to 'react' | 'html' at compile time 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Remove _typeCheck assertions from entry points (unnecessary noise) - Replace `as any` casts with proper LooseHighlighter type - Add TODO.md documenting remaining architecture improvements 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 04bd967 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @AVGVSTVS96's task —— View job Code Review Complete ✅I've completed a comprehensive review of the token output format feature and architecture refactoring. This is an excellent implementation with clean architecture and solid engineering practices. Review Checklist
✅ Positive HighlightsExcellent Architecture Refactoring
Robust Implementation
Documentation & Developer Experience
🔍 Technical AnalysisPerformance Considerations✅ Efficient transformers: The transformer registry pattern in Type Safety✅ Excellent generic usage: Architecture Quality✅ Single Responsibility: Each module has a clear, focused purpose 📋 Requirements Verification
🚀 Minor Suggestions for Future Consideration
🎯 ConclusionThis is a high-quality implementation that demonstrates excellent software engineering practices. The architecture refactoring significantly improves code organization, and the token output feature is implemented with proper type safety and comprehensive testing. The code is clean, well-documented, and follows React/TypeScript best practices. Recommendation: ✅ Ready to merge - this PR enhances the library's capabilities while maintaining excellent code quality. |
f35dd9b to
117b480
Compare
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
117b480 to
6573664
Compare
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
6573664 to
b59b187
Compare
Split resolvers.ts into theme.ts and language.ts for better organization: - theme.ts: resolveTheme, toShikiOptions, getMultiThemeOptions, DEFAULT_THEMES - language.ts: resolveLanguage, isPlaintext helper - options.ts: simplified to import from theme.ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>

Adds a new
tokensoutput format that returns raw Shiki token data for custom rendering, plus refactors the codebase architecture for better maintainability.Token Output Format
The hook now supports three output formats:
'react'ReactNode'html'stringdangerouslySetInnerHTML'tokens'TokensResultUsage
Custom Rendering Example
When to Use Tokens
Architecture Refactor
lib/output.ts- Output transformation logic (React nodes, HTML, tokens)lib/options.ts- Shiki options builderoutputFormatoptionTest plan