Skip to content

Commit

Permalink
Support a tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjoelkemp committed Nov 19, 2018
1 parent 02cbb43 commit 1cb903d
Show file tree
Hide file tree
Showing 7 changed files with 272 additions and 286 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -21,6 +21,7 @@ var tree = dependencyTree({
directory: 'path/to/all/files',
requireConfig: 'path/to/requirejs/config', // optional
webpackConfig: 'path/to/webpack/config', // optional
tsConfig: 'path/to/typescript/config', // optional
nodeModulesConfig: {
entry: 'module'
}, // optional
Expand All @@ -41,6 +42,7 @@ var list = dependencyTree.toList({

* `requireConfig`: path to a requirejs config for AMD modules (allows for the result of aliased module paths)
* `webpackConfig`: path to a webpack config for aliased modules
* `tsConfig`: path to a typescript config (or a preloaded object representing the typescript config)
* `nodeModulesConfig`: config for resolving entry file for node_modules
* `visited`: object used for avoiding redundant subtree generations via memoization.
* `nonExistent`: array used for storing the list of partial paths that do not exist
Expand Down
4 changes: 3 additions & 1 deletion index.js
Expand Up @@ -21,6 +21,7 @@ const Config = require('./lib/Config');
* Format is a filename -> tree as list lookup table
* @param {Array} [options.nonExistent] - List of partials that do not exist
* @param {Boolean} [options.isListForm=false]
* @param {String|Object} [options.tsConfig] Path to a typescript config (or a preloaded one).
* @return {Object}
*/
module.exports = function(options) {
Expand Down Expand Up @@ -107,7 +108,8 @@ module.exports._getDependencies = function(config) {
ast: precinct.ast,
config: config.requireConfig,
webpackConfig: config.webpackConfig,
nodeModulesConfig: config.nodeModulesConfig
nodeModulesConfig: config.nodeModulesConfig,
tsConfig: config.tsConfig
});

if (!result) {
Expand Down
1 change: 1 addition & 0 deletions lib/Config.js
Expand Up @@ -14,6 +14,7 @@ class Config {
this.webpackConfig = options.webpackConfig;
this.nodeModulesConfig = options.nodeModulesConfig;
this.detectiveConfig = options.detective || options.detectiveConfig || {};
this.tsConfig = options.tsConfig;

this.filter = options.filter;

Expand Down

0 comments on commit 1cb903d

Please sign in to comment.