Skip to content

Ever refactor scanner#49

Merged
trishedith merged 2 commits intodevfrom
ever-refactor-scanner
Mar 26, 2026
Merged

Ever refactor scanner#49
trishedith merged 2 commits intodevfrom
ever-refactor-scanner

Conversation

@GuesouL
Copy link
Copy Markdown
Contributor

@GuesouL GuesouL commented Mar 26, 2026

Overview

This PR introduces a major stability upgrade to the core CLI scanning architecture and resolves critical Vite dependency routing errors that were preventing the dashboard from rendering.

The Problem

  1. Silent Backend Crashes: Relying purely on .tsx file extensions caused the scanner to feed utility files and API route handlers into the AST parser, resulting in fatal, silent ECONNREFUSED crashes when running serve.
  2. Missing Dependencies: The Vite server was attempting to resolve CLI-specific dependencies (react-live, prism-react-renderer) from the user's target directory instead of the CLI's internal node_modules.
  3. MIME Type Masking: The Express catch-all route was improperly intercepting missing .js chunk requests and serving index.html, burying the actual 404 errors behind confusing text/html MIME type console errors.

The Solution

  • Smart AST Filtering: Implemented a new isActuallyReactComponent helper leveraging ts-morph to deeply inspect files. Files are now only added to the manifest if their AST explicitly returns JSX, bypassing utility files safely.
  • Memory-Safe Scanning: Added project.removeSourceFile() within the scanner loop to prevent memory leaks on massive codebases.
  • Vite Alias Resolution: Updated the createViteServer config to use require.resolve() to explicitly alias and whitelist CLI dependencies, ensuring live previews render without forcing the user to install additional packages.
  • Express Route Fix: Patched the fallback SPA routing to naturally 404 on missing compiled assets with file extensions, dramatically improving debugging visibility.

Testing

  • Successfully scanned a 13-component project (TuneGraph), isolating the 11 true React components and safely bypassing 2 utility files.
  • Verified Vite bundler successfully attaches without dependency resolution errors.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pattern-book Canceled Canceled Mar 26, 2026 6:38am
test Error Error Mar 26, 2026 6:38am

@trishedith trishedith merged commit 2b1caff into dev Mar 26, 2026
5 of 7 checks passed
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.

3 participants