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

Commit f9b7c0c

Browse files
committed
traceur compatibility fixes
1 parent aea4514 commit f9b7c0c

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

lib/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
require('traceur');
1+
if (!global.traceur)
2+
require('traceur');
23
module.exports = {
34
Loader: require('./loader'),
45
Module: Module,

lib/loader.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@ function logloads(loads) {
225225
load.kind = 'declarative';
226226
depsList = getImports(body);
227227

228+
var oldSourceMaps = traceur.options.sourceMaps;
229+
var oldModules = traceur.options.modules;
230+
228231
traceur.options.sourceMaps = true;
229232
traceur.options.modules = 'instantiate';
230233

@@ -266,10 +269,16 @@ function logloads(loads) {
266269
System.register = curRegister;
267270
if (curSystem)
268271
__global.System = curSystem;
272+
if (oldSourceMaps)
273+
traceur.options.sourceMaps = oldSourceMaps;
274+
if (oldModules)
275+
traceur.options.modules = oldModules;
269276
throw e;
270277
}
271278
System.register = curRegister;
272279
__global.System = curSystem;
280+
traceur.options.sourceMaps = oldSourceMaps;
281+
traceur.options.modules = oldModules;
273282
}
274283
else if (typeof instantiateResult == 'object') {
275284
depsList = instantiateResult.deps || [];

lib/system.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@
219219
if (global.System && global.traceur)
220220
global.traceurSystem = global.System;
221221

222-
global.System = System;
222+
if (isBrowser)
223+
global.System = System;
223224

224225
// <script type="module"> support
225226
// allow a data-init function callback once loaded

0 commit comments

Comments
 (0)