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

moss-api

v0.1.0

Published

Official API for building Moss plugins - types and utilities for plugin development

Readme

moss-api

CI codecov npm version

Official API for building Moss plugins. Provides types and utilities for plugin development.

Installation

npm install moss-api

Usage

Types

import type {
  OnDeployContext,
  AfterDeployContext,
  HookResult,
  PluginManifest,
  PluginCategory,
} from "moss-api";

// Define your plugin manifest
const manifest: PluginManifest = {
  name: "my-plugin",
  version: "1.0.0",
  entry: "main.js",
  category: "deployer",
};

// Implement a hook
async function onDeploy(context: OnDeployContext): Promise<HookResult> {
  // Your deployment logic here
  return { success: true, message: "Deployed successfully" };
}

Utilities

import {
  setMessageContext,
  reportProgress,
  reportError,
  reportComplete,
  log,
  warn,
  error,
} from "moss-api";

// Set plugin context (call once at plugin initialization)
setMessageContext("my-plugin", "on_deploy");

// Report progress during long operations
await reportProgress("deploying", 50, 100, "Uploading files...");

// Log messages
await log("Deployment started");
await warn("Deprecation warning");
await error("Something went wrong");

// Report errors with context
await reportError("Upload failed", "network", false);

// Report completion with result
await reportComplete({ url: "https://example.com" });

Browser Utilities

import { openBrowser, closeBrowser } from "moss-api";

// Open authentication page in plugin browser window
await openBrowser("https://example.com/auth");

// Close browser window when done
await closeBrowser();

Tauri Utilities

import { getTauriCore, isTauriAvailable } from "moss-api";

// Check if running in Tauri environment
if (isTauriAvailable()) {
  const core = getTauriCore();
  const result = await core.invoke("my_command", { arg: "value" });
}

API Reference

Types

| Type | Description | |------|-------------| | ProjectInfo | Project metadata (type, folders, files) | | PluginManifest | Plugin configuration (name, version, entry, category) | | PluginCategory | Union: "generator" | "deployer" | "syndicator" | "enhancer" | "processor" | | BaseContext | Base hook context with project info | | BeforeBuildContext | Context for before_build hook | | OnBuildContext | Context for on_build hook (includes source files) | | OnDeployContext | Context for on_deploy hook (includes output files) | | AfterDeployContext | Context for after_deploy hook (includes articles, deployment) | | SourceFiles | Categorized source files (markdown, pages, docx, other) | | ArticleInfo | Article metadata for syndication | | DeploymentInfo | Deployment result (method, url, timestamp, metadata) | | HookResult | Standard hook return type | | PluginMessage | Union of all message types | | LogMessage | Log message with level | | ProgressMessage | Progress update message | | ErrorMessage | Error message with context and fatal flag | | CompleteMessage | Completion message with result |

Functions

| Function | Description | |----------|-------------| | getTauriCore() | Get Tauri API (throws if unavailable) | | isTauriAvailable() | Check if Tauri is available | | setMessageContext(pluginName, hookName) | Set context for messages | | getMessageContext() | Get current message context | | sendMessage(message) | Send raw message to Moss | | reportProgress(phase, current, total, message?) | Report progress | | reportError(error, context?, fatal?) | Report error | | reportComplete(result) | Report completion | | log(message) | Log info message | | warn(message) | Log warning message | | error(message) | Log error message | | openBrowser(url) | Open URL in plugin browser | | closeBrowser() | Close plugin browser |

License

MIT - see LICENSE for details.