From d1fee530a4f218b5dce1000e7c5863049b83fb84 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Wed, 23 Jul 2025 15:19:01 -0600 Subject: [PATCH] add async vite loader --- .../ui/charts/TableChart/BusterTableChart.tsx | 9 +- apps/web/vitest.config.ts | 117 +++++++++--------- pnpm-lock.yaml | 76 ++++++++++-- 3 files changed, 131 insertions(+), 71 deletions(-) diff --git a/apps/web/src/components/ui/charts/TableChart/BusterTableChart.tsx b/apps/web/src/components/ui/charts/TableChart/BusterTableChart.tsx index 4398768e9..d87a2c0fd 100644 --- a/apps/web/src/components/ui/charts/TableChart/BusterTableChart.tsx +++ b/apps/web/src/components/ui/charts/TableChart/BusterTableChart.tsx @@ -7,6 +7,7 @@ import React, { useCallback } from 'react'; import { AppDataGrid } from '../../table/AppDataGrid'; import type { BusterChartPropsBase } from '../BusterChart.types'; import type { BusterTableChartConfig } from './interfaces'; +import { useUpdateMetricChart } from '@/context/Metrics'; export interface BusterTableChartProps extends BusterTableChartConfig, BusterChartPropsBase {} @@ -27,19 +28,17 @@ const BusterTableChartBase: React.FC = ({ // tableHeaderFontColor, // tableColumnFontColor, }) => { - // const { onUpdateMetricChartConfig, onInitializeTableColumnWidths } = useUpdateMetricChart(); + const { onUpdateMetricChartConfig, onInitializeTableColumnWidths } = useUpdateMetricChart(); const onChangeConfig = useMemoizedFn((config: Partial) => { if (readOnly) return; - // onUpdateMetricChartConfig({ chartConfig: config }); - alert('TODO - FIX THIS BEFORE A PR'); + onUpdateMetricChartConfig({ chartConfig: config }); if ( (tableColumnWidths === null || isEmpty(tableColumnWidths)) && !isEmpty(config.tableColumnWidths) ) { - alert('TODO - FIX THIS BEFORE A PR'); - // onInitializeTableColumnWidths(config.tableColumnWidths); + onInitializeTableColumnWidths(config.tableColumnWidths); } }); diff --git a/apps/web/vitest.config.ts b/apps/web/vitest.config.ts index 43d0a0564..29d9d546e 100644 --- a/apps/web/vitest.config.ts +++ b/apps/web/vitest.config.ts @@ -1,63 +1,66 @@ -import { defineConfig } from 'vitest/config'; -import tsconfigPaths from 'vite-tsconfig-paths'; +import { defineConfig, type ViteUserConfig } from 'vitest/config'; +import type { PluginOption } from 'vite'; -export default defineConfig({ - plugins: [tsconfigPaths()], - esbuild: { - jsx: 'automatic' - }, - test: { - globals: true, - environment: 'jsdom', // For React components - setupFiles: ['./vitest.setup.ts'], - pool: 'forks', - poolOptions: { - forks: { - maxForks: process.env.CI ? 1 : 8, - minForks: process.env.CI ? 1 : 8 +export default defineConfig(async () => { + const { default: tsconfigPaths } = await import('vite-tsconfig-paths'); + return { + plugins: [tsconfigPaths() as PluginOption], + esbuild: { + jsx: 'automatic' + }, + test: { + globals: true, + environment: 'jsdom', // For React components + setupFiles: ['./vitest.setup.ts'], + pool: 'forks', + poolOptions: { + forks: { + maxForks: process.env.CI ? 1 : 8, + minForks: process.env.CI ? 1 : 8 + } + }, + include: ['**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], + exclude: [ + '**/node_modules/**', + '**/dist/**', + '**/.next/**', + '**/playwright-tests/**', + '**/coverage/**' + ], + coverage: { + provider: 'v8', + reporter: ['text', 'json', 'html'], + exclude: [ + 'coverage/**', + 'dist/**', + '**/node_modules/**', + '**/[.]**', + 'packages/*/test{,s}/**', + '**/*.d.ts', + '**/virtual:*', + '**/__x00__*', + '**/\x00*', + 'cypress/**', + 'test{,s}/**', + 'test{,-*}.{js,cjs,mjs,ts,tsx,jsx}', + '**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}', + '**/*{.,-}spec.{js,cjs,mjs,ts,tsx,jsx}', + '**/tests/**', + '**/__tests__/**', + '**/.{eslint,mocha,prettier}rc.{js,cjs,yml}', + '**/vitest.{workspace,projects}.[jt]s?(on)', + '**/vitest.config.[jt]s', + '**/playwright.config.[jt]s', + '**/.storybook/**', + '**/storybook-static/**' + ] } }, - include: ['**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], - exclude: [ - '**/node_modules/**', - '**/dist/**', - '**/.next/**', - '**/playwright-tests/**', - '**/coverage/**' - ], - coverage: { - provider: 'v8', - reporter: ['text', 'json', 'html'], - exclude: [ - 'coverage/**', - 'dist/**', - '**/node_modules/**', - '**/[.]**', - 'packages/*/test{,s}/**', - '**/*.d.ts', - '**/virtual:*', - '**/__x00__*', - '**/\x00*', - 'cypress/**', - 'test{,s}/**', - 'test{,-*}.{js,cjs,mjs,ts,tsx,jsx}', - '**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}', - '**/*{.,-}spec.{js,cjs,mjs,ts,tsx,jsx}', - '**/tests/**', - '**/__tests__/**', - '**/.{eslint,mocha,prettier}rc.{js,cjs,yml}', - '**/vitest.{workspace,projects}.[jt]s?(on)', - '**/vitest.config.[jt]s', - '**/playwright.config.[jt]s', - '**/.storybook/**', - '**/storybook-static/**' - ] - } - }, - css: { - postcss: { - plugins: [] + css: { + postcss: { + plugins: [] + } } - } + } satisfies ViteUserConfig; }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 080c0e75c..ece5cf422 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -49,13 +49,13 @@ catalogs: specifier: ^11.0.0 version: 11.1.0 vite: - specifier: 6.3.5 - version: 6.3.5 + specifier: ^7.0.0 + version: 7.0.5 vite-tsconfig-paths: specifier: ^5.1.4 version: 5.1.4 vitest: - specifier: 3.2.4 + specifier: ^3.2.4 version: 3.2.4 zod: specifier: ^3.25.0 @@ -511,10 +511,10 @@ importers: version: 0.41.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(svelte@5.34.9)(vue@3.5.17(typescript@5.8.3)) vite: specifier: 'catalog:' - version: 6.3.5(@types/node@24.0.10)(jiti@2.4.2)(lightningcss@1.30.1)(sass@1.89.2)(terser@5.43.1)(tsx@4.20.3)(yaml@2.8.0) + version: 7.0.5(@types/node@24.0.10)(jiti@2.4.2)(lightningcss@1.30.1)(sass@1.89.2)(terser@5.43.1)(tsx@4.20.3)(yaml@2.8.0) vite-tsconfig-paths: specifier: 'catalog:' - version: 5.1.4(typescript@5.8.3)(vite@6.3.5(@types/node@24.0.10)(jiti@2.4.2)(lightningcss@1.30.1)(sass@1.89.2)(terser@5.43.1)(tsx@4.20.3)(yaml@2.8.0)) + version: 5.1.4(typescript@5.8.3)(vite@7.0.5(@types/node@24.0.10)(jiti@2.4.2)(lightningcss@1.30.1)(sass@1.89.2)(terser@5.43.1)(tsx@4.20.3)(yaml@2.8.0)) zod: specifier: 'catalog:' version: 3.25.1 @@ -978,10 +978,10 @@ importers: version: 17.1.0 vite: specifier: 'catalog:' - version: 6.3.5(@types/node@24.0.10)(jiti@2.4.2)(lightningcss@1.30.1)(sass@1.89.2)(terser@5.43.1)(tsx@4.20.3)(yaml@2.8.0) + version: 7.0.5(@types/node@24.0.10)(jiti@2.4.2)(lightningcss@1.30.1)(sass@1.89.2)(terser@5.43.1)(tsx@4.20.3)(yaml@2.8.0) vite-tsconfig-paths: specifier: 'catalog:' - version: 5.1.4(typescript@5.8.3)(vite@6.3.5(@types/node@24.0.10)(jiti@2.4.2)(lightningcss@1.30.1)(sass@1.89.2)(terser@5.43.1)(tsx@4.20.3)(yaml@2.8.0)) + version: 5.1.4(typescript@5.8.3)(vite@7.0.5(@types/node@24.0.10)(jiti@2.4.2)(lightningcss@1.30.1)(sass@1.89.2)(terser@5.43.1)(tsx@4.20.3)(yaml@2.8.0)) vitest: specifier: 'catalog:' version: 3.2.4(@edge-runtime/vm@3.2.0)(@types/debug@4.1.12)(@types/node@24.0.10)(@vitest/ui@3.2.4)(jiti@2.4.2)(jsdom@26.1.0)(lightningcss@1.30.1)(msw@2.10.4(@types/node@24.0.10)(typescript@5.8.3))(sass@1.89.2)(terser@5.43.1)(tsx@4.20.3)(yaml@2.8.0) @@ -11200,6 +11200,46 @@ packages: yaml: optional: true + vite@7.0.5: + resolution: {integrity: sha512-1mncVwJxy2C9ThLwz0+2GKZyEXuC3MyWtAAlNftlZZXZDP3AJt5FmwcMit/IGGaNZ8ZOB2BNO/HFUB+CpN0NQw==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + '@types/node': ^20.19.0 || >=22.12.0 + jiti: '>=1.21.0' + less: ^4.0.0 + lightningcss: ^1.21.0 + sass: ^1.70.0 + sass-embedded: ^1.70.0 + stylus: '>=0.54.8' + sugarss: ^5.0.0 + terser: ^5.16.0 + tsx: ^4.8.1 + yaml: ^2.4.2 + peerDependenciesMeta: + '@types/node': + optional: true + jiti: + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + tsx: + optional: true + yaml: + optional: true + vitest@3.2.4: resolution: {integrity: sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==} engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} @@ -23959,13 +23999,13 @@ snapshots: - tsx - yaml - vite-tsconfig-paths@5.1.4(typescript@5.8.3)(vite@6.3.5(@types/node@24.0.10)(jiti@2.4.2)(lightningcss@1.30.1)(sass@1.89.2)(terser@5.43.1)(tsx@4.20.3)(yaml@2.8.0)): + vite-tsconfig-paths@5.1.4(typescript@5.8.3)(vite@7.0.5(@types/node@24.0.10)(jiti@2.4.2)(lightningcss@1.30.1)(sass@1.89.2)(terser@5.43.1)(tsx@4.20.3)(yaml@2.8.0)): dependencies: debug: 4.4.1 globrex: 0.1.2 tsconfck: 3.1.6(typescript@5.8.3) optionalDependencies: - vite: 6.3.5(@types/node@24.0.10)(jiti@2.4.2)(lightningcss@1.30.1)(sass@1.89.2)(terser@5.43.1)(tsx@4.20.3)(yaml@2.8.0) + vite: 7.0.5(@types/node@24.0.10)(jiti@2.4.2)(lightningcss@1.30.1)(sass@1.89.2)(terser@5.43.1)(tsx@4.20.3)(yaml@2.8.0) transitivePeerDependencies: - supports-color - typescript @@ -24006,6 +24046,24 @@ snapshots: tsx: 4.20.3 yaml: 2.8.0 + vite@7.0.5(@types/node@24.0.10)(jiti@2.4.2)(lightningcss@1.30.1)(sass@1.89.2)(terser@5.43.1)(tsx@4.20.3)(yaml@2.8.0): + dependencies: + esbuild: 0.25.5 + fdir: 6.4.6(picomatch@4.0.2) + picomatch: 4.0.2 + postcss: 8.5.6 + rollup: 4.44.2 + tinyglobby: 0.2.14 + optionalDependencies: + '@types/node': 24.0.10 + fsevents: 2.3.3 + jiti: 2.4.2 + lightningcss: 1.30.1 + sass: 1.89.2 + terser: 5.43.1 + tsx: 4.20.3 + yaml: 2.8.0 + vitest@3.2.4(@edge-runtime/vm@3.2.0)(@types/debug@4.1.12)(@types/node@20.19.4)(@vitest/ui@3.2.4)(jiti@2.4.2)(jsdom@26.1.0)(lightningcss@1.30.1)(msw@2.10.4(@types/node@20.19.4)(typescript@5.8.3))(sass@1.89.2)(terser@5.43.1)(tsx@4.20.3)(yaml@2.8.0): dependencies: '@types/chai': 5.2.2