From 890d412967085773bc61bacee99f0179c1c91ba8 Mon Sep 17 00:00:00 2001 From: "Anders D. Johnson" Date: Tue, 19 Jul 2022 21:17:02 -0500 Subject: [PATCH] docs: add options to readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 911040b..263b247 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ const dependencies = detective(mySourceCode); - `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`](https://github.com/dependents/node-dependency-tree). Passed an object argument with properties `options` (echoing any options passed in, e.g., by [`precinct`](https://github.com/dependents/node-precinct)), `src` (source code for file as string), `ast` (parsed AST object for the file source), and `walker` (a `Walker` instance from [`source-walk`](https://github.com/dependents/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