moroshko / react-scanner

Extract React components and props usage from code.
MIT License
563 stars 40 forks source link

Feature request: Access component source file path using any of the available processors #66

Open alexandra-lim opened 1 year ago

alexandra-lim commented 1 year ago

Would love to be able to access the source file path of the component from any of the processors to output something like:

{
  "Text": {
    "sourcePath": "/path/to/component",
    "instances": [
      {
        "props": {
          "textStyle": "subtitle2"
        },
        "propsSpread": false,
        "location": {
          "file": "/path/to/file",
          "start": {
            "line": 9,
            "column": 9
          }
        }
      },
    ]
  },
}

Or alternatively, is there a way to get this value from importedFrom in the config?