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.style/csp-manager

v1.1.0

Published

A web component to interactively build and manage a Content Security Policy (CSP).

Readme

CSP Manager Web Component

A powerful, interactive web component for building and managing Content Security Policy (CSP) directives with built-in security evaluation.

npm version

Features

  • Interactive Editor: Easily add, remove, and manage CSP directives through an intuitive UI.
  • Security Evaluation: Real-time security checks based on Google's CSP Evaluator logic.
  • Live Preview: See the generated <meta> tag update as you make changes.
  • i18n Support: Full internationalization support (English and Danish included).
  • CMS Integration: Designed for easy integration with headless CMSs like Contentful or Storyblok.
  • Event-Driven: Fires a csp-change event on every modification for easy integration.
  • Flexible: Supports importing from existing CSP strings and exporting to JSON or a header string.

Installation

npm install @browser.style/csp-manager

Or include it directly in your HTML:

<script type="module" src="https://unpkg.com/@browser.style/csp-manager/src/index.js"></script>

Quick Start

<csp-manager evaluate></csp-manager>
  • evaluate: Enables the security evaluation feature.
  • lang="da": Sets the language to Danish.

API and Usage

Attributes

  • evaluate: (Boolean) Enables security evaluation.
  • lang: (String) Sets the language (e.g., "en", "da").
  • initial-policy: (String) A JSON string representing the initial policy to load.
  • directives: (String) A URL or inline JSON for custom directive configurations.
  • i18n: (String) A URL or inline JSON for custom translations.
  • rules: (String) A URL or inline JSON for custom evaluation rules.

Properties

  • policy (get/set): Gets or sets the current CSP policy as a JavaScript object.
  • cspString (get): Gets the generated CSP meta tag string.

Methods

  • fromString(cspString): Parses a CSP string and loads it into the manager.
  • enableDirective(directiveName): Programmatically enables a directive.
  • setDirectivesConfig(config): Sets custom directive definitions.
  • setI18nConfig(config): Sets custom internationalization data.
  • setRulesConfig(config): Sets custom evaluation rules.

Events

  • csp-change: Fired whenever the CSP policy is modified. The event.detail object contains the policy object, the cspString, and evaluations (if enabled).

Customization

The component is highly customizable through CSS custom properties for styling and through configuration files for functionality. You can define custom directives, add new languages, and create your own security evaluation rules.

See the Custom Configuration Demo for live examples.


Development

To run the project locally, simply start a web server in the component's directory.

# In ui/csp-manager/
npx serve

The component is written in modern JavaScript and uses ES modules, so no build step is required for development.


License

This project is licensed under the ISC License. See the LICENSE file for details.