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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dwatcher/core

v1.0.2

Published

Lightweight, performant Node.js file watcher with intelligent debouncing - zero dependencies alternative to nodemon

Readme

dwatcher

Lightweight, performant Node.js file watcher with intelligent debouncing

A zero-dependency alternative to nodemon that focuses on efficiency, simplicity, and smart file change detection. Built with modern ES modules and functional programming principles.

⚡ Key Features

  • Zero Dependencies - No external packages required
  • Intelligent Debouncing - Waits for file change bursts to complete before restarting
  • High Performance - Efficient file watching with minimal resource usage
  • Framework Agnostic - Works with any Node.js application or framework
  • ES Module Native - Built for modern JavaScript
  • Configurable - Flexible ignore patterns and watch settings
  • Production Ready - Can be installed as a regular dependency, not just dev dependency

🚀 Installation

# npm
npm install @dwatcher/core

# yarn
yarn add @dwatcher/core

# pnpm
pnpm add @dwatcher/core

📖 Usage

Command Line

# Basic usage
dwatcher node server.js

# With arguments
dwatcher node app.js --port 3000

# With npm scripts
dwatcher "npm start"

# With custom debounce timing
dwatcher node server.js --debounce 500

# Verbose mode
dwatcher node server.js --verbose

# Watch specific directory
dwatcher node server.js --watch ./src

Programmatic API

import { dwatcher } from '@dwatcher/core';

// Basic usage
await dwatcher('node', ['server.js']);

// With options
await dwatcher('node', ['app.js'], {
  debounceMs: 500,
  verbose: true,
  ignorePatterns: ['*.log', 'temp/**'],
  watchExtensions: ['.js', '.json', '.ts']
});

Package.json Scripts

{
  "scripts": {
    "dev": "dwatcher node server.js",
    "dev:verbose": "dwatcher node server.js --verbose",
    "start:watch": "dwatcher npm start"
  }
}

⚙️ Configuration Options

CLI Options

| Option | Description | Default | |--------|-------------|---------| | --debounce <ms> | Debounce delay in milliseconds | 300 | | --ignore <pattern> | Add ignore pattern (repeatable) | See defaults | | --ext <extensions> | Watch specific extensions | .js,.mjs,.json,.ts,.jsx,.tsx | | --verbose | Enable verbose logging | false | | --no-clear | Don't clear console on restart | false | | --watch <path> | Watch specific directory | Current directory |

Programmatic Options

const options = {
  debounceMs: 300,           // Debounce delay
  verbose: false,            // Verbose logging
  clear: true,              // Clear console on restart
  watchPath: process.cwd(), // Directory to watch
  ignorePatterns: [         // Patterns to ignore
    'node_modules/**',
    '.git/**',
    '*.log',
    'dist/**',
    'build/**'
  ],
  watchExtensions: [        // File extensions to watch
    '.js', '.mjs', '.json', 
    '.ts', '.jsx', '.tsx'
  ]
};

🎯 How It Works

Intelligent Debouncing

Unlike traditional file watchers that restart immediately on any change, dwatcher uses intelligent debouncing:

  1. File Change Detected - dwatcher notices a file change
  2. Debounce Timer Started - Waits for the configured debounce period
  3. Additional Changes - If more changes occur, the timer resets
  4. Quiet Period - Once no changes occur for the debounce period, restart happens
  5. Single Restart - Only one restart occurs regardless of how many files changed

This prevents rapid restarts during bulk operations like:

  • Git operations (checkout, merge, pull)
  • Package installations
  • Build processes that modify multiple files
  • IDE auto-save bursts

Smart File Watching

  • Recursive Directory Scanning - Automatically discovers new directories
  • Efficient Pattern Matching - Fast ignore pattern processing
  • Extension Filtering - Only watches relevant file types
  • Auto-refresh - Periodically updates watchers for new directories

🔧 Environment Variables

When your application runs under dwatcher, the environment variable DWATCHER_RUNNING is set to '1'. You can use this to modify behavior:

if (process.env.DWATCHER_RUNNING) {
  console.log('Running in development mode with dwatcher');
}

📝 Examples

Basic Express Server

// server.js
import express from 'express';
const app = express();

app.get('/', (req, res) => {
  res.send('Hello World!');
});

app.listen(3000, () => {
  console.log('Server running on port 3000');
});
dwatcher node server.js

Next.js Development

dwatcher "npm run dev"

TypeScript Project

dwatcher node --loader ts-node/esm app.ts --ext .js,.ts,.json

Custom Configuration

dwatcher node server.js \
  --debounce 1000 \
  --ignore "logs/**" \
  --ignore "*.tmp" \
  --ext .js,.json \
  --verbose

🆚 vs Nodemon

| Feature | dwatcher | nodemon | |---------|----------|---------| | Dependencies | 0 | 30+ | | Bundle Size | ~15KB | ~2MB+ | | Debouncing | Intelligent | Basic | | ES Modules | Native | Partial | | Configuration | Simple | Complex | | Performance | High | Moderate | | Memory Usage | Low | Higher |

🤝 Contributing

Contributions are welcome! This project follows functional programming principles and avoids OOP patterns. Please ensure:

  • Use ES modules only
  • No external dependencies
  • Functional programming style
  • Comprehensive error handling
  • Performance considerations

📄 License

MIT License - see LICENSE file for details.

🔗 Links


dwatcher - Built for modern Node.js development 🚀