detective-es6

Get the dependencies of an ES6 module

MIT 25 个版本
安装
npm install detective-es6
yarn add detective-es6
pnpm add detective-es6
bun add detective-es6
README

detective-es6

CI npm version npm downloads

Get the dependencies of an ES6 module

npm install detective-es6

Usage

ESM

import fs from 'node:fs';
import detective from 'detective-es6';

const mySourceCode = fs.readFileSync('myfile.js', 'utf8');

// Pass in a file's content or an AST
const dependencies = detective(mySourceCode);

CommonJS

const { default: detective } = require('detective-es6');

You may also (optionally) configure the detective via a second object argument detective(src, options) that supports the following options:

  • skipTypeImports: (Boolean) whether or not to omit type imports (import type {foo} from "mylib";) in the list of extracted dependencies.
  • skipAsyncImports: (Boolean) whether or not to omit async imports (import('foo')) in the list of extracted dependencies.

License

MIT

版本列表
6.0.0 2026-05-19
5.0.2 2026-04-20
5.0.1 2025-02-01
5.0.0 2024-04-14
4.0.1 2023-05-12
4.0.0 2023-05-05
3.0.1 2023-03-19
3.0.0 2022-03-03
2.2.2 2022-02-22
2.2.1 2021-11-11
2.2.0 2020-06-27
2.1.0 2019-03-09
2.0.0 2018-09-03
1.2.0 2017-08-27
1.1.6 2016-09-25
1.1.5 2016-06-25
1.1.4 2016-06-12
1.1.3 2015-10-24
1.1.2 2015-06-27
1.1.1 2015-04-26
1.1.0 2014-12-14
1.0.2 2014-12-13
1.0.1 2014-10-28
1.0.0 2014-10-28
0.0.0 2014-10-25