@depack/detect Detects Dependencies In The Source File.
yarn add -E @depack/detectThe package is available by importing its default function:
importdetectfrom'@depack/detect'Returns the paths or names of packages that are imported in the source code.
For example, for the given source file
importtestfrom'test'importtest2,*astest3from'test2'import'test3'export{defaultasTest}from'test4'It will produce the following output
/* yarn example/ */importdetectfrom'@depack/detect'importreadfrom'@wrote/read'(async()=>{constsource=awaitread('example/source.js')constres=detect(source)console.log(res)})()['test','test2','test3','test4']![]() | © Art Deco for Depack 2019 | ![]() | Tech Nation Visa Sucks |
|---|

