find all `require` `import` calls by walking the AST
npm install konan   
> Like detective but also supports ES6 import and more.
``bash`
yarn add konanor hey old school
npm install --save konan
- require callimport/export
- ES6 modulesimport()
- Dynamic importjsx
- You can use all language features supported by babel parser, including syntax by default
`js
const konan = require('konan')
konan(
import React, {Component} from 'react'
const vue = require('vue/dist/vue')
import('./my-async-module').then()
require(path.resolve('./')))`
/*
result =>
{
strings: ['react', 'vue/dist/vue', './my-async-module'],
expressions: ['path.resolve(\'./\')']
}
*/
#### input
Type: string objecttrue
Required:
Source content as string or AST tree.
#### options
##### dynamicImport
Type: booleantrue
Default:
You can disable detecting dynamic import()-ed modules.
##### parse
Type: object{sourceType: 'module', plugins: ['jsx', 'typescript', 'dynamicImport']}
Default:
babel parser parse options.
It stands for Meitantei Konan (名探偵コナン), the main character in Detective Conan.
1. Fork it!
2. Create your feature branch: git checkout -b my-new-featuregit commit -am 'Add some feature'
3. Commit your changes: git push origin my-new-feature`
4. Push to the branch:
5. Submit a pull request :D
konan © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).
> egoistian.com · GitHub @egoist · Twitter @_egoistlily