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

browser-extension-capabilities

v2.0.1

Published

Zero-dependency library for analyzing browser extension capabilities from manifest files

Readme

Version Downloads workflow

browser-extension-capabilities

Zero-dependency library for analyzing browser extension capabilities from manifest files

A lightweight, zero-dependency TypeScript library for analyzing browser extension manifests and extracting their capabilities. Useful for extension development tools, analysis tools, and browser extension marketplaces.

What are Browser Extension Capabilities?

Browser extension capabilities represent the functional interfaces and execution environments that an extension can utilize. These are the different ways an extension can interact with the browser, web pages, and users. Each capability corresponds to specific manifest fields and defines where and how the extension's code can run.

For example:

  • Background Capability: Allows the extension to run persistent code in the background
  • Content Scripts Capability: Enables the extension to interact with web page content
  • Popup Capability: Provides a user interface through browser toolbar buttons
  • Options Capability: Offers configuration pages for user settings

Features

  • Comprehensive Detection: Detects all major browser extension capabilities and interfaces
  • User-Friendly Output: Returns descriptive capability objects with explanations
  • Cross-Browser Support: Works with Chrome, Firefox, Edge, and other Chromium-based browsers

Installation

npm install browser-extension-capabilities

Usage

import {
  getExtensionCapabilities,
  getExtensionCapabilitiesAsync,
  analyzeExtensionManifest,
} from 'browser-extension-capabilities'

// 1) Sync (path)
const caps1 = getExtensionCapabilities('./path/to/extension/manifest.json', {
  includeFields: true,
  normalizeNames: true,
  includeCompatibility: true,
})

// 2) Async (path)
const caps2 = await getExtensionCapabilitiesAsync(
  './path/to/extension/manifest.json',
  { strict: true },
)

// 3) Direct object
import * as fs from 'fs'
const manifest = JSON.parse(fs.readFileSync('./path/to/manifest.json', 'utf8'))
const caps3 = analyzeExtensionManifest(manifest, { normalizeNames: true })

console.log(caps1)
// [
//   { capability: 'background', id: 'background', description: 'Background service worker or page for persistent functionality', fields: ['background.service_worker'] },
//   { capability: 'content_scripts', id: 'content_scripts', description: 'Content scripts that run on web pages to interact with page content', fields: ['content_scripts'] },
//   { capability: 'popup', id: 'action_popup', description: 'Toolbar popup UI', fields: ['action.default_popup'] },
// ]

Supported Capabilities

| Capability | Description | Manifest Fields | | ---------------------------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | | background | Background service worker or page for persistent functionality | background.page, background.scripts, background.service_worker | | content_scripts | Content scripts that run on web pages to interact with page content | content_scripts | | popup | Toolbar popup UI | action.default_popup, browser_action.default_popup, page_action.default_popup | | sidebar | Side panel UI | side_panel.default_path, sidebar_action.default_panel | | devtools | Developer tools panel | devtools_page | | options | Options page for user configuration | options_ui.page, options_page | | newtab | New tab page override | chrome_url_overrides.newtab | | bookmarks | Custom bookmarks page replacement | chrome_url_overrides.bookmarks | | history | History page override | chrome_url_overrides.history | | sandbox | Sandboxed pages for isolated execution | sandbox.pages | | web_resources | Web-accessible resources exposed to web pages | web_accessible_resources | | omnibox | Omnibox keyword integration | omnibox.keyword | | commands | Keyboard shortcuts and command actions | commands | | settings_homepage | Browser settings override: homepage | chrome_settings_overrides.homepage | | settings_search_provider | Browser settings override: search provider | chrome_settings_overrides.search_provider | | settings_startup_pages | Browser settings override: startup pages | chrome_settings_overrides.startup_pages | | declarative_net_request | Declarative network request rules | declarative_net_request.rule_resources | | tts_engine | Text-to-speech engine | tts_engine.voices |

API Reference

getExtensionCapabilities(manifestPath: string, options?: GetCapabilitiesOptions): ExtensionCapability[]

Analyzes a browser extension manifest from a file path and returns an array of capability objects.

Parameters

  • manifestPath (string): Direct path to the extension's manifest.json file
  • options (optional): See Options below

Returns

  • ExtensionCapability[]: Array of capability objects with capability, description, and optionally id and fields when enabled via options

Example

import { getExtensionCapabilities } from 'browser-extension-capabilities'

const capabilities = getExtensionCapabilities('./my-extension/manifest.json', {
  includeFields: true,
  normalizeNames: true,
})

capabilities.forEach(({ capability, id, description, fields }) => {
  console.log(`${id ?? capability}: ${description}`, fields ?? [])
})

getExtensionCapabilitiesAsync(manifestPath: string, options?: GetCapabilitiesOptions): Promise<ExtensionCapability[]>

Async variant of the path-based API. Respects the same options and error handling semantics.

analyzeExtensionManifest(manifest: ExtensionManifest, options?: GetCapabilitiesOptions): ExtensionCapability[]

Analyzes a manifest object directly without reading from disk.

Types

interface ExtensionCapability {
  capability: string
  description: string
  id?: string // normalized manifest-aligned name (e.g., "web_accessible_resources")
  fields?: string[] // manifest fields that triggered this capability
  compatibility?: {
    safari?: boolean
    notes?: string
    docs?: string
  }
}

interface GetCapabilitiesOptions {
  strict?: boolean // throw on missing/invalid manifest when true
  includeFields?: boolean // include manifest field paths in each capability
  normalizeNames?: boolean // include normalized id aligned with manifest naming
  includeCompatibility?: boolean // include Safari-focused compatibility metadata per capability
}

Compatibility metadata (Safari-focused)

When includeCompatibility: true is set, each capability may include a compatibility object with conservative Safari support and notes.

Example output snippet:

{
  "capability": "sidebar",
  "description": "Side panel UI",
  "id": "sidebar",
  "compatibility": {
    "safari": false,
    "notes": "Chromium uses side_panel; Firefox uses sidebar_action. Safari does not provide an equivalent sidebar UI API.",
    "docs": "https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/user_interface"
  }
}

Error Handling

The library gracefully handles various error scenarios:

  • Missing manifest file: Returns [{ capability: "manifest", description: "Basic extension manifest configuration" }] (or throws when strict: true)
  • Invalid JSON: Returns fallback capability with error logging (or throws when strict: true)
  • Malformed manifest: Attempts to extract available capabilities and falls back gracefully

Use Cases

  • Extension Analysis Tools: Analyze extension capabilities and permissions
  • Marketplace Validation: Verify extension capabilities for store listings
  • Development Tools: IDE plugins and development utilities
  • Security Analysis: Understand extension execution environments
  • Documentation Generation: Auto-generate extension documentation

Browser Support

| | | | | | | | :-----------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------: | | Chrome✅ | Edge✅ | Firefox✅ | Opera✅ | Safari✅ | Chromium✅ |

License

MIT (c) Cezar Augusto