From a817cfbe09b76e67bfc98799cac5b3e485130d4c Mon Sep 17 00:00:00 2001 From: Aidan Bleser <117548273+ieedan@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:01:56 -0600 Subject: [PATCH] fix(next): ensure registry:ui components don't depend on themselves (#1490) Co-authored-by: AdrianGonz97 <31664583+AdrianGonz97@users.noreply.github.com> fixes #1489 --- sites/docs/scripts/build-registry.ts | 9 +++++++++ .../registry/default/ui/data-table/flex-render.svelte | 5 +---- .../default/ui/toggle-group/toggle-group-item.svelte | 2 +- .../registry/new-york/ui/data-table/flex-render.svelte | 5 +---- .../registry/new-york/ui/select/select-content.svelte | 2 +- .../new-york/ui/toggle-group/toggle-group-item.svelte | 2 +- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/sites/docs/scripts/build-registry.ts b/sites/docs/scripts/build-registry.ts index 0ec0ce540..a35bd5410 100644 --- a/sites/docs/scripts/build-registry.ts +++ b/sites/docs/scripts/build-registry.ts @@ -39,6 +39,15 @@ function writeFileWithDirs( async function main() { const registry = await buildRegistry(); + + const selfReferenced = registry.filter((item) => item.registryDependencies.includes(item.name)); + const selfReferenceError = selfReferenced + .map((item) => `Registry item '${item.name}' depends on itself`) + .join("\n"); + if (selfReferenceError) { + throw new Error(selfReferenceError); + } + const result = registrySchema.safeParse(registry); if (!result.success) { diff --git a/sites/docs/src/lib/registry/default/ui/data-table/flex-render.svelte b/sites/docs/src/lib/registry/default/ui/data-table/flex-render.svelte index ef1a240dd..de3563f0e 100644 --- a/sites/docs/src/lib/registry/default/ui/data-table/flex-render.svelte +++ b/sites/docs/src/lib/registry/default/ui/data-table/flex-render.svelte @@ -10,10 +10,7 @@ lang="ts" generics="TData, TValue, TContext extends HeaderContext | CellContext" > - import { - RenderComponentConfig, - RenderSnippetConfig, - } from "$lib/registry/default/ui/data-table/render-helpers.js"; + import { RenderComponentConfig, RenderSnippetConfig } from "./render-helpers.js"; type Props = { /** The cell or header field of the current cell's column definition. */ content?: TContext extends HeaderContext diff --git a/sites/docs/src/lib/registry/default/ui/toggle-group/toggle-group-item.svelte b/sites/docs/src/lib/registry/default/ui/toggle-group/toggle-group-item.svelte index 6f63aa5cc..4c36c7aeb 100644 --- a/sites/docs/src/lib/registry/default/ui/toggle-group/toggle-group-item.svelte +++ b/sites/docs/src/lib/registry/default/ui/toggle-group/toggle-group-item.svelte @@ -1,6 +1,6 @@