Releases: JHXSMatthew/js-tail-recursion-opt-plugin
Releases · JHXSMatthew/js-tail-recursion-opt-plugin
Release list
🎉 v1.0.0 - First Stable Release
🎉 First Stable Release
Features
✅ Automatic Tail Call Optimization
- Converts tail-recursive functions to efficient loops at compile time
- Prevents stack overflow errors
- Zero runtime overhead
- Production-ready quality
✅ Comprehensive Support
- Function declarations and expressions
- Arrow functions (block and expression forms)
- Conditional tail calls (ternary operators, if/else statements)
- Logical expression tail calls (&&, ||)
- Nested conditions and complex patterns
✅ Developer Experience
- Full TypeScript support with type definitions
- Source maps for debugging
- Configurable optimization via annotations
- Clean, readable generated code
- Detailed error messages
Performance
📊 Benchmark Results:
- Handles 100,000+ iterations without stack overflow
- Performance near hand-written loops
- 0-2ms for complex recursive operations
| Test | Input | Unoptimized | Optimized | Result |
|---|---|---|---|---|
| Factorial | 10,000 | ❌ Stack overflow | ✅ 0ms | Crash prevention |
| Sum | 100,000 | ❌ Stack overflow | ✅ 1ms | Crash prevention |
| Fibonacci | 10,000 | ❌ Stack overflow | ✅ 2ms | Crash prevention |
See PERFORMANCE.md for full benchmark results.
Quality Assurance
✅ 100% Test Coverage - 40 comprehensive tests
✅ CI/CD - Automated testing on Node.js 18/20/22
✅ Code Quality - Codecov integration
✅ Type Safety - Full TypeScript definitions
Documentation
- 📖 README - Complete usage guide with examples
- 📝 Examples - Real-world code samples (Fibonacci, arrays, strings)
- 📊 Performance Report - Detailed benchmark results
- 🤝 Contributing Guide - How to contribute
- 📋 Changelog - Version history
Installation
npm install --save-dev js-tail-recursion-opt-pluginQuick Start
.babelrc
{
"plugins": ["js-tail-recursion-opt-plugin"]
}Example:
// Before optimization - causes stack overflow at ~10,000
function factorial(n, acc = 1) {
if (n <= 1) return acc;
return factorial(n - 1, n * acc);
}
// After optimization - works for any depth!
factorial(100000); // ✅ No stack overflow!What's New in 1.0.0
🎨 Code Generation Improvements
- Optimized single-parameter assignments (no temp variables)
- Cleaner multi-parameter handling with indexed temps
- More readable generated code
🗺️ Source Map Support
- Full debugging support
- Navigate to original source in stack traces
📚 Complete Documentation
- 3 real-world example files
- Comprehensive README
- Contributing guidelines
- Performance benchmarks
🔧 CI/CD Pipeline
- Automated testing on multiple Node versions
- Code coverage reporting
- Automated npm publishing on release
Browser Compatibility
Optimized code works in:
- ✅ Node.js 18+
- ✅ Modern browsers (ES2020+)
- ✅ Any environment that supports
whileloops
Credits
Built with ❤️ using:
- Babel for AST transformation
- TypeScript for type safety
- Jest for testing
- GitHub Actions for CI/CD
Links
- 🏠 Homepage
- 📝 Documentation
- 🐛 Issues
- 💬 Discussions
Thank You!
Thank you for trying js-tail-recursion-opt-plugin! If you find it useful, please ⭐ star the repo and share with others!