Skip to content

Commit af40007

Browse files
committedNov 7, 2015
add hand-crafted regeneratorRuntime
1 parent 72a9186 commit af40007

File tree

3 files changed

+917
-0
lines changed

3 files changed

+917
-0
lines changed
 

‎lib/babel.js

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
var resolveFrom = require('resolve-from');
33
var createEspowerPlugin = require('babel-plugin-espower/create');
44
var requireFromString = require('require-from-string');
5+
var fs = require('fs');
6+
var join = require('path').join;
57
var hasGenerators = parseInt(process.version.slice(1), 10) > 0;
68
var path = process.argv[2];
79

@@ -25,4 +27,10 @@ var options = {
2527
};
2628

2729
var transpiled = babel.transformFileSync(path, options);
30+
31+
if (!hasGenerators) {
32+
var runtime = fs.readFileSync(join(__dirname, '/regeneratorRuntime.js'));
33+
transpiled.code = runtime + '\n' + transpiled.code;
34+
}
35+
2836
requireFromString(transpiled.code, path);

0 commit comments

Comments
 (0)