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

Commit aa5a82f

Browse files
committed
test rejigging, specific compiler options, node main, 6to5 source maps
1 parent 9e7642d commit aa5a82f

File tree

12 files changed

+42
-29
lines changed

12 files changed

+42
-29
lines changed

.travis.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ before_install:
1414
script:
1515
- grunt
1616
- npm test
17-
- npm run test:browsers -- --polyfill
18-
- npm run test:browsers -- --saucelabs
19-
- npm run test:browsers -- --saucelabs --ie8
20-
- npm run test:browsers:perf
17+
- npm run test:browser -- --polyfill
18+
- npm run test:browser -- --saucelabs
19+
- npm run test:browser -- --saucelabs --ie8

karma.conf.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,20 @@ var options = extend({
2121
coverage: false
2222
}, argv);
2323

24-
if (options.ie8){
24+
if (options.ie8) {
2525
console.log('IE8 Mode !\n - polyfill required\n');
2626
options.polyfill = true;
2727
}
2828

2929
////
3030

31-
module.exports = function (config) {
31+
module.exports = function(config) {
3232

3333
var files = [
3434
'test/_helper.js',
35-
[!options.ie8 ? 'node_modules/traceur/bin/traceur.js' : ''],
35+
[!options.ie8 ? (!options['6to5'] ? 'node_modules/traceur/bin/traceur.js' : 'node_modules/6to5/browser.js') : ''],
3636

37-
'dist/es6-module-loader' +
38-
(options.polyfill ? '' : '-sans-promises')
39-
+ '.src.js',
37+
'dist/es6-module-loader-' + (!options['6to5'] ? 'traceur' : '6to5') + (options.polyfill ? '' : '-sp') + '.src.js',
4038

4139
'test/_browser.js',
4240
'test/browser-script-type-module.js',
@@ -151,7 +149,7 @@ module.exports = function (config) {
151149
};
152150

153151
function flatten(arr) {
154-
return arr.reduce(function (memo, val) {
152+
return arr.reduce(function(memo, val) {
155153
return memo.concat(util.isArray(val) ? flatten(val) : val ? [val] : []);
156154
}, []);
157155
}

lib/index-6to5.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
require('../dist/es6-module-loader-6to5.src');
2+
3+
module.exports = {
4+
Loader: global.LoaderPolyfill,
5+
System: global.System
6+
};

lib/index-traceur.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
require('../dist/es6-module-loader-traceur.src');
2+
3+
module.exports = {
4+
Loader: global.LoaderPolyfill,
5+
System: global.System
6+
};

lib/index.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@
5454
},
5555
"main": "lib/index-traceur",
5656
"scripts": {
57-
"test": "npm run test:node && npm run test:browsers",
58-
"test:node": "mocha test/_node.js",
59-
"test:browsers": "karma start --single-run",
57+
"test": "npm run test:node && npm run test:browser",
58+
"test:node": "mocha test/_node-traceur.js && mocha test/_node-6to5.js",
59+
"test:browser": "karma start --single-run && karma start --single-run --6to5",
6060
"test:browsers:perf": "karma start karma-benchmark.conf.js --single-run"
6161
},
6262
"dependencies": {

src/6to5-loader.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@
1717
throw new TypeError('Include 6to5 for module syntax support');
1818
}
1919

20-
var options = this.parseOptions || {};
20+
var options = this.to5Options || {};
2121
options.modules = 'system';
2222
options.sourceMap = 'inline';
2323
options.filename = load.address;
2424
options.code = true;
2525
options.ast = false;
26-
options.runtime = true;
2726

2827
var source = to5.transform(load.source, options).code;
2928

@@ -32,7 +31,7 @@
3231

3332
// add "!eval" to end of 6to5 sourceURL
3433
// I believe this does something?
35-
source = 'var __moduleAddress = "' + load.address + '";' + source + '!eval';
34+
source = 'var __moduleAddress = "' + load.address + '";' + source + '\n//# sourceURL=' + load.address + '!eval';
3635

3736
__eval(source, __global, load);
3837
}

src/loader.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,6 @@ function logloads(loads) {
899899
});
900900

901901
// 26.3.3.13 realm not implemented
902-
this.parseOptions = {};
903902
}
904903

905904
function Module() {}

src/traceur-loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
console.assert(load.source, 'Non-empty source');
3030

31-
var options = this.parseOptions || {};
31+
var options = this.traceurOptions || {};
3232
options.modules = 'instantiate';
3333
options.script = false;
3434
options.sourceMaps = 'inline';

test/_node.js renamed to test/_node-6to5.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ global.expect = require('expect.js');
44

55
require('./_helper');
66

7-
require('../lib');
7+
require('../lib/index-6to5');
88

99
require('./system.spec');
1010

0 commit comments

Comments
 (0)