Skip to content

v2.3.8

Choose a tag to compare

@github-actions github-actions released this 30 Aug 21:05
· 51 commits to release since this release

🚀 Release v2.3.8 - CJS/ESM Compatibility & Release Automation Fixes

🐛 Critical Bug Fixes

  • esm/cjs: resolve dual-mode compatibility issues for CommonJS imports
  • automation: fix release automation causing v0.0.0 version tags
  • typescript: improve type safety and eliminate any type usage
  • exports: correct package.json exports mapping for dual module support

🔧 Technical Improvements

  • CJS/ESM Dual Mode: Fixed package.json exports to properly map CommonJS requires to .cjs files and TypeScript declarations to .d.cts
  • 🏗️ Build System: Maintained tsup bundler configuration for optimized dual builds (ESM + CJS)
  • 🔄 Version Sync: Fixed sync-versions.js script preventing v0.0.0 releases through improved validation
  • 📁 Type Safety: Replaced any type usage with proper TypeScript annotations
  • 🧹 Code Quality: Preserved all context analysis functionality with ESLint suppressions and TODO comments
  • 📦 API Consistency: Added ProfanityFilter alias export for better API compatibility

🎯 Issues Resolved

  • Closes #69: CJS imports failing with "CJSResolvesToESM" error due to incorrect exports configuration
  • ✅ CommonJS users can now import without requiring dynamic imports
  • ✅ TypeScript declarations properly resolve for both CJS (.d.cts) and ESM (.d.ts)
  • ✅ Release automation no longer generates v0.0.0 tags due to version parsing bugs
  • ✅ Cross-platform version synchronization between JavaScript and Python packages

📋 Fixed Export Configuration

"exports": {
  ".": {
    "require": {
      "types": "./dist/index.d.cts",
      "default": "./dist/index.cjs"
    },
    "import": {
      "types": "./dist/index.d.ts", 
      "default": "./dist/index.js"
    }
  }
}

🔍 Before & After

Before v2.3.8:

// This would fail with CJSResolvesToESM error
const { Filter } = require('glin-profanity');

After v2.3.8:

// Now works perfectly in CommonJS
const { Filter } = require('glin-profanity');

// ESM continues to work as expected
import { Filter } from 'glin-profanity';

📦 Installation

JavaScript/TypeScript:

npm install glin-profanity@latest  # v2.3.8

Python:

pip install glin-profanity  # v2.3.8 (synchronized)

🔧 For Developers

  • Dual Module Support: Both CommonJS and ESM imports now work seamlessly
  • TypeScript Declarations: Proper .d.cts files for CommonJS and .d.ts for ESM
  • Build Reliability: Release automation no longer fails with version parsing errors
  • Code Quality: Enhanced type safety while preserving all functionality
  • API Compatibility: ProfanityFilter alias added for consistent naming

🏗️ Technical Details

  • Build System: Modern tsup bundler with dual CJS/ESM output
  • Version Management: Enhanced sync-versions.js with proper validation
  • Type Safety: Eliminated any type usage with proper TypeScript annotations
  • ESLint: Fixed configuration and added suppressions with TODOs for future enhancements
  • Context Analysis: Preserved all NLP functionality with proper error handling

📋 Package Information

  • npm version: 2.3.8 (latest tag)
  • PyPI version: 2.3.8 (synchronized)
  • Build system: Modern tsup bundler with dual module support
  • TypeScript: Full type definitions for both CJS and ESM
  • Cross-platform: Identical APIs for JavaScript and Python
  • Compatibility: Node.js 18+, Browser environments, CommonJS and ESM projects

🔗 Links


🤖 This release was automatically generated and includes comprehensive CJS/ESM compatibility fixes