@frontfriend/tailwind 4.0.9 → 4.0.10
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 +36 -32
- package/dist/components-config-schema.js +1 -1
- package/dist/components-config-schema.js.map +2 -2
- package/dist/ffdc.js +1 -1
- package/dist/ffdc.js.map +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +2 -2
- package/dist/lib/core/components-config-schema.js +1 -1
- package/dist/lib/core/components-config-schema.js.map +2 -2
- package/dist/lib/core/default-config-data.js +1 -1
- package/dist/lib/core/default-config-data.js.map +2 -2
- package/dist/lib/core/default-config.js +1 -1
- package/dist/lib/core/default-config.js.map +2 -2
- package/dist/lib/core/token-processor.js +1 -1
- package/dist/lib/core/token-processor.js.map +2 -2
- package/dist/next.js +1 -1
- package/dist/next.js.map +2 -2
- package/dist/vite.js +5 -5
- package/dist/vite.js.map +3 -3
- package/dist/vite.mjs +2 -2
- package/dist/vite.mjs.map +3 -3
- package/package.json +1 -1
- package/scripts/master-components-config.json +1488 -796
- package/scripts/update-default-config-data.js +27 -15
package/dist/cli.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
`,{mode:384});try{F.chmodSync(
|
|
4
|
-
|
|
2
|
+
var A=(e,o)=>()=>(o||e((o={exports:{}}).exports,o),o.exports);var W=A((Un,Z)=>{var $e="https://app.frontfriend.dev",Te="https://registry-legacy.frontfriend.dev",_e=".cache/frontfriend",Ae={JS:["tokens.js","variables.js","semanticVariables.js","semanticDarkVariables.js","safelist.js","custom.js"],JSON:["fonts.json","icons.json","components-config.json","version.json","metadata.json"]},Ee={FF_ID:"FF_ID",FF_API_URL:"FF_API_URL",FF_USE_LOCAL:"FF_USE_LOCAL",FF_AUTH_TOKEN:"FF_AUTH_TOKEN"};Z.exports={DEFAULT_API_URL:$e,LEGACY_API_URL:Te,CACHE_DIR_NAME:_e,CACHE_TTL_DAYS:7,CACHE_TTL_MS:6048e5,CACHE_FILES:Ae,ENV_VARS:Ee}});var ce=A((Mn,ie)=>{var F=require("fs"),Q=require("path"),Ie=require("os"),Pe=require("https"),Oe=require("http"),{URL:De}=require("url"),{DEFAULT_API_URL:X}=W(),ee=Q.join(Ie.homedir(),".frontfriend"),k=Q.join(ee,"credentials");function Le(){return k}function ne(){try{return F.existsSync(k)?JSON.parse(F.readFileSync(k,"utf8")):null}catch{return null}}function oe(e){F.mkdirSync(ee,{recursive:!0,mode:448}),F.writeFileSync(k,`${JSON.stringify(e,null,2)}
|
|
3
|
+
`,{mode:384});try{F.chmodSync(k,384)}catch{}}function Ne(){return F.existsSync(k)?(F.unlinkSync(k),!0):!1}function te(e,o=60*1e3){return!(e!=null&&e.accessToken)||!e.expiresAt||Date.now()+o>=e.expiresAt}function D(e){let o=new Error(`${e}. Run \`frontfriend login\` to re-authenticate.`);return o.code="FF_AUTH_REFRESH_FAILED",o}function se(e,o,n){return new Promise((t,s)=>{let r=new De(e),i=r.protocol==="https:"?Pe:Oe,f=JSON.stringify(o||{}),c=i.request({hostname:r.hostname,port:r.port,path:`${r.pathname}${r.search}`,method:"POST",headers:{"content-type":"application/json","content-length":Buffer.byteLength(f),...n?{authorization:`Bearer ${n}`}:{}}},a=>{let u="";a.on("data",l=>{u+=l}),a.on("end",()=>{if(a.statusCode>=300&&a.statusCode<400){let p=a.headers.location?` to ${a.headers.location}`:"",h=new Error(`HTTP ${a.statusCode}: redirected${p}`);h.statusCode=a.statusCode,h.body=u,s(h);return}let l=null;try{l=u?JSON.parse(u):null}catch(p){if(a.statusCode>=400){let h=new Error(`HTTP ${a.statusCode}: ${a.statusMessage||"Non-JSON response"}`);h.statusCode=a.statusCode,h.body=u,s(h);return}s(p);return}if(a.statusCode>=400){let p=new Error((l==null?void 0:l.error_description)||(l==null?void 0:l.error)||`HTTP ${a.statusCode}`);p.statusCode=a.statusCode,p.body=l,s(p);return}t(l)})});c.on("error",s),c.write(f),c.end()})}async function re(e,o=X){if(!(e!=null&&e.refreshToken)||!(e!=null&&e.deviceId))throw D("FrontFriend session expired");let n;try{n=await se(`${o}/api/plugin/token`,{grant_type:"refresh_token",refresh_token:e.refreshToken,device_id:e.deviceId})}catch(s){throw D((s==null?void 0:s.message)||"Could not refresh FrontFriend session")}if(!(n!=null&&n.access_token)||!(n!=null&&n.refresh_token))throw D("Could not refresh FrontFriend session");let t={accessToken:n.access_token,refreshToken:n.refresh_token,deviceId:n.device_id||e.deviceId,expiresAt:Date.now()+(n.expires_in||900)*1e3,refreshExpiresAt:Date.now()+(n.refresh_expires_in||604800)*1e3,ffApiUrl:o};return oe(t),t}async function Re(e={}){if(!e.skipCredentials){let o=ne();if(o!=null&&o.accessToken||o!=null&&o.refreshToken){let n=e.baseURL||o.ffApiUrl||X;return o.accessToken&&!te(o)?o.accessToken:(await re(o,n)).accessToken}}return e.envToken?e.envToken:e.legacyToken?(e.silent||console.warn("\u26A0\uFE0F auth-token in frontfriend.config.js is deprecated. Run `frontfriend login` to store credentials outside the repo."),e.legacyToken):null}ie.exports={getCredentialsPath:Le,readCredentials:ne,writeCredentials:oe,deleteCredentials:Ne,isExpired:te,postJson:se,refreshCredentials:re,resolveAuthToken:Re,createAuthRefreshError:D}});var ue=A((Vn,de)=>{var ae={primary:"brand-mid","primary-foreground":"onbrand-mid",secondary:"neutral-subtle","secondary-foreground":"neutral-strong",destructive:"negative-mid","destructive-foreground":"onnegative-mid",background:"layer-below",foreground:"neutral-strong",card:"layer-raised","card-foreground":"neutral-strong",popover:"layer-popover","popover-foreground":"neutral-strong",muted:"neutral-subtle","muted-foreground":"neutral-mid",accent:"neutral-subtle","accent-foreground":"neutral-strong",border:"neutral-subtle",ring:"brand-mid","sidebar-foreground":"neutral-strong","sidebar-primary":"brand-mid","sidebar-primary-foreground":"onbrand-mid","sidebar-accent":"neutral-subtle","sidebar-accent-foreground":"neutral-strong","sidebar-border":"neutral-subtle","sidebar-ring":"brand-mid",success:"positive-mid","success-foreground":"onpositive-mid",info:"info-mid","info-foreground":"oninfo-mid",warning:"warning-mid","warning-foreground":"onwarning-mid",invert:"inverse-mid","invert-foreground":"neutral-low"};function Ue(e){return e.split(/\s+/).filter(Boolean).map(le).join(" ")}function Me(e){let o=0,n=-1;for(let t=0;t<e.length;t+=1){let s=e[t];s==="["&&(o+=1),s==="]"&&(o=Math.max(0,o-1)),s===":"&&o===0&&(n=t)}return n===-1?{prefix:"",base:e}:{prefix:e.slice(0,n+1),base:e.slice(n+1)}}function le(e){if(!e)return e;let{prefix:o,base:n}=Me(e),t=n.match(/^(.*?)(\/\d{1,3})$/),s=t?t[1]:n,r=t?t[2]:"";if(s==="bg-black")return`${o}bg-overlay`;let i=s.match(/^(bg|text|border|ring|fill)-(.+)$/);if(!i)return e;let[,f,c]=i;if(c==="input")return`${o}${f}-${f==="bg"?"layer-control":"neutral-subtle"}${r}`;let a=ae[c];return a?`${o}${f}-${a}${r}`:e}var Ve=new Set(["chart-1","chart-2","chart-3","chart-4","chart-5","sidebar","radius"]),fe=/--(?:chart-\d+|sidebar(?:-[a-z-]+)?|radius)\s*:[^;{}]+;/gi;function qe(e){if(!e)return"";let o=new Set,n=[],t=e.match(fe)||[];for(let s of t){let r=s.replace(/\s+/g," ").trim(),i=r.slice(0,r.indexOf(":")).trim();o.has(i)||(o.add(i),n.push(` ${r}`))}return n.length===0?"":`:root {
|
|
4
|
+
${n.join(`
|
|
5
|
+
`)}
|
|
6
|
+
}
|
|
7
|
+
`}de.exports={SHADCN_FF_TOKEN_MAP:ae,CSSVAR_TOKENS:Ve,SHADCN_CSSVAR_PATTERN:fe,shadcnToFf:Ue,shadcnTokenToFf:le,extractShadcnCssVars:qe}});var ge=A((qn,Je)=>{Je.exports={name:"@frontfriend/tailwind",version:"4.0.10",description:"Design token management for Tailwind CSS",main:"./dist/index.js",types:"./dist/types/index.d.ts",bin:{frontfriend:"dist/cli.js"},exports:{".":{types:"./dist/types/index.d.ts",browser:"./dist/browser.mjs",import:"./dist/index.mjs",require:"./dist/index.js",default:"./dist/index.js"},"./runtime":{types:"./dist/runtime.d.ts",default:"./dist/runtime.js"},"./next":{types:"./dist/next.d.ts",default:"./dist/next.js"},"./vite":{types:"./dist/vite.d.ts",default:"./dist/vite.mjs"},"./lib/react/utils":{types:"./dist/lib/react/utils.d.ts",default:"./dist/lib/react/utils.mjs"},"./lib/vue/utils":{types:"./dist/lib/vue/utils.d.ts",default:"./dist/lib/vue/utils.mjs"},"./ffdc":{types:"./dist/ffdc.d.ts",default:"./dist/ffdc.js"},"./theme":"./src/theme.css","./theme.css":"./src/theme.css","./components-config-schema":{types:"./dist/components-config-schema.d.ts",require:"./dist/components-config-schema.js",import:"./dist/components-config-schema.js",default:"./dist/components-config-schema.js"}},scripts:{test:"jest",build:"node scripts/build.js",prepublishOnly:"npm run build"},keywords:["tailwindcss","design-tokens","frontfriend"],author:"Donux",license:"SEE LICENSE IN LICENSE",files:["dist/","src/theme.css","scripts/","README.md","LICENSE"],dependencies:{commander:"^11.0.0",dotenv:"^16.0.0",color:"^4.2.3",clsx:"^2.0.0","tailwind-merge":"^2.0.0","tw-animate-css":"^1.3.4"},peerDependencies:{tailwindcss:"^3.0.0 || ^4.0.0","tw-animate-css":"^1.3.0",react:"^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",vue:">=3.0.0"},devDependencies:{jest:"^29.0.0",esbuild:"^0.19.0",glob:"^10.0.0"}}});var R=A((Jn,N)=>{var b=require("fs"),E=require("path");function pe(e={}){let o=e.projectRoot||process.cwd(),n=E.join(o,"node_modules",".cache","frontfriend","icons.json"),t=e.outputPath||E.join(o,"types","frontfriend.d.ts");b.existsSync(n)||(console.error('[FrontFriend] Error: icons.json not found. Please run "npx frontfriend init" first.'),process.exit(1));try{let c=function(y){for(let C of Object.values(y))typeof C=="string"?f.add(C):typeof C=="object"&&C!==null&&c(C)},a=function(y,C=" "){let w=[];for(let[O,x]of Object.entries(y))typeof x=="string"?w.push(`${C}${O}: '${x}';`):typeof x=="object"&&x!==null&&(w.push(`${C}${O}: {`),w.push(a(x,C+" ")),w.push(`${C}};`));return w.join(`
|
|
8
|
+
`)};var s=c,r=a;let i=JSON.parse(b.readFileSync(n,"utf-8")),f=new Set;c(i);let u=Array.from(f).map(y=>`'${y}'`).join(" | "),l=`// Generated by @frontfriend/tailwind
|
|
5
9
|
// DO NOT EDIT THIS FILE MANUALLY
|
|
6
10
|
|
|
7
11
|
import type { IconSetStructure } from '@frontfriend/tailwind';
|
|
8
12
|
|
|
9
13
|
declare module '@frontfriend/tailwind' {
|
|
10
14
|
// Icon names used in this project
|
|
11
|
-
export type ProjectIconName = ${
|
|
15
|
+
export type ProjectIconName = ${u||"string"};
|
|
12
16
|
|
|
13
17
|
// Typed iconSet structure with exact icon names
|
|
14
18
|
export interface TypedIconSet extends IconSetStructure {
|
|
@@ -18,61 +22,61 @@ ${a(i)}
|
|
|
18
22
|
|
|
19
23
|
// Augment Vue component types with exact icon names
|
|
20
24
|
declare module '*/components/ui/icon/*.vue' {
|
|
21
|
-
export type IconName = ${
|
|
25
|
+
export type IconName = ${u||"string"};
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
declare module '@/components/ui/icon/*.vue' {
|
|
25
|
-
export type IconName = ${
|
|
29
|
+
export type IconName = ${u||"string"};
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
declare module '@/components/ui/icon' {
|
|
29
|
-
export type IconName = ${
|
|
33
|
+
export type IconName = ${u||"string"};
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
declare module '@/src/components/ui/icon' {
|
|
33
|
-
export type IconName = ${
|
|
37
|
+
export type IconName = ${u||"string"};
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
declare module '@/src/components/ui/icon/Icon.vue' {
|
|
37
|
-
export type IconName = ${
|
|
41
|
+
export type IconName = ${u||"string"};
|
|
38
42
|
}
|
|
39
|
-
`,
|
|
40
|
-
`)}var
|
|
43
|
+
`,p=E.dirname(t);b.existsSync(p)||b.mkdirSync(p,{recursive:!0}),b.writeFileSync(t,l),console.log("[FrontFriend] \u2713 Generated types at",E.relative(o,t));let h=E.join(o,"tsconfig.json");if(b.existsSync(h)){let y=JSON.parse(b.readFileSync(h,"utf-8"));y.include||(y.include=[]);let C="types/**/*.d.ts";y.include.includes(C)||(y.include.push(C),b.writeFileSync(h,JSON.stringify(y,null,2)),console.log("[FrontFriend] \u2713 Updated tsconfig.json to include generated types"))}}catch(i){console.error("[FrontFriend] Error generating icon types:",i.message),process.exit(1)}}require.main===N&&pe();N.exports={generateIconTypes:pe}});var{loadEnvLocal:Be}=require("./lib/core/env-utils");Be();var{Command:Ge}=require("commander"),I=require("./lib/core/config-loader"),P=require("./lib/core/cache-manager"),{APIClient:ye}=require("./lib/core/api-client"),{getCredentialsPath:He,writeCredentials:ze,readCredentials:Ke,deleteCredentials:Ye,postJson:U}=ce(),{ComponentDownloader:Ze}=require("./lib/core/component-downloader"),We=require("./lib/core/token-processor"),{shadcnToFf:Qe,extractShadcnCssVars:Xe}=ue(),{ConfigError:j,APIError:en,CacheError:G}=require("./lib/core/errors"),d=require("path"),g=require("fs"),{spawn:nn}=require("child_process"),S=new Ge,{version:Ce}=ge(),on="https://registry.frontfriend.dev/r/v4",me='@import "@frontfriend/tailwind/theme.css";',ve=["app/globals.css","src/app/globals.css","styles/globals.css","src/styles/globals.css","src/styles.css","src/index.css","src/style.css"];function tn(e){let o=(e||process.env.FF_REGISTRY_URL||on).replace(/\/+$/,"");return/\/r\/(legacy|v4)$/i.test(o)?o:`${o}/r/v4`}function T(e){try{return JSON.parse(g.readFileSync(e,"utf8"))}catch{return null}}function H(e,o){g.mkdirSync(d.dirname(e),{recursive:!0}),g.writeFileSync(e,`${JSON.stringify(o,null,2)}
|
|
44
|
+
`)}var sn=d.join("node_modules",".cache","frontfriend","migrated-components.json");function rn(e){let o=T(d.join(e,"package.json"))||{},n={...o.dependencies||{},...o.devDependencies||{}};return n.vue||n["@vitejs/plugin-vue"]?"vue":"react"}function cn(e){let o=T(d.join(e,"package.json"))||{},n={...o.dependencies||{},...o.devDependencies||{}};return n.next||g.existsSync(d.join(e,"next.config.js"))||g.existsSync(d.join(e,"next.config.mjs"))?"next":n.vite||g.existsSync(d.join(e,"vite.config.ts"))||g.existsSync(d.join(e,"vite.config.js"))?"vite":null}function an(e,o,n){let t=d.join(e,"components.json");if(!g.existsSync(t))return!1;let s=T(t)||{};s.registries=s.registries||{};let r=`${tn(n)}/${o}/{name}.json`;return s.registries["@frontfriend"]===r?!1:(s.registries["@frontfriend"]=r,H(t,s),!0)}function ln(e){let o=d.join(e,"package.json"),n=T(o);return n?(n.dependencies=n.dependencies||{},n.dependencies["@frontfriend/tailwind"]?!1:(n.dependencies["@frontfriend/tailwind"]="^4.0.0",H(o,n),!0)):!1}function fn(e){let o=["next.config.js","next.config.mjs","next.config.ts"].map(n=>d.join(e,n)).find(n=>g.existsSync(n));return o?g.readFileSync(o,"utf8").includes("@frontfriend/tailwind/next")?"present":"manual":(g.writeFileSync(d.join(e,"next.config.js"),`const frontfriend = require('@frontfriend/tailwind/next');
|
|
41
45
|
|
|
42
46
|
module.exports = frontfriend({});
|
|
43
|
-
`)
|
|
47
|
+
`),"created")}function dn(e){let o=["vite.config.ts","vite.config.js","vite.config.mjs"].map(n=>d.join(e,n)).find(n=>g.existsSync(n));return o?g.readFileSync(o,"utf8").includes("@frontfriend/tailwind/vite")?"present":"manual":(g.writeFileSync(d.join(e,"vite.config.ts"),`import { defineConfig } from 'vite';
|
|
44
48
|
import frontfriend from '@frontfriend/tailwind/vite';
|
|
45
49
|
|
|
46
50
|
export default defineConfig({
|
|
47
51
|
plugins: [frontfriend()],
|
|
48
52
|
});
|
|
49
|
-
`)
|
|
50
|
-
${t}`),{changed:!0,relativePath:n})}function
|
|
51
|
-
`))}function
|
|
53
|
+
`),"created")}function un(e){let o=ve.find(n=>g.existsSync(d.join(e,n)));return o?d.join(e,o):null}function gn(e){let n=ve.find(s=>g.existsSync(d.join(e,s)))||"app/globals.css",t=d.join(e,n);return g.mkdirSync(d.dirname(t),{recursive:!0}),g.existsSync(t)||g.writeFileSync(t,""),{fullPath:t,relativePath:n}}function pn(e){let{fullPath:o,relativePath:n}=gn(e),t=g.readFileSync(o,"utf8");return t.includes(me)?{changed:!1,relativePath:n}:(g.writeFileSync(o,`${me}
|
|
54
|
+
${t}`),{changed:!0,relativePath:n})}function mn(e,o={}){let n=d.join(e,"components.json");if(!g.existsSync(n))return{isShadcnProject:!1,changes:[]};let t=rn(e),s=cn(e),r=[],i=[];if(an(e,t,o.registryUrl)&&r.push(`registered @frontfriend registry for ${t}`),ln(e)&&r.push("added @frontfriend/tailwind dependency"),s==="next"){let c=fn(e);c==="created"&&r.push("created next.config.js with the FrontFriend plugin"),c==="manual"&&i.push('wrap your existing next.config with `require("@frontfriend/tailwind/next")(...)`')}if(s==="vite"){let c=dn(e);c==="created"&&r.push("created vite.config.ts with the FrontFriend plugin"),c==="manual"&&i.push("add `frontfriend()` from `@frontfriend/tailwind/vite` to your existing vite.config plugins array")}let f=pn(e);return f.changed&&r.push(`imported bundled theme in ${f.relativePath}`),{isShadcnProject:!0,changes:r,manualSteps:i,framework:t,buildTool:s}}function hn(e){return new Promise(o=>setTimeout(o,e))}function yn(e){let o=process.platform==="darwin"?"open":process.platform==="win32"?"cmd":"xdg-open",n=process.platform==="win32"?["/c","start","",e]:[e];try{return nn(o,n,{detached:!0,stdio:"ignore"}).unref(),!0}catch{return!1}}function Cn(e){e.isShadcnProject&&(console.log("\u{1F9E9} shadcn project wiring"),e.changes.length===0?console.log(" \u2713 Already configured"):e.changes.forEach(o=>console.log(` \u2713 ${o}`)),e.manualSteps&&e.manualSteps.length>0&&(console.log(" \u26A0 Manual steps required (existing config left untouched):"),e.manualSteps.forEach(o=>console.log(` \u2022 ${o}`))),console.log(` Next: npx shadcn add @frontfriend/button
|
|
55
|
+
`))}function vn(e,o){let n=e.indexOf(`${o}:`);if(n===-1)return null;let t=e.indexOf("{",n);if(t===-1)return null;let s=0;for(let r=t;r<e.length;r+=1){let i=e[r];if(i==="{"&&(s+=1),i==="}"&&(s-=1),s===0)return e.slice(t+1,r)}return null}function wn(e){let o={},n=/([A-Za-z0-9_-]+):\s*(['"`])([\s\S]*?)\2/g,t;for(;t=n.exec(e||"");)o[t[1]]=t[3].replace(/\s+/g," ").trim();return o}function Sn(e,o){let n=o;for(;/\s|,/.test(e[n]||"");)n+=1;let t=e[n];if(t==='"'||t==="'"||t==="`"){let r=e.indexOf(t,n+1);return r===-1?null:{name:e.slice(n+1,r),end:r+1}}let s=e.slice(n).match(/^([A-Za-z0-9_-]+)/);return s?{name:s[1],end:n+s[1].length}:null}function xn(e){let o={},n=0;for(;n<(e||"").length;){let t=Sn(e,n);if(!t){n+=1;continue}for(n=t.end;/\s/.test(e[n]||"");)n+=1;if(e[n]!==":")continue;for(n+=1;/\s/.test(e[n]||"");)n+=1;if(e[n]!=="{")continue;let s=0,r=n;for(;n<e.length;n+=1)if(e[n]==="{"&&(s+=1),e[n]==="}"&&(s-=1),s===0){o[t.name]=wn(e.slice(r+1,n)),n+=1;break}}return o}function L(e){return String(e||"").replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function bn(e){return String(e||"").replace(/-([a-z0-9])/g,(o,n)=>n.toUpperCase())}function jn(e){return String(e||"").replace(/(^|[-_\s]+)([a-z0-9])/g,(o,n,t)=>t.toUpperCase())}function M(e,o,n,t){let s=0,r=null,i=!1;for(let f=o;f<e.length;f+=1){let c=e[f];if(r){i?i=!1:c==="\\"?i=!0:c===r&&(r=null);continue}if(c==='"'||c==="'"||c==="`"){r=c;continue}if(c===n&&(s+=1),c===t&&(s-=1),s===0)return f}return-1}function Fn(e){let o=[],n=/(?:export\s+)?function\s+([A-Z][A-Za-z0-9_]*)\s*\(/g,t;for(;t=n.exec(e);){let r=t[1],i=e.indexOf("(",t.index),f=i===-1?-1:M(e,i,"(",")"),c=f===-1?-1:e.indexOf("{",f);if(c===-1)continue;let a=M(e,c,"{","}");a!==-1&&(o.push({name:r,body:e.slice(c,a+1)}),n.lastIndex=a+1)}let s=/(?:export\s+)?const\s+([A-Z][A-Za-z0-9_]*)\s*=/g;for(;t=s.exec(e);){let r=t[1],i=t.index,f=e.slice(i+1).search(/\n(?:export\s+)?(?:const|function)\s+[A-Z][A-Za-z0-9_]*\b|\nexport\s*\{/),c=f===-1?e.length:i+1+f;o.push({name:r,body:e.slice(i,c)})}return o}function we(e,o){let n=e[o],t="",s=!1;for(let r=o+1;r<e.length;r+=1){let i=e[r];if(s){t+=i,s=!1;continue}if(i==="\\"){s=!0;continue}if(i===n)return{value:t,end:r+1};t+=i}return null}function kn(e){let o=[];for(let n=0;n<e.length;n+=1){let t=e[n];if(t!=='"'&&t!=="'"&&t!=="`")continue;let s=we(e,n);s&&((t!=="`"||!s.value.includes("${"))&&o.push(s.value.replace(/\s+/g," ").trim()),n=s.end-1)}return o.filter(Boolean)}function $n(e,o){let n=o;for(;/\s/.test(e[n]||"");)n+=1;if(e[n]!=="=")return null;for(n+=1;/\s/.test(e[n]||"");)n+=1;if(e[n]==='"'||e[n]==="'"){let t=we(e,n);return t?{value:t.value,end:t.end}:null}if(e[n]==="{"){let t=M(e,n,"{","}");return t===-1?null:{expression:e.slice(n+1,t),end:t+1}}return null}function Tn(e){let o=e.match(/\bdata-slot\s*=\s*(?:"([^"]+)"|'([^']+)'|\{\s*["'`]([^"'`]+)["'`]\s*\})/);return o?o[1]||o[2]||o[3]:null}function _n(e,o,n){let t=L(n),s=L(e||o);if(s===t)return"root";if(s.startsWith(`${t}-`))s=s.slice(t.length+1);else{let r=jn(n);!e&&o.startsWith(r)&&(s=L(o.slice(r.length)))}return s?bn(s):"root"}function An(e,o){let n={},t=[];for(let s of Fn(e)){let r=/\bclassName\s*=/g,i,f=!1;for(;i=r.exec(s.body);){let c=$n(s.body,i.index+9);if(!c){t.push(`${s.name}: unreadable className`);continue}let u=(c.value!==void 0?[c.value]:kn(c.expression||"")).join(" ").replace(/\s+/g," ").trim();if(!u){t.push(`${s.name}: dynamic className without literal classes`);continue}let l=s.body.lastIndexOf("<",i.index),p=c.end?s.body.indexOf(">",c.end):-1,h=l===-1?"":s.body.slice(l,p===-1?Math.min(s.body.length,c.end+300):p+1),y=_n(Tn(h),s.name,o);n[y]=n[y]?`${n[y]} ${u}`.replace(/\s+/g," ").trim():u,f=!0}!f&&/\bclassName\b/.test(s.body)&&t.push(`${s.name}: className present but no literal classes captured`)}return{slots:n,missed:t}}function V(e,o){if(typeof e=="string")return o(e);if(Array.isArray(e))return e.map(n=>V(n,o));if(e&&typeof e=="object"){let n={};for(let[t,s]of Object.entries(e))n[t]=V(s,o);return n}return e}var En={button:{variant:{default:"main",outline:"tertiary"}},badge:{variant:{default:"main",outline:"tertiary"}}},In=new Set(["variant","size","sizes","iconPosition"]);function q(e,o){let n=e.includes("cva(")&&e.includes("variants:"),t=e.match(/cva\(\s*(['"`])([\s\S]*?)\1\s*,/),s=vn(e,"variants"),r=xn(s),i=Object.values(r).some(l=>Object.keys(l).length>0),f=An(e,o),c=En[o]||{},a={},u=l=>{l&&(a.root=a.root?`${a.root} ${l}`.replace(/\s+/g," ").trim():l)};if(t&&u(t[2].replace(/\s+/g," ").trim()),i)for(let[l,p]of Object.entries(r)){if(Object.keys(p).length===0)continue;let h;In.has(l)?(a[l]=a[l]||{},h=a[l]):(a.variants=a.variants||{},a.variants[l]=a.variants[l]||{},h=a.variants[l]);let y=c[l]||{};for(let[C,w]of Object.entries(p))h[y[C]||C]=w}for(let[l,p]of Object.entries(f.slots))l==="root"?u(p):(a.slots=a.slots||{},a.slots[l]=p);return!n&&Object.keys(f.slots).length===0?{skipped:!0,reason:f.missed.length>0?f.missed.join("; "):`${o} has no cva variants or literal className slots`}:n&&!i&&Object.keys(f.slots).length===0?{skipped:!0,reason:"cva component has no variant class maps or literal className slots"}:{skipped:!1,config:{[o]:a},warnings:f.missed}}function J(...e){return e.reduce((o,n)=>({...o,...n||{}}),{})}function Pn(e){let o=require("./lib/core/token-processor"),{mergeComponentsConfig:n}=require("./lib/core/default-config"),t=new o,s=n(e),r=t.extractClassesFromComponentsConfig(s);return{componentsConfig:s,icons:{},safelist:r,classesContent:t.generateClassesContent(r),themeCSS:t.generateThemeCSS({}),metadata:{version:"local-components"}}}function Se(e,o){let n=new P(e),t=n.exists()?n.load()||{}:{},s=J(t.componentsConfig,o),r=Pn(s);return n.save({...t,...r,icons:t.icons||{}}),r.componentsConfig}function B(e){return d.basename(e).replace(/\.(tsx|ts|jsx|js|vue)$/,"").replace(/[-_]([a-z])/g,(o,n)=>n.toUpperCase())}var On=["tsx","ts","jsx","js","vue"],xe=/\.(tsx|ts|jsx|js|vue)$/;function Dn(e){let o={};for(let n of["tsconfig.json","tsconfig.app.json","jsconfig.json"]){let t=T(d.join(e,n)),s=t&&t.compilerOptions&&t.compilerOptions.paths;s&&Object.assign(o,s)}return o}function Ln(e,o){if(!o)return null;let n=Dn(e);for(let[t,s]of Object.entries(n))if(!(!Array.isArray(s)||s.length===0)){if(t.endsWith("/*")){let r=t.slice(0,-1);if(o.startsWith(r)){let i=o.slice(r.length),f=s[0].replace(/\*+$/,"");return d.resolve(e,f,i)}}else if(t===o)return d.resolve(e,s[0])}return o.startsWith("@/")?d.resolve(e,"src",o.slice(2)):d.resolve(e,o)}function Nn(e){let o=T(d.join(e,"components.json")),n=o&&o.aliases&&o.aliases.ui,t=[n?Ln(e,n):null,d.join(e,"src","components","ui"),d.join(e,"components","ui")].filter(Boolean);return[...new Set(t)].filter(s=>g.existsSync(s))}function he(e,o){for(let t of On){let s=d.join(e,`${o}.${t}`);if(g.existsSync(s))return s}let n=d.join(e,o);if(g.existsSync(n)&&g.statSync(n).isDirectory()){let t=g.readdirSync(n).filter(i=>xe.test(i)),s=t.filter(i=>!/^index\./i.test(i)),r=s.find(i=>i.toLowerCase().startsWith(`${o.toLowerCase()}.`))||s[0]||t.find(i=>/^index\./i.test(i));if(r)return d.join(n,r)}return null}function be(e,o){let n=Nn(e);if(o&&o!=="all"){for(let r of n){let i=he(r,o);if(i)return[{component:o,inputPath:i}]}return[]}let t=new Set,s=[];for(let r of n)for(let i of g.readdirSync(r,{withFileTypes:!0})){let f,c=null;if(i.isFile()&&xe.test(i.name)&&!/^index\./i.test(i.name)?(f=B(i.name),c=d.join(r,i.name)):i.isDirectory()&&(f=B(i.name),c=he(r,i.name)),!c||!f)continue;let a=f.toLowerCase();t.has(a)||(t.add(a),s.push({component:f,inputPath:c}))}return s}function je(e){let o={},n=[],t=be(e,"all");for(let{component:s,inputPath:r}of t){let i=q(g.readFileSync(r,"utf8"),s);if(i.skipped){n.push({component:s,reason:i.reason});continue}Object.assign(o,i.config)}return{config:o,skipped:n}}S.name("frontfriend").description("FrontFriend Tailwind CLI - Manage design tokens and cache").version(Ce);S.command("login").description("Authenticate FrontFriend CLI with an 8-digit device code").option("--api-url <url>","FrontFriend API URL",process.env.FF_API_URL||"https://app.frontfriend.dev").option("--no-open","Do not open the browser automatically").action(async e=>{try{let o=e.apiUrl.replace(/\/$/,""),n=await U(`${o}/api/auth/device/start`,{}),t=n.interval||5,s=Date.now()+(n.expires_in||600)*1e3;for(console.log("\u{1F510} FrontFriend Login"),console.log(`====================
|
|
52
56
|
`),console.log(`Go to ${n.verification_uri} and enter the code:`),console.log(`
|
|
53
57
|
${n.user_code}
|
|
54
|
-
`),e.open!==!1&&
|
|
55
|
-
`);Date.now()<s;){await
|
|
56
|
-
`);let t=await new
|
|
57
|
-
Please add "ff-id" to your frontfriend.config.js file`,"ff-id");let i=e.tag||t.tag,f=e.version||t.version;console.log("\u{1F4CB} Configuration loaded"),console.log(` FF_ID: ${t.ffId}`),console.log(` App Root: ${t.appRoot}`),i&&console.log(` Tag: ${i}`),f&&console.log(` Version: ${f}`),console.log("");let c=new
|
|
58
|
+
`),e.open!==!1&&yn(n.verification_uri)&&console.log("Opened the browser for you."),console.log(`Waiting for approval...
|
|
59
|
+
`);Date.now()<s;){await hn(t*1e3);let r=await U(`${o}/api/auth/device/poll`,{device_code:n.device_code});if(r.error!=="authorization_pending"){if(r.error==="slow_down"){t=r.interval||t+5;continue}if(r.error)throw new Error(`${r.error}: ${r.error_description||"Authentication failed"}`);if(!r.access_token||!r.refresh_token||!r.device_id)throw new Error("Invalid login response from FrontFriend. Run `frontfriend login` again.");ze({accessToken:r.access_token,refreshToken:r.refresh_token,deviceId:r.device_id,expiresAt:Date.now()+(r.expires_in||900)*1e3,refreshExpiresAt:Date.now()+(r.refresh_expires_in||604800)*1e3,ffApiUrl:o}),console.log("\u2705 Login complete!"),console.log(` Credentials saved to ${He()}`),process.exit(0)}}throw new Error("expired_token: the code has expired, run `frontfriend login` again.")}catch(o){console.error("\u274C Login failed:",o.message),process.exit(1)}});S.command("logout").description("Remove FrontFriend CLI credentials").option("--api-url <url>","FrontFriend API URL",process.env.FF_API_URL||"https://app.frontfriend.dev").action(async e=>{let o=Ke(),n=(e.apiUrl||(o==null?void 0:o.ffApiUrl)||"https://app.frontfriend.dev").replace(/\/$/,"");if(o!=null&&o.accessToken&&(o!=null&&o.deviceId))try{await U(`${n}/api/plugin/logout`,{device_id:o.deviceId},o.accessToken)}catch{}let t=Ye();console.log(t?"\u2705 Logged out. Credentials removed.":"\u2139\uFE0F No stored credentials found."),process.exit(0)});S.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)").option("--registry-url <url>","Registry base URL for components.json (overrides FF_REGISTRY_URL)").action(async e=>{var o;try{console.log("\u{1F527} FrontFriend Setup"),console.log(`==================
|
|
60
|
+
`);let t=await new I().load(),s=mn(t.appRoot,{registryUrl:e.registryUrl}),r=s.isShadcnProject?je(t.appRoot):{config:{},skipped:[]};if(Cn(s),!t.ffId)throw s.isShadcnProject&&(Se(t.appRoot,r.config),console.log("\u2705 Local FrontFriend wiring complete!"),console.log(` Local component config cached (${Object.keys(r.config).length||"default"} component${Object.keys(r.config).length===1?"":"s"}).`),console.log(' Add frontfriend.config.js with "ff-id" later to fetch cloud design tokens.'),process.exit(0)),new j(`ff-id not found in frontfriend.config.js
|
|
61
|
+
Please add "ff-id" to your frontfriend.config.js file`,"ff-id");let i=e.tag||t.tag,f=e.version||t.version;console.log("\u{1F4CB} Configuration loaded"),console.log(` FF_ID: ${t.ffId}`),console.log(` App Root: ${t.appRoot}`),i&&console.log(` Tag: ${i}`),f&&console.log(` Version: ${f}`),console.log("");let c=new P(t.appRoot);!e.force&&c.exists()&&c.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..."),e.force?console.log(` Force refresh requested
|
|
58
62
|
`):c.exists()?console.log(` Cache expired
|
|
59
63
|
`):console.log(` No cache found
|
|
60
|
-
`),console.log("\u{1F310} Fetching configuration...");let a=new
|
|
64
|
+
`),console.log("\u{1F310} Fetching configuration...");let a=new ye(t.ffId,{baseURL:t["api-url"]||t.apiUrl,authToken:t["auth-token"]||t.authToken});(t["api-url"]||t.apiUrl)&&console.log(` Using API URL: ${t["api-url"]||t.apiUrl}`);let u=new We,l=null;try{l=await a.fetchProcessedTokens({tag:i,version:f,tailwindV4:u.useTailwindV4})}catch(m){console.log(` \u26A0\uFE0F Failed to fetch pre-processed tokens: ${m.message}`)}if(l){if(console.log(" \u2713 Pre-processed tokens fetched from server"),console.log(" \u2713 Skipping local processing"),Object.keys(r.config).length>0&&(l.componentsConfig=J(l.componentsConfig,r.config),console.log(` \u2713 Preserved host component classes for ${Object.keys(r.config).join(", ")}`)),l.versionMetadata){let m=l.versionMetadata;console.log(" \u2139\uFE0F Version Information:"),m.version&&console.log(` Version: ${m.version}`),m.tag&&console.log(` Tag: ${m.tag}`),m.cached!==void 0&&console.log(` From Cache: ${m.cached?"Yes":"No"}`)}if(console.log(""),(!((o=l.tokens)!=null&&o.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
|
|
61
65
|
`):console.log(` Consider adding font family tokens to your design system
|
|
62
|
-
`)),
|
|
66
|
+
`)),u.useTailwindV4){let m=u.extractClassesFromComponentsConfig(l.componentsConfig),_=[...l.safelist||[],...m||[]];l.safelist=[...new Set(_)].sort(),l.themeCSS||(l.themeCSS=u.generateThemeCSS({variables:l.variables||{},semanticVariables:l.semanticVariables||{},semanticDarkVariables:l.semanticDarkVariables||{},fontFaces:l.fonts||[],keyframes:l.keyframes||{},animations:l.animations||{},custom:l.custom||{}})),(!l.classesContent||Object.keys(r.config).length>0)&&(l.classesContent=u.generateClassesContent(l.safelist))}if(console.log("\u{1F4BE} Saving cache..."),(process.env.FF_VERBOSE==="true"||e.verbose)&&console.log(` Safelist has ${l.safelist?l.safelist.length:0} items`),c.save(l),console.log(` \u2713 Cache saved successfully
|
|
63
67
|
`),console.log("\u2705 Setup complete!"),console.log(" Your FrontFriend configuration has been cached."),console.log(" The Tailwind plugin will now use this cached data."),t.types){console.log(`
|
|
64
|
-
\u{1F524} Generating TypeScript types...`);try{let{generateIconTypes:m}=
|
|
65
|
-
`);let[
|
|
66
|
-
`),console.log("\u2699\uFE0F Processing tokens..."),console.log(" Processing raw token data...");let v=await
|
|
67
|
-
`);let
|
|
68
|
-
`));let $={tokens:v.utilities,variables:v.variables,semanticVariables:v.semanticVariables,semanticDarkVariables:v.semanticDarkVariables,fonts:v.fontFaces,icons:C,componentsConfig:x,keyframes:v.keyframes,animations:v.animations,safelist:
|
|
68
|
+
\u{1F524} Generating TypeScript types...`);try{let{generateIconTypes:m}=R(),_=t.aliases&&t.aliases.types?d.join(t.appRoot,t.aliases.types,"frontfriend.d.ts"):void 0;m({projectRoot:t.appRoot,outputPath:_})}catch(m){console.log(" \u26A0\uFE0F Type generation failed:",m.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
|
|
69
|
+
`);let[p,h,y,C,w,O]=await Promise.all([a.fetchTokens(),a.fetchComponentsConfig(),a.fetchFonts(),a.fetchIcons(),a.fetchVersion(),a.fetchCustomCss()]),x=J(h,r.config);if(console.log(" \u2713 Tokens fetched"),p.global||p.colors||p.semantic||p.semanticDark){let m=[p.global?"global":null,p.colors?"colors":null,p.semantic?"semantic":null,p.semanticDark?"semanticDark":null].filter(Boolean).join(", ");console.log(` (Found: ${m})`)}console.log(" \u2713 Components config fetched"),Object.keys(r.config).length>0&&console.log(` \u2713 Preserved host component classes for ${Object.keys(r.config).join(", ")}`),console.log(" \u2713 Fonts fetched"),console.log(" \u2713 Icons fetched"),console.log(" \u2713 Version fetched"),console.log(` \u2713 Custom CSS fetched
|
|
70
|
+
`),console.log("\u2699\uFE0F Processing tokens..."),console.log(" Processing raw token data...");let v=await u.process({colors:p.colors||p.global,semantic:p.semantic,semanticDark:p.semanticDark,fonts:y,globalTokens:p.global,animations:p.animations,version:w==null?void 0:w.version,ffId:t.ffId,customCss:O});console.log(" \u2713 Colors processed"),console.log(" \u2713 Semantic tokens processed"),v.fontFaces.length>0&&console.log(` \u2713 ${v.fontFaces.length} font faces processed`),Object.keys(v.animations).length>0&&console.log(` \u2713 ${Object.keys(v.animations).length} animations processed`),console.log(`
|
|
71
|
+
`);let Fe=u.extractClassesFromComponentsConfig(x),ke=[...v.safelist||[],...Fe||[]],z=[...new Set(ke)].sort(),K,Y;u.useTailwindV4&&(console.log("\u{1F3A8} Generating Tailwind v4 CSS artifacts..."),K=u.generateThemeCSS(v),Y=u.generateClassesContent(z),console.log(" \u2713 theme.css generated"),console.log(` \u2713 classes.css generated for @source scanning
|
|
72
|
+
`));let $={tokens:v.utilities,variables:v.variables,semanticVariables:v.semanticVariables,semanticDarkVariables:v.semanticDarkVariables,fonts:v.fontFaces,icons:C,componentsConfig:x,keyframes:v.keyframes,animations:v.animations,safelist:z,version:w,metadata:v.metadata,custom:v.custom,themeCSS:K,classesContent:Y};if(console.log("\u{1F4BE} Saving cache..."),(process.env.FF_VERBOSE==="true"||e.verbose)&&(console.log(" Cache data summary:"),console.log(` - Tokens: ${Object.keys($.tokens||{}).length} utilities`),console.log(` - Variables: ${Object.keys($.variables||{}).length} CSS variables`),console.log(` - Semantic variables: ${Object.keys($.semanticVariables||{}).length} semantic variables`),console.log(` - Font faces: ${($.fonts||[]).length} fonts`),console.log(` - Safelist: ${($.safelist||[]).length} safelist classes`)),c.save($),console.log(` \u2713 Cache saved successfully
|
|
69
73
|
`),console.log("\u2705 Setup complete!"),console.log(" Your FrontFriend configuration has been cached."),console.log(" The Tailwind plugin will now use this cached data."),t.types){console.log(`
|
|
70
|
-
\u{1F524} Generating TypeScript types...`);try{let{generateIconTypes:m}=
|
|
71
|
-
`);let o=new
|
|
72
|
-
`),console.log("Package:"),console.log(` Version: ${
|
|
73
|
-
`);let t=await new
|
|
74
|
-
Please add "ff-id" to your frontfriend.config.js file`,"ff-id");let s=new
|
|
74
|
+
\u{1F524} Generating TypeScript types...`);try{let{generateIconTypes:m}=R(),_=t.aliases&&t.aliases.types?d.join(t.appRoot,t.aliases.types,"frontfriend.d.ts"):void 0;m({projectRoot:t.appRoot,outputPath:_})}catch(m){console.log(" \u26A0\uFE0F Type generation failed:",m.message),console.log(' Enable type generation in frontfriend.config.js with "types": true')}}process.exit(0)}catch(n){n instanceof j?console.error("\u274C Configuration Error:",n.message):n instanceof en?(console.error("\u274C API Error:",n.message),console.error(` Status: ${n.statusCode}`),console.error(` URL: ${n.url}`)):n instanceof G?(console.error("\u274C Cache Error:",n.message),console.error(` Operation: ${n.operation}`)):console.error("\u274C Setup failed:",n.message),process.exit(1)}});S.command("clean").description("Remove cached configuration").action(async()=>{try{console.log(`\u{1F9F9} Cleaning FrontFriend cache...
|
|
75
|
+
`);let o=new I().load(),n=new P(o.appRoot);n.exists()?(n.clear(),console.log("\u2705 Cache cleared successfully")):console.log("\u2139\uFE0F No cache found"),process.exit(0)}catch(e){e instanceof G?(console.error("\u274C Cache Error:",e.message),console.error(` Operation: ${e.operation}`)):console.error("\u274C Clean failed:",e.message),process.exit(1)}});S.command("status").description("Show cache status and configuration").action(async()=>{try{console.log("\u{1F4CA} FrontFriend Status"),console.log(`===================
|
|
76
|
+
`),console.log("Package:"),console.log(` Version: ${Ce}`),console.log("");let o=await new I().load();console.log("Configuration:"),console.log(` FF_ID: ${o.ffId||"Not set"}`),console.log(` App Root: ${o.appRoot}`),o.tag&&console.log(` Tag: ${o.tag}`),o.version&&console.log(` Version: ${o.version}`),console.log("");let n=new P(o.appRoot),t=n.getCacheDir();if(console.log("Cache:"),console.log(` Directory: ${d.relative(process.cwd(),t)}`),n.exists()){console.log(` Status: ${n.isValid()?"\u2705 Valid":"\u26A0\uFE0F Expired"}`);let s=n.load();if(s&&s.metadata){let r=new Date(s.metadata.timestamp);console.log(` Created: ${r.toLocaleString()}`),console.log(` Format Version: ${s.metadata.version||"Unknown"}`)}s&&s.versionMetadata&&(console.log(" Cached Version Info:"),s.versionMetadata.version&&console.log(` Version: ${s.versionMetadata.version}`),s.versionMetadata.tag&&console.log(` Tag: ${s.versionMetadata.tag}`))}else console.log(" Status: \u274C Not found");process.exit(0)}catch(e){e instanceof j?console.error("\u274C Configuration Error:",e.message):e instanceof G?(console.error("\u274C Cache Error:",e.message),console.error(` Operation: ${e.operation}`)):console.error("\u274C Status check failed:",e.message),process.exit(1)}});S.command("migrate").description("Migrate shadcn components (cva + non-cva) into FrontFriend config, rewriting classes to FF tokens by default").option("--component <name>",'Component to migrate, or "all" to scan the UI dir',"all").option("--input <path>","Path to the shadcn component source").option("--output <path>","Output JSON path for migrated config",sn).option("--no-push","Do not push migrated config to the configured FrontFriend cloud").option("--keep-shadcn-classes","Keep raw shadcn classes instead of rewriting them to FrontFriend tokens (default: rewrite)").action(async e=>{try{let n=await new I().load(),t=n.appRoot,s=e.input&&e.component==="all"?B(e.input):e.component,r;if(e.input){let c=d.resolve(t,e.input);if(!g.existsSync(c))throw new j(`Component source not found: ${d.relative(t,c)}`);let a=g.readFileSync(c,"utf8");r=q(a,s)}else if(s==="all")r=je(t);else{let c=be(t,s);if(c.length===0)throw new j(`Component source "${s}" not found under components/ui or src/components/ui`,"component");let a=g.readFileSync(c[0].inputPath,"utf8");r=q(a,s)}if(r.skipped===!0||Object.keys(r.config||{}).length===0){let c=r.reason||(Array.isArray(r.skipped)&&r.skipped.length>0?r.skipped.map(a=>`${a.component} (${a.reason})`).join(", "):"no cva-structured components or literal className slots found");console.log(`\u23ED\uFE0F Skipped ${s}: ${c}`),process.exit(0)}if(!e.keepShadcnClasses){r.config=V(r.config,Qe);let c=un(t);if(c){let a=Xe(g.readFileSync(c,"utf8"));if(a){let u=d.join(new P(t).getCacheDir(),"migrated-customcss.css");g.mkdirSync(d.dirname(u),{recursive:!0}),g.writeFileSync(u,a),console.log(` Imported host css vars \u2192 ${d.relative(t,u)}`)}}}let i=d.resolve(t,e.output);H(i,r.config),Se(t,r.config);let f=!1;e.push&&n.ffId&&(await new ye(n.ffId,{baseURL:n["api-url"]||n.apiUrl,authToken:n["auth-token"]||n.authToken}).pushComponentsConfig(r.config),f=!0),console.log("\u2705 Migration complete!"),console.log(` Component: ${s==="all"?Object.keys(r.config).join(", "):s}`),console.log(` Output: ${d.relative(t,i)}`),console.log(" Local config: cached for the FrontFriend plugin"),r.skipped&&r.skipped.length>0&&console.log(` Skipped: ${r.skipped.map(c=>`${c.component} (${c.reason})`).join(", ")}`),console.log(f?" Cloud config: pushed user override":" Cloud config: not pushed (missing ff-id or --no-push)"),process.exit(0)}catch(o){o instanceof j?console.error("\u274C Migration Error:",o.message):console.error("\u274C Migration failed:",o.message),process.exit(1)}});S.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("--registry <generation>","Registry generation to use (legacy/v4)").option("--overwrite","Overwrite existing files").action(async(e,o)=>{try{console.log(`\u{1F4E6} Downloading components...
|
|
77
|
+
`);let t=await new I().load();if(!t.ffId)throw new j(`ff-id not found in frontfriend.config.js
|
|
78
|
+
Please add "ff-id" to your frontfriend.config.js file`,"ff-id");let s=new Ze({appRoot:t.appRoot,config:t,framework:o.framework,registryGeneration:o.registry,outputPath:o.output,overwrite:o.overwrite}),r=e;if(e.length===1&&e[0].toLowerCase()==="all"){let f=await s.getAllComponents(),c=await s.getCustomComponents();process.env.FF_DEBUG&&console.log(`Debug: Found ${c.length} custom components: ${c.join(", ")}`),f.length===0&&(console.error("\u274C Failed to fetch component list"),process.exit(1));let a=new Set(c),u=f.filter(l=>!a.has(l));r=[...c,...u],console.log("\u{1F4CB} Configuration"),console.log(` Framework: ${s.framework}`),console.log(` Registry: ${s.registryGeneration}`),console.log(` Output: ${s.outputPath}`),console.log(` Components: All ${r.length} components`),process.env.FF_DEBUG&&c.length>0&&console.log(` Debug: ${c.length} custom components will override standard ones`),console.log("")}else console.log("\u{1F4CB} Configuration"),console.log(` Framework: ${s.framework}`),console.log(` Registry: ${s.registryGeneration}`),console.log(` Output: ${s.outputPath}`),console.log(` Components: ${e.join(", ")}
|
|
75
79
|
`);let i=await s.downloadComponents(r);i.successful.length>0&&(console.log(`
|
|
76
80
|
\u2705 Download complete!`),console.log(` Downloaded: ${i.successful.length} components`)),i.failed.length>0&&(console.log(""),i.failed.forEach(f=>{f.error.includes("not found")?console.log(`\u274C ${f.error}`):console.log(`\u274C Failed to download ${f.component}: ${f.error}`)})),i.successful.length>0&&i.dependencies.length>0&&(console.log(`
|
|
77
|
-
\u{1F4E6} Install dependencies:`),console.log(` npm install ${i.dependencies.join(" ")}`)),i.successful.length===0&&i.failed.length>0&&process.exit(1),process.exit(0)}catch(n){n instanceof
|
|
81
|
+
\u{1F4E6} Install dependencies:`),console.log(` npm install ${i.dependencies.join(" ")}`)),i.successful.length===0&&i.failed.length>0&&process.exit(1),process.exit(0)}catch(n){n instanceof j?(console.error("\u274C Configuration Error:",n.message),n.missingKey&&console.error(` Missing key: ${n.missingKey}`)):console.error("\u274C Download failed:",n.message),process.exit(1)}});S.parse(process.argv);process.argv.slice(2).length||(S.outputHelp(),process.exit(0));
|
|
78
82
|
//# sourceMappingURL=cli-temp.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var r={anyOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"}]},f={$id:"https://frontfriend.dev/schemas/components-config.schema.json",type:"object",additionalProperties:{anyOf:[{$ref:"#/$defs/classValue"},{$ref:"#/$defs/componentEnvelope"}]},$defs:{classValue:r,slotValue:{anyOf:[{$ref:"#/$defs/classValue"},{type:"object",additionalProperties:{$ref:"#/$defs/slotValue"}}]},reservedBucket:{anyOf:[{$ref:"#/$defs/classValue"},{type:"object",additionalProperties:{$ref:"#/$defs/slotValue"}}]},componentEnvelope:{type:"object",additionalProperties:!1,properties:{root:{$ref:"#/$defs/slotValue"},variants:{type:"object",additionalProperties:{$ref:"#/$defs/reservedBucket"}},variant:{$ref:"#/$defs/reservedBucket"},size:{$ref:"#/$defs/reservedBucket"},sizes:{$ref:"#/$defs/reservedBucket"},iconPosition:{$ref:"#/$defs/reservedBucket"},color:{$ref:"#/$defs/reservedBucket"},fullwidth:{$ref:"#/$defs/reservedBucket"},states:{$ref:"#/$defs/reservedBucket"},compoundVariants:{$ref:"#/$defs/reservedBucket"},defaultVariants:{$ref:"#/$defs/reservedBucket"},props:{$ref:"#/$defs/reservedBucket"},slots:{type:"object",additionalProperties:{$ref:"#/$defs/slotValue"}}}}}};function o(e){if(typeof e!="string"||e.trim().length===0||/^[0-9]
|
|
1
|
+
var r={anyOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"}]},f={$id:"https://frontfriend.dev/schemas/components-config.schema.json",type:"object",additionalProperties:{anyOf:[{$ref:"#/$defs/classValue"},{$ref:"#/$defs/componentEnvelope"}]},$defs:{classValue:r,slotValue:{anyOf:[{$ref:"#/$defs/classValue"},{type:"object",additionalProperties:{$ref:"#/$defs/slotValue"}}]},reservedBucket:{anyOf:[{$ref:"#/$defs/classValue"},{type:"object",additionalProperties:{$ref:"#/$defs/slotValue"}}]},componentEnvelope:{type:"object",additionalProperties:!1,properties:{root:{$ref:"#/$defs/slotValue"},variants:{type:"object",additionalProperties:{$ref:"#/$defs/reservedBucket"}},variant:{$ref:"#/$defs/reservedBucket"},size:{$ref:"#/$defs/reservedBucket"},sizes:{$ref:"#/$defs/reservedBucket"},iconPosition:{$ref:"#/$defs/reservedBucket"},icons:{$ref:"#/$defs/reservedBucket"},color:{$ref:"#/$defs/reservedBucket"},fullwidth:{$ref:"#/$defs/reservedBucket"},states:{$ref:"#/$defs/reservedBucket"},compoundVariants:{$ref:"#/$defs/reservedBucket"},defaultVariants:{$ref:"#/$defs/reservedBucket"},props:{$ref:"#/$defs/reservedBucket"},slots:{type:"object",additionalProperties:{$ref:"#/$defs/slotValue"}}}}}};function o(e){if(typeof e!="string"||e.trim().length===0||/^[0-9]+(?:\.[0-9]+)?$/.test(e)||e==="true"||e==="false")return!1;let s=/\s/.test(e),t=/[-:\[\]\/]/.test(e);return!0}module.exports={componentsConfigSchema:f,isCSSClassString:o};
|
|
2
2
|
//# sourceMappingURL=components-config-schema.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../lib/core/components-config-schema.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Shared componentsConfig schema for FrontFriend tools.\n *\n * The schema defines the canonical per-component envelope used by ffdc,\n * validation scripts, migration tooling, and registry completeness checks.\n * Keep this file as the single source of truth; consumers should re-export it\n * instead of maintaining local schema copies.\n */\n\nconst classValueSchema = {\n anyOf: [\n { type: 'string' },\n { type: 'number' },\n { type: 'boolean' },\n { type: 'null' },\n ],\n};\n\nconst componentsConfigSchema = {\n $id: 'https://frontfriend.dev/schemas/components-config.schema.json',\n type: 'object',\n // A component is a bare class string (e.g. spinner: \"animate-spin\") or a\n // strict envelope.\n additionalProperties: {\n anyOf: [{ $ref: '#/$defs/classValue' }, { $ref: '#/$defs/componentEnvelope' }],\n },\n $defs: {\n classValue: classValueSchema,\n\n // Permissive recursive tree used INSIDE `slots` and for `root`: leaves are\n // class values, objects nest freely. Slot internals are NOT namespaced\n // again (slots live at the component top level only), so e.g.\n // `slots.trigger.icon` and `slots.list.line` stay as plain nested keys.\n slotValue: {\n anyOf: [\n { $ref: '#/$defs/classValue' },\n { type: 'object', additionalProperties: { $ref: '#/$defs/slotValue' } },\n ],\n },\n\n // Variant / prop buckets: a class-value leaf or a (possibly nested) map.\n reservedBucket: {\n anyOf: [\n { $ref: '#/$defs/classValue' },\n { type: 'object', additionalProperties: { $ref: '#/$defs/slotValue' } },\n ],\n },\n\n // STRICT canonical v4 envelope: a fixed set of reserved buckets plus a\n // single `slots` namespace holding every named child slot.\n // `additionalProperties: false` is what standardizes the shape \u2014 any stray\n // top-level key (a slot left outside `slots`, a typo) is rejected.\n componentEnvelope: {\n type: 'object',\n additionalProperties: false,\n properties: {\n // Root classes for the component. Usually a class string; some\n // components (e.g. sidebar) nest a sub-tree under root.\n root: { $ref: '#/$defs/slotValue' },\n\n // Canonical variant buckets (variants.variant, variants.size, \u2026) plus\n // the flat compatibility aliases.\n variants: { type: 'object', additionalProperties: { $ref: '#/$defs/reservedBucket' } },\n variant: { $ref: '#/$defs/reservedBucket' },\n size: { $ref: '#/$defs/reservedBucket' },\n sizes: { $ref: '#/$defs/reservedBucket' },\n iconPosition: { $ref: '#/$defs/reservedBucket' },\n color: { $ref: '#/$defs/reservedBucket' },\n fullwidth: { $ref: '#/$defs/reservedBucket' },\n states: { $ref: '#/$defs/reservedBucket' },\n compoundVariants: { $ref: '#/$defs/reservedBucket' },\n defaultVariants: { $ref: '#/$defs/reservedBucket' },\n props: { $ref: '#/$defs/reservedBucket' },\n\n // All named child slots (item, trigger, content, icon, menu, \u2026) live\n // here. Top-level only \u2014 slot internals stay direct.\n slots: { type: 'object', additionalProperties: { $ref: '#/$defs/slotValue' } },\n },\n },\n },\n};\n\nfunction isCSSClassString(value) {\n if (typeof value !== 'string') return false;\n\n if (value.trim().length === 0) return false;\n\n if (/^[0-9]
|
|
5
|
-
"mappings": "AASA,IAAMA,EAAmB,CACvB,MAAO,CACL,CAAE,KAAM,QAAS,EACjB,CAAE,KAAM,QAAS,EACjB,CAAE,KAAM,SAAU,EAClB,CAAE,KAAM,MAAO,CACjB,CACF,EAEMC,EAAyB,CAC7B,IAAK,gEACL,KAAM,SAGN,qBAAsB,CACpB,MAAO,CAAC,CAAE,KAAM,oBAAqB,EAAG,CAAE,KAAM,2BAA4B,CAAC,CAC/E,EACA,MAAO,CACL,WAAYD,EAMZ,UAAW,CACT,MAAO,CACL,CAAE,KAAM,oBAAqB,EAC7B,CAAE,KAAM,SAAU,qBAAsB,CAAE,KAAM,mBAAoB,CAAE,CACxE,CACF,EAGA,eAAgB,CACd,MAAO,CACL,CAAE,KAAM,oBAAqB,EAC7B,CAAE,KAAM,SAAU,qBAAsB,CAAE,KAAM,mBAAoB,CAAE,CACxE,CACF,EAMA,kBAAmB,CACjB,KAAM,SACN,qBAAsB,GACtB,WAAY,CAGV,KAAM,CAAE,KAAM,mBAAoB,EAIlC,SAAU,CAAE,KAAM,SAAU,qBAAsB,CAAE,KAAM,wBAAyB,CAAE,EACrF,QAAS,CAAE,KAAM,wBAAyB,EAC1C,KAAM,CAAE,KAAM,wBAAyB,EACvC,MAAO,CAAE,KAAM,wBAAyB,EACxC,aAAc,CAAE,KAAM,wBAAyB,EAC/C,MAAO,CAAE,KAAM,wBAAyB,EACxC,UAAW,CAAE,KAAM,wBAAyB,EAC5C,OAAQ,CAAE,KAAM,wBAAyB,EACzC,iBAAkB,CAAE,KAAM,wBAAyB,EACnD,gBAAiB,CAAE,KAAM,wBAAyB,EAClD,MAAO,CAAE,KAAM,wBAAyB,EAIxC,MAAO,CAAE,KAAM,SAAU,qBAAsB,CAAE,KAAM,mBAAoB,CAAE,CAC/E,CACF,CACF,CACF,EAEA,SAASE,EAAiBC,EAAO,CAO/B,GANI,OAAOA,GAAU,UAEjBA,EAAM,KAAK,EAAE,SAAW,GAExB,
|
|
4
|
+
"sourcesContent": ["/**\n * Shared componentsConfig schema for FrontFriend tools.\n *\n * The schema defines the canonical per-component envelope used by ffdc,\n * validation scripts, migration tooling, and registry completeness checks.\n * Keep this file as the single source of truth; consumers should re-export it\n * instead of maintaining local schema copies.\n */\n\nconst classValueSchema = {\n anyOf: [\n { type: 'string' },\n { type: 'number' },\n { type: 'boolean' },\n { type: 'null' },\n ],\n};\n\nconst componentsConfigSchema = {\n $id: 'https://frontfriend.dev/schemas/components-config.schema.json',\n type: 'object',\n // A component is a bare class string (e.g. spinner: \"animate-spin\") or a\n // strict envelope.\n additionalProperties: {\n anyOf: [{ $ref: '#/$defs/classValue' }, { $ref: '#/$defs/componentEnvelope' }],\n },\n $defs: {\n classValue: classValueSchema,\n\n // Permissive recursive tree used INSIDE `slots` and for `root`: leaves are\n // class values, objects nest freely. Slot internals are NOT namespaced\n // again (slots live at the component top level only), so e.g.\n // `slots.trigger.icon` and `slots.list.line` stay as plain nested keys.\n slotValue: {\n anyOf: [\n { $ref: '#/$defs/classValue' },\n { type: 'object', additionalProperties: { $ref: '#/$defs/slotValue' } },\n ],\n },\n\n // Variant / prop buckets: a class-value leaf or a (possibly nested) map.\n reservedBucket: {\n anyOf: [\n { $ref: '#/$defs/classValue' },\n { type: 'object', additionalProperties: { $ref: '#/$defs/slotValue' } },\n ],\n },\n\n // STRICT canonical v4 envelope: a fixed set of reserved buckets plus a\n // single `slots` namespace holding every named child slot.\n // `additionalProperties: false` is what standardizes the shape \u2014 any stray\n // top-level key (a slot left outside `slots`, a typo) is rejected.\n componentEnvelope: {\n type: 'object',\n additionalProperties: false,\n properties: {\n // Root classes for the component. Usually a class string; some\n // components (e.g. sidebar) nest a sub-tree under root.\n root: { $ref: '#/$defs/slotValue' },\n\n // Canonical variant buckets (variants.variant, variants.size, \u2026) plus\n // the flat compatibility aliases.\n variants: { type: 'object', additionalProperties: { $ref: '#/$defs/reservedBucket' } },\n variant: { $ref: '#/$defs/reservedBucket' },\n size: { $ref: '#/$defs/reservedBucket' },\n sizes: { $ref: '#/$defs/reservedBucket' },\n iconPosition: { $ref: '#/$defs/reservedBucket' },\n icons: { $ref: '#/$defs/reservedBucket' },\n color: { $ref: '#/$defs/reservedBucket' },\n fullwidth: { $ref: '#/$defs/reservedBucket' },\n states: { $ref: '#/$defs/reservedBucket' },\n compoundVariants: { $ref: '#/$defs/reservedBucket' },\n defaultVariants: { $ref: '#/$defs/reservedBucket' },\n props: { $ref: '#/$defs/reservedBucket' },\n\n // All named child slots (item, trigger, content, icon, menu, \u2026) live\n // here. Top-level only \u2014 slot internals stay direct.\n slots: { type: 'object', additionalProperties: { $ref: '#/$defs/slotValue' } },\n },\n },\n },\n};\n\nfunction isCSSClassString(value) {\n if (typeof value !== 'string') return false;\n\n if (value.trim().length === 0) return false;\n\n if (/^[0-9]+(?:\\.[0-9]+)?$/.test(value)) return false;\n\n if (value === 'true' || value === 'false') return false;\n\n const hasSpaces = /\\s/.test(value);\n const hasTailwindSyntax = /[-:\\[\\]\\/]/.test(value);\n\n if (hasSpaces || hasTailwindSyntax) return true;\n\n return true;\n}\n\nmodule.exports = {\n componentsConfigSchema,\n isCSSClassString,\n};\n"],
|
|
5
|
+
"mappings": "AASA,IAAMA,EAAmB,CACvB,MAAO,CACL,CAAE,KAAM,QAAS,EACjB,CAAE,KAAM,QAAS,EACjB,CAAE,KAAM,SAAU,EAClB,CAAE,KAAM,MAAO,CACjB,CACF,EAEMC,EAAyB,CAC7B,IAAK,gEACL,KAAM,SAGN,qBAAsB,CACpB,MAAO,CAAC,CAAE,KAAM,oBAAqB,EAAG,CAAE,KAAM,2BAA4B,CAAC,CAC/E,EACA,MAAO,CACL,WAAYD,EAMZ,UAAW,CACT,MAAO,CACL,CAAE,KAAM,oBAAqB,EAC7B,CAAE,KAAM,SAAU,qBAAsB,CAAE,KAAM,mBAAoB,CAAE,CACxE,CACF,EAGA,eAAgB,CACd,MAAO,CACL,CAAE,KAAM,oBAAqB,EAC7B,CAAE,KAAM,SAAU,qBAAsB,CAAE,KAAM,mBAAoB,CAAE,CACxE,CACF,EAMA,kBAAmB,CACjB,KAAM,SACN,qBAAsB,GACtB,WAAY,CAGV,KAAM,CAAE,KAAM,mBAAoB,EAIlC,SAAU,CAAE,KAAM,SAAU,qBAAsB,CAAE,KAAM,wBAAyB,CAAE,EACrF,QAAS,CAAE,KAAM,wBAAyB,EAC1C,KAAM,CAAE,KAAM,wBAAyB,EACvC,MAAO,CAAE,KAAM,wBAAyB,EACxC,aAAc,CAAE,KAAM,wBAAyB,EAC/C,MAAO,CAAE,KAAM,wBAAyB,EACxC,MAAO,CAAE,KAAM,wBAAyB,EACxC,UAAW,CAAE,KAAM,wBAAyB,EAC5C,OAAQ,CAAE,KAAM,wBAAyB,EACzC,iBAAkB,CAAE,KAAM,wBAAyB,EACnD,gBAAiB,CAAE,KAAM,wBAAyB,EAClD,MAAO,CAAE,KAAM,wBAAyB,EAIxC,MAAO,CAAE,KAAM,SAAU,qBAAsB,CAAE,KAAM,mBAAoB,CAAE,CAC/E,CACF,CACF,CACF,EAEA,SAASE,EAAiBC,EAAO,CAO/B,GANI,OAAOA,GAAU,UAEjBA,EAAM,KAAK,EAAE,SAAW,GAExB,wBAAwB,KAAKA,CAAK,GAElCA,IAAU,QAAUA,IAAU,QAAS,MAAO,GAElD,IAAMC,EAAY,KAAK,KAAKD,CAAK,EAC3BE,EAAoB,aAAa,KAAKF,CAAK,EAEjD,MAA2C,EAG7C,CAEA,OAAO,QAAU,CACf,uBAAAF,EACA,iBAAAC,CACF",
|
|
6
6
|
"names": ["classValueSchema", "componentsConfigSchema", "isCSSClassString", "value", "hasSpaces", "hasTailwindSyntax"]
|
|
7
7
|
}
|
package/dist/ffdc.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var n=(e,s)=>()=>(s||e((s={exports:{}}).exports,s),s.exports);var o=n((u,r)=>{var a={anyOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"}]},i={$id:"https://frontfriend.dev/schemas/components-config.schema.json",type:"object",additionalProperties:{anyOf:[{$ref:"#/$defs/classValue"},{$ref:"#/$defs/componentEnvelope"}]},$defs:{classValue:a,slotValue:{anyOf:[{$ref:"#/$defs/classValue"},{type:"object",additionalProperties:{$ref:"#/$defs/slotValue"}}]},reservedBucket:{anyOf:[{$ref:"#/$defs/classValue"},{type:"object",additionalProperties:{$ref:"#/$defs/slotValue"}}]},componentEnvelope:{type:"object",additionalProperties:!1,properties:{root:{$ref:"#/$defs/slotValue"},variants:{type:"object",additionalProperties:{$ref:"#/$defs/reservedBucket"}},variant:{$ref:"#/$defs/reservedBucket"},size:{$ref:"#/$defs/reservedBucket"},sizes:{$ref:"#/$defs/reservedBucket"},iconPosition:{$ref:"#/$defs/reservedBucket"},color:{$ref:"#/$defs/reservedBucket"},fullwidth:{$ref:"#/$defs/reservedBucket"},states:{$ref:"#/$defs/reservedBucket"},compoundVariants:{$ref:"#/$defs/reservedBucket"},defaultVariants:{$ref:"#/$defs/reservedBucket"},props:{$ref:"#/$defs/reservedBucket"},slots:{type:"object",additionalProperties:{$ref:"#/$defs/slotValue"}}}}}};function d(e){if(typeof e!="string"||e.trim().length===0||/^[0-9]
|
|
1
|
+
var n=(e,s)=>()=>(s||e((s={exports:{}}).exports,s),s.exports);var o=n((u,r)=>{var a={anyOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"}]},i={$id:"https://frontfriend.dev/schemas/components-config.schema.json",type:"object",additionalProperties:{anyOf:[{$ref:"#/$defs/classValue"},{$ref:"#/$defs/componentEnvelope"}]},$defs:{classValue:a,slotValue:{anyOf:[{$ref:"#/$defs/classValue"},{type:"object",additionalProperties:{$ref:"#/$defs/slotValue"}}]},reservedBucket:{anyOf:[{$ref:"#/$defs/classValue"},{type:"object",additionalProperties:{$ref:"#/$defs/slotValue"}}]},componentEnvelope:{type:"object",additionalProperties:!1,properties:{root:{$ref:"#/$defs/slotValue"},variants:{type:"object",additionalProperties:{$ref:"#/$defs/reservedBucket"}},variant:{$ref:"#/$defs/reservedBucket"},size:{$ref:"#/$defs/reservedBucket"},sizes:{$ref:"#/$defs/reservedBucket"},iconPosition:{$ref:"#/$defs/reservedBucket"},icons:{$ref:"#/$defs/reservedBucket"},color:{$ref:"#/$defs/reservedBucket"},fullwidth:{$ref:"#/$defs/reservedBucket"},states:{$ref:"#/$defs/reservedBucket"},compoundVariants:{$ref:"#/$defs/reservedBucket"},defaultVariants:{$ref:"#/$defs/reservedBucket"},props:{$ref:"#/$defs/reservedBucket"},slots:{type:"object",additionalProperties:{$ref:"#/$defs/slotValue"}}}}}};function d(e){if(typeof e!="string"||e.trim().length===0||/^[0-9]+(?:\.[0-9]+)?$/.test(e)||e==="true"||e==="false")return!1;let s=/\s/.test(e),f=/[-:\[\]\/]/.test(e);return!0}r.exports={componentsConfigSchema:i,isCSSClassString:d}});var{componentsConfigSchema:c,isCSSClassString:$}=o();function t(e){if(!e)return{};if(typeof e!="object")throw new Error("Config must be an object");return e}t.componentsConfigSchema=c;t.isCSSClassString=$;module.exports=t;
|
|
2
2
|
//# sourceMappingURL=ffdc.js.map
|
package/dist/ffdc.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../lib/core/components-config-schema.js", "../ffdc.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Shared componentsConfig schema for FrontFriend tools.\n *\n * The schema defines the canonical per-component envelope used by ffdc,\n * validation scripts, migration tooling, and registry completeness checks.\n * Keep this file as the single source of truth; consumers should re-export it\n * instead of maintaining local schema copies.\n */\n\nconst classValueSchema = {\n anyOf: [\n { type: 'string' },\n { type: 'number' },\n { type: 'boolean' },\n { type: 'null' },\n ],\n};\n\nconst componentsConfigSchema = {\n $id: 'https://frontfriend.dev/schemas/components-config.schema.json',\n type: 'object',\n // A component is a bare class string (e.g. spinner: \"animate-spin\") or a\n // strict envelope.\n additionalProperties: {\n anyOf: [{ $ref: '#/$defs/classValue' }, { $ref: '#/$defs/componentEnvelope' }],\n },\n $defs: {\n classValue: classValueSchema,\n\n // Permissive recursive tree used INSIDE `slots` and for `root`: leaves are\n // class values, objects nest freely. Slot internals are NOT namespaced\n // again (slots live at the component top level only), so e.g.\n // `slots.trigger.icon` and `slots.list.line` stay as plain nested keys.\n slotValue: {\n anyOf: [\n { $ref: '#/$defs/classValue' },\n { type: 'object', additionalProperties: { $ref: '#/$defs/slotValue' } },\n ],\n },\n\n // Variant / prop buckets: a class-value leaf or a (possibly nested) map.\n reservedBucket: {\n anyOf: [\n { $ref: '#/$defs/classValue' },\n { type: 'object', additionalProperties: { $ref: '#/$defs/slotValue' } },\n ],\n },\n\n // STRICT canonical v4 envelope: a fixed set of reserved buckets plus a\n // single `slots` namespace holding every named child slot.\n // `additionalProperties: false` is what standardizes the shape \u2014 any stray\n // top-level key (a slot left outside `slots`, a typo) is rejected.\n componentEnvelope: {\n type: 'object',\n additionalProperties: false,\n properties: {\n // Root classes for the component. Usually a class string; some\n // components (e.g. sidebar) nest a sub-tree under root.\n root: { $ref: '#/$defs/slotValue' },\n\n // Canonical variant buckets (variants.variant, variants.size, \u2026) plus\n // the flat compatibility aliases.\n variants: { type: 'object', additionalProperties: { $ref: '#/$defs/reservedBucket' } },\n variant: { $ref: '#/$defs/reservedBucket' },\n size: { $ref: '#/$defs/reservedBucket' },\n sizes: { $ref: '#/$defs/reservedBucket' },\n iconPosition: { $ref: '#/$defs/reservedBucket' },\n color: { $ref: '#/$defs/reservedBucket' },\n fullwidth: { $ref: '#/$defs/reservedBucket' },\n states: { $ref: '#/$defs/reservedBucket' },\n compoundVariants: { $ref: '#/$defs/reservedBucket' },\n defaultVariants: { $ref: '#/$defs/reservedBucket' },\n props: { $ref: '#/$defs/reservedBucket' },\n\n // All named child slots (item, trigger, content, icon, menu, \u2026) live\n // here. Top-level only \u2014 slot internals stay direct.\n slots: { type: 'object', additionalProperties: { $ref: '#/$defs/slotValue' } },\n },\n },\n },\n};\n\nfunction isCSSClassString(value) {\n if (typeof value !== 'string') return false;\n\n if (value.trim().length === 0) return false;\n\n if (/^[0-9]
|
|
5
|
-
"mappings": "8DAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CASA,IAAMC,EAAmB,CACvB,MAAO,CACL,CAAE,KAAM,QAAS,EACjB,CAAE,KAAM,QAAS,EACjB,CAAE,KAAM,SAAU,EAClB,CAAE,KAAM,MAAO,CACjB,CACF,EAEMC,EAAyB,CAC7B,IAAK,gEACL,KAAM,SAGN,qBAAsB,CACpB,MAAO,CAAC,CAAE,KAAM,oBAAqB,EAAG,CAAE,KAAM,2BAA4B,CAAC,CAC/E,EACA,MAAO,CACL,WAAYD,EAMZ,UAAW,CACT,MAAO,CACL,CAAE,KAAM,oBAAqB,EAC7B,CAAE,KAAM,SAAU,qBAAsB,CAAE,KAAM,mBAAoB,CAAE,CACxE,CACF,EAGA,eAAgB,CACd,MAAO,CACL,CAAE,KAAM,oBAAqB,EAC7B,CAAE,KAAM,SAAU,qBAAsB,CAAE,KAAM,mBAAoB,CAAE,CACxE,CACF,EAMA,kBAAmB,CACjB,KAAM,SACN,qBAAsB,GACtB,WAAY,CAGV,KAAM,CAAE,KAAM,mBAAoB,EAIlC,SAAU,CAAE,KAAM,SAAU,qBAAsB,CAAE,KAAM,wBAAyB,CAAE,EACrF,QAAS,CAAE,KAAM,wBAAyB,EAC1C,KAAM,CAAE,KAAM,wBAAyB,EACvC,MAAO,CAAE,KAAM,wBAAyB,EACxC,aAAc,CAAE,KAAM,wBAAyB,EAC/C,MAAO,CAAE,KAAM,wBAAyB,EACxC,UAAW,CAAE,KAAM,wBAAyB,EAC5C,OAAQ,CAAE,KAAM,wBAAyB,EACzC,iBAAkB,CAAE,KAAM,wBAAyB,EACnD,gBAAiB,CAAE,KAAM,wBAAyB,EAClD,MAAO,CAAE,KAAM,wBAAyB,EAIxC,MAAO,CAAE,KAAM,SAAU,qBAAsB,CAAE,KAAM,mBAAoB,CAAE,CAC/E,CACF,CACF,CACF,EAEA,SAASE,EAAiBC,EAAO,CAO/B,GANI,OAAOA,GAAU,UAEjBA,EAAM,KAAK,EAAE,SAAW,GAExB,
|
|
4
|
+
"sourcesContent": ["/**\n * Shared componentsConfig schema for FrontFriend tools.\n *\n * The schema defines the canonical per-component envelope used by ffdc,\n * validation scripts, migration tooling, and registry completeness checks.\n * Keep this file as the single source of truth; consumers should re-export it\n * instead of maintaining local schema copies.\n */\n\nconst classValueSchema = {\n anyOf: [\n { type: 'string' },\n { type: 'number' },\n { type: 'boolean' },\n { type: 'null' },\n ],\n};\n\nconst componentsConfigSchema = {\n $id: 'https://frontfriend.dev/schemas/components-config.schema.json',\n type: 'object',\n // A component is a bare class string (e.g. spinner: \"animate-spin\") or a\n // strict envelope.\n additionalProperties: {\n anyOf: [{ $ref: '#/$defs/classValue' }, { $ref: '#/$defs/componentEnvelope' }],\n },\n $defs: {\n classValue: classValueSchema,\n\n // Permissive recursive tree used INSIDE `slots` and for `root`: leaves are\n // class values, objects nest freely. Slot internals are NOT namespaced\n // again (slots live at the component top level only), so e.g.\n // `slots.trigger.icon` and `slots.list.line` stay as plain nested keys.\n slotValue: {\n anyOf: [\n { $ref: '#/$defs/classValue' },\n { type: 'object', additionalProperties: { $ref: '#/$defs/slotValue' } },\n ],\n },\n\n // Variant / prop buckets: a class-value leaf or a (possibly nested) map.\n reservedBucket: {\n anyOf: [\n { $ref: '#/$defs/classValue' },\n { type: 'object', additionalProperties: { $ref: '#/$defs/slotValue' } },\n ],\n },\n\n // STRICT canonical v4 envelope: a fixed set of reserved buckets plus a\n // single `slots` namespace holding every named child slot.\n // `additionalProperties: false` is what standardizes the shape \u2014 any stray\n // top-level key (a slot left outside `slots`, a typo) is rejected.\n componentEnvelope: {\n type: 'object',\n additionalProperties: false,\n properties: {\n // Root classes for the component. Usually a class string; some\n // components (e.g. sidebar) nest a sub-tree under root.\n root: { $ref: '#/$defs/slotValue' },\n\n // Canonical variant buckets (variants.variant, variants.size, \u2026) plus\n // the flat compatibility aliases.\n variants: { type: 'object', additionalProperties: { $ref: '#/$defs/reservedBucket' } },\n variant: { $ref: '#/$defs/reservedBucket' },\n size: { $ref: '#/$defs/reservedBucket' },\n sizes: { $ref: '#/$defs/reservedBucket' },\n iconPosition: { $ref: '#/$defs/reservedBucket' },\n icons: { $ref: '#/$defs/reservedBucket' },\n color: { $ref: '#/$defs/reservedBucket' },\n fullwidth: { $ref: '#/$defs/reservedBucket' },\n states: { $ref: '#/$defs/reservedBucket' },\n compoundVariants: { $ref: '#/$defs/reservedBucket' },\n defaultVariants: { $ref: '#/$defs/reservedBucket' },\n props: { $ref: '#/$defs/reservedBucket' },\n\n // All named child slots (item, trigger, content, icon, menu, \u2026) live\n // here. Top-level only \u2014 slot internals stay direct.\n slots: { type: 'object', additionalProperties: { $ref: '#/$defs/slotValue' } },\n },\n },\n },\n};\n\nfunction isCSSClassString(value) {\n if (typeof value !== 'string') return false;\n\n if (value.trim().length === 0) return false;\n\n if (/^[0-9]+(?:\\.[0-9]+)?$/.test(value)) return false;\n\n if (value === 'true' || value === 'false') return false;\n\n const hasSpaces = /\\s/.test(value);\n const hasTailwindSyntax = /[-:\\[\\]\\/]/.test(value);\n\n if (hasSpaces || hasTailwindSyntax) return true;\n\n return true;\n}\n\nmodule.exports = {\n componentsConfigSchema,\n isCSSClassString,\n};\n", "// ffdc.js - Simple config accessor\n// No base64 decoding, just returns the config object directly\n\nconst {\n componentsConfigSchema,\n isCSSClassString,\n} = require('./lib/core/components-config-schema');\n\nfunction ffdc(config) {\n if (!config) {\n return {};\n }\n\n if (typeof config !== 'object') {\n throw new Error('Config must be an object');\n }\n\n return config;\n}\n\nffdc.componentsConfigSchema = componentsConfigSchema;\nffdc.isCSSClassString = isCSSClassString;\n\nmodule.exports = ffdc;\n"],
|
|
5
|
+
"mappings": "8DAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CASA,IAAMC,EAAmB,CACvB,MAAO,CACL,CAAE,KAAM,QAAS,EACjB,CAAE,KAAM,QAAS,EACjB,CAAE,KAAM,SAAU,EAClB,CAAE,KAAM,MAAO,CACjB,CACF,EAEMC,EAAyB,CAC7B,IAAK,gEACL,KAAM,SAGN,qBAAsB,CACpB,MAAO,CAAC,CAAE,KAAM,oBAAqB,EAAG,CAAE,KAAM,2BAA4B,CAAC,CAC/E,EACA,MAAO,CACL,WAAYD,EAMZ,UAAW,CACT,MAAO,CACL,CAAE,KAAM,oBAAqB,EAC7B,CAAE,KAAM,SAAU,qBAAsB,CAAE,KAAM,mBAAoB,CAAE,CACxE,CACF,EAGA,eAAgB,CACd,MAAO,CACL,CAAE,KAAM,oBAAqB,EAC7B,CAAE,KAAM,SAAU,qBAAsB,CAAE,KAAM,mBAAoB,CAAE,CACxE,CACF,EAMA,kBAAmB,CACjB,KAAM,SACN,qBAAsB,GACtB,WAAY,CAGV,KAAM,CAAE,KAAM,mBAAoB,EAIlC,SAAU,CAAE,KAAM,SAAU,qBAAsB,CAAE,KAAM,wBAAyB,CAAE,EACrF,QAAS,CAAE,KAAM,wBAAyB,EAC1C,KAAM,CAAE,KAAM,wBAAyB,EACvC,MAAO,CAAE,KAAM,wBAAyB,EACxC,aAAc,CAAE,KAAM,wBAAyB,EAC/C,MAAO,CAAE,KAAM,wBAAyB,EACxC,MAAO,CAAE,KAAM,wBAAyB,EACxC,UAAW,CAAE,KAAM,wBAAyB,EAC5C,OAAQ,CAAE,KAAM,wBAAyB,EACzC,iBAAkB,CAAE,KAAM,wBAAyB,EACnD,gBAAiB,CAAE,KAAM,wBAAyB,EAClD,MAAO,CAAE,KAAM,wBAAyB,EAIxC,MAAO,CAAE,KAAM,SAAU,qBAAsB,CAAE,KAAM,mBAAoB,CAAE,CAC/E,CACF,CACF,CACF,EAEA,SAASE,EAAiBC,EAAO,CAO/B,GANI,OAAOA,GAAU,UAEjBA,EAAM,KAAK,EAAE,SAAW,GAExB,wBAAwB,KAAKA,CAAK,GAElCA,IAAU,QAAUA,IAAU,QAAS,MAAO,GAElD,IAAMC,EAAY,KAAK,KAAKD,CAAK,EAC3BE,EAAoB,aAAa,KAAKF,CAAK,EAEjD,MAA2C,EAG7C,CAEAJ,EAAO,QAAU,CACf,uBAAAE,EACA,iBAAAC,CACF,ICpGA,GAAM,CACJ,uBAAAI,EACA,iBAAAC,CACF,EAAI,IAEJ,SAASC,EAAKC,EAAQ,CACpB,GAAI,CAACA,EACH,MAAO,CAAC,EAGV,GAAI,OAAOA,GAAW,SACpB,MAAM,IAAI,MAAM,0BAA0B,EAG5C,OAAOA,CACT,CAEAD,EAAK,uBAAyBF,EAC9BE,EAAK,iBAAmBD,EAExB,OAAO,QAAUC",
|
|
6
6
|
"names": ["require_components_config_schema", "__commonJSMin", "exports", "module", "classValueSchema", "componentsConfigSchema", "isCSSClassString", "value", "hasSpaces", "hasTailwindSyntax", "componentsConfigSchema", "isCSSClassString", "ffdc", "config"]
|
|
7
7
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var y=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var $=y((_e,D)=>{var R={anyOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"}]},B={$id:"https://frontfriend.dev/schemas/components-config.schema.json",type:"object",additionalProperties:{anyOf:[{$ref:"#/$defs/classValue"},{$ref:"#/$defs/componentEnvelope"}]},$defs:{classValue:R,slotValue:{anyOf:[{$ref:"#/$defs/classValue"},{type:"object",additionalProperties:{$ref:"#/$defs/slotValue"}}]},reservedBucket:{anyOf:[{$ref:"#/$defs/classValue"},{type:"object",additionalProperties:{$ref:"#/$defs/slotValue"}}]},componentEnvelope:{type:"object",additionalProperties:!1,properties:{root:{$ref:"#/$defs/slotValue"},variants:{type:"object",additionalProperties:{$ref:"#/$defs/reservedBucket"}},variant:{$ref:"#/$defs/reservedBucket"},size:{$ref:"#/$defs/reservedBucket"},sizes:{$ref:"#/$defs/reservedBucket"},iconPosition:{$ref:"#/$defs/reservedBucket"},color:{$ref:"#/$defs/reservedBucket"},fullwidth:{$ref:"#/$defs/reservedBucket"},states:{$ref:"#/$defs/reservedBucket"},compoundVariants:{$ref:"#/$defs/reservedBucket"},defaultVariants:{$ref:"#/$defs/reservedBucket"},props:{$ref:"#/$defs/reservedBucket"},slots:{type:"object",additionalProperties:{$ref:"#/$defs/slotValue"}}}}}};function K(e){if(typeof e!="string"||e.trim().length===0||/^[0-9]
|
|
1
|
+
var y=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var $=y((_e,D)=>{var R={anyOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"}]},B={$id:"https://frontfriend.dev/schemas/components-config.schema.json",type:"object",additionalProperties:{anyOf:[{$ref:"#/$defs/classValue"},{$ref:"#/$defs/componentEnvelope"}]},$defs:{classValue:R,slotValue:{anyOf:[{$ref:"#/$defs/classValue"},{type:"object",additionalProperties:{$ref:"#/$defs/slotValue"}}]},reservedBucket:{anyOf:[{$ref:"#/$defs/classValue"},{type:"object",additionalProperties:{$ref:"#/$defs/slotValue"}}]},componentEnvelope:{type:"object",additionalProperties:!1,properties:{root:{$ref:"#/$defs/slotValue"},variants:{type:"object",additionalProperties:{$ref:"#/$defs/reservedBucket"}},variant:{$ref:"#/$defs/reservedBucket"},size:{$ref:"#/$defs/reservedBucket"},sizes:{$ref:"#/$defs/reservedBucket"},iconPosition:{$ref:"#/$defs/reservedBucket"},icons:{$ref:"#/$defs/reservedBucket"},color:{$ref:"#/$defs/reservedBucket"},fullwidth:{$ref:"#/$defs/reservedBucket"},states:{$ref:"#/$defs/reservedBucket"},compoundVariants:{$ref:"#/$defs/reservedBucket"},defaultVariants:{$ref:"#/$defs/reservedBucket"},props:{$ref:"#/$defs/reservedBucket"},slots:{type:"object",additionalProperties:{$ref:"#/$defs/slotValue"}}}}}};function K(e){if(typeof e!="string"||e.trim().length===0||/^[0-9]+(?:\.[0-9]+)?$/.test(e)||e==="true"||e==="false")return!1;let n=/\s/.test(e),s=/[-:\[\]\/]/.test(e);return!0}D.exports={componentsConfigSchema:B,isCSSClassString:K}});var k=y((Ee,S)=>{var m=require("fs");function M(e){try{let n=m.readFileSync(e,"utf8");return JSON.parse(n)}catch(n){if(n.code==="ENOENT")return null;throw n}}function Y(e){try{return m.readFileSync(e,"utf8").replace(/^\uFEFF/,"")}catch(n){if(n.code==="ENOENT")return null;throw n}}function W(e,n,s=2){let r=JSON.stringify(n,null,s);m.writeFileSync(e,r,"utf8")}function J(e,n){m.writeFileSync(e,n,"utf8")}function G(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 U(e){return m.existsSync(e)}function z(e){m.mkdirSync(e,{recursive:!0})}function Q(e){m.rmSync(e,{recursive:!0,force:!0})}S.exports={readJsonFileSafe:M,readFileSafe:Y,writeJsonFile:W,writeTextFile:J,writeModuleExportsFile:G,fileExists:U,ensureDirectoryExists:z,removeDirectory:Q}});var O=y((Fe,H)=>{H.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 T=y((De,g)=>{var _=require("fs"),b=require("path"),X=require("os"),Z=require("crypto"),ee=O(),E=ee.version,te=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function ne(e){let n={},s=e.toString();s=s.replace(/\r\n?/mg,`
|
|
2
2
|
`);let r;for(;(r=te.exec(s))!=null;){let f=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[f]=c}return n}function re(e){e=e||{};let n=C(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=V(e).split(","),f=r.length,c;for(let o=0;o<f;o++)try{let l=r[o].trim(),t=se(s,l);c=d.decrypt(t.ciphertext,t.key);break}catch(l){if(o+1>=f)throw l}return d.parse(c)}function oe(e){console.log(`[dotenv@${E}][WARN] ${e}`)}function h(e){console.log(`[dotenv@${E}][DEBUG] ${e}`)}function j(e){console.log(`[dotenv@${E}] ${e}`)}function V(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 se(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 f=s.searchParams.get("environment");if(!f){let l=new Error("INVALID_DOTENV_KEY: Missing environment part");throw l.code="INVALID_DOTENV_KEY",l}let c=`DOTENV_VAULT_${f.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 C(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(X.homedir(),e.slice(1)):e}function ie(e){let n=!!(e&&e.debug),s=e&&"quiet"in e?e.quiet:!0;(n||!s)&&j("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 ae(e){let n=b.resolve(process.cwd(),".env"),s="utf8",r=!!(e&&e.debug),f=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||!f){let i=Object.keys(l).length,a=[];for(let u of c)try{let p=b.relative(process.cwd(),u);a.push(p)}catch(p){r&&h(`Failed to load ${u} ${p.message}`),o=p}j(`injecting env (${i}) from ${a.join(",")}`)}return o?{parsed:l,error:o}:{parsed:l}}function ce(e){if(V(e).length===0)return d.configDotenv(e);let n=C(e);return n?d._configVault(e):(oe(`You set DOTENV_KEY but you are missing a .env.vault file at ${n}. Did you forget to build it?`),d.configDotenv(e))}function le(e,n){let s=Buffer.from(n.slice(-64),"hex"),r=Buffer.from(e,"base64"),f=r.subarray(0,12),c=r.subarray(-16);r=r.subarray(12,-16);try{let o=Z.createDecipheriv("aes-256-gcm",s,f);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 fe(e,n,s={}){let r=!!(s&&s.debug),f=!!(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)?(f===!0&&(e[c]=n[c]),r&&h(f===!0?`"${c}" is already defined and WAS overwritten`:`"${c}" is already defined and was NOT overwritten`)):e[c]=n[c]}var d={configDotenv:ae,_configVault:ie,_parseVault:re,config:ce,decrypt:le,parse:ne,populate:fe};g.exports.configDotenv=d.configDotenv;g.exports._configVault=d._configVault;g.exports._parseVault=d._parseVault;g.exports.config=d.config;g.exports.decrypt=d.decrypt;g.exports.parse=d.parse;g.exports.populate=d.populate;g.exports=d});var A=y((Se,I)=>{var ue=require("path"),{fileExists:de}=O();function pe(e=process.cwd()){let n=ue.join(e,".env.local");return de(n)?(T().config({path:n}),console.log("\u{1F4C4} Loaded .env.local"),!0):!1}function me(e,n=void 0){return process.env[e]||n}function ge(e){return process.env[e]==="true"}I.exports={loadEnvLocal:pe,getEnvVar:me,isEnvTrue:ge}});var P=y((Oe,L)=>{var{componentsConfigSchema:ve,isCSSClassString:ye}=$();function F(e){if(!e)return{};if(typeof e!="object")throw new Error("Config must be an object");return e}F.componentsConfigSchema=ve;F.isCSSClassString=ye;L.exports=F});var he=require("tailwindcss/plugin"),{componentsConfigSchema:we,isCSSClassString:be}=$(),x;try{x=require("postcss")}catch{x=null}var v;if(typeof window>"u"&&typeof process<"u"&&process.versions&&process.versions.node){v=require("./lib/core/cache-manager");let{loadEnvLocal:e}=A();e()}function q(e){return Object.fromEntries(Object.entries(e).filter(([n])=>n!=="DEFAULT"))}var xe=he.withOptions(function(e={}){return function({addBase:n,addUtilities:s,theme:r,matchUtilities:f}){if(!v)return;let c=new v(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[,u,p]=a,w=`.${u}-${p}`;u==="bg"||u==="layer"||u==="overlay"?t[w]={backgroundColor:`var(${i})`}:u==="text"?t[w]={color:`var(${i})`}:u==="border"?t[w]={borderColor:`var(${i})`}:u==="icon"&&(t[`.text-${u}-${p}`]={color:`var(${i})`},t[`.fill-${u}-${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,u]of Object.entries(o.tokens.fill))t[`.fill-${a}`]={fill:u},a.startsWith("icon-")&&(i[`.text-${a}`]={color:u});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"}}),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:q(r("animationDuration"))}),f({delay:t=>({animationDelay:t})},{values:r("animationDelay")}),f({ease:t=>({animationTimingFunction:t})},{values:q(r("animationTimingFunction"))}),s({".running":{animationPlayState:"running"},".paused":{animationPlayState:"paused"}}),s({".px-ff-main":{paddingLeft:"var(--ff-main-px)",paddingRight:"var(--ff-main-px)"},".py-ff-main":{paddingTop:"var(--ff-main-py)",paddingBottom:"var(--ff-main-py)"},".p-ff-main":{paddingLeft:"var(--ff-main-px)",paddingRight:"var(--ff-main-px)",paddingTop:"var(--ff-main-py)",paddingBottom:"var(--ff-main-py)"}}),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 i=x.parse(t),a=[],u=[];i.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&&s(u),e.verbose&&console.log(`[FrontFriend] Added custom CSS: ${a.length} base rules, ${u.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(v){let r=new v(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)||[]).filter(r=>typeof r!="string"||!r.startsWith("file:")),{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=xe;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(v)try{let e=new v(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(v)try{let e=new v(process.cwd());if(e.exists()){let n=e.load();if(n)return n.icons||null}}catch{}return null}});module.exports.componentsConfigSchema=we;module.exports.isCSSClassString=be;module.exports.ffdc=P();
|
|
3
|
+
`),c=c.replace(/\\r/g,"\r")),n[f]=c}return n}function re(e){e=e||{};let n=C(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=V(e).split(","),f=r.length,c;for(let o=0;o<f;o++)try{let l=r[o].trim(),t=se(s,l);c=d.decrypt(t.ciphertext,t.key);break}catch(l){if(o+1>=f)throw l}return d.parse(c)}function oe(e){console.log(`[dotenv@${E}][WARN] ${e}`)}function h(e){console.log(`[dotenv@${E}][DEBUG] ${e}`)}function j(e){console.log(`[dotenv@${E}] ${e}`)}function V(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 se(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 f=s.searchParams.get("environment");if(!f){let l=new Error("INVALID_DOTENV_KEY: Missing environment part");throw l.code="INVALID_DOTENV_KEY",l}let c=`DOTENV_VAULT_${f.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 C(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(X.homedir(),e.slice(1)):e}function ie(e){let n=!!(e&&e.debug),s=e&&"quiet"in e?e.quiet:!0;(n||!s)&&j("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 ae(e){let n=b.resolve(process.cwd(),".env"),s="utf8",r=!!(e&&e.debug),f=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||!f){let i=Object.keys(l).length,a=[];for(let u of c)try{let p=b.relative(process.cwd(),u);a.push(p)}catch(p){r&&h(`Failed to load ${u} ${p.message}`),o=p}j(`injecting env (${i}) from ${a.join(",")}`)}return o?{parsed:l,error:o}:{parsed:l}}function ce(e){if(V(e).length===0)return d.configDotenv(e);let n=C(e);return n?d._configVault(e):(oe(`You set DOTENV_KEY but you are missing a .env.vault file at ${n}. Did you forget to build it?`),d.configDotenv(e))}function le(e,n){let s=Buffer.from(n.slice(-64),"hex"),r=Buffer.from(e,"base64"),f=r.subarray(0,12),c=r.subarray(-16);r=r.subarray(12,-16);try{let o=Z.createDecipheriv("aes-256-gcm",s,f);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 fe(e,n,s={}){let r=!!(s&&s.debug),f=!!(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)?(f===!0&&(e[c]=n[c]),r&&h(f===!0?`"${c}" is already defined and WAS overwritten`:`"${c}" is already defined and was NOT overwritten`)):e[c]=n[c]}var d={configDotenv:ae,_configVault:ie,_parseVault:re,config:ce,decrypt:le,parse:ne,populate:fe};g.exports.configDotenv=d.configDotenv;g.exports._configVault=d._configVault;g.exports._parseVault=d._parseVault;g.exports.config=d.config;g.exports.decrypt=d.decrypt;g.exports.parse=d.parse;g.exports.populate=d.populate;g.exports=d});var A=y((Se,I)=>{var ue=require("path"),{fileExists:de}=k();function pe(e=process.cwd()){let n=ue.join(e,".env.local");return de(n)?(T().config({path:n}),console.log("\u{1F4C4} Loaded .env.local"),!0):!1}function me(e,n=void 0){return process.env[e]||n}function ge(e){return process.env[e]==="true"}I.exports={loadEnvLocal:pe,getEnvVar:me,isEnvTrue:ge}});var P=y((ke,L)=>{var{componentsConfigSchema:ve,isCSSClassString:ye}=$();function F(e){if(!e)return{};if(typeof e!="object")throw new Error("Config must be an object");return e}F.componentsConfigSchema=ve;F.isCSSClassString=ye;L.exports=F});var he=require("tailwindcss/plugin"),{componentsConfigSchema:we,isCSSClassString:be}=$(),x;try{x=require("postcss")}catch{x=null}var v;if(typeof window>"u"&&typeof process<"u"&&process.versions&&process.versions.node){v=require("./lib/core/cache-manager");let{loadEnvLocal:e}=A();e()}function q(e){return Object.fromEntries(Object.entries(e).filter(([n])=>n!=="DEFAULT"))}var xe=he.withOptions(function(e={}){return function({addBase:n,addUtilities:s,theme:r,matchUtilities:f}){if(!v)return;let c=new v(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[,u,p]=a,w=`.${u}-${p}`;u==="bg"||u==="layer"||u==="overlay"?t[w]={backgroundColor:`var(${i})`}:u==="text"?t[w]={color:`var(${i})`}:u==="border"?t[w]={borderColor:`var(${i})`}:u==="icon"&&(t[`.text-${u}-${p}`]={color:`var(${i})`},t[`.fill-${u}-${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,u]of Object.entries(o.tokens.fill))t[`.fill-${a}`]={fill:u},a.startsWith("icon-")&&(i[`.text-${a}`]={color:u});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"}}),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:q(r("animationDuration"))}),f({delay:t=>({animationDelay:t})},{values:r("animationDelay")}),f({ease:t=>({animationTimingFunction:t})},{values:q(r("animationTimingFunction"))}),s({".running":{animationPlayState:"running"},".paused":{animationPlayState:"paused"}}),s({".px-ff-main":{paddingLeft:"var(--ff-main-px)",paddingRight:"var(--ff-main-px)"},".py-ff-main":{paddingTop:"var(--ff-main-py)",paddingBottom:"var(--ff-main-py)"},".p-ff-main":{paddingLeft:"var(--ff-main-px)",paddingRight:"var(--ff-main-px)",paddingTop:"var(--ff-main-py)",paddingBottom:"var(--ff-main-py)"}}),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 i=x.parse(t),a=[],u=[];i.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&&s(u),e.verbose&&console.log(`[FrontFriend] Added custom CSS: ${a.length} base rules, ${u.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(v){let r=new v(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)||[]).filter(r=>typeof r!="string"||!r.startsWith("file:")),{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=xe;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(v)try{let e=new v(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(v)try{let e=new v(process.cwd());if(e.exists()){let n=e.load();if(n)return n.icons||null}}catch{}return null}});module.exports.componentsConfigSchema=we;module.exports.isCSSClassString=be;module.exports.ffdc=P();
|
|
4
4
|
//# sourceMappingURL=index.js.map
|