@elliemae/pui-cli 9.0.0-next.5 → 9.0.0-next.50
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/babel.config.cjs +1 -1
- package/dist/cjs/cli.js +2 -2
- package/dist/cjs/commands/build.js +4 -6
- package/dist/cjs/commands/codemod.js +1 -1
- package/dist/cjs/commands/gendoc.js +2 -2
- package/dist/cjs/commands/lint.js +28 -11
- package/dist/cjs/commands/pack.js +3 -4
- package/dist/cjs/commands/start.js +3 -3
- package/dist/cjs/commands/storybook.js +1 -1
- package/dist/cjs/commands/test.js +46 -23
- package/dist/cjs/commands/tscheck.js +3 -3
- package/dist/cjs/commands/utils.js +37 -10
- package/dist/cjs/commands/version.js +1 -1
- package/dist/cjs/commands/vitest.js +6 -11
- 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/lint-staged.config.js +2 -2
- package/dist/cjs/lint-config/stylelint.config.js +45 -0
- package/dist/cjs/monorepo/delete-merged-tags.js +2 -3
- package/dist/cjs/monorepo/set-registry-version.js +3 -3
- package/dist/cjs/monorepo/set-workspace-version.js +3 -3
- package/dist/cjs/monorepo/utils.js +1 -1
- package/dist/cjs/pui-config.js +5 -6
- package/dist/cjs/release.config.js +46 -0
- package/dist/cjs/server/appRoutes.js +5 -8
- package/dist/cjs/server/csp.js +6 -5
- package/dist/cjs/server/index.js +6 -1
- package/dist/cjs/server/logger.js +2 -2
- package/dist/cjs/server/middlewares.js +5 -5
- package/dist/cjs/server/utils.js +12 -5
- package/dist/cjs/server/wsServer.js +125 -0
- package/dist/cjs/testing/ExtendedJSDomEnv.cjs +27 -0
- package/dist/cjs/testing/extended/axe-core/getMessageAndPass.js +36 -0
- package/dist/cjs/testing/extended/axe-core/index.js +24 -0
- package/dist/cjs/testing/extended/axe-core/reporter.js +50 -0
- package/dist/cjs/testing/extended/axe-core/shouldIgnoreNodeViolation.js +31 -0
- package/dist/cjs/testing/extended/axe-core/toHaveNoViolations.js +42 -0
- package/dist/cjs/testing/jest.config.cjs +6 -2
- package/dist/cjs/testing/jest.polyfills.cjs +30 -0
- package/dist/cjs/testing/mocks/svg.js +1 -1
- package/dist/cjs/testing/setup-react-env.js +1 -1
- package/dist/cjs/testing/setup-test-env.js +0 -2
- package/dist/cjs/testing/setup-tests.js +30 -12
- package/dist/cjs/testing/vitest.config.js +10 -10
- package/dist/cjs/transpile/.swcrc +1 -1
- package/dist/cjs/transpile/esbuild.js +48 -15
- package/dist/cjs/transpile/react-shim.js +1 -1
- package/dist/cjs/update-notifier.js +3 -3
- package/dist/cjs/utils.js +4 -5
- package/dist/cjs/webpack/helpers.js +29 -23
- package/dist/cjs/webpack/webpack.base.babel.js +21 -35
- package/dist/cjs/webpack/webpack.dev.babel.js +20 -10
- package/dist/cjs/webpack/webpack.lib.base.babel.js +22 -13
- package/dist/cjs/webpack/webpack.lib.dev.babel.js +14 -18
- package/dist/cjs/webpack/webpack.lib.prod.babel.js +12 -11
- package/dist/cjs/webpack/webpack.prod.babel.js +8 -8
- package/dist/cjs/webpack/webpack.storybook.js +15 -17
- package/dist/esm/babel.config.cjs +1 -1
- package/dist/esm/commands/build.js +2 -4
- package/dist/esm/commands/lint.js +27 -9
- package/dist/esm/commands/pack.js +1 -2
- package/dist/esm/commands/start.js +1 -1
- package/dist/esm/commands/test.js +45 -22
- package/dist/esm/commands/utils.js +33 -6
- package/dist/esm/commands/vitest.js +5 -10
- 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 +2 -3
- 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 +2 -3
- package/dist/esm/release.config.js +26 -0
- package/dist/esm/server/appRoutes.js +3 -6
- 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 +95 -0
- package/dist/esm/testing/ExtendedJSDomEnv.cjs +27 -0
- package/dist/esm/testing/extended/axe-core/getMessageAndPass.js +16 -0
- package/dist/esm/testing/extended/axe-core/index.js +4 -0
- package/dist/esm/testing/extended/axe-core/reporter.js +30 -0
- package/dist/esm/testing/extended/axe-core/shouldIgnoreNodeViolation.js +11 -0
- package/dist/esm/testing/extended/axe-core/toHaveNoViolations.js +22 -0
- package/dist/esm/testing/jest.config.cjs +6 -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 +29 -11
- package/dist/esm/testing/vitest.config.js +8 -8
- package/dist/esm/transpile/.swcrc +1 -1
- package/dist/esm/transpile/esbuild.js +45 -12
- package/dist/esm/update-notifier.js +1 -1
- package/dist/esm/utils.js +2 -3
- package/dist/esm/webpack/helpers.js +25 -19
- package/dist/esm/webpack/webpack.base.babel.js +13 -27
- package/dist/esm/webpack/webpack.dev.babel.js +13 -3
- package/dist/esm/webpack/webpack.lib.base.babel.js +14 -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 +4 -4
- package/dist/esm/webpack/webpack.storybook.js +12 -14
- 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 +45 -0
- package/dist/types/{testing → lib/testing}/jest.node.config.d.cts +4 -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 +209 -193
- 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
|
@@ -32,10 +32,10 @@ __export(set_workspace_version_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(set_workspace_version_exports);
|
|
34
34
|
var import_promises = require("node:fs/promises");
|
|
35
|
-
var import_fast_glob = __toESM(require("fast-glob")
|
|
36
|
-
var import_normalize_path = __toESM(require("normalize-path")
|
|
35
|
+
var import_fast_glob = __toESM(require("fast-glob"));
|
|
36
|
+
var import_normalize_path = __toESM(require("normalize-path"));
|
|
37
37
|
var import_utils = require("./utils.js");
|
|
38
|
-
const monorepoRoot = (0, import_normalize_path.default)((0, import_utils.findMonoRepoRoot)()
|
|
38
|
+
const monorepoRoot = (0, import_normalize_path.default)((0, import_utils.findMonoRepoRoot)() ?? "");
|
|
39
39
|
const setWorkspaceVersion = async () => {
|
|
40
40
|
const files = await (0, import_fast_glob.default)([
|
|
41
41
|
`${monorepoRoot}/libs/*/package.json`,
|
|
@@ -31,7 +31,7 @@ __export(utils_exports, {
|
|
|
31
31
|
findMonoRepoRoot: () => findMonoRepoRoot
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(utils_exports);
|
|
34
|
-
var import_node_path = __toESM(require("node:path")
|
|
34
|
+
var import_node_path = __toESM(require("node:path"));
|
|
35
35
|
var import_child_process = require("child_process");
|
|
36
36
|
const WORKSPACE_DIR_ENV_VAR = "NPM_CONFIG_WORKSPACE_DIR";
|
|
37
37
|
const WORKSPACE_MANIFEST_FILENAME = "pnpm-workspace.yaml";
|
package/dist/cjs/pui-config.js
CHANGED
|
@@ -31,18 +31,17 @@ __export(pui_config_exports, {
|
|
|
31
31
|
getPUIConfig: () => getPUIConfig
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(pui_config_exports);
|
|
34
|
-
var import_node_path = __toESM(require("node:path")
|
|
35
|
-
var import_node_fs = __toESM(require("node:fs")
|
|
36
|
-
var import_merge = __toESM(require("lodash/merge")
|
|
34
|
+
var import_node_path = __toESM(require("node:path"));
|
|
35
|
+
var import_node_fs = __toESM(require("node:fs"));
|
|
36
|
+
var import_merge = __toESM(require("lodash/merge"));
|
|
37
37
|
const baseConfig = {
|
|
38
38
|
esBuild: {
|
|
39
|
-
target: "
|
|
39
|
+
target: "es2022"
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
const getPUIConfig = () => {
|
|
43
43
|
const configPath = import_node_path.default.resolve(process.cwd(), "./pui.config.js");
|
|
44
|
-
if (!import_node_fs.default.existsSync(configPath))
|
|
45
|
-
return baseConfig;
|
|
44
|
+
if (!import_node_fs.default.existsSync(configPath)) return baseConfig;
|
|
46
45
|
const config = JSON.parse(import_node_fs.default.readFileSync(configPath, "utf8"));
|
|
47
46
|
return (0, import_merge.default)(baseConfig, config);
|
|
48
47
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
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 release_config_exports = {};
|
|
20
|
+
__export(release_config_exports, {
|
|
21
|
+
default: () => release_config_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(release_config_exports);
|
|
24
|
+
var release_config_default = {
|
|
25
|
+
branches: [
|
|
26
|
+
"+([0-9])?(.{+([0-9]),x}).x",
|
|
27
|
+
"master",
|
|
28
|
+
"next-major",
|
|
29
|
+
{ name: "beta", prerelease: true },
|
|
30
|
+
{ name: "alpha", prerelease: true },
|
|
31
|
+
{ name: "hotfix", prerelease: true },
|
|
32
|
+
{ name: "next", prerelease: true }
|
|
33
|
+
],
|
|
34
|
+
plugins: [
|
|
35
|
+
"@semantic-release/commit-analyzer",
|
|
36
|
+
"@semantic-release/release-notes-generator",
|
|
37
|
+
[
|
|
38
|
+
"@semantic-release/changelog",
|
|
39
|
+
{
|
|
40
|
+
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."
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"@semantic-release/npm",
|
|
44
|
+
"@semantic-release/github"
|
|
45
|
+
]
|
|
46
|
+
};
|
|
@@ -31,22 +31,20 @@ __export(appRoutes_exports, {
|
|
|
31
31
|
loadRoutes: () => loadRoutes
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(appRoutes_exports);
|
|
34
|
-
var import_node_fs = __toESM(require("node:fs")
|
|
35
|
-
var import_node_path = __toESM(require("node:path")
|
|
34
|
+
var import_node_fs = __toESM(require("node:fs"));
|
|
35
|
+
var import_node_path = __toESM(require("node:path"));
|
|
36
36
|
var import_node_url = require("node:url");
|
|
37
37
|
const allJS = /\.js$/;
|
|
38
38
|
const serviceEndpoints = /\.endpoint\.js$/;
|
|
39
39
|
const getFilesMatching = (filePattern) => {
|
|
40
40
|
const getFiles = (dir) => {
|
|
41
41
|
let routeFiles = [];
|
|
42
|
-
if (!import_node_fs.default.existsSync(dir))
|
|
43
|
-
return routeFiles;
|
|
42
|
+
if (!import_node_fs.default.existsSync(dir)) return routeFiles;
|
|
44
43
|
import_node_fs.default.readdirSync(dir).forEach((file) => {
|
|
45
44
|
const fullPath = import_node_path.default.join(dir, file);
|
|
46
45
|
if (import_node_fs.default.lstatSync(fullPath).isDirectory()) {
|
|
47
46
|
routeFiles = routeFiles.concat(getFiles(fullPath));
|
|
48
|
-
} else if (filePattern.test(fullPath))
|
|
49
|
-
routeFiles.push(fullPath);
|
|
47
|
+
} else if (filePattern.test(fullPath)) routeFiles.push(fullPath);
|
|
50
48
|
});
|
|
51
49
|
return routeFiles;
|
|
52
50
|
};
|
|
@@ -65,8 +63,7 @@ const loadRoutes = async (app) => {
|
|
|
65
63
|
const routeFileURL = (0, import_node_url.pathToFileURL)(routeFile).href;
|
|
66
64
|
const { default: init } = await import(routeFileURL);
|
|
67
65
|
try {
|
|
68
|
-
if (typeof init === "function")
|
|
69
|
-
init(app);
|
|
66
|
+
if (typeof init === "function") init(app);
|
|
70
67
|
} catch (err) {
|
|
71
68
|
console.error(
|
|
72
69
|
`unable to load routes from ${routeFile}. ${err.message}`
|
package/dist/cjs/server/csp.js
CHANGED
|
@@ -32,15 +32,16 @@ __export(csp_exports, {
|
|
|
32
32
|
sendFileWithCSPNonce: () => sendFileWithCSPNonce
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(csp_exports);
|
|
35
|
-
var import_node_fs = __toESM(require("node:fs")
|
|
36
|
-
var import_node_path = __toESM(require("node:path")
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var
|
|
35
|
+
var import_node_fs = __toESM(require("node:fs"));
|
|
36
|
+
var import_node_path = __toESM(require("node:path"));
|
|
37
|
+
var import_crypto = __toESM(require("crypto"));
|
|
38
|
+
var import_express = __toESM(require("express"));
|
|
39
|
+
var import_helmet_csp = __toESM(require("helmet-csp"));
|
|
40
40
|
const CSP_REPORT_URI = "/diagnostics/v1/csp";
|
|
41
41
|
const sources = [
|
|
42
42
|
"'self'",
|
|
43
43
|
"http://localhost:*",
|
|
44
|
+
"ws://localhost:*",
|
|
44
45
|
"*.elliemae.io",
|
|
45
46
|
"*.elliemae.com",
|
|
46
47
|
"*.elliservices.com",
|
package/dist/cjs/server/index.js
CHANGED
|
@@ -21,11 +21,12 @@ 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_express = __toESM(require("express")
|
|
24
|
+
var import_express = __toESM(require("express"));
|
|
25
25
|
var import_logger = require("./logger.js");
|
|
26
26
|
var import_middlewares = require("./middlewares.js");
|
|
27
27
|
var import_utils = require("./utils.js");
|
|
28
28
|
var import_appRoutes = require("./appRoutes.js");
|
|
29
|
+
var import_wsServer = require("./wsServer.js");
|
|
29
30
|
(async function startServer() {
|
|
30
31
|
const app = (0, import_express.default)();
|
|
31
32
|
(0, import_middlewares.setupDefaultMiddlewares)(app);
|
|
@@ -37,4 +38,8 @@ var import_appRoutes = require("./appRoutes.js");
|
|
|
37
38
|
import_logger.logger.error(err);
|
|
38
39
|
process.exit(1);
|
|
39
40
|
});
|
|
41
|
+
const { wsServer } = await (0, import_wsServer.createWSServer)({
|
|
42
|
+
port: import_utils.wsPort
|
|
43
|
+
});
|
|
44
|
+
app.locals.wsServer = wsServer;
|
|
40
45
|
})();
|
|
@@ -31,8 +31,8 @@ __export(logger_exports, {
|
|
|
31
31
|
logger: () => logger
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(logger_exports);
|
|
34
|
-
var import_chalk = __toESM(require("chalk")
|
|
35
|
-
var import_ip = __toESM(require("ip")
|
|
34
|
+
var import_chalk = __toESM(require("chalk"));
|
|
35
|
+
var import_ip = __toESM(require("ip"));
|
|
36
36
|
const divider = import_chalk.default.gray("\n-----------------------------------");
|
|
37
37
|
const logger = {
|
|
38
38
|
// Called whenever there's an error on the server we want to print
|
|
@@ -32,11 +32,11 @@ __export(middlewares_exports, {
|
|
|
32
32
|
setupDefaultMiddlewares: () => setupDefaultMiddlewares
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(middlewares_exports);
|
|
35
|
-
var import_express = __toESM(require("express")
|
|
36
|
-
var import_cors = __toESM(require("cors")
|
|
37
|
-
var import_compression = __toESM(require("compression")
|
|
38
|
-
var import_express_static_gzip = __toESM(require("express-static-gzip")
|
|
39
|
-
var import_pino_http = __toESM(require("pino-http")
|
|
35
|
+
var import_express = __toESM(require("express"));
|
|
36
|
+
var import_cors = __toESM(require("cors"));
|
|
37
|
+
var import_compression = __toESM(require("compression"));
|
|
38
|
+
var import_express_static_gzip = __toESM(require("express-static-gzip"));
|
|
39
|
+
var import_pino_http = __toESM(require("pino-http"));
|
|
40
40
|
var import_csp = require("./csp.js");
|
|
41
41
|
var import_helpers = require("../webpack/helpers.js");
|
|
42
42
|
const paths = (0, import_helpers.getPaths)();
|
package/dist/cjs/server/utils.js
CHANGED
|
@@ -30,14 +30,21 @@ var utils_exports = {};
|
|
|
30
30
|
__export(utils_exports, {
|
|
31
31
|
getCWD: () => getCWD,
|
|
32
32
|
host: () => host,
|
|
33
|
-
port: () => port
|
|
33
|
+
port: () => port,
|
|
34
|
+
wsPort: () => wsPort
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(utils_exports);
|
|
36
|
-
var import_minimist = __toESM(require("minimist")
|
|
37
|
-
const argv = (0, import_minimist.default)(
|
|
37
|
+
var import_minimist = __toESM(require("minimist"));
|
|
38
|
+
const argv = (0, import_minimist.default)(
|
|
39
|
+
process.argv.slice(2)
|
|
40
|
+
);
|
|
38
41
|
const getCWD = () => process.cwd();
|
|
39
42
|
const port = parseInt(
|
|
40
|
-
argv.port
|
|
43
|
+
argv.port ?? process.env.port ?? process.env.PORT ?? "3000",
|
|
44
|
+
10
|
|
45
|
+
);
|
|
46
|
+
const host = argv.host ?? process.env.HOST ?? "localhost";
|
|
47
|
+
const wsPort = parseInt(
|
|
48
|
+
argv.wsport ?? process.env.wsport ?? process.env.WSPORT ?? "5000",
|
|
41
49
|
10
|
|
42
50
|
);
|
|
43
|
-
const host = argv.host || process.env.HOST || "localhost";
|
|
@@ -0,0 +1,125 @@
|
|
|
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"));
|
|
35
|
+
var wsLib = __toESM(require("ws"));
|
|
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) cb(4401);
|
|
43
|
+
else cb();
|
|
44
|
+
};
|
|
45
|
+
const getAuthToken = (protocols) => {
|
|
46
|
+
const authProtocol = protocols.find(
|
|
47
|
+
(protocol) => protocol.startsWith("auth--")
|
|
48
|
+
);
|
|
49
|
+
if (!authProtocol) return "";
|
|
50
|
+
return authProtocol.split("--")[1]?.trim?.();
|
|
51
|
+
};
|
|
52
|
+
const createWSServer = ({
|
|
53
|
+
port = DEFAULT_PORT,
|
|
54
|
+
pingInterval = PING_INTERVAL,
|
|
55
|
+
onOpen
|
|
56
|
+
}) => {
|
|
57
|
+
let isAlive = false;
|
|
58
|
+
const heartbeat = () => {
|
|
59
|
+
isAlive = true;
|
|
60
|
+
};
|
|
61
|
+
const httpServer = import_node_http.default.createServer();
|
|
62
|
+
const wsServer = new wsLib.WebSocketServer({ noServer: true });
|
|
63
|
+
httpServer.on("upgrade", (req, socket, head) => {
|
|
64
|
+
socket.on("error", onSocketError);
|
|
65
|
+
wsServer.handleUpgrade(req, socket, head, (ws) => {
|
|
66
|
+
const protocols = req.headers["sec-websocket-protocol"]?.split(",");
|
|
67
|
+
if (!protocols) {
|
|
68
|
+
console.error("no protocols");
|
|
69
|
+
ws.close(4401, "unauthorized");
|
|
70
|
+
socket.destroy();
|
|
71
|
+
socket.removeListener("error", onSocketError);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
authenticate(getAuthToken(protocols) || "", (errCode) => {
|
|
75
|
+
if (errCode) {
|
|
76
|
+
switch (errCode) {
|
|
77
|
+
case 4401:
|
|
78
|
+
ws.close(errCode, "unauthorized");
|
|
79
|
+
break;
|
|
80
|
+
default:
|
|
81
|
+
ws.close(4400, "Unknown error");
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
socket.destroy();
|
|
85
|
+
socket.removeListener("error", onSocketError);
|
|
86
|
+
} else {
|
|
87
|
+
socket.removeListener("error", onSocketError);
|
|
88
|
+
wsServer.emit("connection", ws, req);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
wsServer.on("connection", (ws) => {
|
|
94
|
+
isAlive = true;
|
|
95
|
+
ws.on("error", console.error);
|
|
96
|
+
ws.on("pong", () => {
|
|
97
|
+
heartbeat();
|
|
98
|
+
});
|
|
99
|
+
ws.on("message", (message) => {
|
|
100
|
+
console.log(
|
|
101
|
+
"message from client:",
|
|
102
|
+
JSON.parse(message)
|
|
103
|
+
);
|
|
104
|
+
ws.send(JSON.stringify(JSON.parse(message)));
|
|
105
|
+
});
|
|
106
|
+
console.log("client connected");
|
|
107
|
+
onOpen?.(ws);
|
|
108
|
+
});
|
|
109
|
+
const interval = setInterval(() => {
|
|
110
|
+
wsServer.clients.forEach((ws) => {
|
|
111
|
+
if (isAlive === false) ws.terminate();
|
|
112
|
+
isAlive = false;
|
|
113
|
+
ws.ping();
|
|
114
|
+
});
|
|
115
|
+
}, pingInterval);
|
|
116
|
+
wsServer.on("close", function close() {
|
|
117
|
+
clearInterval(interval);
|
|
118
|
+
});
|
|
119
|
+
return new Promise((resolve) => {
|
|
120
|
+
httpServer.listen(port, () => {
|
|
121
|
+
console.log(`Websocket server listening on port ${port}`);
|
|
122
|
+
return resolve({ httpServer, wsServer });
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
};
|
|
@@ -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,36 @@
|
|
|
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) return { message: () => "", pass };
|
|
30
|
+
return {
|
|
31
|
+
message: () => `${(0, import_jest_matcher_utils.matcherHint)(".toHaveNoViolations")}
|
|
32
|
+
|
|
33
|
+
${formatedViolations}`,
|
|
34
|
+
pass
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -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,50 @@
|
|
|
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) return "";
|
|
30
|
+
const lineBreak = "\n\n";
|
|
31
|
+
const horizontalLine = "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
|
|
32
|
+
return violToFormat.map((violation) => {
|
|
33
|
+
const errorBody = violation.nodes.map((node) => {
|
|
34
|
+
const selector = node.target.join(", ");
|
|
35
|
+
const expectedText = `Expected the HTML found at $('${selector}') to have no violations:${lineBreak}`;
|
|
36
|
+
let violationHelpUrl = "";
|
|
37
|
+
if (violation.helpUrl)
|
|
38
|
+
violationHelpUrl = `You can find more information on this issue here:
|
|
39
|
+
${colorBlue(
|
|
40
|
+
violation.helpUrl
|
|
41
|
+
)}`;
|
|
42
|
+
return `${expectedText + colorGrey(node.html) + lineBreak}Received:${lineBreak}${(0, import_jest_matcher_utils.printReceived)(
|
|
43
|
+
`${violation.help} (${violation.id})`
|
|
44
|
+
)}${lineBreak}${colorYellow(
|
|
45
|
+
node.failureSummary
|
|
46
|
+
)}${lineBreak}${violationHelpUrl}`;
|
|
47
|
+
}).join(lineBreak);
|
|
48
|
+
return errorBody;
|
|
49
|
+
}).join(lineBreak + horizontalLine + lineBreak);
|
|
50
|
+
};
|
|
@@ -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,42 @@
|
|
|
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)) newNodes.push(node);
|
|
35
|
+
});
|
|
36
|
+
if (newNodes.length > 0) {
|
|
37
|
+
finalViolations.push({ ...violation, nodes: newNodes });
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return { actual: violations, ...(0, import_getMessageAndPass.getMessageAndPass)(finalViolations) };
|
|
41
|
+
}
|
|
42
|
+
};
|
|
@@ -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,13 +93,15 @@ 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',
|
|
99
102
|
],
|
|
100
103
|
testTimeout: 5000,
|
|
104
|
+
prettierPath: null,
|
|
101
105
|
};
|
|
102
106
|
|
|
103
107
|
if (isReactModule && jestConfig.setupFilesAfterEnv)
|
|
@@ -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
|
+
});
|