@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
|
@@ -0,0 +1,30 @@
|
|
|
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) return "";
|
|
7
|
+
const lineBreak = "\n\n";
|
|
8
|
+
const horizontalLine = "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
|
|
9
|
+
return violToFormat.map((violation) => {
|
|
10
|
+
const errorBody = violation.nodes.map((node) => {
|
|
11
|
+
const selector = node.target.join(", ");
|
|
12
|
+
const expectedText = `Expected the HTML found at $('${selector}') to have no violations:${lineBreak}`;
|
|
13
|
+
let violationHelpUrl = "";
|
|
14
|
+
if (violation.helpUrl)
|
|
15
|
+
violationHelpUrl = `You can find more information on this issue here:
|
|
16
|
+
${colorBlue(
|
|
17
|
+
violation.helpUrl
|
|
18
|
+
)}`;
|
|
19
|
+
return `${expectedText + colorGrey(node.html) + lineBreak}Received:${lineBreak}${printReceived(
|
|
20
|
+
`${violation.help} (${violation.id})`
|
|
21
|
+
)}${lineBreak}${colorYellow(
|
|
22
|
+
node.failureSummary
|
|
23
|
+
)}${lineBreak}${violationHelpUrl}`;
|
|
24
|
+
}).join(lineBreak);
|
|
25
|
+
return errorBody;
|
|
26
|
+
}).join(lineBreak + horizontalLine + lineBreak);
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
reporter
|
|
30
|
+
};
|
|
@@ -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,22 @@
|
|
|
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)) newNodes.push(node);
|
|
12
|
+
});
|
|
13
|
+
if (newNodes.length > 0) {
|
|
14
|
+
finalViolations.push({ ...violation, nodes: newNodes });
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return { actual: violations, ...getMessageAndPass(finalViolations) };
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
toHaveNoViolations
|
|
22
|
+
};
|
|
@@ -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
|
+
});
|
|
@@ -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;
|
|
@@ -24,23 +23,19 @@ console.error = (...args) => {
|
|
|
24
23
|
return false;
|
|
25
24
|
return originalError(...args);
|
|
26
25
|
};
|
|
27
|
-
if (expect)
|
|
28
|
-
expect.extend(jestAxe.toHaveNoViolations);
|
|
26
|
+
if (expect) expect.extend(toHaveNoViolations);
|
|
29
27
|
const addElementToBody = (element) => {
|
|
30
28
|
const documentEle = (window || {}).document;
|
|
31
|
-
if (!documentEle)
|
|
32
|
-
return null;
|
|
29
|
+
if (!documentEle) return null;
|
|
33
30
|
const bodyEle = documentEle.body;
|
|
34
31
|
const newEle = documentEle.createElement(...element);
|
|
35
|
-
if (!newEle)
|
|
36
|
-
return null;
|
|
32
|
+
if (!newEle) return null;
|
|
37
33
|
bodyEle.appendChild(newEle);
|
|
38
34
|
return newEle;
|
|
39
35
|
};
|
|
40
36
|
const addRootElement = (id) => {
|
|
41
37
|
const rootEle = addElementToBody("div");
|
|
42
|
-
if (rootEle)
|
|
43
|
-
rootEle.id = id;
|
|
38
|
+
if (rootEle) rootEle.id = id;
|
|
44
39
|
};
|
|
45
40
|
addRootElement("root");
|
|
46
41
|
addMatchMedia();
|
|
@@ -49,3 +44,26 @@ window.emui = {
|
|
|
49
44
|
logger: logger(),
|
|
50
45
|
_BASE_PATH: new URL(document.baseURI).pathname
|
|
51
46
|
};
|
|
47
|
+
let showCorejsWarn = false;
|
|
48
|
+
afterAll(() => {
|
|
49
|
+
if (showCorejsWarn) {
|
|
50
|
+
console.warn(
|
|
51
|
+
`IMPORTANT: Try importing core-js/stable in your failed test files and retrying.
|
|
52
|
+
Some tests might have failed because of it`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const originalTest = global.test;
|
|
57
|
+
global.it = (name, fn, timeout = void 0) => {
|
|
58
|
+
const fnWrapper = async () => {
|
|
59
|
+
try {
|
|
60
|
+
await fn();
|
|
61
|
+
} catch (error) {
|
|
62
|
+
showCorejsWarn = true;
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
originalTest(name, fnWrapper, timeout);
|
|
67
|
+
};
|
|
68
|
+
global.it.skip = originalTest.skip;
|
|
69
|
+
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,40 @@
|
|
|
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
|
+
const readPkgJson = async () => {
|
|
9
|
+
const pkgJsonPath = path.join(process.cwd(), "package.json");
|
|
10
|
+
const pkgJson = JSON.parse(await readFile(pkgJsonPath, "utf8"));
|
|
11
|
+
return pkgJson;
|
|
12
|
+
};
|
|
13
|
+
const writePkgJson = async (pkgJson) => {
|
|
14
|
+
const pkgJsonPath = path.join(process.cwd(), "package.json");
|
|
15
|
+
await writeFile(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
|
|
16
|
+
};
|
|
17
|
+
const removeModuleType = async () => {
|
|
18
|
+
const pkgJson = await readPkgJson();
|
|
19
|
+
const prevModuleType = pkgJson.type;
|
|
20
|
+
if (pkgJson.type) {
|
|
21
|
+
delete pkgJson.type;
|
|
22
|
+
await writePkgJson(pkgJson);
|
|
23
|
+
}
|
|
24
|
+
return prevModuleType;
|
|
25
|
+
};
|
|
26
|
+
const restoreModuleType = async (typeValue) => {
|
|
27
|
+
if (typeValue) {
|
|
28
|
+
const pkgJson = await readPkgJson();
|
|
29
|
+
pkgJson.type = typeValue;
|
|
30
|
+
await writePkgJson(pkgJson);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
8
33
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
34
|
const TARGETS = {
|
|
10
35
|
browserslist: browserslistToEsbuild(),
|
|
11
|
-
web: "
|
|
12
|
-
node: "
|
|
36
|
+
web: "es2022",
|
|
37
|
+
node: "node20"
|
|
13
38
|
};
|
|
14
39
|
const ESBUILD_FORMAT = {
|
|
15
40
|
CJS: "cjs",
|
|
@@ -77,16 +102,24 @@ const esBuild = async ({
|
|
|
77
102
|
if (!esmOnly) {
|
|
78
103
|
const cjsOutdir = `${outdir}/cjs`;
|
|
79
104
|
const commonJSEntryPoints = await fg(inputFiles);
|
|
80
|
-
await
|
|
81
|
-
|
|
82
|
-
|
|
105
|
+
const typeValue = await removeModuleType();
|
|
106
|
+
try {
|
|
107
|
+
await build({
|
|
108
|
+
entryPoints: commonJSEntryPoints,
|
|
109
|
+
...getCommonConfig({ injectReactShim }),
|
|
110
|
+
outdir: cjsOutdir,
|
|
111
|
+
format: ESBUILD_FORMAT.CJS,
|
|
112
|
+
target,
|
|
113
|
+
plugins: [lodashTransformer()]
|
|
114
|
+
});
|
|
115
|
+
} finally {
|
|
116
|
+
await restoreModuleType(typeValue);
|
|
117
|
+
}
|
|
118
|
+
await copyFiles({ srcdir, outdir: cjsOutdir });
|
|
119
|
+
await createPackageJson({
|
|
83
120
|
outdir: cjsOutdir,
|
|
84
|
-
|
|
85
|
-
target,
|
|
86
|
-
plugins: [lodashTransformer()]
|
|
121
|
+
type: NODE_MODULE_TYPES.CJS
|
|
87
122
|
});
|
|
88
|
-
await copyFiles({ srcdir, outdir: cjsOutdir });
|
|
89
|
-
await createPackageJson({ outdir: cjsOutdir, type: NODE_MODULE_TYPES.CJS });
|
|
90
123
|
}
|
|
91
124
|
const esmOutdir = esmOnly ? outdir : `${outdir}/esm`;
|
|
92
125
|
const entryPoints = await fg(
|
|
@@ -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(
|
|
@@ -8,8 +8,7 @@ const getAppConfig = () => {
|
|
|
8
8
|
isApp() ? "app" : "lib",
|
|
9
9
|
"app.config.json"
|
|
10
10
|
);
|
|
11
|
-
if (!fs.existsSync(appConfigPath))
|
|
12
|
-
return "{}";
|
|
11
|
+
if (!fs.existsSync(appConfigPath)) return "{}";
|
|
13
12
|
const appConfig = fs.readFileSync(appConfigPath);
|
|
14
13
|
return appConfig || "{}";
|
|
15
14
|
};
|
|
@@ -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,9 +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 (
|
|
21
|
-
return false;
|
|
19
|
+
for (const moduleRegExp of moduleRegExps)
|
|
20
|
+
if (moduleRegExp.test(modulePath)) return false;
|
|
22
21
|
return true;
|
|
23
22
|
}
|
|
24
23
|
return false;
|
|
@@ -32,7 +31,7 @@ const getLibraryName = () => {
|
|
|
32
31
|
const modifiedLibName = `emui-${libraryName.replace("@elliemae/", "").replace("pui-", "")}`;
|
|
33
32
|
return _.camelCase(modifiedLibName);
|
|
34
33
|
};
|
|
35
|
-
const getLibraryVariableName = () => (process.env.LIBRARY_VARIABLE_NAME
|
|
34
|
+
const getLibraryVariableName = () => (process.env.LIBRARY_VARIABLE_NAME ?? getLibraryName()).split(".");
|
|
36
35
|
const mapToFolder = (dependencies, folder) => dependencies.reduce(
|
|
37
36
|
(acc, dependency) => ({
|
|
38
37
|
[dependency]: path.resolve(`${folder}/${dependency.replace("$", "")}`),
|
|
@@ -41,7 +40,7 @@ const mapToFolder = (dependencies, folder) => dependencies.reduce(
|
|
|
41
40
|
{}
|
|
42
41
|
);
|
|
43
42
|
const getAlias = () => {
|
|
44
|
-
const monorepoRoot = findMonoRepoRoot(process.cwd())
|
|
43
|
+
const monorepoRoot = findMonoRepoRoot(process.cwd()) ?? "";
|
|
45
44
|
return mapToFolder(
|
|
46
45
|
[
|
|
47
46
|
"@babel/runtime",
|
|
@@ -55,6 +54,8 @@ const getAlias = () => {
|
|
|
55
54
|
"styled-components",
|
|
56
55
|
"immer",
|
|
57
56
|
"react-dates",
|
|
57
|
+
"react-select",
|
|
58
|
+
"react-spring",
|
|
58
59
|
"react-transition-group",
|
|
59
60
|
"@elliemae/pui-cli",
|
|
60
61
|
"@elliemae/pui-app-sdk$",
|
|
@@ -63,6 +64,15 @@ const getAlias = () => {
|
|
|
63
64
|
path.join(monorepoRoot, "./node_modules")
|
|
64
65
|
);
|
|
65
66
|
};
|
|
67
|
+
const getLibraryAlias = (name, alias) => {
|
|
68
|
+
const monorepoRoot = findMonoRepoRoot(process.cwd()) ?? "";
|
|
69
|
+
const aliasPath = path.resolve(
|
|
70
|
+
`${path.join(monorepoRoot, "./node_modules")}/${alias}`
|
|
71
|
+
);
|
|
72
|
+
return {
|
|
73
|
+
[name]: aliasPath
|
|
74
|
+
};
|
|
75
|
+
};
|
|
66
76
|
const modulesToTranspile = [
|
|
67
77
|
"@elliemae/pui-*",
|
|
68
78
|
"@elliemae/ds-*",
|
|
@@ -75,8 +85,7 @@ const getUserMonitoringFileName = () => {
|
|
|
75
85
|
process.cwd(),
|
|
76
86
|
"node_modules/@elliemae/pui-user-monitoring/dist/public/js"
|
|
77
87
|
);
|
|
78
|
-
if (!fs.existsSync(userMonLibPath))
|
|
79
|
-
return `${libName}.js`;
|
|
88
|
+
if (!fs.existsSync(userMonLibPath)) return `${libName}.js`;
|
|
80
89
|
const distJSFiles = fs.readdirSync(userMonLibPath);
|
|
81
90
|
return distJSFiles.filter(
|
|
82
91
|
(fName) => fName.match(/emuiUserMonitoring+((?!chunk).)*\.js$/)
|
|
@@ -88,8 +97,7 @@ const getAppLoaderFileName = () => {
|
|
|
88
97
|
process.cwd(),
|
|
89
98
|
"node_modules/@elliemae/pui-app-loader/dist/public/js"
|
|
90
99
|
);
|
|
91
|
-
if (!fs.existsSync(appLoaderLibPath))
|
|
92
|
-
return `${libName}.js`;
|
|
100
|
+
if (!fs.existsSync(appLoaderLibPath)) return `${libName}.js`;
|
|
93
101
|
const distJSFiles = fs.readdirSync(appLoaderLibPath);
|
|
94
102
|
return distJSFiles.filter(
|
|
95
103
|
(fName) => fName.match(/emuiAppLoader+((?!chunk).)*\.js$/)
|
|
@@ -101,8 +109,7 @@ const getDiagnosticsFileName = () => {
|
|
|
101
109
|
process.cwd(),
|
|
102
110
|
"node_modules/@elliemae/pui-diagnostics/dist/public/js"
|
|
103
111
|
);
|
|
104
|
-
if (!fs.existsSync(libPath))
|
|
105
|
-
return `${libName}.js`;
|
|
112
|
+
if (!fs.existsSync(libPath)) return `${libName}.js`;
|
|
106
113
|
const distJSFiles = fs.readdirSync(libPath);
|
|
107
114
|
return distJSFiles.filter(
|
|
108
115
|
(fName) => fName.match(/emuiDiagnostics+((?!chunk).)*\.js$/)
|
|
@@ -114,18 +121,16 @@ const getENCWLoaderFileName = () => {
|
|
|
114
121
|
process.cwd(),
|
|
115
122
|
"node_modules/@elliemae/encw-loader/dist/public/js"
|
|
116
123
|
);
|
|
117
|
-
if (!fs.existsSync(appLoaderLibPath))
|
|
118
|
-
return `${libName}.js`;
|
|
124
|
+
if (!fs.existsSync(appLoaderLibPath)) return `${libName}.js`;
|
|
119
125
|
const distJSFiles = fs.readdirSync(appLoaderLibPath);
|
|
120
126
|
return distJSFiles.filter(
|
|
121
127
|
(fName) => fName.match(/emuiEncwLoader+((?!chunk).)*\.js$/)
|
|
122
128
|
)[0];
|
|
123
129
|
};
|
|
124
130
|
const getAppVersion = () => {
|
|
125
|
-
if (!process.env.APP_VERSION)
|
|
126
|
-
return LATEST_VERSION;
|
|
131
|
+
if (!process.env.APP_VERSION) return LATEST_VERSION;
|
|
127
132
|
const match = process.env.APP_VERSION.match(/^v?(\d+\.\d+)\..*$/);
|
|
128
|
-
return match
|
|
133
|
+
return match?.[1] ?? LATEST_VERSION;
|
|
129
134
|
};
|
|
130
135
|
const getPaths = (latestVersion = true) => {
|
|
131
136
|
const version = latestVersion ? LATEST_VERSION : getAppVersion();
|
|
@@ -160,9 +165,9 @@ const getCompressionPlugins = (isLibrary = false) => {
|
|
|
160
165
|
];
|
|
161
166
|
const commonConfig = {
|
|
162
167
|
test: /\.(js|css)$/,
|
|
163
|
-
exclude: !isLibrary ? excludeList : [],
|
|
164
168
|
// 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
|
|
169
|
+
minRatio: Infinity,
|
|
170
|
+
...!isLibrary ? { exclude: excludeList } : {}
|
|
166
171
|
};
|
|
167
172
|
return [
|
|
168
173
|
new CompressionPlugin({
|
|
@@ -202,6 +207,7 @@ export {
|
|
|
202
207
|
getAlias,
|
|
203
208
|
getAppVersion,
|
|
204
209
|
getCompressionPlugins,
|
|
210
|
+
getLibraryAlias,
|
|
205
211
|
getLibraryName,
|
|
206
212
|
getLibraryVariableName,
|
|
207
213
|
getMediaPath,
|
|
@@ -102,14 +102,16 @@ const plugins = [
|
|
|
102
102
|
noErrorOnMissing: true,
|
|
103
103
|
globOptions: {
|
|
104
104
|
ignore: ["readme.md"]
|
|
105
|
-
}
|
|
105
|
+
},
|
|
106
|
+
info: { minimized: true }
|
|
106
107
|
},
|
|
107
108
|
{
|
|
108
109
|
from: "webroot",
|
|
109
110
|
noErrorOnMissing: true,
|
|
110
111
|
globOptions: {
|
|
111
112
|
ignore: ["readme.md"]
|
|
112
|
-
}
|
|
113
|
+
},
|
|
114
|
+
info: { minimized: true }
|
|
113
115
|
}
|
|
114
116
|
])
|
|
115
117
|
}),
|
|
@@ -118,7 +120,7 @@ const plugins = [
|
|
|
118
120
|
fileName: "./latest/manifest.json",
|
|
119
121
|
publicPath: "",
|
|
120
122
|
map: (file) => {
|
|
121
|
-
file.name = file.name.replace(/^latest
|
|
123
|
+
file.name = file.name.replace(/^latest(\/|\\)/, "");
|
|
122
124
|
return file;
|
|
123
125
|
}
|
|
124
126
|
}),
|
|
@@ -257,36 +259,20 @@ const baseConfig = (options) => ({
|
|
|
257
259
|
mainFields: ["browser", "module", "main"],
|
|
258
260
|
alias: {
|
|
259
261
|
...getAlias(),
|
|
260
|
-
...
|
|
262
|
+
...options.resolve?.alias ?? {}
|
|
261
263
|
}
|
|
262
264
|
},
|
|
265
|
+
externalsPresets: {
|
|
266
|
+
web: true
|
|
267
|
+
},
|
|
263
268
|
externals: {
|
|
264
269
|
"@elliemae/pui-user-monitoring": "emuiUserMonitoring",
|
|
265
270
|
"@elliemae/pui-app-loader": "emuiAppLoader",
|
|
266
|
-
"@elliemae/pui-diagnostics": "emuiDiagnostics"
|
|
267
|
-
react: "emuiAppReactDependencies.react",
|
|
268
|
-
"react-dom": "emuiAppReactDependencies.reactDOM",
|
|
269
|
-
"@reduxjs/toolkit": "emuiAppReactDependencies.rtk",
|
|
270
|
-
axios: "emuiAppReactDependencies.axios.default",
|
|
271
|
-
dompurify: "emuiAppReactDependencies.dompurify",
|
|
272
|
-
history: "emuiAppReactDependencies.history",
|
|
273
|
-
immer: "emuiAppReactDependencies.immer",
|
|
274
|
-
invariant: "emuiAppReactDependencies.invariant",
|
|
275
|
-
"pubsub-js": "emuiAppReactDependencies.pubsubjs",
|
|
276
|
-
"react-aria-live": "emuiAppReactDependencies.reactAriaLive",
|
|
277
|
-
"react-helmet": "emuiAppReactDependencies.reactHelmet",
|
|
278
|
-
"react-hook-form": "emuiAppReactDependencies.reactHookForm",
|
|
279
|
-
"react-redux": "emuiAppReactDependencies.reactRedux",
|
|
280
|
-
"react-router-dom": "emuiAppReactDependencies.reactRouterDOM",
|
|
281
|
-
reduxInjectors: "emuiAppReactDependencies.reduxInjectors",
|
|
282
|
-
reselect: "emuiAppReactDependencies.reselect",
|
|
283
|
-
// "styled-components": "emuiAppReactDependencies.styledComponents",
|
|
284
|
-
"styled-system": "emuiAppReactDependencies.styledSystem"
|
|
285
|
-
// "@xstyled/styled-components": "emuiAppReactDependencies.xstyled",
|
|
271
|
+
"@elliemae/pui-diagnostics": "emuiDiagnostics"
|
|
286
272
|
},
|
|
287
|
-
devtool: options.devtool
|
|
288
|
-
performance: options.performance
|
|
289
|
-
devServer: options.devServer
|
|
273
|
+
devtool: options.devtool ?? "eval-source-map",
|
|
274
|
+
performance: options.performance ?? {},
|
|
275
|
+
devServer: options.devServer ?? {}
|
|
290
276
|
});
|
|
291
277
|
export {
|
|
292
278
|
baseConfig
|
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
isGoogleTagManagerEnabled
|
|
15
15
|
} from "./helpers.js";
|
|
16
16
|
import { baseConfig } from "./webpack.base.babel.js";
|
|
17
|
+
import { wsPort } from "../server/utils.js";
|
|
18
|
+
import { createWSServer } from "../server/wsServer.js";
|
|
17
19
|
const __filename = fileURLToPath(import.meta.url);
|
|
18
20
|
const {
|
|
19
21
|
appVersion,
|
|
@@ -68,7 +70,7 @@ const devConfig = {
|
|
|
68
70
|
// Add development plugins
|
|
69
71
|
plugins: [
|
|
70
72
|
new HtmlWebpackPlugin({
|
|
71
|
-
inject: !isAppLoaderEnabled(),
|
|
73
|
+
inject: !isAppLoaderEnabled() ? "head" : false,
|
|
72
74
|
// Inject all files that are generated by webpack, e.g. bundle.js
|
|
73
75
|
template: !isAppLoaderEnabled() ? "app/index.html" : "app/index-app-loader.html",
|
|
74
76
|
emui: {
|
|
@@ -80,7 +82,8 @@ const devConfig = {
|
|
|
80
82
|
diagnosticsScriptPath,
|
|
81
83
|
encwLoaderScriptPath,
|
|
82
84
|
googleTagManager: isGoogleTagManagerEnabled()
|
|
83
|
-
}
|
|
85
|
+
},
|
|
86
|
+
scriptLoading: "defer"
|
|
84
87
|
}),
|
|
85
88
|
new CircularDependencyPlugin({
|
|
86
89
|
exclude: /a\.(js|ts|jsx|tsx)|node_modules/,
|
|
@@ -113,7 +116,7 @@ const devConfig = {
|
|
|
113
116
|
},
|
|
114
117
|
hot: true,
|
|
115
118
|
open: [basePath],
|
|
116
|
-
port: process.env.PORT
|
|
119
|
+
port: process.env.PORT ?? "auto",
|
|
117
120
|
setupMiddlewares: (middlewares, devServer) => {
|
|
118
121
|
if (devServer.app) {
|
|
119
122
|
setupDefaultMiddlewares(devServer.app);
|
|
@@ -130,6 +133,13 @@ const devConfig = {
|
|
|
130
133
|
}
|
|
131
134
|
next();
|
|
132
135
|
});
|
|
136
|
+
createWSServer({
|
|
137
|
+
port: wsPort
|
|
138
|
+
}).then(({ wsServer }) => {
|
|
139
|
+
if (devServer.app) devServer.app.locals.wsServer = wsServer;
|
|
140
|
+
}).catch((err) => {
|
|
141
|
+
console.error(err);
|
|
142
|
+
});
|
|
133
143
|
}
|
|
134
144
|
return middlewares;
|
|
135
145
|
}
|
|
@@ -57,14 +57,22 @@ const baseConfig = (options) => ({
|
|
|
57
57
|
output: {
|
|
58
58
|
clean: true,
|
|
59
59
|
path: path.resolve(process.cwd(), "dist/umd"),
|
|
60
|
+
filename: "[name].js",
|
|
61
|
+
chunkFilename: "[name].[chunkhash].chunk.js",
|
|
62
|
+
assetModuleFilename: "assets/[name].[hash][ext][query]",
|
|
60
63
|
publicPath: "auto",
|
|
61
64
|
library: {
|
|
62
65
|
name: getLibraryVariableName(),
|
|
63
|
-
type: "
|
|
66
|
+
type: "var"
|
|
67
|
+
// type: 'module',
|
|
64
68
|
},
|
|
69
|
+
// module: true,
|
|
65
70
|
...options.output
|
|
66
71
|
},
|
|
67
72
|
// Merge with env dependent settings
|
|
73
|
+
// experiments: {
|
|
74
|
+
// outputModule: true,
|
|
75
|
+
// },
|
|
68
76
|
optimization: options.optimization,
|
|
69
77
|
module: {
|
|
70
78
|
rules: [
|
|
@@ -112,6 +120,7 @@ const baseConfig = (options) => ({
|
|
|
112
120
|
loader: "postcss-loader",
|
|
113
121
|
options: {
|
|
114
122
|
postcssOptions: {
|
|
123
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
115
124
|
plugins: [PostcssPresetEnv({ autoprefixer: { grid: true } })]
|
|
116
125
|
},
|
|
117
126
|
sourceMap: true
|
|
@@ -177,7 +186,7 @@ const baseConfig = (options) => ({
|
|
|
177
186
|
mainFields: ["browser", "module", "main"],
|
|
178
187
|
alias: {
|
|
179
188
|
...getAlias(),
|
|
180
|
-
...
|
|
189
|
+
...options.resolve?.alias ?? {}
|
|
181
190
|
},
|
|
182
191
|
plugins: [new ResolveTypeScriptPlugin({})]
|
|
183
192
|
},
|
|
@@ -186,9 +195,9 @@ const baseConfig = (options) => ({
|
|
|
186
195
|
"@elliemae/pui-app-loader": "emuiAppLoader",
|
|
187
196
|
"@elliemae/pui-diagnostics": "emuiDiagnostics"
|
|
188
197
|
},
|
|
189
|
-
devtool: options.devtool
|
|
190
|
-
performance: options.performance
|
|
191
|
-
devServer: options.devServer
|
|
198
|
+
devtool: options.devtool ?? "eval-source-map",
|
|
199
|
+
performance: options.performance ?? {},
|
|
200
|
+
devServer: options.devServer ?? {}
|
|
192
201
|
});
|
|
193
202
|
export {
|
|
194
203
|
baseConfig
|