Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Commit 4028693

Browse files
committed
support transpiler map config
1 parent 874f8cf commit 4028693

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

src/transpiler.js

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,25 @@
3232
};
3333

3434
Loader.prototype.instantiate = function(load) {
35-
// load transpiler as a global (avoiding System clobbering)
36-
if (load.name === this.transpiler) {
37-
var self = this;
38-
return {
39-
deps: [],
40-
execute: function() {
41-
var curSystem = g.System;
42-
var curLoader = g.Reflect.Loader;
43-
__eval('(function(require,exports,module){' + load.source + '})();', g, load);
44-
g.System = curSystem;
45-
g.Reflect.Loader = curLoader;
46-
return getTranspilerModule(self, load.name);
47-
}
48-
};
49-
}
35+
var self = this;
36+
return Promise.resolve(self.normalize(self.transpiler))
37+
.then(function(transpilerNormalized) {
38+
// load transpiler as a global (avoiding System clobbering)
39+
if (load.name === transpilerNormalized) {
40+
return {
41+
deps: [],
42+
execute: function() {
43+
var curSystem = g.System;
44+
var curLoader = g.Reflect.Loader;
45+
// ensure not detected as CommonJS
46+
__eval('(function(require,exports,module){' + load.source + '})();', g, load);
47+
g.System = curSystem;
48+
g.Reflect.Loader = curLoader;
49+
return getTranspilerModule(self, load.name);
50+
}
51+
};
52+
}
53+
});
5054
};
5155

5256
function traceurTranspile(load, traceur) {

0 commit comments

Comments
 (0)