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

Commit e616a94

Browse files
committed
rename 6to5 to babel
1 parent 67f45bf commit e616a94

10 files changed

+29
-28
lines changed

.travis.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,23 @@ node_js:
66
- '0.10'
77
- '0.11'
88
- '0.12'
9+
- 'iojs'
910
env:
1011
global:
1112
- SAUCE_LABS=false PARSER=false OPTIONS=""
1213
matrix:
1314
- PARSER="traceur"
14-
- PARSER="6to5"
15+
- PARSER="babel"
1516
matrix:
1617
include:
1718
- node_js: "0.10"
1819
env: SAUCE_LABS=true PARSER="traceur"
1920
- node_js: "0.10"
20-
env: SAUCE_LABS=true PARSER="6to5"
21+
env: SAUCE_LABS=true PARSER="babel"
2122
# - node_js: "0.10"
2223
# env: SAUCE_LABS=true PARSER="traceur" OPTIONS="--ie8"
2324
# - node_js: "0.10"
24-
# env: SAUCE_LABS=true PARSER="6to5" OPTIONS="--ie8"
25+
# env: SAUCE_LABS=true PARSER="babel" OPTIONS="--ie8"
2526
before_install:
2627
- export CHROME_BIN=chromium-browser
2728
- export DISPLAY=:99.0

karma.conf.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ module.exports = function(config) {
3535

3636
var files = [
3737
'test/_helper.js',
38-
[options['6to5'] ? 'node_modules/regenerator/runtime.js' : ''],
38+
[options['babel'] ? 'node_modules/regenerator/runtime.js' : ''],
3939

40-
[!options.ie8 ? (!options['6to5'] ? 'node_modules/traceur/bin/traceur.js' : 'node_modules/6to5-core/browser.js') : ''],
40+
[!options.ie8 ? (!options['babel'] ? 'node_modules/traceur/bin/traceur.js' : 'node_modules/babel-core/browser.js') : ''],
4141

4242
'dist/es6-module-loader' + (options.polyfill ? '' : '-sans-promises') + '.src.js',
4343

lib/index-6to5.js lib/index-babel.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var System = require('../dist/es6-module-loader.src');
22

3-
System.transpiler = '6to5';
3+
System.transpiler = 'babel';
44

55
module.exports = {
66
Loader: global.LoaderPolyfill,

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@
5656
"main": "lib/index-traceur",
5757
"scripts": {
5858
"test": "npm run test:node && npm run test:browser",
59-
"test:node": "mocha test/_node-traceur.js && mocha test/_node-6to5.js",
60-
"test:browser": "npm run test:browser-traceur && npm run test:browser-6to5",
59+
"test:node": "mocha test/_node-traceur.js && mocha test/_node-babel.js",
60+
"test:browser": "npm run test:browser-traceur && npm run test:browser-babel",
6161
"test:browser-traceur": "karma start --single-run",
62-
"test:browser-6to5": "karma start --single-run --6to5",
62+
"test:browser-babel": "karma start --single-run --babel",
6363
"test:browser:perf": "karma start karma-benchmark.conf.js --single-run"
6464
},
6565
"dependencies": {
66-
"6to5-core": "~3.5.3",
66+
"babel-core": "^4.1.1",
6767
"traceur": "0.0.82",
6868
"when": "^3.7.2"
6969
}

src/transpiler.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Traceur and 6to5 transpile hook for Loader
2+
* Traceur and Babel transpile hook for Loader
33
*/
44
(function(Loader) {
55
// Returns an array of ModuleSpecifiers
@@ -11,17 +11,17 @@
1111

1212
Loader.prototype.transpile = function(load) {
1313
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;
1717
}
1818
else {
1919
transpiler = traceurTranspile;
2020
transpilerModule = isNode ? require('traceur') : __global.traceur;
2121
}
2222

2323
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.');
2525
}
2626

2727
return 'var __moduleAddress = "' + load.address + '";' + transpiler.call(this, load);
@@ -53,8 +53,8 @@
5353
}
5454
}
5555

56-
function to5Transpile(load) {
57-
var options = this.to5Options || {};
56+
function babelTranspile(load) {
57+
var options = this.babelOptions || {};
5858
options.modules = 'system';
5959
options.sourceMap = 'inline';
6060
options.filename = load.address;
@@ -65,7 +65,7 @@
6565

6666
var source = transpilerModule.transform(load.source, options).code;
6767

68-
// add "!eval" to end of 6to5 sourceURL
68+
// add "!eval" to end of Babel sourceURL
6969
// I believe this does something?
7070
return source + '\n//# sourceURL=' + load.address + '!eval';
7171
}

test/_node-6to5.js test/_node-babel.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ require('./_helper');
66

77
require('regenerator/runtime');
88

9-
global.System = require('../lib/index-6to5').System;
9+
global.System = require('../lib/index-babel').System;
1010

11-
System.parser = '6to5';
11+
System.parser = 'babel';
1212

1313
require('./system.spec');
1414

test/system.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22

3-
if (typeof to5 != 'undefined')
4-
System.transpiler = '6to5';
3+
if (typeof babel != 'undefined')
4+
System.transpiler = 'babel';
55

66
var ie = typeof window != 'undefined' && window.navigator.userAgent.match(/Trident/);
77

test/test-6to5.html test/test-babel.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
<script src="test.js"></script>
77

8-
<!-- set this to the path to 6to5.js -->
9-
<script src="../node_modules/6to5-core/browser.js"></script>
8+
<!-- set this to the path to babel.js -->
9+
<script src="../node_modules/babel-core/browser.js"></script>
1010
<script src="../node_modules/regenerator/runtime.js"></script>
1111

1212
<script>
@@ -18,7 +18,7 @@
1818

1919
<script src="../dist/es6-module-loader.src.js"></script>
2020
<script>
21-
System.transpiler = '6to5';
21+
System.transpiler = 'babel';
2222
</script>
2323

2424
<script>

test/test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ function runTests() {
640640

641641
if (typeof Worker != 'undefined')
642642
test('Loading inside of a Web Worker', function(assert) {
643-
var worker = new Worker('worker/worker-' + (typeof traceur != 'undefined' ? 'traceur' : '6to5') + '.js');
643+
var worker = new Worker('worker/worker-' + (typeof traceur != 'undefined' ? 'traceur' : 'babel') + '.js');
644644

645645
worker.onmessage = function(e) {
646646
assert(e.data, 'p');

test/worker/worker-6to5.js test/worker/worker-babel.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
importScripts("../../node_modules/6to5-core/browser.js",
1+
importScripts("../../node_modules/babel-core/browser.js",
22
"../../node_modules/when/es6-shim/Promise.js",
33
"../../dist/es6-module-loader.src.js"
44
);
55

6-
System.transpiler = '6to5';
6+
System.transpiler = 'babel';
77

88
System['import']('es6').then(function(m) {
99
postMessage(m.p);

0 commit comments

Comments
 (0)