@frontfriend/tailwind 2.5.4 → 3.0.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.
- package/dist/cli.js +30 -33
- package/dist/index.js +3 -3
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +3 -3
- package/dist/lib/core/api-client.js +1 -1
- package/dist/lib/core/api-client.js.map +3 -3
- package/dist/lib/core/cache-manager.js +6 -2
- package/dist/lib/core/component-downloader.js +2 -2
- package/dist/lib/core/component-downloader.js.map +3 -3
- package/dist/lib/core/env-utils.js +1 -1
- package/dist/lib/core/env-utils.js.map +2 -2
- package/dist/lib/core/file-utils.js +1 -1
- package/dist/lib/core/file-utils.js.map +2 -2
- package/dist/lib/core/local-token-reader.js +1 -1
- package/dist/lib/core/local-token-reader.js.map +2 -2
- package/dist/lib/core/path-utils.js +1 -1
- package/dist/lib/core/path-utils.js.map +2 -2
- package/dist/next.js +1 -1
- package/dist/next.js.map +3 -3
- package/dist/runtime.js +1 -1
- package/dist/runtime.js.map +3 -3
- package/dist/vite.js +1 -1
- package/dist/vite.js.map +3 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var _=(t
|
|
3
|
-
`)};var
|
|
2
|
+
var _=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports);var q=_((K,E)=>{var P=require("fs"),N=require("path");function M(s={}){let t=s.projectRoot||process.cwd(),o=N.join(t,"node_modules",".cache","frontfriend","icons.json"),e=s.outputPath||N.join(t,"types","frontfriend.d.ts");P.existsSync(o)||(console.error('[FrontFriend] Error: icons.json not found. Please run "npx frontfriend init" first.'),process.exit(1));try{let i=function(v){for(let m of Object.values(v))typeof m=="string"?u.add(m):typeof m=="object"&&m!==null&&i(m)},a=function(v,m=" "){let p=[];for(let[D,l]of Object.entries(v))typeof l=="string"?p.push(`${m}${D}: '${l}';`):typeof l=="object"&&l!==null&&(p.push(`${m}${D}: {`),p.push(a(l,m+" ")),p.push(`${m}};`));return p.join(`
|
|
3
|
+
`)};var r=i,F=a;let g=JSON.parse(P.readFileSync(o,"utf-8")),u=new Set;i(g);let n=Array.from(u).map(v=>`'${v}'`).join(" | "),d=`// Generated by @frontfriend/tailwind
|
|
4
4
|
// DO NOT EDIT THIS FILE MANUALLY
|
|
5
5
|
|
|
6
6
|
import type { IconSetStructure } from '@frontfriend/tailwind';
|
|
@@ -11,7 +11,7 @@ declare module '@frontfriend/tailwind' {
|
|
|
11
11
|
|
|
12
12
|
// Typed iconSet structure with exact icon names
|
|
13
13
|
export interface TypedIconSet extends IconSetStructure {
|
|
14
|
-
${
|
|
14
|
+
${a(g)}
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -35,41 +35,38 @@ declare module '@/src/components/ui/icon' {
|
|
|
35
35
|
declare module '@/src/components/ui/icon/Icon.vue' {
|
|
36
36
|
export type IconName = ${n||"string"};
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
`,x=N.dirname(e);P.existsSync(x)||P.mkdirSync(x,{recursive:!0}),P.writeFileSync(e,d),console.log("[FrontFriend] \u2713 Generated types at",N.relative(t,e));let k=N.join(t,"tsconfig.json");if(P.existsSync(k)){let v=JSON.parse(P.readFileSync(k,"utf-8"));v.include||(v.include=[]);let m="types/**/*.d.ts";v.include.includes(m)||(v.include.push(m),P.writeFileSync(k,JSON.stringify(v,null,2)),console.log("[FrontFriend] \u2713 Updated tsconfig.json to include generated types"))}}catch(g){console.error("[FrontFriend] Error generating icon types:",g.message),process.exit(1)}}require.main===E&&M();E.exports={generateIconTypes:M}});var{Command:G}=require("commander"),O=require("./lib/core/config-loader"),U=require("./lib/core/cache-manager"),{APIClient:J}=require("./lib/core/api-client"),{ComponentDownloader:A}=require("./lib/core/component-downloader"),B=require("./lib/core/token-processor"),{ConfigError:R,APIError:H,CacheError:V}=require("./lib/core/errors"),{loadEnvLocal:Y}=require("./lib/core/env-utils"),L=require("path");Y();var b=new G;b.name("frontfriend").description("FrontFriend Tailwind CLI - Manage design tokens and cache").version("2.4.0");b.command("init").description("Initialize FrontFriend configuration and fetch from API").option("--force","Force refresh even if cache is valid").option("--verbose","Show detailed output including safelist size and token counts").option("--tag <tag>","Fetch specific tag (e.g., dev, next, latest)").option("--version <version>","Fetch specific version (e.g., v1.0.0)").action(async s=>{var t;try{console.log("\u{1F527} FrontFriend Setup"),console.log(`==================
|
|
39
39
|
`);let e=await new O().load();if(!e.ffId)throw new R(`ff-id not found in frontfriend.config.js
|
|
40
|
-
Please add "ff-id" to your frontfriend.config.js file`,"ff-id");console.log("\u{1F4CB} Configuration loaded"),console.log(` FF_ID: ${e.ffId}`),console.log(` App Root: ${e.appRoot}
|
|
41
|
-
`)
|
|
42
|
-
`):f.exists()?console.log(` Cache expired
|
|
40
|
+
Please add "ff-id" to your frontfriend.config.js file`,"ff-id");let r=s.tag||e.tag,F=s.version||e.version;console.log("\u{1F4CB} Configuration loaded"),console.log(` FF_ID: ${e.ffId}`),console.log(` App Root: ${e.appRoot}`),r&&console.log(` Tag: ${r}`),F&&console.log(` Version: ${F}`),console.log("");let g=new U(e.appRoot);!s.force&&g.exists()&&g.isValid()&&(console.log("\u2705 Cache is valid and up to date"),console.log(" Use --force to refresh anyway"),process.exit(0)),console.log("\u{1F50D} Checking cache..."),s.force?console.log(` Force refresh requested
|
|
41
|
+
`):g.exists()?console.log(` Cache expired
|
|
43
42
|
`):console.log(` No cache found
|
|
44
|
-
`),console.log("\u{1F310} Fetching configuration...");let
|
|
45
|
-
`),(!((i=l.tokens)!=null&&i.fontFamily)||Object.keys(l.tokens.fontFamily).length===0)&&(console.log("\u26A0\uFE0F Warning: No font family utilities found"),console.log(" Font classes like font-primary and font-secondary will not be available"),l.globalTokens?console.log(` Global tokens are present - font processor may need to be updated
|
|
43
|
+
`),console.log("\u{1F310} Fetching configuration...");let u=new J(e.ffId,{baseURL:e["api-url"]||e.apiUrl});(e["api-url"]||e.apiUrl)&&console.log(` Using API URL: ${e["api-url"]||e.apiUrl}`);let i=null;try{i=await u.fetchProcessedTokens({tag:r,version:F})}catch(c){console.log(` \u26A0\uFE0F Failed to fetch pre-processed tokens: ${c.message}`)}if(i){if(console.log(" \u2713 Pre-processed tokens fetched from server"),console.log(" \u2713 Skipping local processing"),i.versionMetadata){let c=i.versionMetadata;console.log(" \u2139\uFE0F Version Information:"),c.version&&console.log(` Version: ${c.version}`),c.tag&&console.log(` Tag: ${c.tag}`),c.cached!==void 0&&console.log(` From Cache: ${c.cached?"Yes":"No"}`)}if(console.log(""),(!((t=i.tokens)!=null&&t.fontFamily)||Object.keys(i.tokens.fontFamily).length===0)&&(console.log("\u26A0\uFE0F Warning: No font family utilities found"),console.log(" Font classes like font-primary and font-secondary will not be available"),i.globalTokens?console.log(` Global tokens are present - font processor may need to be updated
|
|
46
44
|
`):console.log(` Consider adding font family tokens to your design system
|
|
47
|
-
`)),console.log("\u{1F4BE} Saving cache..."),(process.env.FF_VERBOSE==="true"||
|
|
45
|
+
`)),console.log("\u{1F4BE} Saving cache..."),(process.env.FF_VERBOSE==="true"||s.verbose)&&console.log(` Safelist has ${i.safelist?i.safelist.length:0} items`),g.save(i),console.log(` \u2713 Cache saved successfully
|
|
48
46
|
`),console.log("\u2705 Setup complete!"),console.log(" Your FrontFriend configuration has been cached."),console.log(" The Tailwind plugin will now use this cached data."),e.types){console.log(`
|
|
49
|
-
\u{1F524} Generating TypeScript types...`);try{let{generateIconTypes:
|
|
50
|
-
`);let[
|
|
51
|
-
`),console.log("\u2699\uFE0F Processing tokens...");let
|
|
52
|
-
`);let
|
|
47
|
+
\u{1F524} Generating TypeScript types...`);try{let{generateIconTypes:c}=q(),y=e.aliases&&e.aliases.types?L.join(e.appRoot,e.aliases.types,"frontfriend.d.ts"):void 0;c({projectRoot:e.appRoot,outputPath:y})}catch(c){console.log(" \u26A0\uFE0F Type generation failed:",c.message),console.log(' Enable type generation in frontfriend.config.js with "types": true')}}process.exit(0)}console.log(` \u2139\uFE0F Pre-processed tokens not available, falling back to local processing
|
|
48
|
+
`);let[a,n,d,x,k,v]=await Promise.all([u.fetchTokens(),u.fetchComponentsConfig(),u.fetchFonts(),u.fetchIcons(),u.fetchVersion(),u.fetchCustomCss()]);if(console.log(" \u2713 Tokens fetched"),a.global||a.colors||a.semantic||a.semanticDark){let c=[a.global?"global":null,a.colors?"colors":null,a.semantic?"semantic":null,a.semanticDark?"semanticDark":null].filter(Boolean).join(", ");console.log(` (Found: ${c})`)}console.log(" \u2713 Components config fetched"),console.log(" \u2713 Fonts fetched"),console.log(" \u2713 Icons fetched"),console.log(" \u2713 Version fetched"),console.log(` \u2713 Custom CSS fetched
|
|
49
|
+
`),console.log("\u2699\uFE0F Processing tokens...");let m=new B;console.log(" Processing raw token data...");let p=await m.process({colors:a.colors||a.global,semantic:a.semantic,semanticDark:a.semanticDark,fonts:d,globalTokens:a.global,animations:a.animations,version:k==null?void 0:k.version,ffId:e.ffId,customCss:v});console.log(" \u2713 Colors processed"),console.log(" \u2713 Semantic tokens processed"),p.fontFaces.length>0&&console.log(` \u2713 ${p.fontFaces.length} font faces processed`),Object.keys(p.animations).length>0&&console.log(` \u2713 ${Object.keys(p.animations).length} animations processed`),console.log(`
|
|
50
|
+
`);let D=m.extractClassesFromComponentsConfig(n),l=[...p.safelist||[],...D||[]],f=[...new Set(l)].sort(),h={tokens:p.utilities,variables:p.variables,semanticVariables:p.semanticVariables,semanticDarkVariables:p.semanticDarkVariables,fonts:p.fontFaces,icons:x,componentsConfig:n,keyframes:p.keyframes,animations:p.animations,safelist:f,version:k,metadata:p.metadata,custom:p.custom};if(console.log("\u{1F4BE} Saving cache..."),(process.env.FF_VERBOSE==="true"||s.verbose)&&(console.log(" Cache data summary:"),console.log(` - Tokens: ${Object.keys(h.tokens||{}).length} utilities`),console.log(` - Variables: ${Object.keys(h.variables||{}).length} CSS variables`),console.log(` - Semantic variables: ${Object.keys(h.semanticVariables||{}).length} semantic variables`),console.log(` - Font faces: ${(h.fonts||[]).length} fonts`),console.log(` - Safelist: ${(h.safelist||[]).length} safelist classes`)),g.save(h),console.log(` \u2713 Cache saved successfully
|
|
53
51
|
`),console.log("\u2705 Setup complete!"),console.log(" Your FrontFriend configuration has been cached."),console.log(" The Tailwind plugin will now use this cached data."),e.types){console.log(`
|
|
54
|
-
\u{1F524} Generating TypeScript types...`);try{let{generateIconTypes:
|
|
55
|
-
`);let
|
|
56
|
-
`),console.log("Package:"),console.log(" Version: 2.4.0"),console.log("");let
|
|
57
|
-
`);let o=new U(i.appRoot),e=o.getCacheDir();if(console.log("Cache:"),console.log(` Directory: ${L.relative(process.cwd(),e)}`),o.exists()){console.log(` Status: ${o.isValid()?"\u2705 Valid":"\u26A0\uFE0F Expired"}`);let f=o.load();if(f&&f.metadata){let g=new Date(f.metadata.timestamp);console.log(` Created: ${g.toLocaleString()}`),console.log(` Format Version: ${f.metadata.version||"Unknown"}`)}}else console.log(" Status: \u274C Not found");process.exit(0)}catch(t){t instanceof R?console.error("\u274C Configuration Error:",t.message):t instanceof V?(console.error("\u274C Cache Error:",t.message),console.error(` Operation: ${t.operation}`)):console.error("\u274C Status check failed:",t.message),process.exit(1)}});b.command("download").description("Download components from registry").argument("<components...>",'component names to download (or "all" to download all components)').option("-f, --framework <framework>","Framework to download components for (react/vue)").option("-o, --output <path>","Output directory for components").option("--overwrite","Overwrite existing files").action(async(t,i)=>{try{console.log(`\u{1F4E6} Downloading components...
|
|
52
|
+
\u{1F524} Generating TypeScript types...`);try{let{generateIconTypes:c}=q(),y=e.aliases&&e.aliases.types?L.join(e.appRoot,e.aliases.types,"frontfriend.d.ts"):void 0;c({projectRoot:e.appRoot,outputPath:y})}catch(c){console.log(" \u26A0\uFE0F Type generation failed:",c.message),console.log(' Enable type generation in frontfriend.config.js with "types": true')}}process.exit(0)}catch(o){o instanceof R?console.error("\u274C Configuration Error:",o.message):o instanceof H?(console.error("\u274C API Error:",o.message),console.error(` Status: ${o.statusCode}`),console.error(` URL: ${o.url}`)):o instanceof V?(console.error("\u274C Cache Error:",o.message),console.error(` Operation: ${o.operation}`)):console.error("\u274C Setup failed:",o.message),process.exit(1)}});b.command("clean").description("Remove cached configuration").action(async()=>{try{console.log(`\u{1F9F9} Cleaning FrontFriend cache...
|
|
53
|
+
`);let t=new O().load(),o=new U(t.appRoot);o.exists()?(o.clear(),console.log("\u2705 Cache cleared successfully")):console.log("\u2139\uFE0F No cache found"),process.exit(0)}catch(s){s instanceof V?(console.error("\u274C Cache Error:",s.message),console.error(` Operation: ${s.operation}`)):console.error("\u274C Clean failed:",s.message),process.exit(1)}});b.command("status").description("Show cache status and configuration").action(async()=>{try{console.log("\u{1F4CA} FrontFriend Status"),console.log(`===================
|
|
54
|
+
`),console.log("Package:"),console.log(" Version: 2.4.0"),console.log("");let t=await new O().load();console.log("Configuration:"),console.log(` FF_ID: ${t.ffId||"Not set"}`),console.log(` App Root: ${t.appRoot}`),t.tag&&console.log(` Tag: ${t.tag}`),t.version&&console.log(` Version: ${t.version}`),console.log("");let o=new U(t.appRoot),e=o.getCacheDir();if(console.log("Cache:"),console.log(` Directory: ${L.relative(process.cwd(),e)}`),o.exists()){console.log(` Status: ${o.isValid()?"\u2705 Valid":"\u26A0\uFE0F Expired"}`);let r=o.load();if(r&&r.metadata){let F=new Date(r.metadata.timestamp);console.log(` Created: ${F.toLocaleString()}`),console.log(` Format Version: ${r.metadata.version||"Unknown"}`)}r&&r.versionMetadata&&(console.log(" Cached Version Info:"),r.versionMetadata.version&&console.log(` Version: ${r.versionMetadata.version}`),r.versionMetadata.tag&&console.log(` Tag: ${r.versionMetadata.tag}`))}else console.log(" Status: \u274C Not found");process.exit(0)}catch(s){s instanceof R?console.error("\u274C Configuration Error:",s.message):s instanceof V?(console.error("\u274C Cache Error:",s.message),console.error(` Operation: ${s.operation}`)):console.error("\u274C Status check failed:",s.message),process.exit(1)}});b.command("download").description("Download components from registry").argument("<components...>",'component names to download (or "all" to download all components)').option("-f, --framework <framework>","Framework to download components for (react/vue)").option("-o, --output <path>","Output directory for components").option("--overwrite","Overwrite existing files").action(async(s,t)=>{try{console.log(`\u{1F4E6} Downloading components...
|
|
58
55
|
`);let e=await new O().load();if(!e.ffId)throw new R(`ff-id not found in frontfriend.config.js
|
|
59
|
-
Please add "ff-id" to your frontfriend.config.js file`,"ff-id");let
|
|
60
|
-
`);let
|
|
61
|
-
\u2705 Download complete!`),console.log(` Downloaded: ${
|
|
62
|
-
\u{1F4E6} Install dependencies:`),console.log(` npm install ${
|
|
56
|
+
Please add "ff-id" to your frontfriend.config.js file`,"ff-id");let r=new A({appRoot:e.appRoot,config:e,framework:t.framework,outputPath:t.output,overwrite:t.overwrite}),F=s;if(s.length===1&&s[0].toLowerCase()==="all"){let u=await r.getAllComponents(),i=await r.getCustomComponents();process.env.FF_DEBUG&&console.log(`Debug: Found ${i.length} custom components: ${i.join(", ")}`),u.length===0&&(console.error("\u274C Failed to fetch component list"),process.exit(1));let a=new Set(i),n=u.filter(d=>!a.has(d));F=[...i,...n],console.log("\u{1F4CB} Configuration"),console.log(` Framework: ${r.framework}`),console.log(` Output: ${r.outputPath}`),console.log(` Components: All ${F.length} components`),process.env.FF_DEBUG&&i.length>0&&console.log(` Debug: ${i.length} custom components will override standard ones`),console.log("")}else console.log("\u{1F4CB} Configuration"),console.log(` Framework: ${r.framework}`),console.log(` Output: ${r.outputPath}`),console.log(` Components: ${s.join(", ")}
|
|
57
|
+
`);let g=await r.downloadComponents(F);g.successful.length>0&&(console.log(`
|
|
58
|
+
\u2705 Download complete!`),console.log(` Downloaded: ${g.successful.length} components`)),g.failed.length>0&&(console.log(""),g.failed.forEach(u=>{u.error.includes("not found")?console.log(`\u274C ${u.error}`):console.log(`\u274C Failed to download ${u.component}: ${u.error}`)})),g.successful.length>0&&g.dependencies.length>0&&(console.log(`
|
|
59
|
+
\u{1F4E6} Install dependencies:`),console.log(` npm install ${g.dependencies.join(" ")}`)),g.successful.length===0&&g.failed.length>0&&process.exit(1),process.exit(0)}catch(o){o instanceof R?(console.error("\u274C Configuration Error:",o.message),o.missingKey&&console.error(` Missing key: ${o.missingKey}`)):console.error("\u274C Download failed:",o.message),process.exit(1)}});b.command("add").description("Add generated pages from Frontfriend platform").argument("<type>","Type of resource to add (page or project)").argument("<id>","ID of the resource").option("--name <name>","Component name for the page").option("--path <path>","Output path (overrides aliases.pages)").option("--force","Overwrite existing files").option("--pages <ids>","Specific page IDs for project (comma-separated)").option("--all","Add all pages from project").action(async(s,t,o)=>{var e,r,F,g,u,i;try{console.log(`\u{1F680} Frontfriend Add
|
|
63
60
|
`);let n=await new O().load();if(!n.ffId)throw new R(`ff-id not found in frontfriend.config.js
|
|
64
|
-
Please add "ff-id" to your frontfriend.config.js file`,"ff-id");let
|
|
65
|
-
`),console.log("\u{1F310} Fetching page...");let
|
|
66
|
-
\u{1F4E6} Checking UI components...`);let
|
|
67
|
-
\u{1F4BE} Writing page file...`);let
|
|
68
|
-
\u274C File already exists: ${
|
|
69
|
-
\u2705 Page added successfully!`),console.log(` Component: ${
|
|
70
|
-
\u{1F4DA} Import in your app:`);let
|
|
71
|
-
`),console.log("\u{1F310} Fetching project pages...");let
|
|
72
|
-
\u{1F4E6} Checking UI components...`);let
|
|
73
|
-
\u{1F4BE} Writing page files...`);let
|
|
74
|
-
\u2705 Project pages added!`),console.log(` Added: ${T} pages`),
|
|
61
|
+
Please add "ff-id" to your frontfriend.config.js file`,"ff-id");let d=require("fs"),x=require("path"),k=require("https"),v=require("http"),{URL:m}=require("url"),p=l=>new Promise((f,h)=>{let c=new m(l),y=c.protocol==="https:",T=y?k:v,j={hostname:c.hostname,port:c.port||(y?443:80),path:c.pathname+c.search,method:"GET",headers:{Accept:"application/json"}};T.get(j,C=>{let $="";C.on("data",w=>$+=w),C.on("end",()=>{if(C.statusCode===200)try{f(JSON.parse($))}catch{h(new Error("Invalid JSON response"))}else try{let w=JSON.parse($);h(new Error(w.error||`HTTP ${C.statusCode}`))}catch{h(new Error(`HTTP ${C.statusCode}: ${$}`))}})}).on("error",h)}),D=n["api-url"]||n.apiUrl||"https://app.frontfriend.dev";if(s==="page"){console.log("\u{1F4CB} Configuration"),console.log(` FF_ID: ${n.ffId}`),console.log(` Page ID: ${t}`);let l=o.path||((e=n.aliases)==null?void 0:e.pages)||"src/pages";console.log(` Output: ${l}
|
|
62
|
+
`),console.log("\u{1F310} Fetching page...");let f=await p(`${D}/api/export/pages/${t}?ffId=${n.ffId}`);if(console.log(` \u2713 Page fetched: ${f.name}`),f.components&&f.components.length>0){console.log(`
|
|
63
|
+
\u{1F4E6} Checking UI components...`);let C=new A({appRoot:n.appRoot,config:n,framework:n.framework||"react"}),$=((F=(r=n.aliases)==null?void 0:r.ui)==null?void 0:F.replace("@/",""))||"src/components/ui",w=[];for(let S of f.components){let I=x.join(n.appRoot,$,S);d.existsSync(I)||d.existsSync(I+".tsx")||d.existsSync(I+".jsx")||d.existsSync(I+".vue")||w.push(S)}if(w.length>0){console.log(` Missing components: ${w.join(", ")}`),console.log(" Downloading missing components...");let S=await C.downloadComponents(w);S.successful.length>0&&console.log(` \u2713 Downloaded ${S.successful.length} components`)}else console.log(" \u2713 All required components present")}console.log(`
|
|
64
|
+
\u{1F4BE} Writing page file...`);let h=o.name?`${o.name}.tsx`:`${f.componentName}.tsx`,c=l.startsWith("@/")?l.replace("@/",""):l,y=x.join(n.appRoot,c,h);d.existsSync(y)&&!o.force&&(console.error(`
|
|
65
|
+
\u274C File already exists: ${y}`),console.error(" Use --force to overwrite"),process.exit(1));let T=x.dirname(y);d.existsSync(T)||d.mkdirSync(T,{recursive:!0}),d.writeFileSync(y,f.code),console.log(` \u2713 Created: ${x.relative(n.appRoot,y)}`),console.log(`
|
|
66
|
+
\u2705 Page added successfully!`),console.log(` Component: ${f.componentName}`),console.log(` Location: ${x.relative(n.appRoot,y)}`),console.log(`
|
|
67
|
+
\u{1F4DA} Import in your app:`);let j;l.startsWith("@/")?j=`${l}/${f.componentName}`:l.startsWith("src/")?j=`@/${l.substring(4)}/${f.componentName}`:j=`@/${l}/${f.componentName}`,console.log(` import ${f.componentName} from '${j}';`)}else if(s==="project"){!o.all&&!o.pages&&(console.error("\u274C Please specify --all or --pages <ids>"),process.exit(1)),console.log("\u{1F4CB} Configuration"),console.log(` FF_ID: ${n.ffId}`),console.log(` Project ID: ${t}`);let l=o.path||((g=n.aliases)==null?void 0:g.pages)||"src/pages";console.log(` Output: ${l}
|
|
68
|
+
`),console.log("\u{1F310} Fetching project pages...");let f=await p(`${D}/api/export/projects/${t}?ffId=${n.ffId}`);console.log(` \u2713 Project fetched: ${f.projectTitle}`),console.log(` \u2713 Found ${f.pages.length} pages`);let h=f.pages;if(o.pages){let C=o.pages.split(",").map($=>$.trim());h=f.pages.filter($=>C.includes($.id)),console.log(` \u2713 Adding ${h.length} specific pages`)}if(f.components&&f.components.length>0){console.log(`
|
|
69
|
+
\u{1F4E6} Checking UI components...`);let C=new A({appRoot:n.appRoot,config:n,framework:n.framework||"react"}),$=((i=(u=n.aliases)==null?void 0:u.ui)==null?void 0:i.replace("@/",""))||"src/components/ui",w=[];for(let S of f.components){let I=x.join(n.appRoot,$,S);d.existsSync(I)||d.existsSync(I+".tsx")||d.existsSync(I+".jsx")||d.existsSync(I+".vue")||w.push(S)}if(w.length>0){console.log(` Missing components: ${w.join(", ")}`),console.log(" Downloading missing components...");let S=await C.downloadComponents(w);S.successful.length>0&&console.log(` \u2713 Downloaded ${S.successful.length} components`)}else console.log(" \u2713 All required components present")}console.log(`
|
|
70
|
+
\u{1F4BE} Writing page files...`);let c=l.startsWith("@/")?l.replace("@/",""):l,y=x.join(n.appRoot,c);d.existsSync(y)||d.mkdirSync(y,{recursive:!0});let T=0,j=0;for(let C of h){let $=`${C.componentName}.tsx`,w=x.join(y,$);if(d.existsSync(w)&&!o.force){console.log(` \u26A0\uFE0F Skipped (exists): ${$}`),j++;continue}d.writeFileSync(w,C.code),console.log(` \u2713 Created: ${$}`),T++}console.log(`
|
|
71
|
+
\u2705 Project pages added!`),console.log(` Added: ${T} pages`),j>0&&(console.log(` Skipped: ${j} pages (already exist)`),console.log(" Use --force to overwrite existing files"))}else console.error(`\u274C Unknown type: ${s}`),console.error(' Use "page" or "project"'),process.exit(1);process.exit(0)}catch(a){a instanceof R?console.error("\u274C Configuration Error:",a.message):console.error("\u274C Failed:",a.message),process.exit(1)}});b.parse(process.argv);process.argv.slice(2).length||(b.outputHelp(),process.exit(0));
|
|
75
72
|
//# sourceMappingURL=cli-temp.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var y=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var D=y((de,F)=>{var m=require("fs");function L(e){try{let n=m.readFileSync(e,"utf8");return JSON.parse(n)}catch(n){if(n.code==="ENOENT")return null;throw n}}function q(e){try{return m.readFileSync(e,"utf8")}catch(n){if(n.code==="ENOENT")return null;throw n}}function P(e,n,
|
|
2
|
-
`);let r;for(;(r=
|
|
3
|
-
`),l=l.replace(/\\r/g,"\r")),n[f]=l}return n}function z(e){e=e||{};let n=j(e);e.path=n;let i=d.configDotenv(e);if(!i.parsed){let o=new Error(`MISSING_DATA: Cannot parse ${n} for an unknown reason`);throw o.code="MISSING_DATA",o}let r=k(e).split(","),f=r.length,l;for(let o=0;o<f;o++)try{let c=r[o].trim(),t=X(i,c);l=d.decrypt(t.ciphertext,t.key);break}catch(c){if(o+1>=f)throw c}return d.parse(l)}function H(e){console.log(`[dotenv@${E}][WARN] ${e}`)}function h(e){console.log(`[dotenv@${E}][DEBUG] ${e}`)}function $(e){console.log(`[dotenv@${E}] ${e}`)}function k(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function X(e,n){let i;try{i=new URL(n)}catch(c){if(c.code==="ERR_INVALID_URL"){let t=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw t.code="INVALID_DOTENV_KEY",t}throw c}let r=i.password;if(!r){let c=new Error("INVALID_DOTENV_KEY: Missing key part");throw c.code="INVALID_DOTENV_KEY",c}let f=i.searchParams.get("environment");if(!f){let c=new Error("INVALID_DOTENV_KEY: Missing environment part");throw c.code="INVALID_DOTENV_KEY",c}let l=`DOTENV_VAULT_${f.toUpperCase()}`,o=e.parsed[l];if(!o){let c=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${l} in your .env.vault file.`);throw c.code="NOT_FOUND_DOTENV_ENVIRONMENT",c}return{ciphertext:o,key:r}}function j(e){let n=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let i of e.path)_.existsSync(i)&&(n=i.endsWith(".vault")?i:`${i}.vault`);else n=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else n=b.resolve(process.cwd(),".env.vault");return _.existsSync(n)?n:null}function O(e){return e[0]==="~"?b.join(J.homedir(),e.slice(1)):e}function Z(e){let n=!!(e&&e.debug),i=e&&"quiet"in e?e.quiet:!0;(n||!i)&&$("Loading env from encrypted .env.vault");let r=d._parseVault(e),f=process.env;return e&&e.processEnv!=null&&(f=e.processEnv),d.populate(f,r,e),{parsed:r}}function ee(e){let n=b.resolve(process.cwd(),".env"),i="utf8",r=!!(e&&e.debug),f=e&&"quiet"in e?e.quiet:!0;e&&e.encoding?i=e.encoding:r&&h("No encoding is specified. UTF-8 is used by default");let l=[n];if(e&&e.path)if(!Array.isArray(e.path))l=[O(e.path)];else{l=[];for(let s of e.path)l.push(O(s))}let o,c={};for(let s of l)try{let a=d.parse(_.readFileSync(s,{encoding:i}));d.populate(c,a,e)}catch(a){r&&h(`Failed to load ${s} ${a.message}`),o=a}let t=process.env;if(e&&e.processEnv!=null&&(t=e.processEnv),d.populate(t,c,e),r||!f){let s=Object.keys(c).length,a=[];for(let u of l)try{let p=b.relative(process.cwd(),u);a.push(p)}catch(p){r&&h(`Failed to load ${u} ${p.message}`),o=p}$(`injecting env (${s}) from ${a.join(",")}`)}return o?{parsed:c,error:o}:{parsed:c}}function te(e){if(k(e).length===0)return d.configDotenv(e);let n=j(e);return n?d._configVault(e):(H(`You set DOTENV_KEY but you are missing a .env.vault file at ${n}. Did you forget to build it?`),d.configDotenv(e))}function ne(e,n){let i=Buffer.from(n.slice(-64),"hex"),r=Buffer.from(e,"base64"),f=r.subarray(0,12),l=r.subarray(-16);r=r.subarray(12,-16);try{let o=G.createDecipheriv("aes-256-gcm",i,f);return o.setAuthTag(l),`${o.update(r)}${o.final()}`}catch(o){let c=o instanceof RangeError,t=o.message==="Invalid key length",s=o.message==="Unsupported state or unable to authenticate data";if(c||t){let a=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw a.code="INVALID_DOTENV_KEY",a}else if(s){let a=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw a.code="DECRYPTION_FAILED",a}else throw o}}function re(e,n,i={}){let r=!!(i&&i.debug),f=!!(i&&i.override);if(typeof n!="object"){let l=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw l.code="OBJECT_REQUIRED",l}for(let l of Object.keys(n))Object.prototype.hasOwnProperty.call(e,l)?(f===!0&&(e[l]=n[l]),r&&h(f===!0?`"${l}" is already defined and WAS overwritten`:`"${l}" is already defined and was NOT overwritten`)):e[l]=n[l]}var d={configDotenv:ee,_configVault:Z,_parseVault:z,config:te,decrypt:ne,parse:Q,populate:re};v.exports.configDotenv=d.configDotenv;v.exports._configVault=d._configVault;v.exports._parseVault=d._parseVault;v.exports.config=d.config;v.exports.decrypt=d.decrypt;v.exports.parse=d.parse;v.exports.populate=d.populate;v.exports=d});var S=y((ge,T)=>{var oe=require("path"),{fileExists:ie}=D();function se(e=process.cwd()){let n=oe.join(e,".env.local");return ie(n)?(V().config({path:n}),console.log("\u{1F4C4} Loaded .env.local"),!0):!1}function ae(e,n=void 0){return process.env[e]||n}function le(e){return process.env[e]==="true"}T.exports={loadEnvLocal:se,getEnvVar:ae,isEnvTrue:le}});var I=y((me,C)=>{C.exports=function(n){if(!n)return{};if(typeof n!="object")throw new Error("Config must be an object");return n}});var ce=require("tailwindcss/plugin"),x;try{x=require("postcss")}catch{x=null}var g;if(typeof window>"u"&&typeof process<"u"&&process.versions&&process.versions.node){g=require("./lib/core/cache-manager");let{loadEnvLocal:e}=S();e()}function A(e){return Object.fromEntries(Object.entries(e).filter(([n])=>n!=="DEFAULT"))}var fe=ce.withOptions(function(e={}){return function({addBase:n,addUtilities:i,theme:r,matchUtilities:f}){if(!g)return;let l=new g(process.cwd());if(!l.exists()){console.warn('[FrontFriend] No cache found. Please run "npx frontfriend init" first.');return}l.isValid()||console.warn('[FrontFriend] Cache is expired. Please run "npx frontfriend init" to refresh.');let o=l.load();if(!o){console.error("[FrontFriend] Failed to load cache.");return}let c={};if(o.variables)for(let[t,s]of Object.entries(o.variables))t.startsWith("--color-")&&!s.startsWith("hsl(")?c[t]=`hsl(${s})`:c[t]=s;if(o.semanticVariables)for(let[t,s]of Object.entries(o.semanticVariables))typeof s=="string"&&!s.startsWith("var(")&&!s.startsWith("hsl(")&&/^\d+\s+\d+%\s+\d+%/.test(s)?c[t]=`hsl(${s})`:c[t]=s;if(n({":root":c}),o.semanticDarkVariables&&Object.keys(o.semanticDarkVariables).length>0){let t={};for(let[s,a]of Object.entries(o.semanticDarkVariables))typeof a=="string"&&!a.startsWith("var(")&&!a.startsWith("hsl(")&&/^\d+\s+\d+%\s+\d+%/.test(a)?t[s]=`hsl(${a})`:t[s]=a;n({":root:not(.light)":t}),n({":root:not(.dark)":c})}if(o.semanticVariables){let t={};for(let[s]of Object.entries(o.semanticVariables)){let a=s.match(/^--(bg|text|border|layer|overlay|icon)-(.+)$/);if(a){let[,u,p]=a,w=`.${u}-${p}`;u==="bg"||u==="layer"||u==="overlay"?t[w]={backgroundColor:`var(${s})`}:u==="text"?t[w]={color:`var(${s})`}:u==="border"?t[w]={borderColor:`var(${s})`}:u==="icon"&&(t[`.text-${u}-${p}`]={color:`var(${s})`},t[`.fill-${u}-${p}`]={fill:`var(${s})`})}}i(t)}if(o.tokens){if(o.tokens.backgroundColor){let t={};for(let[s,a]of Object.entries(o.tokens.backgroundColor))t[`.bg-${s}`]={backgroundColor:a};i(t)}if(o.tokens.textColor){let t={};for(let[s,a]of Object.entries(o.tokens.textColor))t[`.text-${s}`]={color:a};i(t)}if(o.tokens.borderColor){let t={};for(let[s,a]of Object.entries(o.tokens.borderColor))t[`.border-${s}`]={borderColor:a};i(t)}if(o.tokens.fill){let t={},s={};for(let[a,u]of Object.entries(o.tokens.fill))t[`.fill-${a}`]={fill:u},a.startsWith("icon-")&&(s[`.text-${a}`]={color:u});i(t),i(s)}if(o.tokens.fontFamily){let t={};for(let[s,a]of Object.entries(o.tokens.fontFamily))t[`.font-${s}`]={fontFamily:a};i(t)}}if(o.fonts&&o.fonts.length>0&&o.fonts.forEach(t=>{n({"@font-face":t})}),i({"@keyframes enter":r("keyframes.enter"),"@keyframes exit":r("keyframes.exit"),".animate-in":{animationName:"enter",animationDuration:r("animationDuration.DEFAULT"),"--tw-enter-opacity":"initial","--tw-enter-scale":"initial","--tw-enter-rotate":"initial","--tw-enter-translate-x":"initial","--tw-enter-translate-y":"initial"},".animate-out":{animationName:"exit",animationDuration:r("animationDuration.DEFAULT"),"--tw-exit-opacity":"initial","--tw-exit-scale":"initial","--tw-exit-rotate":"initial","--tw-exit-translate-x":"initial","--tw-exit-translate-y":"initial"}}),f({"fade-in":t=>({"--tw-enter-opacity":t}),"fade-out":t=>({"--tw-exit-opacity":t})},{values:r("animationOpacity")}),f({"zoom-in":t=>({"--tw-enter-scale":t}),"zoom-out":t=>({"--tw-exit-scale":t})},{values:r("animationScale")}),f({"spin-in":t=>({"--tw-enter-rotate":t}),"spin-out":t=>({"--tw-exit-rotate":t})},{values:r("animationRotate")}),f({"slide-in-from-top":t=>({"--tw-enter-translate-y":`-${t}`}),"slide-in-from-bottom":t=>({"--tw-enter-translate-y":t}),"slide-in-from-left":t=>({"--tw-enter-translate-x":`-${t}`}),"slide-in-from-right":t=>({"--tw-enter-translate-x":t}),"slide-out-to-top":t=>({"--tw-exit-translate-y":`-${t}`}),"slide-out-to-bottom":t=>({"--tw-exit-translate-y":t}),"slide-out-to-left":t=>({"--tw-exit-translate-x":`-${t}`}),"slide-out-to-right":t=>({"--tw-exit-translate-x":t})},{values:r("animationTranslate")}),f({duration:t=>({animationDuration:t})},{values:A(r("animationDuration"))}),f({delay:t=>({animationDelay:t})},{values:r("animationDelay")}),f({ease:t=>({animationTimingFunction:t})},{values:A(r("animationTimingFunction"))}),i({".running":{animationPlayState:"running"},".paused":{animationPlayState:"paused"}}),f({"fill-mode":t=>({animationFillMode:t})},{values:r("animationFillMode")}),f({direction:t=>({animationDirection:t})},{values:r("animationDirection")}),f({repeat:t=>({animationIterationCount:t})},{values:r("animationRepeat")}),o.custom&&o.custom.raw&&typeof o.custom.raw=="string"){let t=o.custom.raw.trim();if(!t){e.verbose&&console.warn("[FrontFriend] Empty custom CSS");return}if(!x){console.warn("[FrontFriend] PostCSS not available - custom CSS will not be added");return}try{let s=x.parse(t),a=[],u=[];s.each(p=>{if(p.type==="atrule"){a.push(p);return}if(p.type==="rule"){typeof p.selector=="string"&&p.selector.trim().startsWith(".")?u.push(p):a.push(p);return}p.type!=="comment"&&a.push(p)}),a.length>0&&n(a),u.length>0&&i(u),e.verbose&&console.log(`[FrontFriend] Added custom CSS: ${a.length} base rules, ${u.length} utility classes`)}catch(s){console.error("[FrontFriend] Failed to parse custom CSS:",s.message)}}e.verbose&&(console.log("[FrontFriend] Plugin loaded successfully"),console.log(`[FrontFriend] Colors: ${Object.keys(o.variables||{}).length}`),console.log(`[FrontFriend] Semantic vars: ${Object.keys(o.semanticVariables||{}).length}`),console.log(`[FrontFriend] Fonts: ${(o.fonts||[]).length}`),console.log(`[FrontFriend] Safelist classes: ${Array.isArray(o.safelist)?o.safelist.length:0}`))}},function(e={}){let n=null;if(g){let r=new g(process.cwd());n=r.exists()?r.load():null}let i=["./pages/**/*.{js,ts,jsx,tsx}","./components/**/*.{js,ts,jsx,tsx}","./app/**/*.{js,ts,jsx,tsx}","./src/**/*.{js,ts,jsx,tsx}","./stories/**/*.{js,ts,jsx,tsx}"];return e.verbose&&n&&(console.log("[FrontFriend] Cache loaded successfully"),n.safelist&&Array.isArray(n.safelist)&&console.log(`[FrontFriend] Loading ${n.safelist.length} classes for safelist`)),{theme:{extend:{colors:e.extendColors||{},animation:e.extendAnimations||{},spacing:{18:"4.5rem",88:"22rem",128:"32rem"},boxShadow:{"top-sm":"0 -1px 1px 0 rgba(0, 0, 0, 0.05)"},borderRadius:{"2xl":"1rem"},animationDelay:({theme:r})=>({...r("transitionDelay")}),animationDuration:({theme:r})=>({0:"0ms",...r("transitionDuration")}),animationTimingFunction:({theme:r})=>({...r("transitionTimingFunction")}),animationFillMode:{none:"none",forwards:"forwards",backwards:"backwards",both:"both"},animationDirection:{normal:"normal",reverse:"reverse",alternate:"alternate","alternate-reverse":"alternate-reverse"},animationOpacity:({theme:r})=>({DEFAULT:0,...r("opacity")}),animationTranslate:({theme:r})=>({DEFAULT:"100%",...r("translate")}),animationScale:({theme:r})=>({DEFAULT:0,...r("scale")}),animationRotate:({theme:r})=>({DEFAULT:"30deg",...r("rotate")}),animationRepeat:{0:"0",1:"1",infinite:"infinite"},keyframes:{enter:{from:{opacity:"var(--tw-enter-opacity, 1)",transform:"translate3d(var(--tw-enter-translate-x, 0), var(--tw-enter-translate-y, 0), 0) scale3d(var(--tw-enter-scale, 1), var(--tw-enter-scale, 1), var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))"}},exit:{to:{opacity:"var(--tw-exit-opacity, 1)",transform:"translate3d(var(--tw-exit-translate-x, 0), var(--tw-exit-translate-y, 0), 0) scale3d(var(--tw-exit-scale, 1), var(--tw-exit-scale, 1), var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))"}}}}},safelist:[...(n==null?void 0:n.safelist)||[],{pattern:/(text|fill)-icon-(neutral|positive|negative|warning|info|highlight|interactive|brand|inverse|onpositive|onnegative|onwarning|oninfo|onhighlight|oninteractive|onbrand)-(mid|strong|subtle|low)(-(neutral|hover|active|selected|disabled))?$/},{pattern:/^(layer-(below|surface|raised|popover|dialog|control)|overlay-(mid|strong|subtle|low))$/}],content:e.content||i}});module.exports=fe;Object.defineProperty(module.exports,"config",{get:function(){if(typeof __FF_CONFIG__<"u")return __FF_CONFIG__;if(typeof window<"u"&&window.__FF_CONFIG__)return window.__FF_CONFIG__;if(g)try{let e=new g(process.cwd());if(e.exists()){let n=e.load();if(n)return n.componentsConfig||null}}catch{}return null}});Object.defineProperty(module.exports,"iconSet",{get:function(){if(typeof __FF_ICONS__<"u")return __FF_ICONS__;if(typeof window<"u"&&window.__FF_ICONS__)return window.__FF_ICONS__;if(g)try{let e=new g(process.cwd());if(e.exists()){let n=e.load();if(n)return n.icons||null}}catch{}return null}});module.exports.ffdc=I();
|
|
1
|
+
var y=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var D=y((de,F)=>{var m=require("fs");function L(e){try{let n=m.readFileSync(e,"utf8");return JSON.parse(n)}catch(n){if(n.code==="ENOENT")return null;throw n}}function q(e){try{return m.readFileSync(e,"utf8").replace(/^\uFEFF/,"")}catch(n){if(n.code==="ENOENT")return null;throw n}}function P(e,n,s=2){let r=JSON.stringify(n,null,s);m.writeFileSync(e,r,"utf8")}function R(e,n){if(n==null||typeof n=="object"&&Object.keys(n).length===0||Array.isArray(n)&&n.length===0){let r=`module.exports = ${Array.isArray(n)?"[]":"{}"};`;m.writeFileSync(e,r,"utf8")}else{let s=`module.exports = ${JSON.stringify(n,null,2)};`;m.writeFileSync(e,s,"utf8")}}function K(e){return m.existsSync(e)}function M(e){m.mkdirSync(e,{recursive:!0})}function Y(e){m.rmSync(e,{recursive:!0,force:!0})}F.exports={readJsonFileSafe:L,readFileSafe:q,writeJsonFile:P,writeModuleExportsFile:R,fileExists:K,ensureDirectoryExists:M,removeDirectory:Y}});var O=y((pe,W)=>{W.exports={name:"dotenv",version:"16.6.1",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},homepage:"https://github.com/motdotla/dotenv#readme",funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var V=y((ve,v)=>{var _=require("fs"),b=require("path"),J=require("os"),B=require("crypto"),G=O(),E=G.version,U=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Q(e){let n={},s=e.toString();s=s.replace(/\r\n?/mg,`
|
|
2
|
+
`);let r;for(;(r=U.exec(s))!=null;){let u=r[1],c=r[2]||"";c=c.trim();let o=c[0];c=c.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),o==='"'&&(c=c.replace(/\\n/g,`
|
|
3
|
+
`),c=c.replace(/\\r/g,"\r")),n[u]=c}return n}function z(e){e=e||{};let n=j(e);e.path=n;let s=d.configDotenv(e);if(!s.parsed){let o=new Error(`MISSING_DATA: Cannot parse ${n} for an unknown reason`);throw o.code="MISSING_DATA",o}let r=k(e).split(","),u=r.length,c;for(let o=0;o<u;o++)try{let l=r[o].trim(),t=X(s,l);c=d.decrypt(t.ciphertext,t.key);break}catch(l){if(o+1>=u)throw l}return d.parse(c)}function H(e){console.log(`[dotenv@${E}][WARN] ${e}`)}function h(e){console.log(`[dotenv@${E}][DEBUG] ${e}`)}function $(e){console.log(`[dotenv@${E}] ${e}`)}function k(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function X(e,n){let s;try{s=new URL(n)}catch(l){if(l.code==="ERR_INVALID_URL"){let t=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw t.code="INVALID_DOTENV_KEY",t}throw l}let r=s.password;if(!r){let l=new Error("INVALID_DOTENV_KEY: Missing key part");throw l.code="INVALID_DOTENV_KEY",l}let u=s.searchParams.get("environment");if(!u){let l=new Error("INVALID_DOTENV_KEY: Missing environment part");throw l.code="INVALID_DOTENV_KEY",l}let c=`DOTENV_VAULT_${u.toUpperCase()}`,o=e.parsed[c];if(!o){let l=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${c} in your .env.vault file.`);throw l.code="NOT_FOUND_DOTENV_ENVIRONMENT",l}return{ciphertext:o,key:r}}function j(e){let n=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let s of e.path)_.existsSync(s)&&(n=s.endsWith(".vault")?s:`${s}.vault`);else n=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else n=b.resolve(process.cwd(),".env.vault");return _.existsSync(n)?n:null}function N(e){return e[0]==="~"?b.join(J.homedir(),e.slice(1)):e}function Z(e){let n=!!(e&&e.debug),s=e&&"quiet"in e?e.quiet:!0;(n||!s)&&$("Loading env from encrypted .env.vault");let r=d._parseVault(e),u=process.env;return e&&e.processEnv!=null&&(u=e.processEnv),d.populate(u,r,e),{parsed:r}}function ee(e){let n=b.resolve(process.cwd(),".env"),s="utf8",r=!!(e&&e.debug),u=e&&"quiet"in e?e.quiet:!0;e&&e.encoding?s=e.encoding:r&&h("No encoding is specified. UTF-8 is used by default");let c=[n];if(e&&e.path)if(!Array.isArray(e.path))c=[N(e.path)];else{c=[];for(let i of e.path)c.push(N(i))}let o,l={};for(let i of c)try{let a=d.parse(_.readFileSync(i,{encoding:s}));d.populate(l,a,e)}catch(a){r&&h(`Failed to load ${i} ${a.message}`),o=a}let t=process.env;if(e&&e.processEnv!=null&&(t=e.processEnv),d.populate(t,l,e),r||!u){let i=Object.keys(l).length,a=[];for(let f of c)try{let p=b.relative(process.cwd(),f);a.push(p)}catch(p){r&&h(`Failed to load ${f} ${p.message}`),o=p}$(`injecting env (${i}) from ${a.join(",")}`)}return o?{parsed:l,error:o}:{parsed:l}}function te(e){if(k(e).length===0)return d.configDotenv(e);let n=j(e);return n?d._configVault(e):(H(`You set DOTENV_KEY but you are missing a .env.vault file at ${n}. Did you forget to build it?`),d.configDotenv(e))}function ne(e,n){let s=Buffer.from(n.slice(-64),"hex"),r=Buffer.from(e,"base64"),u=r.subarray(0,12),c=r.subarray(-16);r=r.subarray(12,-16);try{let o=B.createDecipheriv("aes-256-gcm",s,u);return o.setAuthTag(c),`${o.update(r)}${o.final()}`}catch(o){let l=o instanceof RangeError,t=o.message==="Invalid key length",i=o.message==="Unsupported state or unable to authenticate data";if(l||t){let a=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw a.code="INVALID_DOTENV_KEY",a}else if(i){let a=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw a.code="DECRYPTION_FAILED",a}else throw o}}function re(e,n,s={}){let r=!!(s&&s.debug),u=!!(s&&s.override);if(typeof n!="object"){let c=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw c.code="OBJECT_REQUIRED",c}for(let c of Object.keys(n))Object.prototype.hasOwnProperty.call(e,c)?(u===!0&&(e[c]=n[c]),r&&h(u===!0?`"${c}" is already defined and WAS overwritten`:`"${c}" is already defined and was NOT overwritten`)):e[c]=n[c]}var d={configDotenv:ee,_configVault:Z,_parseVault:z,config:te,decrypt:ne,parse:Q,populate:re};v.exports.configDotenv=d.configDotenv;v.exports._configVault=d._configVault;v.exports._parseVault=d._parseVault;v.exports.config=d.config;v.exports.decrypt=d.decrypt;v.exports.parse=d.parse;v.exports.populate=d.populate;v.exports=d});var S=y((ge,T)=>{var oe=require("path"),{fileExists:se}=D();function ie(e=process.cwd()){let n=oe.join(e,".env.local");return se(n)?(V().config({path:n}),console.log("\u{1F4C4} Loaded .env.local"),!0):!1}function ae(e,n=void 0){return process.env[e]||n}function ce(e){return process.env[e]==="true"}T.exports={loadEnvLocal:ie,getEnvVar:ae,isEnvTrue:ce}});var I=y((me,C)=>{C.exports=function(n){if(!n)return{};if(typeof n!="object")throw new Error("Config must be an object");return n}});var le=require("tailwindcss/plugin"),x;try{x=require("postcss")}catch{x=null}var g;if(typeof window>"u"&&typeof process<"u"&&process.versions&&process.versions.node){g=require("./lib/core/cache-manager");let{loadEnvLocal:e}=S();e()}function A(e){return Object.fromEntries(Object.entries(e).filter(([n])=>n!=="DEFAULT"))}var ue=le.withOptions(function(e={}){return function({addBase:n,addUtilities:s,theme:r,matchUtilities:u}){if(!g)return;let c=new g(process.cwd());if(!c.exists()){console.warn('[FrontFriend] No cache found. Please run "npx frontfriend init" first.');return}c.isValid()||console.warn('[FrontFriend] Cache is expired. Please run "npx frontfriend init" to refresh.');let o=c.load();if(!o){console.error("[FrontFriend] Failed to load cache.");return}let l={};if(o.variables)for(let[t,i]of Object.entries(o.variables))t.startsWith("--color-")&&!i.startsWith("hsl(")?l[t]=`hsl(${i})`:l[t]=i;if(o.semanticVariables)for(let[t,i]of Object.entries(o.semanticVariables))typeof i=="string"&&!i.startsWith("var(")&&!i.startsWith("hsl(")&&/^\d+\s+\d+%\s+\d+%/.test(i)?l[t]=`hsl(${i})`:l[t]=i;if(n({":root":l}),o.semanticDarkVariables&&Object.keys(o.semanticDarkVariables).length>0){let t={};for(let[i,a]of Object.entries(o.semanticDarkVariables))typeof a=="string"&&!a.startsWith("var(")&&!a.startsWith("hsl(")&&/^\d+\s+\d+%\s+\d+%/.test(a)?t[i]=`hsl(${a})`:t[i]=a;n({":root:not(.light)":t}),n({":root:not(.dark)":l})}if(o.semanticVariables){let t={};for(let[i]of Object.entries(o.semanticVariables)){let a=i.match(/^--(bg|text|border|layer|overlay|icon)-(.+)$/);if(a){let[,f,p]=a,w=`.${f}-${p}`;f==="bg"||f==="layer"||f==="overlay"?t[w]={backgroundColor:`var(${i})`}:f==="text"?t[w]={color:`var(${i})`}:f==="border"?t[w]={borderColor:`var(${i})`}:f==="icon"&&(t[`.text-${f}-${p}`]={color:`var(${i})`},t[`.fill-${f}-${p}`]={fill:`var(${i})`})}}s(t)}if(o.tokens){if(o.tokens.backgroundColor){let t={};for(let[i,a]of Object.entries(o.tokens.backgroundColor))t[`.bg-${i}`]={backgroundColor:a};s(t)}if(o.tokens.textColor){let t={};for(let[i,a]of Object.entries(o.tokens.textColor))t[`.text-${i}`]={color:a};s(t)}if(o.tokens.borderColor){let t={};for(let[i,a]of Object.entries(o.tokens.borderColor))t[`.border-${i}`]={borderColor:a};s(t)}if(o.tokens.fill){let t={},i={};for(let[a,f]of Object.entries(o.tokens.fill))t[`.fill-${a}`]={fill:f},a.startsWith("icon-")&&(i[`.text-${a}`]={color:f});s(t),s(i)}if(o.tokens.fontFamily){let t={};for(let[i,a]of Object.entries(o.tokens.fontFamily))t[`.font-${i}`]={fontFamily:a};s(t)}}if(o.fonts&&o.fonts.length>0&&o.fonts.forEach(t=>{n({"@font-face":t})}),s({"@keyframes enter":r("keyframes.enter"),"@keyframes exit":r("keyframes.exit"),".animate-in":{animationName:"enter",animationDuration:r("animationDuration.DEFAULT"),"--tw-enter-opacity":"initial","--tw-enter-scale":"initial","--tw-enter-rotate":"initial","--tw-enter-translate-x":"initial","--tw-enter-translate-y":"initial"},".animate-out":{animationName:"exit",animationDuration:r("animationDuration.DEFAULT"),"--tw-exit-opacity":"initial","--tw-exit-scale":"initial","--tw-exit-rotate":"initial","--tw-exit-translate-x":"initial","--tw-exit-translate-y":"initial"}}),u({"fade-in":t=>({"--tw-enter-opacity":t}),"fade-out":t=>({"--tw-exit-opacity":t})},{values:r("animationOpacity")}),u({"zoom-in":t=>({"--tw-enter-scale":t}),"zoom-out":t=>({"--tw-exit-scale":t})},{values:r("animationScale")}),u({"spin-in":t=>({"--tw-enter-rotate":t}),"spin-out":t=>({"--tw-exit-rotate":t})},{values:r("animationRotate")}),u({"slide-in-from-top":t=>({"--tw-enter-translate-y":`-${t}`}),"slide-in-from-bottom":t=>({"--tw-enter-translate-y":t}),"slide-in-from-left":t=>({"--tw-enter-translate-x":`-${t}`}),"slide-in-from-right":t=>({"--tw-enter-translate-x":t}),"slide-out-to-top":t=>({"--tw-exit-translate-y":`-${t}`}),"slide-out-to-bottom":t=>({"--tw-exit-translate-y":t}),"slide-out-to-left":t=>({"--tw-exit-translate-x":`-${t}`}),"slide-out-to-right":t=>({"--tw-exit-translate-x":t})},{values:r("animationTranslate")}),u({duration:t=>({animationDuration:t})},{values:A(r("animationDuration"))}),u({delay:t=>({animationDelay:t})},{values:r("animationDelay")}),u({ease:t=>({animationTimingFunction:t})},{values:A(r("animationTimingFunction"))}),s({".running":{animationPlayState:"running"},".paused":{animationPlayState:"paused"}}),u({"fill-mode":t=>({animationFillMode:t})},{values:r("animationFillMode")}),u({direction:t=>({animationDirection:t})},{values:r("animationDirection")}),u({repeat:t=>({animationIterationCount:t})},{values:r("animationRepeat")}),o.custom&&o.custom.raw&&typeof o.custom.raw=="string"){let t=o.custom.raw.trim();if(!t){e.verbose&&console.warn("[FrontFriend] Empty custom CSS");return}if(!x){console.warn("[FrontFriend] PostCSS not available - custom CSS will not be added");return}try{let i=x.parse(t),a=[],f=[];i.each(p=>{if(p.type==="atrule"){a.push(p);return}if(p.type==="rule"){typeof p.selector=="string"&&p.selector.trim().startsWith(".")?f.push(p):a.push(p);return}p.type!=="comment"&&a.push(p)}),a.length>0&&n(a),f.length>0&&s(f),e.verbose&&console.log(`[FrontFriend] Added custom CSS: ${a.length} base rules, ${f.length} utility classes`)}catch(i){console.error("[FrontFriend] Failed to parse custom CSS:",i.message)}}else if(!o.custom){let t=require("fs"),a=require("path").join(process.cwd(),"node_modules",".cache","frontfriend","custom.js");t.existsSync(a)&&(console.warn("[FrontFriend] custom.js file exists but failed to load. This may be due to a parsing error or BOM issue."),console.warn("[FrontFriend] Try deleting node_modules/.cache/frontfriend and running `npx frontfriend init` again."))}e.verbose&&(console.log("[FrontFriend] Plugin loaded successfully"),console.log(`[FrontFriend] Colors: ${Object.keys(o.variables||{}).length}`),console.log(`[FrontFriend] Semantic vars: ${Object.keys(o.semanticVariables||{}).length}`),console.log(`[FrontFriend] Fonts: ${(o.fonts||[]).length}`),console.log(`[FrontFriend] Safelist classes: ${Array.isArray(o.safelist)?o.safelist.length:0}`))}},function(e={}){let n=null;if(g){let r=new g(process.cwd());n=r.exists()?r.load():null}let s=["./pages/**/*.{js,ts,jsx,tsx}","./components/**/*.{js,ts,jsx,tsx}","./app/**/*.{js,ts,jsx,tsx}","./src/**/*.{js,ts,jsx,tsx}","./stories/**/*.{js,ts,jsx,tsx}"];return e.verbose&&n&&(console.log("[FrontFriend] Cache loaded successfully"),n.safelist&&Array.isArray(n.safelist)&&console.log(`[FrontFriend] Loading ${n.safelist.length} classes for safelist`)),{theme:{extend:{colors:e.extendColors||{},animation:e.extendAnimations||{},spacing:{18:"4.5rem",88:"22rem",128:"32rem"},boxShadow:{"top-sm":"0 -1px 1px 0 rgba(0, 0, 0, 0.05)"},borderRadius:{"2xl":"1rem"},animationDelay:({theme:r})=>({...r("transitionDelay")}),animationDuration:({theme:r})=>({0:"0ms",...r("transitionDuration")}),animationTimingFunction:({theme:r})=>({...r("transitionTimingFunction")}),animationFillMode:{none:"none",forwards:"forwards",backwards:"backwards",both:"both"},animationDirection:{normal:"normal",reverse:"reverse",alternate:"alternate","alternate-reverse":"alternate-reverse"},animationOpacity:({theme:r})=>({DEFAULT:0,...r("opacity")}),animationTranslate:({theme:r})=>({DEFAULT:"100%",...r("translate")}),animationScale:({theme:r})=>({DEFAULT:0,...r("scale")}),animationRotate:({theme:r})=>({DEFAULT:"30deg",...r("rotate")}),animationRepeat:{0:"0",1:"1",infinite:"infinite"},keyframes:{enter:{from:{opacity:"var(--tw-enter-opacity, 1)",transform:"translate3d(var(--tw-enter-translate-x, 0), var(--tw-enter-translate-y, 0), 0) scale3d(var(--tw-enter-scale, 1), var(--tw-enter-scale, 1), var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))"}},exit:{to:{opacity:"var(--tw-exit-opacity, 1)",transform:"translate3d(var(--tw-exit-translate-x, 0), var(--tw-exit-translate-y, 0), 0) scale3d(var(--tw-exit-scale, 1), var(--tw-exit-scale, 1), var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))"}}}}},safelist:[...(n==null?void 0:n.safelist)||[],{pattern:/(text|fill)-icon-(neutral|positive|negative|warning|info|highlight|interactive|brand|inverse|onpositive|onnegative|onwarning|oninfo|onhighlight|oninteractive|onbrand)-(mid|strong|subtle|low)(-(neutral|hover|active|selected|disabled))?$/},{pattern:/^(layer-(below|surface|raised|popover|dialog|control)|overlay-(mid|strong|subtle|low))$/}],content:e.content||s}});module.exports=ue;Object.defineProperty(module.exports,"config",{get:function(){if(typeof __FF_CONFIG__<"u")return __FF_CONFIG__;if(typeof window<"u"&&window.__FF_CONFIG__)return window.__FF_CONFIG__;if(g)try{let e=new g(process.cwd());if(e.exists()){let n=e.load();if(n)return n.componentsConfig||null}}catch{}return null}});Object.defineProperty(module.exports,"iconSet",{get:function(){if(typeof __FF_ICONS__<"u")return __FF_ICONS__;if(typeof window<"u"&&window.__FF_ICONS__)return window.__FF_ICONS__;if(g)try{let e=new g(process.cwd());if(e.exists()){let n=e.load();if(n)return n.icons||null}}catch{}return null}});module.exports.ffdc=I();
|
|
4
4
|
//# sourceMappingURL=index.js.map
|