next.js
04722838 - Add TypeScript props type analysis for boundary detection

Commit
160 days ago
Add TypeScript props type analysis for boundary detection Implemented TypeScript compiler API integration to analyze props types passed across server→client boundaries. **TypeScript Type Resolver** (`packages/next/src/server/boundary-analysis/`): - Created type-resolver.ts using TypeScript compiler API - Resolves props type from JSX element location - Extracts prop names and type string - Detects sensitive patterns (password, secret, token, apiKey, credential) **Boundary Analysis Module** (`packages/next/src/server/boundary-analysis/index.ts`): - Public API for analyzing boundaries - Orchestrates type resolution for multiple boundaries - Formats output with sensitive data warnings **Hot Reloader Integration**: - Loads TypeScript module dynamically - Calls analyzeBoundaries for detected boundaries - Displays type information with sensitive data alerts **How it works:** 1. Boundary detected with JSX location (from previous commit) 2. TypeScript compiler API loads project tsconfig 3. Creates program and type checker 4. Finds AST node at JSX location 5. Resolves component type and extracts props type 6. Analyzes prop names for sensitive patterns 7. Outputs type info with warnings **Expected output:** ``` === Server→Client Boundary Type Analysis === Boundary: isolate/test/app/page.tsx → Client Component: isolate/test/app/ClientButton.tsx → Props Type: { label: string; count?: number; apiKey?: string; password?: string } → Props: label, count, config, apiKey, password ⚠️ SENSITIVE DATA DETECTED: API_KEY, PASSWORD ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Author
Committer
Parents
Loading