npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@retrigger/core

v1.0.4

Published

Ultra-fast file system watcher with native performance for Node.js development tools

Readme

@retrigger/core

Ultra-fast file system watcher with native performance for Node.js development tools

Replace slow JavaScript-based file watchers with native Rust performance. Get 100-400x faster hot reload times in your webpack and Vite projects.

🚀 Quick Start

npm install @retrigger/core

Webpack

// webpack.config.js
const { RetriggerWebpackPlugin } = require('@retrigger/core');

module.exports = {
  plugins: [
    new RetriggerWebpackPlugin({
      watchPaths: ['./src', './config'],
      verbose: process.env.NODE_ENV === 'development',
    }),
  ],
};

Vite

// vite.config.js
import { createRetriggerVitePlugin } from '@retrigger/core';

export default {
  plugins: [
    createRetriggerVitePlugin({
      watchPaths: ['./src'],
      enableAdvancedHMR: true,
    }),
  ],
};

📈 Performance

| Metric | Standard Watchers | Retrigger | Improvement | | ------------------ | ----------------- | --------- | ----------- | | Hot reload latency | 500-2000ms | <5ms | 100-400x | | CPU usage (idle) | 5-15% | <1% | 5-15x | | Memory usage | 50-200MB | 10-30MB | 2-7x |

🛠️ Configuration

Webpack Plugin Options

new RetriggerWebpackPlugin({
  // Directories to watch for changes
  watchPaths: ['./src', './config'],

  // Enable detailed logging
  verbose: false,

  // Debounce time for file events (ms)
  debounceMs: 50,

  // Enable Hot Module Replacement
  enableHMR: true,

  // Use SharedArrayBuffer for ultra-fast communication
  useSharedBuffer: true,

  // SharedArrayBuffer size (bytes)
  sharedBufferSize: 2 * 1024 * 1024, // 2MB

  // Maximum events to batch together
  maxEventBatch: 200,

  // Enable advanced dependency-aware invalidation
  enableAdvancedInvalidation: true,

  // Watch options
  watchOptions: {
    recursive: true,
    exclude_patterns: [
      '**/node_modules/**',
      '**/.git/**',
      '**/dist/**',
      '**/build/**',
    ],
    include_patterns: ['**/*.{js,jsx,ts,tsx,vue,svelte}'],
    enable_hashing: true,
    hash_block_size: 4096,
  },
});

Vite Plugin Options

createRetriggerVitePlugin({
  // Directories to watch
  watchPaths: ['./src'],

  // Enable verbose logging
  verbose: false,

  // Debounce time (ms) - lower for Vite
  debounceMs: 10,

  // Enable source map updates
  enableSourceMapUpdate: true,

  // Use SharedArrayBuffer for speed
  useSharedBuffer: true,

  // Enable advanced HMR with dependency tracking
  enableAdvancedHMR: true,

  // HMR invalidation strategy
  hmrInvalidationStrategy: 'smart', // 'conservative' | 'smart' | 'aggressive'

  // Watch options (same as webpack)
  watchOptions: {
    /* ... */
  },
});

🎯 Features

Core Benefits

  • Native Performance: Rust-powered file watching with SIMD-optimized hashing
  • Zero Dependencies: No heavy JavaScript file watcher dependencies
  • Cross-Platform: Works on Linux, macOS, and Windows
  • TypeScript Support: Full TypeScript definitions included
  • Graceful Degradation: Falls back to JavaScript mode if native components unavailable

Advanced Features

  • SharedArrayBuffer Communication: Sub-millisecond event propagation
  • Dependency-Aware Invalidation: Only rebuild what actually changed
  • Performance Monitoring: Built-in metrics and optimization tracking
  • Multiple Build Tool Support: Works with webpack, Vite, Rspack, and more

📊 Monitoring

Performance Stats Endpoint

When using the Vite plugin, access real-time stats at:

  • http://localhost:3000/__retrigger_stats - Basic performance metrics
  • http://localhost:3000/__retrigger_hmr_stats - Advanced HMR statistics

Programmatic Access

// Get performance statistics
const stats = await retriggerPlugin.getPerformanceStats();
console.log(`Events processed: ${stats.total_events}`);
console.log(`Average latency: ${stats.averageEventLatency}ms`);

🔧 Troubleshooting

Common Issues

High CPU Usage

// Reduce CPU usage by excluding more directories
new RetriggerWebpackPlugin({
  watchOptions: {
    exclude_patterns: [
      '**/node_modules/**',
      '**/dist/**',
      '**/coverage/**',
      '**/.next/**',
      '**/.nuxt/**',
    ],
  },
});

Slow Initial Scan

// Disable hashing for faster startup
new RetriggerWebpackPlugin({
  watchOptions: {
    enable_hashing: false,
  },
});

Memory Usage

// Reduce SharedArrayBuffer size
new RetriggerWebpackPlugin({
  sharedBufferSize: 512 * 1024, // 512KB instead of 2MB
  maxEventBatch: 50, // Process fewer events at once
});

📝 TypeScript

Full TypeScript support is included:

import {
  RetriggerWebpackPlugin,
  createRetriggerVitePlugin,
  type FileEvent,
  type WatchOptions,
} from '@retrigger/core';

const plugin = new RetriggerWebpackPlugin({
  watchPaths: ['./src'],
  verbose: true,
});

🏗️ Requirements

  • Node.js: 16.0.0 or higher
  • Operating System: Linux, macOS, or Windows
  • Architecture: x64, ARM64 (Apple Silicon supported)

🤝 Contributing

This package is part of the larger Retrigger project. See the main repository for contribution guidelines.

📄 License

MIT License - see LICENSE file for details.


Made with ⚡ by developers, for developers who value performance.