Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dpck/detect
Detects Dependencies In The Source File.
https://github.com/dpck/detect
Last synced: about 1 month ago
JSON representation
Detects Dependencies In The Source File.
- Host: GitHub
- URL: https://github.com/dpck/detect
- Owner: dpck
- License: mit
- Created: 2019-02-09T16:23:57.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-14T11:30:51.000Z (over 5 years ago)
- Last Synced: 2024-11-10T21:13:34.083Z (about 2 months ago)
- Language: JavaScript
- Homepage: https://artd.eco/depack
- Size: 46.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @depack/detect
[![npm version](https://badge.fury.io/js/%40depack%2Fdetect.svg)](https://npmjs.org/package/@depack/detect)
`@depack/detect` Detects Dependencies In The Source File.
```sh
yarn add -E @depack/detect
```## Table Of Contents
- [Table Of Contents](#table-of-contents)
- [API](#api)
- [`detect(source: string): Array`](#detectsource-string-arraystring)
- [Copyright](#copyright)## API
The package is available by importing its default function:
```js
import detect from '@depack/detect'
```## `detect(`
`source: string,`
`): Array`Returns the paths or names of packages that are imported in the source code.
_For example, for the given source file_
```js
import test from 'test'
import test2, * as test3 from 'test2'
import 'test3'
export { default as Test } from 'test4'
```_It will produce the following output_
```js
/* 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)
})()
```
```js
[ 'test', 'test2', 'test3', 'test4' ]
```## Copyright
© Art Deco for Depack 2019
Tech Nation Visa Sucks