0.30.1 • Published 1 month ago

solid-devtools v0.30.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

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.

0.30.1

1 month ago

0.30.0

1 month ago

0.29.3

4 months ago

0.29.0

6 months ago

0.27.9

6 months ago

0.27.8

6 months ago

0.29.2

6 months ago

0.29.1

6 months ago

0.28.1

6 months ago

0.28.0

6 months ago

0.27.2

11 months ago

0.27.1

11 months ago

0.27.0

12 months ago

0.27.7

9 months ago

0.27.6

10 months ago

0.27.5

10 months ago

0.27.4

10 months ago

0.27.3

11 months ago

0.27.0-next.0

12 months ago

0.26.1

12 months ago

0.25.0

1 year ago

0.26.0

1 year ago

0.20.1

2 years ago

0.20.0

2 years ago

0.19.0

2 years ago

0.23.1

1 year ago

0.23.0

1 year ago

0.21.0

1 year ago

0.24.5

1 year ago

0.24.4

1 year ago

0.24.3

1 year ago

0.24.2

1 year ago

0.24.1

1 year ago

0.24.0

1 year ago

0.22.0

1 year ago

0.24.7

1 year ago

0.24.6

1 year ago

0.18.1

2 years ago

0.18.2

2 years ago

0.13.0

2 years ago

0.14.0

2 years ago

0.15.0

2 years ago

0.14.1

2 years ago

0.16.0

2 years ago

0.17.0

2 years ago

0.18.0

2 years ago

0.17.1

2 years ago

0.16.2

2 years ago

0.12.0

2 years ago

0.11.0

2 years ago

0.10.1

2 years ago

0.10.0

2 years ago

0.9.0

2 years ago

0.8.2

2 years ago

0.8.1

2 years ago

0.8.0

2 years ago

0.7.2

2 years ago

0.7.1

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.7

2 years ago

0.2.4

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago