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:
1 parent
824639976f
commit
1e41c72d60
62 files changed
+718
-898
No files matched your search
+16
-19
@@ -18,20 +18,20 @@
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const zlib = require("zlib");
|
||||
const crypto = require("crypto");
|
||||
const fs = require("fs");
|
||||
const config = require("./config");
|
||||
const common = require("./common");
|
||||
const soap = require("./soap");
|
||||
const session = require("./session");
|
||||
const query = require("./query");
|
||||
const device = require("./device");
|
||||
const cache = require("./cache");
|
||||
const localCache = require("./local-cache");
|
||||
const db = require("./db");
|
||||
const logger = require("./logger");
|
||||
const scheduling = require("./scheduling");
|
||||
import zlib from "zlib";
|
||||
import crypto from "crypto";
|
||||
import fs from "fs";
|
||||
import * as config from "./config";
|
||||
import * as common from "./common";
|
||||
import * as soap from "./soap";
|
||||
import * as session from "./session";
|
||||
import * as query from "./query";
|
||||
import * as device from "./device";
|
||||
import * as cache from "./cache";
|
||||
import * as localCache from "./local-cache";
|
||||
import * as db from "./db";
|
||||
import * as logger from "./logger";
|
||||
import * as scheduling from "./scheduling";
|
||||
|
||||
const MAX_CYCLES = 4;
|
||||
const MAX_CONCURRENT_REQUESTS = config.get("MAX_CONCURRENT_REQUESTS");
|
||||
@@ -771,7 +771,7 @@ function getSession(connection, sessionId, callback) {
|
||||
const currentSessions = new WeakMap();
|
||||
|
||||
// When socket closes, store active sessions in cache
|
||||
function onConnection(socket) {
|
||||
export function onConnection(socket) {
|
||||
// The property remoteAddress may be undefined after the connection is
|
||||
// closed, unless we read it at least once (caching?)
|
||||
socket.remoteAddress;
|
||||
@@ -996,7 +996,7 @@ function processRequest(sessionContext, rpc) {
|
||||
}
|
||||
}
|
||||
|
||||
function listener(httpRequest, httpResponse) {
|
||||
export function listener(httpRequest, httpResponse) {
|
||||
stats.totalRequests += 1;
|
||||
|
||||
if (httpRequest.method !== "POST") {
|
||||
@@ -1243,6 +1243,3 @@ function listener(httpRequest, httpResponse) {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
exports.listener = listener;
|
||||
exports.onConnection = onConnection;
|
||||
Reference in new issue
Block a user