0.0.5 • Published 8 years ago
dependit v0.0.5
dependit
Parse all the imported modules inside the file(Only ES Modules supported)
To install:
npm install dependit -SUsage
import getDependency from 'dependit'
const filepath = '/path/to/your/file'
const result = getDependency(filepath)API Documentation
getDependency(filepath)
filepathabsolute 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