SystemJS._loader.loadedTranspilerRuntime = true;

define(function(require, exports, module) {
  var traceur = require('traceur');

  function prepend(a, b) {
    for (var p in b)
      if (!(p in a))
        a[p] = b[p];
    return a;
  }

  exports.translate = function(load) {
    var options = {
      modules: this.builder ? 'parse' : 'instantiate',
      script: false,
      sourceMaps: this.builder ? 'memory' : 'inline',
      filename: load.address,
      inputSourceMap: load.metadata.sourceMap,
      moduleName: false
    };

    if (load.metadata.traceurOptions)
      prepend(options, load.metadata.traceurOptions);

    if (this.traceurOptions)
      prepend(options, this.traceurOptions);

    var compiler = new traceur.Compiler(options);

    if (!load.metadata.format)
      load.metadata.format = 'register';

    var transpiledSource = doTraceurCompile(load.source, compiler, options.filename);

    var usesRuntime = transpiledSource.match(/\$traceurRuntime/);

    if (this.builder) {

      // this should not be a global but Traceur gives us no choice!
      if (usesRuntime)
        transpiledSource = 'import "traceur-runtime";' + transpiledSource;
      load.metadata.sourceMap = compiler.getSourceMap();
      return transpiledSource;
    }
    else {
      if (usesRuntime)
        load.metadata.deps.push('traceur-runtime');
      return '(function(__moduleName){' + transpiledSource + '\n})("' + load.name + '");\n//# sourceURL=' + load.address + '!transpiled';
    }
  };

  function doTraceurCompile(source, compiler, filename) {
    try {
      return compiler.compile(source, filename);
    }
    catch(e) {
      e.stack = e.stack || e.message;
      throw e;
    }
  }
});
@@ -310,33 +310,8 @@
 les:
- this.builder ? 'parse' :
  'in
@@ -318,24 +318,24 @@
 stantiate',%0A
+
       script
@@ -729,41 +729,8 @@
 );%0A%0A
-    if (!load.metadata.format)%0A  
     
@@ -764,16 +764,16 @@
 ister';%0A
+
 %0A    var
@@ -943,17 +943,16 @@
 lder) %7B%0A
-%0A
       //
@@ -1066,54 +1066,164 @@
 e = 
-'import %22traceur-runtime%22;' + transpiledSource
+transpiledSource.replace('System.register(%5B%22', 'System.register(%5B%22traceur-runtime%22, %22').replace('System.register(%5B%5D', 'System.register(%5B%22traceur-runtime%22%5D')
 ;%0A  
@@ -1252,16 +1252,27 @@
 ceMap = 
+JSON.parse(
 compiler
@@ -1286,16 +1286,17 @@
 rceMap()
+)
 ;%0A      

fix source map, runtime injection