0.10.4 • Published 1 year ago

@solid-devtools/transform v0.10.4

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

@solid-devtools/transform

pnpm version npm

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.

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.10.0

1 year ago

0.10.1

1 year ago

0.10.2

1 year ago

0.10.3

1 year ago

0.10.4

1 year ago

0.7.5

2 years ago

0.9.0

2 years ago

0.8.0

2 years ago

0.7.4

2 years ago

0.7.2

2 years ago

0.7.1

2 years ago

0.7.3

2 years ago

0.7.0

2 years ago

0.6.2

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago