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

nebula-pty

v1.0.13

Published

Custom PTY module for terminal emulation

Readme

Nebula PTY

A modern terminal emulator for Electron applications with native PTY support.

Installation

npm install nebula-pty

Usage

  1. Add required HTML:
<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="node_modules/@xterm/xterm/css/xterm.css" />
</head>
<body>
    <div id="terminal-container"></div>
</body>
</html>
  1. Use in your JavaScript (renderer.js):
const os = require('os');
const path = require('path');
const { Terminal } = require('xterm');
const { FitAddon } = require('xterm-addon-fit');
const { WebLinksAddon } = require('xterm-addon-web-links');
const { WebTerminal } = require('nebula-pty');

// Configuration du terminal
const term = new Terminal({
    cursorBlink: true,
    cursorStyle: 'block',
    fontFamily: 'Consolas, monospace',
    fontSize: 14,
    theme: {
        background: '#1e1e1e',
        foreground: '#d4d4d4',
        cursor: '#ffffff',
        selection: '#264f78',
        black: '#000000',
        red: '#cd3131',
        green: '#0dbc79',
        yellow: '#e5e510',
        blue: '#2472c8',
        magenta: '#bc3fbc',
        cyan: '#11a8cd',
        white: '#e5e5e5',
        brightBlack: '#666666',
        brightRed: '#f14c4c',
        brightGreen: '#23d18b',
        brightYellow: '#f5f543',
        brightBlue: '#3b8eea',
        brightMagenta: '#d670d6',
        brightCyan: '#29b8db',
        brightWhite: '#e5e5e5'
    }
});

// Addons
const fitAddon = new FitAddon();
term.loadAddon(fitAddon);
term.loadAddon(new WebLinksAddon());

// Configuration du conteneur et démarrage
const terminalContainer = document.getElementById('terminal-container');
term.open(terminalContainer);
fitAddon.fit();

// Configuration du processus PTY
const startPTY = () => {
    const ptyProcess = new WebTerminal();

    // Configuration de l'environnement
    const env = {
        ...process.env,
        TERM: 'xterm-256color',
        COLORTERM: 'truecolor',
        TERM_PROGRAM: 'nebula-pty',
        HOME: os.homedir(),
        LANG: 'en_US.UTF-8',
        LC_ALL: 'en_US.UTF-8',
        LC_CTYPE: 'en_US.UTF-8'
    };

    // Options de démarrage
    const ptyOptions = {
        cols: term.cols,
        rows: term.rows,
        cwd: process.env.HOME || process.env.USERPROFILE,
        env: env
    };

    try {
        ptyProcess.startProcess(ptyOptions);

        // Gestion des données
       term.onData(data => {
            console.log('Terminal data:', data);
            try {
                ptyProcess.write(data);
            } catch (error) {
                console.error('Write error:', error);
            }
        });

        ptyProcess.onData(data => {
            console.log('PTY data:', data);
            try {
                term.write(data);
            } catch (error) {
                console.error('Term write error:', error);
            }
        });

        // Gestion du redimensionnement
        const handleResize = () => {
            try {
                fitAddon.fit();
                ptyProcess.resize(term.cols, term.rows);
            } catch (error) {
                console.error('Erreur lors du redimensionnement:', error);
            }
        };

        window.addEventListener('resize', handleResize);

        // Ajout d'un gestionnaire pour le focus
        terminalContainer.addEventListener('click', () => {
            term.focus();
        });

        return ptyProcess;
    } catch (error) {
        console.error('Erreur lors du démarrage du PTY:', error);
        throw error;
    }
};

// Démarrage initial
let currentPTY;
try {
    currentPTY = startPTY();
} catch (error) {
    console.error('Erreur lors de l\'initialisation:', error);
}

// Focus initial
term.focus();

// Export pour debug si nécessaire
window.term = term;
window.ptyProcess = currentPTY;

API

NebulaPTY

  • constructor(options): Create a new terminal instance
  • open(container): Open terminal in container (ID or DOM element)
  • write(data): Write data to terminal
  • onData(callback): Listen for user input
  • resize(cols, rows): Resize terminal
  • focus(): Focus terminal
  • clear(): Clear terminal

License

ISC