@vkontakte/graph-cache-js
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -130,2 +130,10 @@ const Graph = require('graphlib').Graph; | ||
function _addEdge(resolveName, g, filePath, edgePath) { | ||
try { | ||
if (require.resolve.paths(edgePath) === null) { | ||
return; | ||
} | ||
} catch (err) { | ||
} | ||
return resolveName(filePath, edgePath).then(async (newName) => { | ||
@@ -165,5 +173,5 @@ const exist = await fileExist(newName); | ||
ExpressionStatement(node, state) { | ||
const { expression } = node; | ||
const { expression } = node; | ||
if (node.expression.callee.name === 'require') { | ||
if (expression && expression.callee && expression.callee.name === 'require') { | ||
state.push(addEdge(filePath, expression.arguments[0].value)); | ||
@@ -173,5 +181,5 @@ } | ||
VariableDeclaration(node, state) { | ||
const expression = node.declarations[0].init; | ||
const { init: expression } = node.declarations[0]; | ||
if (expression.callee && expression.callee.name === 'require') { | ||
if (expression && expression.callee && expression.callee.name === 'require') { | ||
state.push(addEdge(filePath, expression.arguments[0].value)); | ||
@@ -178,0 +186,0 @@ } |
{ | ||
"name": "@vkontakte/graph-cache-js", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "", | ||
@@ -27,1 +27,2 @@ "main": "index.js", | ||
} | ||
@@ -210,3 +210,12 @@ /* eslint-env mocha */ | ||
}); | ||
it('supports core node js modules', () => { | ||
return createGraphFromFile(createPath('test-core'), s, {}) | ||
.then((g) => verifyGraph(g, [ | ||
'test-core', 'test-core2' | ||
], [ | ||
{ v: 'test-core2', w: 'test-core' } | ||
])); | ||
}); | ||
}); | ||
}); |
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
15772
29
490
4