|
@ -112,15 +112,10 @@ const equivalents = { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
function execute ( options, command ) { |
|
|
function execute ( options, command ) { |
|
|
let external = command.external ? |
|
|
let external; |
|
|
typeof options.external === 'function' ? |
|
|
|
|
|
((fn, a) => { |
|
|
const commandExternal = ( command.external || '' ).split( ',' ); |
|
|
return function (id) { |
|
|
const optionsExternal = options.external; |
|
|
return fn(id) || a.indexOf(id) !== -1; |
|
|
|
|
|
}; |
|
|
|
|
|
})(options.external, command.external.split(',')) : |
|
|
|
|
|
(options.external || []).concat(command.external.split(',')) : |
|
|
|
|
|
options.external; |
|
|
|
|
|
|
|
|
|
|
|
if ( command.globals ) { |
|
|
if ( command.globals ) { |
|
|
let globals = Object.create( null ); |
|
|
let globals = Object.create( null ); |
|
@ -130,14 +125,22 @@ function execute ( options, command ) { |
|
|
globals[ names[0] ] = names[1]; |
|
|
globals[ names[0] ] = names[1]; |
|
|
|
|
|
|
|
|
// Add missing Module IDs to external.
|
|
|
// Add missing Module IDs to external.
|
|
|
if ( external.indexOf( names[0] ) === -1 ) { |
|
|
if ( commandExternal.indexOf( names[0] ) === -1 ) { |
|
|
external.push( names[0] ); |
|
|
commandExternal.push( names[0] ); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
command.globals = globals; |
|
|
command.globals = globals; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ( typeof optionsExternal === 'function' ) { |
|
|
|
|
|
external = id => { |
|
|
|
|
|
return optionsExternal( id ) || ~commandExternal.indexOf( id ); |
|
|
|
|
|
}; |
|
|
|
|
|
} else { |
|
|
|
|
|
external = ( optionsExternal || [] ).concat( commandExternal ); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
options.onwarn = options.onwarn || stderr; |
|
|
options.onwarn = options.onwarn || stderr; |
|
|
|
|
|
|
|
|
options.external = external; |
|
|
options.external = external; |
|
|