1.0.43 • Published 2 years ago

visualize-react-component v1.0.43

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

visualize-react-component

Analyze the component tree of react and displays it as a diagram in the browser. You can refer to the corresponding code from the diagram.

demo.png

Motivation

  • It plays an auxiliary role in visualizing the component design during implementation and activating smooth discussions.
  • It will lead to shrinking the cost of development.

Point

  • Using the popular library, @typescript-eslint/typescript-estree AST to do the analysis.
  • By using VSCode's schema in the Browser, you can quickly check the implementation of components you are interested in.If you do not have vscode installed, you can also check the code in your browser.
  • If you are using vite without setting it in the config file, you can resolve the alias from vite.config.ts.
  • It uses prismjs, which allows for code reading that is more like an IDE.

On Daiagram

  • You can check the code of the component.
  • Reference to VS Code allows code to be referenced in VS Code.
  • New nodes can be added by double-clicking on a background other than the component.
  • Links between each node can be removed by double-clicking.
  • Dragging from the top and bottom of a node to another node to link to it.

Install

npm i -D visualize-react-component

Usage

By specifying the React root file and the component files, it will parse them and output the stats.html file.

npx virot ./src/main.tsx

Config

The following options can be set in the configuration file. Prepare a virot.config.js file with the following properties.

PropertyTypeDescription
vscodebooleanUse vscode schema to code jump to the target component. (default true)
aliasArraySpecify multiple aliases for entry points.

alias Property | Property | Type | Description | | -------- | ----- | ----------- | | find | String | Entry point alias. | | replacement | String | Resolve aliases by specifying absolute paths. |

Sample

const path = require('path')

module.exports = {
  alias: [
    {
      find: '@',
      replacement: path.resolve(__dirname, 'src'),
    },
  ],
}

Principles of conduct

Please see the principles of conduct when building a site.

License

This library is licensed under the MIT license.

1.0.43

2 years ago

1.0.42

2 years ago

1.0.41

2 years ago

1.0.40

2 years ago

1.0.39

2 years ago

1.0.38

2 years ago

1.0.37

2 years ago

1.0.36

2 years ago

1.0.35

2 years ago

1.0.34

2 years ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.29

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.0

2 years ago