New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

code-packer

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

code-packer - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

59

dist/lib/packager.js

@@ -90,2 +90,9 @@ "use strict";

return fs_1.default.statSync(pathname, option);
},
existsSync(pathname) {
if (typeof pathname == 'string') {
const dir = findFile(pkg, pathname);
return !!dir;
}
return fs_1.default.existsSync(pathname);
} });

@@ -167,3 +174,3 @@ };

}
//全局模块(优先加载包中的,在加载自己的)
//全局模块(优先加载包中的,再加载自己的)
else {

@@ -180,21 +187,35 @@ //內建木块直接加载

moduleName = moduleName.replace(/^node_modules[\\\/]/, '');
//先加上node_modules
const checkName = path_1.default.join(pkg.basename, 'node_modules', moduleName);
//直接检测名称
let mpath = this.moduleChecker(checkName, pkg);
//检测package.json
if (!mpath) {
//读取package.json
const fname = this.path.join(checkName, 'package.json');
const buf = pkg.getFile(fname);
if (buf) {
const pkgjson = JSON.parse(buf.toString());
//读取main
if (pkgjson.main)
mpath = this.moduleChecker(path_1.default.join(checkName, pkgjson.main.replace(/^\/+/, '')), pkg);
//从指定的node_modules路径查找
const findInNodeModules = (dir) => {
//先加上node_modules
const checkName = path_1.default.join(dir, moduleName);
//直接检测名称
let mpath = this.moduleChecker(checkName, pkg);
//检测package.json
if (!mpath) {
//读取package.json
const fname = this.path.join(checkName, 'package.json');
const buf = pkg.getFile(fname);
if (buf) {
const pkgjson = JSON.parse(buf.toString());
//读取main
if (pkgjson.main) {
const _checkName = path_1.default.join(checkName, pkgjson.main.replace(/^\/+/, ''));
mpath = this.moduleChecker(_checkName, pkg);
if (!mpath)
mpath = this.moduleChecker(path_1.default.join(_checkName, 'index'), pkg);
}
}
}
}
//检测index
if (!mpath)
mpath = this.moduleChecker(path_1.default.join(checkName, 'index'), pkg);
//检测index
if (!mpath)
mpath = this.moduleChecker(path_1.default.join(checkName, 'index'), pkg);
//不管有没有,返回出去
return mpath;
};
//从根目录的模块查找
let mpath = findInNodeModules(path_1.default.join(pkg.basename, 'node_modules'));
//从模块查找
if (!mpath && module)
mpath = findInNodeModules(path_1.default.join(module.path, 'node_modules'));
//找到模块,直接加载

@@ -201,0 +222,0 @@ if (mpath)

{
"name": "code-packer",
"version": "1.0.6",
"version": "1.0.7",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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