Skip to content

v1.1.0 - Dual Module Support (CommonJS + ESM)

Choose a tag to compare

@JeromeErasmus JeromeErasmus released this 22 Sep 08:48
· 69 commits to main since this release
0461b2d

πŸš€ Extended ADF Markdown Parser v1.1.0

✨ Major Features

πŸ”„ Dual Module Support

  • CommonJS: const { Parser } = require('extended-markdown-adf-parser');
  • ES Modules: import { Parser } from 'extended-markdown-adf-parser';
  • Automatic Selection: Package automatically chooses the right format for your environment
  • Zero Configuration: Works out-of-the-box with both module systems

πŸ›‘οΈ Enhanced Error Handling

  • Graceful Degradation: Better error recovery by default
  • Strict Mode: Optional strict validation when needed
  • Better Error Messages: More descriptive error reporting
  • Fallback Strategies: Improved handling of malformed input

πŸ“¦ Build System Improvements

  • Dual Builds: Separate CommonJS (.js) and ESM (.mjs) outputs
  • Tree Shaking: ESM builds support optimal bundling
  • TypeScript: Complete type definitions for both module systems
  • Modular Imports: Sub-module exports for smaller bundle sizes

πŸ”§ Technical Improvements

Package Exports Structure

dist/
β”œβ”€β”€ index.js          # CommonJS main entry
β”œβ”€β”€ index.mjs         # ES Modules main entry  
β”œβ”€β”€ index.d.ts        # TypeScript definitions
β”œβ”€β”€ streaming.js/.mjs # Streaming module (both formats)
β”œβ”€β”€ performance.js/.mjs # Performance module (both formats)  
└── errors.js/.mjs    # Error handling (both formats)

Usage Examples

ES Modules (Recommended):

import { Parser } from 'extended-markdown-adf-parser';
import { StreamingParser } from 'extended-markdown-adf-parser/streaming';

CommonJS:

const { Parser } = require('extended-markdown-adf-parser');
const { StreamingParser } = require('extended-markdown-adf-parser/streaming');

TypeScript:

import { Parser, type ADFDocument, type ConversionOptions } from 'extended-markdown-adf-parser';

πŸ“š Documentation Updates

  • Complete Module System Guide: Comprehensive documentation for both CommonJS and ESM
  • Installation Verification: New test scripts for both module systems
  • Troubleshooting: Enhanced guides for module system issues
  • Framework Integration: Updated examples for React, Vue, Express, and more
  • Advanced Configuration: Bundle optimization and lazy loading techniques

πŸ“Š Quality Metrics

  • βœ… Tests: 67/67 passing (100% success rate)
  • βœ… Coverage: 18/18 validation checks passed
  • βœ… Performance: Avg 0.48ms processing time
  • βœ… Memory: 1000+ documents processed efficiently
  • βœ… Compatibility: Works with Node.js 16+ (CommonJS) and 18+ (ESM)

🚨 Breaking Changes

  • Package now defaults to graceful error handling instead of strict validation
  • Use { strict: true } option for previous strict behavior
  • Enhanced TypeScript types may require updates in strict TypeScript projects

πŸ”„ Migration Guide

From v1.0.x to v1.1.0

No changes required for basic usage - both module systems work automatically:

// This continues to work exactly as before
import { Parser } from 'extended-markdown-adf-parser';
// OR
const { Parser } = require('extended-markdown-adf-parser');

For strict error handling (if you relied on previous strict behavior):

const parser = new Parser({ strict: true });

🌟 Framework Compatibility

  • βœ… Node.js: 16+ (CommonJS), 18+ (ESM)
  • βœ… TypeScript: 4.5+
  • βœ… Webpack: 5+ (automatic ESM selection)
  • βœ… Vite/Rollup: Full ESM support
  • βœ… Next.js: Both App Router and Pages Router
  • βœ… React: Create React App, Vite, custom builds
  • βœ… Vue: Vue CLI, Vite, Nuxt
  • βœ… Express: Both CommonJS and ESM setups
  • βœ… Serverless: Vercel, AWS Lambda, Netlify

Full Changelog: v1.0.7...v1.1.0