@solid-devtools/transform v0.10.4
@solid-devtools/transform
A babel transform plugin for vite for transforming Solid code. For development — debugging purposes only.
It can do very useful things for you: Wrap stores to let the debugger observe them. Automatically name signals, memos and stroes. It's also required by the Locator package to allow for going to the source code of the components.
Getting Started
Installation
npm i -D @solid-devtools/transform
# or
yarn add -D @solid-devtools/transform
# or
pnpm i -D @solid-devtools/transform
Setup
// vite.config.ts
import { defineConfig } from 'vite'
import solid from 'vite-plugin-solid'
import devtools from '@solid-devtools/transform'
export default defineConfig({
plugins: [devtools(), solid()],
})
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.
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.
locator.jsxLocation
Inject location attributes to jsx templates. This is required for the debugger's locator feature.
Changelog
See CHANGELOG.md.