Categories

Import Path Extractor

Extract all import/require paths from JavaScript/TypeScript code

Import Path Extractor

This tool extracts all import and require statements from JavaScript/TypeScript code:

Supported Import Types:

  • ES6 Imports: import ... from 'path'
  • TypeScript Type-only Imports: import type ... from 'path'
  • Dynamic Imports: import('path')
  • CommonJS Requires: require('path')
  • Export From: export ... from 'path'

Path Categories:

  • Package Imports: node_modules packages (e.g., 'react', 'lodash')
  • Relative Imports: Local files (e.g., './utils', '../components')
  • Absolute Imports: Absolute paths (e.g., '/src/config')

Features:

  • Line number tracking for each import
  • Deduplication of import paths
  • Grouping by import type
  • Filtering by package/relative paths
  • Support for both JavaScript and TypeScript

Example Usage:

import React from 'react'
import { useState } from 'react'
import type { User } from './types'
import * as lodash from 'lodash'
const utils = require('./utils')
import('./lazyModule').then(module => {})
export { Component } from './Component'

Use Cases:

  • Analyze code dependencies
  • Find all imported modules
  • Identify external dependencies
  • Refactor import statements
  • Audit code for unused imports

Include imports from node_modules (package imports)

Include relative file imports (./, ../)

Group results by import type (ES6, CommonJS, Dynamic, etc.)

Key Facts

Category
Development
Input Types
textarea, checkbox
Output Type
json
Sample Coverage
4
API Ready
Yes

Overview

### Import Path Extractor This tool extracts all import and require statements from JavaScript/TypeScript code: **Supported Import Types:** - **ES6 Imports**: `import ... from 'path'` - **TypeScript Type-only Imports**: `import type ... from 'path'` - **Dynamic Imports**: `import('path')` - **CommonJS Requires**: `require('path')` - **Export From**: `export ... from 'path'` **Path Categories:** - **Package Imports**: node_modules packages (e.g., 'react', 'lodash') - **Relative Imports**: Local files (e.g., './utils', '../components') - **Absolute Imports**: Absolute paths (e.g., '/src/config') **Features:** - Line number tracking for each import - Deduplication of import paths - Grouping by import type - Filtering by package/relative paths - Support for both JavaScript and TypeScript **Example Usage:** ```javascript import React from 'react' import { useState } from 'react' import type { User } from './types' import * as lodash from 'lodash' const utils = require('./utils') import('./lazyModule').then(module => {}) export { Component } from './Component' ``` **Use Cases:** - Analyze code dependencies - Find all imported modules - Identify external dependencies - Refactor import statements - Audit code for unused imports

When to Use

  • Use it when you need to convert development content quickly in the browser.
  • Helpful for development workflows that need repeatable inputs and fast results.
  • Useful when you want to test input and output behavior before integrating the workflow elsewhere.

How It Works

  • Provide JavaScript/TypeScript Code, Include Node Modules, Include Relative Paths, Group by Import Type as input to the tool.
  • The tool processes the request and returns a json result.
  • For repeatable workflows, use the API endpoint shown on the page after validating the result interactively.

Use Cases

Convert development data during debugging or QA.
Validate expected output before using the API or automation flows.
Compare small variations of input to understand output differences quickly.

Try with Samples

development

Related Hubs

FAQ

What does Import Path Extractor do?

Import Path Extractor helps you convert development content online without setting up a separate local script or app.

When should I use this tool?

Use it when you need a quick convert workflow, want to verify output, or need a browser-based utility for development tasks.

Can I try this tool with sample data?

Yes. Try short representative inputs first, then move to larger or more complex cases once the output looks correct.

What inputs does Import Path Extractor accept?

Import Path Extractor accepts JavaScript/TypeScript Code, Include Node Modules, Include Relative Paths, Group by Import Type.

Is there an API for Import Path Extractor?

Yes. The tool page includes an API endpoint so you can move from manual testing to scripted usage.

API Documentation

Request Endpoint

POST /en/api/tools/import-path-extractor

Request Parameters

Parameter Name Type Required Description
code textarea Yes -
includeNodeModules checkbox No Include imports from node_modules (package imports)
includeRelativePaths checkbox No Include relative file imports (./, ../)
groupByType checkbox No Group results by import type (ES6, CommonJS, Dynamic, etc.)

Response Format

{
  "key": {...},
  "metadata": {
    "key": "value"
  },
  "error": "Error message (optional)",
  "message": "Notification message (optional)"
}
JSON Data: JSON Data

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-import-path-extractor": {
      "name": "import-path-extractor",
      "description": "Extract all import/require paths from JavaScript/TypeScript code",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=import-path-extractor",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

If you encounter any issues, please contact us at [email protected]