detective-typescript
Get the dependencies of a TypeScript module
Last updated 5 years ago by pahen .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install detective-typescript 
SYNC missed versions from official npm registry.

detective-typescript

CI npm version npm downloads

Get the dependencies of TypeScript module

npm install detective-typescript typescript

Usage

const fs = require('fs');
const detective = require('detective-typescript');

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

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

Options

  • skipTypeImports (default: false) Skips imports that only imports types
  • mixedImports: (default: false) Include CJS imports in dependency list
  • skipAsyncImports: (default: false) Whether or not to omit async imports (import('foo'))
  • jsx: (default: false) Enable parsing of JSX
  • onFile: A callback that will be called before the file is processed. Intended for use with dependency-tree. Passed an object argument with properties options (echoing any options passed in, e.g., by precinct), src (source code for file as string), ast (parsed AST object for the file source), and walker (a Walker instance from node-source-walk configured for TypeScript to which you can pass the ast or src).
  • onAfterFile: Similar to onFile, but the callback is also passed an object property dependencies, a string array with the extracted dependencies.

License

MIT

Current Tags

  • 13.0.0                                ...           latest (7 months ago)

36 Versions

  • 13.0.0                                ...           7 months ago
  • 12.0.0                                ...           7 months ago
  • 11.2.0                                ...           7 months ago
  • 11.1.0                                ...           2 years ago
  • 11.0.2                                ...           2 years ago
  • 11.0.1                                ...           2 years ago
  • 11.0.0                                ...           2 years ago
  • 10.0.0                                ...           2 years ago
  • 9.1.1                                ...           2 years ago
  • 9.1.0                                ...           2 years ago
  • 9.0.0                                ...           3 years ago
  • 8.0.1                                ...           3 years ago
  • 8.0.0                                ...           3 years ago
  • 7.0.2                                ...           3 years ago
  • 7.0.1                                ...           3 years ago
  • 7.0.0                                ...           4 years ago
  • 6.0.0                                ...           4 years ago
  • 5.8.0                                ...           5 years ago
  • 5.7.0                                ...           5 years ago
  • 5.6.1                                ...           5 years ago
  • 5.6.0                                ...           5 years ago
  • 5.5.0                                ...           5 years ago
  • 5.4.0                                ...           5 years ago
  • 5.3.0                                ...           5 years ago
  • 5.2.0                                ...           6 years ago
  • 5.1.1                                ...           6 years ago
  • 5.1.0                                ...           6 years ago
  • 5.0.0                                ...           6 years ago
  • 4.1.2                                ...           6 years ago
  • 4.1.1                                ...           6 years ago
  • 4.1.0                                ...           6 years ago
  • 4.0.0                                ...           6 years ago
  • 3.0.0                                ...           6 years ago
  • 2.0.0                                ...           7 years ago
  • 1.0.1                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
Downloads
Total 18
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE