New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

swr-cache-devtools

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swr-cache-devtools

Developer tools for SWR cache visualization and debugging

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
2
-50%
Maintainers
1
Weekly downloads
 
Created
Source

SWR Cache DevTools

npm version License: MIT

Developer tools for SWR cache visualization and debugging in React applications.

Features

  • 🔍 Cache Visualization: View and explore your SWR cache data in real-time
  • 🎨 JSON Editor: Edit cache values directly in the DevTools interface
  • 🌗 Theme Support: Light, dark, and auto themes
  • 📱 Flexible Positioning: Position the DevTools panel anywhere on your screen
  • Zero Configuration: Works out of the box with any SWR setup

Installation

npm install swr-cache-devtools
# or
yarn add swr-cache-devtools
# or
pnpm add swr-cache-devtools

Usage

Simply import and add the SwrCacheDevTools component to your React application:

import { SwrCacheDevTools } from "swr-cache-devtools";

function App() {
  return (
    <div>
      {/* Your app content */}
      <SwrCacheDevTools />
    </div>
  );
}

With Custom Configuration

import { SwrCacheDevTools } from "swr-cache-devtools";

function App() {
  return (
    <div>
      {/* Your app content */}
      <SwrCacheDevTools
        position="bottom-right"
        theme="dark"
        defaultOpen={false}
        maxHeight={400}
        maxWidth={600}
      />
    </div>
  );
}

Props

PropTypeDefaultDescription
position"top-left" | "top-right" | "bottom-left" | "bottom-right""bottom-right"Position of the DevTools panel
theme"light" | "dark" | "auto""auto"Color theme
defaultOpenbooleanfalseWhether the panel starts open
maxHeightnumber400Maximum height of the panel
maxWidthnumber600Maximum width of the panel
classNamestring-Custom CSS class for the container
buttonStyleReact.CSSProperties-Custom styles for the toggle button
panelStyleReact.CSSProperties-Custom styles for the panel

Development Mode Only

It's recommended to only include the DevTools in development mode:

import { SwrCacheDevTools } from "swr-cache-devtools";

function App() {
  return (
    <div>
      {/* Your app content */}
      {process.env.NODE_ENV === "development" && <SwrCacheDevTools />}
    </div>
  );
}

Demo

You can try the DevTools in our interactive demo application:

  • Live Demo
  • Local development: pnpm dev --filter=web

Project Structure

This repository uses Turborepo for monorepo management:

  • packages/swr-cache-devtools: Main library package
  • apps/web: Demo application showcasing the DevTools
  • apps/docs: Documentation website

Requirements

  • React >= 17.0.0
  • SWR >= 2.0.0

Development

To develop all apps and packages:

# Install dependencies
pnpm install

# Start development mode
pnpm dev

To develop specific packages:

# Develop the DevTools package
pnpm dev --filter=swr-cache-devtools

# Develop the demo app
pnpm dev --filter=web

Build

To build all packages:

pnpm build

To build specific packages:

# Build the DevTools package
pnpm build --filter=swr-cache-devtools

# Build the demo app
pnpm build --filter=web

Publishing

The main package is automatically published to npm when changes are made to the packages/swr-cache-devtools directory.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  • Fork the repository
  • Create your feature branch (git checkout -b feature/amazing-feature)
  • Commit your changes (git commit -m 'Add some amazing feature')
  • Push to the branch (git push origin feature/amazing-feature)
  • Open a Pull Request

License

MIT License - see the LICENSE file for details.

Author

Yoshiharu Kamata

Keywords

swr

FAQs

Package last updated on 21 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts