Skip to content

Instantly share code, notes, and snippets.

@OliverJAsh
Last active August 29, 2015 14:08
Show Gist options
  • Save OliverJAsh/fd98c53b62eaa32f5e56 to your computer and use it in GitHub Desktop.
Save OliverJAsh/fd98c53b62eaa32f5e56 to your computer and use it in GitHub Desktop.
longjohn interoperability with Traceur call stacks
npm install
node traceur-runner.js main.js
/* jshint esnext: true, node: true */
require('longjohn');
var bar = () => { throw new Error('foo'); };
var foo = () => new Promise((resolve) => setTimeout(() => resolve(bar()), 0));
foo()
.catch(error => console.error(error));
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "traceur-runner.js",
"dependencies": {
"longjohn": "^0.2.4",
"traceur": "0.0.72",
"traceur-source-maps": "^1.0.3"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
'use strict';
/* jshint node: true */
var traceur = require('traceur');
require('traceur-source-maps').install(traceur);
var path = require('path');
traceur.require.makeDefault(function (modulePath) {
var isDependency = modulePath.indexOf('node_modules') !== -1;
return ! isDependency;
});
require(path.resolve(process.cwd(), process.argv[2]));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment