|
1 | 1 | /*
|
2 |
| - * Traceur and 6to5 transpile hook for Loader |
| 2 | + * Traceur and Babel transpile hook for Loader |
3 | 3 | */
|
4 | 4 | (function(Loader) {
|
5 | 5 | // Returns an array of ModuleSpecifiers
|
|
11 | 11 |
|
12 | 12 | Loader.prototype.transpile = function(load) {
|
13 | 13 | if (!transpiler) {
|
14 |
| - if (this.transpiler == '6to5') { |
15 |
| - transpiler = to5Transpile; |
16 |
| - transpilerModule = isNode ? require('6to5-core') : __global.to5; |
| 14 | + if (this.transpiler == 'babel') { |
| 15 | + transpiler = babelTranspile; |
| 16 | + transpilerModule = isNode ? require('babel-core') : __global.babel; |
17 | 17 | }
|
18 | 18 | else {
|
19 | 19 | transpiler = traceurTranspile;
|
20 | 20 | transpilerModule = isNode ? require('traceur') : __global.traceur;
|
21 | 21 | }
|
22 | 22 |
|
23 | 23 | if (!transpilerModule)
|
24 |
| - throw new TypeError('Include Traceur or 6to5 for module syntax support.'); |
| 24 | + throw new TypeError('Include Traceur or Babel for module syntax support.'); |
25 | 25 | }
|
26 | 26 |
|
27 | 27 | return 'var __moduleAddress = "' + load.address + '";' + transpiler.call(this, load);
|
|
53 | 53 | }
|
54 | 54 | }
|
55 | 55 |
|
56 |
| - function to5Transpile(load) { |
57 |
| - var options = this.to5Options || {}; |
| 56 | + function babelTranspile(load) { |
| 57 | + var options = this.babelOptions || {}; |
58 | 58 | options.modules = 'system';
|
59 | 59 | options.sourceMap = 'inline';
|
60 | 60 | options.filename = load.address;
|
|
65 | 65 |
|
66 | 66 | var source = transpilerModule.transform(load.source, options).code;
|
67 | 67 |
|
68 |
| - // add "!eval" to end of 6to5 sourceURL |
| 68 | + // add "!eval" to end of Babel sourceURL |
69 | 69 | // I believe this does something?
|
70 | 70 | return source + '\n//# sourceURL=' + load.address + '!eval';
|
71 | 71 | }
|
|
0 commit comments