// @effect-diagnostics nodeBuiltinImport:off - Config load checks the debt-ceiling files exist before any Effect runtime exists. import "vite-plus/test/config"; import { defineConfig } from "vite-plus"; import * as NodeFS from "node:fs"; import * as NodeURL from "node:url"; import { remoteCacheUrl } from "./infra/task-cache/src/remoteCache.ts"; import { cachedTestTasks } from "./scripts/lib/cached-tests.ts"; const TEST_EXCLUDE = [ "**/.repos/**", "**/.t3/**", "**/node_modules/**", "**/dist/**", "**/dist-electron/**", "**/.{idea,git,cache,output,temp}/**", ]; // Directories whose tests belong to a package's own test config. desktop also // owns the kde-snap-shot tests through its `include`. const TEST_CONFIG_PACKAGES = [ "apps/desktop", "apps/mobile", "apps/server", "apps/web", "packages/client-runtime", ]; // `vp test run ` from the repo root hands each file to its package's // config. Packages that borrow this config (`--config ../../vite.config.ts`) run // from their own directory, as CI does, so they keep one plain project. const isRepoRootTestRun = process.cwd() === import.meta.dirname; /** Debt ceilings for files that still exist, so a branch deleting a file can't break the config. */ const existingCeilings = (ceilings: Record) => Object.entries(ceilings).filter(([file]) => NodeFS.existsSync(NodeURL.fileURLToPath(new URL(file, import.meta.url))), ); const RESTRICTED_IMPORT_PATHS = [ { name: "@t3tools/client-runtime", message: "Import from an explicit @t3tools/client-runtime/* subpath. The package has no root export.", }, { name: "@pierre/diffs/react", importNames: ["CodeView"], message: "Use StyledDiffCodeView so web diff surfaces share styling and virtualized geometry.", }, { name: "react-native-screens", importNames: ["ScrollViewMarker"], message: "Use NativeScrollViewMarker or NativeScrollView (src/native/NativeScrollViewMarker.tsx): they carry the header's scroll-edge blur under the Duo's vertical bar.", }, ]; const RESTRICTED_UI_VARIANT_PATTERNS = [ { group: ["**/components/ui/*", "**/ui/*", "./ui/*"], importNames: ["buttonVariants", "toggleVariants", "badgeVariants", "selectTriggerVariants"], message: "Render the components/ui export instead of borrowing its class recipe (render={