Skip to content

Latest commit

 

History

History
61 lines (45 loc) · 1.18 KB

README.md

File metadata and controls

61 lines (45 loc) · 1.18 KB

detective-esm

find ES module dependencies

npm travis standard

Example

input.js:

import xyz from 'xyz'
import 'a'

require('b')

export default function d () {}
export { d as c }

log.js:

var detective = require('detective-esm')
var fs = require('fs')

console.log(detective(
  fs.readFileSync('./input.js')
))
$ node log.js
{ strings: [ 'xyz', 'a' ],
  expressions: [],
  imports: [ { from: 'xyz', import: 'default', as: 'xyz' } ],
  exports: [ { export: 'd', as: 'default' }, { export: 'd', as: 'c' } ] }

Install

npm install detective-esm

Usage

var detectiveEsm = require('detective-esm')

License

MIT