Skip to content

Releases: dwekat/nodeswarm

v2.1.0

21 Mar 14:06
926aba9

Choose a tag to compare

v2.0.2

23 Nov 08:04
v2.0.2
5375136

Choose a tag to compare

Changelog

2.0.2

Patch Changes

  • fe22825: - Update @babel/traverse from 7.23.0 to 7.28.5
    • Add Prettier and EditorConfig configuration for consistent code formatting

2.0.1

Patch Changes

  • Add Buy Me A Coffee button to README

2.0.0

Major Changes

  • ad1eede: Production-ready v1.0.0 release with enterprise features:
    • Job timeout & cancellation with AbortController support
    • Priority queue system (HIGH, NORMAL, LOW priorities)
    • Worker health monitoring and automatic restart on failure
    • Real-time metrics and performance monitoring
    • Auto-scaling thread pool with configurable thresholds
    • Strict mode security validation (enabled by default)
    • Comprehensive benchmark suite vs competitors (Piscina, Workerpool, Tinypool)
    • Full TypeScript strict mode with zero linter errors
    • 20+ new comprehensive tests covering all features
    • Complete documentation overhaul (README, SECURITY, CHANGELOG, CONTRIBUTING)
    • Advanced examples for all features
    • Event-driven pool closing (replaced inefficient polling)
    • Enhanced error handling with full stack trace preservation

Minor Changes

  • Add full ESM (ES Modules) and CommonJS dual module support:
    • Dual build system with separate CJS and ESM outputs
    • Proper package.json exports field with conditional exports
    • Module type hints in dist folders for better resolution
    • Universal worker path resolution for both module systems
    • Compatibility tests for both ESM and CJS
    • Tree-shaking support in ESM builds
    • Works seamlessly in modern bundlers (Vite, Rollup) and legacy tools (Webpack, Node CJS)
    • Fully backward compatible - existing CommonJS users unaffected

1.1.0

Minor Changes

  • Full ESM (ES Modules) support: Package now supports both ESM and CommonJS
  • Dual build system: Separate builds for CJS (dist/cjs) and ESM (dist/esm) with proper conditional exports
  • Package.json exports field: Proper conditional exports for modern tooling and tree-shaking
  • Module type hints: package.json files in dist folders for better module resolution
  • Compatibility tests: Dedicated ESM and CJS compatibility test suites
  • Universal worker path resolution: Works seamlessly in both ESM and CJS environments

Changed

  • Build system now outputs three separate builds: dist/cjs, dist/esm, dist/types
  • Worker path resolution improved to detect and handle both module systems automatically
  • Package exports configured for optimal tree-shaking in ESM
  • Documentation updated with both ESM and CJS usage examples

Technical Details

  • Main entry point (require): ./dist/cjs/index.js
  • Module entry point (import): ./dist/esm/index.js
  • TypeScript types: ./dist/types/index.d.ts
  • Requires Node.js 12.20+ for conditional exports support

Benefits

  • ✅ Modern ESM support for Vite, Rollup, and modern bundlers
  • ✅ Tree-shaking support in ESM builds
  • ✅ Backward compatible with CommonJS projects
  • ✅ Future-proof module architecture
  • ✅ Works in both Next.js App Router (ESM) and Pages Router (CJS)

1.0.0

Major Changes

  • Production-ready v1.0.0 release with enterprise features:
    • Job timeout & cancellation with AbortController support
    • Priority queue system (HIGH, NORMAL, LOW priorities)
    • Worker health monitoring and automatic restart on failure
    • Real-time metrics and performance monitoring
    • Auto-scaling thread pool with configurable thresholds
    • Strict mode security validation (enabled by default)
    • Comprehensive benchmark suite vs competitors (Piscina, Workerpool, Tinypool)
    • Full TypeScript strict mode with zero linter errors
    • 20+ new comprehensive tests covering all features
    • Complete documentation overhaul (README, SECURITY, CHANGELOG, CONTRIBUTING)
    • Advanced examples for all features
    • Event-driven pool closing (replaced inefficient polling)
    • Enhanced error handling with full stack trace preservation

Patch Changes

  • c546e8a: Add changesets for version management and changelog generation
  • cd77166: Update dev dependencies
  • 36f33cf: Update repository URL to dwekat/nodeswarm

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.

[1.0.0] - 2025-11-19

Added

Core Features

  • Job Timeout & Cancellation: Support for job timeouts and cancellation via AbortController
  • Priority Queue System: HIGH, NORMAL, and LOW priority levels for job scheduling
  • Worker Health Monitoring: Automatic health checks and worker restart on failure
  • Metrics & Monitoring: Comprehensive metrics tracking (completed/failed jobs, execution times, queue depth)
  • Auto-scaling: Optional dynamic pool scaling based on queue depth
  • Strict Mode Validation: Security validation to detect potentially unsafe code patterns

