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

Commit 30ed631

Browse files
committed
final test runs
1 parent 8ee0ba4 commit 30ed631

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

src/parser.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
(function(Loader) {
55
// parse function is used to parse a load record
66
// Returns an array of ModuleSpecifiers
7-
var parser, parserName, parserOptionsName;
7+
var parser, parserModule, parserName, parserOptionsName;
88

99
// use Traceur by default
1010
Loader.prototype.parser = 'traceur';
@@ -15,17 +15,17 @@
1515

1616
// try to pick up parser from global or require
1717
if (typeof window == 'undefined' && typeof WorkerGlobalScope == 'undefined')
18-
parser = require(this.parser);
18+
parserModule = require(this.parser);
1919
else
20-
parser = __global[parserName]
20+
parserModule = __global[parserName];
2121

22-
if (!parser)
22+
if (!parserModule)
2323
throw new TypeError('Include Traceur or 6to5 for module syntax support');
2424

25-
parserOptionsName = parserName + 'Options';
25+
parser = this.parser == '6to5' ? to5Parse : traceurParse;
2626
}
2727

28-
var source = (this.parser == '6to5' ? to5Parse : traceurParse).call(this, load);
28+
var source = parser.call(this, load);
2929

3030
source = 'var __moduleAddress = "' + load.address + '";' + source;
3131

@@ -39,7 +39,7 @@
3939
options.sourceMaps = 'inline';
4040
options.filename = load.address;
4141

42-
var compiler = new parser.Compiler(options);
42+
var compiler = new parserModule.Compiler(options);
4343
var source = doTraceurCompile(load.source, compiler, options.filename);
4444

4545
// add "!eval" to end of Traceur sourceURL
@@ -66,7 +66,7 @@
6666
options.code = true;
6767
options.ast = false;
6868

69-
var source = parser.transform(load.source, options).code;
69+
var source = parserModule.transform(load.source, options).code;
7070

7171
// add "!eval" to end of 6to5 sourceURL
7272
// I believe this does something?

test/test-6to5.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<script src="../node_modules/regenerator/runtime.js"></script>
1111

1212
<script>
13-
System.parser = '6to5';
1413
// test promise polyfill
1514
// delete window.Promise;
1615
</script>
@@ -19,6 +18,7 @@
1918

2019
<script src="../dist/es6-module-loader.src.js"></script>
2120
<script>
21+
System.parser = '6to5';
2222
// test parseOptions and anonymous errors
2323
// System.parseOptions = { classes: false };
2424
</script>

test/test-traceur.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<script src="../node_modules/traceur/bin/traceur.js"></script>
1010

1111
<script>
12-
System.parser = 'traceur';
1312
// test promise polyfill
1413
// delete window.Promise;
1514
</script>

test/worker/worker-6to5.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
importScripts("../../node_modules/6to5/browser.js",
22
"../../node_modules/when/es6-shim/Promise.js",
3-
"../../dist/es6-module-loader.src.js");
3+
"../../dist/es6-module-loader.src.js"
4+
);
5+
6+
System.parser = '6to5';
47

58
System['import']('es6').then(function(m) {
69
postMessage(m.p);
710
}, function(err) {
811
console.error(err, err.stack);
9-
});
12+
});

0 commit comments

Comments
 (0)