From 27ac382bf968f7faa7d7b60706de66095ed32435 Mon Sep 17 00:00:00 2001 From: zernonia Date: Tue, 19 Sep 2023 00:30:11 +0800 Subject: [PATCH] fix: nuxt config --- packages/cli/src/commands/add.ts | 28 +++---- packages/cli/src/commands/init.ts | 3 +- packages/cli/src/utils/get-config.ts | 2 +- packages/cli/src/utils/templates.ts | 2 +- .../utils/transformers/transform-import.ts | 6 +- packages/cli/test/fixtures/nuxt/app.vue | 25 +++++- .../fixtures/nuxt/assets/css/tailwind.css | 77 ++++++++++++++++++- .../cli/test/fixtures/nuxt/components.json | 15 ++++ .../ui/alert-dialog/AlertDialog.vue | 16 ++++ .../ui/alert-dialog/AlertDialogAction.vue | 13 ++++ .../ui/alert-dialog/AlertDialogCancel.vue | 13 ++++ .../ui/alert-dialog/AlertDialogContent.vue | 35 +++++++++ .../alert-dialog/AlertDialogDescription.vue | 18 +++++ .../ui/alert-dialog/AlertDialogFooter.vue | 23 ++++++ .../ui/alert-dialog/AlertDialogHeader.vue | 18 +++++ .../ui/alert-dialog/AlertDialogTitle.vue | 15 ++++ .../ui/alert-dialog/AlertDialogTrigger.vue | 11 +++ .../nuxt/components/ui/alert-dialog/index.ts | 9 +++ .../nuxt/components/ui/button/Button.vue | 23 ++++++ .../nuxt/components/ui/button/index.ts | 32 ++++++++ packages/cli/test/fixtures/nuxt/lib/utils.ts | 26 +++++++ .../cli/test/fixtures/nuxt/nuxt.config.ts | 8 ++ packages/cli/test/fixtures/nuxt/package.json | 8 ++ .../cli/test/fixtures/nuxt/tailwind.config.js | 70 +++++++++++++++++ .../cli/test/utils/transform-import.test.ts | 12 +-- pnpm-lock.yaml | 49 ++++++++++-- 26 files changed, 523 insertions(+), 34 deletions(-) create mode 100644 packages/cli/test/fixtures/nuxt/components.json create mode 100644 packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialog.vue create mode 100644 packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogAction.vue create mode 100644 packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogCancel.vue create mode 100644 packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogContent.vue create mode 100644 packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogDescription.vue create mode 100644 packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogFooter.vue create mode 100644 packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogHeader.vue create mode 100644 packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogTitle.vue create mode 100644 packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogTrigger.vue create mode 100644 packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/index.ts create mode 100644 packages/cli/test/fixtures/nuxt/components/ui/button/Button.vue create mode 100644 packages/cli/test/fixtures/nuxt/components/ui/button/index.ts create mode 100644 packages/cli/test/fixtures/nuxt/lib/utils.ts create mode 100644 packages/cli/test/fixtures/nuxt/tailwind.config.js diff --git a/packages/cli/src/commands/add.ts b/packages/cli/src/commands/add.ts index 98cda4ea..a549a7b4 100644 --- a/packages/cli/src/commands/add.ts +++ b/packages/cli/src/commands/add.ts @@ -7,8 +7,7 @@ import { execa } from 'execa' import ora from 'ora' import prompts from 'prompts' import * as z from 'zod' -import { transformImport } from '../utils/transformers/transform-import' -import { transformSFC } from '../utils/transformers/transform-sfc' +import { transform } from '@/src/utils/transformers' import { getConfig } from '@/src/utils/get-config' import { getPackageManager } from '@/src/utils/get-package-manager' import { handleError } from '@/src/utils/handle-error' @@ -130,15 +129,11 @@ export const add = new Command() if (existingComponent.length && !options.overwrite) { if (selectedComponents.includes(item.name)) { logger.warn( - `\nComponent ${ - item.name - } already exists. Use ${chalk.green( - '--overwrite', - )} to overwrite.`, + `Component ${item.name} already exists. Use ${chalk.green( + '--overwrite', + )} to overwrite.`, ) - spinner.stop() - process.exitCode = 1 - return + process.exit(1) } continue @@ -152,14 +147,19 @@ export const add = new Command() file.name, ) - // Run transformers. - const content = await transformSFC(file, config) + if (!config.typescript) + filePath = filePath.replace(/\.ts$/, '.js') if (!existsSync(componentDir)) await fs.mkdir(componentDir, { recursive: true }) - if (!config.typescript) - filePath = filePath.replace(/\.ts$/, '.js') + // Run transformers. + const content = await transform({ + filename: file.name, + raw: file.content, + config, + baseColor, + }) await fs.writeFile(filePath, content) } diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.ts index fdb49afb..1ef424ca 100644 --- a/packages/cli/src/commands/init.ts +++ b/packages/cli/src/commands/init.ts @@ -266,9 +266,8 @@ export async function runInit(cwd: string, config: Config) { const dependenciesSpinner = ora('Installing dependencies...')?.start() const packageManager = await getPackageManager(cwd) - // TODO: add support for other icon libraries. const deps = PROJECT_DEPENDENCIES.base.concat( - config.framework === 'nuxt' ? PROJECT_DEPENDENCIES.nuxt : PROJECT_DEPENDENCIES.vue, + config.framework === 'nuxt' ? PROJECT_DEPENDENCIES.nuxt : [], ).concat( config.style === 'new-york' ? [] : ['lucide-vue-next'], ).filter(Boolean) diff --git a/packages/cli/src/utils/get-config.ts b/packages/cli/src/utils/get-config.ts index adc2685c..53f5637a 100644 --- a/packages/cli/src/utils/get-config.ts +++ b/packages/cli/src/utils/get-config.ts @@ -10,7 +10,7 @@ export const DEFAULT_STYLE = 'default' export const DEFAULT_COMPONENTS = '@/components' export const DEFAULT_UTILS = '@/lib/utils' export const DEFAULT_TAILWIND_CSS = 'src/assets/index.css' -export const DEFAULT_TAILWIND_CSS_NUXT = 'assets/style/tailwind.css' +export const DEFAULT_TAILWIND_CSS_NUXT = 'assets/css/tailwind.css' export const DEFAULT_TAILWIND_CONFIG = 'tailwind.config.js' export const DEFAULT_TAILWIND_BASE_COLOR = 'slate' diff --git a/packages/cli/src/utils/templates.ts b/packages/cli/src/utils/templates.ts index fa74ccbe..8d6636d1 100644 --- a/packages/cli/src/utils/templates.ts +++ b/packages/cli/src/utils/templates.ts @@ -15,7 +15,7 @@ export function useEmitAsProps( const result: Record = {} if (!events?.length) { console.warn( - 'No emitted event found. Please check component: \${vm?.type.__name}', + \`No emitted event found. Please check component: \${vm?.type.__name}\`, ) } diff --git a/packages/cli/src/utils/transformers/transform-import.ts b/packages/cli/src/utils/transformers/transform-import.ts index ac8b78d3..d5610361 100644 --- a/packages/cli/src/utils/transformers/transform-import.ts +++ b/packages/cli/src/utils/transformers/transform-import.ts @@ -6,11 +6,11 @@ export const transformImport: Transformer = async ({ sourceFile, config }) => { for (const importDeclaration of importDeclarations) { const moduleSpecifier = importDeclaration.getModuleSpecifierValue() - // Replace @/registry/[style] with the components alias. - if (moduleSpecifier.startsWith('@/registry/')) { + // Replace @/lib/registry/[style] with the components alias. + if (moduleSpecifier.startsWith('@/lib/registry/')) { importDeclaration.setModuleSpecifier( moduleSpecifier.replace( - /^@\/registry\/[^/]+/, + /^@\/lib\/registry\/[^/]+/, config.aliases.components, ), ) diff --git a/packages/cli/test/fixtures/nuxt/app.vue b/packages/cli/test/fixtures/nuxt/app.vue index a495b757..9a21babb 100644 --- a/packages/cli/test/fixtures/nuxt/app.vue +++ b/packages/cli/test/fixtures/nuxt/app.vue @@ -1,5 +1,28 @@ diff --git a/packages/cli/test/fixtures/nuxt/assets/css/tailwind.css b/packages/cli/test/fixtures/nuxt/assets/css/tailwind.css index bd6213e1..10b7e9cd 100644 --- a/packages/cli/test/fixtures/nuxt/assets/css/tailwind.css +++ b/packages/cli/test/fixtures/nuxt/assets/css/tailwind.css @@ -1,3 +1,78 @@ @tailwind base; @tailwind components; -@tailwind utilities; \ No newline at end of file +@tailwind utilities; + +@layer base { + :root { + --background: 0 0% 100%; + --foreground: 222.2 84% 4.9%; + + --muted: 210 40% 96.1%; + --muted-foreground: 215.4 16.3% 46.9%; + + --popover: 0 0% 100%; + --popover-foreground: 222.2 84% 4.9%; + + --card: 0 0% 100%; + --card-foreground: 222.2 84% 4.9%; + + --border: 214.3 31.8% 91.4%; + --input: 214.3 31.8% 91.4%; + + --primary: 222.2 47.4% 11.2%; + --primary-foreground: 210 40% 98%; + + --secondary: 210 40% 96.1%; + --secondary-foreground: 222.2 47.4% 11.2%; + + --accent: 210 40% 96.1%; + --accent-foreground: 222.2 47.4% 11.2%; + + --destructive: 0 84.2% 60.2%; + --destructive-foreground: 210 40% 98%; + + --ring: 222.2 84% 4.9%; + + --radius: 0.5rem; + } + + .dark { + --background: 222.2 84% 4.9%; + --foreground: 210 40% 98%; + + --muted: 217.2 32.6% 17.5%; + --muted-foreground: 215 20.2% 65.1%; + + --popover: 222.2 84% 4.9%; + --popover-foreground: 210 40% 98%; + + --card: 222.2 84% 4.9%; + --card-foreground: 210 40% 98%; + + --border: 217.2 32.6% 17.5%; + --input: 217.2 32.6% 17.5%; + + --primary: 210 40% 98%; + --primary-foreground: 222.2 47.4% 11.2%; + + --secondary: 217.2 32.6% 17.5%; + --secondary-foreground: 210 40% 98%; + + --accent: 217.2 32.6% 17.5%; + --accent-foreground: 210 40% 98%; + + --destructive: 0 62.8% 30.6%; + --destructive-foreground: 210 40% 98%; + + --ring: 212.7 26.8% 83.9%; + } +} + +@layer base { + * { + @apply border-border; + } + body { + @apply bg-background text-foreground; + } +} \ No newline at end of file diff --git a/packages/cli/test/fixtures/nuxt/components.json b/packages/cli/test/fixtures/nuxt/components.json new file mode 100644 index 00000000..bc7b4a3f --- /dev/null +++ b/packages/cli/test/fixtures/nuxt/components.json @@ -0,0 +1,15 @@ +{ + "style": "default", + "typescript": true, + "tailwind": { + "config": "tailwind.config.js", + "css": "assets/css/tailwind.css", + "baseColor": "slate", + "cssVariables": true + }, + "framework": "nuxt", + "aliases": { + "components": "@/components", + "utils": "@/lib/utils" + } +} diff --git a/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialog.vue b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialog.vue new file mode 100644 index 00000000..b7eda12b --- /dev/null +++ b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialog.vue @@ -0,0 +1,16 @@ + + + diff --git a/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogAction.vue b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogAction.vue new file mode 100644 index 00000000..f82508fc --- /dev/null +++ b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogAction.vue @@ -0,0 +1,13 @@ + + + diff --git a/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogCancel.vue b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogCancel.vue new file mode 100644 index 00000000..bbbd5a31 --- /dev/null +++ b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogCancel.vue @@ -0,0 +1,13 @@ + + + diff --git a/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogContent.vue b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogContent.vue new file mode 100644 index 00000000..fde4167f --- /dev/null +++ b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogContent.vue @@ -0,0 +1,35 @@ + + + diff --git a/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogDescription.vue b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogDescription.vue new file mode 100644 index 00000000..7ff155e6 --- /dev/null +++ b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogDescription.vue @@ -0,0 +1,18 @@ + + + diff --git a/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogFooter.vue b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogFooter.vue new file mode 100644 index 00000000..de4af93b --- /dev/null +++ b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogFooter.vue @@ -0,0 +1,23 @@ + + + diff --git a/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogHeader.vue b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogHeader.vue new file mode 100644 index 00000000..a350b718 --- /dev/null +++ b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogHeader.vue @@ -0,0 +1,18 @@ + + + diff --git a/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogTitle.vue b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogTitle.vue new file mode 100644 index 00000000..9b6491f2 --- /dev/null +++ b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogTitle.vue @@ -0,0 +1,15 @@ + + + diff --git a/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogTrigger.vue b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogTrigger.vue new file mode 100644 index 00000000..4f5e2fd0 --- /dev/null +++ b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogTrigger.vue @@ -0,0 +1,11 @@ + + + diff --git a/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/index.ts b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/index.ts new file mode 100644 index 00000000..91d138ae --- /dev/null +++ b/packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/index.ts @@ -0,0 +1,9 @@ +export { default as AlertDialog } from './AlertDialog.vue' +export { default as AlertDialogTrigger } from './AlertDialogTrigger.vue' +export { default as AlertDialogContent } from './AlertDialogContent.vue' +export { default as AlertDialogHeader } from './AlertDialogHeader.vue' +export { default as AlertDialogTitle } from './AlertDialogTitle.vue' +export { default as AlertDialogDescription } from './AlertDialogDescription.vue' +export { default as AlertDialogFooter } from './AlertDialogFooter.vue' +export { default as AlertDialogAction } from './AlertDialogAction.vue' +export { default as AlertDialogCancel } from './AlertDialogCancel.vue' diff --git a/packages/cli/test/fixtures/nuxt/components/ui/button/Button.vue b/packages/cli/test/fixtures/nuxt/components/ui/button/Button.vue new file mode 100644 index 00000000..d721b1ab --- /dev/null +++ b/packages/cli/test/fixtures/nuxt/components/ui/button/Button.vue @@ -0,0 +1,23 @@ + + + diff --git a/packages/cli/test/fixtures/nuxt/components/ui/button/index.ts b/packages/cli/test/fixtures/nuxt/components/ui/button/index.ts new file mode 100644 index 00000000..382c4f4f --- /dev/null +++ b/packages/cli/test/fixtures/nuxt/components/ui/button/index.ts @@ -0,0 +1,32 @@ +import { cva } from 'class-variance-authority' + +export { default as Button } from './Button.vue' + +export const buttonVariants = cva( + 'inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', + { + variants: { + variant: { + default: 'bg-primary text-primary-foreground hover:bg-primary/90', + destructive: + 'bg-destructive text-destructive-foreground hover:bg-destructive/90', + outline: + 'border border-input bg-background hover:bg-accent hover:text-accent-foreground', + secondary: + 'bg-secondary text-secondary-foreground hover:bg-secondary/80', + ghost: 'hover:bg-accent hover:text-accent-foreground', + link: 'text-primary underline-offset-4 hover:underline', + }, + size: { + default: 'h-10 px-4 py-2', + sm: 'h-9 rounded-md px-3', + lg: 'h-11 rounded-md px-8', + icon: 'h-10 w-10', + }, + }, + defaultVariants: { + variant: 'default', + size: 'default', + }, + }, +) diff --git a/packages/cli/test/fixtures/nuxt/lib/utils.ts b/packages/cli/test/fixtures/nuxt/lib/utils.ts new file mode 100644 index 00000000..b5f0e3c1 --- /dev/null +++ b/packages/cli/test/fixtures/nuxt/lib/utils.ts @@ -0,0 +1,26 @@ +import { type ClassValue, clsx } from 'clsx' +import { twMerge } from 'tailwind-merge' +import { camelize, getCurrentInstance, toHandlerKey } from 'vue' + +export function cn(...inputs: ClassValue[]) { + return twMerge(clsx(inputs)) +} + +export function useEmitAsProps( + emit: (name: Name, ...args: any[]) => void, +) { + const vm = getCurrentInstance() + + const events = vm?.type.emits as Name[] + const result: Record = {} + if (!events?.length) { + console.warn( + `No emitted event found. Please check component: ${vm?.type.__name}`, + ) + } + + events?.forEach((ev) => { + result[toHandlerKey(camelize(ev))] = (...arg: any) => emit(ev, ...arg) + }) + return result +} diff --git a/packages/cli/test/fixtures/nuxt/nuxt.config.ts b/packages/cli/test/fixtures/nuxt/nuxt.config.ts index 9d825c49..c3288b5f 100644 --- a/packages/cli/test/fixtures/nuxt/nuxt.config.ts +++ b/packages/cli/test/fixtures/nuxt/nuxt.config.ts @@ -1,4 +1,12 @@ // https://nuxt.com/docs/api/configuration/nuxt-config export default defineNuxtConfig({ devtools: { enabled: true }, + modules: ['@nuxtjs/tailwindcss'], + components: [ + { + path: '~/components/ui', + extensions: ['.vue'], + prefix: 'Ui', + }, + ], }) diff --git a/packages/cli/test/fixtures/nuxt/package.json b/packages/cli/test/fixtures/nuxt/package.json index 881519a9..cbb358a1 100644 --- a/packages/cli/test/fixtures/nuxt/package.json +++ b/packages/cli/test/fixtures/nuxt/package.json @@ -9,6 +9,14 @@ "preview": "nuxt preview", "postinstall": "nuxt prepare" }, + "dependencies": { + "class-variance-authority": "^0.7.0", + "clsx": "^2.0.0", + "lucide-vue-next": "^0.276.0", + "radix-vue": "^0.2.2", + "tailwind-merge": "^1.14.0", + "tailwindcss-animate": "^1.0.7" + }, "devDependencies": { "@nuxt/devtools": "latest", "@nuxtjs/tailwindcss": "^6.8.0", diff --git a/packages/cli/test/fixtures/nuxt/tailwind.config.js b/packages/cli/test/fixtures/nuxt/tailwind.config.js new file mode 100644 index 00000000..62653c7b --- /dev/null +++ b/packages/cli/test/fixtures/nuxt/tailwind.config.js @@ -0,0 +1,70 @@ +/** @type {import('tailwindcss').Config} */ +module.exports = { + darkMode: ['class'], + theme: { + container: { + center: true, + padding: '2rem', + screens: { + '2xl': '1400px', + }, + }, + extend: { + colors: { + border: 'hsl(var(--border))', + input: 'hsl(var(--input))', + ring: 'hsl(var(--ring))', + background: 'hsl(var(--background))', + foreground: 'hsl(var(--foreground))', + primary: { + DEFAULT: 'hsl(var(--primary))', + foreground: 'hsl(var(--primary-foreground))', + }, + secondary: { + DEFAULT: 'hsl(var(--secondary))', + foreground: 'hsl(var(--secondary-foreground))', + }, + destructive: { + DEFAULT: 'hsl(var(--destructive))', + foreground: 'hsl(var(--destructive-foreground))', + }, + muted: { + DEFAULT: 'hsl(var(--muted))', + foreground: 'hsl(var(--muted-foreground))', + }, + accent: { + DEFAULT: 'hsl(var(--accent))', + foreground: 'hsl(var(--accent-foreground))', + }, + popover: { + DEFAULT: 'hsl(var(--popover))', + foreground: 'hsl(var(--popover-foreground))', + }, + card: { + DEFAULT: 'hsl(var(--card))', + foreground: 'hsl(var(--card-foreground))', + }, + }, + borderRadius: { + lg: 'var(--radius)', + md: 'calc(var(--radius) - 2px)', + sm: 'calc(var(--radius) - 4px)', + }, + keyframes: { + 'accordion-down': { + from: { height: 0 }, + to: { height: 'var(--radix-accordion-content-height)' }, + }, + 'accordion-up': { + from: { height: 'var(--radix-accordion-content-height)' }, + to: { height: 0 }, + }, + }, + animation: { + 'accordion-down': 'accordion-down 0.2s ease-out', + 'accordion-up': 'accordion-up 0.2s ease-out', + }, + }, + }, + plugins: [require('tailwindcss-animate')], +} diff --git a/packages/cli/test/utils/transform-import.test.ts b/packages/cli/test/utils/transform-import.test.ts index 3a62074d..3107631e 100644 --- a/packages/cli/test/utils/transform-import.test.ts +++ b/packages/cli/test/utils/transform-import.test.ts @@ -6,9 +6,9 @@ test('transform import', async () => { await transform({ filename: 'app.vue', raw: `import { Foo } from "bar" - import { Button } from "@/registry/new-york/ui/button" + import { Button } from "@/lib/registry/new-york/ui/button" import { Label} from "ui/label" - import { Box } from "@/registry/new-york/box" + import { Box } from "@/lib/registry/new-york/box" import { cn } from "@/lib/utils" `, @@ -29,9 +29,9 @@ test('transform import', async () => { await transform({ filename: 'app.vue', raw: `import { Foo } from "bar" - import { Button } from "@/registry/new-york/ui/button" + import { Button } from "@/lib/registry/new-york/ui/button" import { Label} from "ui/label" - import { Box } from "@/registry/new-york/box" + import { Box } from "@/lib/registry/new-york/box" import { cn, foo, bar } from "@/lib/utils" import { bar } from "@/lib/utils/bar" @@ -49,9 +49,9 @@ test('transform import', async () => { await transform({ filename: 'app.vue', raw: `import { Foo } from "bar" - import { Button } from "@/registry/new-york/ui/button" + import { Button } from "@/lib/registry/new-york/ui/button" import { Label} from "ui/label" - import { Box } from "@/registry/new-york/box" + import { Box } from "@/lib/registry/new-york/box" import { cn } from "@/lib/utils" import { bar } from "@/lib/utils/bar" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e564618e..b5718818 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -252,6 +252,25 @@ importers: version: 5.2.2 packages/cli/test/fixtures/nuxt: + dependencies: + class-variance-authority: + specifier: ^0.7.0 + version: 0.7.0 + clsx: + specifier: ^2.0.0 + version: 2.0.0 + lucide-vue-next: + specifier: ^0.276.0 + version: 0.276.0(vue@3.3.4) + radix-vue: + specifier: ^0.2.2 + version: 0.2.2(vue@3.3.4) + tailwind-merge: + specifier: ^1.14.0 + version: 1.14.0 + tailwindcss-animate: + specifier: ^1.0.7 + version: 1.0.7(tailwindcss@3.3.3) devDependencies: '@nuxt/devtools': specifier: latest @@ -1072,6 +1091,7 @@ packages: engines: {node: '>=12'} dependencies: '@jridgewell/trace-mapping': 0.3.9 + dev: true /@csstools/cascade-layer-name-parser@1.0.4(@csstools/css-parser-algorithms@2.3.1)(@csstools/css-tokenizer@2.2.0): resolution: {integrity: sha512-zXMGsJetbLoXe+gjEES07MEGjL0Uy3hMxmnGtVBrRpVKr5KV9OgCB09zr/vLrsEtoVQTgJFewxaU8IYSAE4tjg==} @@ -1840,6 +1860,7 @@ packages: dependencies: '@jridgewell/resolve-uri': 3.1.0 '@jridgewell/sourcemap-codec': 1.4.15 + dev: true /@juggle/resize-observer@3.4.0: resolution: {integrity: sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA==} @@ -2534,6 +2555,7 @@ packages: dependencies: is-glob: 4.0.3 micromatch: 4.0.5 + napi-wasm: 1.1.0 dev: true bundledDependencies: - napi-wasm @@ -2857,15 +2879,19 @@ packages: /@tsconfig/node10@1.0.9: resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==} + dev: true /@tsconfig/node12@1.0.11: resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} + dev: true /@tsconfig/node14@1.0.3: resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} + dev: true /@tsconfig/node16@1.0.4: resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} + dev: true /@tufjs/canonical-json@1.0.0: resolution: {integrity: sha512-QTnf++uxunWvG2z3UFNzAoQPHxnSXOwtaI3iJ+AohhV+5vONuArPjJE7aPXPVXfXJsqrVbZBu9b81AJoSd09IQ==} @@ -3218,6 +3244,7 @@ packages: /@types/node@20.4.7: resolution: {integrity: sha512-bUBrPjEry2QUTsnuEjzjbS7voGWCc30W0qzgMf90GPeDGFRakvrz47ju+oqDAKCXLUCe39u57/ORMl/O/04/9g==} + dev: true /@types/node@20.6.0: resolution: {integrity: sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg==} @@ -4103,6 +4130,7 @@ packages: /acorn-walk@8.2.0: resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==} engines: {node: '>=0.4.0'} + dev: true /acorn@8.10.0: resolution: {integrity: sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==} @@ -4309,6 +4337,7 @@ packages: /arg@4.1.3: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} + dev: true /arg@5.0.2: resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==} @@ -5107,6 +5136,7 @@ packages: /create-require@1.1.1: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} + dev: true /cross-spawn@7.0.3: resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} @@ -5777,6 +5807,7 @@ packages: /diff@4.0.2: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} engines: {node: '>=0.3.1'} + dev: true /diff@5.1.0: resolution: {integrity: sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==} @@ -7282,6 +7313,7 @@ packages: /iconv-lite@0.6.3: resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} engines: {node: '>=0.10.0'} + requiresBuild: true dependencies: safer-buffer: 2.1.2 @@ -8212,6 +8244,7 @@ packages: /make-error@1.3.6: resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} + dev: true /make-fetch-happen@11.1.1: resolution: {integrity: sha512-rLWS7GCSTcEujjVBs2YqG7Y4643u8ucvCJeSRqiLYhesrDuzeuFIk37xREzAsfQaqzl8b9rNCE4m6J8tvX4Q8w==} @@ -8617,6 +8650,10 @@ packages: hasBin: true dev: true + /napi-wasm@1.1.0: + resolution: {integrity: sha512-lHwIAJbmLSjF9VDRm9GoVOy9AGp3aIvkjv+Kvz9h16QR3uSVYH78PNQUnT2U4X53mhlnV2M7wrhibQ3GHicDmg==} + dev: true + /natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: true @@ -9672,7 +9709,6 @@ packages: lilconfig: 2.1.0 postcss: 8.4.28 yaml: 2.3.1 - dev: true /postcss-load-config@4.0.1(postcss@8.4.28)(ts-node@10.9.1): resolution: {integrity: sha512-vEJIc8RdiBRu3oRAI0ymerOn+7rPuMvRXslTvZUKZonDHFIczxztIyJ1urxM1x9JXEikvpWWTUUqal5j/8QgvA==} @@ -9690,6 +9726,7 @@ packages: postcss: 8.4.28 ts-node: 10.9.1(@types/node@20.4.7)(typescript@5.2.2) yaml: 2.3.1 + dev: true /postcss-loader@4.3.0(postcss@8.4.28)(webpack@5.88.2): resolution: {integrity: sha512-M/dSoIiNDOo8Rk0mUqoj4kpGq91gcxCfb9PoyZVdZ76/AuhxylHDYZblNE8o+EQ9AMSASeMFEKxZf5aU6wlx1Q==} @@ -10146,7 +10183,6 @@ packages: transitivePeerDependencies: - '@vue/composition-api' - vue - dev: true /radix3@1.1.0: resolution: {integrity: sha512-pNsHDxbGORSvuSScqNJ+3Km6QAVqk8CfsCBIEoDgpqLrkD2f3QM4I7d1ozJJ172OmIcoUcerZaNWqtLkRXTV3A==} @@ -10493,6 +10529,7 @@ packages: /safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + requiresBuild: true /schema-utils@3.3.0: resolution: {integrity: sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==} @@ -11076,14 +11113,13 @@ packages: /tailwind-merge@1.14.0: resolution: {integrity: sha512-3mFKyCo/MBcgyOTlrY8T7odzZFx+w+qKSMAmdFzRvqBfLlSigU6TZnlFHK0lkMwj9Bj8OYU+9yW9lmGuS0QEnQ==} - dev: true /tailwindcss-animate@1.0.7(tailwindcss@3.3.3): resolution: {integrity: sha512-bl6mpH3T7I3UFxuvDEXLxy/VuFxBk5bbzplh7tXI68mwMokNYd1t9qPBHlnyTwfa4JGC4zP516I1hYYtQ/vspA==} peerDependencies: tailwindcss: '>=3.0.0 || insiders' dependencies: - tailwindcss: 3.3.3(ts-node@10.9.1) + tailwindcss: 3.3.3 dev: false /tailwindcss@3.3.3: @@ -11115,7 +11151,6 @@ packages: sucrase: 3.34.0 transitivePeerDependencies: - ts-node - dev: true /tailwindcss@3.3.3(ts-node@10.9.1): resolution: {integrity: sha512-A0KgSkef7eE4Mf+nKJ83i75TMyq8HqY3qmFIJSWy8bNt0v1lG7jUcpGpoTFxAwYcWOphcTBLPPJg+bDfhDf52w==} @@ -11146,6 +11181,7 @@ packages: sucrase: 3.34.0 transitivePeerDependencies: - ts-node + dev: true /tapable@1.1.3: resolution: {integrity: sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==} @@ -11395,6 +11431,7 @@ packages: typescript: 5.2.2 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 + dev: true /tsconfck@2.1.2(typescript@5.2.2): resolution: {integrity: sha512-ghqN1b0puy3MhhviwO2kGF8SeMDNhEbnKxjK7h6+fvY9JAxqvXi8y5NAHSQv687OVboS2uZIByzGd45/YxrRHg==} @@ -11938,6 +11975,7 @@ packages: /v8-compile-cache-lib@3.0.1: resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} + dev: true /validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} @@ -12720,6 +12758,7 @@ packages: /yn@3.1.1: resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} engines: {node: '>=6'} + dev: true /yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}