Comparing version 0.0.88 to 0.0.89
{ | ||
"name": "traceur", | ||
"version": "0.0.88", | ||
"version": "0.0.89", | ||
"description": "ES6 to ES5 compiler", | ||
@@ -52,8 +52,8 @@ "keywords": [ | ||
"serve-index": "1.x", | ||
"mocha": "1.20.x", | ||
"chai": "1.x", | ||
"mocha": "2.2.x", | ||
"chai": "2.2.x", | ||
"node-uuid": "1.x", | ||
"regexpu": "1.1.0", | ||
"requirejs": "2.x", | ||
"traceur": "0.0.87", | ||
"traceur": "0.0.88", | ||
"promises-aplus-tests": "2.x", | ||
@@ -60,0 +60,0 @@ "webcomponents.js": "^0.5.4-1" |
@@ -18,5 +18,13 @@ // Copyright 2015 Traceur Authors. | ||
export class NodeLoaderCompiler extends LoaderCompiler { | ||
constructor() { | ||
super(); | ||
this.sourceMapsInMemory_ = false; | ||
} | ||
evaluateCodeUnit(codeUnit) { | ||
// TODO(jjb): can we move this to file scope? | ||
let runInThisContext = require('vm').runInThisContext; | ||
// We cannot move these to file scope since this file is included in | ||
// bin/traceur.js which needs to work in a browser. | ||
let {runInThisContext} = require('vm'); | ||
let semver = require('semver'); | ||
let content = codeUnit.metadata.transcoded; | ||
@@ -27,6 +35,38 @@ let filename = codeUnit.address || codeUnit.normalizedName; | ||
// sourcemap=memory mechanism can help us debug. | ||
let result = runInThisContext(content, filename); | ||
if (codeUnit.metadata.traceurOptions.sourceMaps === 'memory') { | ||
this.enableMemorySourceMaps_(); | ||
} | ||
// Node 0.10 uses a string as the filename. | ||
// Node 0.12 >= uses an option object | ||
let options; | ||
if (semver.gte(process.version, '0.12.0')) { | ||
options = {filename}; | ||
} else { | ||
options = filename; | ||
} | ||
let result = runInThisContext(content, options); | ||
codeUnit.metadata.transformedTree = null; | ||
return result; | ||
} | ||
enableMemorySourceMaps_() { | ||
if (this.sourceMapsInMemory_) { | ||
return; | ||
} | ||
require('source-map-support').install({ | ||
retrieveSourceMap: function(url) { | ||
try { | ||
let map = System.getSourceMap(url); | ||
if (map) { | ||
return {url, map}; | ||
} | ||
} catch (ex) { | ||
// Failure in this function results in no error output. | ||
console.error('retrieveSourceMap FAILED ', ex); | ||
} | ||
} | ||
}); | ||
this.sourceMapsInMemory_ = true; | ||
} | ||
} |
@@ -102,7 +102,6 @@ // Copyright 2012 Traceur Authors. | ||
* | ||
* @param {Array.<Object>} fileNamesAndTypes The list of {name, type} | ||
* @param {Array<Object>} fileNamesAndTypes The list of {name, type} | ||
* to compile and concat; type is 'module' or 'script' | ||
* @param {Object} options A container for misc options. 'depTarget' is the | ||
* only currently available option, which results in the dependencies for | ||
* 'fileNamesAndTypes' being printed to stdout, with 'depTarget' as the target. | ||
* @param {Object} options A container for misc options. 'referrer' is the | ||
* only currently available option. | ||
* @param {Function} callback Callback used to return the result. A null result | ||
@@ -114,3 +113,2 @@ * indicates that recursiveModuleCompile has returned successfully from a | ||
function recursiveModuleCompile(fileNamesAndTypes, options) { | ||
var depTarget = options && options.depTarget; | ||
var referrerName = options && options.referrer; | ||
@@ -164,7 +162,3 @@ | ||
return sequencePromises(fileNamesAndTypes, loadInput).then(function() { | ||
if (depTarget) { | ||
return null; | ||
} else { | ||
return loaderCompiler.toTree(); | ||
} | ||
return loaderCompiler.toTree(); | ||
}); | ||
@@ -171,0 +165,0 @@ } |
@@ -24,20 +24,2 @@ // Copyright 2014 Traceur Authors. | ||
require('source-map-support').install({ | ||
retrieveSourceMap: function(filename) { | ||
var map = System.getSourceMap(filename); | ||
if (!map && filename === traceur.selfCompiledFilename) { | ||
if (!traceurMap) { | ||
traceurMap = fs.readFileSync(traceur.selfCompiledFilename + '.map', 'utf8'); | ||
} | ||
map = traceurMap; | ||
} | ||
if (map) { | ||
return { | ||
url: filename, | ||
map: map | ||
}; | ||
} | ||
} | ||
}); | ||
Reflect.global.System = System; | ||
@@ -44,0 +26,0 @@ System.map = System.semverMap(System.version); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1402690
36086