From 439bc05ae6950f3822d3de5a9458f1efcf72ac3e Mon Sep 17 00:00:00 2001 From: isorex Date: Sat, 22 Nov 2025 13:33:16 +0100 Subject: [PATCH 1/2] feat: add an option to allow external packages to be scanned for Nuxt UI components --- src/plugins/components.ts | 12 +++++++++++- src/unplugin.ts | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/plugins/components.ts b/src/plugins/components.ts index 9295eca8ed..8a82b58bd7 100644 --- a/src/plugins/components.ts +++ b/src/plugins/components.ts @@ -44,10 +44,20 @@ export default function ComponentImportPlugin(options: NuxtUIOptions & { prefix: }) const inertiaOverrideNames = new Set(inertiaOverrides.map(c => `${options.prefix}${c.replace(/\.vue$/, '')}`)) + const allowlist = [ + '@nuxt/ui', + '@compodium/examples', + ...(Array.isArray(options.allowedPackages) ? options.allowedPackages : []) + ] + const allowlistRegexGroup = allowlist.map(pkg => + pkg.replace(/\//g, '\\/') + ).join('|') + const excludeRegex = new RegExp(`[\\\\/]node_modules[\\\\/](?!\\.pnpm|${allowlistRegexGroup})`) + const pluginOptions = defu(options.components, { dts: options.dts ?? true, exclude: [ - /[\\/]node_modules[\\/](?!\.pnpm|@nuxt\/ui|@compodium\/examples)/, + excludeRegex, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/ ], diff --git a/src/unplugin.ts b/src/unplugin.ts index 1e404b20ca..09b825f51c 100644 --- a/src/unplugin.ts +++ b/src/unplugin.ts @@ -55,6 +55,10 @@ export interface NuxtUIOptions extends Omit Date: Sat, 22 Nov 2025 13:39:20 +0100 Subject: [PATCH 2/2] chore: add test snapshots to gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 791af041b7..f790044fc9 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,6 @@ playgrounds/vue/auto-imports.d.ts playgrounds/vue/components.d.ts playgrounds/vue/tsconfig.app.tsbuildinfo playgrounds/vue/tsconfig.node.tsbuildinfo + +# Test snapshots +__snapshots__/