Skip to content

Commit

Permalink
node resolver: added debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
benmosher committed Aug 20, 2016
1 parent f4d1458 commit 5be9660
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
16 changes: 14 additions & 2 deletions resolvers/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,25 @@ var resolve = require('resolve')
, path = require('path')
, assign = require('object-assign')

var log = require('debug')('eslint-plugin-import:resolver:node')

exports.interfaceVersion = 2

exports.resolve = function (source, file, config) {
if (resolve.isCore(source)) return { found: true, path: null }
log('Resolving:', source, 'from:', file)
var resolvedPath

if (resolve.isCore(source)) {
log('resolved to core')
return { found: true, path: null }
}

try {
return { found: true, path: resolve.sync(source, opts(file, config)) }
resolvedPath = resolve.sync(source, opts(file, config))
log('Resolved to:', resolvedPath)
return { found: true, path: resolvedPath }
} catch (err) {
log('resolve threw error:', err)
return { found: false }
}
}
Expand Down
1 change: 1 addition & 0 deletions resolvers/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
},
"homepage": "https://github.com/benmosher/eslint-plugin-import",
"dependencies": {
"debug": "^2.2.0",
"object-assign": "^4.0.1",
"resolve": "^1.1.6"
},
Expand Down

0 comments on commit 5be9660

Please sign in to comment.