Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vkontakte/graph-cache-js

Package Overview
Dependencies
Maintainers
8
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vkontakte/graph-cache-js - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

.travis.yml

5

.eslintrc.json
{
"parserOptions": {
"ecmaVersion": 7,
"ecmaVersion": 2018,
"sourceType": "module",

@@ -13,2 +13,5 @@ "ecmaFeatures": {}

},
"overrides": [{
"excludedFiles": "tests/fixtures/**/*.js"
}],
"extends": ["google"],

@@ -15,0 +18,0 @@ "rules": {

20

lib/parser.js

@@ -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' }
]));
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc