1.1.0 • Published 5 years ago

@depack/detect v1.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

@depack/detect

npm version

@depack/detect Detects Dependencies In The Source File.

yarn add -E @depack/detect

Table Of Contents

API

The package is available by importing its default function:

import detect from '@depack/detect'

detect(  source: string,): Array<string>

Returns the paths or names of packages that are imported in the source code.

For example, for the given source file

import test from 'test'
import test2, * as test3 from 'test2'
import 'test3'
export { default as Test } from 'test4'

It will produce the following output

/* yarn example/ */
import detect from '@depack/detect'
import read from '@wrote/read'

(async () => {
  const source = await read('example/source.js')
  const res = detect(source)
  console.log(res)
})()
[ 'test', 'test2', 'test3', 'test4' ]

Copyright

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago