Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance dependency analysis with TypeScript type system #454

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

poteboy
Copy link
Collaborator

@poteboy poteboy commented Jan 27, 2025

This PR improves the dependency analysis functionality by leveraging TypeScript's type system:

  • Utilize TypeScript's type checker for accurate module resolution
  • Add support for dynamic imports
  • Remove custom module resolution in favor of TypeScript's built-in functionality
  • Improve performance by early filtering of node_modules
  • Clean up and simplify the codebase

The changes make the analyzer more reliable and maintainable while improving its accuracy in detecting dependencies.

Example of improved analysis:

// src/components/Button.tsx
export const Button = () => {
return <button>Click me</button>
}
// src/components/Header.tsx
import { Avatar } from './Avatar'
export const Header = () => {
return <div><Avatar /></div>
}
// src/components/Avatar.tsx
export const Avatar = () => {
return <div>Avatar</div>
}

The analyzer can now correctly identify:

  • Button.tsx as "safe to remove" (no dependencies, not used)
  • Header.tsx and Avatar.tsx as "needs review" (interdependent)

This helps LLM safely identify unused components while being cautious with interconnected files.

Copy link

railway-app bot commented Jan 27, 2025

🚅 Previously deployed to Railway in the onestack.dev project. Environment has been deleted.

@natew natew merged commit e5fe9ae into main Jan 27, 2025
6 checks passed
@natew natew deleted the feat/improve-dependency-analysis branch January 27, 2025 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants