@vkontakte/graph-cache-js
Advanced tools
Comparing version 2.1.0 to 2.2.0
{ | ||
"parserOptions": { | ||
"ecmaVersion": 7, | ||
"ecmaVersion": 2018, | ||
"sourceType": "module", | ||
@@ -13,2 +13,5 @@ "ecmaFeatures": {} | ||
}, | ||
"overrides": [{ | ||
"excludedFiles": "tests/fixtures/**/*.js" | ||
}], | ||
"extends": ["google"], | ||
@@ -15,0 +18,0 @@ "rules": { |
@@ -45,5 +45,5 @@ const Graph = require('graphlib').Graph; | ||
if (root.indexOf('@') === 0) { | ||
root += path.sep + depFile.split(path.sep)[1] | ||
root += path.sep + depFile.split(path.sep)[1]; | ||
} | ||
const exist = Object.keys(json.dependencies) | ||
@@ -63,3 +63,3 @@ .filter((el) => el === root).length; | ||
alias.some(item => { | ||
alias.some((item) => { | ||
if (depFile.indexOf(item.key) !== 0) return; | ||
@@ -161,3 +161,3 @@ | ||
return false; | ||
}) | ||
}); | ||
} | ||
@@ -168,3 +168,3 @@ | ||
const addEdge = _addEdge.bind(null, resolveName, g) | ||
const addEdge = _addEdge.bind(null, resolveName, g); | ||
@@ -175,2 +175,8 @@ walk.simple(ast, { | ||
}, | ||
ExportAllDeclaration(node, state) { | ||
state.push(addEdge(filePath, node.source.value)); | ||
}, | ||
ExportNamedDeclaration(node, state) { | ||
state.push(addEdge(filePath, node.source.value)); | ||
}, | ||
ExpressionStatement(node, state) { | ||
@@ -241,3 +247,3 @@ const { expression } = node; | ||
// To be compatible with webpack, logic take from: | ||
// To be compatible with webpack, logic taken from: | ||
// https://github.com/webpack/enhanced-resolve/blob/49cddd1c5757849b1e0b53b9c765525b840c3b59/lib/ResolverFactory.js#L127s | ||
@@ -249,3 +255,3 @@ function prepareAlias(alias) { | ||
return Object.keys(alias).map(key => { | ||
return Object.keys(alias).map((key) => { | ||
let exactMatch = false; | ||
@@ -252,0 +258,0 @@ let obj = alias[key]; |
{ | ||
"name": "@vkontakte/graph-cache-js", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "", | ||
@@ -24,5 +24,5 @@ "main": "index.js", | ||
"graphlib": "^2.1.0", | ||
"lodash.memoize": "^4.1.2" | ||
"lodash.memoize": "^4.1.2", | ||
"uuid": "^3.3.2" | ||
} | ||
} | ||
@@ -69,4 +69,4 @@ /* eslint-env mocha */ | ||
], [ | ||
{ v: 'test1', w: 'test/test4' }, | ||
{ v: 'test2', w: 'test/test4' }, | ||
{ v: 'test1', w: 'test/test4' }, | ||
{ v: 'test2', w: 'test1' }, | ||
@@ -81,4 +81,4 @@ ])); | ||
], [ | ||
{ v: 'cyclic2', w: 'cyclic1' }, | ||
{ v: 'cyclic1', w: 'cyclic2' }, | ||
{ v: 'cyclic2', w: 'cyclic1' }, | ||
])); | ||
@@ -92,20 +92,21 @@ }); | ||
verifyGraph(g, [ | ||
'testNpm', '../../node_modules/babylon/package.json' | ||
], [ | ||
{ v: '../../node_modules/babylon/package.json', w: 'testNpm' }, | ||
])}) | ||
'testNpm', '../../node_modules/babylon/package.json' | ||
], [ | ||
{ v: '../../node_modules/babylon/package.json', w: 'testNpm' }, | ||
]); | ||
}); | ||
}); | ||
it("handles npm deps with namespace", () => { | ||
return createGraphFromFile(createPath("namespace/test"), s, { | ||
packageJSON: "./tests/fixtures/namespace/package.json" | ||
}).then(g => { | ||
it('handles npm deps with namespace', () => { | ||
return createGraphFromFile(createPath('namespace/test'), s, { | ||
packageJSON: './tests/fixtures/namespace/package.json' | ||
}).then((g) => { | ||
verifyGraph( | ||
g, | ||
[ | ||
"namespace/test", | ||
"../fixtures/namespace/node_modules/@vkontakte/vkui-connect/package.json" | ||
'namespace/test', | ||
'../fixtures/namespace/node_modules/@vkontakte/vkui-connect/package.json' | ||
], | ||
[ | ||
{v: "../fixtures/namespace/node_modules/@vkontakte/vkui-connect/package.json", w: "namespace/test" } | ||
{ v: '../fixtures/namespace/node_modules/@vkontakte/vkui-connect/package.json', w: 'namespace/test' } | ||
] | ||
@@ -132,3 +133,3 @@ ); | ||
{ v: 'test/test.html', w: 'test_html.js' } | ||
])).catch(err => { | ||
])).catch((err) => { | ||
if (err + '' === 'SyntaxError: Unexpected token (1:0)') { | ||
@@ -161,4 +162,4 @@ return; | ||
{ v: 'test/test4', w: 'test_alias' }, | ||
{ v: 'test1', w: 'test/test4' }, | ||
{ v: 'test2', w: 'test/test4' }, | ||
{ v: 'test1', w: 'test/test4' }, | ||
{ v: 'test2', w: 'test1' }, | ||
@@ -175,7 +176,7 @@ ])); | ||
.then((g) => verifyGraph(g, [ | ||
'test1', 'test2', 'test/test4', 'test_alias' | ||
'test2', 'test1', 'test/test4', 'test_alias' | ||
], [ | ||
{ v: 'test/test4', w: 'test_alias' }, | ||
{ v: 'test1', w: 'test/test4' }, | ||
{ v: 'test2', w: 'test/test4' }, | ||
{ v: 'test1', w: 'test/test4' }, | ||
{ v: 'test2', w: 'test1' }, | ||
@@ -186,3 +187,3 @@ ])); | ||
it('handles path to folder without index.js', () => { | ||
return createGraphFromFile(createPath('testFolder'), s, {}).then(g => | ||
return createGraphFromFile(createPath('testFolder'), s, {}).then((g) => | ||
verifyGraph( | ||
@@ -192,5 +193,5 @@ g, | ||
[ | ||
{ v: 'folder', w: 'testFolder.js' }, | ||
{ v: 'folder/module', w: 'folder' }, | ||
{ v: 'folder/module2', w: 'folder' }, | ||
{ v: 'folder', w: 'testFolder.js' } | ||
{ v: 'folder/module2', w: 'folder' } | ||
] | ||
@@ -201,11 +202,18 @@ ) | ||
it('supports require statement', () => { | ||
return createGraphFromFile(createPath('test_require'), s, {}) | ||
.then((g) => verifyGraph(g, [ | ||
'test_require', 'test2' | ||
], [ | ||
{ v: 'test2', w: 'test_require' } | ||
])); | ||
.then((g) => verifyGraph(g, [ | ||
'test_require', 'test2' | ||
], [ | ||
{ v: 'test2', w: 'test_require' } | ||
])); | ||
}); | ||
it('supports nesting in import statement', () => { | ||
return createGraphFromFile(createPath('testNested'), s, { | ||
packageJSON: './package.json' | ||
}); | ||
}); | ||
it('supports require statement with declaration', () => { | ||
@@ -228,3 +236,21 @@ return createGraphFromFile(createPath('test_require2'), s, {}) | ||
}); | ||
it('supports export with import statement', () => { | ||
return createGraphFromFile(createPath('import_export'), s, {}) | ||
.then((g) => verifyGraph(g, [ | ||
'import_export', 'test2' | ||
], [ | ||
{ v: 'test2', w: 'import_export' } | ||
])); | ||
}); | ||
it('supports export with import all statement', () => { | ||
return createGraphFromFile(createPath('import_export_all'), s, {}) | ||
.then((g) => verifyGraph(g, [ | ||
'import_export_all', 'test2' | ||
], [ | ||
{ v: 'test2', w: 'import_export_all' } | ||
])); | ||
}); | ||
}); | ||
}); |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
50417
35
524
1
40
5
1
+ Addeduuid@^3.3.2
+ Addeduuid@3.4.0(transitive)