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

fis3-hook-lego

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fis3-hook-lego - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

.idea/dictionaries/jerojiang.xml

7

index.js

@@ -8,3 +8,3 @@ /**

module.exports = function init(fis, opts) {
module.exports = function(fis, opts) {
fis.on('lookup:file', function(info, file) {

@@ -14,3 +14,4 @@

if (file.isJsLike && /^[a-zA-Z0-9_@.-]+$/.test(info.rest)) {
var ret = lookup(info.rest);
var ret = lookup(info.rest, opts);
if (ret) {

@@ -21,2 +22,2 @@ info.id = info.moduleId = ret;

});
};
};
/**
* 查找依赖
* @author jerojiang
*
*
* 默认最新 require('zepto') -> require('zepto/x.x.x/zepto')

@@ -18,3 +18,16 @@ * 指定版本号 require('zepto@1.2.3') -> require('zepto/1.2.3')

module.exports = function(id) {
module.exports = function(id, opts) {
var ignore = opts.ignore;
if (typeof ignore === 'string') {
ignore = [opts.ignore];
} else {
ignore = opts.ignore || [];
}
if (ignore.indexOf(id) > -1) {
fis.log.debug('lego: ignore module %s', id);
return null;
}
return getModule(id) || getLegoModule(id);

@@ -32,3 +45,7 @@ };

return id;
} else if (_.isFile(_(mod, id, id + '.js'))) {
fis.log.debug('lego: get %s from <modules>', id + '/' + id);
return id;
}
return null;

@@ -44,7 +61,8 @@ }

var ver, versions, pkg, legoInfo, ret,
tempId = id.split('@'),
id = tempId[0];
root = _(lego, id);
tempId = id.split('@');
id = tempId[0];
root = _(lego, id);
fis.log.debug('lego: get %s from <lego_modules>', id);

@@ -55,3 +73,3 @@ if (!_.isDir(root)) {

if (ver = tempId[1]) { // 指定版本号
if (ver = tempId[1]) { // 指定版本号
// ver = _(root, ver);

@@ -61,3 +79,3 @@ if (!_.isDir(_(root, ver))) {

}
} else { // 默认最新
} else { // 默认最新
versions = fs.readdirSync(root) || [];

@@ -75,3 +93,3 @@

pkg = _(root, ver, 'package.json');
try {

@@ -81,10 +99,10 @@ pkg = require(pkg);

ret = _(id, ver, legoInfo.main.replace(/\.js$/, ''));
} catch(ex) {
} catch (ex) {
// 如果不存在 package.json
fis.log.info('lego: 组件 %s 没有 package.json', id);
if (_.isFile(_(root, ver, id + '.js'))) { // zepto/x.x.x/zepto.js 同名文件
if (_.isFile(_(root, ver, id + '.js'))) { // zepto/x.x.x/zepto.js 同名文件
ret = _(id, ver, id);
} else if (_.isFile(_(root, ver, 'index.js'))) { // zepto/x.x.x/index.js index 文件
} else if (_.isFile(_(root, ver, 'index.js'))) { // zepto/x.x.x/index.js index 文件
ret = _(id, ver, 'index');

@@ -95,5 +113,5 @@ } else {

}
return ret;
}
}
{
"name": "fis3-hook-lego",
"version": "0.2.0",
"version": "0.2.1",
"description": "lego 包管理模块查找",

@@ -5,0 +5,0 @@ "keywords": [

@@ -48,5 +48,7 @@ # fis3-hook-lego

var tab = require('tab'); // lego_modules 中的快速引用
var version = require('versions@0.1.0'); // 指定版本
var common = require('common');
var testModule = require('test_module');
var header = require('index/header'); // modules 中也可以省去 `modules`
var index = require('index'); // 查找modules/index.js ; modules/index/index.js
```

@@ -79,2 +81,2 @@

});
```
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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