Files
vercel-labs__json-render/vitest.config.mts
T
maxffarrell 40892a6af0 feat: shadcn-svelte renderer (#227)
* init

* fix: resolve all type errors, runtime bugs, and test failures in @json-render/shadcn-svelte

- Add /index.js extensions to all ../ui/* imports (NodeNext moduleResolution)
- Type shadcnComponents as Record<string, Component<any>> to fix d.ts generation
- Call getBoundProp() once at top level instead of inside a binding() function
  called from event handlers (getContext() only works during initialization)
- Move getOptionalValidationContext() call to top level; update createValidation()
  to accept the context as first param instead of calling getContext() itself
- Wrap validation.register() in untrack() to break the fieldConfigs read-write
  cycle that caused effect_update_depth_exceeded in tests
- Fix implicit any on Input onkeydown handler (KeyboardEvent type)
- Use untrack() for $state() initializers that read reactive props values
- Call getStateValue() once at top level in Dialog/Drawer (not in a function
  called from event handlers)
- Fix test fixtures: use named imports { StateProvider, ValidationProvider }
- Add server.deps.inline for bits-ui and @lucide/svelte so vitest can process
  their .svelte source files; add root svelte.config.js with runes: true
- Add role/aria-modal/tabindex/onkeydown a11y attributes to Dialog and Drawer
- Fix self-closing non-void elements in Skeleton, Spinner, Textarea

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* update shadcn-svelte components

* fixes

* fixes

* fix: address PR review issues for shadcn-svelte renderer

- Fix missing comma in .changeset/config.json (invalid JSON)
- Fix Slider.svelte type errors (single-mode expects number, not array)
- Replace raw <button> with shadcn Button in Pagination.svelte
- Remove global font import and body/html overrides from app.css
- Remove root svelte.config.js (duplicates package-level config)
- Revert unrelated packageManager version bump

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 10:38:11 -05:00

51 lines
1.7 KiB
TypeScript

import { defineConfig } from "vitest/config";
import path from "path";
import { fileURLToPath } from "url";
import { svelte } from "@sveltejs/vite-plugin-svelte";
import solid from "vite-plugin-solid";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default defineConfig({
plugins: [
svelte({
hot: false,
compilerOptions: { runes: true },
// Also transform bits-ui and vaul-svelte .svelte files so getContext works in tests
include: ["**/*.svelte", "**/bits-ui/**/*.svelte", "**/vaul-svelte/**/*.svelte"],
}),
solid({
// Only transform files in the solid package to avoid interfering with React JSX
include: ["packages/solid/**/*.{ts,tsx}"],
}),
],
resolve: {
// Ensure Svelte resolves to browser bundle, not server
conditions: ["browser"],
// Deduplicate React, Vue, and Solid so tests don't get two copies
// (pnpm strict resolution can cause packages to resolve different copies)
alias: {
react: path.resolve(__dirname, "node_modules/react"),
"react-dom": path.resolve(__dirname, "node_modules/react-dom"),
vue: path.resolve(__dirname, "packages/vue/node_modules/vue"),
"solid-js": path.resolve(__dirname, "node_modules/solid-js"),
},
},
test: {
globals: true,
environment: "jsdom",
include: ["packages/**/*.test.ts", "packages/**/*.test.tsx"],
server: {
deps: {
inline: [/bits-ui/, /runed/, /vaul-svelte/, /@lucide\/svelte/],
},
},
coverage: {
provider: "v8",
reporter: ["text", "json", "html"],
include: ["packages/*/src/**/*.{ts,tsx,svelte}"],
exclude: ["**/*.test.{ts,tsx}", "**/index.ts"],
},
},
});