detective-es6
Advanced tools
Comparing version 4.0.0 to 4.0.1
15
index.js
@@ -12,3 +12,3 @@ 'use strict'; | ||
*/ | ||
module.exports = function(src, options) { | ||
module.exports = function(src, options = {}) { | ||
if (src === undefined) throw new Error('src not given'); | ||
@@ -23,7 +23,7 @@ if (src === '') return []; | ||
case 'ImportDeclaration': { | ||
if (options && options.skipTypeImports && node.importKind === 'type') { | ||
if (options.skipTypeImports && node.importKind === 'type') { | ||
break; | ||
} | ||
if (node.source && node.source.value) { | ||
if (node.source?.value) { | ||
dependencies.push(node.source.value); | ||
@@ -37,3 +37,3 @@ } | ||
case 'ExportAllDeclaration': { | ||
if (node.source && node.source.value) { | ||
if (node.source?.value) { | ||
dependencies.push(node.source.value); | ||
@@ -46,9 +46,8 @@ } | ||
case 'CallExpression': { | ||
if (options && options.skipAsyncImports) { | ||
if (options.skipAsyncImports) { | ||
break; | ||
} | ||
if (node.callee.type === 'Import' && node.arguments.length > 0 && | ||
node.arguments[0].value) { | ||
dependencies.push(node.arguments[0].value); | ||
if (node.callee.type === 'Import' && node.arguments?.[0].value) { | ||
dependencies.push(node.arguments?.[0].value); | ||
} | ||
@@ -55,0 +54,0 @@ |
{ | ||
"name": "detective-es6", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Get the dependencies of an ES6 module", | ||
@@ -39,3 +39,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"node-source-walk": "^6.0.0" | ||
"node-source-walk": "^6.0.1" | ||
}, | ||
@@ -42,0 +42,0 @@ "devDependencies": { |
# detective-es6 | ||
[![CI](https://img.shields.io/github/actions/workflow/status/dependents/node-detective-es6/ci.yml?branch=main&label=CI&logo=github)](https://github.com/dependents/node-detective-es6/actions/workflows/ci.yml?query=branch%3Amain) | ||
[![npm version](https://img.shields.io/npm/v/detective-es6)](https://www.npmjs.com/package/detective-es6) | ||
[![npm version](https://img.shields.io/npm/v/detective-es6?logo=npm&logoColor=fff)](https://www.npmjs.com/package/detective-es6) | ||
[![npm downloads](https://img.shields.io/npm/dm/detective-es6)](https://www.npmjs.com/package/detective-es6) | ||
@@ -6,0 +6,0 @@ |
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
5388
47
Updatednode-source-walk@^6.0.1