Open
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #28
This commit implements support for React.js and ink (React for CLI) as built-in modules in use-m, addressing issue #28. ## Features Added - **React.js Support**: Built-in modules for `react`, `react-dom`, and `react/jsx-runtime` - **ink Support**: Built-in module for `ink` (React for CLI applications) - **Environment Detection**: Automatic browser vs Node.js environment detection - **CDN Fallbacks**: Browser environments automatically fall back to CDN loading - **Error Handling**: Graceful error messages when dependencies aren't installed ## Implementation Details - Added React.js and ink modules to `supportedBuiltins` in all use-m variants (use.js, use.mjs, use.cjs) - Browser environments try global React/ReactDOM first, then fall back to esm.sh CDN - Node.js environments import from locally installed packages with helpful error messages - ink is Node.js-only (returns null for browser environments) ## Examples and Tests - Added comprehensive examples for both React.js and ink usage - Created browser and Node.js React examples with different rendering approaches - Added interactive ink CLI examples with user input handling - Comprehensive test coverage for both React.js and ink built-in modules - Tests handle environments where packages aren't installed gracefully ## Documentation - Updated README.md with React.js and ink usage examples - Added dedicated example directories with detailed READMEs - Updated package version to 8.14.0 for this feature release 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚀 Summary
This pull request adds comprehensive built-in module support for React.js and ink (React for CLI applications) to use-m, enabling developers to use these popular frameworks without explicit dependency management.
📋 Issue Reference
Fixes #28
✨ Features Added
react,react-dom, andreact/jsx-runtimeink(React for CLI applications)🔧 Implementation Details
Built-in Module Support
Environment-Specific Behavior
📁 Files Added/Modified
Core Implementation
use.js,use.mjs,use.cjs- Added React.js and ink tosupportedBuiltinspackage.json- Version bump to 8.14.0Examples & Documentation
examples/react/- Node.js and browser React.js examplesexamples/ink/- CLI application examples with interactive featuresREADME.md- Updated with React.js and ink usage documentationTesting
tests/builtin-react.test.*- Comprehensive React.js built-in module teststests/builtin-ink.test.*- ink built-in module tests with environment detection🎯 Usage Examples
React.js in Browser
React.js in Node.js (SSR)
ink CLI Applications
✅ Testing
💡 Benefits
🔄 Migration
This is a purely additive change - no breaking changes to existing functionality. Users can immediately start using:
🤖 Generated with Claude Code