@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,25 @@
|
|
|
1
|
+
const stylelintConfig = {
|
|
2
|
+
ignoreFiles: [
|
|
3
|
+
"/dist/**/*",
|
|
4
|
+
"/coverage/**/*",
|
|
5
|
+
"/build/**/*",
|
|
6
|
+
"/reports/**/*",
|
|
7
|
+
"/temp/**/*",
|
|
8
|
+
"/docs/**/*",
|
|
9
|
+
"/demo/**/*",
|
|
10
|
+
"/node_modules/**/*",
|
|
11
|
+
"/vendor/**/*"
|
|
12
|
+
],
|
|
13
|
+
extends: ["stylelint-config-standard"],
|
|
14
|
+
customSyntax: "postcss-styled-syntax",
|
|
15
|
+
rules: {
|
|
16
|
+
"selector-type-no-unknown": null,
|
|
17
|
+
"function-no-unknown": null,
|
|
18
|
+
"value-no-vendor-prefix": true,
|
|
19
|
+
"property-no-vendor-prefix": true,
|
|
20
|
+
"no-empty-source": null
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
stylelintConfig
|
|
25
|
+
};
|
|
@@ -3,7 +3,7 @@ const cwd = process.cwd();
|
|
|
3
3
|
const execaOptions = { cwd, stdio: "inherit" };
|
|
4
4
|
const semVerRegEx = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
|
5
5
|
const isSemVersion = (tagName) => semVerRegEx.test(tagName);
|
|
6
|
-
const branchName = (process.env.BRANCH_NAME
|
|
6
|
+
const branchName = (process.env.BRANCH_NAME ?? "master").toLowerCase();
|
|
7
7
|
const branchTags = {
|
|
8
8
|
master: /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/,
|
|
9
9
|
next: /^v.*-next\.(0|[1-9]\d*)/,
|
|
@@ -2,7 +2,7 @@ import { readFile, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import fg from "fast-glob";
|
|
3
3
|
import normalizePath from "normalize-path";
|
|
4
4
|
import { findMonoRepoRoot } from "./utils.js";
|
|
5
|
-
const monorepoRoot = normalizePath(findMonoRepoRoot()
|
|
5
|
+
const monorepoRoot = normalizePath(findMonoRepoRoot() ?? "");
|
|
6
6
|
const setRegistryVersion = async () => {
|
|
7
7
|
const files = await fg([
|
|
8
8
|
`${monorepoRoot}/libs/*/package.json`,
|
|
@@ -2,7 +2,7 @@ import { readFile, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import fg from "fast-glob";
|
|
3
3
|
import normalizePath from "normalize-path";
|
|
4
4
|
import { findMonoRepoRoot } from "./utils.js";
|
|
5
|
-
const monorepoRoot = normalizePath(findMonoRepoRoot()
|
|
5
|
+
const monorepoRoot = normalizePath(findMonoRepoRoot() ?? "");
|
|
6
6
|
const setWorkspaceVersion = async () => {
|
|
7
7
|
const files = await fg([
|
|
8
8
|
`${monorepoRoot}/libs/*/package.json`,
|
package/dist/esm/pui-config.js
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var release_config_default = {
|
|
2
|
+
branches: [
|
|
3
|
+
"+([0-9])?(.{+([0-9]),x}).x",
|
|
4
|
+
"master",
|
|
5
|
+
"next-major",
|
|
6
|
+
{ name: "beta", prerelease: true },
|
|
7
|
+
{ name: "alpha", prerelease: true },
|
|
8
|
+
{ name: "hotfix", prerelease: true },
|
|
9
|
+
{ name: "next", prerelease: true }
|
|
10
|
+
],
|
|
11
|
+
plugins: [
|
|
12
|
+
"@semantic-release/commit-analyzer",
|
|
13
|
+
"@semantic-release/release-notes-generator",
|
|
14
|
+
[
|
|
15
|
+
"@semantic-release/changelog",
|
|
16
|
+
{
|
|
17
|
+
changelogTitle: "# Changelog\n\nAll notable changes to this project will be documented in this file. See\n[Conventional Commits](https://conventionalcommits.org) for commit guidelines."
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"@semantic-release/npm",
|
|
21
|
+
"@semantic-release/github"
|
|
22
|
+
]
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
release_config_default as default
|
|
26
|
+
};
|
package/dist/esm/server/csp.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import crypto from "crypto";
|
|
3
4
|
import express from "express";
|
|
4
5
|
import cspPolicy from "helmet-csp";
|
|
5
|
-
import crypto from "crypto";
|
|
6
6
|
const CSP_REPORT_URI = "/diagnostics/v1/csp";
|
|
7
7
|
const sources = [
|
|
8
8
|
"'self'",
|
|
9
9
|
"http://localhost:*",
|
|
10
|
+
"ws://localhost:*",
|
|
10
11
|
"*.elliemae.io",
|
|
11
12
|
"*.elliemae.com",
|
|
12
13
|
"*.elliservices.com",
|
package/dist/esm/server/index.js
CHANGED
|
@@ -4,8 +4,9 @@ import {
|
|
|
4
4
|
setupDefaultMiddlewares,
|
|
5
5
|
setupAdditionalMiddlewars
|
|
6
6
|
} from "./middlewares.js";
|
|
7
|
-
import { port, host } from "./utils.js";
|
|
7
|
+
import { port, wsPort, host } from "./utils.js";
|
|
8
8
|
import { loadRoutes } from "./appRoutes.js";
|
|
9
|
+
import { createWSServer } from "./wsServer.js";
|
|
9
10
|
(async function startServer() {
|
|
10
11
|
const app = express();
|
|
11
12
|
setupDefaultMiddlewares(app);
|
|
@@ -17,4 +18,8 @@ import { loadRoutes } from "./appRoutes.js";
|
|
|
17
18
|
logger.error(err);
|
|
18
19
|
process.exit(1);
|
|
19
20
|
});
|
|
21
|
+
const { wsServer } = await createWSServer({
|
|
22
|
+
port: wsPort
|
|
23
|
+
});
|
|
24
|
+
app.locals.wsServer = wsServer;
|
|
20
25
|
})();
|
package/dist/esm/server/utils.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import minimist from "minimist";
|
|
2
|
-
const argv = minimist(
|
|
2
|
+
const argv = minimist(
|
|
3
|
+
process.argv.slice(2)
|
|
4
|
+
);
|
|
3
5
|
const getCWD = () => process.cwd();
|
|
4
6
|
const port = parseInt(
|
|
5
|
-
argv.port
|
|
7
|
+
argv.port ?? process.env.port ?? process.env.PORT ?? "3000",
|
|
8
|
+
10
|
|
9
|
+
);
|
|
10
|
+
const host = argv.host ?? process.env.HOST ?? "localhost";
|
|
11
|
+
const wsPort = parseInt(
|
|
12
|
+
argv.wsport ?? process.env.wsport ?? process.env.WSPORT ?? "5000",
|
|
6
13
|
10
|
|
7
14
|
);
|
|
8
|
-
const host = argv.host || process.env.HOST || "localhost";
|
|
9
15
|
export {
|
|
10
16
|
getCWD,
|
|
11
17
|
host,
|
|
12
|
-
port
|
|
18
|
+
port,
|
|
19
|
+
wsPort
|
|
13
20
|
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import http from "node:http";
|
|
2
|
+
import * as wsLib from "ws";
|
|
3
|
+
const PING_INTERVAL = 3e4;
|
|
4
|
+
const DEFAULT_PORT = 5001;
|
|
5
|
+
const onSocketError = (err) => {
|
|
6
|
+
console.error(err);
|
|
7
|
+
};
|
|
8
|
+
const authenticate = (token, cb) => {
|
|
9
|
+
if (!token)
|
|
10
|
+
cb(4401);
|
|
11
|
+
else
|
|
12
|
+
cb();
|
|
13
|
+
};
|
|
14
|
+
const getAuthToken = (protocols) => {
|
|
15
|
+
const authProtocol = protocols.find(
|
|
16
|
+
(protocol) => protocol.startsWith("auth--")
|
|
17
|
+
);
|
|
18
|
+
if (!authProtocol)
|
|
19
|
+
return "";
|
|
20
|
+
return authProtocol.split("--")[1]?.trim?.();
|
|
21
|
+
};
|
|
22
|
+
const createWSServer = ({
|
|
23
|
+
port = DEFAULT_PORT,
|
|
24
|
+
pingInterval = PING_INTERVAL,
|
|
25
|
+
onOpen
|
|
26
|
+
}) => {
|
|
27
|
+
let isAlive = false;
|
|
28
|
+
const heartbeat = () => {
|
|
29
|
+
isAlive = true;
|
|
30
|
+
};
|
|
31
|
+
const httpServer = http.createServer();
|
|
32
|
+
const wsServer = new wsLib.WebSocketServer({ noServer: true });
|
|
33
|
+
httpServer.on("upgrade", (req, socket, head) => {
|
|
34
|
+
socket.on("error", onSocketError);
|
|
35
|
+
wsServer.handleUpgrade(req, socket, head, (ws) => {
|
|
36
|
+
const protocols = req.headers["sec-websocket-protocol"]?.split(",");
|
|
37
|
+
if (!protocols) {
|
|
38
|
+
console.error("no protocols");
|
|
39
|
+
ws.close(4401, "unauthorized");
|
|
40
|
+
socket.destroy();
|
|
41
|
+
socket.removeListener("error", onSocketError);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
authenticate(getAuthToken(protocols) || "", (errCode) => {
|
|
45
|
+
if (errCode) {
|
|
46
|
+
switch (errCode) {
|
|
47
|
+
case 4401:
|
|
48
|
+
ws.close(errCode, "unauthorized");
|
|
49
|
+
break;
|
|
50
|
+
default:
|
|
51
|
+
ws.close(4400, "Unknown error");
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
socket.destroy();
|
|
55
|
+
socket.removeListener("error", onSocketError);
|
|
56
|
+
} else {
|
|
57
|
+
socket.removeListener("error", onSocketError);
|
|
58
|
+
wsServer.emit("connection", ws, req);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
wsServer.on("connection", (ws) => {
|
|
64
|
+
isAlive = true;
|
|
65
|
+
ws.on("error", console.error);
|
|
66
|
+
ws.on("pong", () => {
|
|
67
|
+
heartbeat();
|
|
68
|
+
});
|
|
69
|
+
ws.on("message", (message) => {
|
|
70
|
+
console.log(
|
|
71
|
+
"message from client:",
|
|
72
|
+
JSON.parse(message)
|
|
73
|
+
);
|
|
74
|
+
ws.send(JSON.stringify(JSON.parse(message)));
|
|
75
|
+
});
|
|
76
|
+
console.log("client connected");
|
|
77
|
+
onOpen?.(ws);
|
|
78
|
+
});
|
|
79
|
+
const interval = setInterval(() => {
|
|
80
|
+
wsServer.clients.forEach((ws) => {
|
|
81
|
+
if (isAlive === false)
|
|
82
|
+
ws.terminate();
|
|
83
|
+
isAlive = false;
|
|
84
|
+
ws.ping();
|
|
85
|
+
});
|
|
86
|
+
}, pingInterval);
|
|
87
|
+
wsServer.on("close", function close() {
|
|
88
|
+
clearInterval(interval);
|
|
89
|
+
});
|
|
90
|
+
return new Promise((resolve) => {
|
|
91
|
+
httpServer.listen(port, () => {
|
|
92
|
+
console.log(`Websocket server listening on port ${port}`);
|
|
93
|
+
return resolve({ httpServer, wsServer });
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
export {
|
|
98
|
+
createWSServer
|
|
99
|
+
};
|
|
@@ -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,17 @@
|
|
|
1
|
+
import { matcherHint } from "jest-matcher-utils";
|
|
2
|
+
import { reporter } from "./reporter.js";
|
|
3
|
+
const getMessageAndPass = (violations) => {
|
|
4
|
+
const formatedViolations = reporter(violations);
|
|
5
|
+
const pass = formatedViolations.length === 0;
|
|
6
|
+
if (pass)
|
|
7
|
+
return { message: () => "", pass };
|
|
8
|
+
return {
|
|
9
|
+
message: () => `${matcherHint(".toHaveNoViolations")}
|
|
10
|
+
|
|
11
|
+
${formatedViolations}`,
|
|
12
|
+
pass
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
getMessageAndPass
|
|
17
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { printReceived } from "jest-matcher-utils";
|
|
2
|
+
const colorYellow = (arg) => `\x1B[93m ${arg ?? ""} \x1B[0m`;
|
|
3
|
+
const colorGrey = (arg) => `\x1B[90m ${arg ?? ""} \x1B[0m`;
|
|
4
|
+
const colorBlue = (arg) => `\x1B[34m ${arg ?? ""} \x1B[0m`;
|
|
5
|
+
const reporter = (violToFormat) => {
|
|
6
|
+
if (violToFormat.length === 0)
|
|
7
|
+
return "";
|
|
8
|
+
const lineBreak = "\n\n";
|
|
9
|
+
const horizontalLine = "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
|
|
10
|
+
return violToFormat.map((violation) => {
|
|
11
|
+
const errorBody = violation.nodes.map((node) => {
|
|
12
|
+
const selector = node.target.join(", ");
|
|
13
|
+
const expectedText = `Expected the HTML found at $('${selector}') to have no violations:${lineBreak}`;
|
|
14
|
+
let violationHelpUrl = "";
|
|
15
|
+
if (violation.helpUrl)
|
|
16
|
+
violationHelpUrl = `You can find more information on this issue here:
|
|
17
|
+
${colorBlue(
|
|
18
|
+
violation.helpUrl
|
|
19
|
+
)}`;
|
|
20
|
+
return `${expectedText + colorGrey(node.html) + lineBreak}Received:${lineBreak}${printReceived(
|
|
21
|
+
`${violation.help} (${violation.id})`
|
|
22
|
+
)}${lineBreak}${colorYellow(
|
|
23
|
+
node.failureSummary
|
|
24
|
+
)}${lineBreak}${violationHelpUrl}`;
|
|
25
|
+
}).join(lineBreak);
|
|
26
|
+
return errorBody;
|
|
27
|
+
}).join(lineBreak + horizontalLine + lineBreak);
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
reporter
|
|
31
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const dataAttributeRegexp = /(data-[\S]*)=["']([\S]*)["']/gm;
|
|
2
|
+
const shouldIgnoreNodeViolation = (node, violation) => [...node.html.matchAll(dataAttributeRegexp)].map(([fullMatch, dataKey, dataValue]) => ({
|
|
3
|
+
fullMatch,
|
|
4
|
+
dataKey,
|
|
5
|
+
dataValue
|
|
6
|
+
})).some(
|
|
7
|
+
({ dataKey, dataValue }) => dataKey === `data-axe-ignore-${violation.id}` && dataValue === "true"
|
|
8
|
+
);
|
|
9
|
+
export {
|
|
10
|
+
shouldIgnoreNodeViolation
|
|
11
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getMessageAndPass } from "./getMessageAndPass.js";
|
|
2
|
+
import { shouldIgnoreNodeViolation } from "./shouldIgnoreNodeViolation.js";
|
|
3
|
+
const toHaveNoViolations = {
|
|
4
|
+
toHaveNoViolations(results) {
|
|
5
|
+
const { violations } = results;
|
|
6
|
+
const finalViolations = [];
|
|
7
|
+
violations.forEach((violation) => {
|
|
8
|
+
const { nodes } = violation;
|
|
9
|
+
const newNodes = [];
|
|
10
|
+
nodes.forEach((node) => {
|
|
11
|
+
if (!shouldIgnoreNodeViolation(node, violation))
|
|
12
|
+
newNodes.push(node);
|
|
13
|
+
});
|
|
14
|
+
if (newNodes.length > 0) {
|
|
15
|
+
finalViolations.push({ ...violation, nodes: newNodes });
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return { actual: violations, ...getMessageAndPass(finalViolations) };
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
toHaveNoViolations
|
|
23
|
+
};
|
|
@@ -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,7 @@
|
|
|
1
|
-
import "core-js/stable";
|
|
2
1
|
import "regenerator-runtime/runtime";
|
|
3
|
-
import "@testing-library/jest-dom/
|
|
4
|
-
import jestAxe from "jest-axe";
|
|
2
|
+
import "@testing-library/jest-dom/jest-globals";
|
|
5
3
|
import ResizeObserver from "resize-observer-polyfill";
|
|
4
|
+
import { toHaveNoViolations } from "./extended/axe-core";
|
|
6
5
|
import { addMatchMedia } from "./mocks/matchMedia.js";
|
|
7
6
|
import { logger } from "./mocks/pui-diagnostics.js";
|
|
8
7
|
const originalError = console.error;
|
|
@@ -25,7 +24,7 @@ console.error = (...args) => {
|
|
|
25
24
|
return originalError(...args);
|
|
26
25
|
};
|
|
27
26
|
if (expect)
|
|
28
|
-
expect.extend(
|
|
27
|
+
expect.extend(toHaveNoViolations);
|
|
29
28
|
const addElementToBody = (element) => {
|
|
30
29
|
const documentEle = (window || {}).document;
|
|
31
30
|
if (!documentEle)
|
|
@@ -49,3 +48,26 @@ window.emui = {
|
|
|
49
48
|
logger: logger(),
|
|
50
49
|
_BASE_PATH: new URL(document.baseURI).pathname
|
|
51
50
|
};
|
|
51
|
+
let showCorejsWarn = false;
|
|
52
|
+
afterAll(() => {
|
|
53
|
+
if (showCorejsWarn) {
|
|
54
|
+
console.warn(
|
|
55
|
+
`IMPORTANT: Try importing core-js/stable in your failed test files and retrying.
|
|
56
|
+
Some tests might have failed because of it`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const originalTest = global.test;
|
|
61
|
+
global.it = (name, fn, timeout = void 0) => {
|
|
62
|
+
const fnWrapper = async () => {
|
|
63
|
+
try {
|
|
64
|
+
await fn();
|
|
65
|
+
} catch (error) {
|
|
66
|
+
showCorejsWarn = true;
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
originalTest(name, fnWrapper, timeout);
|
|
71
|
+
};
|
|
72
|
+
global.it.skip = originalTest.skip;
|
|
73
|
+
global.it.only = originalTest.only;
|
|
@@ -2,26 +2,26 @@ import path from "node:path";
|
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { defineConfig, configDefaults } from "vitest/config";
|
|
4
4
|
import react from "@vitejs/plugin-react";
|
|
5
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
5
6
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
7
|
const vitestConfig = defineConfig({
|
|
7
|
-
plugins: [react()],
|
|
8
|
+
plugins: [react(), tsconfigPaths()],
|
|
8
9
|
test: {
|
|
9
10
|
globals: true,
|
|
10
11
|
root: process.cwd(),
|
|
11
|
-
environment: "
|
|
12
|
+
environment: "happy-dom",
|
|
12
13
|
setupFiles: [path.resolve(__dirname, "./setup-test-env.js")],
|
|
13
14
|
include: ["./{app,lib}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
|
14
15
|
exclude: [...configDefaults.exclude, ".idea", ".git", ".cache", "e2e"],
|
|
15
|
-
// watchIgnore: [
|
|
16
|
-
// '.*\\/node_modules\\/.*',
|
|
17
|
-
// '.*\\/build\\/.*',
|
|
18
|
-
// '.*\\/dist\\/.*',
|
|
19
|
-
// ],
|
|
20
16
|
coverage: {
|
|
21
17
|
reportsDirectory: "./reports/coverage"
|
|
22
18
|
},
|
|
23
19
|
deps: {
|
|
24
|
-
|
|
20
|
+
optimizer: {
|
|
21
|
+
web: {
|
|
22
|
+
include: ["app.config.json", "@elliemae/pui-app-sdk"]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
});
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
import fg from "fast-glob";
|
|
4
|
-
import { build } from "esbuild";
|
|
5
3
|
import { writeFile, copyFile, readFile, mkdir } from "node:fs/promises";
|
|
6
4
|
import browserslistToEsbuild from "browserslist-to-esbuild";
|
|
5
|
+
import fg from "fast-glob";
|
|
6
|
+
import { build } from "esbuild";
|
|
7
7
|
import lodashTransformer from "esbuild-plugin-lodash";
|
|
8
8
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
9
|
const TARGETS = {
|
|
10
10
|
browserslist: browserslistToEsbuild(),
|
|
11
|
-
web: "
|
|
12
|
-
node: "
|
|
11
|
+
web: "es2022",
|
|
12
|
+
node: "node20"
|
|
13
13
|
};
|
|
14
14
|
const ESBUILD_FORMAT = {
|
|
15
15
|
CJS: "cjs",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import updateNotifier from "update-notifier";
|
|
2
1
|
import path from "node:path";
|
|
3
2
|
import fs from "node:fs/promises";
|
|
3
|
+
import updateNotifier from "update-notifier";
|
|
4
4
|
const notifyUpdates = async () => {
|
|
5
5
|
const pkgFile = await fs.readFile(path.join(process.cwd(), "./package.json"));
|
|
6
6
|
const pkg = JSON.parse(pkgFile);
|
package/dist/esm/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
const basePath = (process.env.BASE_PATH
|
|
3
|
+
const basePath = (process.env.BASE_PATH ?? "/").replace(/\/?$/, "/");
|
|
4
4
|
const isApp = () => fs.existsSync(path.join(process.cwd(), "app"));
|
|
5
5
|
const getAppConfig = () => {
|
|
6
6
|
const appConfigPath = path.join(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import fs from "node:fs";
|
|
3
|
+
import zlib from "zlib";
|
|
3
4
|
import _ from "lodash";
|
|
4
5
|
import CompressionPlugin from "compression-webpack-plugin";
|
|
5
|
-
import zlib from "zlib";
|
|
6
6
|
import { findMonoRepoRoot } from "../monorepo/utils.js";
|
|
7
7
|
import { basePath, getAppConfig } from "../utils.js";
|
|
8
8
|
let pathSep = path.sep;
|
|
@@ -16,8 +16,8 @@ const excludeNodeModulesExcept = (modules) => {
|
|
|
16
16
|
const moduleRegExps = getNodeModulesRegEx(modules);
|
|
17
17
|
return function(modulePath) {
|
|
18
18
|
if (/node_modules/.test(modulePath)) {
|
|
19
|
-
for (
|
|
20
|
-
if (
|
|
19
|
+
for (const moduleRegExp of moduleRegExps)
|
|
20
|
+
if (moduleRegExp.test(modulePath))
|
|
21
21
|
return false;
|
|
22
22
|
return true;
|
|
23
23
|
}
|
|
@@ -32,7 +32,7 @@ const getLibraryName = () => {
|
|
|
32
32
|
const modifiedLibName = `emui-${libraryName.replace("@elliemae/", "").replace("pui-", "")}`;
|
|
33
33
|
return _.camelCase(modifiedLibName);
|
|
34
34
|
};
|
|
35
|
-
const getLibraryVariableName = () => (process.env.LIBRARY_VARIABLE_NAME
|
|
35
|
+
const getLibraryVariableName = () => (process.env.LIBRARY_VARIABLE_NAME ?? getLibraryName()).split(".");
|
|
36
36
|
const mapToFolder = (dependencies, folder) => dependencies.reduce(
|
|
37
37
|
(acc, dependency) => ({
|
|
38
38
|
[dependency]: path.resolve(`${folder}/${dependency.replace("$", "")}`),
|
|
@@ -41,7 +41,7 @@ const mapToFolder = (dependencies, folder) => dependencies.reduce(
|
|
|
41
41
|
{}
|
|
42
42
|
);
|
|
43
43
|
const getAlias = () => {
|
|
44
|
-
const monorepoRoot = findMonoRepoRoot(process.cwd())
|
|
44
|
+
const monorepoRoot = findMonoRepoRoot(process.cwd()) ?? "";
|
|
45
45
|
return mapToFolder(
|
|
46
46
|
[
|
|
47
47
|
"@babel/runtime",
|
|
@@ -55,6 +55,8 @@ const getAlias = () => {
|
|
|
55
55
|
"styled-components",
|
|
56
56
|
"immer",
|
|
57
57
|
"react-dates",
|
|
58
|
+
"react-select",
|
|
59
|
+
"react-spring",
|
|
58
60
|
"react-transition-group",
|
|
59
61
|
"@elliemae/pui-cli",
|
|
60
62
|
"@elliemae/pui-app-sdk$",
|
|
@@ -63,6 +65,15 @@ const getAlias = () => {
|
|
|
63
65
|
path.join(monorepoRoot, "./node_modules")
|
|
64
66
|
);
|
|
65
67
|
};
|
|
68
|
+
const getLibraryAlias = (name, alias) => {
|
|
69
|
+
const monorepoRoot = findMonoRepoRoot(process.cwd()) ?? "";
|
|
70
|
+
const aliasPath = path.resolve(
|
|
71
|
+
`${path.join(monorepoRoot, "./node_modules")}/${alias}`
|
|
72
|
+
);
|
|
73
|
+
return {
|
|
74
|
+
[name]: aliasPath
|
|
75
|
+
};
|
|
76
|
+
};
|
|
66
77
|
const modulesToTranspile = [
|
|
67
78
|
"@elliemae/pui-*",
|
|
68
79
|
"@elliemae/ds-*",
|
|
@@ -125,7 +136,7 @@ const getAppVersion = () => {
|
|
|
125
136
|
if (!process.env.APP_VERSION)
|
|
126
137
|
return LATEST_VERSION;
|
|
127
138
|
const match = process.env.APP_VERSION.match(/^v?(\d+\.\d+)\..*$/);
|
|
128
|
-
return match
|
|
139
|
+
return match?.[1] ?? LATEST_VERSION;
|
|
129
140
|
};
|
|
130
141
|
const getPaths = (latestVersion = true) => {
|
|
131
142
|
const version = latestVersion ? LATEST_VERSION : getAppVersion();
|
|
@@ -160,9 +171,9 @@ const getCompressionPlugins = (isLibrary = false) => {
|
|
|
160
171
|
];
|
|
161
172
|
const commonConfig = {
|
|
162
173
|
test: /\.(js|css)$/,
|
|
163
|
-
exclude: !isLibrary ? excludeList : [],
|
|
164
174
|
// 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
|
|
165
|
-
minRatio: Infinity
|
|
175
|
+
minRatio: Infinity,
|
|
176
|
+
...!isLibrary ? { exclude: excludeList } : {}
|
|
166
177
|
};
|
|
167
178
|
return [
|
|
168
179
|
new CompressionPlugin({
|
|
@@ -202,6 +213,7 @@ export {
|
|
|
202
213
|
getAlias,
|
|
203
214
|
getAppVersion,
|
|
204
215
|
getCompressionPlugins,
|
|
216
|
+
getLibraryAlias,
|
|
205
217
|
getLibraryName,
|
|
206
218
|
getLibraryVariableName,
|
|
207
219
|
getMediaPath,
|