パッケージの詳細

@depack/detect

dpck1.2kMIT1.1.0

Detects Dependencies In The Source File.

detect, depack

readme

@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

更新履歴

14 May 2019

1.1.0

  • [feature] Detect export * from '@externs/preact'.

19 April 2019

1.0.2

  • [deps] Update and unlock dependencies.

2 April 2019

1.0.1

  • [deps] Upgrade mismatch.

9 February 2019

1.0.0