@sugarcube-sh/cli 0.0.2 → 0.0.4
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.
- package/dist/index.mjs +81 -78
- package/package.json +5 -4
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
2
|
+
var lt=Object.defineProperty;var s=(e,t)=>lt(e,"name",{value:t,configurable:!0});import{Command as U}from"commander";import{relative as N,join as $,basename as be,resolve as j,dirname as ut,isAbsolute as dt}from"pathe";import c from"picocolors";import{existsSync as D,readFileSync as ve}from"node:fs";import{z as y}from"zod";import oe,{mkdir as x,writeFile as Q,readFile as ke}from"node:fs/promises";import{execa as ft}from"execa";import{loadAndResolveTokens as pt,findResolverDocument as ae,loadInternalConfig as ee,isNoConfigError as $e,extractFileRefs as mt,configFileExists as Re,fillDefaults as _e,clearMatchCache as gt,processAndConvertTokens as ce,generateCSSVariables as Fe,writeCSSVariablesToDisk as Ce,writeCSSUtilitiesToDisk as Ne,convertConfigToUnoRules as ht,DEFAULT_CONFIG as le}from"@sugarcube-sh/core";import{select as wt,isCancel as ue,log as yt,multiselect as St,confirm as Tt,cancel as De}from"@clack/prompts";import{getColumns as It}from"@clack/core";import{wrapAnsi as Et}from"fast-wrap-ansi";import bt from"is-unicode-supported";import*as Oe from"node:readline";import Ae from"node:readline";import{createLogUpdate as Le}from"log-update";import de,{resolve as vt}from"node:path";import{detect as kt}from"@antfu/ni";import{createGenerator as $t}from"@unocss/core";import{glob as fe}from"tinyglobby";import{watch as Pe}from"chokidar";import{getTsconfig as Rt}from"get-tsconfig";var _t="0.0.4",Me={version:_t};const pe="fluid",Ft="**/*.json",Ue="@sugarcube-sh/vite",Ct="@sugarcube-sh/cli",Nt=20,O={INIT:"@sugarcube-sh/cli init",COMPONENTS:"@sugarcube-sh/cli components",CUBE:"@sugarcube-sh/cli cube"},R={INITIALIZATION:"https://sugarcube.sh/docs/getting-started",CONFIGURATION:"https://sugarcube.sh/docs/configuration",ISSUES:"https://github.com/sugarcube-sh/sugarcube/issues",RESOLVER:"https://sugarcube.sh/docs/resolver",DESIGN_TOKENS:"https://sugarcube.sh/docs/tokens",COMPONENTS_CLI:"https://sugarcube.sh/docs/reference/cli-commands/#components",HOMEPAGE:"https://sugarcube.sh"},h={PROJECT_REQUIRED:`No sugarcube project detected. Please run ${c.cyan(O.INIT)} first.
|
|
3
3
|
|
|
4
|
-
For more information, visit: ${c.cyan(
|
|
4
|
+
For more information, visit: ${c.cyan(R.INITIALIZATION)}`,CONFIG_EXISTS:s(()=>`A sugarcube config file already exists in this project.
|
|
5
5
|
|
|
6
|
-
To start over, remove it and run ${c.cyan(O.INIT)} again.`,"CONFIG_EXISTS"),PLUGIN_INSTALL_FAILED:
|
|
6
|
+
To start over, remove it and run ${c.cyan(O.INIT)} again.`,"CONFIG_EXISTS"),PLUGIN_INSTALL_FAILED:s(e=>{const t=e.packageManager==="npm"?"install":"add";return`Failed to install ${e.pluginToInstall} plugin.
|
|
7
7
|
|
|
8
8
|
This is usually a temporary issue. Try these steps:
|
|
9
9
|
|
|
@@ -12,7 +12,7 @@ This is usually a temporary issue. Try these steps:
|
|
|
12
12
|
3. Install manually: ${e.packageManager} ${t} ${e.pluginToInstall}
|
|
13
13
|
|
|
14
14
|
If the problem continues, please open an issue at:
|
|
15
|
-
${
|
|
15
|
+
${R.ISSUES}`},"PLUGIN_INSTALL_FAILED"),CLI_INSTALL_FAILED:s(e=>{const t=e.packageManager==="npm"?"install":"add";return`Failed to install @sugarcube-sh/cli.
|
|
16
16
|
|
|
17
17
|
This is usually a temporary issue. Try these steps:
|
|
18
18
|
|
|
@@ -21,30 +21,27 @@ This is usually a temporary issue. Try these steps:
|
|
|
21
21
|
3. Install manually: ${e.packageManager} ${t} -D @sugarcube-sh/cli
|
|
22
22
|
|
|
23
23
|
If the problem continues, please open an issue at:
|
|
24
|
-
${
|
|
24
|
+
${R.ISSUES}`},"CLI_INSTALL_FAILED"),INITIALIZATION_INCOMPLETE:s(()=>`The initialization process was not completed properly.
|
|
25
25
|
This is an internal error that should not occur.
|
|
26
26
|
Try running the \`init\` command again.
|
|
27
27
|
|
|
28
28
|
If the problem persists, please report this issue at
|
|
29
|
-
${
|
|
30
|
-
Value: "${t}"
|
|
29
|
+
${R.ISSUES}`,"INITIALIZATION_INCOMPLETE"),CONFIG_WRITE_FAILED:s(()=>"Failed to write configuration file. Check permissions and try again.","CONFIG_WRITE_FAILED"),KIT_INCOMPLETE:s(()=>`The starter kit appears to be incomplete or corrupted.
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
URL: ${c.cyan(e)}`,"
|
|
36
|
-
URL: ${c.cyan(
|
|
37
|
-
URL: ${c.cyan(e)}`,"REGISTRY_NOT_FOUND"),REGISTRY_REQUEST_FAILED:i((e,t)=>`Registry request failed: ${e}
|
|
38
|
-
URL: ${c.cyan(t)}`,"REGISTRY_REQUEST_FAILED"),REGISTRY_NETWORK_ERROR:i(e=>`Failed to connect to registry
|
|
31
|
+
This is likely a temporary issue. Please try running the command again or choose a different starter kit.`,"KIT_INCOMPLETE"),REGISTRY_AUTH_REQUIRED:s(e=>`Registry access denied: Authentication required
|
|
32
|
+
URL: ${c.cyan(e)}`,"REGISTRY_AUTH_REQUIRED"),REGISTRY_AUTH_INVALID:s(e=>`Registry access denied: Invalid or missing token
|
|
33
|
+
URL: ${c.cyan(e)}`,"REGISTRY_AUTH_INVALID"),REGISTRY_NOT_FOUND:s(e=>`Registry resource not found
|
|
34
|
+
URL: ${c.cyan(e)}`,"REGISTRY_NOT_FOUND"),REGISTRY_REQUEST_FAILED:s((e,t)=>`Registry request failed: ${e}
|
|
35
|
+
URL: ${c.cyan(t)}`,"REGISTRY_REQUEST_FAILED"),REGISTRY_NETWORK_ERROR:s(e=>`Failed to connect to registry
|
|
39
36
|
|
|
40
37
|
URL: ${c.cyan(e)}
|
|
41
38
|
|
|
42
|
-
The registry server may be temporarily unavailable or there might be network connectivity issues. Please try again in a few minutes.`,"REGISTRY_NETWORK_ERROR"),REGISTRY_INVALID_DATA:
|
|
43
|
-
URL: ${c.cyan(e)}`,"REGISTRY_INVALID_DATA"),REGISTRY_ITEM_NOT_FOUND:
|
|
44
|
-
Available ${e==="tokens"?"starter kit":e}s: ${n.join(", ")}`,"REGISTRY_ITEM_NOT_FOUND"),REGISTRY_FILE_INVALID:
|
|
45
|
-
File: ${c.cyan(e)}`,"REGISTRY_FILE_INVALID"),STARTER_KIT_UNAVAILABLE:
|
|
39
|
+
The registry server may be temporarily unavailable or there might be network connectivity issues. Please try again in a few minutes.`,"REGISTRY_NETWORK_ERROR"),REGISTRY_INVALID_DATA:s(e=>`Invalid registry data received
|
|
40
|
+
URL: ${c.cyan(e)}`,"REGISTRY_INVALID_DATA"),REGISTRY_ITEM_NOT_FOUND:s((e,t,n)=>`${e==="tokens"?"Starter kit":e}'${c.cyan(t)} ' not found in registry
|
|
41
|
+
Available ${e==="tokens"?"starter kit":e}s: ${n.join(", ")}`,"REGISTRY_ITEM_NOT_FOUND"),REGISTRY_FILE_INVALID:s(e=>`Invalid file content received
|
|
42
|
+
File: ${c.cyan(e)}`,"REGISTRY_FILE_INVALID"),STARTER_KIT_UNAVAILABLE:s(e=>`Starter kit '${c.cyan(e)}' is currently unavailable.
|
|
46
43
|
|
|
47
|
-
Please try a different starter kit or run the command again in a few minutes.`,"STARTER_KIT_UNAVAILABLE"),RESOLVER_NOT_CONFIGURED:
|
|
44
|
+
Please try a different starter kit or run the command again in a few minutes.`,"STARTER_KIT_UNAVAILABLE"),RESOLVER_NOT_CONFIGURED:s(()=>`No resolver path configured.
|
|
48
45
|
|
|
49
46
|
Add a resolver path to your sugarcube config:
|
|
50
47
|
|
|
@@ -53,105 +50,111 @@ ${c.cyan(`export default {
|
|
|
53
50
|
// ...
|
|
54
51
|
}`)}
|
|
55
52
|
|
|
56
|
-
See ${c.cyan(
|
|
53
|
+
See ${c.cyan(R.RESOLVER)} for more information.`,"RESOLVER_NOT_CONFIGURED"),RESOLVER_NOT_FOUND:s(e=>`No resolver document found in ${c.cyan(e)}.
|
|
57
54
|
|
|
58
55
|
A resolver document (*.resolver.json) is required to define how your tokens are loaded.
|
|
59
56
|
|
|
60
|
-
See ${c.cyan(
|
|
57
|
+
See ${c.cyan(R.RESOLVER)} to learn how to create one.`,"RESOLVER_NOT_FOUND"),RESOLVER_MULTIPLE_FOUND:s(e=>`Multiple resolver documents found:
|
|
61
58
|
${e.map(t=>` - ${c.cyan(t)}`).join(`
|
|
62
59
|
`)}
|
|
63
60
|
|
|
64
|
-
A project should have only one resolver document. Please remove the extras or consolidate them.`,"RESOLVER_MULTIPLE_FOUND"),TOKEN_LOAD_FAILED:
|
|
61
|
+
A project should have only one resolver document. Please remove the extras or consolidate them.`,"RESOLVER_MULTIPLE_FOUND"),TOKEN_LOAD_FAILED:s(e=>`Failed to load token files:
|
|
65
62
|
|
|
66
63
|
${e.join(`
|
|
67
64
|
`)}
|
|
68
65
|
|
|
69
|
-
Please check your token files and try again.`,"TOKEN_LOAD_FAILED"),TOKEN_VALIDATION_FAILED:
|
|
66
|
+
Please check your token files and try again.`,"TOKEN_LOAD_FAILED"),TOKEN_VALIDATION_FAILED:s(e=>{let t=`Token validation failed:
|
|
70
67
|
|
|
71
|
-
`;for(const[n,
|
|
72
|
-
`;for(const
|
|
68
|
+
`;for(const[n,r]of e){t+=`Error(s) in ${c.cyan(n)}:
|
|
69
|
+
`;for(const i of r)t+=` - ${i}
|
|
73
70
|
`;t+=`
|
|
74
|
-
`}return t+=`See ${c.cyan(
|
|
75
|
-
Please check your package manager configuration and try again.`,"DEPENDENCY_INSTALL_FAILED"),VALIDATE_NO_PATH_SPECIFIED:
|
|
71
|
+
`}return t+=`See ${c.cyan(R.DESIGN_TOKENS)} for valid token formats`,t},"TOKEN_VALIDATION_FAILED"),TOKEN_FILE_INVALID_JSON:s(e=>`File ${e}: Invalid JSON syntax`,"TOKEN_FILE_INVALID_JSON"),TOKEN_FILE_INCOMPLETE_JSON:s(e=>`File ${e}: Incomplete JSON file`,"TOKEN_FILE_INCOMPLETE_JSON"),TOKEN_FILE_GENERIC_ERROR:s((e,t)=>`File ${e}: ${t}`,"TOKEN_FILE_GENERIC_ERROR"),DEPENDENCY_INSTALL_FAILED:s(e=>`Failed to install dependencies using ${e}.
|
|
72
|
+
Please check your package manager configuration and try again.`,"DEPENDENCY_INSTALL_FAILED"),VALIDATE_NO_PATH_SPECIFIED:s(()=>`No path specified.
|
|
76
73
|
|
|
77
|
-
Run ${c.cyan("sugarcube validate --help")} for more information.`,"VALIDATE_NO_PATH_SPECIFIED"),VALIDATE_PATH_NOT_FOUND:
|
|
74
|
+
Run ${c.cyan("sugarcube validate --help")} for more information.`,"VALIDATE_NO_PATH_SPECIFIED"),VALIDATE_PATH_NOT_FOUND:s(e=>`Path not found: ${e}
|
|
78
75
|
|
|
79
|
-
Please check that the specified path exists`,"VALIDATE_PATH_NOT_FOUND"),VALIDATE_NO_TOKEN_FILES:
|
|
76
|
+
Please check that the specified path exists`,"VALIDATE_PATH_NOT_FOUND"),VALIDATE_NO_TOKEN_FILES:s(()=>`No token files found.
|
|
80
77
|
|
|
81
|
-
Please ensure the path contains .json token files`,"VALIDATE_NO_TOKEN_FILES"),COMPONENTS_FRAMEWORK_REQUIRED:
|
|
78
|
+
Please ensure the path contains .json token files`,"VALIDATE_NO_TOKEN_FILES"),COMPONENTS_FRAMEWORK_REQUIRED:s(()=>`Framework is required when specifying components. Use --framework to specify a framework (react, css-only) or run without arguments for interactive mode.
|
|
82
79
|
|
|
83
|
-
See ${c.cyan(
|
|
80
|
+
See ${c.cyan(R.COMPONENTS_CLI)} for more information.`,"COMPONENTS_FRAMEWORK_REQUIRED"),COMPONENTS_INVALID_FRAMEWORK:s(()=>"Invalid framework. Must be one of: react, css-only.","COMPONENTS_INVALID_FRAMEWORK"),COMPONENTS_DIRECTORY_NOT_CONFIGURED:s(()=>"Components directory must be configured in non-interactive mode. Please run the 'components' command without arguments first.","COMPONENTS_DIRECTORY_NOT_CONFIGURED"),PLUGIN_DETECTED:s(e=>`Plugin detected: ${e}
|
|
84
81
|
|
|
85
82
|
The 'generate' command is for manual generation without plugins. Since you have a plugin installed, use your development server instead:
|
|
86
83
|
|
|
87
84
|
npm run dev # or your framework's dev command
|
|
88
85
|
|
|
89
|
-
The plugin will automatically generate CSS with hot module replacement.`,"PLUGIN_DETECTED"),GENERATE_NO_CONFIG_OR_RESOLVER:
|
|
86
|
+
The plugin will automatically generate CSS with hot module replacement.`,"PLUGIN_DETECTED"),GENERATE_NO_CONFIG_OR_RESOLVER:s(()=>`No design tokens found.
|
|
90
87
|
|
|
91
88
|
Run ${c.cyan(O.INIT)} to set up your design tokens.
|
|
92
89
|
|
|
93
|
-
Stuck? ${c.cyan(
|
|
90
|
+
Stuck? ${c.cyan(R.HOMEPAGE)}`,"GENERATE_NO_CONFIG_OR_RESOLVER"),GENERATE_MULTIPLE_RESOLVERS_NO_CONFIG:s(e=>`No config file found, but multiple resolver files detected:
|
|
94
91
|
${e.map(t=>` - ${t}`).join(`
|
|
95
92
|
`)}
|
|
96
93
|
|
|
97
94
|
Please either:
|
|
98
95
|
- Create a config file with ${c.cyan(O.INIT)}
|
|
99
|
-
- Use --resolver flag to specify which resolver to use`,"GENERATE_MULTIPLE_RESOLVERS_NO_CONFIG")
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
- Use --resolver flag to specify which resolver to use`,"GENERATE_MULTIPLE_RESOLVERS_NO_CONFIG"),FILENAME_CONTAINS_PATH:s((e,t)=>`Invalid ${e} value: "${t}". Must be a filename, not a path.
|
|
97
|
+
|
|
98
|
+
Use --variables-dir or --utilities-dir to specify the directory.`,"FILENAME_CONTAINS_PATH")};class p extends Error{static{s(this,"CLIError")}constructor(t,n){super(t),this.name="CLIError",this.cause=n}}const me=y.enum(["react","web-components","css-only"]),je=y.object({path:y.string(),type:y.string()}),Dt=je.extend({framework:me}),Ot=y.object({name:y.string(),type:y.string(),description:y.string().optional(),frameworks:y.array(y.string()).optional(),files:y.array(y.union([Dt,je])),tokens:y.record(y.object({type:y.string(),mapping:y.string()})).optional(),dependencies:y.record(me,y.array(y.string())).optional(),registryDependencies:y.record(me,y.array(y.string())).optional(),tokenDependencies:y.array(y.string()).optional()}),At=y.array(Ot),Lt=y.object({content:y.string()}),Ge=process.env.REGISTRY_URL??"https://sugarcube.sh/r";async function We(e){try{const t=await fetch(e);if(!t.ok){if(t.status===401)throw new p(h.REGISTRY_AUTH_REQUIRED(e));if(t.status===403)throw new p(h.REGISTRY_AUTH_INVALID(e));if(t.status===404)throw new p(h.REGISTRY_NOT_FOUND(e));const n=await t.json().catch(()=>null),r=n&&typeof n=="object"&&"error"in n?String(n.error):t.statusText;throw new p(h.REGISTRY_REQUEST_FAILED(r,e))}return t.json()}catch(t){throw t instanceof p?t:new p(h.REGISTRY_NETWORK_ERROR(e))}}s(We,"fetchRegistry");async function G(){const e=`${Ge}/index.json`,t=await We(e);try{return At.parse(t)}catch{throw new p(h.REGISTRY_INVALID_DATA(e))}}s(G,"getRegistryIndex");async function ge({type:e,name:t,framework:n}){const r=await G(),i=r.find(l=>l.type===e&&l.name===t);if(!i){const l=r.filter(f=>f.type===e).map(f=>f.name);throw new p(h.REGISTRY_ITEM_NOT_FOUND(e,t,l))}let o=i.files;e==="component"&&n&&(o=i.files.filter(l=>"framework"in l&&l.framework===n));const a=await Promise.all(o.map(async l=>{const f=`${Ge}/${l.path}.json`,u=await We(f);try{const d=Lt.parse(u);return{path:l.path,type:l.type,framework:"framework"in l?l.framework:void 0,content:d.content}}catch{throw new p(h.REGISTRY_FILE_INVALID(l.path))}}));return{item:i,files:a}}s(ge,"getRegistryFiles");async function Pt(e){const t=await ge({type:"tokens",name:e});if(!t.files[0])throw new p(h.STARTER_KIT_UNAVAILABLE(e));return t}s(Pt,"fetchStarterKit");async function he(e,t,n){const r=[],i=new Set;async function o(a){if(i.has(a))return;i.add(a);const l=e.find(u=>u.name===a);if(!l){const u=e.filter(d=>d.type==="component").map(d=>d.name).join(", ");throw new p(`Component '${a}' not found in registry
|
|
99
|
+
Available components: ${u}`)}const f=l.registryDependencies?.[n]||[];for(const u of f)await o(u);r.push(l)}s(o,"resolveComponent");for(const a of t)await o(a);return r}s(he,"resolveTree");async function Mt({selectedComponents:e,componentType:t,componentsOutputDirectory:n}){const r={variableCSS:[],utilityCSS:[],componentFiles:[],componentCSS:[],cubeCSS:[],indexFiles:[]},i=await G(),a=(await he(i,e,t)).map(d=>d.name),l=i.filter(d=>d.type==="component").filter(d=>a.includes(d.name)),f=l.flatMap(d=>d.files.filter(m=>(m.type==="tsx"||m.type==="astro"||m.type==="njk")&&"framework"in m&&m.framework===t).map(m=>N(process.cwd(),$(n,d.name,`${d.name}.${m.type}`))));r.componentFiles=f.filter(d=>D($(process.cwd(),d)));const u=l.map(d=>{const m=d.name;return N(process.cwd(),$(n,d.name,`${m}.css`))});return r.componentCSS=u.filter(d=>D($(process.cwd(),d))),r}s(Mt,"collectComponentOverwriteWarnings");async function Ut({cubeDirectory:e}){const t={variableCSS:[],utilityCSS:[],componentFiles:[],componentCSS:[],cubeCSS:[],indexFiles:[]},r=(await G()).filter(i=>i.type==="cube").flatMap(i=>i.files).map(i=>{const o=i.path.replace(/^styles\//,"");return N(process.cwd(),$(e,o))});return t.cubeCSS=r.filter(i=>D($(process.cwd(),i))),t}s(Ut,"collectCubeOverwriteWarnings");function Be(e){const t=[];if(e.variableCSS.length>0&&t.push(`CSS variables files:
|
|
100
|
+
${e.variableCSS.map(r=>` - ${r}`).join(`
|
|
102
101
|
`)}`),e.utilityCSS.length>0&&t.push(`CSS utility files:
|
|
103
|
-
${e.utilityCSS.map(
|
|
102
|
+
${e.utilityCSS.map(r=>` - ${r}`).join(`
|
|
104
103
|
`)}`),e.cubeCSS.length>0&&t.push(`CUBE CSS files:
|
|
105
|
-
${e.cubeCSS.map(
|
|
106
|
-
`)}`),e.componentFiles.length>0||e.componentCSS.length>0){const
|
|
107
|
-
${
|
|
104
|
+
${e.cubeCSS.map(r=>` - ${r}`).join(`
|
|
105
|
+
`)}`),e.componentFiles.length>0||e.componentCSS.length>0){const r=[...e.componentFiles,...e.componentCSS];t.push(`Component files:
|
|
106
|
+
${r.map(i=>` - ${i}`).join(`
|
|
108
107
|
`)}`)}return e.indexFiles.length>0&&t.push(`Index files:
|
|
109
|
-
${e.indexFiles.map(
|
|
108
|
+
${e.indexFiles.map(r=>` - ${r}`).join(`
|
|
110
109
|
`)}`),t.length===0?void 0:`The following file(s) already exist and will be overwritten:
|
|
111
110
|
|
|
112
111
|
${t.join(`
|
|
113
112
|
|
|
114
|
-
`)}`}
|
|
113
|
+
`)}`}s(Be,"formatOverwriteWarnings");async function te(e,t,n,r={}){if(e.length===0)return;const{devDependency:i=!1}=r,o=n==="npm"?"install":"add",a=(()=>{if(!i)return[];switch(n){case"npm":return["--save-dev"];case"pnpm":return["-D"];case"yarn":return["-D"];case"bun":return["-d"]}})();try{await ft(n,[o,...a,...e],{cwd:t})}catch{throw new p(h.DEPENDENCY_INSTALL_FAILED(n))}}s(te,"installDependencies");async function jt(e,t,n){const r=$(n,t.name);if(await x(r,{recursive:!0}),e.path.endsWith(".css")){const o=$(r,`${t.name}.css`);return await Q(o,e.content),o}const i=$(r,be(e.path));return await Q(i,e.content),i}s(jt,"writeComponentFile");async function Gt({registryIndex:e,selectedComponents:t,componentType:n,componentsOutputDirectory:r,packageManager:i}){const o=[],a=new Set;await x(r,{recursive:!0});const l=await he(e,t,n);for(const f of l){const u=await ge({type:"component",name:f.name,framework:n});for(const m of u.files)if(m)try{const g=await jt(m,f,r);g&&o.push(g)}catch(g){const I=g instanceof Error?`: ${g.message}`:"";throw new p(`Failed to write component file for "${f.name}"${I}`)}const d=f.dependencies?.[n]||[];for(const m of d)a.add(m)}if(a.size>0)try{await te(Array.from(a),process.cwd(),i)}catch(f){const u=f instanceof Error?`: ${f.message}`:"";throw new p(`Failed to install component dependencies${u}`)}return{createdFiles:o,npmDependencies:a}}s(Gt,"installComponents");function Wt(e,t){const n=j(e),r=j(t),i=N(r,n);return!i.startsWith("..")&&!dt(i)}s(Wt,"isWithinDirectory");async function Bt(e){const t=[],n=j(process.cwd(),e);await x(n,{recursive:!0});const i=(await G()).filter(o=>o.type==="cube").map(o=>o.name);for(const o of i){const a=await ge({type:"cube",name:o});for(const l of a.files){if(!l)continue;const f=l.path.replace(/^styles\//,""),u=j(n,f);if(!Wt(u,n))throw new p(`Invalid file path detected in CUBE module "${o}": path escapes target directory`);const d=ut(u);try{await x(d,{recursive:!0}),await Q(u,l.content),t.push(u)}catch(m){const g=m instanceof Error?`: ${m.message}`:"";throw new p(`Failed to write CUBE module "${o}"${g}`)}}}return t}s(Bt,"installCUBE");async function Vt(e,t){await oe.mkdir(t,{recursive:!0});const n=[];for(const r of e)await oe.writeFile(r.path,r.content),n.push(r.path);return n}s(Vt,"writeTokenFiles");async function K(e,t){let n;if(t)n={type:"memory",data:t,config:e};else{if(!e.resolver)throw new p(h.RESOLVER_NOT_CONFIGURED());n={type:"resolver",resolverPath:e.resolver,config:e}}const{trees:r,resolved:i,modifiers:o,errors:a}=await pt(n);if(a.load.length>0){const l=a.load.map(f=>{const u=f.file.split("/").pop()||"unknown file";let d=`File ${u}: `;return f.message.includes("Unexpected token")?d=h.TOKEN_FILE_INVALID_JSON(u):f.message.includes("Unexpected end")?d=h.TOKEN_FILE_INCOMPLETE_JSON(u):d=h.TOKEN_FILE_GENERIC_ERROR(u,f.message),d});throw new p(h.TOKEN_LOAD_FAILED(l))}if(a.validation.length>0||a.flatten.length>0||a.resolution.length>0){const l=[...a.flatten,...a.validation,...a.resolution],f=new Map;for(const u of l)if(u.source?.sourcePath){const d=f.get(u.source.sourcePath)||[];d.push(u.message),f.set(u.source.sourcePath,d)}throw new p(h.TOKEN_VALIDATION_FAILED(f))}return{trees:r,resolved:i,modifiers:o}}s(K,"loadAndResolveTokensForCLI");const xt=s(async(e,t,n)=>{const r=await Pt(e),i=j(process.cwd(),t),o=r.files.map(a=>({path:$(i,be(a.path)),content:a.content}));return{config:n,tokenFiles:o,tokensDir:i,createdTokenPaths:o.map(a=>N(process.cwd(),a.path))}},"prepareStarterKitForInstall");async function Kt(e){const t=await xt(e.starterKit??"",e.tokensDir,e.config),n=await Vt(t.tokenFiles,e.tokensDir),r=await ae(e.tokensDir);if(r.found==="none")throw new p(h.RESOLVER_NOT_FOUND(e.tokensDir));if(r.found==="multiple")throw new p(h.RESOLVER_MULTIPLE_FOUND(r.paths));const i={...e.config,resolver:r.path},{trees:o,resolved:a}=await K(i);e.setupResult={config:i,createdTokenPaths:t.createdTokenPaths,trees:o,resolved:a,tokenFiles:t.tokenFiles,tokensDir:t.tokensDir},e.createdFiles.push(...n),e.config=i,e.sugarcubeConfig={...e.sugarcubeConfig,resolver:r.path}}s(Kt,"installFromStarterKit");async function Ve(e=!0){const t=[{label:"React",value:"react",hint:".tsx"},{label:"CSS Only",value:"css-only",hint:".css"},{label:c.dim("Web components"),value:"web-components",hint:"Coming soon!"}];e&&t.push({label:"Skip",value:"skip",hint:"continue without components"});const n=await wt({message:"Build with",options:t});return ue(n)&&process.exit(0),n==="web-components"?(yt.info(c.blue("Web components are coming soon! Please choose React or CSS Only for now.")),Ve(e)):n}s(Ve,"promptComponentFramework");async function Yt(e,t){const n=e.filter(i=>i.type==="component"&&i.frameworks?.includes(t)),r=await St({message:"Select components to add",options:n.map(i=>({label:i.name,value:i.name,hint:i.description})),required:!0});return ue(r)&&process.exit(0),r}s(Yt,"promptComponentSelectionFiltered");async function xe(e,t=!1){const n=await Tt({message:e,initialValue:t});return(!n||ue(n))&&(De(),process.exit(0)),!0}s(xe,"confirmOverwrite");function W(e){return{absolute:j(process.cwd(),e)}}s(W,"resolveDirectoryFromFlag");async function Ht(e){if(e){const{absolute:t}=W(e);return{directory:t}}try{const{config:t}=await ee(),n=t.output.cube||t.output.cssRoot,{absolute:r}=W(n);return{directory:r}}catch(t){if($e(t)){const{absolute:n}=W("src/styles");return{directory:n}}throw t}}s(Ht,"getCubeDir");async function zt(e){if(e){const{absolute:t}=W(e);return{directory:t}}try{const{config:t}=await ee(),n=t.output.components??"src/components/ui",{absolute:r}=W(n);return{directory:r}}catch(t){if($e(t)){const{absolute:n}=W("src/components/ui");return{directory:n}}throw t}}s(zt,"getComponentsDir");const Jt=bt(),E=s((e,t)=>Jt?e:t,"unicodeOr"),qt=E("\u25C7","o"),Ke=E("\u250C","T"),A=E("\u2502","|"),we=E("\u2514","\u2014"),Zt=E("\u2510","T"),Xt=E("\u2518","\u2014"),ne=E("\u2500","-"),Qt=E("\u256E","+"),en=E("\u256F","+"),tn=E("\u2570","+"),nn=E("\u256D","+"),sn=E("\u25CF","\u2022"),rn=E("\u25C6","*"),on=E("\u25B2","!"),an=E("\u25A0","x"),Y=s((e,t=c.bgGreen,n=c.black)=>t(` ${n(e)} `),"label"),H=s(e=>{const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),n=new RegExp(t,"g");return typeof e=="string"?e.replace(n,""):e},"strip"),z=s((e="",t)=>{process.stdout.write(`
|
|
115
114
|
|
|
116
|
-
${c.gray(
|
|
117
|
-
`)},"intro"),se=
|
|
118
|
-
${c.gray(
|
|
115
|
+
${c.gray(Ke)}${c.gray(ne)} ${e}
|
|
116
|
+
`)},"intro"),se=s((e="",t)=>{process.stdout.write(`${c.gray(A)}
|
|
117
|
+
${c.gray(we)}${c.gray(ne)} ${e}
|
|
119
118
|
|
|
120
|
-
`)},"outro");function B(e){return new Promise(t=>setTimeout(t,e))}
|
|
121
|
-
`);let V=
|
|
119
|
+
`)},"outro");function B(e){return new Promise(t=>setTimeout(t,e))}s(B,"sleep");const cn=[nn,Qt,tn,en],ln=[Ke,Zt,we,Xt];function Ye(e,t,n,r){let i=n,o=n;return r==="center"?i=Math.floor((t-e)/2):r==="right"&&(i=t-e-n),o=t-i-e,[i,o]}s(Ye,"getPaddingForLine");const un=s(e=>e,"defaultFormatBorder"),ye=s((e="",t="",n)=>{const r=n?.output??process.stdout,i=It(r),a=1*2,l=n?.titlePadding??1,f=n?.contentPadding??2,u=n?.width===void 0||n.width==="auto"?1:Math.min(1,n.width),d=n?.includePrefix?`${A} `:"",m=n?.formatBorder??un,g=(n?.rounded?cn:ln).map(m),I=m(ne),w=m(A),k=i-d.length;let v=Math.floor(i*u)-d.length;if(n?.width==="auto"){const Z=e.split(`
|
|
120
|
+
`);let V=H(t).length+l*2;for(const ct of Z){const Ee=H(ct).length+f*2;Ee>V&&(V=Ee)}const X=V+a;X<v&&(v=X)}v%2!==0&&(v<k?v++:v--);const b=v-a,C=b-l*2,S=H(t).length>C?`${t.slice(0,C-3)}...`:t,[_,F]=Ye(H(S).length,b,l,n?.titleAlign),L=Et(e,b-f*2,{hard:!0,trim:!1});r.write(`${d}${g[0]}${I.repeat(_)}${S}${I.repeat(F)}${g[1]}
|
|
122
121
|
`);const q=L.split(`
|
|
123
|
-
`);for(const Z of q){const[V,
|
|
124
|
-
`)}
|
|
125
|
-
`)},"box");function
|
|
126
|
-
${e}`;
|
|
127
|
-
${e}`;
|
|
128
|
-
${e}`;
|
|
129
|
-
`),"renderContent");
|
|
130
|
-
`))}else{const
|
|
131
|
-
`))}else
|
|
132
|
-
`));await B(1e3),
|
|
133
|
-
`),"rawLog"),
|
|
134
|
-
`);if(a.length>0){const[l,...f]=a;l&&l.length>0?o.push(`${t} ${l}`):o.push(t);for(const
|
|
122
|
+
`);for(const Z of q){const[V,X]=Ye(H(Z).length,b,f,n?.contentAlign);r.write(`${d}${w}${" ".repeat(V)}${Z}${" ".repeat(X)}${w}
|
|
123
|
+
`)}r.write(`${d}${g[2]}${I.repeat(b)}${g[3]}
|
|
124
|
+
`)},"box");function Se(e,t={}){const n=`
|
|
125
|
+
${e}`;ye(n,c.black(c.bgRed(" ERROR ")),{width:"auto",titlePadding:2,formatBorder:c.red,...t})}s(Se,"errorBoxWithBadge");function He(e,t={}){const n=`
|
|
126
|
+
${e}`;ye(n,c.black(c.bgYellow(" WARNING ")),{width:"auto",titlePadding:2,formatBorder:c.yellow,...t})}s(He,"warningBoxWithBadge");function dn(e,t={}){const n=`
|
|
127
|
+
${e}`;ye(n,c.black(c.bgCyan(" INFO ")),{width:"auto",titlePadding:2,formatBorder:c.cyan,...t})}s(dn,"infoBoxWithBadge");const fn=s((e,t)=>{if(!(e.meta&&e.name!=="escape")){if(e.ctrl){if(e.name==="a")return"first";if(e.name==="c"||e.name==="d")return"abort";if(e.name==="e")return"last";if(e.name==="g")return"reset"}return e.name==="return"||e.name==="enter"?"submit":e.name==="backspace"?"delete":e.name==="delete"?"deleteForward":e.name==="abort"?"abort":e.name==="escape"?"exit":e.name==="tab"?"next":e.name==="pagedown"?"nextPage":e.name==="pageup"?"prevPage":e.name==="home"?"home":e.name==="end"?"end":e.name==="up"?"up":e.name==="down"?"down":e.name==="right"?"right":e.name==="left"?"left":!1}},"action"),pn=s(async(e,t={})=>{const{sidebarSymbol:n=c.gray("\u2502"),clear:r=!1,stdin:i=process.stdin,stdout:o=process.stdout}=t,a=Ae.createInterface({input:i,escapeCodeTimeout:50}),l=Le(o,{showCursor:!1});Ae.emitKeypressEvents(i,a);let f=0,u=!1;const d=s(async()=>{i.off("keypress",m),i.isTTY&&i.setRawMode(!1),a.close(),u=!0,f<e.length-1||r?l.clear():l.done()},"done"),m=s((g,I)=>{i.isTTY&&i.setRawMode(!0);const w=fn(I);if(w==="abort")return d(),process.exit(0);["up","down","left","right"].includes(w)||d()},"handleKeyPress");i.isTTY&&i.setRawMode(!0),i.on("keypress",m);for(const g of e){const I=Array.isArray(g)?g:g.split(" "),w=[];for(const b of[""].concat(I)){b&&w.push(b);const C=w.join(" ").replace(/sugarcube/g,c.cyan("sugarcube")),S=`${n} ${C}`;l(S),u||await new Promise(_=>setTimeout(_,Math.floor(Math.random()*126)+75))}u||await new Promise(b=>setTimeout(b,100));const v=(await Promise.all(I).then(b=>b.join(" "))).replace(/sugarcube/g,c.cyan("sugarcube"));l(`${n} ${v}`),u||await new Promise(b=>setTimeout(b,Math.floor(Math.random()*201)+1200)),f++}i.off("keypress",m),await new Promise(g=>setTimeout(g,100)),d(),i.isTTY&&i.setRawMode(!1),i.removeAllListeners("keypress")},"sayAnimatedInSidebar");function mn(){return Math.floor(Math.random()*551)+200}s(mn,"getRandomTaskDuration");async function gn(e,{sidebarSymbol:t="\u2502",spacing:n=1,stdin:r=process.stdin,stdout:i=process.stdout,initialDelayMs:o=200,minDurationMs:a,successPauseMs:l=300,successMessage:f,successAsOutro:u=!1}={}){const d=s((S,_)=>{let F="";switch(_){case"start":F=`${c.cyan(`\u25B6 ${S.start}`)}`;break;case"pending":F=`${c.dim(`\u25A1 ${S.pending}`)}`;break;case"success":F=`${c.green(`\u2714 ${S.end}`)}`;break;case"end":F=`${c.dim(`\u25A0 ${S.end}`)}`;break}return`${t} ${F}`},"formatWithSidebar"),m=Array.from({length:e.length},()=>"");e.forEach((S,_)=>{m[_]=d(S,"pending")});const g=Le(i),I=Oe.createInterface({input:r,escapeCodeTimeout:50});Oe.emitKeypressEvents(r,I);const w=s(S=>{S===""&&(g.clear(),I.close(),r.isTTY&&r.setRawMode(!1),process.exit(0)),r.isTTY&&r.setRawMode(!0)},"keypress");r.isTTY&&r.setRawMode(!0),r.on("keypress",w);const k=Array.from({length:Math.max(n,0)},()=>`${t}`),v=s(()=>[...k,...m].join(`
|
|
128
|
+
`),"renderContent");g(v()),await B(o);let b=0;for(const S of e){m[b]=d(S,"start"),g(v());const _=Date.now(),F=S.while();try{await F;const L=Date.now()-_,q=typeof a=="number"?a:mn();L<q&&await B(q-L),m[b]=d(S,"success"),g(v()),await B(l)}catch(L){throw m[b]=`${t} ${c.red(`\u2717 ${S.end} (failed)`)}`,g(v()),S.onError?.(L),r.removeListener("keypress",w),I.close(),r.isTTY&&r.setRawMode(!1),L}b++}const C=e.map(S=>d(S,"end"));if(f)if(u){const S=`${c.gray(we)}${c.gray(ne)} ${c.green(f)}`;g([...k,...C,`${t}`,S].join(`
|
|
129
|
+
`))}else{const S=`${t} ${c.green(f)}`;g([...k,...C,`${t}`,S].join(`
|
|
130
|
+
`))}else g([...k,...C].join(`
|
|
131
|
+
`));await B(1e3),r.removeListener("keypress",w),r.isTTY&&r.setRawMode(!1),I.close(),g.done()}s(gn,"executeTasksInSidebar");const hn=s(e=>process.stdout.write(`${e}
|
|
132
|
+
`),"rawLog"),T={message:s((e=[],{symbol:t=c.gray(A),secondarySymbol:n=c.gray(A),output:r=process.stdout,spacing:i=1}={})=>{const o=[];for(let l=0;l<i;l++)o.push(`${n}`);const a=Array.isArray(e)?e:e.split(`
|
|
133
|
+
`);if(a.length>0){const[l,...f]=a;l&&l.length>0?o.push(`${t} ${l}`):o.push(t);for(const u of f)u.length>0?o.push(`${n} ${u}`):o.push(n)}r.write(`${o.join(`
|
|
135
134
|
`)}
|
|
136
|
-
`)},"message"),info:
|
|
137
|
-
`)},"space"),break:
|
|
138
|
-
`)},"break")};function J(e){if(e instanceof p)
|
|
139
|
-
|
|
140
|
-
If this issue persists, please report it: ${c.cyan("https://github.com/sugarcube-sh/sugarcube/issues")}`;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
`),{css:
|
|
144
|
-
|
|
135
|
+
`)},"message"),info:s((e,t)=>{T.message(e,{...t,symbol:c.blue(sn)})},"info"),success:s((e,t)=>{T.message(e,{...t,symbol:c.green(rn)})},"success"),step:s((e,t)=>{T.message(e,{...t,symbol:c.green(qt)})},"step"),warn:s((e,t)=>{T.message(e,{...t,symbol:c.yellow(on)})},"warn"),error:s((e,t)=>{T.message(e,{...t,symbol:c.red(an)})},"error"),animated:s(async(e,{secondarySymbol:t=c.gray(A),output:n=process.stdout,clear:r=!1,...i}={})=>pn(e,{sidebarSymbol:t,stdout:n,clear:r,...i}),"animated"),tasks:s(async(e,{spacing:t=1,secondarySymbol:n=c.gray(A),output:r=process.stdout,...i}={})=>gn(e,{sidebarSymbol:n,spacing:t,stdout:r,...i}),"tasks"),space:s((e=1)=>{for(let t=0;t<e;t++)process.stdout.write(`${c.gray(A)}
|
|
136
|
+
`)},"space"),break:s((e=1)=>{for(let t=0;t<e;t++)process.stdout.write(`
|
|
137
|
+
`)},"break")};function J(e){if(e instanceof p)T.space(1),Se(e.message,{});else{const t=`An unexpected error occurred: ${e instanceof Error?e.message:String(e)}
|
|
138
|
+
|
|
139
|
+
If this issue persists, please report it: ${c.cyan("https://github.com/sugarcube-sh/sugarcube/issues")}`;T.space(1),Se(t,{})}process.exit(1)}s(J,"handleError");function P(e,t=process.cwd()){try{const n=vt(t,"package.json");if(!D(n))return!1;const r=ve(n,"utf-8"),i=JSON.parse(r),o={...i.dependencies,...i.devDependencies,...i.peerDependencies};return e in o}catch{return!1}}s(P,"isPackageInstalled");async function ze(e,{withFallback:t=!1}={}){const n=await kt({programmatic:!0,cwd:e});if(n?.includes("yarn"))return"yarn";if(n?.includes("pnpm"))return"pnpm";if(n?.includes("bun"))return"bun";if(n?.includes("npm"))return"npm";if(t){const r=process.env.npm_config_user_agent||"";if(r.includes("yarn"))return"yarn";if(r.includes("pnpm"))return"pnpm";if(r.includes("bun"))return"bun"}return"npm"}s(ze,"getPackageManager");const wn=new U().name("components").description("Add components to your project").argument("[components...]","Components to add (e.g., button card)").option("-f, --framework <type>","Framework to use (react, css-only)").option("--components-dir <dir>","Components output directory (e.g., 'src/components')").option("-s, --silent","Suppress logs and prompts").option("-o, --overwrite","Overwrite existing files").action(async(e,t)=>{try{t.silent||z(Y(c.bgGreen(c.black("Components"))));const{directory:n}=await zt(t.componentsDir);let r=[],i;if(e.length>0||t.framework){if(!t.framework)throw new p(h.COMPONENTS_FRAMEWORK_REQUIRED());if(!["react","css-only"].includes(t.framework))throw new p(h.COMPONENTS_INVALID_FRAMEWORK());i=t.framework,r=e}else{i=await Ve(!1);const w=await G();w||(De("Failed to fetch component list"),process.exit(1)),r=await Yt(w,i)}const o=await ze(process.cwd(),{withFallback:!0}),a=await G(),l=await he(a,r,i),f=await Mt({selectedComponents:r,componentType:i,componentsOutputDirectory:n}),u=Be(f);if(u&&!t.force&&!t.silent){const w=He(u,{});T.space(1),await xe("Continue?",!1)}const d=[],m=[],g=new Set;for(const w of l){const k=w.dependencies?.[i]||[];for(const v of k)g.add(v)}const I=Array.from(g).filter(w=>!P(w,process.cwd()));I.length>0&&d.push({pending:`Install ${I.length} dependencies`,start:`Installing ${I.join(", ")}...`,end:`Installed ${I.join(", ")}`,while:s(async()=>{await te(I,process.cwd(),o)},"while")});for(const w of l)d.push({pending:`Write component files for ${w.name}`,start:`Writing component files for ${w.name}...`,end:`Wrote component files for ${w.name}`,while:s(async()=>{const k=await Gt({registryIndex:a,selectedComponents:[w.name],componentType:i,componentsOutputDirectory:n,overwrite:t.overwrite||!1,packageManager:o});m.push(...k.createdFiles)},"while")});await T.tasks(d,{successMessage:"Components added successfully! \u{1F389} ",minDurationMs:0,successAsOutro:!0}),hn("")}catch(n){J(n)}}),yn=new U().name("cube").description("Add CUBE CSS to your project").option("-s, --silent","Suppress logs and prompts").option("-f, --force","Skip overwrite confirmation").option("--cube-dir <dir>","CUBE CSS output directory (defaults to cssRoot)").action(async e=>{try{e.silent||z(Y("CUBE CSS"));const{directory:t}=await Ht(e.cubeDir);try{await x(t,{recursive:!0})}catch(o){const a=o instanceof Error?`: ${o.message}`:"";throw new p(`Failed to create output directory${a}`)}const n=await Ut({cubeDirectory:t}),r=Be(n);if(r&&!e.force&&!e.silent){T.space(1);const o=He(r,{});await xe("Continue?",!1)}const i=await Bt(t);if(!e.silent){T.space(1);const o=i,f=[...new Set(o)].map(u=>N(process.cwd(),u)).map(u=>({pending:`Write ${u}`,start:`Writing ${u}`,end:`Wrote ${u}`,while:s(async()=>{},"while")}));await T.tasks(f,{spacing:0,minDurationMs:0,successPauseMs:100,successMessage:"\u{1F389} Files written!"}),se(c.green("CUBE added successfully."))}}catch(t){J(t)}}),Je=new Set(["html","htm","js","ts","jsx","tsx","vue","svelte","astro","php","njk","liquid","pug","hbs","handlebars","twig","erb","ejs"]),qe=new Set(["node_modules","dist","build",".next",".nuxt",".astro",".git","coverage",".pnpm",".pnpm-store",".npm",".cache",".turbo",".vercel",".svelte-kit","out","__snapshots__"]),Sn=[...Array.from(qe,e=>`**/${e}/**`),"**/*.config.{js,ts,mjs}","**/*.min.js","**/*.bundle.js","**/*.d.ts"],Tn=`**/*.{${[...Je].join(",")}}`,Ze=1e4,Xe=100,In=Xe*1024*1024;async function En(){const e=await fe([Tn],{ignore:Sn,dot:!1,onlyFiles:!0,absolute:!1});if(e.length>Ze)throw new p(`Found ${e.length} files to scan (limit: ${Ze}). Are you running this from a monorepo root or a directory containing multiple projects? Run the command from within a single project directory instead.`);return e}s(En,"getMarkupFiles");async function bn(e){const t=[];let n=0;for(const r of e){const i=await ke(r,"utf8");if(n+=i.length,n>In)throw new p(`Total source size exceeds ${Xe}MB. Are you running this from a monorepo root or a directory containing multiple projects? Run the command from within a single project directory instead.`);t.push(i)}return t}s(bn,"readMarkupSources");function re(e,t){if(e&&(e.includes("/")||e.includes("\\")))throw new p(h.FILENAME_CONTAINS_PATH(t,e))}s(re,"validateFilename");function vn(e,t){let n;const r=s((...i)=>{n&&clearTimeout(n),n=setTimeout(()=>{n=void 0,e(...i)},t)},"debounced");return r.cancel=()=>{n&&(clearTimeout(n),n=void 0)},r}s(vn,"debounce");async function kn(e,t){if(!e.resolver)throw new Error("Resolver path is required for watch mode");const{filePaths:n,resolverPath:r}=await mt(e.resolver),i=[r,...n],o=vn(async u=>{try{await t.onRegenerate(u)}catch(d){t.onError(d instanceof Error?d:new Error(String(d)))}},100),a=Pe(i,{ignoreInitial:!0,awaitWriteFinish:{stabilityThreshold:50,pollInterval:10}}),l=Pe(".",{ignoreInitial:!0,ignored:s((u,d)=>{const m=u.split("/");for(const g of m)if(qe.has(g))return!0;if(d?.isFile()){const g=$n(u);return!Je.has(g)}return!1},"ignored"),awaitWriteFinish:{stabilityThreshold:50,pollInterval:10}}),f=s(u=>{o(u)},"handleChange");return a.on("change",f),a.on("add",f),a.on("unlink",f),l.on("change",f),l.on("add",f),l.on("unlink",f),await Promise.all([new Promise(u=>a.once("ready",u)),new Promise(u=>l.once("ready",u))]),t.onReady(i.length),{close:s(async()=>{o.cancel(),await Promise.all([a.close(),l.close()])},"close")}}s(kn,"startWatcher");function $n(e){const t=e.lastIndexOf(".");return t===-1?"":e.slice(t+1).toLowerCase()}s($n,"getExtension");const Rn=`/* Generated by @sugarcube-sh/cli v${Me.version} */
|
|
140
|
+
|
|
141
|
+
`;function ie(e,t){return e?Number.parseInt(e,10):t}s(ie,"parseFluidValue");function _n(e){if(!(!e.fluidMin&&!e.fluidMax))return{min:ie(e.fluidMin,320),max:ie(e.fluidMax,1200)}}s(_n,"buildFluidConfig");function Fn(e){const t={resolver:e.resolver,output:{cssRoot:e.stylesDir,variables:e.variablesDir,variablesFilename:e.variablesFilename,utilities:e.utilitiesDir,utilitiesFilename:e.utilitiesFilename},transforms:{fluid:_n(e),colorFallbackStrategy:e.colorFallback}};return _e(t)}s(Fn,"buildConfigFromFlags");function Cn(e,t){return{...e,resolver:t.resolver??e.resolver,transforms:{fluid:{min:ie(t.fluidMin,e.transforms.fluid.min),max:ie(t.fluidMax,e.transforms.fluid.max)},colorFallbackStrategy:t.colorFallback??e.transforms.colorFallbackStrategy},output:{...e.output,cssRoot:t.stylesDir??e.output.cssRoot,variables:t.variablesDir??e.output.variables,variablesFilename:t.variablesFilename??e.output.variablesFilename,utilities:t.utilitiesDir??e.output.utilities,utilitiesFilename:t.utilitiesFilename??e.output.utilitiesFilename}}}s(Cn,"mergeConfigWithFlags");function Nn(e){return!!(e.resolver||e.stylesDir||e.variablesDir||e.variablesFilename||e.utilitiesDir||e.utilitiesFilename||e.fluidMin||e.fluidMax||e.colorFallback)}s(Nn,"hasConfigFlags");async function Dn(e){if(Re()){const{config:r}=await ee();return Cn(r,e)}const t=await ae(process.cwd());if(t.found==="multiple")throw new p(h.GENERATE_MULTIPLE_RESOLVERS_NO_CONFIG(t.paths));const n=e.resolver??(t.found==="one"?t.path:void 0);if(n||Nn(e))return Fn({...e,resolver:n});throw new p(h.GENERATE_NO_CONFIG_OR_RESOLVER())}s(Dn,"resolveConfig");function Qe(e){const t=e.map(r=>r.path);return[...new Set(t)].map(r=>N(process.cwd(),r))}s(Qe,"formatOutputPaths");async function et(e,t){if(!t.utilities||Object.keys(t.utilities).length===0)return[];const r={presets:[{name:"sugarcube",rules:ht(t.utilities,e),preflights:[]}]},i=await $t(r),o=await En();if(o.length===0)return[];const l=(await bn(o)).join(`
|
|
142
|
+
`),{css:f}=await i.generate(l,{preflights:!1});return f?.trim()?[{path:`${t.output.utilities}/${t.output.utilitiesFilename}`,css:f}]:[]}s(et,"generateSugarcubeUtilities");function tt(e){return e.map(t=>({...t,css:Rn+t.css}))}s(tt,"addBanner");function nt(e,t){return e.map(n=>{const r=n.css.split(`
|
|
143
|
+
`).map(i=>i.trim()?` ${i}`:i).join(`
|
|
144
|
+
`);return{...n,css:`@layer ${t} {
|
|
145
|
+
${r}}
|
|
146
|
+
`}})}s(nt,"wrapInLayer$1");async function On(e,t,n,r){const i=[],o=n.output.layers,a=await ce(e,t,n);let l=await Fe(a,n,r);o&&(l=nt(l,o.variables));const f=tt(l);await Ce(f),i.push(...f);let u=await et(a,n);o&&(u=nt(u,o.utilities));const d=tt(u);return await Ne(d),i.push(...d),i}s(On,"generateAllCSS");async function Te(e){gt();const{trees:t,resolved:n,modifiers:r}=await K(e);return On(t,n,e,r)}s(Te,"runGeneration");async function An(e){const t=e.map(n=>({pending:`Write ${n}`,start:`Writing ${n}`,end:`Wrote ${n}`,while:s(async()=>{},"while")}));await T.tasks(t,{spacing:1,minDurationMs:0,successPauseMs:100,successMessage:"\u{1F389} Files written!"}),T.space(1),se(c.green("CSS generated successfully."))}s(An,"logOneTimeResult");async function Ln(e,t){const n=await Te(e);t.silent||await An(Qe(n))}s(Ln,"runOneTimeGeneration");async function Pn(e,t){const n=c.cyan("[sugarcube]"),r=performance.now();await Te(e);const i=Math.round(performance.now()-r);console.log(`${n} Generated in ${i}ms`);const o=await kn(e,{onRegenerate:s(async a=>{const l=performance.now(),f=await Te(e),u=Math.round(performance.now()-l),d=a.split("/").pop()??a,m=Qe(f);console.log(`${n} ${c.dim(d)} \u2192 ${m.join(", ")} ${c.dim(`(${u}ms)`)}`)},"onRegenerate"),onError:s(a=>{console.log(`${c.red("[sugarcube]")} ${a.message}`)},"onError"),onReady:s(a=>{console.log(`${n} Watching ${a} token file${a===1?"":"s"} + markup files...`)},"onReady")});process.on("SIGINT",async()=>{await o.close(),console.log(`${n} Watch mode stopped.`),process.exit(0)}),await new Promise(()=>{})}s(Pn,"runWatchMode");const Mn=new U().name("generate").description("Generate CSS from your design tokens").option("--force","Skip overwrite confirmation").option("-s, --silent","Suppress logs and prompts").option("-w, --watch","Watch for changes and regenerate automatically").option("--resolver <path>","Path to token resolver file (.resolver.json)").option("--styles-dir <dir>","CSS output directory (default: 'src/styles')").option("--variables-dir <dir>","Token variables output directory (default: 'src/styles/global')").option("--variables-filename <name>","Token variables filename (default: 'tokens.variables.gen.css')").option("--utilities-dir <dir>","Utilities output directory (default: 'src/styles/utilities')").option("--utilities-filename <name>","Utilities filename (default: 'utilities.gen.css')").option("--fluid-min <number>","Minimum viewport width for fluid scaling (default: 320)").option("--fluid-max <number>","Maximum viewport width for fluid scaling (default: 1200)").option("--color-fallback <strategy>","Color fallback strategy: 'native' or 'polyfill' (default: native)").action(async e=>{try{if(!e.silent&&!e.watch&&z(Y("Generate CSS")),re(e.variablesFilename,"--variables-filename"),re(e.utilitiesFilename,"--utilities-filename"),P("@sugarcube-sh/vite"))throw new p("Sugarcube vite plugin detected. When using the plugin, CSS is generated automatically during your build process. Remove the plugin to use CLI generation instead.");const t=await Dn(e);await(e.watch?Pn:Ln)(t,e)}catch(t){J(t)}});async function Un(e){const t={};return(e.stylesDir||e.variablesDir||e.variablesFilename||e.utilitiesDir||e.utilitiesFilename)&&(t.output={},e.stylesDir&&(t.output.cssRoot=e.stylesDir),e.variablesDir&&(t.output.variables=e.variablesDir),e.variablesFilename&&(t.output.variablesFilename=e.variablesFilename),e.utilitiesDir&&(t.output.utilities=e.utilitiesDir),e.utilitiesFilename&&(t.output.utilitiesFilename=e.utilitiesFilename)),(e.fluidMin!==void 0||e.colorFallback)&&(t.transforms={},e.fluidMin!==void 0&&e.fluidMax!==void 0&&(t.transforms.fluid={min:Number(e.fluidMin),max:Number(e.fluidMax)}),e.colorFallback&&(t.transforms.colorFallbackStrategy=e.colorFallback)),t}s(Un,"buildSugarcubeConfig");function st(e){try{const t=de.resolve(e,"package.json");if(!D(t))return null;const n=ve(t,"utf-8");return JSON.parse(n)}catch{return null}}s(st,"getPackageJson");function M(e,t){if(!e)return!1;const n=e.dependencies,r=e.devDependencies;return!!(n?.[t]||r?.[t])}s(M,"hasDependency");function jn(e,t){if(!e)return!1;const n=e.dependencies,r=e.devDependencies,i={...n,...r};return Object.keys(i).some(o=>o.startsWith(t))}s(jn,"hasDependencyStartingWith");function Gn(e){const t=D(de.resolve(e,"src")),n=st(e),r=t?"src/design-tokens":"design-tokens",i=t?"src/styles":"styles",o=t?"src/components":"components";let a="none";return M(n,"next")?a=D(de.resolve(e,`${t?"src/":""}app`))?"next-app":"next-pages":M(n,"astro")?a="astro":M(n,"nuxt")?a="nuxt":M(n,"@sveltejs/kit")?a="sveltekit":jn(n,"@remix-run/")?a="remix":M(n,"@11ty/eleventy")?a="eleventy":M(n,"vite")&&(a="vite"),{framework:a,isSrcDir:t,tokensDir:r,stylesDir:i,componentDir:o}}s(Gn,"getProjectInfo");function Wn(e,t){if(["vite","astro","nuxt","sveltekit","remix"].includes(e))return!0;if(e==="eleventy"){const r=st(t);return M(r,"vite")}return!1}s(Wn,"shouldInstallVitePlugin");function rt(e,t=0){if(typeof e!="object"||e===null||t>Nt)return!1;for(const[n,r]of Object.entries(e))if(!n.startsWith("$")&&typeof r=="object"&&r!==null&&("$value"in r||rt(r,t+1)))return!0;return!1}s(rt,"hasAnyToken");async function Bn(e){try{const t=await fe([Ft],{cwd:e,absolute:!0});for(const n of t)try{const r=await oe.readFile(n,"utf-8"),i=JSON.parse(r);if(rt(i))return!0}catch{}return!1}catch{return!1}}s(Bn,"detectExistingTokens");function Vn(e=process.cwd()){return Rt(e)!==null}s(Vn,"isTypeScriptProject");async function it(e=process.cwd()){return Vn(e)?"sugarcube.config.ts":"sugarcube.config.js"}s(it,"getConfigFileName");function xn(e){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)}s(xn,"isValidIdentifier");function Ie(e,t=0){const n=" ".repeat(t);if(e===null)return"null";if(e===void 0)return"undefined";if(typeof e=="string")return JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.length===0?"[]":`[
|
|
147
|
+
${e.map(i=>`${n} ${Ie(i,t+1)}`).join(`,
|
|
145
148
|
`)}
|
|
146
|
-
${n}]`;if(typeof e=="object"){const
|
|
147
|
-
${
|
|
149
|
+
${n}]`;if(typeof e=="object"){const r=Object.entries(e);return r.length===0?"{}":`{
|
|
150
|
+
${r.map(([o,a])=>{const l=xn(o)?o:JSON.stringify(o);return`${n} ${l}: ${Ie(a,t+1)}`}).join(`,
|
|
148
151
|
`)}
|
|
149
|
-
${n}}`}return JSON.stringify(e)}
|
|
152
|
+
${n}}`}return JSON.stringify(e)}s(Ie,"formatValue");function Kn(e,t){const n=Ie(e,0);return t?`import { defineConfig } from "${t}";
|
|
150
153
|
|
|
151
154
|
export default defineConfig(${n});
|
|
152
|
-
`:`${`// Configuration reference: ${
|
|
155
|
+
`:`${`// Configuration reference: ${R.CONFIGURATION}
|
|
153
156
|
export default `}${n};
|
|
154
|
-
`}
|
|
157
|
+
`}s(Kn,"formatConfigAsCode");async function Yn(e,t){try{const n=await it(),r=Kn(e,t);await Q(n,r,"utf-8")}catch(n){const r=n instanceof Error?`: ${n.message}`:"";throw new p(`Failed to write config file${r}`)}}s(Yn,"writeSugarcubeConfig");const Hn=s(async e=>{T.space(2),await B(200);let t="Next steps";if(e.pluginToInstall===Ue)t+=`
|
|
155
158
|
|
|
156
159
|
`,t+=`1. Configure the plugin
|
|
157
160
|
`,t+=` Add the plugin to your build configuration:
|
|
@@ -166,10 +169,10 @@ export default `}${n};
|
|
|
166
169
|
`,t+=` ${c.cyan(O.CUBE)}`,t+=`
|
|
167
170
|
|
|
168
171
|
`,t+=`4. (Optional) Add components
|
|
169
|
-
`,t+=` ${c.cyan(O.COMPONENTS)}`;else{const n=`${e.stylesDir}/global/${
|
|
172
|
+
`,t+=` ${c.cyan(O.COMPONENTS)}`;else{const n=`${e.stylesDir}/global/${le.output.variablesFilename}`;t+=`
|
|
170
173
|
|
|
171
174
|
`,t+=`1. Import the generated CSS
|
|
172
|
-
`;const
|
|
175
|
+
`;const r=e.isSrcDir?`"${n}"`:`"./${n}"`;t+=` ${c.cyan(`import ${r}`)}`,t+=`
|
|
173
176
|
|
|
174
177
|
`,t+=`2. (Optional) Add CUBE CSS
|
|
175
178
|
`,t+=` ${c.cyan(O.CUBE)}`,t+=`
|
|
@@ -177,6 +180,6 @@ export default `}${n};
|
|
|
177
180
|
`,t+=`3. (Optional) Add components
|
|
178
181
|
`,t+=` ${c.cyan(O.COMPONENTS)}`}t+=`
|
|
179
182
|
|
|
180
|
-
`,t+=`Docs: ${c.cyan("https://sugarcube.sh")}`,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
+
`,t+=`Docs: ${c.cyan("https://sugarcube.sh")}`,dn(t,{width:.75}),await B(200),T.break(1)},"nextSteps");async function zn(e){await Hn(e)}s(zn,"next");const Jn=s(async()=>{const e=["Welcome to sugarcube \u2014 the toolkit for seriously sweet frontends!"];T.space(1),await T.animated(e,{clear:!1})},"welcome");async function qn(){Re()&&(Se(h.CONFIG_EXISTS(),{}),process.exit(1))}s(qn,"preflightInit");function Zn(e,t){return e.map(n=>({...n,css:`@layer ${t} {
|
|
184
|
+
${n.css}}
|
|
185
|
+
`}))}s(Zn,"wrapInLayer");async function Xn(e){const t=Gn(process.cwd()),n=e.tokensDir||t.tokensDir,r=e.stylesDir||t.stylesDir,i=await Bn(n);let o=null;if(i){const a=await ae(n);if(a.found==="none")throw new p(h.RESOLVER_NOT_FOUND(n));if(a.found==="multiple")throw new p(h.RESOLVER_MULTIPLE_FOUND(a.paths));o=a.path}return{tokensDir:n,stylesDir:r,isSrcDir:t.isSrcDir,hasExistingTokens:i,resolverPath:o,framework:t.framework}}s(Xn,"initializeProjectContext");function Qn(e,t,n){const r=t?null:e.kit||pe;if(e.skipDeps)return{starterKit:r,pluginToInstall:null,cliToInstall:null};const i=es(n,process.cwd());return{starterKit:r,pluginToInstall:i,cliToInstall:i?null:Ct}}s(Qn,"determineInstallationTargets");function es(e,t){return Wn(e,t)?Ue:null}s(es,"determinePlugin");async function ts(e,t,n,r,i){const o=await ze(process.cwd(),{withFallback:!0});return t.resolverPath&&(n.resolver=t.resolverPath),{options:e,...t,isSrcDir:t.isSrcDir,config:n,sugarcubeConfig:r,...i,packageManager:o,createdFiles:[],createdDirectories:[],installedDependencies:[],tasks:[]}}s(ts,"buildInitContext");async function ns(e){const{trees:t,resolved:n}=await K(e.config);e.setupResult={config:e.config,createdTokenPaths:[],trees:t,resolved:n,tokenFiles:[],tokensDir:e.tokensDir}}s(ns,"processExistingTokens");async function ss(e){!e.hasExistingTokens&&e.starterKit?await Kt(e):await ns(e)}s(ss,"setupDesignTokens");async function rs(e){if(!e.setupResult)throw new p(h.INITIALIZATION_INCOMPLETE());const{trees:t,resolved:n}=e.setupResult,r=e.config.output.layers,i=await ce(t,n,e.config);let o=await Fe(i,e.config);r&&(o=Zn(o,r.variables)),await Ce(o)}s(rs,"writeCSSVariables");async function is(e){if(!e.setupResult)throw new p(h.INITIALIZATION_INCOMPLETE());const{trees:t,resolved:n}=e.setupResult,r=await ce(t,n,e.config),i=await et(r,e.config);i.length&&await Ne(i)}s(is,"writeCSSUtilities");async function os(e){if(e.pluginToInstall&&!P(e.pluginToInstall))try{await te([e.pluginToInstall],process.cwd(),e.packageManager,{devDependency:!0}),e.installedDependencies.push(e.pluginToInstall)}catch{throw new p(h.PLUGIN_INSTALL_FAILED({pluginToInstall:e.pluginToInstall,packageManager:e.packageManager}))}}s(os,"installPlugins");async function as(e){if(e.cliToInstall&&!P(e.cliToInstall))try{await te([e.cliToInstall],process.cwd(),e.packageManager,{devDependency:!0}),e.installedDependencies.push(e.cliToInstall)}catch{throw new p(h.CLI_INSTALL_FAILED({packageManager:e.packageManager}))}}s(as,"installCLI");function ot(e){return!!(e.stylesDir||e.variablesDir||e.variablesFilename||e.utilitiesDir||e.utilitiesFilename||e.fluidMin||e.fluidMax||e.colorFallback)}s(ot,"hasCustomizationFlags");function cs(e){return e.pluginToInstall?"@sugarcube-sh/vite":e.cliToInstall?"@sugarcube-sh/cli":null}s(cs,"getTypeSource");async function at(e){if(ot(e.options))try{await Yn(e.sugarcubeConfig,cs(e));const t=await it();e.createdFiles.push(t)}catch{throw new p(h.CONFIG_WRITE_FAILED())}}s(at,"finalize");function ls(e){const t=[];if(e.hasExistingTokens?t.push({pending:"Looking for existing tokens",start:"Looking for existing tokens...",end:`Existing tokens found at ${e.tokensDir} ${E("\u2192","->")} using them`,while:s(async()=>{},"while")}):e.starterKit&&t.push({pending:"Looking for existing tokens",start:"Looking for existing tokens...",end:`No existing tokens detected ${E("\u2192","->")} adding starter kit`,while:s(async()=>{},"while")}),e.pluginToInstall){const n="Vite";P(e.pluginToInstall)?t.push({pending:`Checking for ${n} compatibility`,start:`Checking for ${n} compatibility...`,end:`${n} plugin already installed ${E("\u2192","->")} skipping plugin installation`,while:s(async()=>{},"while")}):t.push({pending:"Checking for Vite compatibility",start:"Checking for Vite compatibility...",end:`Vite detected ${E("\u2192","->")} plugin will be installed`,while:s(async()=>{},"while")})}else{const n=e.options.skipDeps;t.push({pending:"Checking for Vite compatibility",start:"Checking for Vite compatibility...",end:n?`Dependencies skipped ${E("\u2192","->")} no plugins or CLI will be installed`:`No Vite detected ${E("\u2192","->")} CSS will be generated as file(s)`,while:s(async()=>{},"while")})}return t}s(ls,"buildDetectionTasks");async function us(e){if(e.tasks.push({pending:e.hasExistingTokens?"Process existing design tokens":"Add design tokens",start:e.hasExistingTokens?"Processing existing design tokens...":"Adding design tokens...",end:e.hasExistingTokens?"Design tokens processed":"Design tokens added",while:s(async()=>{await ss(e)},"while")}),!e.pluginToInstall)e.tasks.push({pending:"Generate CSS variables",start:"Generating CSS variables...",end:"CSS variables generated",while:s(async()=>{await rs(e)},"while")}),e.tasks.push({pending:"Generate CSS utilities",start:"Generating CSS utilities...",end:"CSS utilities generated",while:s(async()=>{await is(e)},"while")}),e.cliToInstall&&!P(e.cliToInstall)&&e.tasks.push({pending:"Install CLI",start:"Installing CLI...",end:"CLI installed",while:s(async()=>{await as(e)},"while")});else if(e.pluginToInstall&&!P(e.pluginToInstall)){const t="Vite";e.tasks.push({pending:`Install ${t} plugin`,start:`Installing ${t} plugin...`,end:`${t} plugin installed`,while:s(async()=>{await os(e)},"while")})}ot(e.options)?e.tasks.push({pending:"Write configuration file",start:"Writing configuration file...",end:"Configuration file written",while:s(async()=>{await at(e)},"while")}):e.tasks.push({pending:"Finalize setup",start:"Finalizing...",end:"Setup complete",while:s(async()=>{await at(e)},"while")})}s(us,"buildExecutionTasks");const ds=new U().name("init").description("Initialize a new sugarcube project").option("--kit <kit>",`Starter kit to use (default: ${pe})`,pe).option("--tokens-dir <dir>","Design tokens directory (e.g., 'src/design-tokens')").option("--styles-dir <dir>","Styles output directory (e.g., 'src/styles')").option("--variables-dir <dir>","Token variables directory (e.g., 'src/styles/global')").option("--variables-filename <name>","Token variables filename (default: 'tokens.variables.gen.css')").option("--utilities-dir <dir>","Utilities directory (e.g., 'src/styles/utilities')").option("--utilities-filename <name>","Utilities filename (default: 'utilities.gen.css')").option("--fluid-min <number>","Minimum viewport width for fluid scaling (default: 320)").option("--fluid-max <number>","Maximum viewport width for fluid scaling (default: 1200)").option("--color-fallback <strategy>","Color fallback strategy: 'native' or 'polyfill' (default: native)").option("--skip-deps","Don't install any sugarcube packages").action(async e=>{let t;try{re(e.variablesFilename,"--variables-filename"),re(e.utilitiesFilename,"--utilities-filename"),await qn();const n=await Xn(e),r=await Un(e),i=_e(r),o=Qn(e,n.hasExistingTokens,n.framework);t=await ts(e,n,i,r,o),z(Y("sugarcube")),await Jn();const a=ls(t);a.length>0&&(T.message("Detecting project\u2026"),await T.tasks(a,{minDurationMs:1e3})),t.tasks=[],await us(t),t.tasks.length>0&&(T.message("Setting things up\u2026"),await T.tasks(t.tasks,{successMessage:"\u{1F389} Tasks completed successfully!"})),await zn(t)}catch(n){J(n)}}),fs=new U().name("validate").description("Validate design token files").argument("[paths...]","Token files or directories to validate (e.g., src/design-tokens)").action(async e=>{try{if(z(Y("Validate")),!e.length)try{const{config:o}=await ee();await K(o),se(c.greenBright("All tokens valid \u2728"));return}catch{throw new p(h.VALIDATE_NO_PATH_SPECIFIED())}for(const o of e)if(!D(o))throw new p(h.VALIDATE_PATH_NOT_FOUND(o));const n=(await fe(e.map(o=>o.endsWith(".json")?o:$(o,"**/*.json")),{absolute:!0})).filter(o=>!o.endsWith(".resolver.json"));if(n.length===0)throw new p(h.VALIDATE_NO_TOKEN_FILES());const r={};for(const o of n){const a=await ke(o,"utf-8"),l=N(process.cwd(),o);r[l]={content:a}}const i={output:le.output,transforms:le.transforms};await K(i,r),se(c.greenBright("All tokens valid \u2728"))}catch(t){J(t)}});process.on("SIGINT",()=>process.exit(0)),process.on("SIGTERM",()=>process.exit(0));async function ps(){const e=new U().name("sugarcube").description("CLI for sugarcube").version(Me.version,"-v, --version","display the version number");e.addCommand(ds).addCommand(Mn).addCommand(fs).addCommand(wn).addCommand(yn),e.parse()}s(ps,"main"),ps();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sugarcube-sh/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": false
|
|
@@ -47,18 +47,19 @@
|
|
|
47
47
|
"@antfu/ni": "23.3.0",
|
|
48
48
|
"@clack/core": "1.0.0-alpha.3",
|
|
49
49
|
"@clack/prompts": "1.0.0-alpha.3",
|
|
50
|
-
"@unocss/core": "66.5.2",
|
|
50
|
+
"@unocss/core": "^66.5.2",
|
|
51
|
+
"chokidar": "^4.0.3",
|
|
51
52
|
"commander": "12.1.0",
|
|
52
53
|
"execa": "9.5.2",
|
|
53
54
|
"fast-wrap-ansi": "0.1.3",
|
|
54
55
|
"get-tsconfig": "4.7.2",
|
|
55
56
|
"is-unicode-supported": "2.1.0",
|
|
56
57
|
"log-update": "6.1.0",
|
|
57
|
-
"pathe": "2.0.3",
|
|
58
|
+
"pathe": "^2.0.3",
|
|
58
59
|
"picocolors": "1.1.1",
|
|
59
60
|
"tinyglobby": "^0.2.9",
|
|
60
61
|
"zod": "^3.23.8",
|
|
61
|
-
"@sugarcube-sh/core": "0.0.
|
|
62
|
+
"@sugarcube-sh/core": "0.0.4"
|
|
62
63
|
},
|
|
63
64
|
"devDependencies": {
|
|
64
65
|
"cross-env": "7.0.3",
|