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

@api-buddy/core

v3.0.0

Published

Core functionality and plugin system for API Buddy

Readme

@api-buddy/plugin-core

Core plugin system for API Buddy, providing a robust foundation for building and managing plugins.

Features

  • Plugin Lifecycle Management: Load, initialize, and unload plugins with proper lifecycle hooks
  • Dependency Resolution: Handle plugin dependencies with automatic resolution
  • Type Safety: Full TypeScript support with comprehensive type definitions
  • Error Handling: Robust error handling and recovery options
  • Hooks System: Extensible hook system for plugin communication
  • Command Registration: Register and manage CLI commands from plugins

Installation

pnpm add @api-buddy/plugin-core

Usage

Basic Plugin Definition

import { ApiBuddyPlugin } from '@api-buddy/plugin-core';

const myPlugin: ApiBuddyPlugin = {
  name: 'my-plugin',
  version: '1.0.0',
  description: 'My awesome plugin',
  
  hooks: {
    'before:load': async (context) => {
      context.logger.info('Plugin is about to load');
    },
    'after:load': async (context) => {
      context.logger.info('Plugin has been loaded');
    },
    'before:unload': async (context) => {
      context.logger.info('Plugin is about to unload');
    },
  },
  
  dependencies: ['other-plugin'],
  
  metadata: {
    // Any additional metadata
  },
};

export default myPlugin;

Using the Plugin Manager

import { PluginManager } from '@api-buddy/plugin-core';
import myPlugin from './my-plugin';

// Create a new plugin manager instance
const manager = new PluginManager({
  // Optional context overrides
  logger: {
    info: console.log,
    error: console.error,
    debug: console.debug,
  },
  config: {
    // Your configuration here
  },
}, {
  // Plugin manager options
  hookTimeout: 5000, // Default timeout for hooks (ms)
  continueOnError: false, // Whether to continue if a plugin fails to load
});

// Load a plugin
await manager.loadPlugin(myPlugin);

// Trigger a custom hook
await manager.triggerHook('custom:hook', { some: 'data' });

// Unload a plugin
await manager.unloadPlugin('my-plugin');

Lifecycle Hooks

API Buddy plugins support the following lifecycle hooks:

  • before:load: Called before the plugin is loaded
  • after:load: Called after the plugin is loaded
  • before:unload: Called before the plugin is unloaded

Error Handling

The plugin manager provides several options for error handling:

  • hookTimeout: Automatically rejects hooks that take too long
  • continueOnError: When true, the manager will continue loading other plugins if one fails
  • Error Logging: All errors are logged through the provided logger

TypeScript Support

The package includes TypeScript type definitions for all public APIs.

License

MIT