https://github.com/dleitee/showdeps
A little library to list all imports in a code.
https://github.com/dleitee/showdeps
dependencies library
Last synced: 10 months ago
JSON representation
A little library to list all imports in a code.
- Host: GitHub
- URL: https://github.com/dleitee/showdeps
- Owner: dleitee
- License: mit
- Created: 2017-02-15T01:37:47.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-06-05T16:27:30.000Z (about 8 years ago)
- Last Synced: 2025-04-02T13:11:11.488Z (about 1 year ago)
- Topics: dependencies, library
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# showdeps
A little library to list all imports in a code.
## Install
```
npm install --save showdeps
```
## Usage
```javascript
import showdeps from 'showdeps'
const code = `
import strman from 'strman'
console.log('dleitee')
`
showdeps(code)
/**
* [{
* "file": "strman",
* "specifiers": [{
* "name": "strman",
* "type": "ImportDefaultSpecifier",
* }],
* }]
*/
```
## Specifiers types
### ImportDefaultSpecifier
When you import default dependency. Ex. `import strman from 'strman'`
### ImportSpecifier
When you import specified dependency. Ex. `import { replace } from 'strman'`
### ImportNamespaceSpecifier
When you import named dependency. Ex. `import * as strman from 'strman'`