@elliemae/pui-cli 9.0.0-next.5 → 9.0.0-next.51
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 +3 -1
- package/dist/cjs/babel.config.js +99 -0
- 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 +27 -10
- 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 -16
- package/dist/cjs/index.js +13 -11
- package/dist/cjs/lint-config/commitlint.config.js +26 -0
- package/dist/cjs/lint-config/eslint/config.js +186 -0
- package/dist/cjs/lint-config/eslint/react.js +107 -0
- package/dist/cjs/lint-config/eslint/typescript/config.js +97 -0
- package/dist/cjs/lint-config/lint-staged.config.js +2 -2
- package/dist/cjs/lint-config/prettier.config.js +31 -0
- 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.js +79 -0
- package/dist/esm/commands/build.js +2 -4
- package/dist/esm/commands/lint.js +26 -8
- 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 -16
- package/dist/esm/index.js +13 -11
- package/dist/esm/lint-config/commitlint.config.js +6 -0
- package/dist/esm/lint-config/eslint/config.js +155 -0
- package/dist/esm/lint-config/eslint/react.js +76 -0
- package/dist/esm/lint-config/eslint/typescript/config.js +67 -0
- package/dist/esm/lint-config/{prettier.config.cjs → prettier.config.js} +5 -2
- 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 +3 -0
- package/dist/types/docusaurus.config.d.ts.map +1 -0
- package/dist/types/{babel.config.d.cts → lib/babel.config.d.ts} +9 -9
- package/dist/types/lib/babel.config.d.ts.map +1 -0
- package/dist/types/lib/cli.d.ts +3 -0
- package/dist/types/lib/cli.d.ts.map +1 -0
- package/dist/types/{commands → lib/commands}/build.d.ts +3 -2
- package/dist/types/lib/commands/build.d.ts.map +1 -0
- package/dist/types/{commands → lib/commands}/codemod.d.ts +3 -2
- package/dist/types/lib/commands/codemod.d.ts.map +1 -0
- package/dist/types/{commands → lib/commands}/gendoc.d.ts +1 -0
- package/dist/types/lib/commands/gendoc.d.ts.map +1 -0
- package/dist/types/{commands → lib/commands}/lint.d.ts +4 -2
- package/dist/types/lib/commands/lint.d.ts.map +1 -0
- package/dist/types/{commands → lib/commands}/pack.d.ts +3 -2
- package/dist/types/lib/commands/pack.d.ts.map +1 -0
- package/dist/types/{commands → lib/commands}/start.d.ts +3 -2
- package/dist/types/lib/commands/start.d.ts.map +1 -0
- package/dist/types/{commands → lib/commands}/storybook.d.ts +3 -2
- package/dist/types/lib/commands/storybook.d.ts.map +1 -0
- package/dist/types/{commands → lib/commands}/test.d.ts +5 -2
- package/dist/types/lib/commands/test.d.ts.map +1 -0
- package/dist/types/{commands → lib/commands}/tscheck.d.ts +3 -2
- package/dist/types/lib/commands/tscheck.d.ts.map +1 -0
- package/dist/types/lib/commands/utils.d.ts +39 -0
- package/dist/types/lib/commands/utils.d.ts.map +1 -0
- package/dist/types/{commands → lib/commands}/version.d.ts +3 -2
- package/dist/types/lib/commands/version.d.ts.map +1 -0
- package/dist/types/{commands → lib/commands}/vitest.d.ts +3 -2
- package/dist/types/lib/commands/vitest.d.ts.map +1 -0
- package/dist/types/lib/index.d.cts +4 -0
- package/dist/types/lib/index.d.cts.map +1 -0
- package/dist/types/{index.d.ts → lib/index.d.ts} +11 -8
- package/dist/types/lib/index.d.ts.map +1 -0
- package/dist/types/lib/lint-config/commitlint.config.d.ts +5 -0
- package/dist/types/lib/lint-config/commitlint.config.d.ts.map +1 -0
- package/dist/types/lib/lint-config/eslint/config.d.ts +2 -0
- package/dist/types/lib/lint-config/eslint/config.d.ts.map +1 -0
- package/dist/types/lib/lint-config/eslint/react.d.ts +2 -0
- package/dist/types/lib/lint-config/eslint/react.d.ts.map +1 -0
- package/dist/types/lib/lint-config/eslint/typescript/config.d.ts +2 -0
- package/dist/types/lib/lint-config/eslint/typescript/config.d.ts.map +1 -0
- package/dist/types/{lint-config → lib/lint-config}/lint-staged.config.d.ts +1 -0
- package/dist/types/lib/lint-config/lint-staged.config.d.ts.map +1 -0
- package/dist/types/lib/lint-config/prettier.config.d.ts +3 -0
- package/dist/types/lib/lint-config/prettier.config.d.ts.map +1 -0
- package/dist/types/lib/lint-config/stylelint.config.d.ts +14 -0
- package/dist/types/lib/lint-config/stylelint.config.d.ts.map +1 -0
- package/dist/types/{monorepo → lib/monorepo}/delete-merged-tags.d.ts +1 -0
- package/dist/types/lib/monorepo/delete-merged-tags.d.ts.map +1 -0
- package/dist/types/{monorepo → lib/monorepo}/set-registry-version.d.ts +1 -0
- package/dist/types/lib/monorepo/set-registry-version.d.ts.map +1 -0
- package/dist/types/{monorepo → lib/monorepo}/set-workspace-version.d.ts +1 -0
- package/dist/types/lib/monorepo/set-workspace-version.d.ts.map +1 -0
- package/dist/types/{monorepo → lib/monorepo}/utils.d.cts +1 -0
- package/dist/types/lib/monorepo/utils.d.cts.map +1 -0
- package/dist/types/{monorepo → lib/monorepo}/utils.d.ts +1 -0
- package/dist/types/lib/monorepo/utils.d.ts.map +1 -0
- package/dist/types/lib/pui-config.d.ts +2 -0
- package/dist/types/lib/pui-config.d.ts.map +1 -0
- package/dist/types/lib/release.config.d.ts +11 -0
- package/dist/types/lib/release.config.d.ts.map +1 -0
- package/dist/types/{server → lib/server}/appRoutes.d.ts +1 -0
- package/dist/types/lib/server/appRoutes.d.ts.map +1 -0
- package/dist/types/{server → lib/server}/csp.d.ts +3 -2
- package/dist/types/lib/server/csp.d.ts.map +1 -0
- package/dist/types/lib/server/index.d.ts +2 -0
- package/dist/types/lib/server/index.d.ts.map +1 -0
- package/dist/types/{server → lib/server}/logger.d.ts +1 -0
- package/dist/types/lib/server/logger.d.ts.map +1 -0
- package/dist/types/{server → lib/server}/middlewares.d.ts +1 -0
- package/dist/types/lib/server/middlewares.d.ts.map +1 -0
- package/dist/types/{server → lib/server}/utils.d.ts +2 -0
- package/dist/types/lib/server/utils.d.ts.map +1 -0
- package/dist/types/lib/server/wsServer.d.ts +14 -0
- package/dist/types/lib/server/wsServer.d.ts.map +1 -0
- package/dist/types/lib/testing/ExtendedJSDomEnv.d.cts +6 -0
- package/dist/types/lib/testing/ExtendedJSDomEnv.d.cts.map +1 -0
- package/dist/types/lib/testing/extended/axe-core/getMessageAndPass.d.ts +9 -0
- package/dist/types/lib/testing/extended/axe-core/getMessageAndPass.d.ts.map +1 -0
- package/dist/types/lib/testing/extended/axe-core/index.d.ts +2 -0
- package/dist/types/lib/testing/extended/axe-core/index.d.ts.map +1 -0
- package/dist/types/lib/testing/extended/axe-core/reporter.d.ts +3 -0
- package/dist/types/lib/testing/extended/axe-core/reporter.d.ts.map +1 -0
- package/dist/types/lib/testing/extended/axe-core/shouldIgnoreNodeViolation.d.ts +3 -0
- package/dist/types/lib/testing/extended/axe-core/shouldIgnoreNodeViolation.d.ts.map +1 -0
- package/dist/types/lib/testing/extended/axe-core/toHaveNoViolations.d.ts +13 -0
- package/dist/types/lib/testing/extended/axe-core/toHaveNoViolations.d.ts.map +1 -0
- package/dist/types/lib/testing/jest.config.d.cts +46 -0
- package/dist/types/lib/testing/jest.config.d.cts.map +1 -0
- package/dist/types/{testing → lib/testing}/jest.node.config.d.cts +5 -0
- package/dist/types/lib/testing/jest.node.config.d.cts.map +1 -0
- package/dist/types/lib/testing/jest.polyfills.d.cts +2 -0
- package/dist/types/lib/testing/jest.polyfills.d.cts.map +1 -0
- package/dist/types/lib/testing/mocks/axios.d.ts +18 -0
- package/dist/types/lib/testing/mocks/axios.d.ts.map +1 -0
- package/dist/types/{testing → lib/testing}/mocks/cssModule.d.ts +1 -0
- package/dist/types/lib/testing/mocks/cssModule.d.ts.map +1 -0
- package/dist/types/{testing → lib/testing}/mocks/html.d.ts +1 -0
- package/dist/types/lib/testing/mocks/html.d.ts.map +1 -0
- package/dist/types/{testing → lib/testing}/mocks/image.d.ts +1 -0
- package/dist/types/lib/testing/mocks/image.d.ts.map +1 -0
- package/dist/types/lib/testing/mocks/matchMedia.d.ts +2 -0
- package/dist/types/lib/testing/mocks/matchMedia.d.ts.map +1 -0
- package/dist/types/lib/testing/mocks/pui-app-loader.d.ts +2 -0
- package/dist/types/lib/testing/mocks/pui-app-loader.d.ts.map +1 -0
- package/dist/types/{testing → lib/testing}/mocks/pui-diagnostics.d.ts +14 -13
- package/dist/types/lib/testing/mocks/pui-diagnostics.d.ts.map +1 -0
- package/dist/types/{testing → lib/testing}/mocks/pui-user-monitoring.d.ts +1 -0
- package/dist/types/lib/testing/mocks/pui-user-monitoring.d.ts.map +1 -0
- package/dist/types/{testing → lib/testing}/mocks/retry-axios.d.ts +1 -0
- package/dist/types/lib/testing/mocks/retry-axios.d.ts.map +1 -0
- package/dist/types/{testing → lib/testing}/mocks/svg.d.ts +1 -0
- package/dist/types/lib/testing/mocks/svg.d.ts.map +1 -0
- package/dist/types/{testing → lib/testing}/mocks/webpack-hmr.d.ts +1 -0
- package/dist/types/lib/testing/mocks/webpack-hmr.d.ts.map +1 -0
- package/dist/types/{testing → lib/testing}/resolver.d.cts +1 -0
- package/dist/types/lib/testing/resolver.d.cts.map +1 -0
- package/dist/types/lib/testing/setup-react-env.d.ts +2 -0
- package/dist/types/lib/testing/setup-react-env.d.ts.map +1 -0
- package/dist/types/lib/testing/setup-test-env.d.ts +2 -0
- package/dist/types/lib/testing/setup-test-env.d.ts.map +1 -0
- package/dist/types/lib/testing/setup-tests.d.ts +2 -0
- package/dist/types/lib/testing/setup-tests.d.ts.map +1 -0
- package/dist/types/lib/testing/vitest.config.d.ts +2 -0
- package/dist/types/lib/testing/vitest.config.d.ts.map +1 -0
- package/dist/types/lib/tests/basic.test.d.ts +1 -0
- package/dist/types/lib/tests/basic.test.d.ts.map +1 -0
- package/dist/types/{transpile → lib/transpile}/esbuild.d.ts +4 -3
- package/dist/types/lib/transpile/esbuild.d.ts.map +1 -0
- package/dist/types/{transpile → lib/transpile}/react-shim.d.ts +1 -0
- package/dist/types/lib/transpile/react-shim.d.ts.map +1 -0
- package/dist/types/lib/transpile/swcrc.config.d.cts +2 -0
- package/dist/types/lib/transpile/swcrc.config.d.cts.map +1 -0
- package/dist/types/lib/typedoc.d.cts +4 -0
- package/dist/types/lib/typedoc.d.cts.map +1 -0
- package/dist/types/{update-notifier.d.ts → lib/update-notifier.d.ts} +1 -0
- package/dist/types/lib/update-notifier.d.ts.map +1 -0
- package/dist/types/{utils.d.cts → lib/utils.d.cts} +1 -0
- package/dist/types/lib/utils.d.cts.map +1 -0
- package/dist/types/{utils.d.ts → lib/utils.d.ts} +1 -0
- package/dist/types/lib/utils.d.ts.map +1 -0
- package/dist/types/{webpack → lib/webpack}/helpers.d.ts +5 -1
- package/dist/types/lib/webpack/helpers.d.ts.map +1 -0
- package/dist/types/{webpack → lib/webpack}/webpack.base.babel.d.ts +1 -0
- package/dist/types/lib/webpack/webpack.base.babel.d.ts.map +1 -0
- package/dist/types/{webpack → lib/webpack}/webpack.dev.babel.d.ts +1 -0
- package/dist/types/lib/webpack/webpack.dev.babel.d.ts.map +1 -0
- package/dist/types/{webpack → lib/webpack}/webpack.lib.base.babel.d.ts +1 -0
- package/dist/types/lib/webpack/webpack.lib.base.babel.d.ts.map +1 -0
- package/dist/types/{webpack → lib/webpack}/webpack.lib.dev.babel.d.ts +1 -0
- package/dist/types/lib/webpack/webpack.lib.dev.babel.d.ts.map +1 -0
- package/dist/types/{webpack → lib/webpack}/webpack.lib.prod.babel.d.ts +1 -0
- package/dist/types/lib/webpack/webpack.lib.prod.babel.d.ts.map +1 -0
- package/dist/types/{webpack → lib/webpack}/webpack.prod.babel.d.ts +1 -0
- package/dist/types/lib/webpack/webpack.prod.babel.d.ts.map +1 -0
- package/dist/types/{webpack → lib/webpack}/webpack.storybook.d.ts +1 -1
- package/dist/types/lib/webpack/webpack.storybook.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/library.tsconfig.json +6 -1
- package/nx.json +97 -0
- package/package.json +210 -194
- package/dist/cjs/babel.config.cjs +0 -97
- package/dist/cjs/dummy.js +0 -1
- package/dist/cjs/lint-config/commitlint.config.cjs +0 -1
- package/dist/cjs/lint-config/eslint/common.cjs +0 -163
- package/dist/cjs/lint-config/eslint/non-react.cjs +0 -14
- package/dist/cjs/lint-config/eslint/react.cjs +0 -26
- package/dist/cjs/lint-config/eslint/typescript/common.cjs +0 -49
- package/dist/cjs/lint-config/eslint/typescript/non-react.cjs +0 -12
- package/dist/cjs/lint-config/eslint/typescript/react.cjs +0 -19
- package/dist/cjs/lint-config/prettier.config.cjs +0 -8
- package/dist/cjs/lint-config/stylelint.config.cjs +0 -19
- package/dist/cjs/release.config.cjs +0 -24
- package/dist/esm/babel.config.cjs +0 -97
- package/dist/esm/dummy.js +0 -0
- package/dist/esm/lint-config/commitlint.config.cjs +0 -1
- package/dist/esm/lint-config/eslint/common.cjs +0 -163
- package/dist/esm/lint-config/eslint/non-react.cjs +0 -14
- package/dist/esm/lint-config/eslint/react.cjs +0 -26
- package/dist/esm/lint-config/eslint/typescript/common.cjs +0 -49
- package/dist/esm/lint-config/eslint/typescript/non-react.cjs +0 -12
- package/dist/esm/lint-config/eslint/typescript/react.cjs +0 -19
- package/dist/esm/lint-config/stylelint.config.cjs +0 -19
- package/dist/esm/release.config.cjs +0 -24
- package/dist/types/cli.d.ts +0 -2
- package/dist/types/commands/utils.d.ts +0 -17
- package/dist/types/dummy.d.ts +0 -0
- package/dist/types/index.d.cts +0 -9
- package/dist/types/lint-config/commitlint.config.d.cts +0 -4
- package/dist/types/lint-config/eslint/common.d.cts +0 -130
- package/dist/types/lint-config/eslint/non-react.d.cts +0 -96
- package/dist/types/lint-config/eslint/react.d.cts +0 -126
- package/dist/types/lint-config/eslint/typescript/common.d.cts +0 -40
- package/dist/types/lint-config/eslint/typescript/non-react.d.cts +0 -90
- package/dist/types/lint-config/eslint/typescript/react.d.cts +0 -121
- 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/pui-config.d.ts +0 -1
- package/dist/types/release.config.d.cts +0 -7
- package/dist/types/server/index.d.ts +0 -1
- package/dist/types/testing/jest.config.d.cts +0 -41
- package/dist/types/testing/mocks/axios.d.ts +0 -17
- package/dist/types/testing/mocks/matchMedia.d.ts +0 -1
- package/dist/types/testing/mocks/pui-app-loader.d.ts +0 -1
- package/dist/types/testing/setup-react-env.d.ts +0 -1
- package/dist/types/testing/setup-test-env.d.ts +0 -1
- package/dist/types/testing/setup-tests.d.ts +0 -1
- package/dist/types/testing/vitest.config.d.ts +0 -1
- package/dist/types/transpile/swcrc.config.d.cts +0 -1
- package/dist/types/typedoc.d.cts +0 -3
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
|
+
});
|
|
@@ -21,6 +21,6 @@ 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 React = __toESM(require("react")
|
|
24
|
+
var React = __toESM(require("react"));
|
|
25
25
|
var import_jest_styled_components = require("jest-styled-components");
|
|
26
26
|
global.React = React;
|
|
@@ -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
|
|
28
|
-
var
|
|
25
|
+
var import_jest_globals = require("@testing-library/jest-dom/jest-globals");
|
|
26
|
+
var import_resize_observer_polyfill = __toESM(require("resize-observer-polyfill"));
|
|
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;
|
|
@@ -47,23 +46,19 @@ console.error = (...args) => {
|
|
|
47
46
|
return false;
|
|
48
47
|
return originalError(...args);
|
|
49
48
|
};
|
|
50
|
-
if (expect)
|
|
51
|
-
expect.extend(import_jest_axe.default.toHaveNoViolations);
|
|
49
|
+
if (expect) expect.extend(import_axe_core.toHaveNoViolations);
|
|
52
50
|
const addElementToBody = (element) => {
|
|
53
51
|
const documentEle = (window || {}).document;
|
|
54
|
-
if (!documentEle)
|
|
55
|
-
return null;
|
|
52
|
+
if (!documentEle) return null;
|
|
56
53
|
const bodyEle = documentEle.body;
|
|
57
54
|
const newEle = documentEle.createElement(...element);
|
|
58
|
-
if (!newEle)
|
|
59
|
-
return null;
|
|
55
|
+
if (!newEle) return null;
|
|
60
56
|
bodyEle.appendChild(newEle);
|
|
61
57
|
return newEle;
|
|
62
58
|
};
|
|
63
59
|
const addRootElement = (id) => {
|
|
64
60
|
const rootEle = addElementToBody("div");
|
|
65
|
-
if (rootEle)
|
|
66
|
-
rootEle.id = id;
|
|
61
|
+
if (rootEle) rootEle.id = id;
|
|
67
62
|
};
|
|
68
63
|
addRootElement("root");
|
|
69
64
|
(0, import_matchMedia.addMatchMedia)();
|
|
@@ -72,3 +67,26 @@ window.emui = {
|
|
|
72
67
|
logger: (0, import_pui_diagnostics.logger)(),
|
|
73
68
|
_BASE_PATH: new URL(document.baseURI).pathname
|
|
74
69
|
};
|
|
70
|
+
let showCorejsWarn = false;
|
|
71
|
+
afterAll(() => {
|
|
72
|
+
if (showCorejsWarn) {
|
|
73
|
+
console.warn(
|
|
74
|
+
`IMPORTANT: Try importing core-js/stable in your failed test files and retrying.
|
|
75
|
+
Some tests might have failed because of it`
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const originalTest = global.test;
|
|
80
|
+
global.it = (name, fn, timeout = void 0) => {
|
|
81
|
+
const fnWrapper = async () => {
|
|
82
|
+
try {
|
|
83
|
+
await fn();
|
|
84
|
+
} catch (error) {
|
|
85
|
+
showCorejsWarn = true;
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
originalTest(name, fnWrapper, timeout);
|
|
90
|
+
};
|
|
91
|
+
global.it.skip = originalTest.skip;
|
|
92
|
+
global.it.only = originalTest.only;
|
|
@@ -31,31 +31,31 @@ __export(vitest_config_exports, {
|
|
|
31
31
|
vitestConfig: () => vitestConfig
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(vitest_config_exports);
|
|
34
|
-
var import_node_path = __toESM(require("node:path")
|
|
34
|
+
var import_node_path = __toESM(require("node:path"));
|
|
35
35
|
var import_node_url = require("node:url");
|
|
36
36
|
var import_config = require("vitest/config");
|
|
37
|
-
var import_plugin_react = __toESM(require("@vitejs/plugin-react")
|
|
37
|
+
var import_plugin_react = __toESM(require("@vitejs/plugin-react"));
|
|
38
|
+
var import_vite_tsconfig_paths = __toESM(require("vite-tsconfig-paths"));
|
|
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
|
});
|