detective-es6
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -9,5 +9,6 @@ 'use strict'; | ||
* @param {String|Object} src - File's content or AST | ||
* @param {Object} options - optional extra settings | ||
* @return {String[]} | ||
*/ | ||
module.exports = function(src) { | ||
module.exports = function(src, options) { | ||
const walker = new Walker(); | ||
@@ -26,2 +27,5 @@ | ||
case 'ImportDeclaration': | ||
if (options && options.skipTypeImports && node.importKind == 'type') { | ||
break; | ||
} | ||
if (node.source && node.source.value) { | ||
@@ -28,0 +32,0 @@ dependencies.push(node.source.value); |
{ | ||
"name": "detective-es6", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Get the dependencies of an es6 module", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -99,2 +99,10 @@ 'use strict'; | ||
}); | ||
it('respects settings for type imports', function() { | ||
const source = 'import type {foo} from "mylib";'; | ||
const depsWithTypes = detective(source); | ||
const depsWithoutTypes = detective(source, {skipTypeImports: true}); | ||
assert.deepEqual(depsWithTypes, ['mylib']); | ||
assert.deepEqual(depsWithoutTypes, []); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5686
131