Skip to content

Commit

Permalink
add es6 compilation step using typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
nightwing committed Apr 18, 2018
1 parent f3dbec7 commit 086d429
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 45 deletions.
10 changes: 4 additions & 6 deletions plugins/c9.fs/net_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

"use client";

require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) {
var expect = chai.expect;
var expect = require("lib/chai/chai").expect;

expect.setupArchitectTest([
{
Expand All @@ -27,7 +26,7 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai)
provides: [],
setup: main
}
], architect);
]);

function main(options, imports, register) {
var net = imports.net;
Expand All @@ -39,7 +38,7 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai)

it("should connect to a port", function(done) {
var code =
"var server = require('net').createServer(function(c) {"
"var server = require\('net').createServer(function(c) {"
+ "c.write('1');"
+ "c.pipe(c);"
+ "});"
Expand Down Expand Up @@ -73,5 +72,4 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai)
});

register();
}
});
}
2 changes: 1 addition & 1 deletion plugins/c9.ide.ace/ace.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"threewaymerge", "error_handler", "apf"
];
main.provides = ["ace"];
return main;
module.exports = main;

function main(options, imports, register) {
var Editor = imports.Editor;
Expand Down
10 changes: 4 additions & 6 deletions plugins/c9.ide.ace/ace_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

"use client";

require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai) {
var expect = chai.expect;
var expect = require("lib/chai/chai").expect;

expect.setupArchitectTest([
{
Expand Down Expand Up @@ -60,7 +59,7 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai)
provides: [],
setup: main
}
], architect);
]);

function main(options, imports, register) {
var settings = imports.settings;
Expand Down Expand Up @@ -188,10 +187,10 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai)
});
});
describe("focus(), blur()", function() {
it('should get the right className and take keyboard input when focussed', function(done) {
it.skip('should get the right className and take keyboard input when focussed', function(done) {
done();
});
it('should get the right className and don\'t take any keyboard input when blurred', function(done) {
it.skip(`should get the right className and not take any keyboard input when blurred`, function(done) {
done();
});
});
Expand Down Expand Up @@ -564,4 +563,3 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai)

register();
}
});
9 changes: 4 additions & 5 deletions plugins/c9.ide.language.core/complete_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"use client";

require(["plugins/c9.ide.language/test_base"], function(base) {
var base = require("plugins/c9.ide.language/test_base");
base.setup(function(err, imports, helpers) {
if (err) throw err;

Expand Down Expand Up @@ -193,7 +193,7 @@ require(["plugins/c9.ide.language/test_base"], function(base) {
});

it("completes following local dependencies", function(done) {
jsSession.setValue('var test2 = require("./test2.js");\ntest2.');
jsSession.setValue('var test2 = require\("./test2.js");\ntest2.');
jsTab.editor.ace.selection.setSelectionRange({ start: { row: 2, column: 0 }, end: { row: 2, column: 0 }});
jsTab.editor.ace.onTextInput("h");
afterCompleteOpen(function(el) {
Expand All @@ -203,7 +203,7 @@ require(["plugins/c9.ide.language/test_base"], function(base) {
});

it("completes following local with absolute paths", function(done) {
jsSession.setValue('var ext = require("plugins/c9.dummy/dep");\next.');
jsSession.setValue('var ext = require\("plugins/c9.dummy/dep");\next.');
jsTab.editor.ace.selection.setSelectionRange({ start: { row: 2, column: 0 }, end: { row: 2, column: 0 }});
jsTab.editor.ace.onTextInput("e");
afterCompleteOpen(function(el) {
Expand All @@ -214,7 +214,7 @@ require(["plugins/c9.ide.language/test_base"], function(base) {
});

it("completes following local dependencies with absolute paths and common js style exports", function(done) {
jsSession.setValue('var ext = require("plugins/c9.dummy/dep-define");\next.');
jsSession.setValue('var ext = require\("plugins/c9.dummy/dep-define");\next.');
jsTab.editor.ace.selection.setSelectionRange({ start: { row: 2, column: 0 }, end: { row: 2, column: 0 }});
jsTab.editor.ace.onTextInput("e");
afterCompleteOpen(function(el) {
Expand Down Expand Up @@ -726,4 +726,3 @@ require(["plugins/c9.ide.language/test_base"], function(base) {
});
});
});
});
6 changes: 3 additions & 3 deletions plugins/c9.vfs.standalone/standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,12 @@ function plugin(options, imports, register) {
var filefinder = require(base + "/test/lib/filefinder.js");
filefinder.find(base, "plugins", ".*_test.js", blacklistfile, function(err, result) {
result.all = result.list.concat(result.blacklist);
async.filterSeries(result.list, function(file, next) {
fs.readFile(base + file, "utf8", function(err, file) {
async.filterSeries(result.list, function(path, next) {
fs.readFile(base + path, "utf8", function(err, file) {
if (err) return next(false);
if (file.match(/^"use server"/m) && !file.match(/^"use client"/m))
return next(false);
next(file.match(/^define\(|^require\(\[/m));
next(file.match(/^define\(|^require\(\[/m) || /c9\.(ide|fs)/.test(path));
});
}, function(files) {
result.list = files;
Expand Down
3 changes: 3 additions & 0 deletions plugins/c9.vfs.standalone/views/standalone.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
<% if (packed) { %>
require.MODULE_LOAD_URL = "/static/standalone/modules"
<% } else { %>
if (/es5=1/.test(location.search))
require.config.transform = "es5";
<% } %>
if (isLocalVersion)
Expand Down
3 changes: 1 addition & 2 deletions plugins/c9.vfs.standalone/www/places.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
VFS: "/vfs",
Preview: "/preview",
StaticIde: ["/static/ide.html", "/static/ide.offline.html"],
Test: "/static/test.html",
List_of_tests: "/static/test.html?",
List_of_tests: ["/static/test.html", "?es5=1"]
},
Collab: {
main: "/static/plugins/c9.ide.collab/collab_test.html",
Expand Down
7 changes: 5 additions & 2 deletions plugins/c9.vfs.standalone/www/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
<script>
window.onerror=function(msg){ var el=document.getElementById('jserror'); el.innerHTML+="<div class='jserr'>"+msg+"</div>";};

try { var ES6_SUPPORT = eval("x=>x,true"); } catch(e) {}
if (!ES6_SUPPORT || /es5=1/.test(location.search) || /es5=1/.test(top.location.search))
require.config({ useCache: true, transform: "es5" });

/* wrap setTimeout to prevent any plugins leaking timeouts to the next test*/
/*global setTimeout: true, setInterval: true*/
void function() {
Expand Down Expand Up @@ -169,7 +173,6 @@
}
});

require.config({ useCache: false, transform: "~es5/" });
mocha.bail(false);
mocha.ignoreLeaks(true);
mocha.fullTrace && mocha.fullTrace();
Expand Down Expand Up @@ -222,7 +225,7 @@
tests = JSON.parse(tests);
allFiles = tests.list.slice();

if (!files.length && (location.search === "?" || location.search === "")) {
if (!files.length) {
var disabled = tests.blacklist.slice().sort();
var enabled = tests.list.slice().sort();
var all = "<span style='font-size: 14px;'><a href='?runAllTests&remain=1'>run all</a></span>";
Expand Down
16 changes: 12 additions & 4 deletions plugins/node_modules/architect-build/build_support/mini_require.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion plugins/node_modules/architect-build/compress.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 21 additions & 15 deletions plugins/node_modules/architect-build/transform.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 086d429

Please sign in to comment.