Comparing version 1.0.27 to 1.0.28
@@ -67,32 +67,32 @@ /*************************************************************************** | ||
// 因为edp-core不方便的获取edp的安装目录,所以也就不方便的扫描所有安装的packages | ||
// 因此我们通过获取edp -v的输出,解析出我们需要的内容. | ||
var cmd = require( '../lib/util' ).spawn( 'edp', [ '-v' ] ); | ||
cmd.stdout.on( 'data', function( data ){ | ||
stdout.push( data ); | ||
}); | ||
cmd.on( 'close', function( code ){ | ||
stdout = Buffer.concat( stdout ).toString( 'utf-8' ).split( /[\r?\n]+/g ); // .slice( 2 ); | ||
var edpPkgs = util.getEdpPackages( stdout ); | ||
edp.log.info( 'Checking edp pacakges...' ); | ||
util.checkUpdate( edpPkgs ).done(function( outdatedPkgs ){ | ||
var prjPkgs = util.getPrjPackages(); | ||
if ( prjPkgs.length ) { | ||
// 处于项目中 | ||
edp.log.info( 'Checking dep pacakges...' ); | ||
util.checkUpdate( prjPkgs, 'http://edp-registry.baidu.com' ).done( function( outdatedPkgs ){ | ||
edp.log.write( '' ); | ||
displayOutdatedPackages( outdatedPkgs, ' [sudo] npm i -g' ); | ||
displayOutdatedPackages( outdatedPkgs, ' edp import' ); | ||
displayUpgradeInstruction(); | ||
}); | ||
} | ||
else { | ||
// 没有处于项目中 | ||
// 因为edp-core不方便的获取edp的安装目录,所以也就不方便的扫描所有安装的packages | ||
// 因此我们通过获取edp -v的输出,解析出我们需要的内容. | ||
var cmd = require( '../lib/util' ).spawn( 'edp', [ '-v' ] ); | ||
cmd.stdout.on( 'data', function( data ){ | ||
stdout.push( data ); | ||
}); | ||
cmd.on( 'close', function( code ){ | ||
stdout = Buffer.concat( stdout ).toString( 'utf-8' ).split( /[\r?\n]+/g ); // .slice( 2 ); | ||
var edpPkgs = util.getEdpPackages( stdout ); | ||
var prjPkgs = util.getPrjPackages(); | ||
if ( prjPkgs.length ) { | ||
edp.log.info( 'Checking dep pacakges...' ); | ||
util.checkUpdate( prjPkgs, 'http://edp-registry.baidu.com' ).done( function( outdatedPkgs ){ | ||
edp.log.write( '' ); | ||
displayOutdatedPackages( outdatedPkgs, ' edp import' ); | ||
displayUpgradeInstruction(); | ||
}); | ||
} | ||
else { | ||
edp.log.info( 'Checking edp pacakges...' ); | ||
util.checkUpdate( edpPkgs ).done(function( outdatedPkgs ){ | ||
edp.log.write( '' ); | ||
displayOutdatedPackages( outdatedPkgs, ' [sudo] npm i -g' ); | ||
displayUpgradeInstruction(); | ||
} | ||
}); | ||
}); | ||
}); | ||
} | ||
}; | ||
@@ -99,0 +99,0 @@ |
@@ -38,7 +38,7 @@ /** | ||
var dependenciesMap = {}; | ||
var args = expr['arguments']; | ||
var args = expr[ 'arguments' ]; | ||
var argument; | ||
function loop( item ) { | ||
function dependenciesWalker( item ) { | ||
if ( isStringLiteral( item ) | ||
@@ -63,3 +63,3 @@ && !dependenciesMap[ item.value ] | ||
dependencies = []; | ||
argument.elements.forEach( loop ); | ||
argument.elements.forEach( dependenciesWalker ); | ||
} | ||
@@ -72,5 +72,11 @@ else { | ||
// 计算factory function的形参个数 | ||
var factoryParamCount = 0; | ||
if ( factoryAst && factoryAst.type == SYNTAX.FunctionExpression ) { | ||
factoryParamCount = factoryAst.params.length; | ||
} | ||
var actualDependencies = dependencies | ||
? dependencies.slice( 0 ) | ||
: [ 'require', 'exports', 'module' ]; | ||
: [ 'require', 'exports', 'module' ].slice( 0, factoryParamCount ); | ||
@@ -77,0 +83,0 @@ // 解析模块定义函数 |
@@ -43,3 +43,3 @@ /*************************************************************************** | ||
return d; | ||
return d.promise; | ||
}; | ||
@@ -46,0 +46,0 @@ |
@@ -157,3 +157,3 @@ /*************************************************************************** | ||
return d; | ||
return d.promise; | ||
} | ||
@@ -201,3 +201,3 @@ | ||
req.end(); | ||
return d; | ||
return d.promise; | ||
} | ||
@@ -204,0 +204,0 @@ |
{ | ||
"name": "edp-core", | ||
"version": "1.0.27", | ||
"version": "1.0.28", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -48,4 +48,2 @@ /*************************************************************************** | ||
'require', | ||
'exports', | ||
'module', | ||
'io/File', | ||
@@ -106,8 +104,3 @@ 'net/Http', | ||
expect(moduleInfo.dependencies).toBeUndefined(); | ||
expect(moduleInfo.actualDependencies) | ||
.toEqual([ | ||
'require', | ||
'exports', | ||
'module' | ||
]); | ||
expect(moduleInfo.actualDependencies).toEqual([]); | ||
expect(moduleInfo.factoryAst.name).toBe('etpl'); | ||
@@ -114,0 +107,0 @@ }); |
@@ -17,3 +17,3 @@ /*************************************************************************** | ||
**/ | ||
define('foo', function(require) { | ||
define('foo', function(require, exports, module) { | ||
var er = require('er'); | ||
@@ -20,0 +20,0 @@ return er; |
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
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
198903