API Enhancements

  • Thread options support: { timeout, signal, priority }
  • getMetrics() method for real-time pool statistics
  • resetMetrics() method to clear metrics
  • Enhanced error handling with full stack trace preservation
  • Better TypeScript type inference and constraints

Developer Experience

  • Comprehensive benchmark suite with 9 different workload types
  • Comparison benchmarks against Piscina, Workerpool, and Tinypool
  • Example files (basic and advanced usage patterns)
  • Full TypeScript strict mode support
  • Extensive test coverage for all features

Documentation

  • Complete SECURITY.md with usage guidelines
  • Enhanced README with feature documentation
  • API reference with JSDoc comments
  • Migration guide for breaking changes

Changed

Breaking Changes

  • thread() method now supports overloaded signatures with options parameter
  • Error messages now include full context (message, stack, name)
  • Minimum Node.js version requirement for AbortController support
  • TypeScript strict mode enabled (affects type checking)

Improvements

  • Replaced polling-based close() with event-driven approach
  • Better error serialization across worker boundary
  • More efficient queue management with priority support
  • Enhanced worker lifecycle management
  • Improved memory efficiency

Fixed

  • Import path bug in worker.ts ("ThreadPool""./ThreadPool")
  • Test bug in high load test (incorrect Array.fill usage)
  • Error handling now preserves full error context
  • Worker threads properly restart after crashes

Security

  • Input validation for functions and arguments
  • Strict mode enabled by default to block unsafe patterns
  • Detection of dangerous code patterns (require, eval, process access)
  • Comprehensive security documentation

[0.0.1] - 2024-XX-XX

Added

  • Initial release
  • Basic thread pool functionality
  • Simple job queue
  • Worker thread management
  • Basic error handling

Upgrade Guide

From 0.x to 1.0

Thread Method Signature

// Old (still supported)
pool.thread((x) => x * 2, 5);

// New with options
pool.thread({ timeout: 1000 }, (x) => x * 2, 5);
pool.thread({ priority: Priority.HIGH }, (x) => x * 2, 5);

Error Handling

Errors now include full stack traces automatically. No code changes required.

Strict Mode

Strict mode is enabled by default. To disable:

const pool = new ThreadPool({ strictMode: false });

Metrics API

const metrics = pool.getMetrics();
console.log(metrics.completedJobs, metrics.avgExecutionTime);

See README.md for complete documentation.

v2.0.1

22 Nov 12:17
v2.0.1
fa2e47c

Choose a tag to compare

Changelog

2.0.1

Patch Changes

  • Add Buy Me A Coffee button to README

2.0.0

Major Changes

  • ad1eede: Production-ready v1.0.0 release with enterprise features:
    • Job timeout & cancellation with AbortController support
    • Priority queue system (HIGH, NORMAL, LOW priorities)
    • Worker health monitoring and automatic restart on failure
    • Real-time metrics and performance monitoring
    • Auto-scaling thread pool with configurable thresholds
    • Strict mode security validation (enabled by default)
    • Comprehensive benchmark suite vs competitors (Piscina, Workerpool, Tinypool)
    • Full TypeScript strict mode with zero linter errors
    • 20+ new comprehensive tests covering all features
    • Complete documentation overhaul (README, SECURITY, CHANGELOG, CONTRIBUTING)
    • Advanced examples for all features
    • Event-driven pool closing (replaced inefficient polling)
    • Enhanced error handling with full stack trace preservation

Minor Changes

  • Add full ESM (ES Modules) and CommonJS dual module support:
    • Dual build system with separate CJS and ESM outputs
    • Proper package.json exports field with conditional exports
    • Module type hints in dist folders for better resolution
    • Universal worker path resolution for both module systems
    • Compatibility tests for both ESM and CJS
    • Tree-shaking support in ESM builds
    • Works seamlessly in modern bundlers (Vite, Rollup) and legacy tools (Webpack, Node CJS)
    • Fully backward compatible - existing CommonJS users unaffected

1.1.0

Minor Changes

  • Full ESM (ES Modules) support: Package now supports both ESM and CommonJS
  • Dual build system: Separate builds for CJS (dist/cjs) and ESM (dist/esm) with proper conditional exports
  • Package.json exports field: Proper conditional exports for modern tooling and tree-shaking
  • Module type hints: package.json files in dist folders for better module resolution
  • Compatibility tests: Dedicated ESM and CJS compatibility test suites
  • Universal worker path resolution: Works seamlessly in both ESM and CJS environments

Changed

  • Build system now outputs three separate builds: dist/cjs, dist/esm, dist/types
  • Worker path resolution improved to detect and handle both module systems automatically
  • Package exports configured for optimal tree-shaking in ESM
  • Documentation updated with both ESM and CJS usage examples

