fix(language-service): don't require `reflect-metadata` module to be provided (#15569)

Fixes #15568
This commit is contained in:
Chuck Jazdzewski 2017-03-29 09:34:21 -07:00 committed by Victor Berchet
parent 49162784a8
commit 331b9f6425
1 changed files with 3 additions and 1 deletions

View File

@ -49,13 +49,15 @@ function resolve(id, from) {
}
var banner = `
var $reflect = {defineMetadata: function() {}, getOwnMetadata: function(){}};
((typeof global !== 'undefined' && global)||{})['Reflect'] = $reflect;
var $deferred, $resolved, $provided;
function $getModule(name) { return $provided[name] || require(name); }
function define(modules, cb) { $deferred = { modules: modules, cb: cb }; }
module.exports = function(provided) {
if ($resolved) return $resolved;
var result = {};
$provided = Object.assign({}, provided || {}, { exports: result });
$provided = Object.assign({'reflect-metadata': $reflect}, provided || {}, { exports: result });
$deferred.cb.apply(this, $deferred.modules.map($getModule));
$resolved = result;
return result;