shadcn 2.4.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -24,6 +24,6 @@ ${u}`)}return o.json()})();return A.set(i,n),n}))}catch(t){return m.error(`
|
|
|
24
24
|
`),b(t),[]}}function Ir(){A.clear();}async function et(e,t){try{if(!await Ze())return null;e.includes("index")&&e.unshift("index");let i=await it(e,t),n=await P(i),o=z.array(k).parse(n);if(!o)return null;if(e.includes("index")&&t.tailwind.baseColor){let l=await rt(t.tailwind.baseColor,t);l&&o.unshift(l);}o.sort((l,f)=>l.type==="registry:theme"?-1:1);let c={};o.forEach(l=>{c=v(c,l.tailwind??{});});let g={};o.forEach(l=>{g=v(g,l.cssVars??{});});let u={};o.forEach(l=>{u=v(u,l.css??{});});let w="";return o.forEach(l=>{l.docs&&(w+=`${l.docs}
|
|
25
25
|
`);}),J.parse({dependencies:v.all(o.map(l=>l.dependencies??[])),devDependencies:v.all(o.map(l=>l.devDependencies??[])),files:v.all(o.map(l=>l.files??[])),tailwind:c,cssVars:g,css:u,docs:w})}catch(r){return b(r),null}}async function tt(e,t){let r=new Set,i=[],n=t.resolvedPaths?.cwd?await q(t.resolvedPaths.cwd,t.style):t.style;async function o(c){let g=oe(W(c)?c:`styles/${n}/${c}.json`);if(!r.has(g)){r.add(g);try{let[u]=await P([g]),w=k.parse(u);if(i.push(g),w.registryDependencies)for(let l of w.registryDependencies)await o(l);}catch(u){console.error(`Error fetching or parsing registry item at ${c}:`,u);}}}return await o(e),Array.from(new Set(i))}async function rt(e,t){let[r,i]=await Promise.all([qe(e),H(t)]);if(!r)return null;let n={name:e,type:"registry:theme",tailwind:{config:{theme:{extend:{borderRadius:{lg:"var(--radius)",md:"calc(var(--radius) - 2px)",sm:"calc(var(--radius) - 4px)"},colors:{}}}}},cssVars:{theme:{},light:{radius:"0.5rem"},dark:{}}};return t.tailwind.cssVariables&&(n.tailwind.config.theme.extend.colors={...n.tailwind.config.theme.extend.colors,...se(r.cssVars.dark??{})},n.cssVars={theme:{...r.cssVars.theme,...n.cssVars.theme},light:{...r.cssVars.light,...n.cssVars.light},dark:{...r.cssVars.dark,...n.cssVars.dark}},i==="v4"&&r.cssVarsV4&&(n.cssVars={theme:{...r.cssVarsV4.theme,...n.cssVars.theme},light:{radius:"0.625rem",...r.cssVarsV4.light},dark:{...r.cssVarsV4.dark}})),n}function oe(e){if(W(e)){let t=new URL(e);return t.pathname.match(/\/chat\/b\//)&&!t.pathname.endsWith("/json")&&(t.pathname=`${t.pathname}/json`),t.toString()}return `${Ye}/${e}`}function W(e){try{return new URL(e),!0}catch{return !1}}async function it(e,t){let r=[];for(let i of e){let n=await tt(i,t);r.push(...n);}return Array.from(new Set(r))}function Ar(){return new Map([["registry:ui","ui"],["registry:lib","lib"],["registry:hook","hooks"],["registry:block","components"],["registry:component","components"]])}function Rr(e){let t=new Map;return e.forEach(r=>{r.registryDependencies&&r.registryDependencies.forEach(i=>{t.set(i,r);});}),t}
|
|
26
26
|
|
|
27
|
-
export {
|
|
27
|
+
export { ce as A, k as B, st as C, V as D, M as E, B as F, G, J as H, Qe as I, Ze as J, vr as K, Er as L, Sr as M, Cr as N, qe as O, Xe as P, jr as Q, Lr as R, P as S, Ir as T, et as U, rt as V, W, it as X, Ar as Y, Rr as Z, d as a, x as b, Ft as c, zt as d, Dt as e, _t as f, Q as g, S as h, F as i, Ut as j, je as k, Ie as l, O as m, L as n, Tt as o, H as p, m as q, X as r, b as s, cr as t, te as u, We as v, N as w, ae as x, le as y, R as z };
|
|
28
28
|
//# sourceMappingURL=out.js.map
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
//# sourceMappingURL=chunk-D7IBBDN3.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,74 +1,75 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
2
|
+
import { I, W as W$1, M, q, a, s, n, h, o, r, i, K as K$1, N as N$1, e, f, c, d, g, p, J, C, B, Q as Q$1, O as O$1, R, j, U, t, X, S, Z as Z$1, Y, l, k, u, v, L, m, b } from './chunk-D7IBBDN3.js';
|
|
3
|
+
export { I as BASE_COLORS, T as clearRegistryCache, S as fetchRegistry, Q as fetchTree, R as getItemTargetPath, O as getRegistryBaseColor, N as getRegistryBaseColors, L as getRegistryIcons, J as getRegistryIndex, M as getRegistryItem, Z as getRegistryParentMap, K as getRegistryStyles, Y as getRegistryTypeAliasMap, W as isUrl, V as registryGetTheme, U as registryResolveItemsTree, X as resolveRegistryItems, P as resolveTree } from './chunk-D7IBBDN3.js';
|
|
4
|
+
import * as y from 'path';
|
|
5
|
+
import y__default, { basename } from 'path';
|
|
6
6
|
import { promises, existsSync } from 'fs';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
7
|
+
import B$1 from 'fs-extra';
|
|
8
|
+
import x from 'postcss';
|
|
9
|
+
import ir from 'postcss/lib/at-rule';
|
|
10
10
|
import { z } from 'zod';
|
|
11
11
|
import { detect } from '@antfu/ni';
|
|
12
12
|
import { execa } from 'execa';
|
|
13
|
-
import
|
|
14
|
-
import
|
|
13
|
+
import ze from 'prompts';
|
|
14
|
+
import Zr, { tmpdir } from 'os';
|
|
15
15
|
import { Project, ScriptKind, SyntaxKind } from 'ts-morph';
|
|
16
16
|
import { transformFromAstSync } from '@babel/core';
|
|
17
17
|
import { parse } from '@babel/parser';
|
|
18
|
-
import
|
|
19
|
-
import * as
|
|
18
|
+
import jr from '@babel/plugin-transform-typescript';
|
|
19
|
+
import * as de from 'recast';
|
|
20
|
+
import { loadConfig } from 'tsconfig-paths';
|
|
20
21
|
import { Command } from 'commander';
|
|
21
|
-
import * as
|
|
22
|
-
import
|
|
22
|
+
import * as te from 'fs/promises';
|
|
23
|
+
import te__default from 'fs/promises';
|
|
23
24
|
import { diffLines } from 'diff';
|
|
24
25
|
import { randomBytes } from 'crypto';
|
|
25
|
-
import
|
|
26
|
+
import Pi from 'fast-glob';
|
|
26
27
|
|
|
27
|
-
var
|
|
28
|
-
To start over, remove the ${a.info("components.json")} file and run ${a.info("init")} again.`),
|
|
29
|
-
Visit ${a.info(n?.framework.links.installation)} to manually configure your project.
|
|
30
|
-
Once configured, you can use the cli to add components.`),
|
|
28
|
+
var O="1";var F="3";var Q="5",Ne="6",dt="7";var $e="13";async function gt(e){let t={};if(!B$1.existsSync(e.cwd)||!B$1.existsSync(y__default.resolve(e.cwd,"package.json")))return t[O]=!0,{errors:t,projectInfo:null};let r$1=r("Preflight checks.",{silent:e.silent}).start();B$1.existsSync(y__default.resolve(e.cwd,"components.json"))&&!e.force&&(r$1?.fail(),q.break(),q.error(`A ${a.info("components.json")} file already exists at ${a.info(e.cwd)}.
|
|
29
|
+
To start over, remove the ${a.info("components.json")} file and run ${a.info("init")} again.`),q.break(),process.exit(1)),r$1?.succeed();let i=r("Verifying framework.",{silent:e.silent}).start(),n$1=await n(e.cwd);(!n$1||n$1?.framework.name==="manual")&&(t[dt]=!0,i?.fail(),q.break(),n$1?.framework.links.installation&&q.error(`We could not detect a supported framework at ${a.info(e.cwd)}.
|
|
30
|
+
Visit ${a.info(n$1?.framework.links.installation)} to manually configure your project.
|
|
31
|
+
Once configured, you can use the cli to add components.`),q.break(),process.exit(1)),i?.succeed(`Verifying framework. Found ${a.info(n$1.framework.label)}.`);let o="Validating Tailwind CSS.";n$1.tailwindVersion==="v4"&&(o=`Validating Tailwind CSS config. Found ${a.info("v4")}.`);let a$1=r(o,{silent:e.silent}).start();n$1.tailwindVersion==="v3"&&(!n$1?.tailwindConfigFile||!n$1?.tailwindCssFile)?(t[Q]=!0,a$1?.fail()):n$1.tailwindVersion==="v4"&&!n$1?.tailwindCssFile?(t[Q]=!0,a$1?.fail()):n$1.tailwindVersion?a$1?.succeed():(t[Q]=!0,a$1?.fail());let s=r("Validating import alias.",{silent:e.silent}).start();return n$1?.aliasPrefix?s?.succeed():(t[Ne]=!0,s?.fail()),Object.keys(t).length>0&&(t[Q]&&(q.break(),q.error(`No Tailwind CSS configuration found at ${a.info(e.cwd)}.`),q.error("It is likely you do not have Tailwind CSS installed or have an invalid configuration."),q.error("Install Tailwind CSS then try again."),n$1?.framework.links.tailwind&&q.error(`Visit ${a.info(n$1?.framework.links.tailwind)} to get started.`)),t[Ne]&&(q.break(),q.error("No import alias found in your tsconfig.json file."),n$1?.framework.links.installation&&q.error(`Visit ${a.info(n$1?.framework.links.installation)} to learn how to set an import alias.`)),q.break(),process.exit(1)),{errors:t,projectInfo:n$1}}async function Ae(e,t,r$1){if(!t.resolvedPaths.tailwindCss||!e||Object.keys(e).length===0)return;r$1={silent:!1,...r$1};let i=t.resolvedPaths.tailwindCss,n=y__default.relative(t.resolvedPaths.cwd,i),o=r(`Updating ${a.info(n)}`,{silent:r$1.silent}).start(),a$1=await promises.readFile(i,"utf8"),s=await er(a$1,e);await promises.writeFile(i,s,"utf8"),o.succeed();}async function er(e,t){let r=[tr(t)],n=(await x(r).process(e,{from:void 0})).css;return n=n.replace(/\/\* ---break--- \*\//g,""),n=n.replace(/(\n\s*\n)+/g,`
|
|
31
32
|
|
|
32
|
-
`),n=n.trimEnd(),n}function
|
|
33
|
-
`}}),t.append(
|
|
34
|
-
`}});if(
|
|
35
|
-
`}});d?d.replaceWith(f):
|
|
36
|
-
`}});if(t.append(c),t.insertBefore(c,
|
|
37
|
-
`}});c.append(f);}else typeof d=="object"&&
|
|
38
|
-
`}}),e.append(n),e.insertBefore(n,
|
|
39
|
-
`}});
|
|
40
|
-
`,
|
|
41
|
-
`}}),e.append(i)),typeof r=="object"){for(let[n,o]of Object.entries(r))if(typeof o=="string"){let
|
|
42
|
-
`}}),
|
|
43
|
-
`,i?.append(
|
|
33
|
+
`),n=n.trimEnd(),n}function tr(e){return {postcssPlugin:"update-css",Once(t){for(let[r,i]of Object.entries(e))if(r.startsWith("@")){let n=r.match(/@([a-zA-Z-]+)\s*(.*)/);if(!n)continue;let[,o,a]=n;if(o==="keyframes"){let s=t.nodes?.find(l=>l.type==="atrule"&&l.name==="theme"&&l.params==="inline");s||(s=x.atRule({name:"theme",params:"inline",raws:{semicolon:!0,between:" ",before:`
|
|
34
|
+
`}}),t.append(s),t.insertBefore(s,x.comment({text:"---break---"})));let c=x.atRule({name:"keyframes",params:a,raws:{semicolon:!0,between:" ",before:`
|
|
35
|
+
`}});if(s.append(c),typeof i=="object")for(let[l,d]of Object.entries(i))K(c,l,d);}else if(o==="utility"){let s=t.nodes?.find(c=>c.type==="atrule"&&c.name===o&&c.params===a);if(s){if(typeof i=="object")for(let[c,l]of Object.entries(i))if(typeof l=="string"){let d=s.nodes?.find(u=>u.type==="decl"&&u.prop===c),f=x.decl({prop:c,value:l,raws:{semicolon:!0,before:`
|
|
36
|
+
`}});d?d.replaceWith(f):s.append(f);}else typeof l=="object"&&K(s,c,l);}else {let c=x.atRule({name:o,params:a,raws:{semicolon:!0,between:" ",before:`
|
|
37
|
+
`}});if(t.append(c),t.insertBefore(c,x.comment({text:"---break---"})),typeof i=="object")for(let[l,d]of Object.entries(i))if(typeof d=="string"){let f=x.decl({prop:l,value:d,raws:{semicolon:!0,before:`
|
|
38
|
+
`}});c.append(f);}else typeof d=="object"&&K(c,l,d);}}else wt(t,o,a,i);}else K(t,r,i);}}}function wt(e,t,r,i){let n=e.nodes?.find(o=>o.type==="atrule"&&o.name===t&&o.params===r);if(n||(n=x.atRule({name:t,params:r,raws:{semicolon:!0,between:" ",before:`
|
|
39
|
+
`}}),e.append(n),e.insertBefore(n,x.comment({text:"---break---"}))),typeof i=="object")for(let[o,a]of Object.entries(i))if(o.startsWith("@")){let s=o.match(/@([a-zA-Z-]+)\s*(.*)/);if(s){let[,c,l]=s;wt(n,c,l,a);}}else K(n,o,a);else if(typeof i=="string")try{let a=x.parse(`.temp{${i}}`).first;if(a&&a.nodes){let s=x.rule({selector:"temp",raws:{semicolon:!0,between:" ",before:`
|
|
40
|
+
`}});a.nodes.forEach(c=>{if(c.type==="decl"){let l=c.clone();l.raws.before=`
|
|
41
|
+
`,s.append(l);}}),s.nodes?.length&&n.append(s);}}catch(o){throw console.error("Error parsing at-rule content:",i,o),o}}function K(e,t,r){let i=e.nodes?.find(n=>n.type==="rule"&&n.selector===t);if(i||(i=x.rule({selector:t,raws:{semicolon:!0,between:" ",before:`
|
|
42
|
+
`}}),e.append(i)),typeof r=="object"){for(let[n,o]of Object.entries(r))if(typeof o=="string"){let a=x.decl({prop:n,value:o,raws:{semicolon:!0,before:`
|
|
43
|
+
`}}),s=i.nodes?.find(c=>c.type==="decl"&&c.prop===n);s?s.replaceWith(a):i.append(a);}else if(typeof o=="object"){let a=n.startsWith("&")?t.replace(/^([^:]+)/,`$1${n.substring(1)}`):n;K(e,a,o);}}else if(typeof r=="string")try{let o=x.parse(`.temp{${r}}`).first;o&&o.nodes&&o.nodes.forEach(a=>{if(a.type==="decl"){let s=a.clone();s.raws.before=`
|
|
44
|
+
`,i?.append(s);}});}catch(n){throw console.error("Error parsing rule content:",t,r,n),n}}async function Fe(e,t,r$1){if(!t.resolvedPaths.tailwindCss||!Object.keys(e??{}).length)return;r$1={cleanupDefaultNextStyles:!1,silent:!1,tailwindVersion:"v3",overwriteCssVars:!1,initIndex:!0,...r$1};let i=t.resolvedPaths.tailwindCss,n=y__default.relative(t.resolvedPaths.cwd,i),o=r(`Updating CSS variables in ${a.info(n)}`,{silent:r$1.silent}).start(),a$1=await promises.readFile(i,"utf8"),s=await nr(a$1,e??{},t,{cleanupDefaultNextStyles:r$1.cleanupDefaultNextStyles,tailwindVersion:r$1.tailwindVersion,tailwindConfig:r$1.tailwindConfig,overwriteCssVars:r$1.overwriteCssVars,initIndex:r$1.initIndex});await promises.writeFile(i,s,"utf8"),o.succeed();}async function nr(e,t,r,i={cleanupDefaultNextStyles:!1,tailwindVersion:"v3",tailwindConfig:void 0,overwriteCssVars:!1,initIndex:!0}){i={cleanupDefaultNextStyles:!1,tailwindVersion:"v3",tailwindConfig:void 0,overwriteCssVars:!1,initIndex:!0,...i};let n=[sr(t)];if(i.cleanupDefaultNextStyles&&n.push(bt()),i.tailwindVersion==="v4"){if(n=[],r.resolvedPaths?.cwd){let s=m(r.resolvedPaths.cwd);!s?.dependencies?.["tailwindcss-animate"]&&!s?.devDependencies?.["tailwindcss-animate"]&&i.initIndex&&n.push(mr({params:"tw-animate-css"}));}n.push(pr({params:"dark (&:is(.dark *))"})),i.cleanupDefaultNextStyles&&n.push(bt()),n.push(cr(t,{overwriteCssVars:i.overwriteCssVars})),n.push(lr(t)),i.tailwindConfig&&(n.push(fr(i.tailwindConfig)),n.push(ur(i.tailwindConfig)),n.push(dr(i.tailwindConfig)));}r.tailwind.cssVariables&&i.initIndex&&n.push(or({tailwindVersion:i.tailwindVersion}));let a=(await x(n).process(e,{from:void 0})).css;return a=a.replace(/\/\* ---break--- \*\//g,""),i.tailwindVersion==="v4"&&(a=a.replace(/(\n\s*\n)+/g,`
|
|
44
45
|
|
|
45
|
-
`)),
|
|
46
|
-
`}}),t.append(i),t.insertBefore(i,
|
|
46
|
+
`)),a}function or({tailwindVersion:e}){return {postcssPlugin:"update-base-layer",Once(t){let r=[{selector:"*",apply:e==="v4"?"border-border outline-ring/50":"border-border"},{selector:"body",apply:"bg-background text-foreground"}],i=t.nodes.find(n=>n.type==="atrule"&&n.name==="layer"&&n.params==="base"&&r.every(({selector:o,apply:a})=>n.nodes?.some(s=>s.type==="rule"&&s.selector===o&&s.nodes.some(c=>c.type==="atrule"&&c.name==="apply"&&c.params===a))));i||(i=x.atRule({name:"layer",params:"base",raws:{semicolon:!0,between:" ",before:`
|
|
47
|
+
`}}),t.append(i),t.insertBefore(i,x.comment({text:"---break---"}))),r.forEach(({selector:n,apply:o})=>{i?.nodes?.find(s=>s.type==="rule"&&s.selector===n)||i?.append(x.rule({selector:n,nodes:[x.atRule({name:"apply",params:o,raws:{semicolon:!0,before:`
|
|
47
48
|
`}})],raws:{semicolon:!0,between:" ",before:`
|
|
48
|
-
`}}));});}}}function
|
|
49
|
-
`,between:" "}}),t.append(r),t.insertBefore(r,
|
|
50
|
-
`}}),e.append(i)),Object.entries(r).forEach(([n,o])=>{let
|
|
51
|
-
`}}),r.append(
|
|
52
|
-
`}}),e.append(t),e.insertBefore(t,
|
|
53
|
-
`}});if(i.length>0){let o=i[i.length-1];t.insertAfter(o,n);}else t.insertAfter(t.nodes[0],n);t.insertBefore(n,
|
|
54
|
-
`}});if(r.length>0){let
|
|
55
|
-
`}});t.insertAfter(o,c),t.insertBefore(c,
|
|
56
|
-
`}});for(let[
|
|
49
|
+
`}}));});}}}function sr(e){return {postcssPlugin:"update-css-vars",Once(t){let r=t.nodes.find(i=>i.type==="atrule"&&i.name==="layer"&&i.params==="base");r instanceof ir||(r=x.atRule({name:"layer",params:"base",nodes:[],raws:{semicolon:!0,before:`
|
|
50
|
+
`,between:" "}}),t.append(r),t.insertBefore(r,x.comment({text:"---break---"}))),r!==void 0&&Object.entries(e).forEach(([i,n])=>{let o=i==="light"?":root":`.${i}`;ar(r,o,n);});}}}function xt(e){let t=e.nodes.find(r=>r.type==="rule"&&r.selector===":root");if(t){let r=["--background","--foreground"];t.nodes.filter(i=>i.type==="decl"&&r.includes(i.prop)).forEach(i=>i.remove()),t.nodes.length===0&&t.remove();}}function bt(){return {postcssPlugin:"cleanup-default-next-styles",Once(e){let t=e.nodes.find(i=>i.type==="rule"&&i.selector==="body");t&&(t.nodes.find(i=>i.type==="decl"&&i.prop==="color"&&["rgb(var(--foreground-rgb))","var(--foreground)"].includes(i.value))?.remove(),t.nodes.find(i=>i.type==="decl"&&i.prop==="background"&&(i.value.startsWith("linear-gradient")||i.value==="var(--background)"))?.remove(),t.nodes.find(i=>i.type==="decl"&&i.prop==="font-family"&&i.value==="Arial, Helvetica, sans-serif")?.remove(),t.nodes.length===0&&t.remove()),xt(e);let r=e.nodes.find(i=>i.type==="atrule"&&i.params==="(prefers-color-scheme: dark)");r&&(xt(r),r.nodes.length===0&&r.remove());}}}function ar(e,t,r){let i=e.nodes?.find(n=>n.type==="rule"&&n.selector===t);i||Object.keys(r).length>0&&(i=x.rule({selector:t,raws:{between:" ",before:`
|
|
51
|
+
`}}),e.append(i)),Object.entries(r).forEach(([n,o])=>{let a=`--${n.replace(/^--/,"")}`,s=x.decl({prop:a,value:o,raws:{semicolon:!0}}),c=i?.nodes.find(l=>l.type==="decl"&&l.prop===a);c?c.replaceWith(s):i?.append(s);});}function cr(e,t){return {postcssPlugin:"update-css-vars-v4",Once(r){Object.entries(e).forEach(([i,n])=>{let o=i==="light"?":root":`.${i}`;if(i==="theme"){o="@theme";let s=ce(r);Object.entries(n).forEach(([c,l])=>{let d=`--${c.replace(/^--/,"")}`,f=x.decl({prop:d,value:l,raws:{semicolon:!0}}),u=s?.nodes?.find(g=>g.type==="decl"&&g.prop===d);t.overwriteCssVars?u?u.replaceWith(f):s?.append(f):u||s?.append(f);});return}let a=r.nodes?.find(s=>s.type==="rule"&&s.selector===o);!a&&Object.keys(n).length>0&&(a=x.rule({selector:o,nodes:[],raws:{semicolon:!0,between:" ",before:`
|
|
52
|
+
`}}),r.append(a),r.insertBefore(a,x.comment({text:"---break---"}))),Object.entries(n).forEach(([s,c])=>{let l=`--${s.replace(/^--/,"")}`;l==="--sidebar-background"&&(l="--sidebar"),Rt(c)&&(c=`hsl(${c})`);let d=x.decl({prop:l,value:c,raws:{semicolon:!0}}),f=a?.nodes.find(u=>u.type==="decl"&&u.prop===l);t.overwriteCssVars?f?f.replaceWith(d):a?.append(d):f||a?.append(d);});});}}}function lr(e){return {postcssPlugin:"update-theme",Once(t){let r=Array.from(new Set(Object.keys(e).flatMap(o=>Object.keys(e[o]||{}))));if(!r.length)return;let i=ce(t),n=i.nodes?.filter(o=>o.type==="decl"&&o.prop.startsWith("--"));for(let o of r){let a=Object.values(e).find(f=>f[o])?.[o];if(!a)continue;if(o==="radius"){let f={sm:"calc(var(--radius) - 4px)",md:"calc(var(--radius) - 2px)",lg:"var(--radius)",xl:"calc(var(--radius) + 4px)"};for(let[u,g]of Object.entries(f)){let S=x.decl({prop:`--radius-${u}`,value:g,raws:{semicolon:!0}});i?.nodes?.find(h=>h.type==="decl"&&h.prop===S.prop)||i?.append(S);}continue}let s=Rt(a)||hr(a)?`--color-${o.replace(/^--/,"")}`:`--${o.replace(/^--/,"")}`;s==="--color-sidebar-background"&&(s="--color-sidebar");let c=`var(--${o})`;s==="--color-sidebar"&&(c="var(--sidebar)");let l=x.decl({prop:s,value:c,raws:{semicolon:!0}});i?.nodes?.find(f=>f.type==="decl"&&f.prop===l.prop)||(n?.length?i?.insertAfter(n[n.length-1],l):i?.append(l));}}}}function ce(e){let t=e.nodes.find(r=>r.type==="atrule"&&r.name==="theme"&&r.params==="inline");return t||(t=x.atRule({name:"theme",params:"inline",nodes:[],raws:{semicolon:!0,between:" ",before:`
|
|
53
|
+
`}}),e.append(t),e.insertBefore(t,x.comment({text:"---break---"}))),t}function pr({params:e}){return {postcssPlugin:"add-custom-variant",Once(t){if(!t.nodes.find(i=>i.type==="atrule"&&i.name==="custom-variant")){let i=t.nodes.filter(o=>o.type==="atrule"&&o.name==="import"),n=x.atRule({name:"custom-variant",params:e,raws:{semicolon:!0,before:`
|
|
54
|
+
`}});if(i.length>0){let o=i[i.length-1];t.insertAfter(o,n);}else t.insertAfter(t.nodes[0],n);t.insertBefore(n,x.comment({text:"---break---"}));}}}}function mr({params:e}){return {postcssPlugin:"add-custom-import",Once(t){let r=t.nodes.filter(o=>o.type==="atrule"&&o.name==="import"),i=t.nodes.find(o=>o.type==="atrule"&&o.name==="custom-variant");if(!r.some(o=>o.params.replace(/["']/g,"")===e)){let o=x.atRule({name:"import",params:`"${e}"`,raws:{semicolon:!0,before:`
|
|
55
|
+
`}});if(r.length>0){let a=r[r.length-1];t.insertAfter(a,o);}else i?(t.insertBefore(i,o),t.insertBefore(i,x.comment({text:"---break---"}))):(t.prepend(o),t.insertAfter(o,x.comment({text:"---break---"})));}}}}function fr(e){return {postcssPlugin:"update-tailwind-config",Once(t){if(!e?.plugins)return;let i=gr(t)==="single"?"'":'"',n=t.nodes.filter(a=>a.type==="atrule"&&a.name==="plugin"),o=n[n.length-1]||t.nodes[0];for(let a of e.plugins){let s=a.replace(/^require\(["']|["']\)$/g,"");if(n.some(l=>l.params.replace(/["']/g,"")===s))continue;let c=x.atRule({name:"plugin",params:`${i}${s}${i}`,raws:{semicolon:!0,before:`
|
|
56
|
+
`}});t.insertAfter(o,c),t.insertBefore(c,x.comment({text:"---break---"}));}}}}function dr(e){return {postcssPlugin:"update-tailwind-config-keyframes",Once(t){if(!e?.theme?.extend?.keyframes)return;let r=ce(t),i=r.nodes?.filter(o=>o.type==="atrule"&&o.name==="keyframes"),n=z.record(z.string(),z.record(z.string(),z.string()));for(let[o,a]of Object.entries(e.theme.extend.keyframes)){if(typeof o!="string")continue;let s=n.safeParse(a);if(!s.success||i?.find(l=>l.type==="atrule"&&l.name==="keyframes"&&l.params===o))continue;let c=x.atRule({name:"keyframes",params:o,nodes:[],raws:{semicolon:!0,between:" ",before:`
|
|
57
|
+
`}});for(let[l,d]of Object.entries(s.data)){let f=x.rule({selector:l,nodes:Object.entries(d).map(([u,g])=>x.decl({prop:u,value:g,raws:{semicolon:!0,before:`
|
|
57
58
|
`,between:": "}})),raws:{semicolon:!0,between:" ",before:`
|
|
58
|
-
`}});c.append(f);}r.append(c),r.insertBefore(c,
|
|
59
|
-
`}});r.append(c);}}}}function
|
|
59
|
+
`}});c.append(f);}r.append(c),r.insertBefore(c,x.comment({text:"---break---"}));}}}}function ur(e){return {postcssPlugin:"update-tailwind-config-animation",Once(t){if(!e?.theme?.extend?.animation)return;let r=ce(t),i=r.nodes?.filter(o=>o.type==="decl"&&o.prop.startsWith("--animate-")),n=z.record(z.string(),z.string()).safeParse(e.theme.extend.animation);if(n.success)for(let[o,a]of Object.entries(n.data)){let s=`--animate-${o}`;if(i?.find(l=>l.prop===s))continue;let c=x.decl({prop:s,value:a,raws:{semicolon:!0,between:": ",before:`
|
|
60
|
+
`}});r.append(c);}}}}function gr(e){return e.nodes[0].toString().includes("'")?"single":"double"}function Rt(e){if(e.startsWith("hsl")||e.startsWith("rgb")||e.startsWith("#")||e.startsWith("oklch"))return !1;let t=e.split(" ");return t.length===3&&t.slice(1,3).every(r=>r.includes("%"))}function hr(e){return e.startsWith("hsl")||e.startsWith("rgb")||e.startsWith("#")||e.startsWith("oklch")}async function le(e,{withFallback:t}={withFallback:!1}){let r=await detect({programmatic:!0,cwd:e});if(r==="yarn@berry")return "yarn";if(r==="pnpm@6")return "pnpm";if(r==="bun")return "bun";if(r==="deno")return "deno";if(!t)return r??"npm";let i=process.env.npm_config_user_agent||"";return i.startsWith("yarn")?"yarn":i.startsWith("pnpm")?"pnpm":i.startsWith("bun")?"bun":"npm"}async function Z(e,t,r$1,i){if(e=Array.from(new Set(e)),t=Array.from(new Set(t)),!e?.length&&!t?.length)return;i={silent:!1,...i};let n=r("Installing dependencies.",{silent:i.silent})?.start(),o=await le(r$1.resolvedPaths.cwd),a="";if(xr(r$1)&&o==="npm")if(i.silent)a="force";else {n.stopAndPersist(),q.warn(`
|
|
60
61
|
It looks like you are using React 19.
|
|
61
62
|
Some packages may fail to install due to peer dependency issues in npm (see https://ui.shadcn.com/react-19).
|
|
62
|
-
`);let s=await Le([{type:"select",name:"flag",message:"How would you like to proceed?",choices:[{title:"Use --force",value:"force"},{title:"Use --legacy-peer-deps",value:"legacy-peer-deps"}]}]);s&&(o=s.flag);}i?.start(),await execa(n,[n==="npm"?"install":"add",...n==="npm"&&o?[`--${o}`]:[],...e],{cwd:t.resolvedPaths.cwd}),i?.succeed();}function wr(e){let t=l(e.resolvedPaths.cwd);return t?.dependencies?.react?/^(?:\^|~)?19(?:\.\d+)*(?:-.*)?$/.test(t.dependencies.react):!1}var ne=async({sourceFile:e,config:t,baseColor:r})=>(t.tailwind?.cssVariables||!r?.inlineColors||e.getDescendantsOfKind(SyntaxKind.StringLiteral).forEach(i=>{let n=i.getText();if(n){let o=xr(n.replace(/"/g,""),r.inlineColors);i.replaceWithText(`"${o.trim()}"`);}}),e);function De(e){if(!e.includes("/")&&!e.includes(":"))return [null,e,null];let t=[],[r,i]=e.split("/");if(!r.includes(":"))return [null,r,i];let n=r.split(":"),o=n.pop(),s=n.join(":");return t.push(s??null,o??null,i??null),t}var br=["bg-","text-","border-","ring-offset-","ring-"];function xr(e,t){e.includes(" border ")&&(e=e.replace(" border "," border border-border "));let r=e.split(" "),i=new Set,n=new Set;for(let o of r){let[s,a,c]=De(o),p=br.find(f=>a?.startsWith(f));if(!p){i.has(o)||i.add(o);continue}let d=a?.replace(p,"");if(d&&d in t.light){i.add([s,`${p}${t.light[d]}`].filter(Boolean).join(":")+(c?`/${c}`:"")),n.add(["dark",s,`${p}${t.dark[d]}`].filter(Boolean).join(":")+(c?`/${c}`:""));continue}i.has(o)||i.add(o);}return [...Array.from(i),...Array.from(n)].join(" ").trim()}var T={lucide:{name:"lucide-react",package:"lucide-react",import:"lucide-react"},radix:{name:"@radix-ui/react-icons",package:"@radix-ui/react-icons",import:"@radix-ui/react-icons"}};var xt="lucide",oe=async({sourceFile:e,config:t})=>{if(!t.iconLibrary||!(t.iconLibrary in T))return e;let r=await K(),i=xt,n=t.iconLibrary;if(i===n)return e;let o=[];for(let s of e.getImportDeclarations()??[])if(s.getModuleSpecifier()?.getText()===`"${T[xt].import}"`){for(let a of s.getNamedImports()??[]){let c=a.getName(),p=r[c]?.[n];!p||o.includes(p)||(o.push(p),a.remove(),e.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement).filter(d=>d.getTagNameNode()?.getText()===c).forEach(d=>d.getTagNameNode()?.replaceWithText(p)));}s.getNamedImports()?.length===0&&s.remove();}if(o.length>0){let s=e.addImportDeclaration({moduleSpecifier:T[n]?.import,namedImports:o.map(a=>({name:a}))});Sr(e)||s.replaceWithText(s.getText().replace(";",""));}return e};function Sr(e){return e.getImportDeclarations()?.[0]?.getText().endsWith(";")??!1}var se=async({sourceFile:e,config:t,isRemote:r})=>{let n=`@${t.aliases?.utils?.split("/")[0]?.slice(1)}/lib/utils`,o=e.getImportDeclarations();for(let s of o){let a=vr(s.getModuleSpecifierValue(),t,r);s.setModuleSpecifier(a),(n===a||a==="@/lib/utils")&&s.getNamedImports().find(d=>d.getName()==="cn")&&s.setModuleSpecifier(n===a?a.replace(n,t.aliases.utils):t.aliases.utils);}return e};function vr(e,t,r=!1){if(!e.startsWith("@/")&&!r)return e;if(r&&e.startsWith("@/")&&(e=e.replace(/^@\//,"@/registry/new-york/")),!e.startsWith("@/registry/")){let i=t.aliases.components.split("/")[0];return e.replace(/^@\//,`${i}/`)}return e.match(/^@\/registry\/(.+)\/ui/)?e.replace(/^@\/registry\/(.+)\/ui/,t.aliases.ui??`${t.aliases.components}/ui`):t.aliases.components&&e.match(/^@\/registry\/(.+)\/components/)?e.replace(/^@\/registry\/(.+)\/components/,t.aliases.components):t.aliases.lib&&e.match(/^@\/registry\/(.+)\/lib/)?e.replace(/^@\/registry\/(.+)\/lib/,t.aliases.lib):t.aliases.hooks&&e.match(/^@\/registry\/(.+)\/hooks/)?e.replace(/^@\/registry\/(.+)\/hooks/,t.aliases.hooks):e.replace(/^@\/registry\/[^/]+/,t.aliases.components)}var kr={sourceType:"module",allowImportExportEverywhere:!0,allowReturnOutsideFunction:!0,startLine:1,tokens:!0,plugins:["asyncGenerators","bigInt","classPrivateMethods","classPrivateProperties","classProperties","classStaticBlock","decimal","decorators-legacy","doExpressions","dynamicImport","exportDefaultFrom","exportNamespaceFrom","functionBind","functionSent","importAssertions","importMeta","nullishCoalescingOperator","numericSeparator","objectRestSpread","optionalCatchBinding","optionalChaining",["pipelineOperator",{proposal:"minimal"}],["recordAndTuple",{syntaxType:"hash"}],"throwExpressions","topLevelAwait","v8intrinsic","typescript","jsx"]},Rt=async({sourceFile:e,config:t})=>{let r=e.getFullText();if(t.tsx)return r;let i=ae.parse(r,{parser:{parse:o=>parse(o,kr)}}),n=transformFromAstSync(i,r,{cloneInputAst:!1,code:!1,ast:!0,plugins:[Pr],configFile:!1});if(!n||!n.ast)throw new Error("Failed to transform JSX");return ae.print(n.ast).code};var Er=/^["']use client["']$/g,ce=async({sourceFile:e,config:t})=>{if(t.rsc)return e;let r=e.getFirstChildByKind(SyntaxKind.ExpressionStatement);return r&&Er.test(r.getText())&&r.remove(),e};var le=async({sourceFile:e,config:t})=>(t.tailwind?.prefix&&(e.getDescendantsOfKind(SyntaxKind.CallExpression).filter(r=>r.getExpression().getText()==="cva").forEach(r=>{if(r.getArguments()[0]?.isKind(SyntaxKind.StringLiteral)){let i=r.getArguments()[0];i&&i.replaceWithText(`"${A(i.getText()?.replace(/"|'/g,""),t.tailwind.prefix)}"`);}r.getArguments()[1]?.isKind(SyntaxKind.ObjectLiteralExpression)&&r.getArguments()[1]?.getDescendantsOfKind(SyntaxKind.PropertyAssignment).find(i=>i.getName()==="variants")?.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach(i=>{i.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach(n=>{let o=n.getInitializerIfKind(SyntaxKind.StringLiteral);o&&o?.replaceWithText(`"${A(o.getText()?.replace(/"|'/g,""),t.tailwind.prefix)}"`);});});}),e.getDescendantsOfKind(SyntaxKind.JsxAttribute).forEach(r=>{if(r.getName()==="className"){if(r.getInitializer()?.isKind(SyntaxKind.StringLiteral)){let i=r.getInitializer();i&&i.replaceWithText(`"${A(i.getText()?.replace(/"|'/g,""),t.tailwind.prefix)}"`);}if(r.getInitializer()?.isKind(SyntaxKind.JsxExpression)){let i=r.getInitializer()?.getDescendantsOfKind(SyntaxKind.CallExpression).find(n=>n.getExpression().getText()==="cn");i&&i.getArguments().forEach(n=>{(n.isKind(SyntaxKind.ConditionalExpression)||n.isKind(SyntaxKind.BinaryExpression))&&n.getChildrenOfKind(SyntaxKind.StringLiteral).forEach(o=>{o.replaceWithText(`"${A(o.getText()?.replace(/"|'/g,""),t.tailwind.prefix)}"`);}),n.isKind(SyntaxKind.StringLiteral)&&n.replaceWithText(`"${A(n.getText()?.replace(/"|'/g,""),t.tailwind.prefix)}"`);});}}r.getName()==="classNames"&&r.getInitializer()?.isKind(SyntaxKind.JsxExpression)&&r.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach(i=>{if(i.getInitializer()?.isKind(SyntaxKind.CallExpression)){let n=i.getInitializerIfKind(SyntaxKind.CallExpression);n&&n.getArguments().forEach(o=>{o.isKind(SyntaxKind.ConditionalExpression)&&o.getChildrenOfKind(SyntaxKind.StringLiteral).forEach(s=>{s.replaceWithText(`"${A(s.getText()?.replace(/"|'/g,""),t.tailwind.prefix)}"`);}),o.isKind(SyntaxKind.StringLiteral)&&o.replaceWithText(`"${A(o.getText()?.replace(/"|'/g,""),t.tailwind.prefix)}"`);});}if(i.getInitializer()?.isKind(SyntaxKind.StringLiteral)&&i.getName()!=="variant"){let n=i.getInitializer();n&&n.replaceWithText(`"${A(n.getText()?.replace(/"|'/g,""),t.tailwind.prefix)}"`);}});})),e);function A(e,t=""){let r=e.split(" "),i=[];for(let n of r){let[o,s,a]=De(n);o?a?i.push(`${o}:${t}${s}/${a}`):i.push(`${o}:${t}${s}`):a?i.push(`${t}${s}/${a}`):i.push(`${t}${s}`);}return i.join(" ")}var Dr=new Project({compilerOptions:{}});async function Ar(e){let t=await promises.mkdtemp(O__default.join(tmpdir(),"shadcn-"));return O__default.join(t,e)}async function pe(e,t=[se,ce,ne,le,oe]){let r=await Ar(e.filename),i=Dr.createSourceFile(r,e.raw,{scriptKind:ScriptKind.TSX});for(let n of t)await n({sourceFile:i,...e});return e.transformJsx?await Rt({sourceFile:i,...e}):i.getText()}async function Fe(e,t,r){if(!e?.length)return {filesCreated:[],filesUpdated:[],filesSkipped:[]};r={overwrite:!1,force:!1,silent:!1,isRemote:!1,...r};let i=q$1("Updating files.",{silent:r.silent})?.start(),[n,o]=await Promise.all([m(t.resolvedPaths.cwd),N(t.tailwind.baseColor)]),s=[],a$1=[],c=[];for(let d of e){if(!d.content)continue;let f=Vr(d,t,{isSrcDir:n?.isSrcDir,framework:n?.framework.name,commonRoot:Mr(e.map(j=>j.path),d.path)});if(!f)continue;let u=basename(d.path),b=O__default.dirname(f);t.tsx||(f=f.replace(/\.tsx?$/,j=>j===".tsx"?".jsx":".js"));let P=existsSync(f),h=await pe({filename:d.path,raw:d.content,config:t,baseColor:o,transformJsx:!t.tsx,isRemote:r.isRemote},[se,ce,ne,le,oe]);if(P){let j=await promises.readFile(f,"utf-8"),[xe,S]=await Promise.all([It(j),It(h)]);if(xe===S){c.push(O__default.relative(t.resolvedPaths.cwd,f));continue}}if(P&&!r.overwrite){i.stop(),r.rootSpinner&&r.rootSpinner.stop();let{overwrite:j}=await Le({type:"confirm",name:"overwrite",message:`The file ${a.info(u)} already exists. Would you like to overwrite?`,initial:!1});if(!j){c.push(O__default.relative(t.resolvedPaths.cwd,f)),r.rootSpinner&&r.rootSpinner.start();continue}i?.start(),r.rootSpinner&&r.rootSpinner.start();}existsSync(b)||await promises.mkdir(b,{recursive:!0}),await promises.writeFile(f,h,"utf-8"),P?a$1.push(O__default.relative(t.resolvedPaths.cwd,f)):s.push(O__default.relative(t.resolvedPaths.cwd,f));}if(!(s.length||a$1.length)&&!c.length&&i?.info("No files updated."),s.length){if(i?.succeed(`Created ${s.length} ${s.length===1?"file":"files"}:`),!r.silent)for(let d of s)p.log(` - ${d}`);}else i?.stop();if(a$1.length&&(q$1(`Updated ${a$1.length} ${a$1.length===1?"file":"files"}:`,{silent:r.silent})?.info(),!r.silent))for(let d of a$1)p.log(` - ${d}`);if(c.length&&(q$1(`Skipped ${c.length} ${a$1.length===1?"file":"files"}: (files might be identical, use --overwrite to overwrite)`,{silent:r.silent})?.info(),!r.silent))for(let d of c)p.log(` - ${d}`);return r.silent||p.break(),{filesCreated:s,filesUpdated:a$1,filesSkipped:c}}function Vr(e,t,r){if(e.target){if(e.target.startsWith("~/"))return O__default.join(t.resolvedPaths.cwd,e.target.replace("~/",""));let o=e.target;return e.type==="registry:page"&&(o=Wr(o,r.framework),!o)?"":r.isSrcDir?O__default.join(t.resolvedPaths.cwd,"src",o.replace("src/","")):O__default.join(t.resolvedPaths.cwd,o.replace("src/",""))}let i=Lr(e,t),n=zr(e.path,i);return O__default.join(i,n)}function Lr(e,t){return e.type==="registry:ui"?t.resolvedPaths.ui:e.type==="registry:lib"?t.resolvedPaths.lib:e.type==="registry:block"||e.type==="registry:component"?t.resolvedPaths.components:e.type==="registry:hook"?t.resolvedPaths.hooks:t.resolvedPaths.components}function Mr(e,t){let r=e.map(s=>s.replace(/^\//,"")),i=t.replace(/^\//,""),n=i.split("/").slice(0,-1).join("/");if(!n)return "";let o=n.split("/");for(let s=o.length;s>0;s--){let a=o.slice(0,s).join("/");if(r.some(p=>p!==i&&p.startsWith(a+"/")))return "/"+a}return "/"+n}function zr(e,t){let r=e.replace(/^\/|\/$/g,""),i=t.replace(/^\/|\/$/g,""),n=r.split("/"),o=i.split("/"),s=o[o.length-1],a=n.findIndex(c=>c===s);return a===-1?n[n.length-1]:n.slice(a+1).join("/")}async function It(e){return e.replace(/\r\n/g,`
|
|
63
|
-
`).trim()}function
|
|
64
|
-
Would you like to start a new project?`,choices:[{title:"Next.js",value:"next"},{title:"Next.js (Monorepo)",value:"next-monorepo"}],initial:0},{type:"text",name:"name",message:"What is your project named?",initial:r
|
|
65
|
-
You may now add components.`),
|
|
66
|
-
Before you can add components, you must create a valid ${a.info("components.json")} file by running the ${a.info("init")} command.`),
|
|
63
|
+
`);let s=await ze([{type:"select",name:"flag",message:"How would you like to proceed?",choices:[{title:"Use --force",value:"force"},{title:"Use --legacy-peer-deps",value:"legacy-peer-deps"}]}]);s&&(a=s.flag);}n?.start(),e?.length&&await execa(o,[o==="npm"?"install":"add",...o==="npm"&&a?[`--${a}`]:[],...o==="deno"?e.map(s=>`npm:${s}`):e],{cwd:r$1.resolvedPaths.cwd}),t?.length&&await execa(o,[o==="npm"?"install":"add",...o==="npm"&&a?[`--${a}`]:[],"-D",...o==="deno"?t.map(s=>`npm:${s}`):t],{cwd:r$1.resolvedPaths.cwd}),n?.succeed();}function xr(e){let t=m(e.resolvedPaths.cwd,!1);return t?.dependencies?.react?/^(?:\^|~)?19(?:\.\d+)*(?:-.*)?$/.test(t.dependencies.react):!1}var pe=async({sourceFile:e,config:t,baseColor:r})=>(t.tailwind?.cssVariables||!r?.inlineColors||e.getDescendantsOfKind(SyntaxKind.StringLiteral).forEach(i=>{let n=i.getText();if(n){let o=Sr(n.replace(/"/g,""),r.inlineColors);i.replaceWithText(`"${o.trim()}"`);}}),e);function _e(e){if(!e.includes("/")&&!e.includes(":"))return [null,e,null];let t=[],[r,i]=e.split("/");if(!r.includes(":"))return [null,r,i];let n=r.split(":"),o=n.pop(),a=n.join(":");return t.push(a??null,o??null,i??null),t}var Rr=["bg-","text-","border-","ring-offset-","ring-"];function Sr(e,t){e.includes(" border ")&&(e=e.replace(" border "," border border-border "));let r=e.split(" "),i=new Set,n=new Set;for(let o of r){let[a,s,c]=_e(o),l=Rr.find(f=>s?.startsWith(f));if(!l){i.has(o)||i.add(o);continue}let d=s?.replace(l,"");if(d&&d in t.light){i.add([a,`${l}${t.light[d]}`].filter(Boolean).join(":")+(c?`/${c}`:"")),n.add(["dark",a,`${l}${t.dark[d]}`].filter(Boolean).join(":")+(c?`/${c}`:""));continue}i.has(o)||i.add(o);}return [...Array.from(i),...Array.from(n)].join(" ").trim()}var N={lucide:{name:"lucide-react",package:"lucide-react",import:"lucide-react"},radix:{name:"@radix-ui/react-icons",package:"@radix-ui/react-icons",import:"@radix-ui/react-icons"}};var vt="lucide",me=async({sourceFile:e,config:t})=>{if(!t.iconLibrary||!(t.iconLibrary in N))return e;let r=await L(),i=vt,n=t.iconLibrary;if(i===n)return e;let o=[];for(let a of e.getImportDeclarations()??[])if(a.getModuleSpecifier()?.getText()===`"${N[vt].import}"`){for(let s of a.getNamedImports()??[]){let c=s.getName(),l=r[c]?.[n];!l||o.includes(l)||(o.push(l),s.remove(),e.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement).filter(d=>d.getTagNameNode()?.getText()===c).forEach(d=>d.getTagNameNode()?.replaceWithText(l)));}a.getNamedImports()?.length===0&&a.remove();}if(o.length>0){let a=e.addImportDeclaration({moduleSpecifier:N[n]?.import,namedImports:o.map(s=>({name:s}))});Ir(e)||a.replaceWithText(a.getText().replace(";",""));}return e};function Ir(e){return e.getImportDeclarations()?.[0]?.getText().endsWith(";")??!1}var fe=async({sourceFile:e,config:t,isRemote:r})=>{let n=`@${t.aliases?.utils?.split("/")[0]?.slice(1)}/lib/utils`,o=e.getImportDeclarations();for(let a of o){let s=Cr(a.getModuleSpecifierValue(),t,r);a.setModuleSpecifier(s),(n===s||s==="@/lib/utils")&&a.getNamedImports().find(d=>d.getName()==="cn")&&a.setModuleSpecifier(n===s?s.replace(n,t.aliases.utils):t.aliases.utils);}return e};function Cr(e,t,r=!1){if(!e.startsWith("@/")&&!r)return e;if(r&&e.startsWith("@/")&&(e=e.replace(/^@\//,"@/registry/new-york/")),!e.startsWith("@/registry/")){let i=t.aliases.components.split("/")[0];return e.replace(/^@\//,`${i}/`)}return e.match(/^@\/registry\/(.+)\/ui/)?e.replace(/^@\/registry\/(.+)\/ui/,t.aliases.ui??`${t.aliases.components}/ui`):t.aliases.components&&e.match(/^@\/registry\/(.+)\/components/)?e.replace(/^@\/registry\/(.+)\/components/,t.aliases.components):t.aliases.lib&&e.match(/^@\/registry\/(.+)\/lib/)?e.replace(/^@\/registry\/(.+)\/lib/,t.aliases.lib):t.aliases.hooks&&e.match(/^@\/registry\/(.+)\/hooks/)?e.replace(/^@\/registry\/(.+)\/hooks/,t.aliases.hooks):e.replace(/^@\/registry\/[^/]+/,t.aliases.components)}var Tr={sourceType:"module",allowImportExportEverywhere:!0,allowReturnOutsideFunction:!0,startLine:1,tokens:!0,plugins:["asyncGenerators","bigInt","classPrivateMethods","classPrivateProperties","classProperties","classStaticBlock","decimal","decorators-legacy","doExpressions","dynamicImport","exportDefaultFrom","exportNamespaceFrom","functionBind","functionSent","importAssertions","importMeta","nullishCoalescingOperator","numericSeparator","objectRestSpread","optionalCatchBinding","optionalChaining",["pipelineOperator",{proposal:"minimal"}],["recordAndTuple",{syntaxType:"hash"}],"throwExpressions","topLevelAwait","v8intrinsic","typescript","jsx"]},It=async({sourceFile:e,config:t})=>{let r=e.getFullText();if(t.tsx)return r;let i=de.parse(r,{parser:{parse:o=>parse(o,Tr)}}),n=transformFromAstSync(i,r,{cloneInputAst:!1,code:!1,ast:!0,plugins:[jr],configFile:!1});if(!n||!n.ast)throw new Error("Failed to transform JSX");return de.print(n.ast).code};var Or=/^["']use client["']$/g,ue=async({sourceFile:e,config:t})=>{if(t.rsc)return e;let r=e.getFirstChildByKind(SyntaxKind.ExpressionStatement);return r&&Or.test(r.getText())&&r.remove(),e};var ge=async({sourceFile:e,config:t})=>(t.tailwind?.prefix&&(e.getDescendantsOfKind(SyntaxKind.CallExpression).filter(r=>r.getExpression().getText()==="cva").forEach(r=>{if(r.getArguments()[0]?.isKind(SyntaxKind.StringLiteral)){let i=r.getArguments()[0];i&&i.replaceWithText(`"${V(i.getText()?.replace(/"|'/g,""),t.tailwind.prefix)}"`);}r.getArguments()[1]?.isKind(SyntaxKind.ObjectLiteralExpression)&&r.getArguments()[1]?.getDescendantsOfKind(SyntaxKind.PropertyAssignment).find(i=>i.getName()==="variants")?.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach(i=>{i.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach(n=>{let o=n.getInitializerIfKind(SyntaxKind.StringLiteral);o&&o?.replaceWithText(`"${V(o.getText()?.replace(/"|'/g,""),t.tailwind.prefix)}"`);});});}),e.getDescendantsOfKind(SyntaxKind.JsxAttribute).forEach(r=>{if(r.getName()==="className"){if(r.getInitializer()?.isKind(SyntaxKind.StringLiteral)){let i=r.getInitializer();i&&i.replaceWithText(`"${V(i.getText()?.replace(/"|'/g,""),t.tailwind.prefix)}"`);}if(r.getInitializer()?.isKind(SyntaxKind.JsxExpression)){let i=r.getInitializer()?.getDescendantsOfKind(SyntaxKind.CallExpression).find(n=>n.getExpression().getText()==="cn");i&&i.getArguments().forEach(n=>{(n.isKind(SyntaxKind.ConditionalExpression)||n.isKind(SyntaxKind.BinaryExpression))&&n.getChildrenOfKind(SyntaxKind.StringLiteral).forEach(o=>{o.replaceWithText(`"${V(o.getText()?.replace(/"|'/g,""),t.tailwind.prefix)}"`);}),n.isKind(SyntaxKind.StringLiteral)&&n.replaceWithText(`"${V(n.getText()?.replace(/"|'/g,""),t.tailwind.prefix)}"`);});}}r.getName()==="classNames"&&r.getInitializer()?.isKind(SyntaxKind.JsxExpression)&&r.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach(i=>{if(i.getInitializer()?.isKind(SyntaxKind.CallExpression)){let n=i.getInitializerIfKind(SyntaxKind.CallExpression);n&&n.getArguments().forEach(o=>{o.isKind(SyntaxKind.ConditionalExpression)&&o.getChildrenOfKind(SyntaxKind.StringLiteral).forEach(a=>{a.replaceWithText(`"${V(a.getText()?.replace(/"|'/g,""),t.tailwind.prefix)}"`);}),o.isKind(SyntaxKind.StringLiteral)&&o.replaceWithText(`"${V(o.getText()?.replace(/"|'/g,""),t.tailwind.prefix)}"`);});}if(i.getInitializer()?.isKind(SyntaxKind.StringLiteral)&&i.getName()!=="variant"){let n=i.getInitializer();n&&n.replaceWithText(`"${V(n.getText()?.replace(/"|'/g,""),t.tailwind.prefix)}"`);}});})),e);function V(e,t=""){let r=e.split(" "),i=[];for(let n of r){let[o,a,s]=_e(n);o?s?i.push(`${o}:${t}${a}/${s}`):i.push(`${o}:${t}${a}`):s?i.push(`${t}${a}/${s}`):i.push(`${t}${a}`);}return i.join(" ")}var Fr=new Project({compilerOptions:{}});async function _r(e){let t=await promises.mkdtemp(y__default.join(tmpdir(),"shadcn-"));return y__default.join(t,e)}async function he(e,t=[fe,ue,pe,ge,me]){let r=await _r(e.filename),i=Fr.createSourceFile(r,e.raw,{scriptKind:ScriptKind.TSX});for(let n of t)await n({sourceFile:i,...e});return e.transformJsx?await It({sourceFile:i,...e}):i.getText()}async function Ve(e,t,r$1){if(!e?.length)return {filesCreated:[],filesUpdated:[],filesSkipped:[]};r$1={overwrite:!1,force:!1,silent:!1,isRemote:!1,...r$1};let i=r("Updating files.",{silent:r$1.silent})?.start(),[n$1,o]=await Promise.all([n(t.resolvedPaths.cwd),O$1(t.tailwind.baseColor)]),a$1=[],s=[],c=[];for(let u of e){if(!u.content)continue;let g=Br(u,t,{isSrcDir:n$1?.isSrcDir,framework:n$1?.framework.name,commonRoot:Kr(e.map(b=>b.path),u.path)});if(!g)continue;let S=basename(u.path),h=y__default.dirname(g);t.tsx||(g=g.replace(/\.tsx?$/,b=>b===".tsx"?".jsx":".js"));let v=existsSync(g),E=await he({filename:u.path,raw:u.content,config:t,baseColor:o,transformJsx:!t.tsx,isRemote:r$1.isRemote},[fe,ue,pe,ge,me]);if(v){let b=await promises.readFile(g,"utf-8"),[D,C]=await Promise.all([Pt(b),Pt(E)]);if(D===C){c.push(y__default.relative(t.resolvedPaths.cwd,g));continue}}if(v&&!r$1.overwrite){i.stop(),r$1.rootSpinner&&r$1.rootSpinner.stop();let{overwrite:b}=await ze({type:"confirm",name:"overwrite",message:`The file ${a.info(S)} already exists. Would you like to overwrite?`,initial:!1});if(!b){c.push(y__default.relative(t.resolvedPaths.cwd,g)),r$1.rootSpinner&&r$1.rootSpinner.start();continue}i?.start(),r$1.rootSpinner&&r$1.rootSpinner.start();}existsSync(h)||await promises.mkdir(h,{recursive:!0}),await promises.writeFile(g,E,"utf-8"),v?s.push(y__default.relative(t.resolvedPaths.cwd,g)):a$1.push(y__default.relative(t.resolvedPaths.cwd,g));}let l=[...a$1,...s,...c],d=await Yr(l,t);if(s.push(...d),s=s.filter(u=>!a$1.includes(u)),!(a$1.length||s.length)&&!c.length&&i?.info("No files updated."),a$1=Array.from(new Set(a$1)),s=Array.from(new Set(s)),c=Array.from(new Set(c)),a$1.length){if(i?.succeed(`Created ${a$1.length} ${a$1.length===1?"file":"files"}:`),!r$1.silent)for(let u of a$1)q.log(` - ${u}`);}else i?.stop();if(s.length&&(r(`Updated ${s.length} ${s.length===1?"file":"files"}:`,{silent:r$1.silent})?.info(),!r$1.silent))for(let u of s)q.log(` - ${u}`);if(c.length&&(r(`Skipped ${c.length} ${s.length===1?"file":"files"}: (files might be identical, use --overwrite to overwrite)`,{silent:r$1.silent})?.info(),!r$1.silent))for(let u of c)q.log(` - ${u}`);return r$1.silent||q.break(),{filesCreated:a$1,filesUpdated:s,filesSkipped:c}}function Br(e,t,r){if(e.target){if(e.target.startsWith("~/"))return y__default.join(t.resolvedPaths.cwd,e.target.replace("~/",""));let o=e.target;return e.type==="registry:page"&&(o=Jr(o,r.framework),!o)?"":r.isSrcDir?y__default.join(t.resolvedPaths.cwd,"src",o.replace("src/","")):y__default.join(t.resolvedPaths.cwd,o.replace("src/",""))}let i=Ur(e,t),n=Gr(e.path,i);return y__default.join(i,n)}function Ur(e,t){return e.type==="registry:ui"?t.resolvedPaths.ui:e.type==="registry:lib"?t.resolvedPaths.lib:e.type==="registry:block"||e.type==="registry:component"?t.resolvedPaths.components:e.type==="registry:hook"?t.resolvedPaths.hooks:t.resolvedPaths.components}function Kr(e,t){let r=e.map(a=>a.replace(/^\//,"")),i=t.replace(/^\//,""),n=i.split("/").slice(0,-1).join("/");if(!n)return "";let o=n.split("/");for(let a=o.length;a>0;a--){let s=o.slice(0,a).join("/");if(r.some(l=>l!==i&&l.startsWith(s+"/")))return "/"+s}return "/"+n}function Gr(e,t){let r=e.replace(/^\/|\/$/g,""),i=t.replace(/^\/|\/$/g,""),n=r.split("/"),o=i.split("/"),a=o[o.length-1],s=n.findIndex(c=>c===a);return s===-1?n[n.length-1]:n.slice(s+1).join("/")}async function Pt(e){return e.replace(/\r\n/g,`
|
|
64
|
+
`).trim()}function Jr(e,t){if(!t)return "";if(t==="next-app")return e;if(t==="next-pages"){let r=e.replace(/^app\//,"pages/");return r=r.replace(/\/page(\.[jt]sx?)$/,"$1"),r}if(t==="react-router"){let r=e.replace(/^app\//,"app/routes/");return r=r.replace(/\/page(\.[jt]sx?)$/,"$1"),r}if(t==="laravel"){let r=e.replace(/^app\//,"resources/js/pages/");return r=r.replace(/\/page(\.[jt]sx?)$/,"$1"),r}return ""}async function Yr(e,t){let r=new Project({compilerOptions:{}}),i=await n(t.resolvedPaths.cwd),n$1=await loadConfig(t.resolvedPaths.cwd),o=[];if(!i||n$1.resultType==="failed")return [];for(let a of e){let s=y__default.resolve(t.resolvedPaths.cwd,a);if(!existsSync(s))continue;let c=await promises.readFile(s,"utf-8"),l=await promises.mkdtemp(y__default.join(tmpdir(),"shadcn-")),d=r.createSourceFile(y__default.join(l,basename(s)),c,{scriptKind:ScriptKind.TSX}),f=d.getImportDeclarations();for(let u of f){let g=u.getModuleSpecifierValue();if(i?.aliasPrefix&&!g.startsWith(`${i.aliasPrefix}/`))continue;let S=await b(g,n$1);if(!S)continue;let h=qr(S,e,t);if(!h)continue;let v=Xr(h,t,i);!v||v===g||(u.setModuleSpecifier(v),await promises.writeFile(s,d.getFullText(),"utf-8"),o.push(a));}}return o}function qr(e,t,r,i=[".tsx",".ts",".js",".jsx",".css"]){let n=y__default.normalize(r.resolvedPaths.cwd),o=t.map(v=>v.split(y__default.sep).join(y__default.posix.sep)),a=new Set(o),s=y__default.extname(e),c=s!=="",l=c?e.slice(0,-s.length):e,f=y__default.relative(n,l).split(y__default.sep).join(y__default.posix.sep),u=c?[s]:i,g=new Set;for(let v of u){let E=l+v,b=y__default.posix.normalize(y__default.relative(n,E));(a.has(b)||existsSync(E))&&g.add(b);let D=y__default.join(l,`index${v}`),C=y__default.posix.normalize(y__default.relative(n,D));(a.has(C)||existsSync(D))&&g.add(C);}let S=y__default.basename(l);for(let v of o)u.some(E=>v.endsWith(`/${S}${E}`))&&g.add(v);return g.size===0?null:Array.from(g).sort((v,E)=>{let b=y__default.posix.extname(v),D=y__default.posix.extname(E),C=u.indexOf(b)-u.indexOf(D);if(C!==0)return C;let J=f&&v.startsWith(f)?-1:1,Y=f&&E.startsWith(f)?-1:1;return J-Y})[0]}function Xr(e,t,r){let i=y__default.normalize(y__default.join(t.resolvedPaths.cwd,e)),n=Object.entries(t.resolvedPaths).filter(([,S])=>S&&i.startsWith(y__default.normalize(S+y__default.sep))).sort((S,h)=>h[1].length-S[1].length);if(n.length===0)return null;let[o,a]=n[0],s=y__default.relative(a,i);s=s.split(y__default.sep).join("/");let c=y__default.posix.extname(s),d=[".ts",".tsx",".js",".jsx"].includes(c)?"":c,f=s.slice(0,s.length-c.length);f.endsWith("/index")&&(f=f.slice(0,-6));let u=o==="cwd"?r.aliasPrefix:t.aliases[o];if(!u)return null;let g=f===""?"":`/${f}`;return g=g.replace("/src",""),`${u}${g}${d}`}async function we(e,t,r){r={overwrite:!1,silent:!1,isNewProject:!1,style:"index",...r};let i=await j(t);return i&&i.ui&&i.ui.resolvedPaths.cwd!==t.resolvedPaths.cwd?await Qr(e,t,i,{...r,isRemote:e?.length===1&&!!e[0].match(/\/chat\/b\//)}):await Hr(e,t,r)}async function Hr(e,t$1,r$1){let i=r("Checking registry.",{silent:r$1.silent})?.start(),n=await U(e,t$1);if(!n)return i?.fail(),s(new Error("Failed to fetch components from registry."));i?.succeed();let o=await p(t$1);await t(n.tailwind?.config,t$1,{silent:r$1.silent,tailwindVersion:o});let a=await Tt(e,t$1);await Fe(n.cssVars,t$1,{cleanupDefaultNextStyles:r$1.isNewProject,silent:r$1.silent,tailwindVersion:o,tailwindConfig:n.tailwind?.config,overwriteCssVars:a,initIndex:r$1.style?r$1.style==="index":!1}),await Ae(n.css,t$1,{silent:r$1.silent}),await Z(n.dependencies,n.devDependencies,t$1,{silent:r$1.silent}),await Ve(n.files,t$1,{overwrite:r$1.overwrite,silent:r$1.silent}),n.docs&&q.info(n.docs);}async function Qr(e,t$1,r$1,i){let n=r("Checking registry.",{silent:i.silent})?.start(),o=await X(e,t$1),a=await S(o),s$1=z.array(B).parse(a);if(!s$1)return n?.fail(),s(new Error("Failed to fetch components from registry."));n?.succeed();let c=Z$1(s$1),l$1=Y(),d=[],f=[],u=[],g=r("Installing components.")?.start();for(let h of s$1){let v=l$1.get(h.type),E=c.get(h.name);if(!v)continue;let b=h.type==="registry:ui"||E?.type==="registry:ui"?r$1.ui:t$1,D=await p(b),C=l(t$1.resolvedPaths.cwd,b.resolvedPaths.ui),J=await k(C,b.resolvedPaths.cwd)??b.resolvedPaths.cwd;if(h.tailwind?.config&&(await t(h.tailwind?.config,b,{silent:!0,tailwindVersion:D}),f.push(y__default.relative(C,b.resolvedPaths.tailwindConfig))),h.cssVars){let M=await Tt(e,t$1);await Fe(h.cssVars,b,{silent:!0,tailwindVersion:D,tailwindConfig:h.tailwind?.config,overwriteCssVars:M}),f.push(y__default.relative(C,b.resolvedPaths.tailwindCss));}h.css&&(await Ae(h.css,b,{silent:!0}),f.push(y__default.relative(C,b.resolvedPaths.tailwindCss))),await Z(h.dependencies,h.devDependencies,b,{silent:!0});let Y=await Ve(h.files,b,{overwrite:i.overwrite,silent:!0,rootSpinner:g,isRemote:i.isRemote});d.push(...Y.filesCreated.map(M=>y__default.relative(C,y__default.join(J,M)))),f.push(...Y.filesUpdated.map(M=>y__default.relative(C,y__default.join(J,M)))),u.push(...Y.filesSkipped.map(M=>y__default.relative(C,y__default.join(J,M))));}if(g?.succeed(),d.sort(),f.sort(),u.sort(),!(d.length||f.length)&&!u.length&&r("No files updated.",{silent:i.silent})?.info(),d.length){r(`Created ${d.length} ${d.length===1?"file":"files"}:`,{silent:i.silent})?.succeed();for(let h of d)q.log(` - ${h}`);}if(f.length){r(`Updated ${f.length} ${f.length===1?"file":"files"}:`,{silent:i.silent})?.info();for(let h of f)q.log(` - ${h}`);}if(u.length){r(`Skipped ${u.length} ${f.length===1?"file":"files"}: (use --overwrite to overwrite)`,{silent:i.silent})?.info();for(let h of u)q.log(` - ${h}`);}}async function Tt(e,t){let r=await X(e,t),i=await S(r);return z.array(B).parse(i).some(o=>o.type==="registry:theme"||o.type==="registry:style")}var ti="https://codeload.github.com/shadcn-ui/ui/tar.gz/main",W={next:"next","next-monorepo":"next-monorepo"};async function xe(e){e={srcDir:!1,...e};let t=e.template&&W[e.template]?e.template:"next",r=t===W.next?"my-app":"my-monorepo",i="latest",n=e.components?.length===1&&!!e.components[0].match(/\/chat\/b\//);if(e.components&&n)try{let[s]=await S(e.components),{meta:c}=z.object({meta:z.object({nextVersion:z.string()})}).parse(s);i=c.nextVersion,t=W.next;}catch(s$1){q.break(),s(s$1);}if(!e.force){let{type:s,name:c}=await ze([{type:e.template||n?null:"select",name:"type",message:`The path ${a.info(e.cwd)} does not contain a package.json file.
|
|
65
|
+
Would you like to start a new project?`,choices:[{title:"Next.js",value:"next"},{title:"Next.js (Monorepo)",value:"next-monorepo"}],initial:0},{type:"text",name:"name",message:"What is your project named?",initial:r,format:l=>l.trim(),validate:l=>l.length>128?"Name should be less than 128 characters.":!0}]);t=s??t,r=c;}let o=await le(e.cwd,{withFallback:!0}),a$1=`${e.cwd}/${r}`;try{await B$1.access(e.cwd,B$1.constants.W_OK);}catch{q.break(),q.error(`The path ${a.info(e.cwd)} is not writable.`),q.error(`It is likely you do not have write permissions for this folder or the path ${a.info(e.cwd)} does not exist.`),q.break(),process.exit(1);}return B$1.existsSync(y__default.resolve(e.cwd,r,"package.json"))&&(q.break(),q.error(`A project with the name ${a.info(r)} already exists.`),q.error("Please choose a different name and try again."),q.break(),process.exit(1)),t===W.next&&await ri(a$1,{version:i,cwd:e.cwd,packageManager:o,srcDir:!!e.srcDir}),t===W["next-monorepo"]&&await ii(a$1,{packageManager:o}),{projectPath:a$1,projectName:r,template:t}}async function ri(e,t){let r$1=r("Creating a new Next.js project. This may take a few minutes.").start(),i=["--tailwind","--eslint","--typescript","--app",t.srcDir?"--src-dir":"--no-src-dir","--no-import-alias",`--use-${t.packageManager}`];(t.version.startsWith("15")||t.version.startsWith("latest")||t.version.startsWith("canary"))&&i.push("--turbopack");try{await execa("npx",[`create-next-app@${t.version}`,e,"--silent",...i],{cwd:t.cwd});}catch{q.break(),q.error("Something went wrong creating a new Next.js project. Please try again."),process.exit(1);}r$1?.succeed("Creating a new Next.js project.");}async function ii(e,t){let r$1=r("Creating a new Next.js monorepo. This may take a few minutes.").start();try{let i=y__default.join(Zr.tmpdir(),`shadcn-template-${Date.now()}`);await B$1.ensureDir(i);let n=await fetch(ti);if(!n.ok)throw new Error(`Failed to download template: ${n.statusText}`);let o=y__default.resolve(i,"template.tar.gz");await B$1.writeFile(o,Buffer.from(await n.arrayBuffer())),await execa("tar",["-xzf",o,"-C",i,"--strip-components=2","ui-main/templates/monorepo-next"]);let a=y__default.resolve(i,"monorepo-next");await B$1.move(a,e),await B$1.remove(i),await execa(t.packageManager,["install"],{cwd:e});let s=process.cwd();await execa("git",["--version"],{cwd:e}),await execa("git",["init"],{cwd:e}),await execa("git",["add","-A"],{cwd:e}),await execa("git",["commit","-m","Initial commit"],{cwd:e}),await execa("cd",[s]),r$1?.succeed("Creating a new Next.js monorepo.");}catch(i){r$1?.fail("Something went wrong creating a new Next.js monorepo."),s(i);}}async function Ot(e,t,r$1){if(!e)return;r$1={silent:!1,...r$1};let i=y__default.relative(t.resolvedPaths.cwd,t.resolvedPaths.tailwindConfig),n=r(`Updating ${a.info(i)}`,{silent:r$1.silent}).start(),o=await promises.readFile(t.resolvedPaths.tailwindConfig,"utf8"),a$1=await oi(o,e,t);await promises.writeFile(t.resolvedPaths.tailwindConfig,a$1,"utf8"),n?.succeed();}async function oi(e,t,r){let i=await u(e,r),n=i.getDescendantsOfKind(SyntaxKind.ObjectLiteralExpression).find(o=>o.getProperties().some(a=>a.isKind(SyntaxKind.PropertyAssignment)&&a.getName()==="content"));return n?(si(n,t),i.getFullText()):e}async function si(e,t){let r=v(e),i=e.getProperty("content");if(!i){let n={name:"content",initializer:`[${r}${t.join(`${r}, ${r}`)}${r}]`};return e.addPropertyAssignment(n),e}if(i.isKind(SyntaxKind.PropertyAssignment)){let n=i.getInitializer();if(n?.isKind(SyntaxKind.ArrayLiteralExpression))for(let o of t){let a=`${r}${o}${r}`;n.getElements().map(s=>s.getText()).includes(a)||n.addElement(a);}return e}return e}var li=z.object({cwd:z.string(),components:z.array(z.string()).optional(),yes:z.boolean(),defaults:z.boolean(),force:z.boolean(),silent:z.boolean(),isNewProject:z.boolean(),srcDir:z.boolean().optional(),cssVariables:z.boolean(),template:z.string().optional().refine(e=>e?W[e]:!0,{message:"Invalid template. Please use 'next' or 'next-monorepo'."}),baseColor:z.string().optional().refine(e=>e?I.find(t=>t.name===e):!0,{message:`Invalid base color. Please use '${I.map(e=>e.name).join("', '")}'`}),style:z.string()}),Nt=new Command().name("init").description("initialize your project and install dependencies").argument("[components...]","the components to add or a url to the component.").option("-t, --template <template>","the template to use. (next, next-monorepo)").option("-b, --base-color <base-color>","the base color to use. (neutral, gray, zinc, stone, slate)",void 0).option("-y, --yes","skip confirmation prompt.",!0).option("-d, --defaults,","use default configuration.",!1).option("-f, --force","force overwrite of existing configuration.",!1).option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).option("-s, --silent","mute output.",!1).option("--src-dir","use the src directory when creating a new project.",!1).option("--no-src-dir","do not use the src directory when creating a new project.").option("--css-variables","use css variables for theming.",!0).option("--no-css-variables","do not use css variables for theming.").action(async(e,t)=>{try{let r=li.parse({cwd:y__default.resolve(t.cwd),isNewProject:!1,components:e,style:"index",...t});if(e.length>0&&W$1(e[0])){let i=await M(e[0],"");i?.type==="registry:style"&&(r.baseColor="neutral",r.style=i.extends??"index");}await Re(r),q.log(`${a.success("Success!")} Project initialization completed.
|
|
66
|
+
You may now add components.`),q.break();}catch(r){q.break(),s(r);}});async function Re(e){let t,r$1;if(e.skipPreflight)t=await n(e.cwd);else {let l=await gt(e);if(l.errors[O]){let{projectPath:d,template:f}=await xe(e);d||process.exit(1),e.cwd=d,e.isNewProject=!0,r$1=f;}t=l.projectInfo;}if(r$1==="next-monorepo")return e.cwd=y__default.resolve(e.cwd,"apps/web"),await h(e.cwd);let i$1=await o(e.cwd,t),n$1=i$1?await mi(i$1,e):await pi(await h(e.cwd));if(!e.yes){let{proceed:l}=await ze({type:"confirm",name:"proceed",message:`Write configuration to ${a.info("components.json")}. Proceed?`,initial:!0});l||process.exit(0);}let o$1=r("Writing components.json.").start(),a$1=y__default.resolve(e.cwd,"components.json");await promises.writeFile(a$1,JSON.stringify(n$1,null,2),"utf8"),o$1.succeed();let s=await i(e.cwd,n$1),c=[...e.style==="none"?[]:[e.style],...e.components??[]];return await we(c,s,{overwrite:!0,silent:e.silent,style:e.style,isNewProject:e.isNewProject||t?.framework.name==="next-app"}),e.isNewProject&&e.srcDir&&await Ot(["./src/**/*.{js,ts,jsx,tsx,mdx}"],s,{silent:e.silent}),s}async function pi(e$1=null){let[t,r]=await Promise.all([K$1(),N$1()]);q.info("");let i=await ze([{type:"toggle",name:"typescript",message:`Would you like to use ${a.info("TypeScript")} (recommended)?`,initial:e$1?.tsx??!0,active:"yes",inactive:"no"},{type:"select",name:"style",message:`Which ${a.info("style")} would you like to use?`,choices:t.map(n=>({title:n.label,value:n.name}))},{type:"select",name:"tailwindBaseColor",message:`Which color would you like to use as the ${a.info("base color")}?`,choices:r.map(n=>({title:n.label,value:n.name}))},{type:"text",name:"tailwindCss",message:`Where is your ${a.info("global CSS")} file?`,initial:e$1?.tailwind.css??e},{type:"toggle",name:"tailwindCssVariables",message:`Would you like to use ${a.info("CSS variables")} for theming?`,initial:e$1?.tailwind.cssVariables??!0,active:"yes",inactive:"no"},{type:"text",name:"tailwindPrefix",message:`Are you using a custom ${a.info("tailwind prefix eg. tw-")}? (Leave blank if not)`,initial:""},{type:"text",name:"tailwindConfig",message:`Where is your ${a.info("tailwind.config.js")} located?`,initial:e$1?.tailwind.config??f},{type:"text",name:"components",message:`Configure the import alias for ${a.info("components")}:`,initial:e$1?.aliases.components??c},{type:"text",name:"utils",message:`Configure the import alias for ${a.info("utils")}:`,initial:e$1?.aliases.utils??d},{type:"toggle",name:"rsc",message:`Are you using ${a.info("React Server Components")}?`,initial:e$1?.rsc??!0,active:"yes",inactive:"no"}]);return g.parse({$schema:"https://ui.shadcn.com/schema.json",style:i.style,tailwind:{config:i.tailwindConfig,css:i.tailwindCss,baseColor:i.tailwindBaseColor,cssVariables:i.tailwindCssVariables,prefix:i.tailwindPrefix},rsc:i.rsc,tsx:i.typescript,aliases:{utils:i.utils,components:i.components,lib:i.components.replace(/\/components$/,"lib"),hooks:i.components.replace(/\/components$/,"hooks")}})}async function mi(e,t){let r=e.style,i=t.baseColor,n=e.tailwind.cssVariables;if(!t.defaults){let[o,a$1,s]=await Promise.all([K$1(),N$1(),p(e)]),c=await ze([{type:s==="v4"?null:"select",name:"style",message:`Which ${a.info("style")} would you like to use?`,choices:o.map(l=>({title:l.name==="new-york"?"New York (Recommended)":l.label,value:l.name})),initial:0},{type:t.baseColor?null:"select",name:"tailwindBaseColor",message:`Which color would you like to use as the ${a.info("base color")}?`,choices:a$1.map(l=>({title:l.label,value:l.name}))}]);r=c.style??"new-york",i=c.tailwindBaseColor??i,n=t.cssVariables;}return g.parse({$schema:e?.$schema,style:r,tailwind:{...e?.tailwind,baseColor:i,cssVariables:n},rsc:e?.rsc,tsx:e?.tsx,aliases:e?.aliases,iconLibrary:e?.iconLibrary})}async function Dt(e){let t={};if(!B$1.existsSync(e.cwd)||!B$1.existsSync(y__default.resolve(e.cwd,"package.json")))return t[O]=!0,{errors:t,config:null};if(!B$1.existsSync(y__default.resolve(e.cwd,"components.json")))return t[F]=!0,{errors:t,config:null};try{let r=await h(e.cwd);return {errors:t,config:r}}catch{q.break(),q.error(`An invalid ${a.info("components.json")} file was found at ${a.info(e.cwd)}.
|
|
67
|
+
Before you can add components, you must create a valid ${a.info("components.json")} file by running the ${a.info("init")} command.`),q.error(`Learn more at ${a.info("https://ui.shadcn.com/docs/components-json")}.`),q.break(),process.exit(1);}}async function Ft(e,t){let r=y__default.join(t.resolvedPaths.cwd,"app/page.tsx");if(!(await te__default.stat(r)).isFile())return;let i=await M(e,t.style);if(!i?.meta?.importSpecifier||!i?.meta?.moduleSpecifier)return;let n=`import { ${i?.meta?.importSpecifier} } from "${i.meta.moduleSpecifier}"
|
|
67
68
|
|
|
68
69
|
export default function Page() {
|
|
69
70
|
return <${i?.meta?.importSpecifier} />
|
|
70
|
-
}`;await
|
|
71
|
-
Existing CSS variables and components will be overwritten. Continue?`)});c||(
|
|
72
|
-
Before you can run a migration, you must create a valid ${a.info("components.json")} file by running the ${a.info("init")} command.`),
|
|
71
|
+
}`;await te__default.writeFile(r,n,"utf8");}var Ue=[{name:"toast",deprecatedBy:"sonner",message:"The toast component is deprecated. Use the sonner component instead."},{name:"toaster",deprecatedBy:"sonner",message:"The toaster component is deprecated. Use the sonner component instead."}],ui=z.object({components:z.array(z.string()).optional(),yes:z.boolean(),overwrite:z.boolean(),cwd:z.string(),all:z.boolean(),path:z.string().optional(),silent:z.boolean(),srcDir:z.boolean().optional(),cssVariables:z.boolean()}),Vt=new Command().name("add").description("add a component to your project").argument("[components...]","the components to add or a url to the component.").option("-y, --yes","skip confirmation prompt.",!1).option("-o, --overwrite","overwrite existing files.",!1).option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).option("-a, --all","add all available components",!1).option("-p, --path <path>","the path to add the component to.").option("-s, --silent","mute output.",!1).option("--src-dir","use the src directory when creating a new project.",!1).option("--no-src-dir","do not use the src directory when creating a new project.").option("--css-variables","use css variables for theming.",!0).option("--no-css-variables","do not use css variables for theming.").action(async(e,t)=>{try{let r=ui.parse({components:e,cwd:y__default.resolve(t.cwd),...t}),i;if(e.length>0&&W$1(e[0])&&(i=(await M(e[0],""))?.type),!r.yes&&(i==="registry:style"||i==="registry:theme")){q.break();let{confirm:c}=await ze({type:"confirm",name:"confirm",message:a.warn(`You are about to install a new ${i.replace("registry:","")}.
|
|
72
|
+
Existing CSS variables and components will be overwritten. Continue?`)});c||(q.break(),q.log("Installation cancelled."),q.break(),process.exit(1));}if(r.components?.length||(r.components=await gi(r)),(await n(r.cwd))?.tailwindVersion==="v4"){let c=Ue.filter(l=>r.components?.includes(l.name));c?.length&&(q.break(),c.forEach(l=>{q.warn(a.warn(l.message));}),q.break(),process.exit(1));}let{errors:o,config:a$1}=await Dt(r);if(o[F]){let{proceed:c}=await ze({type:"confirm",name:"proceed",message:`You need to create a ${a.info("components.json")} file to add components. Proceed?`,initial:!0});c||(q.break(),process.exit(1)),a$1=await Re({cwd:r.cwd,yes:!0,force:!0,defaults:!1,skipPreflight:!1,silent:!0,isNewProject:!1,srcDir:r.srcDir,cssVariables:r.cssVariables,style:"index"});}let s=!1;if(o[O]){let{projectPath:c,template:l}=await xe({cwd:r.cwd,force:r.overwrite,srcDir:r.srcDir,components:r.components});c||(q.break(),process.exit(1)),r.cwd=c,l==="next-monorepo"?(r.cwd=y__default.resolve(r.cwd,"apps/web"),a$1=await h(r.cwd)):(a$1=await Re({cwd:r.cwd,yes:!0,force:!0,defaults:!1,skipPreflight:!0,silent:!0,isNewProject:!0,srcDir:r.srcDir,cssVariables:r.cssVariables,style:"index"}),s=r.components?.length===1&&!!r.components[0].match(/\/chat\/b\//));}if(!a$1)throw new Error(`Failed to read config at ${a.info(r.cwd)}.`);await we(r.components,a$1,r),s&&await Ft(r.components[0],a$1);}catch(r){q.break(),s(r);}});async function gi(e){let t=await J();if(!t)return q.break(),s(new Error("Failed to fetch registry index.")),[];if(e.all)return t.map(n=>n.name).filter(n=>!Ue.some(o=>o.name===n));if(e.components?.length)return e.components;let{components:r}=await ze({type:"multiselect",name:"components",message:"Which components would you like to add?",hint:"Space to select. A to toggle all. Enter to submit.",instructions:!1,choices:t.filter(n=>n.type==="registry:ui"&&!Ue.some(o=>o.name===n.name)).map(n=>({title:n.name,value:n.name,selected:e.all?!0:e.components?.includes(n.name)}))});r?.length||(q.warn("No components selected. Exiting."),q.info(""),process.exit(1));let i=z.array(z.string()).safeParse(r);return i.success?i.data:(q.error(""),s(new Error("Something went wrong. Please try again.")),[])}async function zt(e){let t={},r={cwd:e.cwd,registryFile:y__default.resolve(e.cwd,e.registryFile),outputDir:y__default.resolve(e.cwd,e.outputDir)};return B$1.existsSync(r.registryFile)||(t[$e]=!0),await B$1.mkdir(r.outputDir,{recursive:!0}),Object.keys(t).length>0&&(t[$e]&&(q.break(),q.error(`The path ${a.info(r.registryFile)} does not exist.`)),q.break(),process.exit(1)),{errors:t,resolvePaths:r}}var wi=z.object({cwd:z.string(),registryFile:z.string(),outputDir:z.string()}),Wt=new Command().name("build").description("build components for a shadcn registry").argument("[registry]","path to registry.json file","./registry.json").option("-o, --output <path>","destination directory for json files","./public/r").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).action(async(e,t)=>{try{let r$1=wi.parse({cwd:y.resolve(t.cwd),registryFile:e,outputDir:t.output}),{resolvePaths:i}=await zt(r$1),n=await te.readFile(i.registryFile,"utf-8"),o=C.safeParse(JSON.parse(n));o.success||(q.error(`Invalid registry file found at ${a.info(i.registryFile)}.`),process.exit(1));let a$1=r("Building registry...");for(let s of o.data.items){if(!s.files)continue;a$1.start(`Building ${s.name}...`),s.$schema="https://ui.shadcn.com/schema/registry-item.json";for(let l of s.files)l.content=await te.readFile(y.resolve(i.cwd,l.path),"utf-8");let c=B.safeParse(s);if(!c.success){q.error(`Invalid registry item found for ${a.info(s.name)}.`);continue}await te.writeFile(y.resolve(i.outputDir,`${c.data.name}.json`),JSON.stringify(c.data,null,2));}a$1.succeed("Building registry.");}catch(r){q.break(),s(r);}});var Ri=z.object({component:z.string().optional(),yes:z.boolean(),cwd:z.string(),path:z.string().optional()}),Ut=new Command().name("diff").description("check for updates against the registry").argument("[component]","the component name").option("-y, --yes","skip confirmation prompt.",!1).option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).action(async(e,t)=>{try{let r=Ri.parse({component:e,...t}),i=y__default.resolve(r.cwd);existsSync(i)||(q.error(`The path ${i} does not exist. Please try again.`),process.exit(1));let n=await h(i);n||(q.warn(`Configuration is missing. Please run ${a.success("init")} to create a components.json file.`),process.exit(1));let o=await J();if(o||(s(new Error("Failed to fetch registry index.")),process.exit(1)),!r.component){let c=n.resolvedPaths.components,l=o.filter(f=>{for(let u of f.files??[]){let g=y__default.resolve(c,typeof u=="string"?u:u.path);if(existsSync(g))return !0}return !1}),d=[];for(let f of l){let u=await Bt(f,n);u.length&&d.push({name:f.name,changes:u});}d.length||(q.info("No updates found."),process.exit(0)),q.info("The following components have updates available:");for(let f of d){q.info(`- ${f.name}`);for(let u of f.changes)q.info(` - ${u.filePath}`);}q.break(),q.info(`Run ${a.success("diff <component>")} to see the changes.`),process.exit(0);}let a$1=o.find(c=>c.name===r.component);a$1||(q.error(`The component ${a.success(r.component)} does not exist.`),process.exit(1));let s$1=await Bt(a$1,n);s$1.length||(q.info(`No updates found for ${r.component}.`),process.exit(0));for(let c of s$1)q.info(`- ${c.filePath}`),await Si(c.patch),q.info("");}catch(r){s(r);}});async function Bt(e,t){let r=await Q$1(t.style,[e]),i=await O$1(t.tailwind.baseColor);if(!r)return [];let n=[];for(let o of r){let a=await R(t,o);if(a)for(let s of o.files??[]){let c=y__default.resolve(a,typeof s=="string"?s:s.path);if(!existsSync(c))continue;let l=await promises.readFile(c,"utf8");if(typeof s=="string"||!s.content)continue;let d=await he({filename:s.path,raw:s.content,config:t,baseColor:i}),f=diffLines(d,l);f.length>1&&n.push({filePath:c,patch:f});}}return n}async function Si(e){e.forEach(t=>{if(t)return t.added?process.stdout.write(a.success(t.value)):t.removed?process.stdout.write(a.error(t.value)):process.stdout.write(t.value)});}var Kt=new Command().name("info").description("get information about your project").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).action(async e=>{q.info("> project info"),console.log(await n(e.cwd)),q.break(),q.info("> components.json"),console.log(await h(e.cwd));});async function Jt(e){if(!e.resolvedPaths.ui)throw new Error("We could not find a valid `ui` path in your `components.json` file. Please ensure you have a valid `ui` path in your `components.json` file.");let t=e.resolvedPaths.ui,[r$1,i]=await Promise.all([Pi("**/*.{js,ts,jsx,tsx}",{cwd:t}),L()]);if(Object.keys(i).length===0)throw new Error("Something went wrong fetching the registry icons.");let n=Object.entries(N).map(([d,f])=>({title:f.name,value:d})),o=await ze([{type:"select",name:"sourceLibrary",message:`Which icon library would you like to ${a.info("migrate from")}?`,choices:n},{type:"select",name:"targetLibrary",message:`Which icon library would you like to ${a.info("migrate to")}?`,choices:n}]);if(o.sourceLibrary===o.targetLibrary)throw new Error("You cannot migrate to the same icon library. Please choose a different icon library.");if(!(o.sourceLibrary in N&&o.targetLibrary in N))throw new Error("Invalid icon library. Please choose a valid icon library.");let a$1=N[o.sourceLibrary],s=N[o.targetLibrary],{confirm:c}=await ze({type:"confirm",name:"confirm",initial:!0,message:`We will migrate ${a.info(r$1.length)} files in ${a.info(`./${y__default.relative(e.resolvedPaths.cwd,t)}`)} from ${a.info(a$1.name)} to ${a.info(s.name)}. Continue?`});c||(q.info("Migration cancelled."),process.exit(0)),s.package&&await Z([s.package],[],e,{silent:!1});let l=r("Migrating icons...")?.start();await Promise.all(r$1.map(async d=>{l.text=`Migrating ${d}...`;let f=y__default.join(t,d),u=await promises.readFile(f,"utf-8"),g=await Ei(u,o.sourceLibrary,o.targetLibrary,i);await promises.writeFile(f,g);})),l.succeed("Migration complete.");}async function Ei(e,t,r,i){let n=N[t]?.import,o=N[r]?.import,a=await promises.mkdtemp(y__default.join(tmpdir(),"shadcn-")),s=new Project({compilerOptions:{}}),c=y__default.join(a,`shadcn-icons-${randomBytes(4).toString("hex")}.tsx`),l=s.createSourceFile(c,e,{scriptKind:ScriptKind.TSX}),d=[];for(let f of l.getImportDeclarations()??[])if(f.getModuleSpecifier()?.getText()===`"${n}"`){for(let u of f.getNamedImports()??[]){let g=u.getName(),S=Object.values(i).find(h=>h[t]===g)?.[r];!S||d.includes(S)||(d.push(S),u.remove(),l.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement).filter(h=>h.getTagNameNode()?.getText()===g).forEach(h=>h.getTagNameNode()?.replaceWithText(S)));}f.getNamedImports()?.length===0&&f.remove();}return d.length>0&&l.addImportDeclaration({moduleSpecifier:o,namedImports:d.map(f=>({name:f}))}),await l.getText()}async function qt(e){let t={};if(!B$1.existsSync(e.cwd)||!B$1.existsSync(y__default.resolve(e.cwd,"package.json")))return t[O]=!0,{errors:t,config:null};if(!B$1.existsSync(y__default.resolve(e.cwd,"components.json")))return t[F]=!0,{errors:t,config:null};try{let r=await h(e.cwd);return {errors:t,config:r}}catch{q.break(),q.error(`An invalid ${a.info("components.json")} file was found at ${a.info(e.cwd)}.
|
|
73
|
+
Before you can run a migration, you must create a valid ${a.info("components.json")} file by running the ${a.info("init")} command.`),q.error(`Learn more at ${a.info("https://ui.shadcn.com/docs/components-json")}.`),q.break(),process.exit(1);}}var Xt=[{name:"icons",description:"migrate your ui components to a different icon library."}],$i=z.object({cwd:z.string(),list:z.boolean(),migration:z.string().refine(e=>e&&Xt.some(t=>t.name===e),{message:"You must specify a valid migration. Run `shadcn migrate --list` to see available migrations."}).optional()}),Ht=new Command().name("migrate").description("run a migration.").argument("[migration]","the migration to run.").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).option("-l, --list","list all migrations.",!1).action(async(e,t)=>{try{let r=$i.parse({cwd:y__default.resolve(t.cwd),migration:e,list:t.list});if(r.list||!r.migration){q.info("Available migrations:");for(let o of Xt)q.info(`- ${o.name}: ${o.description}`);return}if(!r.migration)throw new Error("You must specify a migration. Run `shadcn migrate --list` to see available migrations.");let{errors:i,config:n}=await qt(r);if(i[O]||i[F])throw new Error("No `components.json` file found. Ensure you are at the root of your project.");if(!n)throw new Error("Something went wrong reading your `components.json` file. Please ensure you have a valid `components.json` file.");r.migration==="icons"&&await Jt(n);}catch(r){q.break(),s(r);}});var Qt={name:"shadcn",version:"2.5.0",description:"Add components to your apps.",publishConfig:{access:"public"},license:"MIT",author:{name:"shadcn",url:"https://twitter.com/shadcn"},repository:{type:"git",url:"https://github.com/shadcn/ui.git",directory:"packages/shadcn"},files:["dist"],keywords:["components","ui","tailwind","radix-ui","shadcn"],type:"module",exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"},"./registry":{types:"./dist/registry/index.d.ts",default:"./dist/registry/index.js"}},bin:"./dist/index.js",scripts:{dev:"tsup --watch",build:"tsup",typecheck:"tsc --noEmit",clean:"rimraf dist && rimraf components","start:dev":"cross-env REGISTRY_URL=http://localhost:3333/r node dist/index.js","start:prod":"cross-env REGISTRY_URL=https://ui.shadcn.com/r node dist/index.js",start:"node dist/index.js","format:write":'prettier --write "**/*.{ts,tsx,mdx}" --cache',"format:check":'prettier --check "**/*.{ts,tsx,mdx}" --cache',release:"changeset version","pub:beta":"pnpm build && pnpm publish --no-git-checks --access public --tag beta","pub:next":"pnpm build && pnpm publish --no-git-checks --access public --tag next","pub:release":"pnpm build && pnpm publish --access public",test:"vitest run","test:dev":"REGISTRY_URL=http://localhost:3333/r vitest run"},dependencies:{"@antfu/ni":"^23.2.0","@babel/core":"^7.22.1","@babel/parser":"^7.22.6","@babel/plugin-transform-typescript":"^7.22.5",commander:"^10.0.0",cosmiconfig:"^8.1.3",deepmerge:"^4.3.1",diff:"^5.1.0",execa:"^7.0.0","fast-glob":"^3.3.2","fs-extra":"^11.1.0","https-proxy-agent":"^6.2.0",kleur:"^4.1.5",msw:"^2.7.1","node-fetch":"^3.3.0",ora:"^6.1.2",postcss:"^8.4.24",prompts:"^2.4.2",recast:"^0.23.2","stringify-object":"^5.0.0","ts-morph":"^18.0.0","tsconfig-paths":"^4.2.0",zod:"^3.20.2"},devDependencies:{"@types/babel__core":"^7.20.1","@types/diff":"^5.0.3","@types/fs-extra":"^11.0.1","@types/prompts":"^2.4.2","@types/stringify-object":"^4.0.5",rimraf:"^6.0.1",tsup:"^6.6.3","type-fest":"^3.8.0",typescript:"^4.9.3"}};process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function Fi(){let e=new Command().name("shadcn").description("add components and dependencies to your project").version(Qt.version,"-v, --version","display the version number");e.addCommand(Nt).addCommand(Vt).addCommand(Ut).addCommand(Ht).addCommand(Kt).addCommand(Wt),e.parse();}Fi();
|
|
73
74
|
//# sourceMappingURL=out.js.map
|
|
74
75
|
//# sourceMappingURL=index.js.map
|