Convert backend code to ES modules

Bundling code now with Rollup for its flat bundling and tree shaking
support. Front end code still goes through Webpack for browser support.
This commit is contained in:
Zaid Abdulla committed 2019-02-04 23:47:54 -08:00
1 parent 824639976f
commit 1e41c72d60
62 files changed
+718 -898

No files matched your search

+5 -8
View File
@@ -18,9 +18,9 @@
*/
"use strict";
const fs = require("fs");
const http = require("http");
const https = require("https");
import fs from "fs";
import http from "http";
import https from "https";
let server, listener;
@@ -48,7 +48,7 @@ function closeServer(timeout, callback) {
});
}
function start(port, networkInterface, ssl, _listener, onConnection) {
export function start(port, networkInterface, ssl, _listener, onConnection) {
listener = _listener;
if (ssl) {
@@ -76,7 +76,7 @@ function start(port, networkInterface, ssl, _listener, onConnection) {
server.listen(port, networkInterface);
}
function stop() {
export function stop() {
return new Promise((resolve, reject) => {
setTimeout(() => {
reject(new Error("Could not close server in a timely manner"));
@@ -84,6 +84,3 @@ function stop() {
closeServer(20000, resolve);
});
}
exports.start = start;
exports.stop = stop;