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

@constellation4sitecore/security

v22.8.1

Published

A collection of XM Cloud compatible libraries for SXA Sitecore Development.

Downloads

193

Readme

Constellation Security

Content Security Policy

Add NPM

npm i @constellation4sitecore/security --save

Serialize Items

npm@constellation4sitecore/security

Add CSP Middleware Plugin under lib/middleware/plugins/csp.ts

import { NextRequest, NextResponse } from 'next/server';
import { MiddlewarePlugin } from '..';
import { CSPMiddleware } from '@constellation4sitecore/security/middleware';
import { siteResolver } from 'lib/site-resolver';
import clientFactory from 'lib/graphql-client-factory';

class ContentSecurityPolicyPlugin implements MiddlewarePlugin {
  private cspMiddleware: CSPMiddleware;
  order = 2;

  constructor() {
    this.cspMiddleware = new CSPMiddleware({
      clientFactory,
      siteResolver,
      cacheEnabled: true,
      cacheTimeout: 86400, // Cache
      disabled: () => process.env.NODE_ENV === 'development',
    });
  }

  /**
   * exec async method - to find coincidence in url.pathname and redirects of site
   * @param req<NextRequest>
   * @returns Promise<NextResponse>
   */
  async exec(req: NextRequest, res?: NextResponse): Promise<NextResponse> {
    return this.cspMiddleware.getHandler()(req, res);
  }
}

export const cspPlugin = new ContentSecurityPolicyPlugin();

Create a report under pages/api/cspreports.ts

import type { NextApiRequest, NextApiResponse } from 'next';
import debuggers from '../../debug';

const cspReportsApi = async (req: NextApiRequest, res: NextApiResponse): Promise<void> => {
  res.setHeader('Content-Type', 'text/plain');

  debuggers.csp('CSP Report:', req.body);

  return res.status(200).send({ success: true });
};

export default cspReportsApi;

Add Rewrite plugin lib/next-config/plugins/csreports.js

/**
 * @param {import('next').NextConfig} nextConfig
 */
const cspReportsPlugin = (nextConfig = {}) => {
  return Object.assign({}, nextConfig, {
    async rewrites() {
      return [
        ...(await nextConfig.rewrites()),
        // cspReports route
        {
          source: '/cspreports.xml',
          destination: '/api/cspreports',
        },
      ];
    },
  });
};

module.exports = cspReportsPlugin;

Remove cspreports.xml from Edge middleware. add cspreports.xml to the matcher array in middleware.ts

Experimental

In order to use next/cache which is not stable yet. Set the following env variable

CONSTELLATION_NEXT_CACHE_ENABLED=true