Package Exports
- detective-typescript
- detective-typescript/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (detective-typescript) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
detective-typescript
Get the dependencies of TypeScript module
npm install detective-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 typesmixedImports
: (default:false
) Include CJS imports in dependency listskipAsyncImports
: (default:false
) Whether or not to omit async imports (import('foo'))jsx
: (default:false
) Enable parsing of JSXonFile
: A callback that will be called before the file is processed. Intended for use withdependency-tree
. Passed an object argument with propertiesoptions
(echoing any options passed in, e.g., byprecinct
),src
(source code for file as string),ast
(parsed AST object for the file source), andwalker
(aWalker
instance fromnode-source-walk
configured for TypeScript to which you can pass theast
orsrc
).onAfterFile
: Similar toonFile
, but the callback is also passed an object propertydependencies
, a string array with the extracted dependencies.
License
MIT