Technical Details

  • Main entry point (require): ./dist/cjs/index.js
  • Module entry point (import): ./dist/esm/index.js
  • TypeScript types: ./dist/types/index.d.ts
  • Requires Node.js 12.20+ for conditional exports support

Benefits

  • ✅ Modern ESM support for Vite, Rollup, and modern bundlers
  • ✅ Tree-shaking support in ESM builds
  • ✅ Backward compatible with CommonJS projects
  • ✅ Future-proof module architecture
  • ✅ Works in both Next.js App Router (ESM) and Pages Router (CJS)

1.0.0

Major Changes

  • Production-ready v1.0.0 release with enterprise features:
    • Job timeout & cancellation with AbortController support
    • Priority queue system (HIGH, NORMAL, LOW priorities)
    • Worker health monitoring and automatic restart on failure
    • Real-time metrics and performance monitoring
    • Auto-scaling thread pool with configurable thresholds
    • Strict mode security validation (enabled by default)
    • Comprehensive benchmark suite vs competitors (Piscina, Workerpool, Tinypool)
    • Full TypeScript strict mode with zero linter errors
    • 20+ new comprehensive tests covering all features
    • Complete documentation overhaul (README, SECURITY, CHANGELOG, CONTRIBUTING)
    • Advanced examples for all features
    • Event-driven pool closing (replaced inefficient polling)
    • Enhanced error handling with full stack trace preservation

Patch Changes

  • c546e8a: Add changesets for version management and changelog generation
  • cd77166: Update dev dependencies
  • 36f33cf: Update repository URL to dwekat/nodeswarm

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.

[1.0.0] - 2025-11-19

Added

Core Features

  • Job Timeout & Cancellation: Support for job timeouts and cancellation via AbortController
  • Priority Queue System: HIGH, NORMAL, and LOW priority levels for job scheduling
  • Worker Health Monitoring: Automatic health checks and worker restart on failure
  • Metrics & Monitoring: Comprehensive metrics tracking (completed/failed jobs, execution times, queue depth)
  • Auto-scaling: Optional dynamic pool scaling based on queue depth
  • Strict Mode Validation: Security validation to detect potentially unsafe code patterns

API Enhancements

  • Thread options support: { timeout, signal, priority }
  • getMetrics() method for real-time pool statistics
  • resetMetrics() method to clear metrics
  • Enhanced error handling with full stack trace preservation
  • Better TypeScript type inference and constraints

Developer Experience

  • Comprehensive benchmark suite with 9 different workload types
  • Comparison benchmarks against Piscina, Workerpool, and Tinypool
  • Example files (basic and advanced usage patterns)
  • Full TypeScript strict mode support
  • Extensive test coverage for all features

Documentation

  • Complete SECURITY.md with usage guidelines
  • Enhanced README with feature documentation
  • API reference with JSDoc comments
  • Migration guide for breaking changes

Changed

Breaking Changes

  • thread() method now supports overloaded signatures with options parameter
  • Error messages now include full context (message, stack, name)
  • Minimum Node.js version requirement for AbortController support
  • TypeScript strict mode enabled (affects type checking)

Improvements

  • Replaced polling-based close() with event-driven approach
  • Better error serialization across worker boundary
  • More efficient queue management with priority support
  • Enhanced worker lifecycle management
  • Improved memory efficiency

Fixed

  • Import path bug in worker.ts ("ThreadPool""./ThreadPool")
  • Test bug in high load test (incorrect Array.fill usage)
  • Error handling now preserves full error context
  • Worker threads properly restart after crashes

Security

  • Input validation for functions and arguments
  • Strict mode enabled by default to block unsafe patterns
  • Detection of dangerous code patterns (require, eval, process access)
  • Comprehensive security documentation

[0.0.1] - 2024-XX-XX

Added

  • Initial release
  • Basic thread pool functionality
  • Simple job queue
  • Worker thread management
  • Basic error handling

Upgrade Guide

From 0.x to 1.0

Thread Method Signature

// Old (still supported)
pool.thread((x) => x * 2, 5);

// New with options
pool.thread({ timeout: 1000 }, (x) => x * 2, 5);
pool.thread({ priority: Priority.HIGH }, (x) => x * 2, 5);

Error Handling

Errors now include full stack traces automatically. No code changes required.

Strict Mode

Strict mode is enabled by default. To disable:

const pool = new ThreadPool({ strictMode: false });

Metrics API

const metrics = pool.getMetrics();
console.log(metrics.completedJobs, metrics.avgExecutionTime);

See README.md for complete documentation.

v2.0.0 - ESM + CommonJS Support

20 Nov 00:38
4dada44

Choose a tag to compare

NodeSwarm v2.0.0 - Full ESM & CommonJS Support

🎉 Dual Module System

NodeSwarm now supports both ESM (ES Modules) and CommonJS with proper conditional exports!

