manual merge of TypeScript work

This commit is contained in:
guybedford 2015-05-19 14:33:51 +02:00
parent c6522d206f
commit 5af8d5531d
5 changed files with 56 additions and 3 deletions

View File

@ -22,7 +22,8 @@
setMetaGlobal(this, 'babel');
setMetaGlobal(this, 'traceur');
setMetaGlobal(this, 'traceur-runtime');
setMetaGlobal(this, 'babel/external-helpers');
setMetaGlobal(this, 'babel/external-helpers.js');
setMetaGlobal(this, 'typescript/bin/typescript.js');
};
});
@ -84,7 +85,7 @@
});
}
if (!__global.babelHelpers && load.source.match(babelHelpersRegEx)) {
return loader['import']('babel/external-helpers').then(function() {
return loader['import']('babel/external-helpers.js').then(function() {
return source;
});
}

View File

@ -15,7 +15,8 @@
"devDependencies": {
"babel-core": "^5.0.10",
"qunit": "^0.6.2",
"traceur": "0.0.87",
"traceur": "0.0.88",
"typescript": "mhegazy/typescript#v1.5-beta2",
"uglify-js": "~2.4.13"
},
"scripts": {

32
test/test-typescript.html Normal file
View File

@ -0,0 +1,32 @@
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="../bower_components/qunit/qunit/qunit.css"/>
</head>
<body>
<h1 id="qunit-header">SystemJS Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-test-area"></div>
<!-- <script src="../bower_components/traceur/traceur.js"></script> -->
<script src="../node_modules/es6-module-loader/dist/es6-module-loader.src.js"></script>
<script src="../dist/system.src.js" type="text/javascript"></script>
<script>
System.paths['typescript'] = '../node_modules/typescript/bin/typescript.js';
System.meta['typescript'] = { format: 'global', exports: 'ts' };
System.transpiler = 'typescript';
System['import']('test.js')['catch'](function(e) {
setTimeout(function() {
throw e;
})
});
</script>
<script src="../bower_components/qunit/qunit/qunit.js"></script>
</body>
</html>

View File

@ -484,6 +484,8 @@ asyncTest('ES6 named export loading of CJS', function() {
});
});
// TypeScript does not support async functions yet
if (System.transpiler !== 'typescript')
asyncTest('Async functions', function() {
System.babelOptions = { stage: 0 };
System.traceurOptions = { asyncFunctions: true };
@ -493,6 +495,7 @@ asyncTest('Async functions', function() {
});
});
if (System.transpiler !== 'typescript')
asyncTest('Wrapper module support', function() {
System['import']('tests/wrapper.js').then(function(m) {
ok(m.d == 'default1', 'Wrapper module not defined.');

View File

@ -0,0 +1,16 @@
importScripts('../../node_modules/es6-module-loader/dist/es6-module-loader.js',
'../../dist/system.js');
System.baseURL = '../';
System.paths['typescript'] = '../../node_modules/typescript/bin/typescript.js';
System.meta['typescript'] = { format: 'global', exports: 'ts' };
System.transpiler = 'typescript';
System.import('tests/es6-and-amd').then(function(m) {
postMessage({
amd: m.amd_module,
es6: m.es6_module
});
}, function(err) {
console.error(err);
});