From aaea4201c99fbbfa9c553b250ef8a01a538fbec9 Mon Sep 17 00:00:00 2001 From: ecemooo Date: Wed, 18 Nov 2026 13:33:42 +0300 Subject: [PATCH 1/5] chore: upgrade react-markdown to 9.1.0 so it stops warning about defaultProps (LAZ-1698) --- docs/testing.md | 12 +- pnpm-lock.yaml | 770 +++++++++++++----- pnpm-workspace.yaml | 2 +- src/renderer/src/controls/More.tsx | 2 +- .../about_dialog/views/AboutPage.tsx | 3 +- .../CollectionInstructions.tsx | 2 +- .../InstallDialog/InstallStartDialog.tsx | 2 +- .../views/DependencyIcon.tsx | 3 +- .../views/PluginList.tsx | 3 +- .../InstructionsOverlay.tsx | 2 +- .../ui/components/prose/markdown/Markdown.tsx | 2 +- .../react_markdown/ReactMarkdown.test.tsx | 32 + .../prose/react_markdown/ReactMarkdown.ts | 11 + .../prose/web_link/WebLink.test.tsx | 2 +- src/renderer/src/views/Dialog.tsx | 3 +- src/renderer/test-setup.mts | 51 +- 16 files changed, 668 insertions(+), 234 deletions(-) create mode 100644 src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.test.tsx create mode 100644 src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.ts diff --git a/docs/testing.md b/docs/testing.md index b2149f95a5..6eccf6cc83 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -55,6 +55,14 @@ renderer's test setup, `src/renderer/test-setup.mts`, enforces this: when React logs one, the test that logged it fails with `React updated X outside act()`. +It also fails a test on a function component that sets `defaultProps` +(`X set defaultProps on a function component`), which React 19 drops. In our +code, use default parameter values instead. From a dependency, upgrade it. If the +version that fixes it is ESM-only, the renderer can't `import` it while it +compiles to CommonJS; load it the way +`src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.ts` loads +react-markdown. + The check is there because nothing else surfaces these warnings. Vitest's default reporter hides a test's console output, so a run that logs dozens of warnings still looks clean, and a passing CI log doesn't get read. The suite was @@ -114,8 +122,8 @@ The usual sources: - An update that lands after testing-library's cleanup fails the next test in the file, or the file's `afterAll` after its last test, rather than the test that caused it. -- Only `act()` warnings fail a test. The deprecation warnings still in the log - (`findDOMNode`, `defaultProps`, legacy `contextTypes`) come from older code: +- Only `act()` and `defaultProps` warnings fail a test. The deprecation warnings + still in the log (`findDOMNode`, legacy `contextTypes`) come from older code: class components built on `ComponentEx` in `src/renderer/src/controls/`, and old dependencies such as `react-bootstrap` 0.33. Clearing them means changing that code, not the tests. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 696478484f..2430f7b0fe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -804,8 +804,8 @@ catalogs: specifier: 11.18.6 version: 11.18.6 react-markdown: - specifier: 6.0.3 - version: 6.0.3 + specifier: 9.1.0 + version: 9.1.0 react-overlays: specifier: 1.2.0 version: 1.2.0 @@ -1253,7 +1253,7 @@ importers: version: 11.18.6(i18next@21.10.0)(react-dom@18.3.1)(react@18.3.1) react-markdown: specifier: 'catalog:' - version: 6.0.3(@types/react@18.3.31)(react@18.3.1)(supports-color@10.2.2) + version: 9.1.0(@types/react@18.3.31)(react@18.3.1) react-redux: specifier: 'catalog:' version: 7.2.9(react-dom@18.3.1)(react@18.3.1) @@ -2432,7 +2432,7 @@ importers: version: 2.4.1 electron: specifier: 'catalog:' - version: 45.3.3 + version: 45.3.3(supports-color@10.2.2) modmeta-db: specifier: 'catalog:' version: https://codeload.github.com/Nexus-Mods/modmeta-db/tar.gz/daa8935b6e38e255ec192c908adfce35d47c0336(commander@14.0.3)(encoding-down@6.3.0)(express@4.22.1)(leveldown@5.6.0)(levelup@4.4.0) @@ -2704,7 +2704,7 @@ importers: version: 11.18.6(i18next@21.10.0)(react-dom@18.3.1)(react@18.3.1) react-markdown: specifier: 'catalog:' - version: 6.0.3(@types/react@18.3.31)(react@18.3.1)(supports-color@10.2.2) + version: 9.1.0(@types/react@18.3.31)(react@18.3.1) react-redux: specifier: 'catalog:' version: 7.2.9(react-dom@18.3.1)(react@18.3.1) @@ -3103,7 +3103,7 @@ importers: version: 2.4.1 electron: specifier: 'catalog:' - version: 45.3.3 + version: 45.3.3(supports-color@10.2.2) turbowalk: specifier: 'catalog:' version: https://codeload.github.com/Nexus-Mods/node-turbowalk/tar.gz/3502f6ffc3f9eb55fe1c9c097b4e4772edce0c0f @@ -3607,7 +3607,7 @@ importers: version: 2.4.1 electron: specifier: 'catalog:' - version: 45.3.3 + version: 45.3.3(supports-color@10.2.2) exe-version: specifier: workspace:* version: link:../../packages/exe-version @@ -3829,7 +3829,7 @@ importers: version: 24.12.2 electron: specifier: 'catalog:' - version: 45.3.3 + version: 45.3.3(supports-color@10.2.2) enquirer: specifier: 'catalog:' version: 2.4.1 @@ -4008,7 +4008,7 @@ importers: version: 3.6.0 electron: specifier: 'catalog:' - version: 45.3.3 + version: 45.3.3(supports-color@10.2.2) i18next: specifier: 'catalog:' version: 21.10.0 @@ -4329,7 +4329,7 @@ importers: version: 11.18.6(i18next@21.10.0)(react-dom@18.3.1)(react@18.3.1) react-markdown: specifier: 'catalog:' - version: 6.0.3(@types/react@18.3.31)(react@18.3.1)(supports-color@10.2.2) + version: 9.1.0(@types/react@18.3.31)(react@18.3.1) react-overlays: specifier: 'catalog:' version: 1.2.0(react-dom@18.3.1)(react@18.3.1) @@ -4543,7 +4543,7 @@ importers: version: 10.1.0 electron: specifier: 'catalog:' - version: 45.3.3 + version: 45.3.3(supports-color@10.2.2) electron-builder: specifier: 'catalog:' version: 24.13.3(electron-builder-squirrel-windows@24.13.3) @@ -4570,7 +4570,7 @@ importers: version: link:../shared electron: specifier: 'catalog:' - version: 45.3.3 + version: 45.3.3(supports-color@10.2.2) src/renderer: dependencies: @@ -4874,7 +4874,7 @@ importers: version: https://codeload.github.com/TanninOne/drivelist/tar.gz/720d1890db11482ec05fc0f6aa176cfa6e6844dd electron: specifier: 'catalog:' - version: 45.3.3 + version: 45.3.3(supports-color@10.2.2) electron-context-menu: specifier: 'catalog:' version: 3.6.1 @@ -5018,7 +5018,7 @@ importers: version: 11.18.6(i18next@21.10.0)(react-dom@18.3.1)(react@18.3.1) react-markdown: specifier: 'catalog:' - version: 6.0.3(@types/react@18.3.31)(react@18.3.1)(supports-color@10.2.2) + version: 9.1.0(@types/react@18.3.31)(react@18.3.1) react-overlays: specifier: 'catalog:' version: 1.2.0(react-dom@18.3.1)(react@18.3.1) @@ -7722,6 +7722,9 @@ packages: '@types/esrecurse@4.3.1': resolution: {integrity: sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==} + '@types/estree-jsx@1.0.5': + resolution: {integrity: sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==} + '@types/estree@1.0.8': resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} @@ -7744,8 +7747,8 @@ packages: '@types/graphlib@2.1.12': resolution: {integrity: sha512-abRfQWMphT2qlXwppQa+CTCtUz/GqxBeozQcMjnOFD/WOKD6sRgxkfG8vq1yagV03447BBzCYhuJ0wiNb+/r+Q==} - '@types/hast@2.3.10': - resolution: {integrity: sha512-McWspRw8xx8J9HurkVBfYj0xKoE25tOFlHGdx4MJ5xORQrMGZNqJhVQWaIbm6Oyla5kYOXtDiopzKRJzEOkwJw==} + '@types/hast@3.0.5': + resolution: {integrity: sha512-rp/ezSWaD1m44dPKICGhiskI13nVr7qTloFwDa/IYkhhf5nzwP+zIQcIJh3WIFSBOy/H1PzB40jPjMDksN4F+g==} '@types/history@2.0.51': resolution: {integrity: sha512-B5YRwLxbpFlmiKcOYsvNIcFT0GYNIGsYC1lLFqoiUeHdTzfGjz1NABo//FuPc/fQAdpGdq4pPSug/9eayOi1yg==} @@ -7795,8 +7798,8 @@ packages: '@types/lodash@4.17.24': resolution: {integrity: sha512-gIW7lQLZbue7lRSWEFql49QJJWThrTFFeIMJdp3eH4tKoxm1OvEPg02rm4wCCSHS0cL3/Fizimb35b7k8atwsQ==} - '@types/mdast@3.0.15': - resolution: {integrity: sha512-LnwD+mUEfxWMa1QpDraczIn6k0Ee3SMicuYSSzS6ZYl2gKS09EClnJYGd8Du6rfc5r/GZEk5o1mRb8TaTj03sQ==} + '@types/mdast@4.0.4': + resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==} '@types/minimatch@2.0.29': resolution: {integrity: sha512-HMjwFKEsu7AWge4XGwDf+aB1LbQ+YHlRZth1YfmzXft5+5DROWamftev/ZLTtjvp3//yY4Iqc0pFQrqJwTiKYg==} @@ -7904,6 +7907,9 @@ packages: '@types/unist@2.0.11': resolution: {integrity: sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==} + '@types/unist@3.0.3': + resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==} + '@types/universal-analytics@0.4.8': resolution: {integrity: sha512-HozCrji3dIImmQcKnP7cN0ZBiYTjuOavzgPRY0CbT4AQ2zH/ZRqYDNTMiYI7aBeMV5ylbu+h59WG/N8qGePmww==} @@ -7993,6 +7999,9 @@ packages: resolution: {integrity: sha512-4g3BLxfdTMy8iZG0MaBkadnlRrCJ74cQiFbyEVMrkwIoqdyaXXQM22cotDvrl4x28wgIZ9rEJRoM+mmhSJpJ1g==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@ungap/structured-clone@1.4.0': + resolution: {integrity: sha512-1mEZtMKPM09vDmQt5y7YvmN2+DFTP7Tg0EWXdic8/C6VRnpb33e4ghisCIE3WZjsE2N8mf+QV1Zqh7ZFYLWInQ==} + '@valibot/to-json-schema@1.7.1': resolution: {integrity: sha512-3qkmU6KXWh8GIThEAW3kuRHPQBMjWkKy+Ppz3WkUucx53DTpOa6siMn4xDGSOhlVyMrDaJTCTMLYPZVAIk1P0A==} peerDependencies: @@ -8533,8 +8542,8 @@ packages: peerDependencies: '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 - bail@1.0.5: - resolution: {integrity: sha512-xFbRxM1tahm08yHBP16MMjVUAvDaBMD38zsM9EMAUN61omwLmKlOpB/Zku5QkjZ8TZ4vn53pj+t518cH0S03RQ==} + bail@2.0.2: + resolution: {integrity: sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==} balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -8711,6 +8720,9 @@ packages: caseless@0.12.0: resolution: {integrity: sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==} + ccount@2.0.1: + resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==} + chai@6.2.2: resolution: {integrity: sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==} engines: {node: '>=18'} @@ -8726,14 +8738,17 @@ packages: change-case@5.4.4: resolution: {integrity: sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==} - character-entities-legacy@1.1.4: - resolution: {integrity: sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==} + character-entities-html4@2.1.0: + resolution: {integrity: sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==} - character-entities@1.2.4: - resolution: {integrity: sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==} + character-entities-legacy@3.0.0: + resolution: {integrity: sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==} - character-reference-invalid@1.1.4: - resolution: {integrity: sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==} + character-entities@2.0.2: + resolution: {integrity: sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==} + + character-reference-invalid@2.0.1: + resolution: {integrity: sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==} chokidar@4.0.3: resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} @@ -8843,8 +8858,8 @@ packages: resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} engines: {node: '>= 0.8'} - comma-separated-tokens@1.0.8: - resolution: {integrity: sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw==} + comma-separated-tokens@2.0.3: + resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==} commander@14.0.3: resolution: {integrity: sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==} @@ -9170,6 +9185,9 @@ packages: decimal.js-light@2.5.1: resolution: {integrity: sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==} + decode-named-character-reference@1.3.0: + resolution: {integrity: sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q==} + decompress-response@10.0.0: resolution: {integrity: sha512-oj7KWToJuuxlPr7VV0vabvxEIiqNMo+q0NueIiL3XhtwC6FVOX7Hr1c0C4eD0bmf7Zr+S/dSf2xvkH3Ad6sU3Q==} engines: {node: '>=20'} @@ -9261,6 +9279,9 @@ packages: resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} engines: {node: '>=8'} + devlop@1.1.0: + resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==} + dir-compare@3.3.0: resolution: {integrity: sha512-J7/et3WlGUCxjdnD3HAAzQ6nsnc0WL6DD7WcwJb7c39iH1+AWfg+9OqzJNaI6PkBwBvm1mhZNL9iY/nRiZXlPg==} @@ -9618,6 +9639,9 @@ packages: resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} engines: {node: '>=4.0'} + estree-util-is-identifier-name@3.0.0: + resolution: {integrity: sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg==} + estree-walker@3.0.3: resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} @@ -9999,6 +10023,12 @@ packages: resolution: {integrity: sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==} engines: {node: '>= 0.4'} + hast-util-to-jsx-runtime@2.3.7: + resolution: {integrity: sha512-F7DNV2NMcTxA4GqPVHnXzX+mpoPHAIY9rJAVH3CZ1FdBZOcBUEjUuvMkMpHVs/sicEtznh9tMGj5WUR9S4E2rg==} + + hast-util-whitespace@3.0.0: + resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==} + heap@0.2.7: resolution: {integrity: sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg==} @@ -10021,6 +10051,9 @@ packages: html-parse-stringify@3.0.1: resolution: {integrity: sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg==} + html-url-attributes@3.0.1: + resolution: {integrity: sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==} + http-cache-semantics@4.2.0: resolution: {integrity: sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==} @@ -10142,8 +10175,8 @@ packages: resolution: {integrity: sha512-IBTdIkzZNOpqm7q3dRqJvMaldXjDHWkEDfrwGEQTs5eaQMWV+djAhR+wahyNNMAa+qpbDUhBMVt4ZKNwpPm7xQ==} engines: {node: ^20.17.0 || >=22.9.0} - inline-style-parser@0.1.1: - resolution: {integrity: sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q==} + inline-style-parser@0.2.9: + resolution: {integrity: sha512-IttN8BqKLxzUrnTqHI+/hwAJQItBAUjdoHERCDv+oOuX48VP6bzW8+QjOXSfoevzq3YrYAwX1uLHp8TqO9yIeg==} internmap@2.0.3: resolution: {integrity: sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==} @@ -10169,11 +10202,11 @@ packages: resolution: {integrity: sha512-wOa3CXFJAu8BZ2BDtG9xYOOrsq6oiSvc2jFPy4X/HINx5bmJUcW8e+apItVbU2E7GIfBVaFVO7Zit4oAWtTJcw==} engines: {node: '>=8'} - is-alphabetical@1.0.4: - resolution: {integrity: sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==} + is-alphabetical@2.0.1: + resolution: {integrity: sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==} - is-alphanumerical@1.0.4: - resolution: {integrity: sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==} + is-alphanumerical@2.0.1: + resolution: {integrity: sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==} is-arguments@1.2.0: resolution: {integrity: sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA==} @@ -10182,10 +10215,6 @@ packages: is-arrayish@0.2.1: resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} - is-buffer@2.0.5: - resolution: {integrity: sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==} - engines: {node: '>=4'} - is-ci@3.0.1: resolution: {integrity: sha512-ZYvCgrefwqoQ6yTyYUbQu64HsITZ3NfKX1lzaEYdkTDcfKzzCI/wthRRYKkdjHKFVgNiXKAKm65Zo1pk2as/QQ==} hasBin: true @@ -10198,8 +10227,8 @@ packages: resolution: {integrity: sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==} engines: {node: '>= 0.4'} - is-decimal@1.0.4: - resolution: {integrity: sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==} + is-decimal@2.0.1: + resolution: {integrity: sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==} is-docker@3.0.0: resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==} @@ -10226,8 +10255,8 @@ packages: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} - is-hexadecimal@1.0.4: - resolution: {integrity: sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==} + is-hexadecimal@2.0.1: + resolution: {integrity: sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==} is-inside-container@1.0.0: resolution: {integrity: sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==} @@ -10246,9 +10275,9 @@ packages: resolution: {integrity: sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==} engines: {node: '>=0.10.0'} - is-plain-obj@2.1.0: - resolution: {integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==} - engines: {node: '>=8'} + is-plain-obj@4.1.0: + resolution: {integrity: sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==} + engines: {node: '>=12'} is-plain-object@2.0.4: resolution: {integrity: sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==} @@ -10682,6 +10711,9 @@ packages: resolution: {integrity: sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==} engines: {node: '>=18'} + longest-streak@3.1.0: + resolution: {integrity: sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==} + loose-envify@1.4.0: resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} hasBin: true @@ -10746,24 +10778,33 @@ packages: resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} engines: {node: '>= 0.4'} - mdast-util-definitions@4.0.0: - resolution: {integrity: sha512-k8AJ6aNnUkB7IE+5azR9h81O5EQ/cTDXtWdMq9Kk5KcEW/8ritU5CeLg/9HhOC++nALHBlaogJ5jz0Ybk3kPMQ==} + mdast-util-from-markdown@2.1.0: + resolution: {integrity: sha512-KRLgmPaP2H1ul2bpoJkOS+9pAcDAAj9Nu1mqLnh8NLeJG5tlvj42TH80PIGBpROWlRXLk0lDrWNuZCFy/tsB4A==} + + mdast-util-mdx-expression@2.0.1: + resolution: {integrity: sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==} + + mdast-util-mdx-jsx@3.2.1: + resolution: {integrity: sha512-oXp1GIa+E9IwIs3a106+tr3Bz2MlTTBvlXjOZMoIat11kk7vjqgmBnksB9WHmWv+gZh7k3IUgpAHlwHB7DH4GQ==} + + mdast-util-mdxjs-esm@2.0.1: + resolution: {integrity: sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==} + + mdast-util-phrasing@4.1.0: + resolution: {integrity: sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==} - mdast-util-from-markdown@0.8.5: - resolution: {integrity: sha512-2hkTXtYYnr+NubD/g6KGBS/0mFmBcifAsI0yIWRiRo0PjVs6SSOSOdtzbp6kSGnShDN6G5aWZpKQ2lWRy27mWQ==} + mdast-util-to-hast@13.2.2: + resolution: {integrity: sha512-l2pnmOuqs+SGLVpTVXnRLQu5v1AzvDe181404fbXzzqObVxrAnnVxapAP27pUwzLBL/ABIkgUhGlPVU7QSvIFg==} - mdast-util-to-hast@10.2.0: - resolution: {integrity: sha512-JoPBfJ3gBnHZ18icCwHR50orC9kNH81tiR1gs01D8Q5YpV6adHNO9nKNuFBCJQ941/32PT1a63UF/DitmS3amQ==} + mdast-util-to-markdown@2.2.3: + resolution: {integrity: sha512-dImdB6VZRMRac1SwAW6o1c0ESk/7pFFAMCMuKM+9v7LpTSthMM5nzXpqKw4Mjo66aXVKhNkyrP4bMB9MurPyWg==} - mdast-util-to-string@2.0.0: - resolution: {integrity: sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==} + mdast-util-to-string@4.0.0: + resolution: {integrity: sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==} mdn-data@2.28.1: resolution: {integrity: sha512-U9w+PzSZ00Z5m9rZ5ARVFL5xOfuCHdKYi/1RRwDCJsboFgJDNT3zT6PIPD7mZQYaQLhsZM3GfDRgSMRHhSmVng==} - mdurl@1.0.1: - resolution: {integrity: sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==} - media-typer@0.3.0: resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} engines: {node: '>= 0.6'} @@ -10785,8 +10826,71 @@ packages: resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==} engines: {node: '>= 0.6'} - micromark@2.11.4: - resolution: {integrity: sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==} + micromark-core-commonmark@2.0.4: + resolution: {integrity: sha512-wxEeE8v8XVvOrxn1TZj74qYhAtTQsSqufHVS3uNVyT1MupXxhyaHk8/9xDNPh9BmL77QNDgWTkZ3RsYHB2ry7w==} + + micromark-factory-destination@2.0.1: + resolution: {integrity: sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==} + + micromark-factory-label@2.0.1: + resolution: {integrity: sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==} + + micromark-factory-space@2.1.0: + resolution: {integrity: sha512-fS8hnLIjnjvdQIj39Geug8wWsR0HrYZ43KShKxNfwT7t2LOHo/LbWZEzEaSOjwtjdCsjoE6syHhonEzW0zv0+Q==} + + micromark-factory-title@2.0.1: + resolution: {integrity: sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==} + + micromark-factory-whitespace@2.0.1: + resolution: {integrity: sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==} + + micromark-util-character@2.1.1: + resolution: {integrity: sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==} + + micromark-util-chunked@2.0.1: + resolution: {integrity: sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==} + + micromark-util-classify-character@2.0.1: + resolution: {integrity: sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==} + + micromark-util-combine-extensions@2.0.1: + resolution: {integrity: sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==} + + micromark-util-decode-numeric-character-reference@2.0.2: + resolution: {integrity: sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==} + + micromark-util-decode-string@2.0.1: + resolution: {integrity: sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==} + + micromark-util-edit-map@1.0.0: + resolution: {integrity: sha512-Pa2ljlsEL6sVwFaYeyrOLSYbQt73JvGbPOYFq+9AElXiSnfI5Q4465RRZ1sHv7lDjDOnGRDDaqPXqClqWK/q1Q==} + + micromark-util-encode@2.0.1: + resolution: {integrity: sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==} + + micromark-util-html-tag-name@2.0.1: + resolution: {integrity: sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==} + + micromark-util-normalize-identifier@2.0.1: + resolution: {integrity: sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==} + + micromark-util-resolve-all@2.0.1: + resolution: {integrity: sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==} + + micromark-util-sanitize-uri@2.0.1: + resolution: {integrity: sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==} + + micromark-util-subtokenize@2.1.0: + resolution: {integrity: sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==} + + micromark-util-symbol@2.0.1: + resolution: {integrity: sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==} + + micromark-util-types@2.0.3: + resolution: {integrity: sha512-oxB2Ik03hI0gv+VNn9tnh1t1YEe9MDPptViAEgfdf3YQHsn0pzGTgCdlSCJXcwhqm8phaEuM7zeEu3QQzVBrPg==} + + micromark@4.0.3: + resolution: {integrity: sha512-oGYfQzHSG5dOMovQcJ3fyTmZlWAWpi0XA0sJwJs+i6OT88o1+Jtw/8z0CmdowSLxGhhFK89rQ/oXph/wN02PNw==} micromatch@4.0.8: resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} @@ -11372,8 +11476,8 @@ packages: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} - parse-entities@2.0.0: - resolution: {integrity: sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==} + parse-entities@4.0.2: + resolution: {integrity: sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==} parse-json@5.2.0: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} @@ -11531,8 +11635,8 @@ packages: prop-types@15.8.1: resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==} - property-information@5.6.0: - resolution: {integrity: sha512-YUHSPk+A30YPv+0Qf8i9Mbfe/C0hdPXk1s1jPVToV8pk8BQtpw10ct89Eo7OWkutrwqvT0eicAxlOg3dOAu8JA==} + property-information@7.2.0: + resolution: {integrity: sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==} proxy-addr@2.0.7: resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==} @@ -11685,11 +11789,11 @@ packages: react-lifecycles-compat@3.0.4: resolution: {integrity: sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==} - react-markdown@6.0.3: - resolution: {integrity: sha512-kQbpWiMoBHnj9myLlmZG9T1JdoT/OEyHK7hqM6CqFT14MAkgWiWBUYijLyBmxbntaN6dCDicPcUhWhci1QYodg==} + react-markdown@9.1.0: + resolution: {integrity: sha512-xaijuJB0kzGiUdG7nc2MOMDUDBWPyGAjZtUrow9XxUeua8IqeP+VlIfAZ3bphpcLTnSZXz6z9jcVC/TCwbfgdw==} peerDependencies: '@types/react': '18' - react: '>=16' + react: '>=18' react-onclickoutside@6.13.2: resolution: {integrity: sha512-h6Hbf1c8b7tIYY4u90mDdBLY4+AGQVMFtIE89HgC0DtVCh/JfKl477gYqUtGLmjZBKK3MJxomP/lFiLbz4sq9A==} @@ -11884,11 +11988,11 @@ packages: engines: {node: '>= 0.10.0'} hasBin: true - remark-parse@9.0.0: - resolution: {integrity: sha512-geKatMwSzEXKHuzBNU1z676sGcDcFoChMK38TgdHJNAYfFtsfHDQG7MoJAjs6sgYMqyLduCYWDIWZIxiPeafEw==} + remark-parse@11.0.0: + resolution: {integrity: sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==} - remark-rehype@8.1.0: - resolution: {integrity: sha512-EbCu9kHgAxKmW1yEYjx3QafMyGY3q8noUbNUI5xyKbaFP89wbhDrKxyIQNukNYthzjNHZu6J7hwFg7hRm1svYA==} + remark-rehype@11.1.2: + resolution: {integrity: sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==} remove-accents@0.5.0: resolution: {integrity: sha512-8g3/Otx1eJaVD12e31UbJj1YzdtVvzH85HV7t+9MJYk/u3XmkOUJ5Ys9wQrf9PCPK8+xn4ymzqYCiZl6QWKn+A==} @@ -12247,8 +12351,8 @@ packages: resolution: {integrity: sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==} engines: {node: '>= 12'} - space-separated-tokens@1.1.5: - resolution: {integrity: sha512-q/JSVd1Lptzhf5bkYm4ob4iWPjx0KiRe3sRFBNrVqbJkFaBm5vbbowy1mymoPNLRa52+oadOhJ+K49wsSeSjTA==} + space-separated-tokens@2.0.2: + resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==} sshpk@1.18.0: resolution: {integrity: sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==} @@ -12320,6 +12424,9 @@ packages: string_decoder@1.3.0: resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} + stringify-entities@4.0.4: + resolution: {integrity: sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==} + strip-ansi@3.0.1: resolution: {integrity: sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==} engines: {node: '>=0.10.0'} @@ -12348,8 +12455,8 @@ packages: resolution: {integrity: sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==} engines: {node: '>=0.10.0'} - style-to-object@0.3.0: - resolution: {integrity: sha512-CzFnRRXhzWIdItT3OmF8SQfWyahHhjq3HwcMNCNLn+N7klOOqPjMeG/4JSu77D7ypZdGvSzvkrbyeTMizz2VrA==} + style-to-object@2.0.2: + resolution: {integrity: sha512-QmbXPUylqU80HAgTOJeEOdbA40W9KtxmjMhQy+tq+b8F2aoh3aQLuy82hh2jm2qsC9hR9eI0+eQidTMydKcqRA==} sumchecker@3.0.1: resolution: {integrity: sha512-MvjXzkz/BOfyVDkG0oFOtBxHX2u3gKbMHIF/dXblZsgD3BWOFLmHovIpZY7BykJdAjcqRCBi1WYBNdEC9yI7vg==} @@ -12566,8 +12673,11 @@ packages: resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} hasBin: true - trough@1.0.5: - resolution: {integrity: sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==} + trim-lines@3.0.1: + resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==} + + trough@2.2.0: + resolution: {integrity: sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==} truncate-utf8-bytes@1.0.2: resolution: {integrity: sha512-95Pu1QXQvruGEhv62XCMO3Mm90GscOCClvrIUwCM0PYOXK3kaF3l3sIHxx71ThJfcbM2O5Au6SO3AWCSEfW4mQ==} @@ -12768,32 +12878,26 @@ packages: unidragger@2.4.0: resolution: {integrity: sha512-MueZK2oXuGE6OAlGKIrSXK2zCq+8yb1QUZgqyTDCSJzvwYL0g2Llrad+TtoQTYxtFnNyxxSw0IMnKNIgEMia1w==} - unified@9.2.2: - resolution: {integrity: sha512-Sg7j110mtefBD+qunSLO1lqOEKdrwBFBrR6Qd8f4uwkhWNlbkaqwHse6e7QvD3AP/MNoJdEDLaf8OxYyoWgorQ==} + unified@11.0.5: + resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==} unipointer@2.4.0: resolution: {integrity: sha512-VjzDLPjGK7aYpQKH7bnDZS8X4axF5AFU/LQi+NQe1oyEHfaz6lWKhaQ7n4o7vJ1iJ4i2T0quCIfrQM139p05Sw==} - unist-builder@2.0.3: - resolution: {integrity: sha512-f98yt5pnlMWlzP539tPc4grGMsFaQQlP/vM396b00jngsiINumNmsY8rkXjfoi1c6QaM8nQ3vaGDuoKWbe/1Uw==} - - unist-util-generated@1.1.6: - resolution: {integrity: sha512-cln2Mm1/CZzN5ttGK7vkoGw+RZ8VcUH6BtGbq98DDtRGquAAOXig1mrBQYelOwMXYS8rK+vZDyyojSjp7JX+Lg==} - - unist-util-is@4.1.0: - resolution: {integrity: sha512-ZOQSsnce92GrxSqlnEEseX0gi7GH9zTJZ0p9dtu87WRb/37mMPO2Ilx1s/t9vBHrFhbgweUwb+t7cIn5dxPhZg==} + unist-util-is@6.0.1: + resolution: {integrity: sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==} - unist-util-position@3.1.0: - resolution: {integrity: sha512-w+PkwCbYSFw8vpgWD0v7zRCl1FpY3fjDSQ3/N/wNd9Ffa4gPi8+4keqt99N3XW6F99t/mUzp2xAhNmfKWp95QA==} + unist-util-position@5.0.0: + resolution: {integrity: sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==} - unist-util-stringify-position@2.0.3: - resolution: {integrity: sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==} + unist-util-stringify-position@4.0.0: + resolution: {integrity: sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==} - unist-util-visit-parents@3.1.1: - resolution: {integrity: sha512-1KROIZWo6bcMrZEwiH2UrXDyalAa0uqzWCxCJj6lPOvTve2WkfgCytoDTPaMnodXh1WrXOq0haVYHj99ynJlsg==} + unist-util-visit-parents@6.1.0: + resolution: {integrity: sha512-vKXxz6O38sKDj1mtx/k2cWvkkFBuYGx6uGrlzBkVeWCRF/F8sdI0j3Wbkz/5rVNRRuVc8UrgRdbCxNhmYXgP3w==} - unist-util-visit@2.0.3: - resolution: {integrity: sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==} + unist-util-visit@5.2.0: + resolution: {integrity: sha512-fpsYs/VVoZxfGY9/j3FQpZmN8wdLJaV1Pt38AaJNZu9uKIHcFU3halCdBveEq1HGKO1OEfJY65w1zvoFV1b3qQ==} universal-analytics@0.4.23: resolution: {integrity: sha512-lgMIH7XBI6OgYn1woDEmxhGdj8yDefMKg7GkWdeATAlQZFrMrNyxSkpDzY57iY0/6fdlzTbBV03OawvvzG+q7A==} @@ -12875,11 +12979,11 @@ packages: resolution: {integrity: sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==} engines: {'0': node >=0.6.0} - vfile-message@2.0.4: - resolution: {integrity: sha512-DjssxRGkMvifUOJre00juHoP9DPWuzjxKuMDrhNbk2TdaYYBNMStsNhEOt3idrtI12VQYM/1+iM0KOzXi4pxwQ==} + vfile-message@4.0.4: + resolution: {integrity: sha512-66ycRswIkNmHH9PHku7ADtv5RVwgIrOcuv3J8Svz6h4qgGRrKVa+9/neuKyJZUXyOpYwLTvS+whZ4R2urHHgQg==} - vfile@4.2.1: - resolution: {integrity: sha512-O6AE4OskCG5S1emQ/4gl8zK586RqA3srz3nfK/Viy0UPToBc5Trp9BVFb1u0CjsKrAWwnpr4ifM/KBXPWwJbCA==} + vfile@6.0.3: + resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==} victory-vendor@36.9.2: resolution: {integrity: sha512-PnpQQMuxlwYdocC8fIJqVXvkeViHYzotI+NJrCuav0ZYFoq912ZHBk3mCeuj+5/VpodOjPe1z0Fk2ihgzlXqjQ==} @@ -13234,6 +13338,9 @@ packages: zone.js@0.15.1: resolution: {integrity: sha512-XE96n56IQpJM7NAoXswY3XRLcWFW83xe0BiAOeMD7K5k5xecOeul3Qcpx6GqEeeHNkW5DWL5zOyTbEfB4eti8w==} + zwitch@2.0.4: + resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} + snapshots: 7z-bin@https://codeload.github.com/Nexus-Mods/7z-bin/tar.gz/025786f01319526b56400b0410af6268adc1125c: {} @@ -14114,14 +14221,14 @@ snapshots: glob: 7.2.3 minimatch: 3.1.5 - '@electron/get@5.0.0': + '@electron/get@5.0.0(supports-color@10.2.2)': dependencies: debug: 4.4.3(supports-color@10.2.2) env-paths: 3.0.0 graceful-fs: 4.2.11 progress: 2.0.3 semver: 7.8.5 - sumchecker: 3.0.1 + sumchecker: 3.0.1(supports-color@10.2.2) optionalDependencies: undici: 7.29.0 transitivePeerDependencies: @@ -14159,7 +14266,7 @@ snapshots: '@electron/remote@2.1.3(electron@45.3.3)': dependencies: - electron: 45.3.3 + electron: 45.3.3(supports-color@10.2.2) '@electron/universal@1.5.1': dependencies: @@ -15775,6 +15882,10 @@ snapshots: '@types/esrecurse@4.3.1': {} + '@types/estree-jsx@1.0.5': + dependencies: + '@types/estree': 1.0.8 + '@types/estree@1.0.8': {} '@types/feedparser@2.2.8': @@ -15799,7 +15910,7 @@ snapshots: '@types/graphlib@2.1.12': {} - '@types/hast@2.3.10': + '@types/hast@3.0.5': dependencies: '@types/unist': 2.0.11 @@ -15845,7 +15956,7 @@ snapshots: '@types/lodash@4.17.24': {} - '@types/mdast@3.0.15': + '@types/mdast@4.0.4': dependencies: '@types/unist': 2.0.11 @@ -15967,6 +16078,8 @@ snapshots: '@types/unist@2.0.11': {} + '@types/unist@3.0.3': {} + '@types/universal-analytics@0.4.8': {} '@types/uuid@3.4.13': {} @@ -16104,6 +16217,8 @@ snapshots: '@typescript-eslint/types': 8.62.1 eslint-visitor-keys: 5.0.1 + '@ungap/structured-clone@1.4.0': {} + '@valibot/to-json-schema@1.7.1(valibot@1.4.2)': dependencies: valibot: 1.4.2(typescript@6.0.3) @@ -16623,7 +16738,7 @@ snapshots: transitivePeerDependencies: - supports-color - bail@1.0.5: {} + bail@2.0.2: {} balanced-match@1.0.2: {} @@ -16826,6 +16941,8 @@ snapshots: caseless@0.12.0: {} + ccount@2.0.1: {} + chai@6.2.2: {} chalk@2.4.2: @@ -16841,11 +16958,13 @@ snapshots: change-case@5.4.4: {} - character-entities-legacy@1.1.4: {} + character-entities-html4@2.1.0: {} + + character-entities-legacy@3.0.0: {} - character-entities@1.2.4: {} + character-entities@2.0.2: {} - character-reference-invalid@1.1.4: {} + character-reference-invalid@2.0.1: {} chokidar@4.0.3: dependencies: @@ -16941,7 +17060,7 @@ snapshots: dependencies: delayed-stream: 1.0.0 - comma-separated-tokens@1.0.8: {} + comma-separated-tokens@2.0.3: {} commander@14.0.3: {} @@ -17294,6 +17413,10 @@ snapshots: decimal.js-light@2.5.1: {} + decode-named-character-reference@1.3.0: + dependencies: + character-entities: 2.0.2 + decompress-response@10.0.0: dependencies: mimic-response: 4.0.0 @@ -17369,6 +17492,10 @@ snapshots: detect-libc@2.1.2: {} + devlop@1.1.0: + dependencies: + dequal: 2.0.3 + dir-compare@3.3.0: dependencies: buffer-equal: 1.0.1 @@ -17519,7 +17646,7 @@ snapshots: electron-extension-installer@2.0.1(electron@45.3.3): dependencies: - electron: 45.3.3 + electron: 45.3.3(supports-color@10.2.2) jszip: 3.10.1 electron-is-dev@2.0.0: {} @@ -17559,10 +17686,10 @@ snapshots: transitivePeerDependencies: - supports-color - electron@45.3.3: + electron@45.3.3(supports-color@10.2.2): dependencies: '@electron-internal/extract-zip': 1.0.4 - '@electron/get': 5.0.0 + '@electron/get': 5.0.0(supports-color@10.2.2) '@types/node': 24.12.2 transitivePeerDependencies: - supports-color @@ -17877,6 +18004,8 @@ snapshots: estraverse@5.3.0: {} + estree-util-is-identifier-name@3.0.0: {} + estree-walker@3.0.3: dependencies: '@types/estree': 1.0.8 @@ -18330,6 +18459,30 @@ snapshots: dependencies: function-bind: 1.1.2 + hast-util-to-jsx-runtime@2.3.7: + dependencies: + '@types/estree': 1.0.8 + '@types/hast': 3.0.5 + '@types/unist': 3.0.3 + comma-separated-tokens: 2.0.3 + devlop: 1.1.0 + estree-util-is-identifier-name: 3.0.0 + hast-util-whitespace: 3.0.0 + mdast-util-mdx-expression: 2.0.1 + mdast-util-mdx-jsx: 3.2.1 + mdast-util-mdxjs-esm: 2.0.1 + property-information: 7.2.0 + space-separated-tokens: 2.0.2 + style-to-object: 2.0.2 + unist-util-position: 5.0.0 + vfile-message: 4.0.4 + transitivePeerDependencies: + - supports-color + + hast-util-whitespace@3.0.0: + dependencies: + '@types/hast': 3.0.5 + heap@0.2.7: {} hoist-non-react-statics@3.3.2: @@ -18350,6 +18503,8 @@ snapshots: dependencies: void-elements: 3.1.0 + html-url-attributes@3.0.1: {} + http-cache-semantics@4.2.0: {} http-errors@2.0.1: @@ -18464,7 +18619,7 @@ snapshots: ini@6.0.0: {} - inline-style-parser@0.1.1: {} + inline-style-parser@0.2.9: {} internmap@2.0.3: {} @@ -18485,12 +18640,12 @@ snapshots: dependencies: execa: 1.0.0 - is-alphabetical@1.0.4: {} + is-alphabetical@2.0.1: {} - is-alphanumerical@1.0.4: + is-alphanumerical@2.0.1: dependencies: - is-alphabetical: 1.0.4 - is-decimal: 1.0.4 + is-alphabetical: 2.0.1 + is-decimal: 2.0.1 is-arguments@1.2.0: dependencies: @@ -18499,8 +18654,6 @@ snapshots: is-arrayish@0.2.1: {} - is-buffer@2.0.5: {} - is-ci@3.0.1: dependencies: ci-info: 3.9.0 @@ -18514,7 +18667,7 @@ snapshots: call-bound: 1.0.4 has-tostringtag: 1.0.2 - is-decimal@1.0.4: {} + is-decimal@2.0.1: {} is-docker@3.0.0: {} @@ -18534,7 +18687,7 @@ snapshots: dependencies: is-extglob: 2.1.1 - is-hexadecimal@1.0.4: {} + is-hexadecimal@2.0.1: {} is-inside-container@1.0.0: dependencies: @@ -18546,7 +18699,7 @@ snapshots: is-plain-obj@1.1.0: {} - is-plain-obj@2.1.0: {} + is-plain-obj@4.1.0: {} is-plain-object@2.0.4: dependencies: @@ -18931,6 +19084,8 @@ snapshots: strip-ansi: 7.2.0 wrap-ansi: 9.0.2 + longest-streak@3.1.0: {} + loose-envify@1.4.0: dependencies: js-tokens: 4.0.0 @@ -18991,36 +19146,98 @@ snapshots: math-intrinsics@1.1.0: {} - mdast-util-definitions@4.0.0: + mdast-util-from-markdown@2.1.0: + dependencies: + '@types/mdast': 4.0.4 + '@types/unist': 3.0.3 + decode-named-character-reference: 1.3.0 + devlop: 1.1.0 + mdast-util-to-string: 4.0.0 + micromark: 4.0.3 + micromark-util-decode-numeric-character-reference: 2.0.2 + micromark-util-decode-string: 2.0.1 + micromark-util-normalize-identifier: 2.0.1 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.3 + unist-util-stringify-position: 4.0.0 + transitivePeerDependencies: + - supports-color + + mdast-util-mdx-expression@2.0.1: dependencies: - unist-util-visit: 2.0.3 + '@types/estree-jsx': 1.0.5 + '@types/hast': 3.0.5 + '@types/mdast': 4.0.4 + devlop: 1.1.0 + mdast-util-from-markdown: 2.1.0 + mdast-util-to-markdown: 2.2.3 + transitivePeerDependencies: + - supports-color - mdast-util-from-markdown@0.8.5(supports-color@10.2.2): + mdast-util-mdx-jsx@3.2.1: + dependencies: + '@types/estree-jsx': 1.0.5 + '@types/hast': 3.0.5 + '@types/mdast': 4.0.4 + '@types/unist': 3.0.3 + ccount: 2.0.1 + devlop: 1.1.0 + mdast-util-from-markdown: 2.1.0 + mdast-util-to-markdown: 2.2.3 + parse-entities: 4.0.2 + stringify-entities: 4.0.4 + unist-util-stringify-position: 4.0.0 + vfile-message: 4.0.4 + transitivePeerDependencies: + - supports-color + + mdast-util-mdxjs-esm@2.0.1: dependencies: - '@types/mdast': 3.0.15 - mdast-util-to-string: 2.0.0 - micromark: 2.11.4(supports-color@10.2.2) - parse-entities: 2.0.0 - unist-util-stringify-position: 2.0.3 + '@types/estree-jsx': 1.0.5 + '@types/hast': 3.0.5 + '@types/mdast': 4.0.4 + devlop: 1.1.0 + mdast-util-from-markdown: 2.1.0 + mdast-util-to-markdown: 2.2.3 transitivePeerDependencies: - supports-color - mdast-util-to-hast@10.2.0: + mdast-util-phrasing@4.1.0: dependencies: - '@types/mdast': 3.0.15 - '@types/unist': 2.0.11 - mdast-util-definitions: 4.0.0 - mdurl: 1.0.1 - unist-builder: 2.0.3 - unist-util-generated: 1.1.6 - unist-util-position: 3.1.0 - unist-util-visit: 2.0.3 + '@types/mdast': 4.0.4 + unist-util-is: 6.0.1 - mdast-util-to-string@2.0.0: {} + mdast-util-to-hast@13.2.2: + dependencies: + '@types/hast': 3.0.5 + '@types/mdast': 4.0.4 + '@ungap/structured-clone': 1.4.0 + devlop: 1.1.0 + micromark-util-sanitize-uri: 2.0.1 + trim-lines: 3.0.1 + unist-util-position: 5.0.0 + unist-util-visit: 5.2.0 + vfile: 6.0.3 - mdn-data@2.28.1: {} + mdast-util-to-markdown@2.2.3: + dependencies: + '@types/mdast': 4.0.4 + '@types/unist': 3.0.3 + longest-streak: 3.1.0 + mdast-util-phrasing: 4.1.0 + mdast-util-to-string: 4.0.0 + micromark-util-character: 2.1.1 + micromark-util-classify-character: 2.0.1 + micromark-util-decode-string: 2.0.1 + micromark-util-html-tag-name: 2.0.1 + unist-util-visit: 5.2.0 + zwitch: 2.0.4 - mdurl@1.0.1: {} + mdast-util-to-string@4.0.0: + dependencies: + '@types/mdast': 4.0.4 + + mdn-data@2.28.1: {} media-typer@0.3.0: {} @@ -19036,10 +19253,142 @@ snapshots: methods@1.1.2: {} - micromark@2.11.4(supports-color@10.2.2): + micromark-core-commonmark@2.0.4: + dependencies: + decode-named-character-reference: 1.3.0 + devlop: 1.1.0 + micromark-factory-destination: 2.0.1 + micromark-factory-label: 2.0.1 + micromark-factory-space: 2.1.0 + micromark-factory-title: 2.0.1 + micromark-factory-whitespace: 2.0.1 + micromark-util-character: 2.1.1 + micromark-util-chunked: 2.0.1 + micromark-util-classify-character: 2.0.1 + micromark-util-edit-map: 1.0.0 + micromark-util-html-tag-name: 2.0.1 + micromark-util-normalize-identifier: 2.0.1 + micromark-util-resolve-all: 2.0.1 + micromark-util-subtokenize: 2.1.0 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.3 + + micromark-factory-destination@2.0.1: + dependencies: + micromark-util-character: 2.1.1 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.3 + + micromark-factory-label@2.0.1: + dependencies: + devlop: 1.1.0 + micromark-util-character: 2.1.1 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.3 + + micromark-factory-space@2.1.0: + dependencies: + micromark-util-character: 2.1.1 + micromark-util-types: 2.0.3 + + micromark-factory-title@2.0.1: + dependencies: + micromark-factory-space: 2.1.0 + micromark-util-character: 2.1.1 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.3 + + micromark-factory-whitespace@2.0.1: + dependencies: + micromark-factory-space: 2.1.0 + micromark-util-character: 2.1.1 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.3 + + micromark-util-character@2.1.1: + dependencies: + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.3 + + micromark-util-chunked@2.0.1: + dependencies: + micromark-util-symbol: 2.0.1 + + micromark-util-classify-character@2.0.1: + dependencies: + micromark-util-character: 2.1.1 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.3 + + micromark-util-combine-extensions@2.0.1: + dependencies: + micromark-util-chunked: 2.0.1 + micromark-util-types: 2.0.3 + + micromark-util-decode-numeric-character-reference@2.0.2: + dependencies: + micromark-util-symbol: 2.0.1 + + micromark-util-decode-string@2.0.1: dependencies: + decode-named-character-reference: 1.3.0 + micromark-util-character: 2.1.1 + micromark-util-decode-numeric-character-reference: 2.0.2 + micromark-util-symbol: 2.0.1 + + micromark-util-edit-map@1.0.0: + dependencies: + micromark-util-types: 2.0.3 + + micromark-util-encode@2.0.1: {} + + micromark-util-html-tag-name@2.0.1: {} + + micromark-util-normalize-identifier@2.0.1: + dependencies: + micromark-util-symbol: 2.0.1 + + micromark-util-resolve-all@2.0.1: + dependencies: + micromark-util-types: 2.0.3 + + micromark-util-sanitize-uri@2.0.1: + dependencies: + micromark-util-character: 2.1.1 + micromark-util-encode: 2.0.1 + micromark-util-symbol: 2.0.1 + + micromark-util-subtokenize@2.1.0: + dependencies: + devlop: 1.1.0 + micromark-util-chunked: 2.0.1 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.3 + + micromark-util-symbol@2.0.1: {} + + micromark-util-types@2.0.3: {} + + micromark@4.0.3: + dependencies: + '@types/debug': 4.1.13 debug: 4.4.3(supports-color@10.2.2) - parse-entities: 2.0.0 + decode-named-character-reference: 1.3.0 + devlop: 1.1.0 + micromark-core-commonmark: 2.0.4 + micromark-factory-space: 2.1.0 + micromark-util-character: 2.1.1 + micromark-util-chunked: 2.0.1 + micromark-util-combine-extensions: 2.0.1 + micromark-util-decode-numeric-character-reference: 2.0.2 + micromark-util-edit-map: 1.0.0 + micromark-util-encode: 2.0.1 + micromark-util-normalize-identifier: 2.0.1 + micromark-util-resolve-all: 2.0.1 + micromark-util-sanitize-uri: 2.0.1 + micromark-util-subtokenize: 2.1.0 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.3 transitivePeerDependencies: - supports-color @@ -19575,14 +19924,15 @@ snapshots: dependencies: callsites: 3.1.0 - parse-entities@2.0.0: + parse-entities@4.0.2: dependencies: - character-entities: 1.2.4 - character-entities-legacy: 1.1.4 - character-reference-invalid: 1.1.4 - is-alphanumerical: 1.0.4 - is-decimal: 1.0.4 - is-hexadecimal: 1.0.4 + '@types/unist': 2.0.11 + character-entities-legacy: 3.0.0 + character-reference-invalid: 2.0.1 + decode-named-character-reference: 1.3.0 + is-alphanumerical: 2.0.1 + is-decimal: 2.0.1 + is-hexadecimal: 2.0.1 parse-json@5.2.0: dependencies: @@ -19737,9 +20087,7 @@ snapshots: object-assign: 4.1.1 react-is: 16.13.1 - property-information@5.6.0: - dependencies: - xtend: 4.0.2 + property-information@7.2.0: {} proxy-addr@2.0.7: dependencies: @@ -19908,23 +20256,21 @@ snapshots: react-lifecycles-compat@3.0.4: {} - react-markdown@6.0.3(@types/react@18.3.31)(react@18.3.1)(supports-color@10.2.2): + react-markdown@9.1.0(@types/react@18.3.31)(react@18.3.1): dependencies: - '@types/hast': 2.3.10 + '@types/hast': 3.0.5 + '@types/mdast': 4.0.4 '@types/react': 18.3.31 - '@types/unist': 2.0.11 - comma-separated-tokens: 1.0.8 - prop-types: 15.8.1 - property-information: 5.6.0 + devlop: 1.1.0 + hast-util-to-jsx-runtime: 2.3.7 + html-url-attributes: 3.0.1 + mdast-util-to-hast: 13.2.2 react: 18.3.1 - react-is: 17.0.2 - remark-parse: 9.0.0(supports-color@10.2.2) - remark-rehype: 8.1.0 - space-separated-tokens: 1.1.5 - style-to-object: 0.3.0 - unified: 9.2.2 - unist-util-visit: 2.0.3 - vfile: 4.2.1 + remark-parse: 11.0.0 + remark-rehype: 11.1.2 + unified: 11.0.5 + unist-util-visit: 5.2.0 + vfile: 6.0.3 transitivePeerDependencies: - supports-color @@ -20183,15 +20529,22 @@ snapshots: chalk: 2.4.2 commander: 2.20.3 - remark-parse@9.0.0(supports-color@10.2.2): + remark-parse@11.0.0: dependencies: - mdast-util-from-markdown: 0.8.5(supports-color@10.2.2) + '@types/mdast': 4.0.4 + mdast-util-from-markdown: 2.1.0 + micromark-util-types: 2.0.3 + unified: 11.0.5 transitivePeerDependencies: - supports-color - remark-rehype@8.1.0: + remark-rehype@11.1.2: dependencies: - mdast-util-to-hast: 10.2.0 + '@types/hast': 3.0.5 + '@types/mdast': 4.0.4 + mdast-util-to-hast: 13.2.2 + unified: 11.0.5 + vfile: 6.0.3 remove-accents@0.5.0: {} @@ -20575,7 +20928,7 @@ snapshots: source-map@0.7.6: {} - space-separated-tokens@1.1.5: {} + space-separated-tokens@2.0.2: {} sshpk@1.18.0: dependencies: @@ -20650,6 +21003,11 @@ snapshots: dependencies: safe-buffer: 5.2.1 + stringify-entities@4.0.4: + dependencies: + character-entities-html4: 2.1.0 + character-entities-legacy: 3.0.0 + strip-ansi@3.0.1: dependencies: ansi-regex: 2.1.1 @@ -20672,11 +21030,11 @@ snapshots: strip-json-comments@2.0.1: {} - style-to-object@0.3.0: + style-to-object@2.0.2: dependencies: - inline-style-parser: 0.1.1 + inline-style-parser: 0.2.9 - sumchecker@3.0.1: + sumchecker@3.0.1(supports-color@10.2.2): dependencies: debug: 4.4.3(supports-color@10.2.2) transitivePeerDependencies: @@ -20844,7 +21202,9 @@ snapshots: tree-kill@1.2.2: {} - trough@1.0.5: {} + trim-lines@3.0.1: {} + + trough@2.2.0: {} truncate-utf8-bytes@1.0.2: dependencies: @@ -21031,42 +21391,42 @@ snapshots: dependencies: unipointer: 2.4.0 - unified@9.2.2: + unified@11.0.5: dependencies: - '@types/unist': 2.0.11 - bail: 1.0.5 + '@types/unist': 3.0.3 + bail: 2.0.2 + devlop: 1.1.0 extend: 3.0.2 - is-buffer: 2.0.5 - is-plain-obj: 2.1.0 - trough: 1.0.5 - vfile: 4.2.1 + is-plain-obj: 4.1.0 + trough: 2.2.0 + vfile: 6.0.3 unipointer@2.4.0: dependencies: ev-emitter: 1.1.1 - unist-builder@2.0.3: {} - - unist-util-generated@1.1.6: {} - - unist-util-is@4.1.0: {} + unist-util-is@6.0.1: + dependencies: + '@types/unist': 3.0.3 - unist-util-position@3.1.0: {} + unist-util-position@5.0.0: + dependencies: + '@types/unist': 3.0.3 - unist-util-stringify-position@2.0.3: + unist-util-stringify-position@4.0.0: dependencies: - '@types/unist': 2.0.11 + '@types/unist': 3.0.3 - unist-util-visit-parents@3.1.1: + unist-util-visit-parents@6.1.0: dependencies: - '@types/unist': 2.0.11 - unist-util-is: 4.1.0 + '@types/unist': 3.0.3 + unist-util-is: 6.0.1 - unist-util-visit@2.0.3: + unist-util-visit@5.2.0: dependencies: - '@types/unist': 2.0.11 - unist-util-is: 4.1.0 - unist-util-visit-parents: 3.1.1 + '@types/unist': 3.0.3 + unist-util-is: 6.0.1 + unist-util-visit-parents: 6.1.0 universal-analytics@0.4.23(supports-color@10.2.2): dependencies: @@ -21131,17 +21491,15 @@ snapshots: core-util-is: 1.0.2 extsprintf: 1.4.1 - vfile-message@2.0.4: + vfile-message@4.0.4: dependencies: - '@types/unist': 2.0.11 - unist-util-stringify-position: 2.0.3 + '@types/unist': 3.0.3 + unist-util-stringify-position: 4.0.0 - vfile@4.2.1: + vfile@6.0.3: dependencies: - '@types/unist': 2.0.11 - is-buffer: 2.0.5 - unist-util-stringify-position: 2.0.3 - vfile-message: 2.0.4 + '@types/unist': 3.0.3 + vfile-message: 4.0.4 victory-vendor@36.9.2: dependencies: @@ -21504,3 +21862,5 @@ snapshots: zod@4.4.3: {} zone.js@0.15.1: {} + + zwitch@2.0.4: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index eeb8e3b8ca..f3921f4d27 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -219,7 +219,7 @@ catalog: react-dom: 18.3.1 react-hot-toast: 2.6.0 react-i18next: 11.18.6 - react-markdown: 6.0.3 + react-markdown: 9.1.0 react-overlays: 1.2.0 react-redux: 7.2.9 react-refresh: 0.18.0 diff --git a/src/renderer/src/controls/More.tsx b/src/renderer/src/controls/More.tsx index 44a27c0fbf..9c2e6c07f3 100644 --- a/src/renderer/src/controls/More.tsx +++ b/src/renderer/src/controls/More.tsx @@ -1,9 +1,9 @@ import * as React from "react"; import { Popover } from "react-bootstrap"; import type { WithTranslation } from "react-i18next"; -import ReactMarkdown from "react-markdown"; import { Markdown } from "@/ui/components/prose/markdown/Markdown"; +import { ReactMarkdown } from "@/ui/components/prose/react_markdown/ReactMarkdown"; import type { IExtensionApi } from "../types/api"; import { ComponentEx, translate } from "./ComponentEx"; diff --git a/src/renderer/src/extensions/about_dialog/views/AboutPage.tsx b/src/renderer/src/extensions/about_dialog/views/AboutPage.tsx index 6959e55cf1..46ce29cb45 100644 --- a/src/renderer/src/extensions/about_dialog/views/AboutPage.tsx +++ b/src/renderer/src/extensions/about_dialog/views/AboutPage.tsx @@ -10,7 +10,8 @@ import { getErrorMessageOrDefault } from "@vortex/shared"; import I18next from "i18next"; import * as React from "react"; import { Image, Media, Panel } from "react-bootstrap"; -import ReactMarkdown from "react-markdown"; + +import { ReactMarkdown } from "@/ui/components/prose/react_markdown/ReactMarkdown"; import { ComponentEx, translate } from "../../../controls/ComponentEx"; import More from "../../../controls/More"; diff --git a/src/renderer/src/extensions/collections/views/CollectionPageView/CollectionInstructions.tsx b/src/renderer/src/extensions/collections/views/CollectionPageView/CollectionInstructions.tsx index 8642f3eb05..86d694021d 100644 --- a/src/renderer/src/extensions/collections/views/CollectionPageView/CollectionInstructions.tsx +++ b/src/renderer/src/extensions/collections/views/CollectionPageView/CollectionInstructions.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import { Button } from "react-bootstrap"; -import ReactMarkdown from "react-markdown"; +import { ReactMarkdown } from "@/ui/components/prose/react_markdown/ReactMarkdown"; import { WebLink } from "@/ui/components/prose/web_link/WebLink"; import type { IMod, IModRule } from "../../../../extensions/mod_management/types/IMod"; diff --git a/src/renderer/src/extensions/collections/views/InstallDialog/InstallStartDialog.tsx b/src/renderer/src/extensions/collections/views/InstallDialog/InstallStartDialog.tsx index 36c89be18e..273211a491 100644 --- a/src/renderer/src/extensions/collections/views/InstallDialog/InstallStartDialog.tsx +++ b/src/renderer/src/extensions/collections/views/InstallDialog/InstallStartDialog.tsx @@ -1,12 +1,12 @@ import * as React from "react"; import { Button, Media } from "react-bootstrap"; import { withTranslation } from "react-i18next"; -import ReactMarkdown from "react-markdown"; import { connect } from "react-redux"; import Select from "react-select"; import type * as Redux from "redux"; import { generate as shortid } from "shortid"; +import { ReactMarkdown } from "@/ui/components/prose/react_markdown/ReactMarkdown"; import { WebLink } from "@/ui/components/prose/web_link/WebLink"; import * as actions from "../../../../actions"; diff --git a/src/renderer/src/extensions/gamebryo_plugin_management/views/DependencyIcon.tsx b/src/renderer/src/extensions/gamebryo_plugin_management/views/DependencyIcon.tsx index 3973a54d84..223a90b940 100644 --- a/src/renderer/src/extensions/gamebryo_plugin_management/views/DependencyIcon.tsx +++ b/src/renderer/src/extensions/gamebryo_plugin_management/views/DependencyIcon.tsx @@ -17,9 +17,10 @@ import type { import { DragSource, DropTarget } from "react-dnd"; import { getEmptyImage } from "react-dnd-html5-backend"; import { findDOMNode } from "react-dom"; -import ReactMarkdown from "react-markdown"; import { connect } from "react-redux"; +import { ReactMarkdown } from "@/ui/components/prose/react_markdown/ReactMarkdown"; + import Advanced from "../../../controls/Advanced"; import { ComponentEx } from "../../../controls/ComponentEx"; import * as tooltip from "../../../controls/TooltipControls"; diff --git a/src/renderer/src/extensions/gamebryo_plugin_management/views/PluginList.tsx b/src/renderer/src/extensions/gamebryo_plugin_management/views/PluginList.tsx index 118d3dc1b3..b748af7481 100644 --- a/src/renderer/src/extensions/gamebryo_plugin_management/views/PluginList.tsx +++ b/src/renderer/src/extensions/gamebryo_plugin_management/views/PluginList.tsx @@ -11,13 +11,14 @@ import type { Message, PluginCleaningData } from "loot"; import * as React from "react"; import { Alert, Button, ListGroup, ListGroupItem, Panel } from "react-bootstrap"; import { withTranslation } from "react-i18next"; -import ReactMarkdown from "react-markdown"; import { connect } from "react-redux"; import Select from "react-select"; import type * as Redux from "redux"; import type { ThunkDispatch } from "redux-thunk"; import { generate as shortid } from "shortid"; +import { ReactMarkdown } from "@/ui/components/prose/react_markdown/ReactMarkdown"; + import { ComponentEx } from "../../../controls/ComponentEx"; import FlexLayout from "../../../controls/FlexLayout"; import Icon from "../../../controls/Icon"; diff --git a/src/renderer/src/extensions/instructions_overlay/InstructionsOverlay.tsx b/src/renderer/src/extensions/instructions_overlay/InstructionsOverlay.tsx index 5993dd6975..3fcea39d72 100644 --- a/src/renderer/src/extensions/instructions_overlay/InstructionsOverlay.tsx +++ b/src/renderer/src/extensions/instructions_overlay/InstructionsOverlay.tsx @@ -2,8 +2,8 @@ import memoizeOne from "memoize-one"; import * as React from "react"; import { Button } from "react-bootstrap"; import * as ReactDOM from "react-dom"; -import ReactMarkdown from "react-markdown"; +import { ReactMarkdown } from "@/ui/components/prose/react_markdown/ReactMarkdown"; import { WebLink } from "@/ui/components/prose/web_link/WebLink"; import { tooltip } from "../../controls/api"; diff --git a/src/renderer/src/ui/components/prose/markdown/Markdown.tsx b/src/renderer/src/ui/components/prose/markdown/Markdown.tsx index a82e1714b3..734de1e54e 100644 --- a/src/renderer/src/ui/components/prose/markdown/Markdown.tsx +++ b/src/renderer/src/ui/components/prose/markdown/Markdown.tsx @@ -1,10 +1,10 @@ import React from "react"; -import ReactMarkdown from "react-markdown"; import { joinClasses } from "@/ui/utils/joinClasses"; import type { IProseWithImagesProps } from "../Prose.types"; import { ProseImage } from "../prose_image/ProseImage"; +import { ReactMarkdown } from "../react_markdown/ReactMarkdown"; import { WebLink } from "../web_link/WebLink"; interface IMarkdownProps extends IProseWithImagesProps { diff --git a/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.test.tsx b/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.test.tsx new file mode 100644 index 0000000000..9ad295449f --- /dev/null +++ b/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.test.tsx @@ -0,0 +1,32 @@ +import { render, screen } from "@testing-library/react"; +import React from "react"; +import { describe, expect, it } from "vitest"; + +import { ReactMarkdown } from "./ReactMarkdown"; + +describe("ReactMarkdown", () => { + it("renders markdown as HTML", () => { + render({"Some **bold** text and [a link](https://example.com)"}); + + expect(screen.getByText("bold").tagName).toBe("STRONG"); + expect(screen.getByRole("link", { name: "a link" })).toHaveAttribute( + "href", + "https://example.com", + ); + }); + + it("wraps the markdown in a div with the class it's given", () => { + const { container } = render( + {"text"}, + ); + + expect(container.firstElementChild).toHaveClass("changelog-text"); + expect(container.firstElementChild?.tagName).toBe("DIV"); + }); + + it("renders nothing when it has no markdown", () => { + const { container } = render({undefined}); + + expect(container).toBeEmptyDOMElement(); + }); +}); diff --git a/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.ts b/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.ts new file mode 100644 index 0000000000..3eba6a15ed --- /dev/null +++ b/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.ts @@ -0,0 +1,11 @@ +// react-markdown is ESM-only from version 7, and the renderer compiles to CommonJS +// (`module: node16` in tsconfig.json), which can't `import` an ES module. So it's loaded with +// require(), which webpack bundles and Node 22 runs, and typed from the ES module itself. Import +// react-markdown from here, not from the package. Once the renderer compiles to ES modules this +// can become a plain re-export. +import type * as ReactMarkdownModule from "react-markdown" with { "resolution-mode": "import" }; + +const reactMarkdown = require("react-markdown") as typeof ReactMarkdownModule; + +/** Renders the markdown passed as its children. */ +export const ReactMarkdown = reactMarkdown.default; diff --git a/src/renderer/src/ui/components/prose/web_link/WebLink.test.tsx b/src/renderer/src/ui/components/prose/web_link/WebLink.test.tsx index fb9794c5c4..49e53d8fc5 100644 --- a/src/renderer/src/ui/components/prose/web_link/WebLink.test.tsx +++ b/src/renderer/src/ui/components/prose/web_link/WebLink.test.tsx @@ -1,8 +1,8 @@ import { render, screen } from "@testing-library/react"; import React from "react"; -import ReactMarkdown from "react-markdown"; import { describe, expect, it } from "vitest"; +import { ReactMarkdown } from "../react_markdown/ReactMarkdown"; import { WebLink } from "./WebLink"; const renderMarkdown = (markdown: string) => diff --git a/src/renderer/src/views/Dialog.tsx b/src/renderer/src/views/Dialog.tsx index f3939bb61e..0475143e09 100644 --- a/src/renderer/src/views/Dialog.tsx +++ b/src/renderer/src/views/Dialog.tsx @@ -10,9 +10,10 @@ import { Radio, } from "react-bootstrap"; import { useTranslation } from "react-i18next"; -import ReactMarkdown from "react-markdown"; import { useDispatch, useSelector } from "react-redux"; +import { ReactMarkdown } from "@/ui/components/prose/react_markdown/ReactMarkdown"; + import type { ILink } from "../actions"; import { triggerDialogLink } from "../actions"; import type { DialogContentItem } from "../actions/notifications"; diff --git a/src/renderer/test-setup.mts b/src/renderer/test-setup.mts index e7992e265e..eb7ec17eab 100644 --- a/src/renderer/test-setup.mts +++ b/src/renderer/test-setup.mts @@ -15,30 +15,49 @@ import { afterAll, afterEach, beforeAll, vi } from "vitest"; import { ApplicationData } from "./src/applicationData.js"; -// A React update outside act() fails the test it happened in; "React warnings" in docs/testing.md -// says how to fix one. console.error is assigned rather than spied on so vi.restoreAllMocks() -// leaves it be, and the check runs after testing-library's cleanup (vitest.config.mts runs hooks -// last-registered first), so an update that lands while a test is torn down still counts. -let componentsUpdatedOutsideAct = new Set(); +// These React warnings fail the test they're logged in; "React warnings" in docs/testing.md says +// how to fix each. `logged` is part of the message React logs, and `failure` says what went wrong +// given the components React named. console.error is assigned rather than spied on so +// vi.restoreAllMocks() leaves it be, and the check runs after testing-library's cleanup +// (vitest.config.mts runs hooks last-registered first), so a warning logged while a test is torn +// down still counts. +const failingWarnings: { logged: string; failure: (components: string) => string }[] = [ + { + logged: "not wrapped in act", + failure: (components) => `React updated ${components} outside act()`, + }, + { + logged: "Support for defaultProps will be removed from function components", + failure: (components) => `${components} set defaultProps on a function component`, + }, +]; +let componentsByWarning = new Map<(typeof failingWarnings)[number], Set>(); const originalConsoleError = console.error; console.error = (...args: unknown[]) => { - if (typeof args[0] === "string" && args[0].includes("not wrapped in act")) { + const message = args[0]; + const warning = + typeof message === "string" + ? failingWarnings.find(({ logged }) => message.includes(logged)) + : undefined; + if (warning !== undefined) { + const components = componentsByWarning.get(warning) ?? new Set(); // React passes the component's name after the message - componentsUpdatedOutsideAct.add(typeof args[1] === "string" ? args[1] : "a component"); + components.add(typeof args[1] === "string" ? args[1] : "a component"); + componentsByWarning.set(warning, components); } originalConsoleError.apply(console, args); }; -const failOnActWarnings = () => { - const components = [...componentsUpdatedOutsideAct]; - componentsUpdatedOutsideAct = new Set(); - if (components.length > 0) { - throw new Error( - `React updated ${components.join(", ")} outside act(); see "React warnings" in docs/testing.md`, - ); +const failOnReactWarnings = () => { + const failures = [...componentsByWarning].map(([warning, components]) => + warning.failure([...components].join(", ")), + ); + componentsByWarning = new Map(); + if (failures.length > 0) { + throw new Error(`${failures.join("; ")}; see "React warnings" in docs/testing.md`); } }; -afterEach(failOnActWarnings); -afterAll(failOnActWarnings); +afterEach(failOnReactWarnings); +afterAll(failOnReactWarnings); // No test initialises i18next, so react-i18next warns once per file and falls back to // returning the key. The source strings in this repo are the keys, so that fallback is From 1fc9d83986dd8745f3f46dffb9e7c81ccd0f031e Mon Sep 17 00:00:00 2001 From: ecemooo Date: Thu, 19 Nov 2026 13:57:48 +0300 Subject: [PATCH 2/5] fix: correct the react-markdown shim's comment and render it as JSX everywhere (LAZ-1698) --- .../views/DependencyIcon.tsx | 2 +- .../gamebryo_plugin_management/views/PluginList.tsx | 6 ++---- .../prose/react_markdown/ReactMarkdown.test.tsx | 12 ++++-------- .../components/prose/react_markdown/ReactMarkdown.ts | 8 +++++--- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/renderer/src/extensions/gamebryo_plugin_management/views/DependencyIcon.tsx b/src/renderer/src/extensions/gamebryo_plugin_management/views/DependencyIcon.tsx index 223a90b940..6472de279d 100644 --- a/src/renderer/src/extensions/gamebryo_plugin_management/views/DependencyIcon.tsx +++ b/src/renderer/src/extensions/gamebryo_plugin_management/views/DependencyIcon.tsx @@ -434,7 +434,7 @@ class DependencyIcon extends ComponentEx { if (readOnly) { return (
  • - {(ReactMarkdown as any)({ children: display || name })} + {display || name}
  • ); } diff --git a/src/renderer/src/extensions/gamebryo_plugin_management/views/PluginList.tsx b/src/renderer/src/extensions/gamebryo_plugin_management/views/PluginList.tsx index b748af7481..727cdf9b5b 100644 --- a/src/renderer/src/extensions/gamebryo_plugin_management/views/PluginList.tsx +++ b/src/renderer/src/extensions/gamebryo_plugin_management/views/PluginList.tsx @@ -772,7 +772,7 @@ class PluginList extends ComponentEx { }); return ( - {(ReactMarkdown as any)({ children: message })} + {message} {clean ? null : ( @@ -1240,9 +1240,7 @@ class PluginList extends ComponentEx { {filtered.map((msg: Message, idx: number) => ( - {(ReactMarkdown as any)({ - children: this.prepareMessage(msg.content, plugin), - })} + {this.prepareMessage(msg.content, plugin)} ))} diff --git a/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.test.tsx b/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.test.tsx index 9ad295449f..21677b2b88 100644 --- a/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.test.tsx +++ b/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.test.tsx @@ -6,9 +6,11 @@ import { ReactMarkdown } from "./ReactMarkdown"; describe("ReactMarkdown", () => { it("renders markdown as HTML", () => { - render({"Some **bold** text and [a link](https://example.com)"}); + const { container } = render( + {"Some **bold** text and [a link](https://example.com)"}, + ); - expect(screen.getByText("bold").tagName).toBe("STRONG"); + expect(container.querySelector("strong")).not.toBeNull(); expect(screen.getByRole("link", { name: "a link" })).toHaveAttribute( "href", "https://example.com", @@ -23,10 +25,4 @@ describe("ReactMarkdown", () => { expect(container.firstElementChild).toHaveClass("changelog-text"); expect(container.firstElementChild?.tagName).toBe("DIV"); }); - - it("renders nothing when it has no markdown", () => { - const { container } = render({undefined}); - - expect(container).toBeEmptyDOMElement(); - }); }); diff --git a/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.ts b/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.ts index 3eba6a15ed..aec20aef89 100644 --- a/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.ts +++ b/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.ts @@ -1,8 +1,10 @@ // react-markdown is ESM-only from version 7, and the renderer compiles to CommonJS // (`module: node16` in tsconfig.json), which can't `import` an ES module. So it's loaded with -// require(), which webpack bundles and Node 22 runs, and typed from the ES module itself. Import -// react-markdown from here, not from the package. Once the renderer compiles to ES modules this -// can become a plain re-export. +// require() and typed from the ES module itself. webpack leaves node_modules external +// (webpack.config.cjs), so this require() runs in Electron's Node at runtime, which can require() +// an ES module as long as nothing it loads uses top-level await. Import react-markdown from here, +// not from the package. Once the renderer compiles to ES modules this can become a plain +// re-export. import type * as ReactMarkdownModule from "react-markdown" with { "resolution-mode": "import" }; const reactMarkdown = require("react-markdown") as typeof ReactMarkdownModule; From 63f52e04f59040d6fee067165d7191918f54d681 Mon Sep 17 00:00:00 2001 From: ecemooo Date: Thu, 19 Nov 2026 16:27:44 +0300 Subject: [PATCH 3/5] fix: keep react-markdown 9's links inert and extensions working (LAZ-1698) --- docs/testing.md | 6 +- src/renderer/eslint.config.mjs | 6 ++ src/renderer/src/controls/More.tsx | 2 +- .../about_dialog/views/AboutPage.tsx | 4 +- .../CollectionInstructions.tsx | 2 +- .../InstallDialog/InstallStartDialog.tsx | 2 +- .../views/DependencyIcon.tsx | 2 +- .../views/PluginList.tsx | 2 +- .../InstructionsOverlay.tsx | 2 +- .../ui/components/prose/markdown/Markdown.tsx | 2 +- .../react_markdown/ReactMarkdown.test.tsx | 28 ------- .../prose/react_markdown/ReactMarkdown.ts | 13 --- .../prose/web_link/WebLink.test.tsx | 3 +- src/renderer/src/util/extensionRequire.ts | 17 +++- .../react_markdown/ReactMarkdown.test.tsx | 71 ++++++++++++++++ .../src/util/react_markdown/ReactMarkdown.tsx | 80 +++++++++++++++++++ src/renderer/src/views/Dialog.tsx | 2 +- src/renderer/test-setup.mts | 5 +- 18 files changed, 191 insertions(+), 58 deletions(-) delete mode 100644 src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.test.tsx delete mode 100644 src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.ts create mode 100644 src/renderer/src/util/react_markdown/ReactMarkdown.test.tsx create mode 100644 src/renderer/src/util/react_markdown/ReactMarkdown.tsx diff --git a/docs/testing.md b/docs/testing.md index 6eccf6cc83..47aa09c353 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -55,12 +55,12 @@ renderer's test setup, `src/renderer/test-setup.mts`, enforces this: when React logs one, the test that logged it fails with `React updated X outside act()`. -It also fails a test on a function component that sets `defaultProps` -(`X set defaultProps on a function component`), which React 19 drops. In our +It also fails a test on a function or `React.memo` component that sets +`defaultProps` (`X set defaultProps on a function or memo component`), which React 19 drops. In our code, use default parameter values instead. From a dependency, upgrade it. If the version that fixes it is ESM-only, the renderer can't `import` it while it compiles to CommonJS; load it the way -`src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.ts` loads +`src/renderer/src/util/react_markdown/ReactMarkdown.tsx` loads react-markdown. The check is there because nothing else surfaces these warnings. Vitest's diff --git a/src/renderer/eslint.config.mjs b/src/renderer/eslint.config.mjs index 9d7da06735..75a07ea678 100644 --- a/src/renderer/eslint.config.mjs +++ b/src/renderer/eslint.config.mjs @@ -107,6 +107,12 @@ export default defineConfig([ message: "opn only backs the deprecated util.opn extension API. Use window.api.shell.openUrl or window.api.shell.openFile instead.", }, + { + selector: + "ImportDeclaration[importKind!='type'][source.value='react-markdown'], ImportExpression[source.value='react-markdown'], CallExpression[callee.name='require'][arguments.0.value='react-markdown']", + message: + "Render markdown with Markdown (ui/components/prose/markdown). Older call sites styled by their own SCSS use ReactMarkdown from util/react_markdown, which keeps links safe.", + }, ], "vortex/no-restricted-imports-warnings": [ "warn", diff --git a/src/renderer/src/controls/More.tsx b/src/renderer/src/controls/More.tsx index 9c2e6c07f3..d50201d821 100644 --- a/src/renderer/src/controls/More.tsx +++ b/src/renderer/src/controls/More.tsx @@ -3,7 +3,7 @@ import { Popover } from "react-bootstrap"; import type { WithTranslation } from "react-i18next"; import { Markdown } from "@/ui/components/prose/markdown/Markdown"; -import { ReactMarkdown } from "@/ui/components/prose/react_markdown/ReactMarkdown"; +import { ReactMarkdown } from "@/util/react_markdown/ReactMarkdown"; import type { IExtensionApi } from "../types/api"; import { ComponentEx, translate } from "./ComponentEx"; diff --git a/src/renderer/src/extensions/about_dialog/views/AboutPage.tsx b/src/renderer/src/extensions/about_dialog/views/AboutPage.tsx index 46ce29cb45..9a3608855d 100644 --- a/src/renderer/src/extensions/about_dialog/views/AboutPage.tsx +++ b/src/renderer/src/extensions/about_dialog/views/AboutPage.tsx @@ -11,7 +11,7 @@ import I18next from "i18next"; import * as React from "react"; import { Image, Media, Panel } from "react-bootstrap"; -import { ReactMarkdown } from "@/ui/components/prose/react_markdown/ReactMarkdown"; +import { ReactMarkdown } from "@/util/react_markdown/ReactMarkdown"; import { ComponentEx, translate } from "../../../controls/ComponentEx"; import More from "../../../controls/More"; @@ -145,7 +145,7 @@ class AboutPage extends ComponentEx { const imgPath = path.resolve(getVortexPath("assets"), "images", "vortex.png"); const licenseBox = ownLicense ? ( - + {ownLicenseText} ) : ( diff --git a/src/renderer/src/extensions/collections/views/CollectionPageView/CollectionInstructions.tsx b/src/renderer/src/extensions/collections/views/CollectionPageView/CollectionInstructions.tsx index 86d694021d..33add63e50 100644 --- a/src/renderer/src/extensions/collections/views/CollectionPageView/CollectionInstructions.tsx +++ b/src/renderer/src/extensions/collections/views/CollectionPageView/CollectionInstructions.tsx @@ -1,8 +1,8 @@ import * as React from "react"; import { Button } from "react-bootstrap"; -import { ReactMarkdown } from "@/ui/components/prose/react_markdown/ReactMarkdown"; import { WebLink } from "@/ui/components/prose/web_link/WebLink"; +import { ReactMarkdown } from "@/util/react_markdown/ReactMarkdown"; import type { IMod, IModRule } from "../../../../extensions/mod_management/types/IMod"; import { findModByRef } from "../../../../extensions/mod_management/util/findModByRef"; diff --git a/src/renderer/src/extensions/collections/views/InstallDialog/InstallStartDialog.tsx b/src/renderer/src/extensions/collections/views/InstallDialog/InstallStartDialog.tsx index 273211a491..d06971e48b 100644 --- a/src/renderer/src/extensions/collections/views/InstallDialog/InstallStartDialog.tsx +++ b/src/renderer/src/extensions/collections/views/InstallDialog/InstallStartDialog.tsx @@ -6,8 +6,8 @@ import Select from "react-select"; import type * as Redux from "redux"; import { generate as shortid } from "shortid"; -import { ReactMarkdown } from "@/ui/components/prose/react_markdown/ReactMarkdown"; import { WebLink } from "@/ui/components/prose/web_link/WebLink"; +import { ReactMarkdown } from "@/util/react_markdown/ReactMarkdown"; import * as actions from "../../../../actions"; import { ComponentEx } from "../../../../controls/ComponentEx"; diff --git a/src/renderer/src/extensions/gamebryo_plugin_management/views/DependencyIcon.tsx b/src/renderer/src/extensions/gamebryo_plugin_management/views/DependencyIcon.tsx index 6472de279d..7ab8f86def 100644 --- a/src/renderer/src/extensions/gamebryo_plugin_management/views/DependencyIcon.tsx +++ b/src/renderer/src/extensions/gamebryo_plugin_management/views/DependencyIcon.tsx @@ -19,7 +19,7 @@ import { getEmptyImage } from "react-dnd-html5-backend"; import { findDOMNode } from "react-dom"; import { connect } from "react-redux"; -import { ReactMarkdown } from "@/ui/components/prose/react_markdown/ReactMarkdown"; +import { ReactMarkdown } from "@/util/react_markdown/ReactMarkdown"; import Advanced from "../../../controls/Advanced"; import { ComponentEx } from "../../../controls/ComponentEx"; diff --git a/src/renderer/src/extensions/gamebryo_plugin_management/views/PluginList.tsx b/src/renderer/src/extensions/gamebryo_plugin_management/views/PluginList.tsx index 727cdf9b5b..c5c8be345f 100644 --- a/src/renderer/src/extensions/gamebryo_plugin_management/views/PluginList.tsx +++ b/src/renderer/src/extensions/gamebryo_plugin_management/views/PluginList.tsx @@ -17,7 +17,7 @@ import type * as Redux from "redux"; import type { ThunkDispatch } from "redux-thunk"; import { generate as shortid } from "shortid"; -import { ReactMarkdown } from "@/ui/components/prose/react_markdown/ReactMarkdown"; +import { ReactMarkdown } from "@/util/react_markdown/ReactMarkdown"; import { ComponentEx } from "../../../controls/ComponentEx"; import FlexLayout from "../../../controls/FlexLayout"; diff --git a/src/renderer/src/extensions/instructions_overlay/InstructionsOverlay.tsx b/src/renderer/src/extensions/instructions_overlay/InstructionsOverlay.tsx index 3fcea39d72..35f859e2ff 100644 --- a/src/renderer/src/extensions/instructions_overlay/InstructionsOverlay.tsx +++ b/src/renderer/src/extensions/instructions_overlay/InstructionsOverlay.tsx @@ -3,8 +3,8 @@ import * as React from "react"; import { Button } from "react-bootstrap"; import * as ReactDOM from "react-dom"; -import { ReactMarkdown } from "@/ui/components/prose/react_markdown/ReactMarkdown"; import { WebLink } from "@/ui/components/prose/web_link/WebLink"; +import { ReactMarkdown } from "@/util/react_markdown/ReactMarkdown"; import { tooltip } from "../../controls/api"; import FlexLayout from "../../controls/FlexLayout"; diff --git a/src/renderer/src/ui/components/prose/markdown/Markdown.tsx b/src/renderer/src/ui/components/prose/markdown/Markdown.tsx index 734de1e54e..287f53ba3d 100644 --- a/src/renderer/src/ui/components/prose/markdown/Markdown.tsx +++ b/src/renderer/src/ui/components/prose/markdown/Markdown.tsx @@ -1,10 +1,10 @@ import React from "react"; import { joinClasses } from "@/ui/utils/joinClasses"; +import { ReactMarkdown } from "@/util/react_markdown/ReactMarkdown"; import type { IProseWithImagesProps } from "../Prose.types"; import { ProseImage } from "../prose_image/ProseImage"; -import { ReactMarkdown } from "../react_markdown/ReactMarkdown"; import { WebLink } from "../web_link/WebLink"; interface IMarkdownProps extends IProseWithImagesProps { diff --git a/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.test.tsx b/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.test.tsx deleted file mode 100644 index 21677b2b88..0000000000 --- a/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.test.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { render, screen } from "@testing-library/react"; -import React from "react"; -import { describe, expect, it } from "vitest"; - -import { ReactMarkdown } from "./ReactMarkdown"; - -describe("ReactMarkdown", () => { - it("renders markdown as HTML", () => { - const { container } = render( - {"Some **bold** text and [a link](https://example.com)"}, - ); - - expect(container.querySelector("strong")).not.toBeNull(); - expect(screen.getByRole("link", { name: "a link" })).toHaveAttribute( - "href", - "https://example.com", - ); - }); - - it("wraps the markdown in a div with the class it's given", () => { - const { container } = render( - {"text"}, - ); - - expect(container.firstElementChild).toHaveClass("changelog-text"); - expect(container.firstElementChild?.tagName).toBe("DIV"); - }); -}); diff --git a/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.ts b/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.ts deleted file mode 100644 index aec20aef89..0000000000 --- a/src/renderer/src/ui/components/prose/react_markdown/ReactMarkdown.ts +++ /dev/null @@ -1,13 +0,0 @@ -// react-markdown is ESM-only from version 7, and the renderer compiles to CommonJS -// (`module: node16` in tsconfig.json), which can't `import` an ES module. So it's loaded with -// require() and typed from the ES module itself. webpack leaves node_modules external -// (webpack.config.cjs), so this require() runs in Electron's Node at runtime, which can require() -// an ES module as long as nothing it loads uses top-level await. Import react-markdown from here, -// not from the package. Once the renderer compiles to ES modules this can become a plain -// re-export. -import type * as ReactMarkdownModule from "react-markdown" with { "resolution-mode": "import" }; - -const reactMarkdown = require("react-markdown") as typeof ReactMarkdownModule; - -/** Renders the markdown passed as its children. */ -export const ReactMarkdown = reactMarkdown.default; diff --git a/src/renderer/src/ui/components/prose/web_link/WebLink.test.tsx b/src/renderer/src/ui/components/prose/web_link/WebLink.test.tsx index 49e53d8fc5..2a21738b07 100644 --- a/src/renderer/src/ui/components/prose/web_link/WebLink.test.tsx +++ b/src/renderer/src/ui/components/prose/web_link/WebLink.test.tsx @@ -2,7 +2,8 @@ import { render, screen } from "@testing-library/react"; import React from "react"; import { describe, expect, it } from "vitest"; -import { ReactMarkdown } from "../react_markdown/ReactMarkdown"; +import { ReactMarkdown } from "@/util/react_markdown/ReactMarkdown"; + import { WebLink } from "./WebLink"; const renderMarkdown = (markdown: string) => diff --git a/src/renderer/src/util/extensionRequire.ts b/src/renderer/src/util/extensionRequire.ts index 6de9b0b2a1..8b8fbd476a 100644 --- a/src/renderer/src/util/extensionRequire.ts +++ b/src/renderer/src/util/extensionRequire.ts @@ -9,8 +9,9 @@ import ExtensionManager from "../ExtensionManager"; import { findInstalled } from "../extensions/extension_manager/queries"; import type { IRegisteredExtension } from "../types/extensions"; import type { IExtensionState } from "../types/IState"; -import { deprecatedApiGet } from "./deprecatedApiUsage"; +import { deprecatedApiGet, makeCallerReporter } from "./deprecatedApiUsage"; import type { LogLevel } from "./log"; +import { makeExtensionReactMarkdown } from "./react_markdown/ReactMarkdown"; import { webpackRequireHack } from "./webpack-hacks"; const identity = (input) => input; @@ -98,6 +99,9 @@ class ExtProxyHandlerReduxAct implements ProxyHandler { const handlerMapAPI: { [extId: string]: typeof api } = {}; const handlerMapReactAct: { [extId: string]: typeof reduxAct } = {}; +const handlerMapReactMarkdown: { + [extId: string]: ReturnType; +} = {}; /** * require wrapper to allow extensions to load modules from @@ -127,6 +131,17 @@ function extensionRequire( } } else if (id === "react-select") { return reactSelect; + } else if (id === "react-markdown") { + const ext = getExtensions().find((iter) => this.filename.startsWith(iter.path)); + const key = ext?.name ?? ""; + if (handlerMapReactMarkdown[key] === undefined) { + const report = + ext === undefined + ? () => undefined + : makeCallerReporter(ext, findInstalled(getInstalled(), { path: ext.path })?.extension); + handlerMapReactMarkdown[key] = makeExtensionReactMarkdown(report); + } + return handlerMapReactMarkdown[key]; } else if (id === "redux-act") { const ext = getExtensions().find((iter) => this.filename.startsWith(iter.path)); if (ext !== undefined) { diff --git a/src/renderer/src/util/react_markdown/ReactMarkdown.test.tsx b/src/renderer/src/util/react_markdown/ReactMarkdown.test.tsx new file mode 100644 index 0000000000..fe50698346 --- /dev/null +++ b/src/renderer/src/util/react_markdown/ReactMarkdown.test.tsx @@ -0,0 +1,71 @@ +import { render, screen } from "@testing-library/react"; +import React from "react"; +import { describe, expect, it, vi } from "vitest"; + +import { makeExtensionReactMarkdown, ReactMarkdown } from "./ReactMarkdown"; + +describe("ReactMarkdown", () => { + it("renders markdown as HTML", () => { + const { container } = render( + {"Some **bold** text and [a link](https://example.com)"}, + ); + + expect(container.querySelector("strong")).not.toBeNull(); + expect(screen.getByRole("link", { name: "a link" })).toHaveAttribute( + "href", + "https://example.com", + ); + }); + + it("wraps the markdown in a div with the class it's given", () => { + const { container } = render( + {"text"}, + ); + + expect(container.firstElementChild).toHaveClass("changelog-text"); + expect(container.firstElementChild?.tagName).toBe("DIV"); + }); + + it.each([ + ["an app's protocol", "steam://run/489830"], + ["a relative path", "../run.exe"], + ["a network path", "//server/share/run.exe"], + ])("leaves a link to %s with no target, so clicking it does nothing", (_, href) => { + render({`[Launch](${href})`}); + + expect(screen.getByText("Launch").closest("a")).not.toHaveAttribute("href"); + }); + + it("keeps an image's source as react-markdown 6 did", () => { + render({"![icon](data:image/png;base64,AAAA)"}); + + expect(screen.getByRole("img", { name: "icon" })).toHaveAttribute( + "src", + "data:image/png;base64,AAAA", + ); + }); +}); + +describe("makeExtensionReactMarkdown", () => { + it("is the component, and its own default, as react-markdown 6 was to an extension", () => { + const ExtensionReactMarkdown = makeExtensionReactMarkdown(() => undefined); + + expect(ExtensionReactMarkdown.default).toBe(ExtensionReactMarkdown); + render({"Some **bold** text"}); + expect(screen.getByText("bold").tagName).toBe("STRONG"); + }); + + it("drops a prop only react-markdown 6 took and reports it", () => { + const report = vi.fn(); + const ExtensionReactMarkdown = makeExtensionReactMarkdown(report); + + render( + + {"[a link](https://example.com)"} + , + ); + + expect(screen.getByRole("link", { name: "a link" })).not.toHaveAttribute("target"); + expect(report).toHaveBeenCalledWith("react-markdown.linkTarget", "components.a"); + }); +}); diff --git a/src/renderer/src/util/react_markdown/ReactMarkdown.tsx b/src/renderer/src/util/react_markdown/ReactMarkdown.tsx new file mode 100644 index 0000000000..edf614536e --- /dev/null +++ b/src/renderer/src/util/react_markdown/ReactMarkdown.tsx @@ -0,0 +1,80 @@ +import React from "react"; +// react-markdown is ESM-only from version 7, and the renderer compiles to CommonJS +// (`module: node16` in tsconfig.json), which can't `import` an ES module. So it's loaded with +// require() and typed from the ES module itself. webpack leaves node_modules external +// (webpack.config.cjs), so this require() runs in Electron's Node at runtime, which can require() +// an ES module as long as nothing it loads uses top-level await. Once the renderer compiles to ES +// modules the require() can become a plain import. +import type * as ReactMarkdownModule from "react-markdown" with { "resolution-mode": "import" }; + +import { WebLink } from "@/ui/components/prose/web_link/WebLink"; + +// eslint-disable-next-line no-restricted-syntax -- this is the one place react-markdown is loaded +const reactMarkdown = require("react-markdown") as typeof ReactMarkdownModule; + +export type ReactMarkdownProps = ReactMarkdownModule.Options; + +/** + * Keeps what react-markdown 6 kept. A link react-markdown's own filter rejects, such as `steam:`, + * gets no href rather than its `""`, which would reload the window when clicked. Image sources go + * through untouched, as 6 never filtered them. + */ +const urlTransform: ReactMarkdownModule.UrlTransform = (url, key) => { + if (key === "src") { + return url; + } + const transformed = reactMarkdown.defaultUrlTransform(url); + return transformed === "" ? undefined : transformed; +}; + +/** + * Renders the markdown passed as its children, for the older call sites styled by their own SCSS. + * New UI uses `Markdown` (`ui/components/prose/markdown`), which also styles it and filters images. + * + * Links render as `WebLink` unless `components.a` says otherwise, so a link only opens if it goes + * to a web page or an email address: relative and `//server/share` links would otherwise resolve + * against the app's `file://` page, and the main window opens whatever a link navigates to. + */ +export const ReactMarkdown = ({ components, ...props }: ReactMarkdownProps) => ( + +); + +/** Props react-markdown 6 took that 9 doesn't, and what replaces each, if anything. */ +const removedProps: Record = { + transformLinkUri: "urlTransform", + transformImageUri: "urlTransform", + linkTarget: "components.a", + includeElementIndex: undefined, + rawSourcePos: undefined, + sourcePos: undefined, +}; + +/** + * What an extension gets for `require("react-markdown")`. Extensions were built against 6, a + * CommonJS module that was the component itself, but require() of 9 returns the ES module's + * namespace, which React can't render. So this is the component, carrying itself as `default` too, + * which every way of importing 6 resolves to. 9 ignores 6's removed props, or throws on them in a + * development build, so they're dropped and `report`ed instead. + */ +export const makeExtensionReactMarkdown = ( + report: (method: string, replacement?: string) => void, +) => { + // Built once per extension (extensionRequire caches it), so it's a stable component type. + // eslint-disable-next-line @eslint-react/component-hook-factories + const ExtensionReactMarkdown = (props: ReactMarkdownProps & Record) => { + const kept: Record = {}; + for (const [name, value] of Object.entries(props)) { + if (Object.hasOwn(removedProps, name)) { + report(`react-markdown.${name}`, removedProps[name]); + } else { + kept[name] = value; + } + } + return ; + }; + return Object.assign(ExtensionReactMarkdown, { default: ExtensionReactMarkdown }); +}; diff --git a/src/renderer/src/views/Dialog.tsx b/src/renderer/src/views/Dialog.tsx index 0475143e09..5d75e835c6 100644 --- a/src/renderer/src/views/Dialog.tsx +++ b/src/renderer/src/views/Dialog.tsx @@ -12,7 +12,7 @@ import { import { useTranslation } from "react-i18next"; import { useDispatch, useSelector } from "react-redux"; -import { ReactMarkdown } from "@/ui/components/prose/react_markdown/ReactMarkdown"; +import { ReactMarkdown } from "@/util/react_markdown/ReactMarkdown"; import type { ILink } from "../actions"; import { triggerDialogLink } from "../actions"; diff --git a/src/renderer/test-setup.mts b/src/renderer/test-setup.mts index eb7ec17eab..06e65801bf 100644 --- a/src/renderer/test-setup.mts +++ b/src/renderer/test-setup.mts @@ -27,8 +27,9 @@ const failingWarnings: { logged: string; failure: (components: string) => string failure: (components) => `React updated ${components} outside act()`, }, { - logged: "Support for defaultProps will be removed from function components", - failure: (components) => `${components} set defaultProps on a function component`, + // React logs one message for function components and another for memo components + logged: "Support for defaultProps will be removed from", + failure: (components) => `${components} set defaultProps on a function or memo component`, }, ]; let componentsByWarning = new Map<(typeof failingWarnings)[number], Set>(); From 82c3905db451b39d9768fdd6e40d598218f7df11 Mon Sep 17 00:00:00 2001 From: ecemooo Date: Thu, 19 Nov 2026 17:26:30 +0300 Subject: [PATCH 4/5] fix: filter react-markdown links and images for every caller, and keep v6 extensions rendering (LAZ-1698) --- packages/vortex-api/CHANGELOG.md | 2 + packages/vortex-api/docs/MIGRATION.md | 30 +++ .../ui/components/prose/web_link/WebLink.tsx | 2 +- .../src/util/extensionRequire.test.ts | 44 +++++ .../react_markdown/ReactMarkdown.test.tsx | 144 ++++++++++++--- .../src/util/react_markdown/ReactMarkdown.tsx | 172 +++++++++++++++--- 6 files changed, 349 insertions(+), 45 deletions(-) create mode 100644 src/renderer/src/util/extensionRequire.test.ts diff --git a/packages/vortex-api/CHANGELOG.md b/packages/vortex-api/CHANGELOG.md index ad7e409f2c..10786f768d 100644 --- a/packages/vortex-api/CHANGELOG.md +++ b/packages/vortex-api/CHANGELOG.md @@ -26,11 +26,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/). ### Deprecated - `IMainPageOptions.mdi` is deprecated in favour of `menuIcon: { path }`. It still works, as a `menuIcon` path +- The `react-markdown` 6 props that 9 dropped (`transformLinkUri`, `transformImageUri`, `linkTarget`, and the ones 6 had already deprecated, such as `renderers` and `source`) log a deprecation warning. `transformLinkUri` and `transformImageUri` still run; the rest are ignored - see the [react-markdown section of the migration guide](./docs/MIGRATION.md#vortex-2x-react-markdown-9) - A filesystem path in a game info entry with `type: "url"` is deprecated in favour of `type: "path"`. It still opens as a path, in the game info popover and the game details dialog, and logs a warning naming the provider ### Changed - React peer dependency upgraded to 18.3.1; `@types/react` and `@types/react-dom` peer dependencies are now 18. Extension source may need type-level fixes on next rebuild (explicit `children` props, removed type aliases) - see the [React 18 section of the migration guide](./docs/MIGRATION.md#vortex-2x-react-18) +- `react-markdown` supplied at runtime is now 9.1.0 instead of 6.0.3. Every way of importing 6 still works. Links only open if they go to a web page or an email address, images from network shares don't load, and remark or rehype plugins made for 6 are dropped when they throw. Custom components no longer get 6's `inline`, `level`, `ordered`, `index`, `checked` or `isHeader` props - see the [react-markdown section of the migration guide](./docs/MIGRATION.md#vortex-2x-react-markdown-9) - `IExtensionContext` registration surfaces and `IMainPage` now use `React.FC` instead of the removed `React.StatelessComponent` (source-compatible) - `registerReducer` checks its spec against the state at its path. A path the state interfaces don't declare, or a spec whose type doesn't match the slice, now fails the typecheck. Runtime behaviour is unchanged, and already-built extensions keep working. Declare your slice by augmenting the state interfaces - see the [reducer section of the migration guide](./docs/MIGRATION.md#vortex-2x-typed-registerreducer) - `actions.showURL` takes all four arguments (`url`, `instructions`, `subscriber`, `skippable`); pass `undefined` for the ones you don't use. Previously only `url` was required. Runtime behaviour is unchanged diff --git a/packages/vortex-api/docs/MIGRATION.md b/packages/vortex-api/docs/MIGRATION.md index 1803db4f7b..42f6d65bb7 100644 --- a/packages/vortex-api/docs/MIGRATION.md +++ b/packages/vortex-api/docs/MIGRATION.md @@ -612,3 +612,33 @@ const interfaceReducer = util.actionsToPartialReducerSpec< ### Building the path at runtime `registerReducer` needs the path as a literal, such as `["settings", "myExtension"]`, so it can look the slice up. A path held in a `string[]` variable fails the typecheck. Pass the literal at the call. + +## Vortex 2.x: `react-markdown` 9 + +Vortex now supplies `react-markdown` **9.1.0** to extensions at runtime, in place of 6.0.3. If your extension bundles its own copy, nothing changes. If it uses Vortex's copy (`require("react-markdown")`, or an import your bundler leaves external), read on. + +### What keeps working + +- Every way of importing 6: `require`, `import ReactMarkdown from`, `import * as` and `import =`. You get a component that is also its own `.default`, and carries 9's other exports (`defaultUrlTransform`, `MarkdownAsync`, `MarkdownHooks`) and 6's `uriTransformer`. +- `transformLinkUri` and `transformImageUri` still run, as 9's `urlTransform` would. They log a deprecation warning. + +### What changes + +- **Links only open if they go to a web page (`http`, `https`) or an email address (`mailto:`).** Any other link renders with no target and does nothing when clicked: app links (`steam:`, `nxm:`), `file:` and `tel:` links, relative links (`../run.exe`) and network paths (`//server/share`). This holds with your own `components.a` and your own `urlTransform` too: Vortex filters the URL after your transform runs. +- **Images from network shares don't load.** An image keeps its source if it's a web address, a `data:` address, or a file on the user's machine (`file:///C:/...`, or a relative path). `//host/share/x.png` and `file://host/share/x.png` render with no source. +- **Links lose their `title`** when you use the default link component. +- **6's removed props are ignored** and log a deprecation warning: `linkTarget`, `includeElementIndex`, `rawSourcePos`, `sourcePos`, and the ones 6 had already deprecated (`renderers`, `source`, `plugins`, `allowedTypes`, `disallowedTypes`, `allowNode`, `includeNodeIndex`, `escapeHtml`, `allowDangerousHtml`, `astPlugins`). + +### What you need to change + +| react-markdown 6 | react-markdown 9 | +| ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `linkTarget="_blank"` | `components={{ a: ... }}` | +| `transformLinkUri`, `transformImageUri` | `urlTransform={(url, key, node) => ...}` | +| `ReactMarkdown.uriTransformer` | `defaultUrlTransform` | +| `inline`, `level`, `ordered`, `index`, `checked` and `isHeader` props on a custom component | gone: use a component per tag (`h1`, `h2`, ...), or read the element from the `node` prop | +| remark and rehype plugins made for 6 | versions made for 9, such as `remark-gfm` 4 | + +Plugins made for 6 (for example `remark-gfm` 1.x) throw under 9. Vortex catches that, shows the markdown without your `remarkPlugins` and `rehypePlugins`, and logs a warning, so tables and other syntax the plugin added show as plain text until you update it. + +A custom component that reads a prop 9 no longer passes gets `undefined`: a `code` that checks `inline` renders inline code as a block, for example. diff --git a/src/renderer/src/ui/components/prose/web_link/WebLink.tsx b/src/renderer/src/ui/components/prose/web_link/WebLink.tsx index 2a461dbe2f..24659e5a51 100644 --- a/src/renderer/src/ui/components/prose/web_link/WebLink.tsx +++ b/src/renderer/src/ui/components/prose/web_link/WebLink.tsx @@ -3,7 +3,7 @@ import React, { type ReactNode } from "react"; import { webHref } from "@/ui/utils/webHref"; /** A link's target, if it's an email address to write to, which only opens the user's mail app. */ -const mailHref = (href: string | undefined): string | undefined => +export const mailHref = (href: string | undefined): string | undefined => href !== undefined && URL.parse(href)?.protocol === "mailto:" ? href : undefined; /** diff --git a/src/renderer/src/util/extensionRequire.test.ts b/src/renderer/src/util/extensionRequire.test.ts new file mode 100644 index 0000000000..a4c28488f7 --- /dev/null +++ b/src/renderer/src/util/extensionRequire.test.ts @@ -0,0 +1,44 @@ +import Module from "node:module"; + +import { afterEach, describe, expect, it, vi } from "vitest"; + +import type { IRegisteredExtension } from "../types/extensions"; +import installExtensionRequire from "./extensionRequire"; + +vi.mock("../api", () => ({})); +vi.mock("../controls/ReactSelectWrap", () => ({})); +vi.mock("../ExtensionManager", () => ({ default: { getExtensionPaths: () => [] } })); +vi.mock("./deprecatedApiUsage", () => ({ + deprecatedApiGet: vi.fn(), + makeCallerReporter: () => () => undefined, +})); + +const extension = { + name: "an-extension", + path: "/extensions/an-extension", +} as IRegisteredExtension; + +/** require(), as the extension's own code calls it once extensionRequire is installed. */ +const requireFromExtension = (id: string) => + Module.prototype.require.call({ filename: `${extension.path}/index.js` }, id); + +describe("extensionRequire", () => { + const originalRequire = Module.prototype.require; + + afterEach(() => { + Module.prototype.require = originalRequire; + }); + + it("gives an extension react-markdown as a component that is its own default", () => { + installExtensionRequire( + () => [extension], + () => ({}), + ); + + const reactMarkdown = requireFromExtension("react-markdown"); + + expect(reactMarkdown).toBeTypeOf("function"); + expect(reactMarkdown.default).toBe(reactMarkdown); + expect(requireFromExtension("react-markdown")).toBe(reactMarkdown); + }); +}); diff --git a/src/renderer/src/util/react_markdown/ReactMarkdown.test.tsx b/src/renderer/src/util/react_markdown/ReactMarkdown.test.tsx index fe50698346..7b871fb55f 100644 --- a/src/renderer/src/util/react_markdown/ReactMarkdown.test.tsx +++ b/src/renderer/src/util/react_markdown/ReactMarkdown.test.tsx @@ -4,6 +4,11 @@ import { describe, expect, it, vi } from "vitest"; import { makeExtensionReactMarkdown, ReactMarkdown } from "./ReactMarkdown"; +/** A link component that renders whatever href it's given, as an extension's own might. */ +const PlainLink = ({ href, children }: { href?: string; children?: React.ReactNode }) => ( + {children} +); + describe("ReactMarkdown", () => { it("renders markdown as HTML", () => { const { container } = render( @@ -11,10 +16,7 @@ describe("ReactMarkdown", () => { ); expect(container.querySelector("strong")).not.toBeNull(); - expect(screen.getByRole("link", { name: "a link" })).toHaveAttribute( - "href", - "https://example.com", - ); + expect(screen.getByRole("link")).toHaveAttribute("href", "https://example.com"); }); it("wraps the markdown in a div with the class it's given", () => { @@ -26,23 +28,59 @@ describe("ReactMarkdown", () => { expect(container.firstElementChild?.tagName).toBe("DIV"); }); + describe.each([ + ["its own links", undefined], + ["a caller's own link component", { a: PlainLink }], + ])("with %s", (_, components) => { + it.each([ + ["an app's protocol", "steam://run/489830"], + ["a relative path", "../run.exe"], + ["a network path", "//server/share/run.exe"], + ["a phone number", "tel:123"], + ])("leaves a link to %s with no target, so clicking it does nothing", (_, href) => { + const { container } = render( + {`[Launch](${href})`}, + ); + + expect(container.querySelector("a")).not.toHaveAttribute("href"); + }); + + it("keeps a link to a web page", () => { + render( + {"[docs](https://example.com)"}, + ); + + expect(screen.getByRole("link")).toHaveAttribute("href", "https://example.com"); + }); + }); + + it("filters what a caller's own urlTransform returns", () => { + const { container } = render( + url}> + {"[Launch](steam://run/1)"} + , + ); + + expect(container.querySelector("a")).not.toHaveAttribute("href"); + }); + it.each([ - ["an app's protocol", "steam://run/489830"], - ["a relative path", "../run.exe"], - ["a network path", "//server/share/run.exe"], - ])("leaves a link to %s with no target, so clicking it does nothing", (_, href) => { - render({`[Launch](${href})`}); + ["held in the address", "data:image/png;base64,AAAA"], + ["from the web", "https://example.com/icon.png"], + ["from a file on this machine", "file:///C:/extension/icon.png"], + ])("keeps the source of an image %s, as react-markdown 6 did", (_, src) => { + render({`![icon](${src})`}); - expect(screen.getByText("Launch").closest("a")).not.toHaveAttribute("href"); + expect(screen.getByRole("img")).toHaveAttribute("src", src); }); - it("keeps an image's source as react-markdown 6 did", () => { - render({"![icon](data:image/png;base64,AAAA)"}); + it.each([ + ["a network path", "//attacker.example/share/x.png"], + ["a file on a network share", "file://attacker.example/share/x.png"], + ])("drops the source of an image from %s", (_, src) => { + render({`![icon](${src})`}); - expect(screen.getByRole("img", { name: "icon" })).toHaveAttribute( - "src", - "data:image/png;base64,AAAA", - ); + expect(screen.getByRole("img")).not.toHaveAttribute("src"); }); }); @@ -51,21 +89,83 @@ describe("makeExtensionReactMarkdown", () => { const ExtensionReactMarkdown = makeExtensionReactMarkdown(() => undefined); expect(ExtensionReactMarkdown.default).toBe(ExtensionReactMarkdown); - render({"Some **bold** text"}); - expect(screen.getByText("bold").tagName).toBe("STRONG"); + const { container } = render( + {"Some **bold** text"}, + ); + expect(container.querySelector("strong")).not.toBeNull(); + }); + + it("carries react-markdown 9's other exports, and 6's uriTransformer", () => { + const report = vi.fn(); + const ExtensionReactMarkdown = makeExtensionReactMarkdown(report); + + expect(ExtensionReactMarkdown.defaultUrlTransform("steam://run/1")).toBe(""); + expect(ExtensionReactMarkdown.MarkdownHooks).toBeTypeOf("function"); + expect(ExtensionReactMarkdown).not.toHaveProperty("__esModule"); + expect(ExtensionReactMarkdown.uriTransformer("https://example.com")).toBe( + "https://example.com", + ); + expect(report).toHaveBeenCalledWith("react-markdown.uriTransformer", "defaultUrlTransform"); }); - it("drops a prop only react-markdown 6 took and reports it", () => { + it.each([ + ["linkTarget", "_blank", "components.a"], + ["renderers", { link: PlainLink }, "components"], + ])("drops %s, a prop only react-markdown 6 took, and reports it", (name, value, replacement) => { const report = vi.fn(); const ExtensionReactMarkdown = makeExtensionReactMarkdown(report); render( - + {"[a link](https://example.com)"} , ); - expect(screen.getByRole("link", { name: "a link" })).not.toHaveAttribute("target"); - expect(report).toHaveBeenCalledWith("react-markdown.linkTarget", "components.a"); + expect(screen.getByRole("link")).not.toHaveAttribute("target"); + expect(report).toHaveBeenCalledWith(`react-markdown.${name}`, replacement); + }); + + it("runs react-markdown 6's URL transforms as 9's urlTransform, and reports them", () => { + const report = vi.fn(); + const ExtensionReactMarkdown = makeExtensionReactMarkdown(report); + + render( + `file:///C:/extension/${src}`, + transformLinkUri: (href: string) => `https://example.com/${href}`, + }} + > + {"![logo](logo.png) [docs](docs)"} + , + ); + + expect(screen.getByRole("img")).toHaveAttribute("src", "file:///C:/extension/logo.png"); + expect(screen.getByRole("link")).toHaveAttribute("href", "https://example.com/docs"); + expect(report).toHaveBeenCalledWith("react-markdown.transformImageUri", "urlTransform"); + expect(report).toHaveBeenCalledWith("react-markdown.transformLinkUri", "urlTransform"); + }); + + it("renders without the extension's plugins if they throw, and reports them", () => { + const report = vi.fn(); + const ExtensionReactMarkdown = makeExtensionReactMarkdown(report); + const brokenPlugin = () => { + throw new Error("this.setData is not a function"); + }; + // React logs the error the boundary catches. + const consoleError = vi.spyOn(console, "error").mockImplementation(() => undefined); + + const { container } = render( + + {"Some **bold** text"} + , + ); + consoleError.mockRestore(); + + expect(container.querySelector("strong")).not.toBeNull(); + expect(report).toHaveBeenCalledWith( + "react-markdown.remarkPlugins", + "a version of the plugin made for react-markdown 9", + ); }); }); diff --git a/src/renderer/src/util/react_markdown/ReactMarkdown.tsx b/src/renderer/src/util/react_markdown/ReactMarkdown.tsx index edf614536e..edce96932a 100644 --- a/src/renderer/src/util/react_markdown/ReactMarkdown.tsx +++ b/src/renderer/src/util/react_markdown/ReactMarkdown.tsx @@ -1,3 +1,4 @@ +import { getErrorMessageOrDefault } from "@vortex/shared"; import React from "react"; // react-markdown is ESM-only from version 7, and the renderer compiles to CommonJS // (`module: node16` in tsconfig.json), which can't `import` an ES module. So it's loaded with @@ -7,7 +8,9 @@ import React from "react"; // modules the require() can become a plain import. import type * as ReactMarkdownModule from "react-markdown" with { "resolution-mode": "import" }; -import { WebLink } from "@/ui/components/prose/web_link/WebLink"; +import { mailHref, WebLink } from "@/ui/components/prose/web_link/WebLink"; +import { webHref } from "@/ui/utils/webHref"; +import { log } from "@/util/log"; // eslint-disable-next-line no-restricted-syntax -- this is the one place react-markdown is loaded const reactMarkdown = require("react-markdown") as typeof ReactMarkdownModule; @@ -15,35 +18,57 @@ const reactMarkdown = require("react-markdown") as typeof ReactMarkdownModule; export type ReactMarkdownProps = ReactMarkdownModule.Options; /** - * Keeps what react-markdown 6 kept. A link react-markdown's own filter rejects, such as `steam:`, - * gets no href rather than its `""`, which would reload the window when clicked. Image sources go - * through untouched, as 6 never filtered them. + * An image's source, if loading it can't reach another machine through the file system: a web + * address, an image held in the address, or a file on this machine. `//host/share/x.png` and + * `\\host\share\x.png` resolve against the app's `file://` page to a network share, which Windows + * may sign in to with the user's credentials, so they're dropped. */ -const urlTransform: ReactMarkdownModule.UrlTransform = (url, key) => { - if (key === "src") { - return url; +const imageSrc = (src: string): string | undefined => { + const url = URL.parse(src, "file:///"); + if (url === null) { + return undefined; } - const transformed = reactMarkdown.defaultUrlTransform(url); - return transformed === "" ? undefined : transformed; + if (["http:", "https:", "data:"].includes(url.protocol)) { + return src; + } + return url.protocol === "file:" && url.host === "" ? src : undefined; +}; + +/** + * Where a URL in the markdown may point, after any `urlTransform` the caller passed. A link keeps + * its target only if it's a web page or an email address, so a link stays safe whatever renders + * it. Anything else gets no target rather than react-markdown's own `""`, which would reload the + * window when clicked. An image keeps its source if `imageSrc` does, which covers what + * react-markdown 6 showed, as 6 never filtered images. + */ +const safeUrl = (url: string | null | undefined, key: string): string | undefined => { + if (url === null || url === undefined) { + return undefined; + } + return key === "src" ? imageSrc(url) : (webHref(url) ?? mailHref(url)); }; /** * Renders the markdown passed as its children, for the older call sites styled by their own SCSS. * New UI uses `Markdown` (`ui/components/prose/markdown`), which also styles it and filters images. * - * Links render as `WebLink` unless `components.a` says otherwise, so a link only opens if it goes - * to a web page or an email address: relative and `//server/share` links would otherwise resolve - * against the app's `file://` page, and the main window opens whatever a link navigates to. + * Links render as `WebLink` unless `components.a` says otherwise. A `urlTransform` runs before + * `safeUrl`, rather than replacing it. */ -export const ReactMarkdown = ({ components, ...props }: ReactMarkdownProps) => ( +export const ReactMarkdown = ({ components, urlTransform, ...props }: ReactMarkdownProps) => ( + safeUrl(urlTransform ? urlTransform(url, key, node) : url, key) + } /> ); -/** Props react-markdown 6 took that 9 doesn't, and what replaces each, if anything. */ +/** + * Props react-markdown 6 took that 9 doesn't, and what replaces each in 9, if anything. The ones + * from `renderers` on, 6 had already deprecated: it warned about them and ignored them. + */ const removedProps: Record = { transformLinkUri: "urlTransform", transformImageUri: "urlTransform", @@ -51,22 +76,100 @@ const removedProps: Record = { includeElementIndex: undefined, rawSourcePos: undefined, sourcePos: undefined, + renderers: "components", + source: "children", + plugins: "remarkPlugins", + allowedTypes: "allowedElements", + disallowedTypes: "disallowedElements", + allowNode: "allowElement", + includeNodeIndex: undefined, + escapeHtml: undefined, + allowDangerousHtml: undefined, + astPlugins: undefined, +}; + +type LinkTransform = (href: string, children: unknown, title: string | null) => string; +type ImageTransform = (src: string, alt: string, title: string | null) => string; + +/** + * 6's `transformLinkUri` and `transformImageUri` as a 9 `urlTransform`, run before the + * extension's own `urlTransform`, if it passed one too. + */ +const withRemovedTransforms = ( + urlTransform: ReactMarkdownProps["urlTransform"], + transformLinkUri: unknown, + transformImageUri: unknown, +): ReactMarkdownProps["urlTransform"] => { + if (typeof transformLinkUri !== "function" && typeof transformImageUri !== "function") { + return urlTransform; + } + return (url, key, node) => { + const { alt, title } = node.properties; + const titleText = typeof title === "string" ? title : null; + let transformed = url; + if (key === "src" && typeof transformImageUri === "function") { + transformed = (transformImageUri as ImageTransform)(url, String(alt ?? ""), titleText); + } else if (key !== "src" && typeof transformLinkUri === "function") { + transformed = (transformLinkUri as LinkTransform)(url, node.children, titleText); + } + return urlTransform ? urlTransform(transformed, key, node) : transformed; + }; }; +interface IDropPluginsOnErrorProps { + markdownProps: ReactMarkdownProps; + onDrop: (error: unknown) => void; +} + +/** + * Renders an extension's markdown, and again without its remark and rehype plugins if rendering + * throws. Plugins made for 6, such as remark-gfm 1, throw under 9, which would otherwise unmount + * the extension's UI. If it throws without them too, the error goes on up. + */ +class DropPluginsOnError extends React.Component { + public state = { failed: false }; + + public static getDerivedStateFromError() { + return { failed: true }; + } + + public componentDidCatch(error: unknown) { + this.props.onDrop(error); + } + + public render() { + const { remarkPlugins, rehypePlugins, ...withoutPlugins } = this.props.markdownProps; + return ; + } +} + /** * What an extension gets for `require("react-markdown")`. Extensions were built against 6, a * CommonJS module that was the component itself, but require() of 9 returns the ES module's - * namespace, which React can't render. So this is the component, carrying itself as `default` too, - * which every way of importing 6 resolves to. 9 ignores 6's removed props, or throws on them in a - * development build, so they're dropped and `report`ed instead. + * namespace, which React can't render. So this is the component, carrying itself as `default` and + * the module's other exports, which every way of importing 6 or 9 resolves to, plus 6's + * `uriTransformer`. 9 ignores 6's removed props, or throws on them in a development build, so + * they're dropped and `report`ed instead, apart from the two URL transforms, which 9's + * `urlTransform` still runs. */ export const makeExtensionReactMarkdown = ( report: (method: string, replacement?: string) => void, ) => { + const reportPlugins = (props: ReactMarkdownProps, error: unknown) => { + for (const name of ["remarkPlugins", "rehypePlugins"] as const) { + if (props[name] !== undefined) { + report(`react-markdown.${name}`, "a version of the plugin made for react-markdown 9"); + } + } + log("warn", "react-markdown plugins threw, so the markdown is shown without them", { + error: getErrorMessageOrDefault(error), + }); + }; + // Built once per extension (extensionRequire caches it), so it's a stable component type. // eslint-disable-next-line @eslint-react/component-hook-factories const ExtensionReactMarkdown = (props: ReactMarkdownProps & Record) => { - const kept: Record = {}; + const kept: ReactMarkdownProps & Record = {}; for (const [name, value] of Object.entries(props)) { if (Object.hasOwn(removedProps, name)) { report(`react-markdown.${name}`, removedProps[name]); @@ -74,7 +177,32 @@ export const makeExtensionReactMarkdown = ( kept[name] = value; } } - return ; + kept.urlTransform = withRemovedTransforms( + props.urlTransform, + props.transformLinkUri, + props.transformImageUri, + ); + + if (kept.remarkPlugins === undefined && kept.rehypePlugins === undefined) { + return ; + } + return ( + reportPlugins(kept, error)} /> + ); }; - return Object.assign(ExtensionReactMarkdown, { default: ExtensionReactMarkdown }); + + const uriTransformer = (url: string) => { + report("react-markdown.uriTransformer", "defaultUrlTransform"); + return reactMarkdown.defaultUrlTransform(url); + }; + + const { default: _, ...otherExports } = reactMarkdown as typeof ReactMarkdownModule & { + __esModule?: boolean; + }; + delete otherExports.__esModule; + + return Object.assign(ExtensionReactMarkdown, otherExports, { + default: ExtensionReactMarkdown, + uriTransformer, + }); }; From 1dea0bed12b23de880bb71ab1b9b662a14a60c2b Mon Sep 17 00:00:00 2001 From: ecemooo Date: Thu, 19 Nov 2026 19:21:40 +0300 Subject: [PATCH 5/5] fix: filter react-markdown's other components and check extension plugins on their own (LAZ-1698) --- packages/vortex-api/CHANGELOG.md | 2 +- packages/vortex-api/docs/MIGRATION.md | 8 +- .../react_markdown/ReactMarkdown.test.tsx | 121 +++++++++++++- .../src/util/react_markdown/ReactMarkdown.tsx | 158 +++++++++++++----- 4 files changed, 239 insertions(+), 50 deletions(-) diff --git a/packages/vortex-api/CHANGELOG.md b/packages/vortex-api/CHANGELOG.md index 10786f768d..27fbd84339 100644 --- a/packages/vortex-api/CHANGELOG.md +++ b/packages/vortex-api/CHANGELOG.md @@ -26,7 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/). ### Deprecated - `IMainPageOptions.mdi` is deprecated in favour of `menuIcon: { path }`. It still works, as a `menuIcon` path -- The `react-markdown` 6 props that 9 dropped (`transformLinkUri`, `transformImageUri`, `linkTarget`, and the ones 6 had already deprecated, such as `renderers` and `source`) log a deprecation warning. `transformLinkUri` and `transformImageUri` still run; the rest are ignored - see the [react-markdown section of the migration guide](./docs/MIGRATION.md#vortex-2x-react-markdown-9) +- The `react-markdown` 6 props that 9 dropped (`transformLinkUri`, `transformImageUri`, `linkTarget`, and the ones 6 had already deprecated, such as `renderers` and `source`) log a deprecation warning. `transformLinkUri` and `transformImageUri` still run, and `plugins` runs as `remarkPlugins`, as it did in 6; the rest are ignored - see the [react-markdown section of the migration guide](./docs/MIGRATION.md#vortex-2x-react-markdown-9) - A filesystem path in a game info entry with `type: "url"` is deprecated in favour of `type: "path"`. It still opens as a path, in the game info popover and the game details dialog, and logs a warning naming the provider ### Changed diff --git a/packages/vortex-api/docs/MIGRATION.md b/packages/vortex-api/docs/MIGRATION.md index 42f6d65bb7..1dbb87093e 100644 --- a/packages/vortex-api/docs/MIGRATION.md +++ b/packages/vortex-api/docs/MIGRATION.md @@ -619,15 +619,16 @@ Vortex now supplies `react-markdown` **9.1.0** to extensions at runtime, in plac ### What keeps working -- Every way of importing 6: `require`, `import ReactMarkdown from`, `import * as` and `import =`. You get a component that is also its own `.default`, and carries 9's other exports (`defaultUrlTransform`, `MarkdownAsync`, `MarkdownHooks`) and 6's `uriTransformer`. +- Every way of importing 6: `require`, `import ReactMarkdown from`, `import * as` and `import =`. You get a component that is also its own `.default`, and carries 9's other exports (`defaultUrlTransform`, `MarkdownAsync`, `MarkdownHooks`) and 6's `uriTransformer`. `MarkdownAsync` and `MarkdownHooks` filter links and images as the component does. - `transformLinkUri` and `transformImageUri` still run, as 9's `urlTransform` would. They log a deprecation warning. +- `plugins` still runs, as `remarkPlugins`, unless you pass `remarkPlugins` too, as in 6. It logs a deprecation warning. ### What changes - **Links only open if they go to a web page (`http`, `https`) or an email address (`mailto:`).** Any other link renders with no target and does nothing when clicked: app links (`steam:`, `nxm:`), `file:` and `tel:` links, relative links (`../run.exe`) and network paths (`//server/share`). This holds with your own `components.a` and your own `urlTransform` too: Vortex filters the URL after your transform runs. - **Images from network shares don't load.** An image keeps its source if it's a web address, a `data:` address, or a file on the user's machine (`file:///C:/...`, or a relative path). `//host/share/x.png` and `file://host/share/x.png` render with no source. - **Links lose their `title`** when you use the default link component. -- **6's removed props are ignored** and log a deprecation warning: `linkTarget`, `includeElementIndex`, `rawSourcePos`, `sourcePos`, and the ones 6 had already deprecated (`renderers`, `source`, `plugins`, `allowedTypes`, `disallowedTypes`, `allowNode`, `includeNodeIndex`, `escapeHtml`, `allowDangerousHtml`, `astPlugins`). +- **6's removed props are ignored** and log a deprecation warning: `linkTarget`, `includeElementIndex`, `rawSourcePos`, `sourcePos`, and the ones 6 had already deprecated (`renderers`, `source`, `allowedTypes`, `disallowedTypes`, `allowNode`, `includeNodeIndex`, `escapeHtml`, `allowDangerousHtml`, `astPlugins`). ### What you need to change @@ -636,9 +637,10 @@ Vortex now supplies `react-markdown` **9.1.0** to extensions at runtime, in plac | `linkTarget="_blank"` | `components={{ a: ... }}` | | `transformLinkUri`, `transformImageUri` | `urlTransform={(url, key, node) => ...}` | | `ReactMarkdown.uriTransformer` | `defaultUrlTransform` | +| `plugins` | `remarkPlugins` | | `inline`, `level`, `ordered`, `index`, `checked` and `isHeader` props on a custom component | gone: use a component per tag (`h1`, `h2`, ...), or read the element from the `node` prop | | remark and rehype plugins made for 6 | versions made for 9, such as `remark-gfm` 4 | -Plugins made for 6 (for example `remark-gfm` 1.x) throw under 9. Vortex catches that, shows the markdown without your `remarkPlugins` and `rehypePlugins`, and logs a warning, so tables and other syntax the plugin added show as plain text until you update it. +Plugins made for 6 (for example `remark-gfm` 1.x) throw under 9. Vortex runs your `remarkPlugins` and `rehypePlugins` on the markdown on their own first. If they throw, it shows the markdown without them and logs a warning, so tables and other syntax the plugin added show as plain text until you update it. It checks again whenever the markdown or the plugins change. An error from your own components isn't caught: it goes up to your error boundary, as it did in 6. A custom component that reads a prop 9 no longer passes gets `undefined`: a `code` that checks `inline` renders inline code as a block, for example. diff --git a/src/renderer/src/util/react_markdown/ReactMarkdown.test.tsx b/src/renderer/src/util/react_markdown/ReactMarkdown.test.tsx index 7b871fb55f..4973f9aa5b 100644 --- a/src/renderer/src/util/react_markdown/ReactMarkdown.test.tsx +++ b/src/renderer/src/util/react_markdown/ReactMarkdown.test.tsx @@ -1,4 +1,4 @@ -import { render, screen } from "@testing-library/react"; +import { render, screen, waitFor } from "@testing-library/react"; import React from "react"; import { describe, expect, it, vi } from "vitest"; @@ -9,6 +9,28 @@ const PlainLink = ({ href, children }: { href?: string; children?: React.ReactNo {children} ); +interface ITextNode { + type: string; + value?: string; + children?: ITextNode[]; +} + +/** A remark plugin that upper-cases every piece of text, so it's plain to see that it ran. */ +const uppercase = () => (tree: ITextNode) => { + const walk = (node: ITextNode) => { + if (node.type === "text" && node.value !== undefined) { + node.value = node.value.toUpperCase(); + } + node.children?.forEach(walk); + }; + walk(tree); +}; + +/** A remark plugin that throws as remark-gfm 1, made for react-markdown 6, does under 9. */ +const brokenPlugin = () => { + throw new Error("this.setData is not a function"); +}; + describe("ReactMarkdown", () => { it("renders markdown as HTML", () => { const { container } = render( @@ -149,18 +171,12 @@ describe("makeExtensionReactMarkdown", () => { it("renders without the extension's plugins if they throw, and reports them", () => { const report = vi.fn(); const ExtensionReactMarkdown = makeExtensionReactMarkdown(report); - const brokenPlugin = () => { - throw new Error("this.setData is not a function"); - }; - // React logs the error the boundary catches. - const consoleError = vi.spyOn(console, "error").mockImplementation(() => undefined); const { container } = render( {"Some **bold** text"} , ); - consoleError.mockRestore(); expect(container.querySelector("strong")).not.toBeNull(); expect(report).toHaveBeenCalledWith( @@ -168,4 +184,95 @@ describe("makeExtensionReactMarkdown", () => { "a version of the plugin made for react-markdown 9", ); }); + + it("runs plugins passed as plugins, as react-markdown 6 did, and reports them", () => { + const report = vi.fn(); + const ExtensionReactMarkdown = makeExtensionReactMarkdown(report); + + const { container } = render( + {"some text"}, + ); + + expect(container).toHaveTextContent("SOME TEXT"); + expect(report).toHaveBeenCalledWith("react-markdown.plugins", "remarkPlugins"); + }); + + it("lets an error from the extension's own components go up, and keeps its plugins", () => { + const report = vi.fn(); + const ExtensionReactMarkdown = makeExtensionReactMarkdown(report); + // Throws only on what the plugin made, so the markdown would render without the plugin. + const ShoutingFails = ({ children }: { children?: React.ReactNode }) => { + if (typeof children === "string" && children === children.toUpperCase()) { + throw new Error("component broke"); + } + return

    {children}

    ; + }; + // React logs the error it rethrows. + const consoleError = vi.spyOn(console, "error").mockImplementation(() => undefined); + + expect(() => + render( + + {"some text"} + , + ), + ).toThrow("component broke"); + consoleError.mockRestore(); + + expect(report).not.toHaveBeenCalled(); + }); + + it("uses the plugins again once they change, after one set threw", () => { + const ExtensionReactMarkdown = makeExtensionReactMarkdown(() => undefined); + + const { container, rerender } = render( + + {"first text"} + , + ); + rerender( + {"second text"}, + ); + + expect(container).toHaveTextContent("SECOND TEXT"); + }); + + it("reports plugins that throw once, however often it renders", () => { + const report = vi.fn(); + const ExtensionReactMarkdown = makeExtensionReactMarkdown(report); + + const { rerender } = render( + {"text"}, + ); + rerender( + {"text"}, + ); + + expect(report).toHaveBeenCalledTimes(1); + }); + + const unsafeMarkdown = "[a](steam://run/1) [b](//server/share/x.exe) ![i](//host/share/x.png)"; + + it("filters URLs in MarkdownHooks as the component does", async () => { + const { MarkdownHooks } = makeExtensionReactMarkdown(() => undefined); + + const { container } = render({unsafeMarkdown}); + + await waitFor(() => expect(container.querySelectorAll("a")).toHaveLength(2)); + for (const link of container.querySelectorAll("a")) { + expect(link).not.toHaveAttribute("href"); + } + expect(container.querySelector("img")).not.toHaveAttribute("src"); + }); + + it("filters URLs in MarkdownAsync as the component does", async () => { + const { MarkdownAsync } = makeExtensionReactMarkdown(() => undefined); + + const { container } = render(await MarkdownAsync({ children: unsafeMarkdown })); + + for (const link of container.querySelectorAll("a")) { + expect(link).not.toHaveAttribute("href"); + } + expect(container.querySelector("img")).not.toHaveAttribute("src"); + }); }); diff --git a/src/renderer/src/util/react_markdown/ReactMarkdown.tsx b/src/renderer/src/util/react_markdown/ReactMarkdown.tsx index edce96932a..713a721264 100644 --- a/src/renderer/src/util/react_markdown/ReactMarkdown.tsx +++ b/src/renderer/src/util/react_markdown/ReactMarkdown.tsx @@ -48,6 +48,20 @@ const safeUrl = (url: string | null | undefined, key: string): string | undefine return key === "src" ? imageSrc(url) : (webHref(url) ?? mailHref(url)); }; +/** + * The options with links rendered as `WebLink` unless `components.a` says otherwise, and every URL + * going through `safeUrl` after the caller's own `urlTransform`, rather than that replacing it. + */ +const withSafeUrls = (options: ReactMarkdownProps): ReactMarkdownProps => { + const { components, urlTransform } = options; + return { + ...options, + components: { a: WebLink, ...components }, + urlTransform: (url, key, node) => + safeUrl(urlTransform ? urlTransform(url, key, node) : url, key), + }; +}; + /** * Renders the markdown passed as its children, for the older call sites styled by their own SCSS. * New UI uses `Markdown` (`ui/components/prose/markdown`), which also styles it and filters images. @@ -55,19 +69,14 @@ const safeUrl = (url: string | null | undefined, key: string): string | undefine * Links render as `WebLink` unless `components.a` says otherwise. A `urlTransform` runs before * `safeUrl`, rather than replacing it. */ -export const ReactMarkdown = ({ components, urlTransform, ...props }: ReactMarkdownProps) => ( - - safeUrl(urlTransform ? urlTransform(url, key, node) : url, key) - } - /> +export const ReactMarkdown = (props: ReactMarkdownProps) => ( + ); /** - * Props react-markdown 6 took that 9 doesn't, and what replaces each in 9, if anything. The ones - * from `renderers` on, 6 had already deprecated: it warned about them and ignored them. + * Props react-markdown 6 took that 9 doesn't, and what replaces each in 9, if anything. 6 still + * ran `plugins`, as `remarkPlugins`, so the extension shim passes it on as that. The ones from + * `renderers` on, 6 had already deprecated: it warned about them and ignored them. */ const removedProps: Record = { transformLinkUri: "urlTransform", @@ -76,9 +85,9 @@ const removedProps: Record = { includeElementIndex: undefined, rawSourcePos: undefined, sourcePos: undefined, + plugins: "remarkPlugins", renderers: "components", source: "children", - plugins: "remarkPlugins", allowedTypes: "allowedElements", disallowedTypes: "disallowedElements", allowNode: "allowElement", @@ -116,53 +125,114 @@ const withRemovedTransforms = ( }; }; -interface IDropPluginsOnErrorProps { - markdownProps: ReactMarkdownProps; - onDrop: (error: unknown) => void; +type Plugins = ReactMarkdownProps["remarkPlugins"]; + +interface IPluginCheck { + children: ReactMarkdownProps["children"]; + remarkPlugins: Plugins; + rehypePlugins: Plugins; + /** What the plugins threw, if they did and the markdown renders without them. */ + error?: { thrown: unknown }; } +/** What rendering these options throws, if anything. It only builds elements: no component runs. */ +const renderError = (options: ReactMarkdownProps): { thrown: unknown } | undefined => { + try { + reactMarkdown.default(options); + return undefined; + } catch (thrown) { + return { thrown }; + } +}; + /** - * Renders an extension's markdown, and again without its remark and rehype plugins if rendering - * throws. Plugins made for 6, such as remark-gfm 1, throw under 9, which would otherwise unmount - * the extension's UI. If it throws without them too, the error goes on up. + * Runs the extension's remark and rehype plugins on its markdown, on their own: without its + * components or any other option, so only an error the plugins cause counts against them. If the + * markdown throws without the plugins too, they aren't to blame, and the error is left to the + * real render. */ -class DropPluginsOnError extends React.Component { - public state = { failed: false }; - - public static getDerivedStateFromError() { - return { failed: true }; +const checkPlugins = ({ children, remarkPlugins, rehypePlugins }: ReactMarkdownProps) => { + const check: IPluginCheck = { children, remarkPlugins, rehypePlugins }; + if (remarkPlugins === undefined && rehypePlugins === undefined) { + return check; } - - public componentDidCatch(error: unknown) { - this.props.onDrop(error); + const withPlugins = renderError({ children, remarkPlugins, rehypePlugins }); + if (withPlugins !== undefined && renderError({ children }) === undefined) { + check.error = withPlugins; } + return check; +}; - public render() { - const { remarkPlugins, rehypePlugins, ...withoutPlugins } = this.props.markdownProps; - return ; +/** Whether two plugin entries are the same plugin with the same options, element by element. */ +const samePluggable = (a: unknown, b: unknown): boolean => + Object.is(a, b) || + (Array.isArray(a) && + Array.isArray(b) && + a.length === b.length && + a.every((item, index) => Object.is(item, b[index]))); + +/** + * Whether two plugin lists hold the same plugins. Extensions pass inline arrays, which are new on + * every render, so the lists are compared element by element rather than by identity. + */ +const samePlugins = (a: Plugins, b: Plugins): boolean => + Object.is(a, b) || + (Array.isArray(a) && + Array.isArray(b) && + a.length === b.length && + a.every((plugin, index) => samePluggable(plugin, b[index]))); + +/** + * Whether the extension's plugins can be used on this markdown. Plugins made for 6, such as + * remark-gfm 1, throw under 9, which would otherwise unmount the extension's UI. Checked again + * whenever the markdown or the plugins change, and `onDrop` hears about each check that fails. + */ +const usePluginsWork = ( + props: ReactMarkdownProps, + onDrop: (check: IPluginCheck & { error: { thrown: unknown } }) => void, +): boolean => { + const [check, setCheck] = React.useState(() => checkPlugins(props)); + let current = check; + if ( + !Object.is(check.children, props.children) || + !samePlugins(check.remarkPlugins, props.remarkPlugins) || + !samePlugins(check.rehypePlugins, props.rehypePlugins) + ) { + current = checkPlugins(props); + setCheck(current); } -} + + React.useEffect(() => { + if (current.error !== undefined) { + onDrop({ ...current, error: current.error }); + } + }, [current, onDrop]); + + return current.error === undefined; +}; /** * What an extension gets for `require("react-markdown")`. Extensions were built against 6, a * CommonJS module that was the component itself, but require() of 9 returns the ES module's * namespace, which React can't render. So this is the component, carrying itself as `default` and * the module's other exports, which every way of importing 6 or 9 resolves to, plus 6's - * `uriTransformer`. 9 ignores 6's removed props, or throws on them in a development build, so - * they're dropped and `report`ed instead, apart from the two URL transforms, which 9's - * `urlTransform` still runs. + * `uriTransformer`. `MarkdownHooks` and `MarkdownAsync` filter URLs as the component does. + * + * 9 ignores 6's removed props, or throws on them in a development build, so they're dropped and + * `report`ed instead, apart from the two URL transforms, which 9's `urlTransform` still runs, and + * `plugins`, which goes on as `remarkPlugins`. */ export const makeExtensionReactMarkdown = ( report: (method: string, replacement?: string) => void, ) => { - const reportPlugins = (props: ReactMarkdownProps, error: unknown) => { + const reportPlugins = (check: IPluginCheck & { error: { thrown: unknown } }) => { for (const name of ["remarkPlugins", "rehypePlugins"] as const) { - if (props[name] !== undefined) { + if (check[name] !== undefined) { report(`react-markdown.${name}`, "a version of the plugin made for react-markdown 9"); } } log("warn", "react-markdown plugins threw, so the markdown is shown without them", { - error: getErrorMessageOrDefault(error), + error: getErrorMessageOrDefault(check.error.thrown), }); }; @@ -177,20 +247,28 @@ export const makeExtensionReactMarkdown = ( kept[name] = value; } } + kept.remarkPlugins ??= props.plugins as Plugins; kept.urlTransform = withRemovedTransforms( props.urlTransform, props.transformLinkUri, props.transformImageUri, ); - if (kept.remarkPlugins === undefined && kept.rehypePlugins === undefined) { + const pluginsWork = usePluginsWork(kept, reportPlugins); + if (pluginsWork) { return ; } - return ( - reportPlugins(kept, error)} /> - ); + const { remarkPlugins, rehypePlugins, ...withoutPlugins } = kept; + return ; }; + const MarkdownHooks = (props: ReactMarkdownProps) => ( + + ); + + const MarkdownAsync = (options: ReactMarkdownProps) => + reactMarkdown.MarkdownAsync(withSafeUrls(options)); + const uriTransformer = (url: string) => { report("react-markdown.uriTransformer", "defaultUrlTransform"); return reactMarkdown.defaultUrlTransform(url); @@ -203,6 +281,8 @@ export const makeExtensionReactMarkdown = ( return Object.assign(ExtensionReactMarkdown, otherExports, { default: ExtensionReactMarkdown, + MarkdownHooks, + MarkdownAsync, uriTransformer, }); };