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

slidev-addon-web-terminal

v0.3.0

Published

A Slidev addon that provides a web terminal using xterm.js

Readme

Slidev Addon Web Terminal

This addon provides a WebTerminal component for Slidev presentations, allowing you to embed a fully functional terminal connected to a backend process.

Features

  • Xterm.js Integration: Uses a full-featured terminal emulator.
  • Backend Connection: Connects to a backend WebSocket/API service.
  • Zero-Config Dynamic Proxy: Specify any backendUrl (including different domains and ports) in your markdown, and the addon handles CORS and proxying automatically.
  • Click to Execute: Commands are automatically sent to the terminal when clicking an element with the .clickable-code class (e.g. a wrapper around a code block).
  • Auto-fit: Automatically resizes the terminal to fit the container.
  • Theme Support: Styled for dark mode by default.

Installation

npm install slidev-addon-web-terminal

Backend Setup

This addon requires a backend service to handle the terminal sessions.

To get started quickly, run the Webterminal Agent using Docker:

docker run -d --name webterminal --rm -p {{ HOSTPORT }}:10001 berttejeda/bill-webterminal

Example (port 10001):

docker run -d --name webterminal --rm -p 10001:10001 berttejeda/bill-webterminal

Configuration

To enable the Dynamic Port Proxy (which solves CORS issues when using different hosts or ports), you must add the proxy plugin to your vite.config.ts.

1. Install http-proxy

npm install -s http-proxy

2. Update vite.config.ts

Add the following plugin to your Vite configuration:

import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [
    {
      name: 'dynamic-terminal-proxy',
      configureServer(server) {
        const httpProxy = require('http-proxy')
        const proxy = httpProxy.createProxyServer({ changeOrigin: true, ws: true })

        const proxyPattern = /^\/proxy\/([^\/]+)\/([^\/]+)\/([^\/]+)(.*)/

        server.middlewares.use((req, res, next) => {
          const match = req.url?.match(proxyPattern)
          if (match) {
            const [_, protocol, host, port, rest] = match
            const target = `${protocol}://${host}:${port}`
            req.url = rest || '/'
            proxy.web(req, res, { target, secure: protocol === 'https' }, (e) => {
              res.statusCode = 502
              res.end(`Proxy error: ${e.message}`)
            })
            return
          }
          next()
        })

        server.httpServer?.on('upgrade', (req, socket, head) => {
          const match = req.url?.match(proxyPattern)
          if (match) {
            const [_, protocol, host, port, rest] = match
            req.url = rest || '/'
            proxy.ws(req, socket, head, { target: `${protocol}://${host}:${port}`, secure: protocol === 'https' })
          }
        })
      }
    }
  ]
})

Usage

In your slides configuration (e.g., slides.md):

---
addons:
  - web-terminal
---

Then use the component in your slides. You can point to any backend URL directly:

<!-- Localhost with default port -->
<WebTerminal backendUrl="http://localhost:10001" />

<!-- Arbitrary remote host (handles CORS automatically) -->
<WebTerminal backendUrl="https://my-websocket-host.example.com:4443" />

Props

| Prop | Type | Default | Description | |---|---|---|---| | backendUrl | string | - | The base URL of the terminal backend. If pointing to localhost, it automatically uses the dynamic proxy. | | wsUrl | string | - | (Optional) Direct WebSocket URL to bypass session creation API. |

Development

# Install dependencies
npm install

# Run linter
npm run lint