diff --git a/packages/i18next/jest.config.mjs b/packages/i18next/jest.config.mjs index 8cef5c7718..e4bd10570b 100644 --- a/packages/i18next/jest.config.mjs +++ b/packages/i18next/jest.config.mjs @@ -3,7 +3,6 @@ export default { preset: 'ts-jest', testEnvironment: 'jsdom', roots: ['src'], - setupFiles: ['../testing/setupJest.ts'], unmockedModulePathPatterns: [ '/src/__testFixtures/*', '/node_modules/*', diff --git a/packages/ngx/projects/ngx-tolgee/jest.config.js b/packages/ngx/projects/ngx-tolgee/jest.config.js index 1e6721b203..52cccdb216 100644 --- a/packages/ngx/projects/ngx-tolgee/jest.config.js +++ b/packages/ngx/projects/ngx-tolgee/jest.config.js @@ -14,7 +14,6 @@ module.exports = { moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '/../../', }), - setupFiles: ['../../../testing/setupJest.ts'], globals: { 'ts-jest': { tsconfig: '/tsconfig.spec.json', diff --git a/packages/react/jest.config.mjs b/packages/react/jest.config.mjs index 0d15b75ac0..efb45b7565 100644 --- a/packages/react/jest.config.mjs +++ b/packages/react/jest.config.mjs @@ -5,7 +5,6 @@ export default { modulePathIgnorePatterns: ['cypress'], transformIgnorePatterns: ['node_modules/(?!@tolgee/web)'], roots: ['src'], - setupFiles: ['../testing/setupJest.ts'], globals: { 'ts-jest': { tsconfig: 'tsconfig.spec.json', diff --git a/packages/svelte/jest.config.cjs b/packages/svelte/jest.config.cjs index 16dcabef6a..85a6f6ce91 100644 --- a/packages/svelte/jest.config.cjs +++ b/packages/svelte/jest.config.cjs @@ -17,6 +17,5 @@ module.exports = { '/.svelte-kit/build/runtime/app$1', ], }, - setupFiles: ['../testing/setupJest.ts'], setupFilesAfterEnv: ['/jest-setup.ts'], }; diff --git a/packages/testing/setupJest.ts b/packages/testing/setupJest.ts deleted file mode 100644 index aeffe01614..0000000000 --- a/packages/testing/setupJest.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { TextEncoder, TextDecoder } from 'util'; -// polyfill TextEncoder and TextDecoder as it is supported in browsers but not present in node -global.TextEncoder = TextEncoder; -// @ts-ignore -global.TextDecoder = TextDecoder; diff --git a/packages/vue/jest.config.mjs b/packages/vue/jest.config.mjs index 2766bff17f..a0f4b0170c 100644 --- a/packages/vue/jest.config.mjs +++ b/packages/vue/jest.config.mjs @@ -8,7 +8,6 @@ export default { transform: { '^.+\\.vue$': '@vue/vue3-jest', }, - setupFiles: ['../testing/setupJest.ts'], testEnvironmentOptions: { customExportConditions: ['node', 'node-addons'], }, diff --git a/packages/web/jest.config.mjs b/packages/web/jest.config.mjs index 04f55e956c..b4e6578a56 100644 --- a/packages/web/jest.config.mjs +++ b/packages/web/jest.config.mjs @@ -5,6 +5,5 @@ export default { moduleNameMapper: { '@testFixtures/(.*)': '/src/__testFixtures/$1', }, - setupFiles: ['../testing/setupJest.ts'], roots: ['src'], }; diff --git a/packages/web/package.json b/packages/web/package.json index 1ba8a1cfaf..3df98d0bbd 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -67,6 +67,7 @@ "@types/react-dom": "^18.0.11", "clsx": "^1.1.1", "concurrently": "7.4.0", + "fast-text-encoding": "^1.0.6", "jest": "^27.2.4", "jest-fetch-mock": "^3.0.3", "openapi-typescript": "^4.3.0", @@ -76,6 +77,7 @@ "react-query": "^3.39.2", "rollup": "2.79.0", "rollup-plugin-bundle-size": "^1.0.3", + "rollup-plugin-polyfill": "^4.2.0", "rollup-plugin-replace": "2.2.0", "rollup-plugin-sourcemaps": "^0.6.3", "rollup-plugin-terser": "7.0.2", diff --git a/packages/web/src/observers/invisible/secret.ts b/packages/web/src/observers/invisible/secret.ts index 39509d792d..fe38edc7a2 100644 --- a/packages/web/src/observers/invisible/secret.ts +++ b/packages/web/src/observers/invisible/secret.ts @@ -1,3 +1,9 @@ +// @ts-ignore +import * as FastTextEncoding from 'fast-text-encoding'; +// make sure it's not treeshaken +// eslint-disable-next-line no-console +console.assert?.(FastTextEncoding); + export const INVISIBLE_CHARACTERS = ['\u200C', '\u200D']; export const INVISIBLE_REGEX = RegExp( diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index aea96f2848..e1a4d6bb6b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -713,6 +713,9 @@ importers: concurrently: specifier: 7.4.0 version: 7.4.0 + fast-text-encoding: + specifier: ^1.0.6 + version: 1.0.6 jest: specifier: ^27.2.4 version: 27.5.1(ts-node@10.9.1) @@ -740,6 +743,9 @@ importers: rollup-plugin-bundle-size: specifier: ^1.0.3 version: 1.0.3 + rollup-plugin-polyfill: + specifier: ^4.2.0 + version: 4.2.0(rollup@2.79.0) rollup-plugin-replace: specifier: 2.2.0 version: 2.2.0 @@ -1045,7 +1051,7 @@ importers: specifier: ^7.3.0 version: 7.4.0 i18next: - specifier: ^23.5.1 + specifier: 23.5.1 version: 23.5.1 i18next-icu: specifier: ^2.3.0 @@ -1057,7 +1063,7 @@ importers: specifier: ^18.2.0 version: 18.2.0(react@18.2.0) react-i18next: - specifier: ^13.2.2 + specifier: 13.2.2 version: 13.2.2(i18next@23.5.1)(react-dom@18.2.0)(react@18.2.0) react-scripts: specifier: 5.0.1 @@ -5614,7 +5620,7 @@ packages: resolution: {integrity: sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==} engines: {node: '>=6.9.0'} dependencies: - regenerator-runtime: 0.13.9 + regenerator-runtime: 0.13.11 dev: true /@babel/runtime@7.19.0: @@ -6398,7 +6404,7 @@ packages: '@babel/core': 7.23.2 '@babel/helper-module-imports': 7.18.6 '@babel/plugin-syntax-jsx': 7.18.6(@babel/core@7.23.2) - '@babel/runtime': 7.19.0 + '@babel/runtime': 7.23.2 '@emotion/hash': 0.9.0 '@emotion/memoize': 0.8.0 '@emotion/serialize': 1.1.0 @@ -8670,7 +8676,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.19.0 + '@babel/runtime': 7.23.2 '@emotion/is-prop-valid': 1.2.0 '@mui/types': 7.2.0(@types/react@18.0.28) '@mui/utils': 5.10.6(react@18.2.0) @@ -8750,7 +8756,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.19.0 + '@babel/runtime': 7.23.2 '@mui/utils': 5.10.6(react@18.2.0) '@types/react': 18.0.28 prop-types: 15.8.1 @@ -8770,7 +8776,7 @@ packages: '@emotion/styled': optional: true dependencies: - '@babel/runtime': 7.19.0 + '@babel/runtime': 7.23.2 '@emotion/cache': 11.10.3 '@emotion/react': 11.10.4(@babel/core@7.23.2)(@types/react@18.0.28)(react@18.2.0) '@emotion/styled': 11.10.4(@babel/core@7.23.2)(@emotion/react@11.10.4)(@types/react@18.0.28)(react@18.2.0) @@ -8795,7 +8801,7 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.19.0 + '@babel/runtime': 7.23.2 '@emotion/react': 11.10.4(@babel/core@7.23.2)(@types/react@18.0.28)(react@18.2.0) '@emotion/styled': 11.10.4(@babel/core@7.23.2)(@emotion/react@11.10.4)(@types/react@18.0.28)(react@18.2.0) '@mui/private-theming': 5.10.6(@types/react@18.0.28)(react@18.2.0) @@ -8826,7 +8832,7 @@ packages: peerDependencies: react: ^17.0.0 || ^18.0.0 dependencies: - '@babel/runtime': 7.19.0 + '@babel/runtime': 7.23.2 '@types/prop-types': 15.7.5 '@types/react-is': 17.0.3 prop-types: 15.8.1 @@ -10362,7 +10368,7 @@ packages: engines: {node: '>=10'} dependencies: '@babel/code-frame': 7.18.6 - '@babel/runtime': 7.19.0 + '@babel/runtime': 7.23.2 '@types/aria-query': 4.2.2 aria-query: 4.2.2 chalk: 4.1.2 @@ -10403,7 +10409,7 @@ packages: engines: {node: '>=14'} dependencies: '@babel/code-frame': 7.18.6 - '@babel/runtime': 7.21.0 + '@babel/runtime': 7.23.2 '@types/aria-query': 5.0.1 aria-query: 5.1.3 chalk: 4.1.2 @@ -13229,7 +13235,7 @@ packages: resolution: {integrity: sha512-o/HelwhuKpTj/frsOsbNLNgnNGVIFsVP/SW2BSF14gVl7kAfMOJ6/8wUAUvG1R1NHKrfG+2sHZTu0yauT1qBrA==} engines: {node: '>=6.0'} dependencies: - '@babel/runtime': 7.19.0 + '@babel/runtime': 7.23.2 '@babel/runtime-corejs3': 7.19.1 dev: false @@ -13754,7 +13760,7 @@ packages: resolution: {integrity: sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==} engines: {node: '>=10', npm: '>=6'} dependencies: - '@babel/runtime': 7.19.0 + '@babel/runtime': 7.23.2 cosmiconfig: 7.1.0 resolve: 1.22.1 @@ -14261,7 +14267,7 @@ packages: /broadcast-channel@3.7.0: resolution: {integrity: sha512-cIAKJXAxGJceNZGTZSBzMxzyOn72cVgPnKx4dc6LRjQgbaJUQqhy5rzL3zbMxkMWsGKkv2hSFkPRMEXfoMZ2Mg==} dependencies: - '@babel/runtime': 7.19.0 + '@babel/runtime': 7.23.2 detect-node: 2.1.0 js-sha3: 0.8.0 microseconds: 0.2.0 @@ -16966,7 +16972,7 @@ packages: /dom-helpers@5.2.1: resolution: {integrity: sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==} dependencies: - '@babel/runtime': 7.19.0 + '@babel/runtime': 7.23.2 csstype: 3.1.1 dev: true @@ -19476,6 +19482,10 @@ packages: resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} dev: true + /fast-text-encoding@1.0.6: + resolution: {integrity: sha512-VhXlQgj9ioXCqGstD37E/HBeqEGV/qOD/kmbVG8h5xKBYvM1L3lR1Zn4555cQ8GkYbJa8aJSipLPndE1k6zK2w==} + dev: true + /fast-url-parser@1.1.3: resolution: {integrity: sha1-9K8+qfNNiicc9YrSs3WfQx8LMY0=} dependencies: @@ -24718,7 +24728,7 @@ packages: /match-sorter@6.3.1: resolution: {integrity: sha512-mxybbo3pPNuA+ZuCUhm5bwNkXrJTbsk5VWbR5wiwz/GC6LIiegBGn2w3O08UG/jdbYLinw51fSQ5xNU1U3MgBw==} dependencies: - '@babel/runtime': 7.19.0 + '@babel/runtime': 7.23.2 remove-accents: 0.4.2 dev: true @@ -29129,7 +29139,7 @@ packages: react: '>=16.6.0' react-dom: '>=16.6.0' dependencies: - '@babel/runtime': 7.19.0 + '@babel/runtime': 7.23.2 dom-helpers: 5.2.1 loose-envify: 1.4.0 prop-types: 15.8.1 @@ -29355,7 +29365,7 @@ packages: /regenerator-transform@0.15.0: resolution: {integrity: sha512-LsrGtPmbYg19bcPHwdtmXwbW+TqNvtY4riE3P83foeHRroMbH6/2ddFBfab3t7kbzc7v7p4wbkIecHImqt0QNg==} dependencies: - '@babel/runtime': 7.16.7 + '@babel/runtime': 7.23.2 dev: true /regenerator-transform@0.15.1: @@ -29698,6 +29708,15 @@ packages: maxmin: 2.1.0 dev: true + /rollup-plugin-polyfill@4.2.0(rollup@2.79.0): + resolution: {integrity: sha512-6eeOyn7nr2/xUOtB+MhydvqLrNKcSybGneOuWA+t8Q4rR9NQyeapzwuu5n6nX8OFfY1WI1sHconAofaC44IpuA==} + engines: {node: '>=10.0.0'} + peerDependencies: + rollup: ^2.67.0 || ^3.0.0 || ^4.0.0 + dependencies: + rollup: 2.79.0 + dev: true + /rollup-plugin-replace@2.2.0: resolution: {integrity: sha512-/5bxtUPkDHyBJAKketb4NfaeZjL5yLZdeUihSfbF2PQMz+rSTEb8ARKoOl3UBT4m7/X+QOXJo3sLTcq+yMMYTA==} deprecated: This module has moved and is now available at @rollup/plugin-replace. Please update your dependencies. This version is no longer maintained. @@ -29815,7 +29834,7 @@ packages: peerDependencies: rollup: ^2.0.0 dependencies: - '@babel/code-frame': 7.18.6 + '@babel/code-frame': 7.22.5 jest-worker: 26.6.2 rollup: 2.79.1 serialize-javascript: 4.0.0 @@ -33016,7 +33035,7 @@ packages: /unload@2.2.0: resolution: {integrity: sha512-B60uB5TNBLtN6/LsgAf3udH9saB5p7gqJwcFfbOEZ8BcBHnGwCf6G/TGiEqkRAxX7zAFIUtzdrXQSdL3Q/wqNA==} dependencies: - '@babel/runtime': 7.19.0 + '@babel/runtime': 7.23.2 detect-node: 2.1.0 dev: true diff --git a/testapps/react-i18next/package.json b/testapps/react-i18next/package.json index 56f45317b4..69aa4a813a 100644 --- a/testapps/react-i18next/package.json +++ b/testapps/react-i18next/package.json @@ -9,11 +9,11 @@ "@tolgee/core": "5.16.0", "@tolgee/i18next": "5.16.0", "concurrently": "^7.3.0", - "i18next": "^23.5.1", + "i18next": "23.5.1", "i18next-icu": "^2.3.0", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-i18next": "^13.2.2", + "react-i18next": "13.2.2", "react-scripts": "5.0.1", "serve": "^14.1.1", "web-vitals": "^2.1.4"