@elliemae/pui-cli 8.42.0-alpha.6 → 8.42.0
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/index.js +3 -1
- package/dist/cjs/server/logger.js +5 -2
- package/dist/cjs/server/wsServer.js +6 -4
- package/dist/cjs/testing/jest.config.cjs +1 -1
- package/dist/cjs/testing/setup-tests.js +2 -2
- package/dist/cjs/utils.js +3 -1
- package/dist/cjs/webpack/webpack.dev.babel.js +6 -4
- package/dist/esm/server/index.js +3 -1
- package/dist/esm/server/logger.js +5 -2
- package/dist/esm/server/wsServer.js +6 -4
- package/dist/esm/testing/jest.config.cjs +1 -1
- package/dist/esm/testing/setup-tests.js +2 -2
- package/dist/esm/utils.js +3 -1
- package/dist/esm/webpack/webpack.dev.babel.js +6 -4
- package/dist/types/lib/server/wsServer.d.ts +2 -1
- package/dist/types/lib/utils.d.ts +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/dist/cjs/testing/ExtendedJSDomEnv.cjs +0 -37
- package/dist/cjs/testing/extended/axe-core/getMessageAndPass.js +0 -36
- package/dist/cjs/testing/extended/axe-core/index.js +0 -24
- package/dist/cjs/testing/extended/axe-core/reporter.js +0 -50
- package/dist/cjs/testing/extended/axe-core/shouldIgnoreNodeViolation.js +0 -31
- package/dist/cjs/testing/extended/axe-core/toHaveNoViolations.js +0 -42
- package/dist/esm/testing/ExtendedJSDomEnv.cjs +0 -37
- package/dist/esm/testing/extended/axe-core/getMessageAndPass.js +0 -16
- package/dist/esm/testing/extended/axe-core/index.js +0 -4
- package/dist/esm/testing/extended/axe-core/reporter.js +0 -30
- package/dist/esm/testing/extended/axe-core/shouldIgnoreNodeViolation.js +0 -11
- package/dist/esm/testing/extended/axe-core/toHaveNoViolations.js +0 -22
- package/dist/types/lib/testing/ExtendedJSDomEnv.d.cts +0 -5
- package/dist/types/lib/testing/extended/axe-core/getMessageAndPass.d.ts +0 -8
- package/dist/types/lib/testing/extended/axe-core/index.d.ts +0 -1
- package/dist/types/lib/testing/extended/axe-core/reporter.d.ts +0 -2
- package/dist/types/lib/testing/extended/axe-core/shouldIgnoreNodeViolation.d.ts +0 -2
- package/dist/types/lib/testing/extended/axe-core/toHaveNoViolations.d.ts +0 -12
- package/dist/types/lib/tests/basic.test.d.ts +0 -0
package/dist/cjs/server/index.js
CHANGED
|
@@ -22,11 +22,13 @@ 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_http = __toESM(require("node:http"), 1);
|
|
25
26
|
var import_express = __toESM(require("express"), 1);
|
|
26
27
|
var import_cert = require("./cert.js");
|
|
27
28
|
var import_logger = require("./logger.js");
|
|
28
29
|
var import_middlewares = require("./middlewares.js");
|
|
29
30
|
var import_utils = require("./utils.js");
|
|
31
|
+
var import_utils2 = require("../utils.js");
|
|
30
32
|
var import_appRoutes = require("./appRoutes.js");
|
|
31
33
|
var import_wsServer = require("./wsServer.js");
|
|
32
34
|
(async function startServer() {
|
|
@@ -34,7 +36,7 @@ var import_wsServer = require("./wsServer.js");
|
|
|
34
36
|
(0, import_middlewares.setupDefaultMiddlewares)(app);
|
|
35
37
|
await (0, import_appRoutes.loadRoutes)(app);
|
|
36
38
|
(0, import_middlewares.setupAdditionalMiddlewars)(app);
|
|
37
|
-
const server = import_node_https.default.createServer((0, import_cert.getCertOptions)(), app);
|
|
39
|
+
const server = (0, import_utils2.isHttps)() ? import_node_https.default.createServer((0, import_cert.getCertOptions)(), app) : import_node_http.default.createServer(app);
|
|
38
40
|
server.listen(import_utils.port, import_utils.host, () => {
|
|
39
41
|
import_logger.logger.appStarted(import_utils.port.toString(), import_utils.host || "localhost");
|
|
40
42
|
}).on("error", (err) => {
|
|
@@ -33,6 +33,7 @@ __export(logger_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(logger_exports);
|
|
34
34
|
var import_chalk = __toESM(require("chalk"), 1);
|
|
35
35
|
var import_ip = __toESM(require("ip"), 1);
|
|
36
|
+
var import_utils = require("../utils.js");
|
|
36
37
|
const divider = import_chalk.default.gray("\n-----------------------------------");
|
|
37
38
|
const logger = {
|
|
38
39
|
// Called whenever there's an error on the server we want to print
|
|
@@ -48,10 +49,12 @@ const logger = {
|
|
|
48
49
|
const accessUrls = `${import_chalk.default.bold("Access URLs:")}${divider}
|
|
49
50
|
`;
|
|
50
51
|
const localHostUrl = `Localhost: ${import_chalk.default.magenta(
|
|
51
|
-
|
|
52
|
+
`${(0, import_utils.isHttps)() ? "https" : "http"}://${host}:${port}`
|
|
52
53
|
)}
|
|
53
54
|
`;
|
|
54
|
-
const lanUrl = `LAN: ${import_chalk.default.magenta(
|
|
55
|
+
const lanUrl = `LAN: ${import_chalk.default.magenta(
|
|
56
|
+
`${(0, import_utils.isHttps)() ? "https" : "http"}://${import_ip.default.address()}:${port}`
|
|
57
|
+
)}
|
|
55
58
|
`;
|
|
56
59
|
const proxy = tunnelStarted ? `
|
|
57
60
|
Proxy: ${import_chalk.default.magenta(tunnelStarted)}` : "";
|
|
@@ -32,8 +32,10 @@ __export(wsServer_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(wsServer_exports);
|
|
34
34
|
var import_node_https = __toESM(require("node:https"), 1);
|
|
35
|
+
var import_node_http = __toESM(require("node:http"), 1);
|
|
35
36
|
var wsLib = __toESM(require("ws"), 1);
|
|
36
37
|
var import_cert = require("./cert.js");
|
|
38
|
+
var import_utils = require("../utils.js");
|
|
37
39
|
const PING_INTERVAL = 3e4;
|
|
38
40
|
const DEFAULT_PORT = 5001;
|
|
39
41
|
const onSocketError = (err) => {
|
|
@@ -59,9 +61,9 @@ const createWSServer = ({
|
|
|
59
61
|
const heartbeat = () => {
|
|
60
62
|
isAlive = true;
|
|
61
63
|
};
|
|
62
|
-
const
|
|
64
|
+
const server = (0, import_utils.isHttps)() ? import_node_https.default.createServer((0, import_cert.getCertOptions)()) : import_node_http.default.createServer();
|
|
63
65
|
const wsServer = new wsLib.WebSocketServer({ noServer: true });
|
|
64
|
-
|
|
66
|
+
server.on("upgrade", (req, socket, head) => {
|
|
65
67
|
socket.on("error", onSocketError);
|
|
66
68
|
wsServer.handleUpgrade(req, socket, head, (ws) => {
|
|
67
69
|
const protocols = req.headers["sec-websocket-protocol"]?.split(",");
|
|
@@ -118,9 +120,9 @@ const createWSServer = ({
|
|
|
118
120
|
clearInterval(interval);
|
|
119
121
|
});
|
|
120
122
|
return new Promise((resolve) => {
|
|
121
|
-
|
|
123
|
+
server.listen(port, () => {
|
|
122
124
|
console.log(`Websocket server listening on port ${port}`);
|
|
123
|
-
return resolve({
|
|
125
|
+
return resolve({ server, wsServer });
|
|
124
126
|
});
|
|
125
127
|
});
|
|
126
128
|
};
|
|
@@ -95,7 +95,7 @@ const jestConfig = {
|
|
|
95
95
|
url: `http://localhost:3111${basePath}`,
|
|
96
96
|
resources: 'usable',
|
|
97
97
|
},
|
|
98
|
-
testEnvironment:
|
|
98
|
+
testEnvironment: 'jsdom',
|
|
99
99
|
watchPlugins: [
|
|
100
100
|
'jest-watch-typeahead/filename',
|
|
101
101
|
'jest-watch-typeahead/testname',
|
|
@@ -23,8 +23,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
));
|
|
24
24
|
var import_runtime = require("regenerator-runtime/runtime");
|
|
25
25
|
var import_extend_expect = require("@testing-library/jest-dom/extend-expect");
|
|
26
|
+
var import_jest_axe = __toESM(require("jest-axe"), 1);
|
|
26
27
|
var import_resize_observer_polyfill = __toESM(require("resize-observer-polyfill"), 1);
|
|
27
|
-
var import_axe_core = require("./extended/axe-core");
|
|
28
28
|
var import_matchMedia = require("./mocks/matchMedia.js");
|
|
29
29
|
var import_pui_diagnostics = require("./mocks/pui-diagnostics.js");
|
|
30
30
|
const originalError = console.error;
|
|
@@ -46,7 +46,7 @@ console.error = (...args) => {
|
|
|
46
46
|
return false;
|
|
47
47
|
return originalError(...args);
|
|
48
48
|
};
|
|
49
|
-
if (expect) expect.extend(
|
|
49
|
+
if (expect) expect.extend(import_jest_axe.default.toHaveNoViolations);
|
|
50
50
|
const addElementToBody = (element) => {
|
|
51
51
|
const documentEle = (window || {}).document;
|
|
52
52
|
if (!documentEle) return null;
|
package/dist/cjs/utils.js
CHANGED
|
@@ -30,13 +30,15 @@ var utils_exports = {};
|
|
|
30
30
|
__export(utils_exports, {
|
|
31
31
|
basePath: () => basePath,
|
|
32
32
|
getAppConfig: () => getAppConfig,
|
|
33
|
-
isApp: () => isApp
|
|
33
|
+
isApp: () => isApp,
|
|
34
|
+
isHttps: () => isHttps
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(utils_exports);
|
|
36
37
|
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
37
38
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
38
39
|
const basePath = (process.env.BASE_PATH || "/").replace(/\/?$/, "/");
|
|
39
40
|
const isApp = () => import_node_fs.default.existsSync(import_node_path.default.join(process.cwd(), "app"));
|
|
41
|
+
const isHttps = () => process.env.HTTPS === "true";
|
|
40
42
|
const getAppConfig = () => {
|
|
41
43
|
const appConfigPath = import_node_path.default.join(
|
|
42
44
|
process.cwd(),
|
|
@@ -47,6 +47,7 @@ var import_webpack_base_babel = require("./webpack.base.babel.js");
|
|
|
47
47
|
var import_utils = require("../server/utils.js");
|
|
48
48
|
var import_wsServer = require("../server/wsServer.js");
|
|
49
49
|
var import_cert = require("../server/cert.js");
|
|
50
|
+
var import_utils2 = require("../utils.js");
|
|
50
51
|
const import_meta = {};
|
|
51
52
|
const __filename = (0, import_node_url.fileURLToPath)(import_meta.url);
|
|
52
53
|
const {
|
|
@@ -59,6 +60,10 @@ const {
|
|
|
59
60
|
diagnosticsScriptPath,
|
|
60
61
|
encwLoaderScriptPath
|
|
61
62
|
} = (0, import_helpers.getPaths)();
|
|
63
|
+
const serverOptions = {
|
|
64
|
+
type: "https",
|
|
65
|
+
options: (0, import_cert.getCertOptions)()
|
|
66
|
+
};
|
|
62
67
|
const devConfig = {
|
|
63
68
|
mode: "development",
|
|
64
69
|
cache: {
|
|
@@ -152,10 +157,7 @@ const devConfig = {
|
|
|
152
157
|
hot: true,
|
|
153
158
|
open: [basePath],
|
|
154
159
|
port: process.env.PORT || "auto",
|
|
155
|
-
server: {
|
|
156
|
-
type: "https",
|
|
157
|
-
options: (0, import_cert.getCertOptions)()
|
|
158
|
-
},
|
|
160
|
+
server: (0, import_utils2.isHttps)() ? serverOptions : {},
|
|
159
161
|
setupMiddlewares: (middlewares, devServer) => {
|
|
160
162
|
(0, import_interceptor_middleware.addCSPNonceMiddleware)(middlewares);
|
|
161
163
|
if (devServer.app) {
|
package/dist/esm/server/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import https from "node:https";
|
|
2
|
+
import http from "node:http";
|
|
2
3
|
import express from "express";
|
|
3
4
|
import { getCertOptions } from "./cert.js";
|
|
4
5
|
import { logger } from "./logger.js";
|
|
@@ -7,6 +8,7 @@ import {
|
|
|
7
8
|
setupAdditionalMiddlewars
|
|
8
9
|
} from "./middlewares.js";
|
|
9
10
|
import { port, wsPort, host } from "./utils.js";
|
|
11
|
+
import { isHttps } from "../utils.js";
|
|
10
12
|
import { loadRoutes } from "./appRoutes.js";
|
|
11
13
|
import { createWSServer } from "./wsServer.js";
|
|
12
14
|
(async function startServer() {
|
|
@@ -14,7 +16,7 @@ import { createWSServer } from "./wsServer.js";
|
|
|
14
16
|
setupDefaultMiddlewares(app);
|
|
15
17
|
await loadRoutes(app);
|
|
16
18
|
setupAdditionalMiddlewars(app);
|
|
17
|
-
const server = https.createServer(getCertOptions(), app);
|
|
19
|
+
const server = isHttps() ? https.createServer(getCertOptions(), app) : http.createServer(app);
|
|
18
20
|
server.listen(port, host, () => {
|
|
19
21
|
logger.appStarted(port.toString(), host || "localhost");
|
|
20
22
|
}).on("error", (err) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import ip from "ip";
|
|
3
|
+
import { isHttps } from "../utils.js";
|
|
3
4
|
const divider = chalk.gray("\n-----------------------------------");
|
|
4
5
|
const logger = {
|
|
5
6
|
// Called whenever there's an error on the server we want to print
|
|
@@ -15,10 +16,12 @@ const logger = {
|
|
|
15
16
|
const accessUrls = `${chalk.bold("Access URLs:")}${divider}
|
|
16
17
|
`;
|
|
17
18
|
const localHostUrl = `Localhost: ${chalk.magenta(
|
|
18
|
-
|
|
19
|
+
`${isHttps() ? "https" : "http"}://${host}:${port}`
|
|
19
20
|
)}
|
|
20
21
|
`;
|
|
21
|
-
const lanUrl = `LAN: ${chalk.magenta(
|
|
22
|
+
const lanUrl = `LAN: ${chalk.magenta(
|
|
23
|
+
`${isHttps() ? "https" : "http"}://${ip.address()}:${port}`
|
|
24
|
+
)}
|
|
22
25
|
`;
|
|
23
26
|
const proxy = tunnelStarted ? `
|
|
24
27
|
Proxy: ${chalk.magenta(tunnelStarted)}` : "";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import https from "node:https";
|
|
2
|
+
import http from "node:http";
|
|
2
3
|
import * as wsLib from "ws";
|
|
3
4
|
import { getCertOptions } from "./cert.js";
|
|
5
|
+
import { isHttps } from "../utils.js";
|
|
4
6
|
const PING_INTERVAL = 3e4;
|
|
5
7
|
const DEFAULT_PORT = 5001;
|
|
6
8
|
const onSocketError = (err) => {
|
|
@@ -26,9 +28,9 @@ const createWSServer = ({
|
|
|
26
28
|
const heartbeat = () => {
|
|
27
29
|
isAlive = true;
|
|
28
30
|
};
|
|
29
|
-
const
|
|
31
|
+
const server = isHttps() ? https.createServer(getCertOptions()) : http.createServer();
|
|
30
32
|
const wsServer = new wsLib.WebSocketServer({ noServer: true });
|
|
31
|
-
|
|
33
|
+
server.on("upgrade", (req, socket, head) => {
|
|
32
34
|
socket.on("error", onSocketError);
|
|
33
35
|
wsServer.handleUpgrade(req, socket, head, (ws) => {
|
|
34
36
|
const protocols = req.headers["sec-websocket-protocol"]?.split(",");
|
|
@@ -85,9 +87,9 @@ const createWSServer = ({
|
|
|
85
87
|
clearInterval(interval);
|
|
86
88
|
});
|
|
87
89
|
return new Promise((resolve) => {
|
|
88
|
-
|
|
90
|
+
server.listen(port, () => {
|
|
89
91
|
console.log(`Websocket server listening on port ${port}`);
|
|
90
|
-
return resolve({
|
|
92
|
+
return resolve({ server, wsServer });
|
|
91
93
|
});
|
|
92
94
|
});
|
|
93
95
|
};
|
|
@@ -95,7 +95,7 @@ const jestConfig = {
|
|
|
95
95
|
url: `http://localhost:3111${basePath}`,
|
|
96
96
|
resources: 'usable',
|
|
97
97
|
},
|
|
98
|
-
testEnvironment:
|
|
98
|
+
testEnvironment: 'jsdom',
|
|
99
99
|
watchPlugins: [
|
|
100
100
|
'jest-watch-typeahead/filename',
|
|
101
101
|
'jest-watch-typeahead/testname',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "regenerator-runtime/runtime";
|
|
2
2
|
import "@testing-library/jest-dom/extend-expect";
|
|
3
|
+
import jestAxe from "jest-axe";
|
|
3
4
|
import ResizeObserver from "resize-observer-polyfill";
|
|
4
|
-
import { toHaveNoViolations } from "./extended/axe-core";
|
|
5
5
|
import { addMatchMedia } from "./mocks/matchMedia.js";
|
|
6
6
|
import { logger } from "./mocks/pui-diagnostics.js";
|
|
7
7
|
const originalError = console.error;
|
|
@@ -23,7 +23,7 @@ console.error = (...args) => {
|
|
|
23
23
|
return false;
|
|
24
24
|
return originalError(...args);
|
|
25
25
|
};
|
|
26
|
-
if (expect) expect.extend(toHaveNoViolations);
|
|
26
|
+
if (expect) expect.extend(jestAxe.toHaveNoViolations);
|
|
27
27
|
const addElementToBody = (element) => {
|
|
28
28
|
const documentEle = (window || {}).document;
|
|
29
29
|
if (!documentEle) return null;
|
package/dist/esm/utils.js
CHANGED
|
@@ -2,6 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
const basePath = (process.env.BASE_PATH || "/").replace(/\/?$/, "/");
|
|
4
4
|
const isApp = () => fs.existsSync(path.join(process.cwd(), "app"));
|
|
5
|
+
const isHttps = () => process.env.HTTPS === "true";
|
|
5
6
|
const getAppConfig = () => {
|
|
6
7
|
const appConfigPath = path.join(
|
|
7
8
|
process.cwd(),
|
|
@@ -15,5 +16,6 @@ const getAppConfig = () => {
|
|
|
15
16
|
export {
|
|
16
17
|
basePath,
|
|
17
18
|
getAppConfig,
|
|
18
|
-
isApp
|
|
19
|
+
isApp,
|
|
20
|
+
isHttps
|
|
19
21
|
};
|
|
@@ -18,6 +18,7 @@ import { baseConfig } from "./webpack.base.babel.js";
|
|
|
18
18
|
import { wsPort } from "../server/utils.js";
|
|
19
19
|
import { createWSServer } from "../server/wsServer.js";
|
|
20
20
|
import { getCertOptions } from "../server/cert.js";
|
|
21
|
+
import { isHttps } from "../utils.js";
|
|
21
22
|
const __filename = fileURLToPath(import.meta.url);
|
|
22
23
|
const {
|
|
23
24
|
appVersion,
|
|
@@ -29,6 +30,10 @@ const {
|
|
|
29
30
|
diagnosticsScriptPath,
|
|
30
31
|
encwLoaderScriptPath
|
|
31
32
|
} = getPaths();
|
|
33
|
+
const serverOptions = {
|
|
34
|
+
type: "https",
|
|
35
|
+
options: getCertOptions()
|
|
36
|
+
};
|
|
32
37
|
const devConfig = {
|
|
33
38
|
mode: "development",
|
|
34
39
|
cache: {
|
|
@@ -122,10 +127,7 @@ const devConfig = {
|
|
|
122
127
|
hot: true,
|
|
123
128
|
open: [basePath],
|
|
124
129
|
port: process.env.PORT || "auto",
|
|
125
|
-
server: {
|
|
126
|
-
type: "https",
|
|
127
|
-
options: getCertOptions()
|
|
128
|
-
},
|
|
130
|
+
server: isHttps() ? serverOptions : {},
|
|
129
131
|
setupMiddlewares: (middlewares, devServer) => {
|
|
130
132
|
addCSPNonceMiddleware(middlewares);
|
|
131
133
|
if (devServer.app) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import https from 'node:https';
|
|
2
|
+
import http from 'node:http';
|
|
2
3
|
import * as wsLib from 'ws';
|
|
3
4
|
export interface Servers {
|
|
4
|
-
|
|
5
|
+
server: https.Server | http.Server;
|
|
5
6
|
wsServer: wsLib.WebSocketServer;
|
|
6
7
|
}
|
|
7
8
|
export interface WSServerOptions {
|