✨ New Features

Module Support

  • Full ESM support: Use import in modern projects (Vite, Next.js App Router, etc.)
  • CommonJS support: Continue using require() in legacy projects
  • Dual build system: Separate optimized builds for CJS (dist/cjs) and ESM (dist/esm)
  • Proper conditional exports: Tree-shaking support in ESM builds
  • Module type hints: package.json files in dist folders for better resolution
  • Universal worker path resolution: Works seamlessly in both module systems

Technical Improvements

  • Three separate build outputs: dist/cjs, dist/esm, dist/types
  • Compatibility tests for both module systems
  • Post-build fixes for cross-module compatibility
  • Future-proof architecture for modern tooling

📦 Package Exports

{
  "main": "./dist/cjs/index.js",     // CommonJS entry
  "module": "./dist/esm/index.js",    // ESM entry  
  "types": "./dist/types/index.d.ts"  // TypeScript types
}

🚀 Usage

ESM (Modern)

import { ThreadPool } from 'nodeswarm';

const pool = new ThreadPool();
const result = await pool.thread((a, b) => a + b, 5, 10);
await pool.close();

CommonJS (Legacy)

const { ThreadPool } = require('nodeswarm');

(async () => {
  const pool = new ThreadPool();
  const result = await pool.thread((a, b) => a + b, 5, 10);
  await pool.close();
})();

✅ Compatibility

  • ✅ Vite, Rollup, esbuild (ESM)
  • ✅ Webpack 5 (both)
  • ✅ Next.js App Router (ESM) & Pages Router (CJS)
  • ✅ Node.js 12.20+ (for conditional exports)
  • ✅ TypeScript (all module systems)
  • ✅ Backward compatible - existing code works without changes

📝 Migration

No migration needed! Your existing CommonJS code continues to work:

// This still works exactly as before
const { ThreadPool } = require('nodeswarm');

New ESM projects can now use imports:

// New: Use ESM imports
import { ThreadPool } from 'nodeswarm';

🔧 Requirements

  • Node.js 12.20+ for conditional exports support
  • All features from v1.0.0 remain available

Full Changelog: v1.0.0...v2.0.0

v1.0.0 - Production Ready

20 Nov 00:27
ad1eede

Choose a tag to compare

NodeSwarm v1.0.0 - Production Ready Release

🎉 Major Release

NodeSwarm is now production-ready with enterprise-grade features!

✨ New Features

Core Capabilities

  • Job Timeout & Cancellation: Built-in timeout support and AbortController integration
  • Priority Queue: HIGH, NORMAL, LOW priority levels for intelligent job scheduling
  • Worker Health Monitoring: Automatic health checks and worker restart on failure
  • Real-time Metrics: Comprehensive performance monitoring and statistics
  • Auto-Scaling: Dynamic worker pool adjustment based on load
  • Strict Mode Security: Input validation and dangerous pattern detection (enabled by default)

Developer Experience

  • Full TypeScript Strict Mode: Zero linter errors, complete type safety
  • Comprehensive Benchmarks: Performance suite with 9 workload types
  • Library Comparisons: Head-to-head benchmarks vs Piscina, Workerpool, Tinypool
  • 20+ New Tests: Complete test coverage for all features
  • Rich Documentation: README overhaul, SECURITY.md, CHANGELOG.md, CONTRIBUTING.md
  • Examples: Basic and advanced usage patterns

🔧 Improvements

  • Event-driven pool closing (replaced inefficient polling)
  • Enhanced error handling with full stack trace preservation
  • Better worker lifecycle management
  • Improved memory efficiency

📊 Performance

NodeSwarm delivers competitive performance with the most comprehensive feature set:

Library Total Time vs NodeSwarm
NodeSwarm 599ms baseline
Piscina 623ms +4.0%
Workerpool 649ms +8.3%
Tinypool 634ms +5.8%

🚨 Breaking Changes

  • TypeScript strict mode enabled (may affect type checking)
  • Error structure includes full context (message, stack, name)
  • thread() method supports options parameter (backward compatible)
  • Strict mode enabled by default (can be disabled)

📦 Installation

npm install nodeswarm@1.0.0

📚 Documentation


Full Changelog: v0.0.1...v1.0.0

v0.0.1

28 Sep 22:48

Choose a tag to compare

v0.0.1 Pre-release
Pre-release

Release Notes

This initial release, v0.0.1, lays the foundation for simple and efficient multithreading in Node.js, allowing developers to focus more on their application logic and less on thread management.

🌟 Quick Highlights:

  • 🚀 First release of NodeSwarm.
  • 🛠️ Offers a straightforward API for creating thread pools and running tasks.
  • 💪 Optimized for CPU-bound tasks.

For detailed information on how to use NodeSwarm, please refer to the documentation.