rev-dep 0.2.0 → 0.2.1

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/cli.js CHANGED
@@ -22,13 +22,18 @@ program
22
22
  '-wc, --webpackConfig <path>',
23
23
  'path to webpack config to enable webpack aliases support'
24
24
  )
25
+ .option(
26
+ '-tc, --typescriptConfig <path>',
27
+ 'path to TypeScript config to enable TS aliases support'
28
+ )
25
29
  .action((filePath, entryPoints, data) => {
26
- const { compactSummary, verbose, webpackConfig } = data
30
+ const { compactSummary, verbose, webpackConfig, typescriptConfig } = data
27
31
  const results = find({
28
32
  entryPoints,
29
33
  filePath,
30
34
  verbose,
31
- webpackConfig
35
+ webpackConfig,
36
+ typescriptConfig
32
37
  })
33
38
  const hasAnyResults = results.some((paths) => paths.length > 0)
34
39
  if (!hasAnyResults) {
package/find.js CHANGED
@@ -46,6 +46,7 @@ const find = ({
46
46
  skipRegex,
47
47
  verbose,
48
48
  webpackConfig,
49
+ typescriptConfig,
49
50
  cwd = process.cwd()
50
51
  }) => {
51
52
  const resolveAbsolutePath = _resolveAbsolutePath(cwd)
@@ -59,7 +60,8 @@ const find = ({
59
60
  const deps = getDepsSet(
60
61
  absoluteEntryPoints,
61
62
  skipRegex,
62
- resolveAbsolutePath(webpackConfig)
63
+ resolveAbsolutePath(webpackConfig),
64
+ resolveAbsolutePath(typescriptConfig)
63
65
  )
64
66
  const cleanedEntryPoints = entryPoints.map(removeInitialDot)
65
67
  const cleanedFilePath = removeInitialDot(filePath)
package/getDepsSet.js CHANGED
@@ -1,13 +1,20 @@
1
1
  const depcruise = require('dependency-cruiser').cruise
2
- const resolveWebpackConfig = require('dependency-cruiser/src/config-utl/extract-webpack-resolve-config')
3
- const getDepsSet = (entryPoints, skipRegex, webpackConfigPath) => {
2
+ // eslint-disable-next-line
3
+ const resolveWebpackConfig = require('dependency-cruiser/config-utl/extract-webpack-resolve-config')
4
+ // eslint-disable-next-line
5
+ const resolveTsConfig = require('dependency-cruiser/config-utl/extract-ts-config')
6
+ const getDepsSet = (entryPoints, skipRegex, webpackConfigPath, tsConfigPath) => {
4
7
  const skip =
5
8
  skipRegex || '(node_modules|/__tests__|/__test__|/__mockContent__|.scss)'
6
9
  const webpackResolveOptions = webpackConfigPath ? resolveWebpackConfig(webpackConfigPath) : null
10
+ const tsConfigOptions = tsConfigPath ? resolveTsConfig(tsConfigPath) : null
11
+
7
12
  const result = depcruise(entryPoints, {
8
13
  exclude: skip,
9
14
  doNotFollow: { path: skip },
10
- }, webpackResolveOptions)
15
+ tsPreCompilationDeps: true,
16
+
17
+ }, webpackResolveOptions, tsConfigOptions)
11
18
  return result.output.modules
12
19
  }
13
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rev-dep",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Reverse dependency resolution tool built with dependency-cruiser",
5
5
  "main": "find.js",
6
6
  "bin": "cli.js",