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

@wxn0brp/falcon-frame-plugin

v0.0.3

Published

A flexible plugin system for the **FalconFrame** framework, allowing developers to register, sort, and execute plugins in a specific order based on dependencies.

Readme

FalconFrame Plugin System

A flexible plugin system for the FalconFrame framework, allowing developers to register, sort, and execute plugins in a specific order based on dependencies.

Overview

The FalconFrame Plugin System provides a robust way to manage plugins for FalconFrame applications. It supports dependency management using before and after constraints, ensuring that plugins are executed in the correct order. The system uses a topological sort algorithm to handle complex dependency chains and detect circular dependencies.

Installation

npm install @wxn0brp/falcon-frame-plugin
# and FalconFrame if not already installed
npm install @wxn0brp/falcon-frame 

Features

  • Plugin Registration – Register plugins with optional dependency constraints.
  • Dependency Management – Specify before and after relationships between plugins.
  • Automatic Sorting – Plugins are automatically ordered based on dependencies.
  • Circular Dependency Detection – Throws errors when circular dependencies are detected.
  • Route Handler Integration – Seamless integration with FalconFrame's routing system.

Usage

Basic Example

import { PluginSystem } from "@wxn0brp/falcon-frame-plugin";
import { FalconFrame } from "@wxn0brp/falcon-frame";

const app = new FalconFrame();
const pluginSystem = new PluginSystem();

// Register a plugin
pluginSystem.register({
  	id: "my-plugin",
  	process: (req, res, next) => {
  	  	console.log("Executing my plugin");
  	  	next();
  	}
});

// Register multiple plugins
app.use(pluginSystem);

Plugin with Dependencies

pluginSystem.register({
  	id: "auth-plugin",
  	process: (req, res, next) => {
  	  	// Authentication logic
  	  	next();
  	},
  	before: "data-plugin"  // Runs before "data-plugin"
});

pluginSystem.register({
  id: "data-plugin",
  	process: (req, res, next) => {
  	  	// Data processing logic
  	  	next();
  	},
  	after: "auth-plugin"   // Runs after "auth-plugin"
});

Plugin Interface

interface Plugin {
  	id: string;                 // Unique identifier for the plugin
  	process: RouteHandler;      // Function executed when the plugin runs
  	before?: string | string[]; // Plugin(s) that should run after this one
  	after?: string | string[];  // Plugin(s) that should run before this one
}

API

PluginSystem.register(plugin: Plugin, opts?: PSOpts)

Registers a plugin with the system. If opts.after or opts.before are provided, they will define the execution order. Plugins are re-sorted automatically after registration.

PluginSystem.getRouteHandler(): RouteHandler

Returns a RouteHandler that executes all registered plugins in the correct order. It will sort the plugins if they haven’t been sorted yet, then execute them recursively.

Sorting Algorithm

The system uses a topological sort to:

  • Detect circular dependencies and throw errors
  • Ensure correct execution order based on dependencies
  • Prevent duplicate plugin IDs

Contributing

Contributions are welcome! Please open an issue or pull request for bug reports, feature requests, or improvements.

License

MIT License – see the LICENSE file for details.