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

@vtex/fsp-analyzer

v1.2.13

Published

Static analysis tool for FastStore extensions

Downloads

8,049

Readme

FastStore Platform Analyzer

Static analysis tool for FastStore extensions.

Installation

  1. Add the analyzer to your project:
pnpm add @vtex/fsp-analyzer

Usage

This guide explains how to integrate the FastStore Platform Analyzer (@vtex/fsp-analyzer) into your monorepo. The analyzer aims to provide static code analysis capabilities to ensure code safety and compliance with the standards agreed by the FastStore Platform team.

[!IMPORTANT] Your CLI must adhere to the FastStore Platform CLI specification in order to have the hooks available as well as the basic scaffolding for the modules. If you are unaware of how to do this, please refer to the FastStore Platform CLI Docs.

Understanding the hooks folder

The hooks folder is a special folder in the FastStore Platform ecosystem that allows you to add custom hooks to the development lifecycle. These hooks can be executed at different stages of the runtime, and you can use them to run your own custom code. There are a few hooks available, such as:

  • preBuild: Runs before the build process
  • postBuild: Runs after the build process
  • preDev: Runs before the development server starts
  • postDev: Runs after the development server starts

[!NOTE] The hooks are defined in the src/hooks folder, and are executed in the order of the file name. For example, preBuild.ts will run before postBuild.ts.

In this guide, we'll focus on preBuild, as it was considered during the spec meetings to be the most convenient for the analyzer.

  1. Create a pre-build hook in your project:
import { FastStoreSandboxAnalyzer } from "@vtex/fsp-analyzer";

export async function preBuild() {
  const analyzer = new FastStoreSandboxAnalyzer();

  try {
    await analyzer.analyzeFiles({
      filePattern: "your-module/**/*.{js,ts,jsx,tsx,css,less,scss}",
      cssOptions: {
        allowedNamespaces: ["extension-"], // Array of allowed CSS namespace prefixes
        transformNonCompliant: true, // Whether to automatically fix non-compliant CSS
        defaultNamespace: "extension-", // Default namespace to add to selectors
        verbose: true, // Output details and write transformed files to disk
        overwriteTransformed: true, // Whether to overwrite existing transformed files
      },
    });
  } catch (error) {
    console.error("Pre-build static analysis failed:", error);
    throw error;
  }
}
  1. Register the hook in your project's entry point:
export const hooks = {
  preBuild,
  // ... other hooks
};
  1. Run your project:
pnpm run dev
  1. Do a build:
pnpm run build

And that's it! You should see the analyzer output in the console.

Library Rundown

Available Rules

  • DOM API Access Restrictions: Prevent access to DOM API (e.g. document, window, localStorage)
  • CSS Containment Analysis: Prevent unsolicited usage of selectors and CSS variables (e.g :root, :host, :host-context)
  • Third-Party Script Loading Detection: Prevent loading of third-party scripts (e.g. importScripts, eval, new Function)
  • Core Element Modification Detection: Prevent modification of core elements (e.g. body, html, head)

Next Steps

For Extension Points

  1. Integration Requirements

    • Update your build pipeline to include the analyzer
    • Define appropriate file patterns for your module
    • Handle analysis failures appropriately
  2. Code Compliance

    • Ensure code follows sandboxing guidelines
    • Document any required exceptions
    • Test analysis on your codebase

For FastStore Platform

  • Review and document required API changes
  • Define custom rules for specific needs
  • Maintain the analyzer as a package and be sensitive to the needs of the extension points

Best Practices

  1. Integration

    • Always run analyzer in pre-build hooks
    • Use specific file patterns
    • Handle errors gracefully
  2. Configuration

    • Document any custom rules
    • Version control your analyzer config
    • Regular updates of analyzer package
  3. Maintenance

    • Regular testing of analyzer rules
    • Keep documentation updated
    • Report issues and edge cases to the FastStore Platform team through #team-faststore-platform-dev

Common Issues and Solutions

Known Issues

  1. Performance with Large Codebases

This is being explored in our roadmap. As though this does not mean that the fsp-analyzer will deteriorate as the codebase gets larger, the response time will be impacted, since the time-to-compute won't be the same.

  • Use specific file patterns
  • Implement incremental analysis
  • Consider splitting analysis into chunks
  1. False Positives
    • Document exceptions
    • Use ignore patterns when necessary
    • Report to the FastStore Platform team through #team-faststore-platform-dev for refinements

Support and Resources