diff --git a/.gitignore b/.gitignore index d887a903cf..fc57870e94 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,9 @@ storybook-static .reports .pnpm-store +deps.json +depsFiltered.json + # VSCode extension "Local History" .history diff --git a/package.json b/package.json index f6c88061e5..571e052d82 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,8 @@ "oxc": "oxlint -c .oxlintrc.json", "oxc:fix": "pnpm run oxc --fix", "prepare": "husky", + "analyse:deps:ui": "tsx ./utils/scripts/analyse-deps.ts packages/ui/src/components", + "analyse:deps:form": "tsx ./utils/scripts/analyse-deps.ts packages/form/src/components", "tokens:update": "tsx ./utils/scripts/figma-synchronise-tokens.tsx && pnpm run format packages/themes/src/themes/console", "icons:update": "tsx ./utils/scripts/generate-icons-file.tsx && pnpm run format packages/icons", "release": "pnpm build && pnpm changeset publish", @@ -135,6 +137,7 @@ "@ultraviolet/fonts": "workspace:*", "@ultraviolet/themes": "workspace:*", "@ultraviolet/ui": "workspace:*", + "@vanilla-extract/vite-plugin": "5.1.1", "@vitejs/plugin-react": "5.0.2", "@vitest/coverage-istanbul": "3.2.4", "@vitest/ui": "3.2.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ccde6a61e2..c25800e1e5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -146,6 +146,9 @@ importers: '@ultraviolet/ui': specifier: workspace:* version: link:packages/ui + '@vanilla-extract/vite-plugin': + specifier: 5.1.1 + version: 5.1.1(@types/node@22.18.3)(babel-plugin-macros@3.1.0)(jiti@2.4.2)(terser@5.39.0)(tsx@4.20.5)(vite@7.1.5(@types/node@22.18.3)(jiti@2.4.2)(terser@5.39.0)(tsx@4.20.5)(yaml@2.8.1))(yaml@2.8.1) '@vitejs/plugin-react': specifier: 5.0.2 version: 5.0.2(vite@7.1.5(@types/node@22.18.3)(jiti@2.4.2)(terser@5.39.0)(tsx@4.20.5)(yaml@2.8.1)) @@ -238,7 +241,7 @@ importers: version: 19.1.1(react@19.1.1) react-scan: specifier: 0.4.3 - version: 0.4.3(@types/react@19.1.13)(next@15.5.2(@babel/core@7.28.4)(@playwright/test@1.55.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(react-dom@19.1.1(react@19.1.1))(react-router-dom@7.9.1(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(react-router@7.9.1(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(react@19.1.1)(rollup@4.50.1) + version: 0.4.3(@types/react@19.1.13)(next@15.5.2(@babel/core@7.28.4)(@playwright/test@1.55.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(react-dom@19.1.1(react@19.1.1))(react-router-dom@7.9.1(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(react-router@7.9.1(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(react@19.1.1)(rollup@4.50.1) read-pkg: specifier: 9.0.1 version: 9.0.1 @@ -395,7 +398,7 @@ importers: version: link:../../packages/ui next: specifier: 15.5.2 - version: 15.5.2(@babel/core@7.28.4)(@playwright/test@1.55.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1) + version: 15.5.2(@babel/core@7.28.4)(@playwright/test@1.55.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1) react: specifier: 19.1.1 version: 19.1.1 @@ -459,7 +462,7 @@ importers: version: link:../../packages/ui next: specifier: 15.5.2 - version: 15.5.2(@babel/core@7.28.4)(@playwright/test@1.55.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1) + version: 15.5.2(@babel/core@7.28.4)(@playwright/test@1.55.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1) react: specifier: 19.1.1 version: 19.1.1 @@ -655,7 +658,7 @@ importers: version: link:../ui next: specifier: 15.5.2 - version: 15.5.2(@babel/core@7.28.4)(@playwright/test@1.55.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1) + version: 15.5.2(@babel/core@7.28.4)(@playwright/test@1.55.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1) react: specifier: 19.1.1 version: 19.1.1 @@ -3572,6 +3575,26 @@ packages: cpu: [x64] os: [win32] + '@vanilla-extract/babel-plugin-debug-ids@1.2.2': + resolution: {integrity: sha512-MeDWGICAF9zA/OZLOKwhoRlsUW+fiMwnfuOAqFVohL31Agj7Q/RBWAYweqjHLgFBCsdnr6XIfwjJnmb2znEWxw==} + + '@vanilla-extract/compiler@0.3.1': + resolution: {integrity: sha512-KZ67DZQu58dMo7Jv4PNMPG5TbMOXB68xxVYV2cRJvUdPeiOmX0FOaPgEsYBAZUgd/oLEx4IyV0AvlvsxJ1akfQ==} + + '@vanilla-extract/css@1.17.4': + resolution: {integrity: sha512-m3g9nQDWPtL+sTFdtCGRMI1Vrp86Ay4PBYq1Bo7Bnchj5ElNtAJpOqD+zg+apthVA4fB7oVpMWNjwpa6ElDWFQ==} + + '@vanilla-extract/integration@8.0.4': + resolution: {integrity: sha512-cmOb7tR+g3ulKvFtSbmdw3YUyIS1d7MQqN+FcbwNhdieyno5xzUyfDCMjeWJhmCSMvZ6WlinkrOkgs6SHB+FRg==} + + '@vanilla-extract/private@1.0.9': + resolution: {integrity: sha512-gT2jbfZuaaCLrAxwXbRgIhGhcXbRZCG3v4TTUnjw0EJ7ArdBRxkq4msNJkbuRkCgfIK5ATmprB5t9ljvLeFDEA==} + + '@vanilla-extract/vite-plugin@5.1.1': + resolution: {integrity: sha512-Nd1worqkHrd8XED4ZAA7Wmkd3pCqCwpmzCBVF8v6T1BSLHGXQE5HYflVgygw0CsIAbFRMS6zQBIk4F4/r/YKIw==} + peerDependencies: + vite: 7.1.5 + '@vitejs/plugin-react@5.0.2': resolution: {integrity: sha512-tmyFgixPZCx2+e6VO9TNITWcCQl8+Nl/E8YbAyPVv85QCc7/A3JrdfG2A8gIzvVhWuzMOVrFW1aReaNxrI6tbw==} engines: {node: ^20.19.0 || >=22.12.0} @@ -4183,6 +4206,9 @@ packages: concat-with-sourcemaps@1.1.0: resolution: {integrity: sha512-4gEjHJFT9e+2W/77h/DS5SGUgwDaOwprX8L/gl5+3ixnzkVJJsZWDSelmN3Oilw3LNDZjZV0yqH1hLG3k6nghg==} + confbox@0.1.8: + resolution: {integrity: sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==} + config-chain@1.1.13: resolution: {integrity: sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==} @@ -4483,6 +4509,14 @@ packages: dedent@0.7.0: resolution: {integrity: sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==} + dedent@1.7.0: + resolution: {integrity: sha512-HGFtf8yhuhGhqO07SV79tRp+br4MnbdjeVxotpn1QBl30pcLLCQjX5b2295ll0fv8RKDKsmWYrl05usHM9CewQ==} + peerDependencies: + babel-plugin-macros: ^3.1.0 + peerDependenciesMeta: + babel-plugin-macros: + optional: true + deep-eql@5.0.2: resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} engines: {node: '>=6'} @@ -4494,6 +4528,9 @@ packages: deep-is@0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} + deep-object-diff@1.1.9: + resolution: {integrity: sha512-Rn+RuwkmkDwCi2/oXOFS9Gsr5lJZu/yTGpK7wAaAIE75CC+LCGEZHpY6VQJa/RoJcrmaA/docWJZvYohlNkWPA==} + deepmerge@4.3.1: resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} engines: {node: '>=0.10.0'} @@ -4957,6 +4994,10 @@ packages: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} + eval@0.1.8: + resolution: {integrity: sha512-EzV94NYKoO09GLXGjXj9JIlXijVck4ONSr5wiCWDvhsvj5jxSrzTmRU/9C1DyB6uToszLs8aifA6NQ7lEQdvFw==} + engines: {node: '>= 0.8'} + eventemitter3@4.0.7: resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==} @@ -5658,6 +5699,9 @@ packages: jackspeak@3.4.3: resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} + javascript-stringify@2.1.0: + resolution: {integrity: sha512-JVAfqNPTvNq3sB/VHQJAFxN/sPgKnsKrCwyRt15zwNCdrMMJDdcEOdubuy+DuJYYdm0ox1J4uzEuYKkN+9yhVg==} + jest-axe@10.0.0: resolution: {integrity: sha512-9QR0M7//o5UVRnEUUm68IsGapHrcKGakYy9dKWWMX79LmeUKguDI6DREyljC5I13j78OUmtKLF5My6ccffLFBg==} engines: {node: '>= 16.0.0'} @@ -6005,6 +6049,9 @@ packages: mdn-data@2.12.2: resolution: {integrity: sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA==} + media-query-parser@2.0.2: + resolution: {integrity: sha512-1N4qp+jE0pL5Xv4uEcwVUhIkwdUO3S/9gML90nqKA7v7FcOS5vUtatfzok9S9U1EJU8dHWlcv95WLnKmmxZI9w==} + meow@12.1.1: resolution: {integrity: sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==} engines: {node: '>=16.10'} @@ -6156,6 +6203,12 @@ packages: resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==} hasBin: true + mlly@1.8.0: + resolution: {integrity: sha512-l8D9ODSRWLe2KHJSifWGwBqpTZXIXTeo8mlKjY+E2HAakaTeNpqAyBZ8GSqLzHgw4XmHmC8whvpjJNMbFZN7/g==} + + modern-ahocorasick@1.1.0: + resolution: {integrity: sha512-sEKPVl2rM+MNVkGQt3ChdmD8YsigmXdn5NifZn6jiwn9LRJpWm8F3guhaqrJT/JOat6pwpbXEk6kv+b9DMIjsQ==} + moo-color@1.0.3: resolution: {integrity: sha512-i/+ZKXMDf6aqYtBhuOcej71YSlbjT3wCO/4H1j8rPvxDJEifdwgg5MaFyu6iYAT8GBZJg2z0dkgK4YMzvURALQ==} @@ -6519,6 +6572,9 @@ packages: resolution: {integrity: sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA==} engines: {node: '>=10'} + pkg-types@1.3.1: + resolution: {integrity: sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==} + playwright-core@1.53.2: resolution: {integrity: sha512-ox/OytMy+2w1jcYEYlOo1Hhp8hZkLCximMTUTMBXjGUA1KoFfiSZ+DU+3a739jsPY0yoKH2TFy9S2fsJas8yAw==} engines: {node: '>=18'} @@ -7047,6 +7103,9 @@ packages: resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} engines: {node: '>=0.10.0'} + require-like@0.1.2: + resolution: {integrity: sha512-oyrU88skkMtDdauHDuKVrgR+zuItqr6/c//FXzvmxRGMexSDc6hNvJInGW3LL46n+8b50RykrvwSUIIQH2LQ5A==} + requires-port@1.0.0: resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} @@ -7761,6 +7820,9 @@ packages: engines: {node: '>=14.17'} hasBin: true + ufo@1.6.1: + resolution: {integrity: sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==} + unbox-primitive@1.1.0: resolution: {integrity: sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==} engines: {node: '>= 0.4'} @@ -11610,6 +11672,88 @@ snapshots: '@unrs/resolver-binding-win32-x64-msvc@1.9.2': optional: true + '@vanilla-extract/babel-plugin-debug-ids@1.2.2': + dependencies: + '@babel/core': 7.28.4 + transitivePeerDependencies: + - supports-color + + '@vanilla-extract/compiler@0.3.1(@types/node@22.18.3)(babel-plugin-macros@3.1.0)(jiti@2.4.2)(terser@5.39.0)(tsx@4.20.5)(yaml@2.8.1)': + dependencies: + '@vanilla-extract/css': 1.17.4(babel-plugin-macros@3.1.0) + '@vanilla-extract/integration': 8.0.4(babel-plugin-macros@3.1.0) + vite: 7.1.5(@types/node@22.18.3)(jiti@2.4.2)(terser@5.39.0)(tsx@4.20.5)(yaml@2.8.1) + vite-node: 3.2.4(@types/node@22.18.3)(jiti@2.4.2)(terser@5.39.0)(tsx@4.20.5)(yaml@2.8.1) + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - jiti + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - tsx + - yaml + + '@vanilla-extract/css@1.17.4(babel-plugin-macros@3.1.0)': + dependencies: + '@emotion/hash': 0.9.2 + '@vanilla-extract/private': 1.0.9 + css-what: 6.1.0 + cssesc: 3.0.0 + csstype: 3.1.3 + dedent: 1.7.0(babel-plugin-macros@3.1.0) + deep-object-diff: 1.1.9 + deepmerge: 4.3.1 + lru-cache: 10.4.3 + media-query-parser: 2.0.2 + modern-ahocorasick: 1.1.0 + picocolors: 1.1.1 + transitivePeerDependencies: + - babel-plugin-macros + + '@vanilla-extract/integration@8.0.4(babel-plugin-macros@3.1.0)': + dependencies: + '@babel/core': 7.28.4 + '@babel/plugin-syntax-typescript': 7.27.1(@babel/core@7.28.4) + '@vanilla-extract/babel-plugin-debug-ids': 1.2.2 + '@vanilla-extract/css': 1.17.4(babel-plugin-macros@3.1.0) + dedent: 1.7.0(babel-plugin-macros@3.1.0) + esbuild: 0.25.0 + eval: 0.1.8 + find-up: 5.0.0 + javascript-stringify: 2.1.0 + mlly: 1.8.0 + transitivePeerDependencies: + - babel-plugin-macros + - supports-color + + '@vanilla-extract/private@1.0.9': {} + + '@vanilla-extract/vite-plugin@5.1.1(@types/node@22.18.3)(babel-plugin-macros@3.1.0)(jiti@2.4.2)(terser@5.39.0)(tsx@4.20.5)(vite@7.1.5(@types/node@22.18.3)(jiti@2.4.2)(terser@5.39.0)(tsx@4.20.5)(yaml@2.8.1))(yaml@2.8.1)': + dependencies: + '@vanilla-extract/compiler': 0.3.1(@types/node@22.18.3)(babel-plugin-macros@3.1.0)(jiti@2.4.2)(terser@5.39.0)(tsx@4.20.5)(yaml@2.8.1) + '@vanilla-extract/integration': 8.0.4(babel-plugin-macros@3.1.0) + vite: 7.1.5(@types/node@22.18.3)(jiti@2.4.2)(terser@5.39.0)(tsx@4.20.5)(yaml@2.8.1) + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - jiti + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - tsx + - yaml + '@vitejs/plugin-react@5.0.2(vite@7.1.5(@types/node@22.18.3)(jiti@2.4.2)(terser@5.39.0)(tsx@4.20.5)(yaml@2.8.1))': dependencies: '@babel/core': 7.28.3 @@ -12316,6 +12460,8 @@ snapshots: dependencies: source-map: 0.6.1 + confbox@0.1.8: {} + config-chain@1.1.13: dependencies: ini: 1.3.8 @@ -12639,12 +12785,18 @@ snapshots: dedent@0.7.0: {} + dedent@1.7.0(babel-plugin-macros@3.1.0): + optionalDependencies: + babel-plugin-macros: 3.1.0 + deep-eql@5.0.2: {} deep-extend@0.6.0: {} deep-is@0.1.4: {} + deep-object-diff@1.1.9: {} + deepmerge@4.3.1: {} defaults@1.0.4: @@ -13316,6 +13468,11 @@ snapshots: esutils@2.0.3: {} + eval@0.1.8: + dependencies: + '@types/node': 22.18.3 + require-like: 0.1.2 + eventemitter3@4.0.7: {} eventemitter3@5.0.1: {} @@ -14069,6 +14226,8 @@ snapshots: optionalDependencies: '@pkgjs/parseargs': 0.11.0 + javascript-stringify@2.1.0: {} + jest-axe@10.0.0: dependencies: axe-core: 4.10.2 @@ -14506,6 +14665,10 @@ snapshots: mdn-data@2.12.2: {} + media-query-parser@2.0.2: + dependencies: + '@babel/runtime': 7.28.4 + meow@12.1.1: {} merge-stream@2.0.0: {} @@ -14744,6 +14907,15 @@ snapshots: dependencies: minimist: 1.2.8 + mlly@1.8.0: + dependencies: + acorn: 8.15.0 + pathe: 2.0.3 + pkg-types: 1.3.1 + ufo: 1.6.1 + + modern-ahocorasick@1.1.0: {} + moo-color@1.0.3: dependencies: color-name: 1.1.4 @@ -14782,7 +14954,7 @@ snapshots: dependencies: enhanced-resolve: 5.18.1 - next@15.5.2(@babel/core@7.28.4)(@playwright/test@1.55.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1): + next@15.5.2(@babel/core@7.28.4)(@playwright/test@1.55.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1): dependencies: '@next/env': 15.5.2 '@swc/helpers': 0.5.15 @@ -14790,7 +14962,7 @@ snapshots: postcss: 8.4.31 react: 19.1.1 react-dom: 19.1.1(react@19.1.1) - styled-jsx: 5.1.6(@babel/core@7.28.4)(react@19.1.1) + styled-jsx: 5.1.6(@babel/core@7.28.4)(babel-plugin-macros@3.1.0)(react@19.1.1) optionalDependencies: '@next/swc-darwin-arm64': 15.5.2 '@next/swc-darwin-x64': 15.5.2 @@ -15092,6 +15264,12 @@ snapshots: pify@5.0.0: {} + pkg-types@1.3.1: + dependencies: + confbox: 0.1.8 + mlly: 1.8.0 + pathe: 2.0.3 + playwright-core@1.53.2: {} playwright-core@1.55.0: {} @@ -15502,7 +15680,7 @@ snapshots: optionalDependencies: react-dom: 19.1.1(react@19.1.1) - react-scan@0.4.3(@types/react@19.1.13)(next@15.5.2(@babel/core@7.28.4)(@playwright/test@1.55.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(react-dom@19.1.1(react@19.1.1))(react-router-dom@7.9.1(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(react-router@7.9.1(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(react@19.1.1)(rollup@4.50.1): + react-scan@0.4.3(@types/react@19.1.13)(next@15.5.2(@babel/core@7.28.4)(@playwright/test@1.55.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(react-dom@19.1.1(react@19.1.1))(react-router-dom@7.9.1(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(react-router@7.9.1(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(react@19.1.1)(rollup@4.50.1): dependencies: '@babel/core': 7.28.4 '@babel/generator': 7.28.0 @@ -15524,7 +15702,7 @@ snapshots: react-dom: 19.1.1(react@19.1.1) tsx: 4.20.5 optionalDependencies: - next: 15.5.2(@babel/core@7.28.4)(@playwright/test@1.55.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1) + next: 15.5.2(@babel/core@7.28.4)(@playwright/test@1.55.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.1(react@19.1.1))(react@19.1.1) react-router: 7.9.1(react-dom@19.1.1(react@19.1.1))(react@19.1.1) react-router-dom: 7.9.1(react-dom@19.1.1(react@19.1.1))(react@19.1.1) unplugin: 2.1.0 @@ -15686,6 +15864,8 @@ snapshots: require-from-string@2.0.2: {} + require-like@0.1.2: {} + requires-port@1.0.0: {} resolve-dir@1.0.1: @@ -16218,12 +16398,13 @@ snapshots: style-mod@4.1.2: {} - styled-jsx@5.1.6(@babel/core@7.28.4)(react@19.1.1): + styled-jsx@5.1.6(@babel/core@7.28.4)(babel-plugin-macros@3.1.0)(react@19.1.1): dependencies: client-only: 0.0.1 react: 19.1.1 optionalDependencies: '@babel/core': 7.28.4 + babel-plugin-macros: 3.1.0 stylehacks@5.1.1(postcss@8.5.6): dependencies: @@ -16520,6 +16701,8 @@ snapshots: typescript@5.9.2: {} + ufo@1.6.1: {} + unbox-primitive@1.1.0: dependencies: call-bound: 1.0.4 diff --git a/utils/scripts/analyse-deps.ts b/utils/scripts/analyse-deps.ts new file mode 100644 index 0000000000..ec20f8f9b2 --- /dev/null +++ b/utils/scripts/analyse-deps.ts @@ -0,0 +1,134 @@ +import fs from 'node:fs' +import path from 'node:path' + +const cwd = process.cwd() +const args = process.argv.slice(2) + +const srcDir = path.join(cwd, args[0] ?? 'packages/ui/src/components') + +type DependencyGraph = { + [componentName: string]: { + dependsOn: string[] + } +} + +const graph: DependencyGraph = {} + +const walk = (dir: string): string[] => { + const results = [] + const list = fs.readdirSync(dir) + + for (const file of list) { + const filePath = path.join(dir, file) + + const stat = fs.statSync(filePath) + if (stat.isDirectory()) { + const subDirResult = walk(filePath) + + results.push(...subDirResult) + } else { + results.push(filePath) + } + } + + return results +} + +const filesToAnalyze = walk(srcDir) + +for (const file of filesToAnalyze) { + if ( + (file.endsWith('.ts') || file.endsWith('.tsx')) && + !['stories.tsx', 'test.tsx'].some(end => file.endsWith(end)) + ) { + const relativePath = path.relative(srcDir, file) + const componentName = relativePath.split('/')[0] + + const content = fs.readFileSync(file, 'utf8') + + const matches = content.matchAll( + /import\s+(?:.*?from\s+)?(['"])(.*?)(['"])|export\s+{?\s*(\w+)?\s*}?$/g, + ) + + for (const match of matches) { + const importedFile = match[2] || null + if (importedFile) { + const normalizedFile = path + .relative(srcDir, path.join(path.dirname(file), importedFile)) + .replace(/\.tsx?$/, '') + + if ( + ![ + 'react', + 'react-vite', + 'vitest', + 'styled', + '@emotion/styled', + 'components/', + ].some(string => normalizedFile.endsWith(string)) + ) { + const importedComponent = normalizedFile.split('/').reverse()[0] + + if (!graph[componentName]) { + graph[componentName] = { dependsOn: [] } + } + + if (importedComponent !== componentName) { + const { dependsOn } = graph[componentName] + const newDeps = [...new Set([...dependsOn, importedComponent])] + graph[componentName].dependsOn = newDeps + } + } + } + } + } +} + +const sortGraphByDependencySize = ({ + currentGraph, + order = 'asc', +}: { + currentGraph: DependencyGraph + order?: 'asc' | 'desc' +}) => { + const entries = Object.entries(currentGraph) + + entries.sort((a, b) => { + const aSize = a[1].dependsOn.length + const bSize = b[1].dependsOn.length + + return order === 'asc' ? bSize - aSize : aSize - bSize + }) + + return { + order, + sortedComponent: entries, + } +} + +const sortedComponent = sortGraphByDependencySize({ + currentGraph: graph, + order: 'desc', +}) + +const { info } = console +info('sortedComponent', JSON.stringify(graph, null, 2)) +fs.writeFileSync('deps.json', JSON.stringify(sortedComponent, null, 2)) + +const componentNames = new Set( + sortedComponent.sortedComponent.map(([name]) => name), +) +const asRecord = Object.fromEntries( + sortedComponent.sortedComponent + .map(([name, count]) => { + const { dependsOn } = count as { dependsOn: string[] } + const filteredDeps = dependsOn.filter(dependency => + componentNames.has(dependency), + ) + + return [name, filteredDeps.length] as const + }) + .sort(([, aCount], [, bCount]) => aCount - bCount), +) + +fs.writeFileSync('depsFiltered.json', JSON.stringify(asRecord, null, 2))