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

@hh.ru/js-module-dependency-extrator

Package Overview
Dependencies
Maintainers
10
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hh.ru/js-module-dependency-extrator - npm Package Compare versions

Comparing version 0.0.4 to 0.1.0

.eslintrc

12

lib/index.js

@@ -71,4 +71,2 @@ 'use strict';

var dependencyList = [];
var extractModuleTreeDependenciesFromFile = function extractModuleTreeDependenciesFromFile(file) {

@@ -78,2 +76,3 @@ var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

var cachedFiles = {};
var dependencyList = [];

@@ -114,2 +113,3 @@ function _extractModuleTreeDependenciesFromFile(file, opts) {

var modulesPath = _path2.default.resolve(__dirname, opts.modulesPath);
staticValues = [].concat(_toConsumableArray(new Set(staticValues.map(function (item) {

@@ -119,10 +119,2 @@ return item.slice(modulesPath.length + backslashLength);

staticValues = staticValues.map(function (item) {
if (item.indexOf(mustacheExt)) {
return item.slice(0, -jsExtLength);
}
return item;
});
if (_fs2.default.existsSync(saveFilePath + '/' + opts.saveFileName + '.' + opts.saveFileExt)) {

@@ -129,0 +121,0 @@ previousContent = _fs2.default.readFileSync(saveFilePath + '/' + opts.saveFileName + '.' + opts.saveFileExt, ENCODING).toString();

@@ -21,6 +21,6 @@ 'use strict';

var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var modulesPath = opts.modulesPath;
var modulesPath = opts.modulesPath,
filename = opts.filename;
var importDeclarationPaths = [];
return {

@@ -51,4 +51,23 @@ Program: {

}
},
ImportDeclaration: {
enter: function enter(_ref2) {
var node = _ref2.node;
if (node && node.source && node.source.value) {
var moduleDir = node.source.value[0] === '.' ? filename.slice(modulesPath.length, filename.lastIndexOf('/')) : '';
var ext = node.source.value.endsWith('mustache') ? '' : '.js';
var jsModule = _path2.default.join(modulesPath, moduleDir, '' + node.source.value + ext);
var jsIndexModule = _path2.default.join(modulesPath, moduleDir, node.source.value + '/index' + ext);
if (_fs2.default.existsSync(jsModule)) {
importDeclarationPaths = importDeclarationPaths.concat(jsModule);
} else if (_fs2.default.existsSync(jsIndexModule)) {
importDeclarationPaths = importDeclarationPaths.concat(jsIndexModule);
}
}
}
}
};
};
{
"name": "@hh.ru/js-module-dependency-extrator",
"version": "0.0.4",
"version": "0.1.0",
"main": "lib/index.js",
"devDependencies": {
"@hh.ru/eslint-config": "^3.0.1",
"babel-cli": "^6.26.0",
"babel-eslint": "^9.0.0",
"babel-preset-env": "^1.6.1",
"babel-preset-stage-0": "^6.24.1",
"mocha": "^2.2.5"
"eslint": "~4.19.1",
"eslint-config-prettier": "^3.0.1",
"eslint-plugin-prettier": "^2.6.2",
"mocha": "^2.2.5",
"prettier": "^1.14.2"
},

@@ -32,2 +38,1 @@ "repository": {

}

Sorry, the diff of this file is not supported yet

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