@depack/detect
Detects Dependencies In The Source File.
Last updated 6 years ago by zvr .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install @depack/detect 
SYNC missed versions from official npm registry.

@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

Art Deco © Art Deco for Depack 2019 Tech Nation Visa Tech Nation Visa Sucks

Current Tags

  • 1.1.0                                ...           latest (6 years ago)

4 Versions

  • 1.1.0                                ...           6 years ago
  • 1.0.2                                ...           6 years ago
  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 4
Last Day 0
Last Week 4
Last Month 0
Dependencies (1)
Dev Dependencies (6)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |