@elliemae/pui-cli 8.42.0-alpha.2 → 8.42.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/server/cert.js +45 -0
- package/dist/cjs/server/certs/uiplatform.pfx +0 -0
- package/dist/cjs/server/index.js +6 -13
- package/dist/cjs/server/logger.js +1 -1
- package/dist/cjs/server/wsServer.js +13 -4
- package/dist/cjs/webpack/webpack.dev.babel.js +8 -3
- package/dist/esm/server/cert.js +14 -0
- package/dist/esm/server/certs/uiplatform.pfx +0 -0
- package/dist/esm/server/index.js +7 -14
- package/dist/esm/server/logger.js +1 -1
- package/dist/esm/server/wsServer.js +13 -4
- package/dist/esm/webpack/webpack.dev.babel.js +8 -3
- package/dist/types/lib/server/cert.d.ts +4 -0
- package/dist/types/lib/server/wsServer.d.ts +6 -2
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/cjs/server/certs/uiplatform.p12 +0 -0
- package/dist/esm/server/certs/uiplatform.p12 +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var cert_exports = {};
|
|
30
|
+
__export(cert_exports, {
|
|
31
|
+
getCertOptions: () => getCertOptions
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(cert_exports);
|
|
34
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
35
|
+
var import_path = __toESM(require("path"), 1);
|
|
36
|
+
var import_url = require("url");
|
|
37
|
+
const import_meta = {};
|
|
38
|
+
const getCertOptions = () => {
|
|
39
|
+
const __filename = (0, import_url.fileURLToPath)(import_meta.url);
|
|
40
|
+
const __dirname = import_path.default.dirname(__filename);
|
|
41
|
+
return {
|
|
42
|
+
pfx: import_fs.default.readFileSync(import_path.default.join(__dirname, "./certs/uiplatform.pfx")),
|
|
43
|
+
passPhrase: "uiplatform"
|
|
44
|
+
};
|
|
45
|
+
};
|
|
Binary file
|
package/dist/cjs/server/index.js
CHANGED
|
@@ -22,9 +22,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
mod
|
|
23
23
|
));
|
|
24
24
|
var import_node_https = __toESM(require("node:https"), 1);
|
|
25
|
-
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
26
|
-
var import_node_path = __toESM(require("node:path"), 1);
|
|
27
25
|
var import_express = __toESM(require("express"), 1);
|
|
26
|
+
var import_cert = require("./cert.js");
|
|
28
27
|
var import_logger = require("./logger.js");
|
|
29
28
|
var import_middlewares = require("./middlewares.js");
|
|
30
29
|
var import_utils = require("./utils.js");
|
|
@@ -35,21 +34,15 @@ var import_wsServer = require("./wsServer.js");
|
|
|
35
34
|
(0, import_middlewares.setupDefaultMiddlewares)(app);
|
|
36
35
|
await (0, import_appRoutes.loadRoutes)(app);
|
|
37
36
|
(0, import_middlewares.setupAdditionalMiddlewars)(app);
|
|
38
|
-
const
|
|
39
|
-
pfx: import_node_fs.default.readFileSync(import_node_path.default.join(__dirname, "./certs/uiplatform.p12")),
|
|
40
|
-
passPhrase: "uiplatform"
|
|
41
|
-
};
|
|
42
|
-
const server = import_node_https.default.createServer(options, app);
|
|
37
|
+
const server = import_node_https.default.createServer((0, import_cert.getCertOptions)(), app);
|
|
43
38
|
server.listen(import_utils.port, import_utils.host, () => {
|
|
44
|
-
(0, import_wsServer.createWSServer)({ server }).then((wsServer) => {
|
|
45
|
-
app.locals.wsServer = wsServer;
|
|
46
|
-
}).catch((err) => {
|
|
47
|
-
import_logger.logger.error(err);
|
|
48
|
-
process.exit(1);
|
|
49
|
-
});
|
|
50
39
|
import_logger.logger.appStarted(import_utils.port.toString(), import_utils.host || "localhost");
|
|
51
40
|
}).on("error", (err) => {
|
|
52
41
|
import_logger.logger.error(err);
|
|
53
42
|
process.exit(1);
|
|
54
43
|
});
|
|
44
|
+
const { wsServer } = await (0, import_wsServer.createWSServer)({
|
|
45
|
+
port: import_utils.wsPort
|
|
46
|
+
});
|
|
47
|
+
app.locals.wsServer = wsServer;
|
|
55
48
|
})();
|
|
@@ -48,7 +48,7 @@ const logger = {
|
|
|
48
48
|
const accessUrls = `${import_chalk.default.bold("Access URLs:")}${divider}
|
|
49
49
|
`;
|
|
50
50
|
const localHostUrl = `Localhost: ${import_chalk.default.magenta(
|
|
51
|
-
`
|
|
51
|
+
`https://${host}:${port}`
|
|
52
52
|
)}
|
|
53
53
|
`;
|
|
54
54
|
const lanUrl = `LAN: ${import_chalk.default.magenta(`http://${import_ip.default.address()}:${port}`)}
|
|
@@ -31,8 +31,11 @@ __export(wsServer_exports, {
|
|
|
31
31
|
createWSServer: () => createWSServer
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(wsServer_exports);
|
|
34
|
+
var import_node_https = __toESM(require("node:https"), 1);
|
|
34
35
|
var wsLib = __toESM(require("ws"), 1);
|
|
36
|
+
var import_cert = require("./cert.js");
|
|
35
37
|
const PING_INTERVAL = 3e4;
|
|
38
|
+
const DEFAULT_PORT = 5001;
|
|
36
39
|
const onSocketError = (err) => {
|
|
37
40
|
console.error(err);
|
|
38
41
|
};
|
|
@@ -48,7 +51,7 @@ const getAuthToken = (protocols) => {
|
|
|
48
51
|
return authProtocol.split("--")[1]?.trim?.();
|
|
49
52
|
};
|
|
50
53
|
const createWSServer = ({
|
|
51
|
-
|
|
54
|
+
port = DEFAULT_PORT,
|
|
52
55
|
pingInterval = PING_INTERVAL,
|
|
53
56
|
onOpen
|
|
54
57
|
}) => {
|
|
@@ -56,8 +59,9 @@ const createWSServer = ({
|
|
|
56
59
|
const heartbeat = () => {
|
|
57
60
|
isAlive = true;
|
|
58
61
|
};
|
|
59
|
-
const
|
|
60
|
-
|
|
62
|
+
const httpServer = import_node_https.default.createServer((0, import_cert.getCertOptions)());
|
|
63
|
+
const wsServer = new wsLib.WebSocketServer({ noServer: true });
|
|
64
|
+
httpServer.on("upgrade", (req, socket, head) => {
|
|
61
65
|
socket.on("error", onSocketError);
|
|
62
66
|
wsServer.handleUpgrade(req, socket, head, (ws) => {
|
|
63
67
|
const protocols = req.headers["sec-websocket-protocol"]?.split(",");
|
|
@@ -113,5 +117,10 @@ const createWSServer = ({
|
|
|
113
117
|
wsServer.on("close", function close() {
|
|
114
118
|
clearInterval(interval);
|
|
115
119
|
});
|
|
116
|
-
return Promise
|
|
120
|
+
return new Promise((resolve) => {
|
|
121
|
+
httpServer.listen(port, () => {
|
|
122
|
+
console.log(`Websocket server listening on port ${port}`);
|
|
123
|
+
return resolve({ httpServer, wsServer });
|
|
124
|
+
});
|
|
125
|
+
});
|
|
117
126
|
};
|
|
@@ -32,6 +32,7 @@ __export(webpack_dev_babel_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(webpack_dev_babel_exports);
|
|
34
34
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
35
|
+
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
35
36
|
var import_node_url = require("node:url");
|
|
36
37
|
var import_webpack = __toESM(require("webpack"), 1);
|
|
37
38
|
var import_html_webpack_plugin = __toESM(require("html-webpack-plugin"), 1);
|
|
@@ -44,9 +45,11 @@ var import_middlewares = require("../server/middlewares.js");
|
|
|
44
45
|
var import_appRoutes = require("../server/appRoutes.js");
|
|
45
46
|
var import_helpers = require("./helpers.js");
|
|
46
47
|
var import_webpack_base_babel = require("./webpack.base.babel.js");
|
|
48
|
+
var import_utils = require("../server/utils.js");
|
|
47
49
|
var import_wsServer = require("../server/wsServer.js");
|
|
48
50
|
const import_meta = {};
|
|
49
51
|
const __filename = (0, import_node_url.fileURLToPath)(import_meta.url);
|
|
52
|
+
const __dirname = import_node_path.default.dirname(__filename);
|
|
50
53
|
const {
|
|
51
54
|
appVersion,
|
|
52
55
|
buildPath,
|
|
@@ -153,7 +156,9 @@ const devConfig = {
|
|
|
153
156
|
server: {
|
|
154
157
|
type: "https",
|
|
155
158
|
options: {
|
|
156
|
-
pfx:
|
|
159
|
+
pfx: import_node_fs.default.readFileSync(
|
|
160
|
+
import_node_path.default.join(__dirname, "../server/certs/uiplatform.pfx")
|
|
161
|
+
),
|
|
157
162
|
passphrase: "uiplatform"
|
|
158
163
|
}
|
|
159
164
|
},
|
|
@@ -175,8 +180,8 @@ const devConfig = {
|
|
|
175
180
|
next();
|
|
176
181
|
});
|
|
177
182
|
(0, import_wsServer.createWSServer)({
|
|
178
|
-
|
|
179
|
-
}).then((wsServer) => {
|
|
183
|
+
port: import_utils.wsPort
|
|
184
|
+
}).then(({ wsServer }) => {
|
|
180
185
|
if (devServer.app) devServer.app.locals.wsServer = wsServer;
|
|
181
186
|
}).catch((err) => {
|
|
182
187
|
console.error(err);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
const getCertOptions = () => {
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = path.dirname(__filename);
|
|
7
|
+
return {
|
|
8
|
+
pfx: fs.readFileSync(path.join(__dirname, "./certs/uiplatform.pfx")),
|
|
9
|
+
passPhrase: "uiplatform"
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
getCertOptions
|
|
14
|
+
};
|
|
Binary file
|
package/dist/esm/server/index.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import https from "node:https";
|
|
2
|
-
import fs from "node:fs";
|
|
3
|
-
import path from "node:path";
|
|
4
2
|
import express from "express";
|
|
3
|
+
import { getCertOptions } from "./cert.js";
|
|
5
4
|
import { logger } from "./logger.js";
|
|
6
5
|
import {
|
|
7
6
|
setupDefaultMiddlewares,
|
|
8
7
|
setupAdditionalMiddlewars
|
|
9
8
|
} from "./middlewares.js";
|
|
10
|
-
import { port, host } from "./utils.js";
|
|
9
|
+
import { port, wsPort, host } from "./utils.js";
|
|
11
10
|
import { loadRoutes } from "./appRoutes.js";
|
|
12
11
|
import { createWSServer } from "./wsServer.js";
|
|
13
12
|
(async function startServer() {
|
|
@@ -15,21 +14,15 @@ import { createWSServer } from "./wsServer.js";
|
|
|
15
14
|
setupDefaultMiddlewares(app);
|
|
16
15
|
await loadRoutes(app);
|
|
17
16
|
setupAdditionalMiddlewars(app);
|
|
18
|
-
const
|
|
19
|
-
pfx: fs.readFileSync(path.join(__dirname, "./certs/uiplatform.p12")),
|
|
20
|
-
passPhrase: "uiplatform"
|
|
21
|
-
};
|
|
22
|
-
const server = https.createServer(options, app);
|
|
17
|
+
const server = https.createServer(getCertOptions(), app);
|
|
23
18
|
server.listen(port, host, () => {
|
|
24
|
-
createWSServer({ server }).then((wsServer) => {
|
|
25
|
-
app.locals.wsServer = wsServer;
|
|
26
|
-
}).catch((err) => {
|
|
27
|
-
logger.error(err);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
});
|
|
30
19
|
logger.appStarted(port.toString(), host || "localhost");
|
|
31
20
|
}).on("error", (err) => {
|
|
32
21
|
logger.error(err);
|
|
33
22
|
process.exit(1);
|
|
34
23
|
});
|
|
24
|
+
const { wsServer } = await createWSServer({
|
|
25
|
+
port: wsPort
|
|
26
|
+
});
|
|
27
|
+
app.locals.wsServer = wsServer;
|
|
35
28
|
})();
|
|
@@ -15,7 +15,7 @@ const logger = {
|
|
|
15
15
|
const accessUrls = `${chalk.bold("Access URLs:")}${divider}
|
|
16
16
|
`;
|
|
17
17
|
const localHostUrl = `Localhost: ${chalk.magenta(
|
|
18
|
-
`
|
|
18
|
+
`https://${host}:${port}`
|
|
19
19
|
)}
|
|
20
20
|
`;
|
|
21
21
|
const lanUrl = `LAN: ${chalk.magenta(`http://${ip.address()}:${port}`)}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import https from "node:https";
|
|
1
2
|
import * as wsLib from "ws";
|
|
3
|
+
import { getCertOptions } from "./cert.js";
|
|
2
4
|
const PING_INTERVAL = 3e4;
|
|
5
|
+
const DEFAULT_PORT = 5001;
|
|
3
6
|
const onSocketError = (err) => {
|
|
4
7
|
console.error(err);
|
|
5
8
|
};
|
|
@@ -15,7 +18,7 @@ const getAuthToken = (protocols) => {
|
|
|
15
18
|
return authProtocol.split("--")[1]?.trim?.();
|
|
16
19
|
};
|
|
17
20
|
const createWSServer = ({
|
|
18
|
-
|
|
21
|
+
port = DEFAULT_PORT,
|
|
19
22
|
pingInterval = PING_INTERVAL,
|
|
20
23
|
onOpen
|
|
21
24
|
}) => {
|
|
@@ -23,8 +26,9 @@ const createWSServer = ({
|
|
|
23
26
|
const heartbeat = () => {
|
|
24
27
|
isAlive = true;
|
|
25
28
|
};
|
|
26
|
-
const
|
|
27
|
-
|
|
29
|
+
const httpServer = https.createServer(getCertOptions());
|
|
30
|
+
const wsServer = new wsLib.WebSocketServer({ noServer: true });
|
|
31
|
+
httpServer.on("upgrade", (req, socket, head) => {
|
|
28
32
|
socket.on("error", onSocketError);
|
|
29
33
|
wsServer.handleUpgrade(req, socket, head, (ws) => {
|
|
30
34
|
const protocols = req.headers["sec-websocket-protocol"]?.split(",");
|
|
@@ -80,7 +84,12 @@ const createWSServer = ({
|
|
|
80
84
|
wsServer.on("close", function close() {
|
|
81
85
|
clearInterval(interval);
|
|
82
86
|
});
|
|
83
|
-
return Promise
|
|
87
|
+
return new Promise((resolve) => {
|
|
88
|
+
httpServer.listen(port, () => {
|
|
89
|
+
console.log(`Websocket server listening on port ${port}`);
|
|
90
|
+
return resolve({ httpServer, wsServer });
|
|
91
|
+
});
|
|
92
|
+
});
|
|
84
93
|
};
|
|
85
94
|
export {
|
|
86
95
|
createWSServer
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import fs from "node:fs";
|
|
2
3
|
import { fileURLToPath } from "node:url";
|
|
3
4
|
import webpack from "webpack";
|
|
4
5
|
import HtmlWebpackPlugin from "html-webpack-plugin";
|
|
@@ -15,8 +16,10 @@ import {
|
|
|
15
16
|
isGoogleTagManagerEnabled
|
|
16
17
|
} from "./helpers.js";
|
|
17
18
|
import { baseConfig } from "./webpack.base.babel.js";
|
|
19
|
+
import { wsPort } from "../server/utils.js";
|
|
18
20
|
import { createWSServer } from "../server/wsServer.js";
|
|
19
21
|
const __filename = fileURLToPath(import.meta.url);
|
|
22
|
+
const __dirname = path.dirname(__filename);
|
|
20
23
|
const {
|
|
21
24
|
appVersion,
|
|
22
25
|
buildPath,
|
|
@@ -123,7 +126,9 @@ const devConfig = {
|
|
|
123
126
|
server: {
|
|
124
127
|
type: "https",
|
|
125
128
|
options: {
|
|
126
|
-
pfx:
|
|
129
|
+
pfx: fs.readFileSync(
|
|
130
|
+
path.join(__dirname, "../server/certs/uiplatform.pfx")
|
|
131
|
+
),
|
|
127
132
|
passphrase: "uiplatform"
|
|
128
133
|
}
|
|
129
134
|
},
|
|
@@ -145,8 +150,8 @@ const devConfig = {
|
|
|
145
150
|
next();
|
|
146
151
|
});
|
|
147
152
|
createWSServer({
|
|
148
|
-
|
|
149
|
-
}).then((wsServer) => {
|
|
153
|
+
port: wsPort
|
|
154
|
+
}).then(({ wsServer }) => {
|
|
150
155
|
if (devServer.app) devServer.app.locals.wsServer = wsServer;
|
|
151
156
|
}).catch((err) => {
|
|
152
157
|
console.error(err);
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import https from 'node:https';
|
|
2
2
|
import * as wsLib from 'ws';
|
|
3
|
+
export interface Servers {
|
|
4
|
+
httpServer: https.Server;
|
|
5
|
+
wsServer: wsLib.WebSocketServer;
|
|
6
|
+
}
|
|
3
7
|
export interface WSServerOptions {
|
|
4
|
-
|
|
8
|
+
port?: number;
|
|
5
9
|
pingInterval?: number;
|
|
6
10
|
onOpen?: (webSocket: wsLib.WebSocket) => void;
|
|
7
11
|
}
|
|
8
|
-
export declare const createWSServer: ({
|
|
12
|
+
export declare const createWSServer: ({ port, pingInterval, onOpen, }: WSServerOptions) => Promise<Servers>;
|