v2.11.0
release: v2.11.0 (#72)
release: v2.11.0 (#72)
Release: v2.11.0 - Smart Flattening Enhancements and Path Resolution Fixes
🚀 MAJOR FEATURE RELEASE - ENHANCED ADDAPI FLATTENING AND NODE.JS COMPATIBILITY
• Implement Rule 11 addapi.mjs special file pattern enabling seamless runtime plugin loading and API namespace extensions
• Extend Rule 1 filename-matches-container flattening to addApi context preventing redundant nesting in dynamically loaded modules
• Fix critical addApi content preservation ensuring proper merging when multiple addApi calls target the same API path
• Update minimum Node.js version from 16.4.0 to 16.20.2 addressing stack trace API regression in Node 16.4-16.19
• Add comprehensive Rule 12 module ownership testing validating selective API overwrite patterns across 17 configurations
✨ SMART FLATTENING ARCHITECTURE AND CAPABILITIES
• Rule 11 Implementation: Files named addapi.mjs automatically flatten regardless of autoFlatten setting for plugin-style architecture
• Rule 1 Extension: Filename-matches-container flattening now works in addApi runtime context maintaining consistent API structure
• addApi Content Preservation: Fixed merging logic capturing and restoring existing target content preventing data loss across multiple addApi calls
• Bound Target Consistency: Proper synchronization between currentTarget and currentBoundTarget ensuring live-binding correctness
• Enhanced Decision Logic: Smart flattening decisions work identically in both initial load and addApi contexts
🔧 TECHNICAL IMPLEMENTATION AND INFRASTRUCTURE
• Path Resolution Enhancement: resolve-from-caller.mjs algorithm improved to handle closures through helper modules and nested function calls
• Stack Trace Analysis: Enhanced pickPrimaryBaseFile() to skip ALL node:* modules and internal files finding user code accurately
• Node.js Compatibility: Minimum version updated to 16.20.2 due to CallSite API regression in 16.4-16.19 affecting async context stack traces
• Module Ownership System: Rule 12 comprehensive testing across 17 configurations validating forceOverwrite and allowApiOverwrite interactions
• TypeScript Exclusions: api_tests directory excluded from type generation reducing noise from test-only code patterns
📚 DOCUMENTATION IMPROVEMENTS AND CONSISTENCY
• Changelog Enhancement: v2.11.md documents Rule 11 addapi pattern, Rule 1 extension, content preservation fixes, and Node.js version update
• README Updates: Minimum Node.js version updated to 16.20.2 with migration guidance for users on 16.4-16.19
• CI Workflow Updates: All workflows (ci.yml, publish.yml, release.yml) updated to test Node.js 16.20.2-24 matrix
• Context Propagation Docs: Updated performance notes reflecting Node.js 16.20+ optimization characteristics
• API Rules Documentation: Complete coverage of Rule 11 and Rule 1 extension with examples and use cases
🛠️ VERSION MANAGEMENT AND TYPE SYSTEM
• Automated version management: package.json engines.node updated to >=16.20.2 with clear migration path
• Type system cleanup: Removed 280+ unnecessary type definition files for test directories reducing package bloat
• Import cleanup: Removed unused reference imports from api_adb_test files improving code clarity
• Debug logging optimization: Removed unnecessary || {} fallbacks from variables guaranteed to be objects
• Code quality improvements: Fixed Copilot warnings about always-true conditions in debug statements
Technical Implementation:
- Rule 11 addapi.mjs special handling with automatic flattening independent of autoFlatten configuration
- Rule 1 extension to addApi context via enhanced getFlatteningDecision() recognizing container-matching patterns
- addApi content preservation with super early capture before any proxy materialization preventing data loss
- Path resolution algorithm enhancements handling closures, nested calls, and AsyncLocalStorage contexts across Node versions
- Comprehensive Rule 12 testing infrastructure validating module ownership and selective overwrite patterns
Use Case Examples:
- Plugin systems: Runtime plugin loading with addapi.mjs pattern enabling clean API namespace extensions
- Hot reloading: Dynamic API updates during development with preserved existing content across addApi calls
- Modular extensions: Clean extension of existing API surfaces using filename-matches-container flattening
- Multi-module projects: Selective API overwrites using module ownership tracking and forceOverwrite patterns
- Cross-version compatibility: Support for Node.js 16.20.2+ through 24.x with consistent stack trace behavior
Impact Assessment:
Enhanced capabilities - smart flattening enhancements enable cleaner plugin architectures and runtime API extensions; improved reliability through addApi content preservation preventing data loss; better Node.js compatibility addressing stack trace regressions in 16.4-16.19; comprehensive testing coverage with Rule 12 validation across 17 configurations; reduced package size through type system cleanup.
Breaking Changes:
- Minimum Node.js version updated from 16.4.0 to 16.20.2 (users on 16.4-16.19 must upgrade or use slothlet@2.10.0)
- No API changes - existing code continues working on Node.js 16.20.2+
Testing Coverage:
Comprehensive test suite with Rule 12 comprehensive testing across 17 configurations, path resolution tests with nested directories and closure patterns, addApi content preservation validation, smart flattening tests for Rule 11 and Rule 1 extension, cross-mode compatibility testing (lazy/eager), and Node.js version matrix testing (16.20.2-24).
Files Changed: 300+ files with smart flattening enhancements, path resolution fixes, type system cleanup, and documentation updates
Commits: Multiple commits including addApi fixes, path resolution enhancements, Node.js version update, type cleanup, and Rule 12 testing
Performance Impact: Minimal - smart flattening decisions cached, path resolution optimized, type system reduced, no runtime overhead
Production Ready: Full test coverage, comprehensive Rule 12 validation, cross-Node version compatibility, backward compatible API
This release establishes slothlet's smart flattening capabilities for runtime API extensions while addressing critical Node.js compatibility issues and improving code quality through comprehensive cleanup and testing.
Full Changelog: v2.10.0...v2.11.0
Co-authored-by: Nate - CLDMV Shinrai@users.noreply.github.com