Package Exports
- react-file-analyzer
- react-file-analyzer/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-file-analyzer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-file-analyzer
A powerful NPM package for analyzing React and Next.js projects. It provides tools for file insights, dependency graphs, directory structures, and more. Can be used as a CLI or via an HTTP server.
Installation
npm install react-file-analyzerUsage
CLI Examples
Comprehensive file analysis:
react-file-analyzer --analyze-comprehensive path/to/file.tsx --jsonDependency analysis:
react-file-analyzer --analyze-deps --diagram-type flowchart
Read file contents:
react-file-analyzer --read-files file1.tsx,file2.tsx --jsonDirectory tree:
react-file-analyzer --dir-tree . --depth 3 --json
Start server:
react-file-analyzer --serve --port 3000 --token mysecret
Server Endpoints
- POST /analyze-comprehensive { "filePath": "path/to/file.tsx" } - Comprehensive insights.
- POST /analyze-deps { "includePatterns": [...], ... } - Dependency graph.
- POST /read-files { "files": ["file1.tsx", "file2.tsx"] } - File contents.
- GET /dir-structure?dir=. - Directory structure.
- GET /dir-tree?dir=.&depth=3 - Directory tree.
- POST /analyze-simple { "filePath": "path/to/file.tsx" } - Simple insights.
- POST /clean { "dir": "path/to/dir" } - Clean directory.
All endpoints require Bearer token if set.
Features
- Babel-powered AST analysis for components, hooks, props, state, functions.
- Dependency graph with circular detection and Mermaid diagrams.
- Secure server with path traversal protection.
- Directory traversal and cleaning utilities.
For more details, see the source code or run --help.