@elliemae/pui-cli 9.0.0-next.4 → 9.0.0-next.40
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/app.tsconfig.json +1 -1
- package/dist/cjs/commands/lint.js +27 -8
- package/dist/cjs/commands/start.js +1 -1
- package/dist/cjs/commands/storybook.js +2 -2
- package/dist/cjs/commands/test.js +51 -22
- package/dist/cjs/commands/utils.js +33 -2
- package/dist/cjs/index.cjs +0 -2
- package/dist/cjs/index.js +4 -2
- package/dist/cjs/lint-config/eslint/common.cjs +3 -2
- package/dist/cjs/lint-config/eslint/typescript/common.cjs +3 -3
- package/dist/cjs/lint-config/stylelint.config.js +45 -0
- package/dist/cjs/monorepo/delete-merged-tags.js +1 -1
- package/dist/cjs/monorepo/set-registry-version.js +1 -1
- package/dist/cjs/monorepo/set-workspace-version.js +1 -1
- package/dist/cjs/pui-config.js +1 -1
- package/dist/cjs/release.config.js +46 -0
- package/dist/cjs/server/csp.js +2 -1
- package/dist/cjs/server/index.js +5 -0
- package/dist/cjs/server/utils.js +11 -4
- package/dist/cjs/server/wsServer.js +129 -0
- package/dist/cjs/testing/ExtendedJSDomEnv.cjs +27 -0
- package/dist/cjs/testing/extended/axe-core/getMessageAndPass.js +37 -0
- package/dist/cjs/testing/extended/axe-core/index.js +24 -0
- package/dist/cjs/testing/extended/axe-core/reporter.js +51 -0
- package/dist/cjs/testing/extended/axe-core/shouldIgnoreNodeViolation.js +31 -0
- package/dist/cjs/testing/extended/axe-core/toHaveNoViolations.js +43 -0
- package/dist/cjs/testing/jest.config.cjs +5 -2
- package/dist/cjs/testing/jest.polyfills.cjs +30 -0
- package/dist/cjs/testing/setup-test-env.js +0 -2
- package/dist/cjs/testing/setup-tests.js +26 -4
- package/dist/cjs/testing/vitest.config.js +8 -8
- package/dist/cjs/transpile/.swcrc +1 -1
- package/dist/cjs/transpile/esbuild.js +4 -4
- package/dist/cjs/update-notifier.js +1 -1
- package/dist/cjs/utils.js +1 -1
- package/dist/cjs/webpack/helpers.js +20 -8
- package/dist/cjs/webpack/webpack.base.babel.js +13 -27
- package/dist/cjs/webpack/webpack.dev.babel.js +14 -3
- package/dist/cjs/webpack/webpack.lib.base.babel.js +13 -5
- package/dist/cjs/webpack/webpack.lib.dev.babel.js +8 -12
- package/dist/cjs/webpack/webpack.lib.prod.babel.js +7 -6
- package/dist/cjs/webpack/webpack.prod.babel.js +3 -2
- package/dist/cjs/webpack/webpack.storybook.js +10 -11
- package/dist/esm/commands/lint.js +28 -8
- package/dist/esm/commands/start.js +1 -1
- package/dist/esm/commands/storybook.js +2 -2
- package/dist/esm/commands/test.js +51 -22
- package/dist/esm/commands/utils.js +33 -2
- package/dist/esm/index.cjs +0 -2
- package/dist/esm/index.js +4 -2
- package/dist/esm/lint-config/eslint/common.cjs +3 -2
- package/dist/esm/lint-config/eslint/typescript/common.cjs +3 -3
- package/dist/esm/lint-config/stylelint.config.js +25 -0
- package/dist/esm/monorepo/delete-merged-tags.js +1 -1
- package/dist/esm/monorepo/set-registry-version.js +1 -1
- package/dist/esm/monorepo/set-workspace-version.js +1 -1
- package/dist/esm/pui-config.js +1 -1
- package/dist/esm/release.config.js +26 -0
- package/dist/esm/server/csp.js +2 -1
- package/dist/esm/server/index.js +6 -1
- package/dist/esm/server/utils.js +11 -4
- package/dist/esm/server/wsServer.js +99 -0
- package/dist/esm/testing/ExtendedJSDomEnv.cjs +27 -0
- package/dist/esm/testing/extended/axe-core/getMessageAndPass.js +17 -0
- package/dist/esm/testing/extended/axe-core/index.js +4 -0
- package/dist/esm/testing/extended/axe-core/reporter.js +31 -0
- package/dist/esm/testing/extended/axe-core/shouldIgnoreNodeViolation.js +11 -0
- package/dist/esm/testing/extended/axe-core/toHaveNoViolations.js +23 -0
- package/dist/esm/testing/jest.config.cjs +5 -2
- package/dist/esm/testing/jest.polyfills.cjs +30 -0
- package/dist/esm/testing/setup-test-env.js +0 -2
- package/dist/esm/testing/setup-tests.js +26 -4
- package/dist/esm/testing/vitest.config.js +8 -8
- package/dist/esm/transpile/.swcrc +1 -1
- package/dist/esm/transpile/esbuild.js +4 -4
- package/dist/esm/update-notifier.js +1 -1
- package/dist/esm/utils.js +1 -1
- package/dist/esm/webpack/helpers.js +20 -8
- package/dist/esm/webpack/webpack.base.babel.js +13 -27
- package/dist/esm/webpack/webpack.dev.babel.js +14 -3
- package/dist/esm/webpack/webpack.lib.base.babel.js +13 -5
- package/dist/esm/webpack/webpack.lib.dev.babel.js +9 -13
- package/dist/esm/webpack/webpack.lib.prod.babel.js +12 -7
- package/dist/esm/webpack/webpack.prod.babel.js +3 -2
- package/dist/esm/webpack/webpack.storybook.js +11 -12
- package/dist/types/docusaurus.config.d.ts +2 -0
- package/dist/types/{babel.config.d.cts → lib/babel.config.d.cts} +7 -7
- package/dist/types/{commands → lib/commands}/build.d.ts +2 -2
- package/dist/types/{commands → lib/commands}/codemod.d.ts +2 -2
- package/dist/types/{commands → lib/commands}/lint.d.ts +3 -2
- package/dist/types/{commands → lib/commands}/pack.d.ts +2 -2
- package/dist/types/{commands → lib/commands}/start.d.ts +2 -2
- package/dist/types/{commands → lib/commands}/storybook.d.ts +2 -2
- package/dist/types/{commands → lib/commands}/test.d.ts +4 -2
- package/dist/types/{commands → lib/commands}/tscheck.d.ts +2 -2
- package/dist/types/lib/commands/utils.d.ts +39 -0
- package/dist/types/{commands → lib/commands}/version.d.ts +2 -2
- package/dist/types/{commands → lib/commands}/vitest.d.ts +2 -2
- package/dist/types/{index.d.cts → lib/index.d.cts} +1 -2
- package/dist/types/{index.d.ts → lib/index.d.ts} +3 -1
- package/dist/types/{lint-config → lib/lint-config}/commitlint.config.d.cts +1 -1
- package/dist/types/{lint-config → lib/lint-config}/eslint/common.d.cts +18 -12
- package/dist/types/{lint-config → lib/lint-config}/eslint/non-react.d.cts +8 -1
- package/dist/types/{lint-config → lib/lint-config}/eslint/react.d.cts +8 -1
- package/dist/types/{lint-config → lib/lint-config}/eslint/typescript/common.d.cts +6 -6
- package/dist/types/{lint-config → lib/lint-config}/eslint/typescript/non-react.d.cts +9 -2
- package/dist/types/{lint-config → lib/lint-config}/eslint/typescript/react.d.cts +9 -2
- package/dist/types/lib/lint-config/lint-staged.config.d.ts +5 -0
- package/dist/types/lib/lint-config/prettier.config.d.cts +8 -0
- package/dist/types/lib/lint-config/stylelint.config.d.ts +13 -0
- package/dist/types/lib/release.config.d.ts +10 -0
- package/dist/types/{server → lib/server}/csp.d.ts +2 -2
- package/dist/types/{server → lib/server}/utils.d.ts +1 -0
- package/dist/types/lib/server/wsServer.d.ts +13 -0
- package/dist/types/lib/testing/ExtendedJSDomEnv.d.cts +5 -0
- package/dist/types/lib/testing/extended/axe-core/getMessageAndPass.d.ts +8 -0
- package/dist/types/lib/testing/extended/axe-core/index.d.ts +1 -0
- package/dist/types/lib/testing/extended/axe-core/reporter.d.ts +2 -0
- package/dist/types/lib/testing/extended/axe-core/shouldIgnoreNodeViolation.d.ts +2 -0
- package/dist/types/lib/testing/extended/axe-core/toHaveNoViolations.d.ts +12 -0
- package/dist/types/lib/testing/jest.config.d.cts +44 -0
- package/dist/types/{testing → lib/testing}/jest.node.config.d.cts +3 -0
- package/dist/types/lib/testing/mocks/axios.d.ts +17 -0
- package/dist/types/{testing → lib/testing}/mocks/pui-diagnostics.d.ts +13 -13
- package/dist/types/lib/testing/setup-tests.d.ts +1 -0
- package/dist/types/lib/testing/vitest.config.d.ts +1 -0
- package/dist/types/lib/tests/basic.test.d.ts +0 -0
- package/dist/types/{transpile → lib/transpile}/esbuild.d.ts +3 -3
- package/dist/types/lib/typedoc.d.cts +3 -0
- package/dist/types/{webpack → lib/webpack}/helpers.d.ts +4 -1
- package/dist/types/{webpack → lib/webpack}/webpack.storybook.d.ts +0 -1
- package/nx.json +97 -0
- package/package.json +188 -177
- package/dist/cjs/lint-config/stylelint.config.cjs +0 -19
- package/dist/cjs/release.config.cjs +0 -24
- package/dist/esm/lint-config/stylelint.config.cjs +0 -19
- package/dist/esm/release.config.cjs +0 -24
- package/dist/types/commands/utils.d.ts +0 -17
- package/dist/types/lint-config/lint-staged.config.d.ts +0 -5
- package/dist/types/lint-config/prettier.config.d.cts +0 -8
- package/dist/types/lint-config/stylelint.config.d.cts +0 -10
- package/dist/types/release.config.d.cts +0 -7
- package/dist/types/testing/jest.config.d.cts +0 -41
- package/dist/types/testing/mocks/axios.d.ts +0 -17
- package/dist/types/testing/vitest.config.d.ts +0 -1
- package/dist/types/typedoc.d.cts +0 -3
- /package/dist/types/{cli.d.ts → lib/cli.d.ts} +0 -0
- /package/dist/types/{commands → lib/commands}/gendoc.d.ts +0 -0
- /package/dist/types/{dummy.d.ts → lib/dummy.d.ts} +0 -0
- /package/dist/types/{monorepo → lib/monorepo}/delete-merged-tags.d.ts +0 -0
- /package/dist/types/{monorepo → lib/monorepo}/set-registry-version.d.ts +0 -0
- /package/dist/types/{monorepo → lib/monorepo}/set-workspace-version.d.ts +0 -0
- /package/dist/types/{monorepo → lib/monorepo}/utils.d.cts +0 -0
- /package/dist/types/{monorepo → lib/monorepo}/utils.d.ts +0 -0
- /package/dist/types/{pui-config.d.ts → lib/pui-config.d.ts} +0 -0
- /package/dist/types/{server → lib/server}/appRoutes.d.ts +0 -0
- /package/dist/types/{server → lib/server}/index.d.ts +0 -0
- /package/dist/types/{server → lib/server}/logger.d.ts +0 -0
- /package/dist/types/{server → lib/server}/middlewares.d.ts +0 -0
- /package/dist/types/{testing/setup-react-env.d.ts → lib/testing/jest.polyfills.d.cts} +0 -0
- /package/dist/types/{testing → lib/testing}/mocks/cssModule.d.ts +0 -0
- /package/dist/types/{testing → lib/testing}/mocks/html.d.ts +0 -0
- /package/dist/types/{testing → lib/testing}/mocks/image.d.ts +0 -0
- /package/dist/types/{testing → lib/testing}/mocks/matchMedia.d.ts +0 -0
- /package/dist/types/{testing → lib/testing}/mocks/pui-app-loader.d.ts +0 -0
- /package/dist/types/{testing → lib/testing}/mocks/pui-user-monitoring.d.ts +0 -0
- /package/dist/types/{testing → lib/testing}/mocks/retry-axios.d.ts +0 -0
- /package/dist/types/{testing → lib/testing}/mocks/svg.d.ts +0 -0
- /package/dist/types/{testing → lib/testing}/mocks/webpack-hmr.d.ts +0 -0
- /package/dist/types/{testing → lib/testing}/resolver.d.cts +0 -0
- /package/dist/types/{testing/setup-test-env.d.ts → lib/testing/setup-react-env.d.ts} +0 -0
- /package/dist/types/{testing/setup-tests.d.ts → lib/testing/setup-test-env.d.ts} +0 -0
- /package/dist/types/{transpile → lib/transpile}/react-shim.d.ts +0 -0
- /package/dist/types/{transpile → lib/transpile}/swcrc.config.d.cts +0 -0
- /package/dist/types/{update-notifier.d.ts → lib/update-notifier.d.ts} +0 -0
- /package/dist/types/{utils.d.cts → lib/utils.d.cts} +0 -0
- /package/dist/types/{utils.d.ts → lib/utils.d.ts} +0 -0
- /package/dist/types/{webpack → lib/webpack}/webpack.base.babel.d.ts +0 -0
- /package/dist/types/{webpack → lib/webpack}/webpack.dev.babel.d.ts +0 -0
- /package/dist/types/{webpack → lib/webpack}/webpack.lib.base.babel.d.ts +0 -0
- /package/dist/types/{webpack → lib/webpack}/webpack.lib.dev.babel.d.ts +0 -0
- /package/dist/types/{webpack → lib/webpack}/webpack.lib.prod.babel.d.ts +0 -0
- /package/dist/types/{webpack → lib/webpack}/webpack.prod.babel.d.ts +0 -0
|
@@ -0,0 +1,129 @@
|
|
|
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 wsServer_exports = {};
|
|
30
|
+
__export(wsServer_exports, {
|
|
31
|
+
createWSServer: () => createWSServer
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(wsServer_exports);
|
|
34
|
+
var import_node_http = __toESM(require("node:http"), 1);
|
|
35
|
+
var wsLib = __toESM(require("ws"), 1);
|
|
36
|
+
const PING_INTERVAL = 3e4;
|
|
37
|
+
const DEFAULT_PORT = 5001;
|
|
38
|
+
const onSocketError = (err) => {
|
|
39
|
+
console.error(err);
|
|
40
|
+
};
|
|
41
|
+
const authenticate = (token, cb) => {
|
|
42
|
+
if (!token)
|
|
43
|
+
cb(4401);
|
|
44
|
+
else
|
|
45
|
+
cb();
|
|
46
|
+
};
|
|
47
|
+
const getAuthToken = (protocols) => {
|
|
48
|
+
const authProtocol = protocols.find(
|
|
49
|
+
(protocol) => protocol.startsWith("auth--")
|
|
50
|
+
);
|
|
51
|
+
if (!authProtocol)
|
|
52
|
+
return "";
|
|
53
|
+
return authProtocol.split("--")[1]?.trim?.();
|
|
54
|
+
};
|
|
55
|
+
const createWSServer = ({
|
|
56
|
+
port = DEFAULT_PORT,
|
|
57
|
+
pingInterval = PING_INTERVAL,
|
|
58
|
+
onOpen
|
|
59
|
+
}) => {
|
|
60
|
+
let isAlive = false;
|
|
61
|
+
const heartbeat = () => {
|
|
62
|
+
isAlive = true;
|
|
63
|
+
};
|
|
64
|
+
const httpServer = import_node_http.default.createServer();
|
|
65
|
+
const wsServer = new wsLib.WebSocketServer({ noServer: true });
|
|
66
|
+
httpServer.on("upgrade", (req, socket, head) => {
|
|
67
|
+
socket.on("error", onSocketError);
|
|
68
|
+
wsServer.handleUpgrade(req, socket, head, (ws) => {
|
|
69
|
+
const protocols = req.headers["sec-websocket-protocol"]?.split(",");
|
|
70
|
+
if (!protocols) {
|
|
71
|
+
console.error("no protocols");
|
|
72
|
+
ws.close(4401, "unauthorized");
|
|
73
|
+
socket.destroy();
|
|
74
|
+
socket.removeListener("error", onSocketError);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
authenticate(getAuthToken(protocols) || "", (errCode) => {
|
|
78
|
+
if (errCode) {
|
|
79
|
+
switch (errCode) {
|
|
80
|
+
case 4401:
|
|
81
|
+
ws.close(errCode, "unauthorized");
|
|
82
|
+
break;
|
|
83
|
+
default:
|
|
84
|
+
ws.close(4400, "Unknown error");
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
socket.destroy();
|
|
88
|
+
socket.removeListener("error", onSocketError);
|
|
89
|
+
} else {
|
|
90
|
+
socket.removeListener("error", onSocketError);
|
|
91
|
+
wsServer.emit("connection", ws, req);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
wsServer.on("connection", (ws) => {
|
|
97
|
+
isAlive = true;
|
|
98
|
+
ws.on("error", console.error);
|
|
99
|
+
ws.on("pong", () => {
|
|
100
|
+
heartbeat();
|
|
101
|
+
});
|
|
102
|
+
ws.on("message", (message) => {
|
|
103
|
+
console.log(
|
|
104
|
+
"message from client:",
|
|
105
|
+
JSON.parse(message)
|
|
106
|
+
);
|
|
107
|
+
ws.send(JSON.stringify(JSON.parse(message)));
|
|
108
|
+
});
|
|
109
|
+
console.log("client connected");
|
|
110
|
+
onOpen?.(ws);
|
|
111
|
+
});
|
|
112
|
+
const interval = setInterval(() => {
|
|
113
|
+
wsServer.clients.forEach((ws) => {
|
|
114
|
+
if (isAlive === false)
|
|
115
|
+
ws.terminate();
|
|
116
|
+
isAlive = false;
|
|
117
|
+
ws.ping();
|
|
118
|
+
});
|
|
119
|
+
}, pingInterval);
|
|
120
|
+
wsServer.on("close", function close() {
|
|
121
|
+
clearInterval(interval);
|
|
122
|
+
});
|
|
123
|
+
return new Promise((resolve) => {
|
|
124
|
+
httpServer.listen(port, () => {
|
|
125
|
+
console.log(`Websocket server listening on port ${port}`);
|
|
126
|
+
return resolve({ httpServer, wsServer });
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const { TestEnvironment } = require('jest-environment-jsdom');
|
|
2
|
+
|
|
3
|
+
// ICE platform is meant to be run on node > 18
|
|
4
|
+
// "jest-environment-jsdom": "~29.6.3" is instead meant to support node >16
|
|
5
|
+
// features that are supported since node 17 & 18 are not supported in jsdom env
|
|
6
|
+
// the limitation is not relevant for us since we are already running on node 18 anyway,
|
|
7
|
+
// this "ExtendedJSDomEnv" is an extension of the
|
|
8
|
+
// jest.config.cjs
|
|
9
|
+
// {
|
|
10
|
+
// ...
|
|
11
|
+
// testEnvironment: 'jsdom'
|
|
12
|
+
// ...
|
|
13
|
+
// }
|
|
14
|
+
// that actually uses node 18 features that are not supported in "jest-environment-jsdom": "~29.6.3"
|
|
15
|
+
|
|
16
|
+
// https://github.com/facebook/jest/blob/v29.4.3/website/versioned_docs/version-29.4/Configuration.md#testenvironment-string
|
|
17
|
+
class FixJSDOMEnvironment extends TestEnvironment {
|
|
18
|
+
constructor(...args) {
|
|
19
|
+
super(...args);
|
|
20
|
+
|
|
21
|
+
// From here on we are using "node" (currently running version of it) to polyfill jsdom this.global
|
|
22
|
+
|
|
23
|
+
// FIXME https://github.com/jsdom/jsdom/issues/3363
|
|
24
|
+
if (structuredClone) this.global.structuredClone = structuredClone;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
module.exports = FixJSDOMEnvironment;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var getMessageAndPass_exports = {};
|
|
20
|
+
__export(getMessageAndPass_exports, {
|
|
21
|
+
getMessageAndPass: () => getMessageAndPass
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(getMessageAndPass_exports);
|
|
24
|
+
var import_jest_matcher_utils = require("jest-matcher-utils");
|
|
25
|
+
var import_reporter = require("./reporter.js");
|
|
26
|
+
const getMessageAndPass = (violations) => {
|
|
27
|
+
const formatedViolations = (0, import_reporter.reporter)(violations);
|
|
28
|
+
const pass = formatedViolations.length === 0;
|
|
29
|
+
if (pass)
|
|
30
|
+
return { message: () => "", pass };
|
|
31
|
+
return {
|
|
32
|
+
message: () => `${(0, import_jest_matcher_utils.matcherHint)(".toHaveNoViolations")}
|
|
33
|
+
|
|
34
|
+
${formatedViolations}`,
|
|
35
|
+
pass
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var axe_core_exports = {};
|
|
20
|
+
__export(axe_core_exports, {
|
|
21
|
+
toHaveNoViolations: () => import_toHaveNoViolations.toHaveNoViolations
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(axe_core_exports);
|
|
24
|
+
var import_toHaveNoViolations = require("./toHaveNoViolations.js");
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var reporter_exports = {};
|
|
20
|
+
__export(reporter_exports, {
|
|
21
|
+
reporter: () => reporter
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(reporter_exports);
|
|
24
|
+
var import_jest_matcher_utils = require("jest-matcher-utils");
|
|
25
|
+
const colorYellow = (arg) => `\x1B[93m ${arg ?? ""} \x1B[0m`;
|
|
26
|
+
const colorGrey = (arg) => `\x1B[90m ${arg ?? ""} \x1B[0m`;
|
|
27
|
+
const colorBlue = (arg) => `\x1B[34m ${arg ?? ""} \x1B[0m`;
|
|
28
|
+
const reporter = (violToFormat) => {
|
|
29
|
+
if (violToFormat.length === 0)
|
|
30
|
+
return "";
|
|
31
|
+
const lineBreak = "\n\n";
|
|
32
|
+
const horizontalLine = "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
|
|
33
|
+
return violToFormat.map((violation) => {
|
|
34
|
+
const errorBody = violation.nodes.map((node) => {
|
|
35
|
+
const selector = node.target.join(", ");
|
|
36
|
+
const expectedText = `Expected the HTML found at $('${selector}') to have no violations:${lineBreak}`;
|
|
37
|
+
let violationHelpUrl = "";
|
|
38
|
+
if (violation.helpUrl)
|
|
39
|
+
violationHelpUrl = `You can find more information on this issue here:
|
|
40
|
+
${colorBlue(
|
|
41
|
+
violation.helpUrl
|
|
42
|
+
)}`;
|
|
43
|
+
return `${expectedText + colorGrey(node.html) + lineBreak}Received:${lineBreak}${(0, import_jest_matcher_utils.printReceived)(
|
|
44
|
+
`${violation.help} (${violation.id})`
|
|
45
|
+
)}${lineBreak}${colorYellow(
|
|
46
|
+
node.failureSummary
|
|
47
|
+
)}${lineBreak}${violationHelpUrl}`;
|
|
48
|
+
}).join(lineBreak);
|
|
49
|
+
return errorBody;
|
|
50
|
+
}).join(lineBreak + horizontalLine + lineBreak);
|
|
51
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var shouldIgnoreNodeViolation_exports = {};
|
|
20
|
+
__export(shouldIgnoreNodeViolation_exports, {
|
|
21
|
+
shouldIgnoreNodeViolation: () => shouldIgnoreNodeViolation
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(shouldIgnoreNodeViolation_exports);
|
|
24
|
+
const dataAttributeRegexp = /(data-[\S]*)=["']([\S]*)["']/gm;
|
|
25
|
+
const shouldIgnoreNodeViolation = (node, violation) => [...node.html.matchAll(dataAttributeRegexp)].map(([fullMatch, dataKey, dataValue]) => ({
|
|
26
|
+
fullMatch,
|
|
27
|
+
dataKey,
|
|
28
|
+
dataValue
|
|
29
|
+
})).some(
|
|
30
|
+
({ dataKey, dataValue }) => dataKey === `data-axe-ignore-${violation.id}` && dataValue === "true"
|
|
31
|
+
);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var toHaveNoViolations_exports = {};
|
|
20
|
+
__export(toHaveNoViolations_exports, {
|
|
21
|
+
toHaveNoViolations: () => toHaveNoViolations
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(toHaveNoViolations_exports);
|
|
24
|
+
var import_getMessageAndPass = require("./getMessageAndPass.js");
|
|
25
|
+
var import_shouldIgnoreNodeViolation = require("./shouldIgnoreNodeViolation.js");
|
|
26
|
+
const toHaveNoViolations = {
|
|
27
|
+
toHaveNoViolations(results) {
|
|
28
|
+
const { violations } = results;
|
|
29
|
+
const finalViolations = [];
|
|
30
|
+
violations.forEach((violation) => {
|
|
31
|
+
const { nodes } = violation;
|
|
32
|
+
const newNodes = [];
|
|
33
|
+
nodes.forEach((node) => {
|
|
34
|
+
if (!(0, import_shouldIgnoreNodeViolation.shouldIgnoreNodeViolation)(node, violation))
|
|
35
|
+
newNodes.push(node);
|
|
36
|
+
});
|
|
37
|
+
if (newNodes.length > 0) {
|
|
38
|
+
finalViolations.push({ ...violation, nodes: newNodes });
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return { actual: violations, ...(0, import_getMessageAndPass.getMessageAndPass)(finalViolations) };
|
|
42
|
+
}
|
|
43
|
+
};
|
|
@@ -57,6 +57,8 @@ const jestConfig = {
|
|
|
57
57
|
coverageReporters: ['lcov', 'html', 'text-summary'],
|
|
58
58
|
moduleDirectories: ['node_modules', 'app', 'lib'],
|
|
59
59
|
moduleNameMapper: {
|
|
60
|
+
d3: '<rootDir>/node_modules/d3/dist/d3.min.js',
|
|
61
|
+
'^d3-(.*)$': '<rootDir>/node_modules/d3-$1/dist/d3-$1.min.js',
|
|
60
62
|
'.*\\webpack-hmr(.[t|j]s)?$': getMockFilePath('webpack-hmr.js'),
|
|
61
63
|
'.*\\.(css|scss)$': getMockFilePath('cssModule.js'),
|
|
62
64
|
'.*\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ico)$':
|
|
@@ -73,7 +75,7 @@ const jestConfig = {
|
|
|
73
75
|
},
|
|
74
76
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
|
75
77
|
setupFilesAfterEnv: [path.resolve(__dirname, './setup-tests.js')],
|
|
76
|
-
setupFiles: ['raf/polyfill', '
|
|
78
|
+
setupFiles: ['raf/polyfill', path.resolve(__dirname, './jest.polyfills.cjs')],
|
|
77
79
|
testRegex: '(app|lib).*/tests/.*\\.test\\.[jt]sx?$',
|
|
78
80
|
snapshotSerializers: [],
|
|
79
81
|
testResultsProcessor: 'jest-sonar-reporter',
|
|
@@ -91,8 +93,9 @@ const jestConfig = {
|
|
|
91
93
|
testEnvironmentOptions: {
|
|
92
94
|
url: `http://localhost:3111${basePath}`,
|
|
93
95
|
resources: 'usable',
|
|
96
|
+
customExportConditions: [''],
|
|
94
97
|
},
|
|
95
|
-
testEnvironment: '
|
|
98
|
+
testEnvironment: path.resolve(__dirname, './ExtendedJSDomEnv.cjs'),
|
|
96
99
|
watchPlugins: [
|
|
97
100
|
'jest-watch-typeahead/filename',
|
|
98
101
|
'jest-watch-typeahead/testname',
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @note The block below contains polyfills for Node.js globals
|
|
3
|
+
* required for Jest to function when running JSDOM tests.
|
|
4
|
+
* These HAVE to be require's and HAVE to be in this exact
|
|
5
|
+
* order, since "undici" depends on the "TextEncoder" global API.
|
|
6
|
+
*
|
|
7
|
+
* Consider migrating to a more modern test runner if
|
|
8
|
+
* you don't want to deal with this.
|
|
9
|
+
*/
|
|
10
|
+
const { TextDecoder, TextEncoder } = require('node:util');
|
|
11
|
+
const { ReadableStream } = require('node:stream/web');
|
|
12
|
+
|
|
13
|
+
Object.defineProperties(globalThis, {
|
|
14
|
+
TextDecoder: { value: TextDecoder },
|
|
15
|
+
TextEncoder: { value: TextEncoder },
|
|
16
|
+
ReadableStream: { value: ReadableStream },
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const { Blob, File } = require('node:buffer');
|
|
20
|
+
const { fetch, Headers, FormData, Request, Response } = require('undici');
|
|
21
|
+
|
|
22
|
+
Object.defineProperties(globalThis, {
|
|
23
|
+
fetch: { value: fetch, writable: true },
|
|
24
|
+
Blob: { value: Blob },
|
|
25
|
+
File: { value: File },
|
|
26
|
+
Headers: { value: Headers },
|
|
27
|
+
FormData: { value: FormData },
|
|
28
|
+
Request: { value: Request },
|
|
29
|
+
Response: { value: Response },
|
|
30
|
+
});
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var import_vitest = require("vitest");
|
|
3
|
-
var import_jest_styled_components = require("jest-styled-components");
|
|
4
3
|
var import_react = require("@testing-library/react");
|
|
5
|
-
var import_extend_expect = require("@testing-library/jest-dom/extend-expect");
|
|
6
4
|
(0, import_vitest.afterEach)(() => {
|
|
7
5
|
(0, import_react.cleanup)();
|
|
8
6
|
});
|
|
@@ -21,11 +21,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
22
|
mod
|
|
23
23
|
));
|
|
24
|
-
var import_stable = require("core-js/stable");
|
|
25
24
|
var import_runtime = require("regenerator-runtime/runtime");
|
|
26
|
-
var
|
|
27
|
-
var import_jest_axe = __toESM(require("jest-axe"), 1);
|
|
25
|
+
var import_jest_globals = require("@testing-library/jest-dom/jest-globals");
|
|
28
26
|
var import_resize_observer_polyfill = __toESM(require("resize-observer-polyfill"), 1);
|
|
27
|
+
var import_axe_core = require("./extended/axe-core");
|
|
29
28
|
var import_matchMedia = require("./mocks/matchMedia.js");
|
|
30
29
|
var import_pui_diagnostics = require("./mocks/pui-diagnostics.js");
|
|
31
30
|
const originalError = console.error;
|
|
@@ -48,7 +47,7 @@ console.error = (...args) => {
|
|
|
48
47
|
return originalError(...args);
|
|
49
48
|
};
|
|
50
49
|
if (expect)
|
|
51
|
-
expect.extend(
|
|
50
|
+
expect.extend(import_axe_core.toHaveNoViolations);
|
|
52
51
|
const addElementToBody = (element) => {
|
|
53
52
|
const documentEle = (window || {}).document;
|
|
54
53
|
if (!documentEle)
|
|
@@ -72,3 +71,26 @@ window.emui = {
|
|
|
72
71
|
logger: (0, import_pui_diagnostics.logger)(),
|
|
73
72
|
_BASE_PATH: new URL(document.baseURI).pathname
|
|
74
73
|
};
|
|
74
|
+
let showCorejsWarn = false;
|
|
75
|
+
afterAll(() => {
|
|
76
|
+
if (showCorejsWarn) {
|
|
77
|
+
console.warn(
|
|
78
|
+
`IMPORTANT: Try importing core-js/stable in your failed test files and retrying.
|
|
79
|
+
Some tests might have failed because of it`
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
const originalTest = global.test;
|
|
84
|
+
global.it = (name, fn, timeout = void 0) => {
|
|
85
|
+
const fnWrapper = async () => {
|
|
86
|
+
try {
|
|
87
|
+
await fn();
|
|
88
|
+
} catch (error) {
|
|
89
|
+
showCorejsWarn = true;
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
originalTest(name, fnWrapper, timeout);
|
|
94
|
+
};
|
|
95
|
+
global.it.skip = originalTest.skip;
|
|
96
|
+
global.it.only = originalTest.only;
|
|
@@ -35,27 +35,27 @@ var import_node_path = __toESM(require("node:path"), 1);
|
|
|
35
35
|
var import_node_url = require("node:url");
|
|
36
36
|
var import_config = require("vitest/config");
|
|
37
37
|
var import_plugin_react = __toESM(require("@vitejs/plugin-react"), 1);
|
|
38
|
+
var import_vite_tsconfig_paths = __toESM(require("vite-tsconfig-paths"), 1);
|
|
38
39
|
const import_meta = {};
|
|
39
40
|
const __dirname = import_node_path.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
|
|
40
41
|
const vitestConfig = (0, import_config.defineConfig)({
|
|
41
|
-
plugins: [(0, import_plugin_react.default)()],
|
|
42
|
+
plugins: [(0, import_plugin_react.default)(), (0, import_vite_tsconfig_paths.default)()],
|
|
42
43
|
test: {
|
|
43
44
|
globals: true,
|
|
44
45
|
root: process.cwd(),
|
|
45
|
-
environment: "
|
|
46
|
+
environment: "happy-dom",
|
|
46
47
|
setupFiles: [import_node_path.default.resolve(__dirname, "./setup-test-env.js")],
|
|
47
48
|
include: ["./{app,lib}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
|
48
49
|
exclude: [...import_config.configDefaults.exclude, ".idea", ".git", ".cache", "e2e"],
|
|
49
|
-
// watchIgnore: [
|
|
50
|
-
// '.*\\/node_modules\\/.*',
|
|
51
|
-
// '.*\\/build\\/.*',
|
|
52
|
-
// '.*\\/dist\\/.*',
|
|
53
|
-
// ],
|
|
54
50
|
coverage: {
|
|
55
51
|
reportsDirectory: "./reports/coverage"
|
|
56
52
|
},
|
|
57
53
|
deps: {
|
|
58
|
-
|
|
54
|
+
optimizer: {
|
|
55
|
+
web: {
|
|
56
|
+
include: ["app.config.json", "@elliemae/pui-app-sdk"]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
});
|
|
@@ -34,17 +34,17 @@ __export(esbuild_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(esbuild_exports);
|
|
35
35
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
36
36
|
var import_node_url = require("node:url");
|
|
37
|
-
var import_fast_glob = __toESM(require("fast-glob"), 1);
|
|
38
|
-
var import_esbuild = require("esbuild");
|
|
39
37
|
var import_promises = require("node:fs/promises");
|
|
40
38
|
var import_browserslist_to_esbuild = __toESM(require("browserslist-to-esbuild"), 1);
|
|
39
|
+
var import_fast_glob = __toESM(require("fast-glob"), 1);
|
|
40
|
+
var import_esbuild = require("esbuild");
|
|
41
41
|
var import_esbuild_plugin_lodash = __toESM(require("esbuild-plugin-lodash"), 1);
|
|
42
42
|
const import_meta = {};
|
|
43
43
|
const __dirname = import_node_path.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
|
|
44
44
|
const TARGETS = {
|
|
45
45
|
browserslist: (0, import_browserslist_to_esbuild.default)(),
|
|
46
|
-
web: "
|
|
47
|
-
node: "
|
|
46
|
+
web: "es2022",
|
|
47
|
+
node: "node20"
|
|
48
48
|
};
|
|
49
49
|
const ESBUILD_FORMAT = {
|
|
50
50
|
CJS: "cjs",
|
|
@@ -31,9 +31,9 @@ __export(update_notifier_exports, {
|
|
|
31
31
|
notifyUpdates: () => notifyUpdates
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(update_notifier_exports);
|
|
34
|
-
var import_update_notifier = __toESM(require("update-notifier"), 1);
|
|
35
34
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
36
35
|
var import_promises = __toESM(require("node:fs/promises"), 1);
|
|
36
|
+
var import_update_notifier = __toESM(require("update-notifier"), 1);
|
|
37
37
|
const notifyUpdates = async () => {
|
|
38
38
|
const pkgFile = await import_promises.default.readFile(import_node_path.default.join(process.cwd(), "./package.json"));
|
|
39
39
|
const pkg = JSON.parse(pkgFile);
|
package/dist/cjs/utils.js
CHANGED
|
@@ -35,7 +35,7 @@ __export(utils_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(utils_exports);
|
|
36
36
|
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
37
37
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
38
|
-
const basePath = (process.env.BASE_PATH
|
|
38
|
+
const basePath = (process.env.BASE_PATH ?? "/").replace(/\/?$/, "/");
|
|
39
39
|
const isApp = () => import_node_fs.default.existsSync(import_node_path.default.join(process.cwd(), "app"));
|
|
40
40
|
const getAppConfig = () => {
|
|
41
41
|
const appConfigPath = import_node_path.default.join(
|
|
@@ -34,6 +34,7 @@ __export(helpers_exports, {
|
|
|
34
34
|
getAlias: () => getAlias,
|
|
35
35
|
getAppVersion: () => getAppVersion,
|
|
36
36
|
getCompressionPlugins: () => getCompressionPlugins,
|
|
37
|
+
getLibraryAlias: () => getLibraryAlias,
|
|
37
38
|
getLibraryName: () => getLibraryName,
|
|
38
39
|
getLibraryVariableName: () => getLibraryVariableName,
|
|
39
40
|
getMediaPath: () => getMediaPath,
|
|
@@ -48,9 +49,9 @@ __export(helpers_exports, {
|
|
|
48
49
|
module.exports = __toCommonJS(helpers_exports);
|
|
49
50
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
50
51
|
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
52
|
+
var import_zlib = __toESM(require("zlib"), 1);
|
|
51
53
|
var import_lodash = __toESM(require("lodash"), 1);
|
|
52
54
|
var import_compression_webpack_plugin = __toESM(require("compression-webpack-plugin"), 1);
|
|
53
|
-
var import_zlib = __toESM(require("zlib"), 1);
|
|
54
55
|
var import_utils = require("../monorepo/utils.js");
|
|
55
56
|
var import_utils2 = require("../utils.js");
|
|
56
57
|
let pathSep = import_node_path.default.sep;
|
|
@@ -64,8 +65,8 @@ const excludeNodeModulesExcept = (modules) => {
|
|
|
64
65
|
const moduleRegExps = getNodeModulesRegEx(modules);
|
|
65
66
|
return function(modulePath) {
|
|
66
67
|
if (/node_modules/.test(modulePath)) {
|
|
67
|
-
for (
|
|
68
|
-
if (
|
|
68
|
+
for (const moduleRegExp of moduleRegExps)
|
|
69
|
+
if (moduleRegExp.test(modulePath))
|
|
69
70
|
return false;
|
|
70
71
|
return true;
|
|
71
72
|
}
|
|
@@ -80,7 +81,7 @@ const getLibraryName = () => {
|
|
|
80
81
|
const modifiedLibName = `emui-${libraryName.replace("@elliemae/", "").replace("pui-", "")}`;
|
|
81
82
|
return import_lodash.default.camelCase(modifiedLibName);
|
|
82
83
|
};
|
|
83
|
-
const getLibraryVariableName = () => (process.env.LIBRARY_VARIABLE_NAME
|
|
84
|
+
const getLibraryVariableName = () => (process.env.LIBRARY_VARIABLE_NAME ?? getLibraryName()).split(".");
|
|
84
85
|
const mapToFolder = (dependencies, folder) => dependencies.reduce(
|
|
85
86
|
(acc, dependency) => ({
|
|
86
87
|
[dependency]: import_node_path.default.resolve(`${folder}/${dependency.replace("$", "")}`),
|
|
@@ -89,7 +90,7 @@ const mapToFolder = (dependencies, folder) => dependencies.reduce(
|
|
|
89
90
|
{}
|
|
90
91
|
);
|
|
91
92
|
const getAlias = () => {
|
|
92
|
-
const monorepoRoot = (0, import_utils.findMonoRepoRoot)(process.cwd())
|
|
93
|
+
const monorepoRoot = (0, import_utils.findMonoRepoRoot)(process.cwd()) ?? "";
|
|
93
94
|
return mapToFolder(
|
|
94
95
|
[
|
|
95
96
|
"@babel/runtime",
|
|
@@ -103,6 +104,8 @@ const getAlias = () => {
|
|
|
103
104
|
"styled-components",
|
|
104
105
|
"immer",
|
|
105
106
|
"react-dates",
|
|
107
|
+
"react-select",
|
|
108
|
+
"react-spring",
|
|
106
109
|
"react-transition-group",
|
|
107
110
|
"@elliemae/pui-cli",
|
|
108
111
|
"@elliemae/pui-app-sdk$",
|
|
@@ -111,6 +114,15 @@ const getAlias = () => {
|
|
|
111
114
|
import_node_path.default.join(monorepoRoot, "./node_modules")
|
|
112
115
|
);
|
|
113
116
|
};
|
|
117
|
+
const getLibraryAlias = (name, alias) => {
|
|
118
|
+
const monorepoRoot = (0, import_utils.findMonoRepoRoot)(process.cwd()) ?? "";
|
|
119
|
+
const aliasPath = import_node_path.default.resolve(
|
|
120
|
+
`${import_node_path.default.join(monorepoRoot, "./node_modules")}/${alias}`
|
|
121
|
+
);
|
|
122
|
+
return {
|
|
123
|
+
[name]: aliasPath
|
|
124
|
+
};
|
|
125
|
+
};
|
|
114
126
|
const modulesToTranspile = [
|
|
115
127
|
"@elliemae/pui-*",
|
|
116
128
|
"@elliemae/ds-*",
|
|
@@ -173,7 +185,7 @@ const getAppVersion = () => {
|
|
|
173
185
|
if (!process.env.APP_VERSION)
|
|
174
186
|
return LATEST_VERSION;
|
|
175
187
|
const match = process.env.APP_VERSION.match(/^v?(\d+\.\d+)\..*$/);
|
|
176
|
-
return match
|
|
188
|
+
return match?.[1] ?? LATEST_VERSION;
|
|
177
189
|
};
|
|
178
190
|
const getPaths = (latestVersion = true) => {
|
|
179
191
|
const version = latestVersion ? LATEST_VERSION : getAppVersion();
|
|
@@ -208,9 +220,9 @@ const getCompressionPlugins = (isLibrary = false) => {
|
|
|
208
220
|
];
|
|
209
221
|
const commonConfig = {
|
|
210
222
|
test: /\.(js|css)$/,
|
|
211
|
-
exclude: !isLibrary ? excludeList : [],
|
|
212
223
|
// we are compressing all files since in aws cloudfront edge lambda, we don't want to whitelist files that are not compressed due to below limits
|
|
213
|
-
minRatio: Infinity
|
|
224
|
+
minRatio: Infinity,
|
|
225
|
+
...!isLibrary ? { exclude: excludeList } : {}
|
|
214
226
|
};
|
|
215
227
|
return [
|
|
216
228
|
new import_compression_webpack_plugin.default({
|