Get Started

Static Import Engine

Trace imports through your codebase

The Static Import Engine uses git grep to find all files that import or require the target file. Works instantly even for brand new files with no git history.

Overview

Unlike the other engines that rely on git history, the Static Import Engine works with the current state of your codebase. It uses fast pattern matching to find all files that import, require, or reference the target file, giving you an immediate view of downstream dependencies.

How It Works

  1. Pattern Generation: Generates search patterns for common import syntaxes: ES6 import, CommonJS require, dynamic import().
  2. Git Grep Search: Uses `git grep` for fast, index-aware searching across the entire repository.
  3. Result Parsing: Parses results to extract file paths, line numbers, and import types.
  4. Dependency Tree: Optionally builds a full dependency tree by recursively analyzing importers.

Technical Details

Uses `git grep -n` with regex patterns tailored to your project's language. Supports JavaScript/TypeScript (import/require), Python (import/from), Go (import), and more. Falls back to ripgrep or standard grep when git grep is unavailable.

Use Cases

New File Analysis

Understand who uses a file before you've made any commits to it.

Refactoring Impact

See all consumers of a module before changing its API.

Dead Code Detection

Find files that are never imported and may be candidates for removal.

Configuration Options

OptionDefaultDescription
languages["javascript", "typescript", "python"]Languages to generate import patterns for
customPatterns[]Additional regex patterns to search for
maxDepth3Maximum depth for recursive dependency tree building
Static Import Engine | Memoria Features | Memoria