dependency-tree 7.2.2 → 8.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -26,7 +26,8 @@ var tree = dependencyTree({
26
26
  entry: 'module'
27
27
  }, // optional
28
28
  filter: path => path.indexOf('node_modules') === -1, // optional
29
- nonExistent: [] // optional
29
+ nonExistent: [], // optional
30
+ noTypeDefinitions: false // optional
30
31
  });
31
32
 
32
33
  // Returns a post-order traversal (list form) of the tree with duplicate sub-trees pruned.
@@ -51,6 +52,7 @@ var list = dependencyTree.toList({
51
52
  * `detective`: object with configuration specific to detectives used to find dependencies of a file
52
53
  - for example `detective.amd.skipLazyLoaded: true` tells the AMD detective to omit inner requires
53
54
  - See [precinct's usage docs](https://github.com/dependents/node-precinct#usage) for the list of module types you can pass options to.
55
+ * `noTypeDefinitions`: For TypeScript imports, whether to resolve to `*.js` instead of `*.d.ts`.
54
56
 
55
57
  #### Format Details
56
58
 
package/index.d.ts ADDED
@@ -0,0 +1,34 @@
1
+ declare namespace dependencyTree {
2
+ interface TreeInnerNode {
3
+ [parent: string]: TreeInnerNode | string;
4
+ }
5
+ type Tree = TreeInnerNode | string;
6
+
7
+ export interface Options {
8
+ filename: string;
9
+ directory: string;
10
+ visited?: Tree;
11
+ nonExistent?: string[];
12
+ isListForm?: boolean;
13
+ requireConfig?: string;
14
+ webpackConfig?: string;
15
+ nodeModulesConfig?: any;
16
+ detectiveConfig?: any;
17
+ tsConfig?: string | Record<string, any>;
18
+ noTypeDefinitions?: boolean;
19
+ filter?: (path: string) => boolean;
20
+ }
21
+
22
+ interface Config extends Options {
23
+ clone: () => Config;
24
+ }
25
+
26
+ function toList(options: Options): string[];
27
+ function _getDependencies(config: Config): string[];
28
+ }
29
+
30
+ declare function dependencyTree(
31
+ options: dependencyTree.Options
32
+ ): dependencyTree.Tree;
33
+
34
+ export = dependencyTree;
package/index.js CHANGED
@@ -22,6 +22,7 @@ const Config = require('./lib/Config');
22
22
  * @param {Array} [options.nonExistent] - List of partials that do not exist
23
23
  * @param {Boolean} [options.isListForm=false]
24
24
  * @param {String|Object} [options.tsConfig] Path to a typescript config (or a preloaded one).
25
+ * @param {Boolean} [options.noTypeDefinitions] For TypeScript imports, whether to resolve to `*.js` instead of `*.d.ts`.
25
26
  * @return {Object}
26
27
  */
27
28
  module.exports = function(options) {
@@ -109,7 +110,8 @@ module.exports._getDependencies = function(config) {
109
110
  config: config.requireConfig,
110
111
  webpackConfig: config.webpackConfig,
111
112
  nodeModulesConfig: config.nodeModulesConfig,
112
- tsConfig: config.tsConfig
113
+ tsConfig: config.tsConfig,
114
+ noTypeDefinitions: config.noTypeDefinitions
113
115
  });
114
116
 
115
117
  if (!result) {
package/lib/Config.js CHANGED
@@ -15,6 +15,7 @@ class Config {
15
15
  this.nodeModulesConfig = options.nodeModulesConfig;
16
16
  this.detectiveConfig = options.detective || options.detectiveConfig || {};
17
17
  this.tsConfig = options.tsConfig;
18
+ this.noTypeDefinitions = options.noTypeDefinitions;
18
19
 
19
20
  this.filter = options.filter;
20
21
 
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "dependency-tree",
3
- "version": "7.2.2",
3
+ "version": "8.1.2",
4
4
  "description": "Get the dependency tree of a module",
5
5
  "main": "index.js",
6
+ "types": "index.d.ts",
6
7
  "scripts": {
7
- "test": "jscs index.js test/test.js && ./node_modules/.bin/mocha --require @babel/register test/test.js"
8
+ "test": "jscs index.js test/test.js && ./node_modules/.bin/mocha --require esm test/test.js"
8
9
  },
9
10
  "bin": {
10
11
  "dependency-tree": "bin/cli.js"
@@ -34,27 +35,24 @@
34
35
  "url": "https://github.com/mrjoelkemp/node-dependency-tree/issues"
35
36
  },
36
37
  "engines": {
37
- "node": ">=6.0.0"
38
+ "node": "^10.13 || ^12 || >=14"
38
39
  },
39
40
  "homepage": "https://github.com/mrjoelkemp/node-dependency-tree",
40
41
  "dependencies": {
41
42
  "commander": "^2.20.3",
42
- "debug": "^4.2.1",
43
- "filing-cabinet": "^2.6.0",
44
- "precinct": "^6.3.1",
43
+ "debug": "^4.3.1",
44
+ "filing-cabinet": "^3.0.1",
45
+ "precinct": "^8.0.0",
45
46
  "typescript": "^3.9.7"
46
47
  },
47
48
  "devDependencies": {
48
- "@babel/cli": "^7.2.3",
49
- "@babel/core": "^7.2.2",
50
- "@babel/preset-env": "^7.2.3",
51
- "@babel/register": "^7.0.0",
49
+ "esm": "^3.2.25",
52
50
  "jscs": "^3.0.7",
53
51
  "jscs-preset-mrjoelkemp": "~2.0.0",
54
- "mocha": "^5.0.0",
55
- "mock-fs": "^4.7.0",
56
- "resolve": "^1.9.0",
57
- "rewire": "^4.0.1",
58
- "sinon": "^6.1.5"
52
+ "mocha": "^8.2.1",
53
+ "mock-fs": "^4.13.0",
54
+ "resolve": "^1.19.0",
55
+ "rewire": "^5.0.0",
56
+ "sinon": "^9.2.1"
59
57
  }
60
58
  }