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 🙏

© 2024 – Pkg Stats / Ryan Hefner

solid-devtools

v0.30.1

Published

Runtime library for hooking up SolidJS application with Solid Devtools Extension

Downloads

46,890

Readme

solid-devtools

pnpm version npm

The main client library. It reexports the most important tools and connects the client application to the chrome extension.

Installation

npm i -D solid-devtools
# or
yarn add -D solid-devtools
# or
pnpm add -D solid-devtools

Using the browser extension

For the usage guide of the Solid Devtools chrome extension, please refer to the extension documentation.

Type Module

The vite plugin is exported as an ESM module, so you need to make sure that you have the "type": "module" field in your package.json.

{
  "type": "module"
}

Vite plugin

The vite plugin is the easiest way to get started with the devtools. It will automatically inject the extension client script to the page and connect the application to the extension.

It will also transform the code to make it easier to debug. For development — debugging purposes only.

Setup

// vite.config.ts

import { defineConfig } from 'vite'
import solid from 'vite-plugin-solid' // or solid-start/vite
import devtools from 'solid-devtools/vite'

export default defineConfig({
  plugins: [
    devtools({
      /* features options - all disabled by default */
      autoname: true, // e.g. enable autoname
    }),
    solid({
      // currently HMR breaks displaying components
      // https://github.com/solidjs/solid-refresh/pull/41 will fix this
      hot: false,
    }),
  ],
})

To be able to open the source code of your components in your IDE, you need to enable the component locator. Here is how to do it:

// vite.config.ts

devtools({
  // pass `true` or an object with options
  locator: {
    targetIDE: 'vscode',
    componentLocation: true,
    jsxLocation: true,
  },
})

>> Follow this locator guide to know more

Import the devtools runtime

The plugin doesn't automatically import the devtools runtime. You need to import it manually in your application's client-side entry point.

The runtime is important for exposing the devtools API to the extension.

// src/index.tsx or src/client-entry.tsx

import 'solid-devtools'
// or from 'solid-devtools/setup' if you're not using the vite plugin

Options

By default the plugin will only inject the debugger and extension client script to the page. (If installed)

All of the other transforms are disabled by default—you need to pick what you want by enabling correlated option.

interface DevtoolsPluginOptions {
  /** Add automatic name when creating signals, memos, stores, or mutables */
  autoname?: boolean
  locator?:
    | boolean
    | {
        /** Choose in which IDE the component source code should be revealed. */
        targetIDE?: Exclude<LocatorOptions['targetIDE'], TargetURLFunction>
        /**
         * Holding which key should enable the locator overlay?
         * @default 'Alt'
         */
        key?: LocatorOptions['key']
        /** Inject location attributes to jsx templates */
        jsxLocation?: boolean
        /** Inject location information to component declarations */
        componentLocation?: boolean
      }
}

// in vite.config.ts plugins array:
devtools({
  autoname: true,
  locator: {
    targetIDE: 'vscode',
    key: 'Ctrl',
    jsxLocation: true,
    componentLocation: true,
  },
})

autoname

This option adds automatic name to signals, memos, stores, and mutables. Those names will be visible in the devtools when inspecting.

name-transform-example

locator

This option enables the locator feature. The key and targetIDE are going to pe passed to useLocator function call.

locator.componentLocation

Inject location information to component functions. This will add a button in the devtools inspector panel, allowing you to go to the source code of the component.

component-location-ui

locator.jsxLocation

Inject location attributes to jsx templates. This is required for the debugger's locator feature.

Changelog

See CHANGELOG.md.