Skip to content

assuming/dependit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dependit

Parse all the imported modules inside the file(Only ES Modules supported)

To install:

npm install dependit -S

Usage

import getDependency from 'dependit'

const filepath = '/path/to/your/file'
const result = getDependency(filepath)

API Documentation

getDependency(filepath)

  • filepath absolute path to your file

Returned object

The return value is an object with all the dependencies information. The object's structure is listed below using TypeScript.

interface Result {
  path: string,
  dependencies: Array<Dependency>
}

interface Dependency {
  source: string,
  imported: Array<ImportedItem>
}

interface ImportedItem {
  value: string,
  local: string,
  type: ImportType
}

enum ImportType {
  default = 'ImportDefault',
  import = 'Import',
  namespace = 'ImportNamespace'
}

Supported file types

Currently only 4 types are supported:

  • .js
  • .jsx
  • .ts
  • .vue

About

Find the connection inside your project files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published