{"id":26214636,"url":"https://github.com/azer/react-analyzer","last_synced_at":"2026-03-08T08:33:24.564Z","repository":{"id":276804342,"uuid":"852411757","full_name":"azer/react-analyzer","owner":"azer","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-10T08:05:49.000Z","size":955,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-15T18:50:49.916Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://azer.github.io/react-analyzer/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/azer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-04T18:58:26.000Z","updated_at":"2025-04-10T08:05:53.000Z","dependencies_parsed_at":"2025-04-09T17:35:33.114Z","dependency_job_id":null,"html_url":"https://github.com/azer/react-analyzer","commit_stats":null,"previous_names":["azer/react-analyzer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/azer/react-analyzer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Freact-analyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Freact-analyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Freact-analyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Freact-analyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azer","download_url":"https://codeload.github.com/azer/react-analyzer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azer%2Freact-analyzer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30250401,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T08:09:00.343Z","status":"ssl_error","status_checked_at":"2026-03-08T08:07:06.692Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-12T10:17:57.879Z","updated_at":"2026-03-08T08:33:24.538Z","avatar_url":"https://github.com/azer.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-analyzer\n\nExtract structured information about React components and their props through AST parsing. See also: [react-analyzer-mcp](https://github.com/azer/react-analyzer-mcp)\n\n**Ideal for:**\n* Feeding high level codebase structure to LLMs\n* Building developer tools / visual component editors / component catalogs (e.g storybooks)\n* Performing static analysis\n* Documentation generation\n\n**Included:**\n- Supports JSX and TSX files\n- Extracts component names, props, and their types\n- Supports complex TypeScript types\n- Handles React.FC, React.memo, and React.forwardRef\n- Detects default props (`({ items = [] })` and prop types (`component.propTypes =`)\n- Processes generic types and utility types\n\n**Demo:**\n\n[![react analyzer 2](https://github.com/user-attachments/assets/f4fe84c5-13b6-4030-860e-de5095dcc2ca)](https://x.com/azerkoculu/status/1910013631766450294)\n\n**Scope:**\n\nFocused on React component analysis but internally scans all variables, functions, interfaces in given files. Can be extended for other frameworks, etc.\n\n## Install\n\n```bash\nnpm install azer/react-analyzer\n```\n\nCompile:\n\n```bash\nnpm run build\n```\n\nRun tests:\n\n```bash\nnpm run test\n```\n\n## Usage\n\n```js\nimport { analyzeReactFile } from 'react-analyzer';\n\n// Analyze a React file\nconst result = analyzeReactFile('MyComponent.tsx', sourceCode);\n```\n\n## Examples\n\n### Simple JSX Component\n\n```ts\nexport function HelloWorld(props) {\n  return \u003cdiv\u003e{props.user}: {props.message}\u003c/div\u003e\n}\n```\n\nAnalysis result:\n\n```ts\n{\n  type: 'jsx',\n  filename: 'HelloWorld.jsx',\n  components: [{\n    name: 'HelloWorld',\n    props: {\n      message: { type: 'unknown', optional: false },\n      user: { type: 'unknown', optional: false }\n    }\n  }]\n}\n```\n\n### Simple TSX Component\n\n```tsx\ninterface Props {\n  name: string;\n  age: number;\n  isActive?: boolean;\n}\n\nexport const MyComponent = ({ name, age, isActive }: Props) =\u003e {\n  return \u003cdiv\u003e{name}: {age}\u003c/div\u003e;\n};\n\nconst Foo = MyComponent\nconst Bar = Foo\nexport { Bar }\n```\n\nAnalysis result:\n\n```tsx\n{\n  type: 'tsx',\n  filename: 'MyComponent.tsx',\n  components: [{\n    name: 'MyComponent',\n    props: {\n      name: { type: 'string', optional: false },\n      age: { type: 'number', optional: false },\n      isActive: { type: 'boolean', optional: true },\n    },\n  },\n  {\n    name: 'Bar',\n    props: {\n      name: { type: 'string', optional: false },\n      age: { type: 'number', optional: false },\n      isActive: { type: 'boolean', optional: true },\n    },\n  }]\n}\n```\n\n### Complex TSX Component\n\n```tsx\ninterface Item {\n  id: string;\n  name: string;\n}\n\ninterface ComplexWrappedComponentProps {\n  items: Item[];\n  onItemSelect: (item: Item) =\u003e void;\n  initialCount?: number;\n}\n\nconst ComplexWrappedComponent: React.FC\u003cComplexWrappedComponentProps\u003e = React.memo(({ \n  items, \n  onItemSelect, \n  initialCount = 0 \n}) =\u003e {\n  return (\n    \u003cdiv\u003e\n      \u003ch2\u003eSelected: {initialCount}\u003c/h2\u003e\n      \u003cul\u003e\n        {items.map((item) =\u003e (\n          \u003cli key={item.id} onClick={() =\u003e onItemSelect(item)}\u003e\n            {item.name}\n          \u003c/li\u003e\n        ))}\n      \u003c/ul\u003e\n    \u003c/div\u003e\n  );\n});\n\nexport default ComplexWrappedComponent;\n```\n\nAnalysis result:\n\n```tsx\n{\n  type: 'tsx',\n  filename: 'ComplexComponent.tsx',\n  components: [{\n    name: 'ComplexWrappedComponent',\n    props: {\n      items: {\n        type: 'array',\n        optional: false,\n        elementType: {\n          type: 'object',\n          props: {\n            id: { type: 'string', optional: false },\n            name: { type: 'string', optional: false }\n          },\n          typeName: 'Item'\n        }\n      },\n      onItemSelect: {\n        type: 'function',\n        optional: false,\n        parameters: [{\n          type: 'object',\n          props: {\n            id: { type: 'string', optional: false },\n            name: { type: 'string', optional: false }\n          },\n          typeName: 'Item'\n        }],\n        returnType: { type: 'void' }\n      },\n      initialCount: {\n        type: 'number',\n        optional: true,\n        defaultValue: '0'\n      }\n    },\n    wrapperFn: 'React.memo'\n  }]\n}\n```\n\n# Project Sponsor\n\n[Ray Labs](https://raylabs.ai)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazer%2Freact-analyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazer%2Freact-analyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazer%2Freact-analyzer/lists"}