@frontfriend/tailwind 2.0.3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/ffdc.d.ts +1 -1
- package/dist/ffdc.js +1 -1
- package/dist/ffdc.js.map +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/dist/next.d.ts +1 -1
- package/dist/next.js +1 -1
- package/dist/next.js.map +3 -3
- package/dist/types/index.d.ts +13 -2
- package/dist/vite.d.ts +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/vite.mjs.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,9 +76,9 @@ For Next.js projects:
|
|
|
76
76
|
|
|
77
77
|
```js
|
|
78
78
|
// next.config.js
|
|
79
|
-
const
|
|
79
|
+
const frontfriend = require('@frontfriend/tailwind/next');
|
|
80
80
|
|
|
81
|
-
module.exports =
|
|
81
|
+
module.exports = frontfriend({
|
|
82
82
|
// Your Next.js config
|
|
83
83
|
});
|
|
84
84
|
```
|
package/dist/ffdc.d.ts
CHANGED
package/dist/ffdc.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
module.exports=function(r){if(!r)
|
|
1
|
+
module.exports=function(r){if(!r)return{};if(typeof r!="object")throw new Error("Config must be an object");return r};
|
|
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": ["../ffdc.js"],
|
|
4
|
-
"sourcesContent": ["// ffdc.js - Simple config accessor\n// No base64 decoding, just returns the config object directly\n\nmodule.exports = function ffdc(config) {\n if (!config) {\n
|
|
5
|
-
"mappings": "AAGA,OAAO,QAAU,SAAcA,EAAQ,CACrC,GAAI,CAACA,EACH,
|
|
4
|
+
"sourcesContent": ["// ffdc.js - Simple config accessor\n// No base64 decoding, just returns the config object directly\n\nmodule.exports = function 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};"],
|
|
5
|
+
"mappings": "AAGA,OAAO,QAAU,SAAcA,EAAQ,CACrC,GAAI,CAACA,EACH,MAAO,CAAC,EAGV,GAAI,OAAOA,GAAW,SACpB,MAAM,IAAI,MAAM,0BAA0B,EAG5C,OAAOA,CACT",
|
|
6
6
|
"names": ["config"]
|
|
7
7
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var k=(s,o)=>()=>(o||s((o={exports:{}}).exports,o),o.exports);var g=k(($,x)=>{x.exports=function(o){if(!o)
|
|
1
|
+
var k=(s,o)=>()=>(o||s((o={exports:{}}).exports,o),o.exports);var g=k(($,x)=>{x.exports=function(o){if(!o)return{};if(typeof o!="object")throw new Error("Config must be an object");return o}});var _=require("tailwindcss/plugin"),d=require("./lib/config/cache-manager");function v(s){return Object.fromEntries(Object.entries(s).filter(([o])=>o!=="DEFAULT"))}var j=_.withOptions(function(s={}){return function({addBase:o,addUtilities:i,theme:l,matchUtilities:a}){let w=new d(process.cwd());if(!w.exists()){console.warn('[FrontFriend] No cache found. Please run "npx frontfriend setup" first.');return}w.isValid()||console.warn('[FrontFriend] Cache is expired. Please run "npx frontfriend setup" to refresh.');let e=w.load();if(!e){console.error("[FrontFriend] Failed to load cache.");return}let m={};if(e.variables)for(let[t,n]of Object.entries(e.variables))t.startsWith("--color-")&&!n.startsWith("hsl(")?m[t]=`hsl(${n})`:m[t]=n;if(e.semanticVariables)for(let[t,n]of Object.entries(e.semanticVariables))m[t]=n;if(o({":root":m}),e.semanticDarkVariables&&Object.keys(e.semanticDarkVariables).length>0&&(o({":root:not(.light)":e.semanticDarkVariables}),o({":root:not(.dark)":e.semanticVariables})),e.semanticVariables){let t={};for(let[n]of Object.entries(e.semanticVariables)){let r=n.match(/^--(bg|text|border|layer|overlay|icon)-(.+)$/);if(r){let[,c,f]=r,u=`.${c}-${f}`;c==="bg"||c==="layer"||c==="overlay"?t[u]={backgroundColor:`var(${n})`}:c==="text"?t[u]={color:`var(${n})`}:c==="border"?t[u]={borderColor:`var(${n})`}:c==="icon"&&(t[`.text-${c}-${f}`]={color:`var(${n})`},t[`.fill-${c}-${f}`]={fill:`var(${n})`})}}i(t)}if(e.tokens){if(e.tokens.backgroundColor){let t={};for(let[n,r]of Object.entries(e.tokens.backgroundColor))t[`.bg-${n}`]={backgroundColor:r};i(t)}if(e.tokens.textColor){let t={};for(let[n,r]of Object.entries(e.tokens.textColor))t[`.text-${n}`]={color:r};i(t)}if(e.tokens.borderColor){let t={};for(let[n,r]of Object.entries(e.tokens.borderColor))t[`.border-${n}`]={borderColor:r};i(t)}if(e.tokens.fill){let t={};for(let[n,r]of Object.entries(e.tokens.fill))t[`.fill-${n}`]={fill:r};i(t)}if(e.tokens.fontFamily){let t={};for(let[n,r]of Object.entries(e.tokens.fontFamily))t[`.font-${n}`]={fontFamily:r};i(t)}}if(e.fonts&&e.fonts.length>0&&e.fonts.forEach(t=>{o({"@font-face":t})}),e.keyframes&&Object.keys(e.keyframes).length>0){let t={};for(let[n,r]of Object.entries(e.keyframes))t[`@keyframes ${n}`]=r;o(t)}if(e.animations&&Object.keys(e.animations).length>0){let t={};for(let[n,r]of Object.entries(e.animations))t[`.animate-${n}`]={animation:r};i(t)}if(i({"@keyframes enter":l("keyframes.enter"),"@keyframes exit":l("keyframes.exit"),".animate-in":{animationName:"enter",animationDuration:l("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:l("animationDuration.DEFAULT"),"--tw-exit-opacity":"initial","--tw-exit-scale":"initial","--tw-exit-rotate":"initial","--tw-exit-translate-x":"initial","--tw-exit-translate-y":"initial"}}),a({"fade-in":t=>({"--tw-enter-opacity":t}),"fade-out":t=>({"--tw-exit-opacity":t})},{values:l("animationOpacity")}),a({"zoom-in":t=>({"--tw-enter-scale":t}),"zoom-out":t=>({"--tw-exit-scale":t})},{values:l("animationScale")}),a({"spin-in":t=>({"--tw-enter-rotate":t}),"spin-out":t=>({"--tw-exit-rotate":t})},{values:l("animationRotate")}),a({"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:l("animationTranslate")}),a({duration:t=>({animationDuration:t})},{values:v(l("animationDuration"))}),a({delay:t=>({animationDelay:t})},{values:l("animationDelay")}),a({ease:t=>({animationTimingFunction:t})},{values:v(l("animationTimingFunction"))}),i({".running":{animationPlayState:"running"},".paused":{animationPlayState:"paused"}}),a({"fill-mode":t=>({animationFillMode:t})},{values:l("animationFillMode")}),a({direction:t=>({animationDirection:t})},{values:l("animationDirection")}),a({repeat:t=>({animationIterationCount:t})},{values:l("animationRepeat")}),e.custom)if(e.custom.raw&&typeof e.custom.raw=="string"){let t=e.custom.raw.replace(/theme\(['"](.*?)['"]\)/g,(n,r)=>{let c=r.split("."),f=l(c[0]);for(let u=1;u<c.length;u++)if(f&&f[c[u]])f=f[c[u]];else{f=null;break}return f||n});o({...t.split("}").filter(n=>n.trim().length>0).map(n=>{let r=n.split("{");if(r.length===2){let c=r[0].trim(),f=r[1].trim(),u={};return f.split(";").filter(y=>y.trim().length>0).forEach(y=>{let[b,p]=y.split(":").map(F=>F.trim());b&&p&&(u[b]=p)}),{[c]:u}}return{}}).reduce((n,r)=>({...n,...r}),{})})}else typeof e.custom=="object"&&o(e.custom);s.verbose&&(console.log("[FrontFriend] Plugin loaded successfully"),console.log(`[FrontFriend] Colors: ${Object.keys(e.variables||{}).length}`),console.log(`[FrontFriend] Semantic vars: ${Object.keys(e.semanticVariables||{}).length}`),console.log(`[FrontFriend] Fonts: ${(e.fonts||[]).length}`),console.log(`[FrontFriend] Animations: ${Object.keys(e.animations||{}).length}`),console.log(`[FrontFriend] Additional classes: ${Array.isArray(e.cls)?e.cls.length:0}`))}},function(s={}){let o=new d(process.cwd()),i=o.exists()?o.load():null,l=["./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 s.verbose&&i&&(console.log("[FrontFriend] Cache loaded successfully"),i.cls&&Array.isArray(i.cls)&&console.log(`[FrontFriend] Loading ${i.cls.length} additional classes for safelist`)),{theme:{extend:{colors:s.extendColors||{},animation:s.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:a})=>({...a("transitionDelay")}),animationDuration:({theme:a})=>({0:"0ms",...a("transitionDuration")}),animationTimingFunction:({theme:a})=>({...a("transitionTimingFunction")}),animationFillMode:{none:"none",forwards:"forwards",backwards:"backwards",both:"both"},animationDirection:{normal:"normal",reverse:"reverse",alternate:"alternate","alternate-reverse":"alternate-reverse"},animationOpacity:({theme:a})=>({DEFAULT:0,...a("opacity")}),animationTranslate:({theme:a})=>({DEFAULT:"100%",...a("translate")}),animationScale:({theme:a})=>({DEFAULT:0,...a("scale")}),animationRotate:({theme:a})=>({DEFAULT:"30deg",...a("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:[...(i==null?void 0:i.safelist)||[],{pattern:/(text|fill)-icon-(neutral|positive|negative|warning|info|highlight|interactive|brand|inverse|onpositive|onnegative|onwarning|oninfo|onhighlight|oninteractive|onbrand)-(mid|strong|subtle|low)(-(neutral|hover|active|selected|disabled))?$/},{pattern:/^(layer-(below|surface|raised|popover|dialog|control)|overlay-(mid|strong|subtle|low))$/},...(i==null?void 0:i.cls)||[]],content:s.content||l}});module.exports=j;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__;try{let s=new d(process.cwd());if(s.exists()){let o=s.load();if(o)return o.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__;try{let s=new d(process.cwd());if(s.exists()){let o=s.load();if(o)return o.icons||null}}catch{}return null}});module.exports.ffdc=g();
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../ffdc.js", "../index.js"],
|
|
4
|
-
"sourcesContent": ["// ffdc.js - Simple config accessor\n// No base64 decoding, just returns the config object directly\n\nmodule.exports = function ffdc(config) {\n if (!config) {\n throw new Error('Config is required');\n }\n \n if (typeof config !== 'object') {\n throw new Error('Config must be an object');\n }\n \n return config;\n};", "const plugin = require('tailwindcss/plugin');\nconst CacheManager = require('./lib/config/cache-manager');\n\nfunction filterDefault(values) {\n return Object.fromEntries(\n Object.entries(values).filter(([key]) => key !== \"DEFAULT\"),\n );\n}\n\nconst pluginExport = plugin.withOptions(\n function(options = {}) {\n return function({ addBase, addUtilities, theme, matchUtilities }) {\n // 1. Load cache with CacheManager\n const cacheManager = new CacheManager(process.cwd());\n \n if (!cacheManager.exists()) {\n console.warn('[FrontFriend] No cache found. Please run \"npx frontfriend setup\" first.');\n return;\n }\n\n if (!cacheManager.isValid()) {\n console.warn('[FrontFriend] Cache is expired. Please run \"npx frontfriend setup\" to refresh.');\n }\n\n const cache = cacheManager.load();\n if (!cache) {\n console.error('[FrontFriend] Failed to load cache.');\n return;\n }\n\n // 2. Add CSS variables to :root\n const rootVars = {};\n \n // Add color variables\n if (cache.variables) {\n // Wrap HSL values in hsl() function\n for (const [key, value] of Object.entries(cache.variables)) {\n // Check if it's a color variable (contains HSL values)\n if (key.startsWith('--color-') && !value.startsWith('hsl(')) {\n rootVars[key] = `hsl(${value})`;\n } else {\n rootVars[key] = value;\n }\n }\n }\n \n // Add semantic variables (light mode)\n if (cache.semanticVariables) {\n for (const [key, value] of Object.entries(cache.semanticVariables)) {\n // Semantic variables point to color variables using var()\n // so we don't need to wrap them in hsl()\n rootVars[key] = value;\n }\n }\n \n // Add root styles\n addBase({\n ':root': rootVars\n });\n\n // 3. Add dark mode support\n if (cache.semanticDarkVariables && Object.keys(cache.semanticDarkVariables).length > 0) {\n addBase({\n ':root:not(.light)': cache.semanticDarkVariables\n });\n addBase({\n ':root:not(.dark)': cache.semanticVariables\n });\n }\n\n\n // 4. Generate semantic color utilities from semantic variables\n if (cache.semanticVariables) {\n const semanticUtilities = {};\n \n // Process semantic variables into utility classes\n for (const [cssVar] of Object.entries(cache.semanticVariables)) {\n // Convert CSS variable to utility class name\n // --bg-brand-mid-default -> bg-brand-mid\n // --text-brand-strong -> text-brand-strong\n // --border-neutral-subtle-hover -> border-neutral-subtle-hover\n \n const match = cssVar.match(/^--(bg|text|border|layer|overlay|icon)-(.+)$/);\n if (match) {\n const [, prefix, name] = match;\n const className = `.${prefix}-${name}`;\n \n if (prefix === 'bg' || prefix === 'layer' || prefix === 'overlay') {\n semanticUtilities[className] = {\n backgroundColor: `var(${cssVar})`\n };\n } else if (prefix === 'text') {\n semanticUtilities[className] = {\n color: `var(${cssVar})`\n };\n } else if (prefix === 'border') {\n semanticUtilities[className] = {\n borderColor: `var(${cssVar})`\n };\n } else if (prefix === 'icon') {\n // Icon tokens map to both text color and fill\n semanticUtilities[`.text-${prefix}-${name}`] = {\n color: `var(${cssVar})`\n };\n semanticUtilities[`.fill-${prefix}-${name}`] = {\n fill: `var(${cssVar})`\n };\n }\n }\n }\n \n addUtilities(semanticUtilities);\n }\n\n // 5. Generate utilities from tokens (semantic-based utilities)\n if (cache.tokens) {\n // Background colors\n if (cache.tokens.backgroundColor) {\n const bgUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.backgroundColor)) {\n // The value already contains hsl() wrapper from the processor\n bgUtilities[`.bg-${name}`] = {\n backgroundColor: value\n };\n }\n addUtilities(bgUtilities);\n }\n\n // Text colors\n if (cache.tokens.textColor) {\n const textUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.textColor)) {\n textUtilities[`.text-${name}`] = {\n color: value\n };\n }\n addUtilities(textUtilities);\n }\n\n // Border colors\n if (cache.tokens.borderColor) {\n const borderUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.borderColor)) {\n borderUtilities[`.border-${name}`] = {\n borderColor: value\n };\n }\n addUtilities(borderUtilities);\n }\n\n // Fill colors (for SVG icons)\n if (cache.tokens.fill) {\n const fillUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.fill)) {\n fillUtilities[`.fill-${name}`] = {\n fill: value\n };\n }\n addUtilities(fillUtilities);\n }\n\n // Font family utilities\n if (cache.tokens.fontFamily) {\n const fontUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.fontFamily)) {\n fontUtilities[`.font-${name}`] = {\n fontFamily: value\n };\n }\n addUtilities(fontUtilities);\n }\n }\n\n // 6. Add font faces\n if (cache.fonts && cache.fonts.length > 0) {\n // Convert font objects to Tailwind-compatible format\n cache.fonts.forEach(fontFace => {\n // Tailwind expects each @font-face as a separate rule\n addBase({\n '@font-face': fontFace\n });\n });\n }\n\n // 7. Add keyframes\n if (cache.keyframes && Object.keys(cache.keyframes).length > 0) {\n const keyframeRules = {};\n for (const [name, frames] of Object.entries(cache.keyframes)) {\n keyframeRules[`@keyframes ${name}`] = frames;\n }\n addBase(keyframeRules);\n }\n\n // 8. Add animation utilities\n if (cache.animations && Object.keys(cache.animations).length > 0) {\n const animationUtilities = {};\n for (const [name, value] of Object.entries(cache.animations)) {\n animationUtilities[`.animate-${name}`] = {\n animation: value\n };\n }\n addUtilities(animationUtilities);\n }\n\n // 9. Add enter/exit animation utilities\n addUtilities({\n \"@keyframes enter\": theme(\"keyframes.enter\"),\n \"@keyframes exit\": theme(\"keyframes.exit\"),\n \".animate-in\": {\n animationName: \"enter\",\n animationDuration: theme(\"animationDuration.DEFAULT\"),\n \"--tw-enter-opacity\": \"initial\",\n \"--tw-enter-scale\": \"initial\",\n \"--tw-enter-rotate\": \"initial\",\n \"--tw-enter-translate-x\": \"initial\",\n \"--tw-enter-translate-y\": \"initial\",\n },\n \".animate-out\": {\n animationName: \"exit\",\n animationDuration: theme(\"animationDuration.DEFAULT\"),\n \"--tw-exit-opacity\": \"initial\",\n \"--tw-exit-scale\": \"initial\",\n \"--tw-exit-rotate\": \"initial\",\n \"--tw-exit-translate-x\": \"initial\",\n \"--tw-exit-translate-y\": \"initial\",\n },\n });\n\n // 10. Add animation match utilities\n matchUtilities(\n {\n \"fade-in\": (value) => ({ \"--tw-enter-opacity\": value }),\n \"fade-out\": (value) => ({ \"--tw-exit-opacity\": value }),\n },\n { values: theme(\"animationOpacity\") }\n );\n\n matchUtilities(\n {\n \"zoom-in\": (value) => ({ \"--tw-enter-scale\": value }),\n \"zoom-out\": (value) => ({ \"--tw-exit-scale\": value }),\n },\n { values: theme(\"animationScale\") }\n );\n\n matchUtilities(\n {\n \"spin-in\": (value) => ({ \"--tw-enter-rotate\": value }),\n \"spin-out\": (value) => ({ \"--tw-exit-rotate\": value }),\n },\n { values: theme(\"animationRotate\") }\n );\n\n matchUtilities(\n {\n \"slide-in-from-top\": (value) => ({\n \"--tw-enter-translate-y\": `-${value}`,\n }),\n \"slide-in-from-bottom\": (value) => ({\n \"--tw-enter-translate-y\": value,\n }),\n \"slide-in-from-left\": (value) => ({\n \"--tw-enter-translate-x\": `-${value}`,\n }),\n \"slide-in-from-right\": (value) => ({\n \"--tw-enter-translate-x\": value,\n }),\n \"slide-out-to-top\": (value) => ({\n \"--tw-exit-translate-y\": `-${value}`,\n }),\n \"slide-out-to-bottom\": (value) => ({\n \"--tw-exit-translate-y\": value,\n }),\n \"slide-out-to-left\": (value) => ({\n \"--tw-exit-translate-x\": `-${value}`,\n }),\n \"slide-out-to-right\": (value) => ({\n \"--tw-exit-translate-x\": value,\n }),\n },\n { values: theme(\"animationTranslate\") }\n );\n\n // 11. Add animation control utilities\n matchUtilities(\n { duration: (value) => ({ animationDuration: value }) },\n { values: filterDefault(theme(\"animationDuration\")) }\n );\n\n matchUtilities(\n { delay: (value) => ({ animationDelay: value }) },\n { values: theme(\"animationDelay\") }\n );\n\n matchUtilities(\n { ease: (value) => ({ animationTimingFunction: value }) },\n { values: filterDefault(theme(\"animationTimingFunction\")) }\n );\n\n addUtilities({\n \".running\": { animationPlayState: \"running\" },\n \".paused\": { animationPlayState: \"paused\" },\n });\n\n matchUtilities(\n { \"fill-mode\": (value) => ({ animationFillMode: value }) },\n { values: theme(\"animationFillMode\") }\n );\n\n matchUtilities(\n { direction: (value) => ({ animationDirection: value }) },\n { values: theme(\"animationDirection\") }\n );\n\n matchUtilities(\n { repeat: (value) => ({ animationIterationCount: value }) },\n { values: theme(\"animationRepeat\") }\n );\n\n // 12. Add custom CSS\n if (cache.custom) {\n if (cache.custom.raw && typeof cache.custom.raw === 'string') {\n // Process the raw CSS string\n const processedCss = cache.custom.raw.replace(\n /theme\\(['\"](.*?)['\"]\\)/g, \n (match, themePath) => {\n // Split the theme path (e.g., 'colors.orange.300' -> ['colors', 'orange', '300'])\n const parts = themePath.split('.');\n \n // Get the value from theme\n let value = theme(parts[0]);\n for (let i = 1; i < parts.length; i++) {\n if (value && value[parts[i]]) {\n value = value[parts[i]];\n } else {\n value = null;\n break;\n }\n }\n \n return value || match; // Return the theme value or original if not found\n }\n );\n \n // Add the processed CSS\n addBase({\n // Using a style object with selectors\n ...processedCss.split('}')\n .filter(rule => rule.trim().length > 0)\n .map(rule => {\n const parts = rule.split('{');\n if (parts.length === 2) {\n const selector = parts[0].trim();\n const styles = parts[1].trim();\n \n // Convert CSS properties to object\n const styleObj = {};\n styles.split(';')\n .filter(prop => prop.trim().length > 0)\n .forEach(prop => {\n const [key, value] = prop.split(':').map(p => p.trim());\n if (key && value) {\n styleObj[key] = value;\n }\n });\n \n return { [selector]: styleObj };\n }\n return {};\n })\n .reduce((acc, item) => ({ ...acc, ...item }), {})\n });\n } else if (typeof cache.custom === 'object') {\n // Handle object format\n addBase(cache.custom);\n }\n }\n\n // Log success\n if (options.verbose) {\n console.log('[FrontFriend] Plugin loaded successfully');\n console.log(`[FrontFriend] Colors: ${Object.keys(cache.variables || {}).length}`);\n console.log(`[FrontFriend] Semantic vars: ${Object.keys(cache.semanticVariables || {}).length}`);\n console.log(`[FrontFriend] Fonts: ${(cache.fonts || []).length}`);\n console.log(`[FrontFriend] Animations: ${Object.keys(cache.animations || {}).length}`);\n console.log(`[FrontFriend] Additional classes: ${Array.isArray(cache.cls) ? cache.cls.length : 0}`);\n }\n };\n },\n function(options = {}) {\n // Return theme configuration\n const cacheManager = new CacheManager(process.cwd());\n const cache = cacheManager.exists() ? cacheManager.load() : null;\n \n // Default content paths matching the current-plugin approach\n const defaultContent = [\n './pages/**/*.{js,ts,jsx,tsx}',\n './components/**/*.{js,ts,jsx,tsx}',\n './app/**/*.{js,ts,jsx,tsx}',\n './src/**/*.{js,ts,jsx,tsx}',\n './stories/**/*.{js,ts,jsx,tsx}'\n ];\n \n // Log cache loading\n if (options.verbose && cache) {\n console.log('[FrontFriend] Cache loaded successfully');\n if (cache.cls && Array.isArray(cache.cls)) {\n console.log(`[FrontFriend] Loading ${cache.cls.length} additional classes for safelist`);\n }\n }\n\n return {\n theme: {\n extend: {\n // Extend colors if needed\n colors: options.extendColors || {},\n // Extend animations if needed\n animation: options.extendAnimations || {},\n // Add custom spacing values\n spacing: {\n '18': '4.5rem',\n '88': '22rem',\n '128': '32rem'\n },\n // Add custom box shadows\n boxShadow: {\n 'top-sm': '0 -1px 1px 0 rgba(0, 0, 0, 0.05)'\n },\n // Add border radius values\n borderRadius: {\n '2xl': '1rem'\n },\n // Animation extensions\n animationDelay: ({ theme }) => ({\n ...theme(\"transitionDelay\"),\n }),\n animationDuration: ({ theme }) => ({\n 0: \"0ms\",\n ...theme(\"transitionDuration\"),\n }),\n animationTimingFunction: ({ theme }) => ({\n ...theme(\"transitionTimingFunction\"),\n }),\n animationFillMode: {\n none: \"none\",\n forwards: \"forwards\",\n backwards: \"backwards\",\n both: \"both\",\n },\n animationDirection: {\n normal: \"normal\",\n reverse: \"reverse\",\n alternate: \"alternate\",\n \"alternate-reverse\": \"alternate-reverse\",\n },\n animationOpacity: ({ theme }) => ({\n DEFAULT: 0,\n ...theme(\"opacity\"),\n }),\n animationTranslate: ({ theme }) => ({\n DEFAULT: \"100%\",\n ...theme(\"translate\"),\n }),\n animationScale: ({ theme }) => ({\n DEFAULT: 0,\n ...theme(\"scale\"),\n }),\n animationRotate: ({ theme }) => ({\n DEFAULT: \"30deg\",\n ...theme(\"rotate\"),\n }),\n animationRepeat: {\n 0: \"0\",\n 1: \"1\",\n infinite: \"infinite\",\n },\n keyframes: {\n enter: {\n from: {\n opacity: \"var(--tw-enter-opacity, 1)\",\n transform:\n \"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))\",\n },\n },\n exit: {\n to: {\n opacity: \"var(--tw-exit-opacity, 1)\",\n transform:\n \"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))\",\n },\n },\n },\n }\n },\n // Include safelist from cache and additional classes\n safelist: [\n ...(cache?.safelist || []),\n {\n 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))?$/,\n },\n {\n pattern: /^(layer-(below|surface|raised|popover|dialog|control)|overlay-(mid|strong|subtle|low))$/,\n },\n ...(cache?.cls || []),\n ],\n // Set content paths - merge options with defaults\n content: options.content || defaultContent\n };\n }\n);\n\n// Default export is the plugin\nmodule.exports = pluginExport;\n\n// Export components config and icons with getter functions\n// This allows dynamic resolution at runtime\n\n// Create getter for config\nObject.defineProperty(module.exports, 'config', {\n get: function() {\n // Check for webpack-injected global variable\n if (typeof __FF_CONFIG__ !== 'undefined') {\n return __FF_CONFIG__;\n }\n \n // Check if we're in a browser environment\n if (typeof window !== 'undefined' && window.__FF_CONFIG__) {\n return window.__FF_CONFIG__;\n }\n \n // Node.js: load from cache\n try {\n const cacheManager = new CacheManager(process.cwd());\n if (cacheManager.exists()) {\n const cache = cacheManager.load();\n if (cache) {\n return cache.componentsConfig || null;\n }\n }\n } catch (error) {\n // Config not available\n }\n \n return null;\n }\n});\n\n// Create getter for iconSet\nObject.defineProperty(module.exports, 'iconSet', {\n get: function() {\n // Check for webpack-injected global variable\n if (typeof __FF_ICONS__ !== 'undefined') {\n return __FF_ICONS__;\n }\n \n // Check if we're in a browser environment\n if (typeof window !== 'undefined' && window.__FF_ICONS__) {\n return window.__FF_ICONS__;\n }\n \n // Node.js: load from cache\n try {\n const cacheManager = new CacheManager(process.cwd());\n if (cacheManager.exists()) {\n const cache = cacheManager.load();\n if (cache) {\n return cache.icons || null;\n }\n }\n } catch (error) {\n // Icons not available\n }\n \n return null;\n }\n});\n\n// Export ffdc utility\nmodule.exports.ffdc = require('./ffdc.js');"],
|
|
5
|
-
"mappings": "8DAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CAGAA,EAAO,QAAU,SAAcC,EAAQ,CACrC,GAAI,CAACA,EACH,
|
|
4
|
+
"sourcesContent": ["// ffdc.js - Simple config accessor\n// No base64 decoding, just returns the config object directly\n\nmodule.exports = function 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};", "const plugin = require('tailwindcss/plugin');\nconst CacheManager = require('./lib/config/cache-manager');\n\nfunction filterDefault(values) {\n return Object.fromEntries(\n Object.entries(values).filter(([key]) => key !== \"DEFAULT\"),\n );\n}\n\nconst pluginExport = plugin.withOptions(\n function(options = {}) {\n return function({ addBase, addUtilities, theme, matchUtilities }) {\n // 1. Load cache with CacheManager\n const cacheManager = new CacheManager(process.cwd());\n \n if (!cacheManager.exists()) {\n console.warn('[FrontFriend] No cache found. Please run \"npx frontfriend setup\" first.');\n return;\n }\n\n if (!cacheManager.isValid()) {\n console.warn('[FrontFriend] Cache is expired. Please run \"npx frontfriend setup\" to refresh.');\n }\n\n const cache = cacheManager.load();\n if (!cache) {\n console.error('[FrontFriend] Failed to load cache.');\n return;\n }\n\n // 2. Add CSS variables to :root\n const rootVars = {};\n \n // Add color variables\n if (cache.variables) {\n // Wrap HSL values in hsl() function\n for (const [key, value] of Object.entries(cache.variables)) {\n // Check if it's a color variable (contains HSL values)\n if (key.startsWith('--color-') && !value.startsWith('hsl(')) {\n rootVars[key] = `hsl(${value})`;\n } else {\n rootVars[key] = value;\n }\n }\n }\n \n // Add semantic variables (light mode)\n if (cache.semanticVariables) {\n for (const [key, value] of Object.entries(cache.semanticVariables)) {\n // Semantic variables point to color variables using var()\n // so we don't need to wrap them in hsl()\n rootVars[key] = value;\n }\n }\n \n // Add root styles\n addBase({\n ':root': rootVars\n });\n\n // 3. Add dark mode support\n if (cache.semanticDarkVariables && Object.keys(cache.semanticDarkVariables).length > 0) {\n addBase({\n ':root:not(.light)': cache.semanticDarkVariables\n });\n addBase({\n ':root:not(.dark)': cache.semanticVariables\n });\n }\n\n\n // 4. Generate semantic color utilities from semantic variables\n if (cache.semanticVariables) {\n const semanticUtilities = {};\n \n // Process semantic variables into utility classes\n for (const [cssVar] of Object.entries(cache.semanticVariables)) {\n // Convert CSS variable to utility class name\n // --bg-brand-mid-default -> bg-brand-mid\n // --text-brand-strong -> text-brand-strong\n // --border-neutral-subtle-hover -> border-neutral-subtle-hover\n \n const match = cssVar.match(/^--(bg|text|border|layer|overlay|icon)-(.+)$/);\n if (match) {\n const [, prefix, name] = match;\n const className = `.${prefix}-${name}`;\n \n if (prefix === 'bg' || prefix === 'layer' || prefix === 'overlay') {\n semanticUtilities[className] = {\n backgroundColor: `var(${cssVar})`\n };\n } else if (prefix === 'text') {\n semanticUtilities[className] = {\n color: `var(${cssVar})`\n };\n } else if (prefix === 'border') {\n semanticUtilities[className] = {\n borderColor: `var(${cssVar})`\n };\n } else if (prefix === 'icon') {\n // Icon tokens map to both text color and fill\n semanticUtilities[`.text-${prefix}-${name}`] = {\n color: `var(${cssVar})`\n };\n semanticUtilities[`.fill-${prefix}-${name}`] = {\n fill: `var(${cssVar})`\n };\n }\n }\n }\n \n addUtilities(semanticUtilities);\n }\n\n // 5. Generate utilities from tokens (semantic-based utilities)\n if (cache.tokens) {\n // Background colors\n if (cache.tokens.backgroundColor) {\n const bgUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.backgroundColor)) {\n // The value already contains hsl() wrapper from the processor\n bgUtilities[`.bg-${name}`] = {\n backgroundColor: value\n };\n }\n addUtilities(bgUtilities);\n }\n\n // Text colors\n if (cache.tokens.textColor) {\n const textUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.textColor)) {\n textUtilities[`.text-${name}`] = {\n color: value\n };\n }\n addUtilities(textUtilities);\n }\n\n // Border colors\n if (cache.tokens.borderColor) {\n const borderUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.borderColor)) {\n borderUtilities[`.border-${name}`] = {\n borderColor: value\n };\n }\n addUtilities(borderUtilities);\n }\n\n // Fill colors (for SVG icons)\n if (cache.tokens.fill) {\n const fillUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.fill)) {\n fillUtilities[`.fill-${name}`] = {\n fill: value\n };\n }\n addUtilities(fillUtilities);\n }\n\n // Font family utilities\n if (cache.tokens.fontFamily) {\n const fontUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.fontFamily)) {\n fontUtilities[`.font-${name}`] = {\n fontFamily: value\n };\n }\n addUtilities(fontUtilities);\n }\n }\n\n // 6. Add font faces\n if (cache.fonts && cache.fonts.length > 0) {\n // Convert font objects to Tailwind-compatible format\n cache.fonts.forEach(fontFace => {\n // Tailwind expects each @font-face as a separate rule\n addBase({\n '@font-face': fontFace\n });\n });\n }\n\n // 7. Add keyframes\n if (cache.keyframes && Object.keys(cache.keyframes).length > 0) {\n const keyframeRules = {};\n for (const [name, frames] of Object.entries(cache.keyframes)) {\n keyframeRules[`@keyframes ${name}`] = frames;\n }\n addBase(keyframeRules);\n }\n\n // 8. Add animation utilities\n if (cache.animations && Object.keys(cache.animations).length > 0) {\n const animationUtilities = {};\n for (const [name, value] of Object.entries(cache.animations)) {\n animationUtilities[`.animate-${name}`] = {\n animation: value\n };\n }\n addUtilities(animationUtilities);\n }\n\n // 9. Add enter/exit animation utilities\n addUtilities({\n \"@keyframes enter\": theme(\"keyframes.enter\"),\n \"@keyframes exit\": theme(\"keyframes.exit\"),\n \".animate-in\": {\n animationName: \"enter\",\n animationDuration: theme(\"animationDuration.DEFAULT\"),\n \"--tw-enter-opacity\": \"initial\",\n \"--tw-enter-scale\": \"initial\",\n \"--tw-enter-rotate\": \"initial\",\n \"--tw-enter-translate-x\": \"initial\",\n \"--tw-enter-translate-y\": \"initial\",\n },\n \".animate-out\": {\n animationName: \"exit\",\n animationDuration: theme(\"animationDuration.DEFAULT\"),\n \"--tw-exit-opacity\": \"initial\",\n \"--tw-exit-scale\": \"initial\",\n \"--tw-exit-rotate\": \"initial\",\n \"--tw-exit-translate-x\": \"initial\",\n \"--tw-exit-translate-y\": \"initial\",\n },\n });\n\n // 10. Add animation match utilities\n matchUtilities(\n {\n \"fade-in\": (value) => ({ \"--tw-enter-opacity\": value }),\n \"fade-out\": (value) => ({ \"--tw-exit-opacity\": value }),\n },\n { values: theme(\"animationOpacity\") }\n );\n\n matchUtilities(\n {\n \"zoom-in\": (value) => ({ \"--tw-enter-scale\": value }),\n \"zoom-out\": (value) => ({ \"--tw-exit-scale\": value }),\n },\n { values: theme(\"animationScale\") }\n );\n\n matchUtilities(\n {\n \"spin-in\": (value) => ({ \"--tw-enter-rotate\": value }),\n \"spin-out\": (value) => ({ \"--tw-exit-rotate\": value }),\n },\n { values: theme(\"animationRotate\") }\n );\n\n matchUtilities(\n {\n \"slide-in-from-top\": (value) => ({\n \"--tw-enter-translate-y\": `-${value}`,\n }),\n \"slide-in-from-bottom\": (value) => ({\n \"--tw-enter-translate-y\": value,\n }),\n \"slide-in-from-left\": (value) => ({\n \"--tw-enter-translate-x\": `-${value}`,\n }),\n \"slide-in-from-right\": (value) => ({\n \"--tw-enter-translate-x\": value,\n }),\n \"slide-out-to-top\": (value) => ({\n \"--tw-exit-translate-y\": `-${value}`,\n }),\n \"slide-out-to-bottom\": (value) => ({\n \"--tw-exit-translate-y\": value,\n }),\n \"slide-out-to-left\": (value) => ({\n \"--tw-exit-translate-x\": `-${value}`,\n }),\n \"slide-out-to-right\": (value) => ({\n \"--tw-exit-translate-x\": value,\n }),\n },\n { values: theme(\"animationTranslate\") }\n );\n\n // 11. Add animation control utilities\n matchUtilities(\n { duration: (value) => ({ animationDuration: value }) },\n { values: filterDefault(theme(\"animationDuration\")) }\n );\n\n matchUtilities(\n { delay: (value) => ({ animationDelay: value }) },\n { values: theme(\"animationDelay\") }\n );\n\n matchUtilities(\n { ease: (value) => ({ animationTimingFunction: value }) },\n { values: filterDefault(theme(\"animationTimingFunction\")) }\n );\n\n addUtilities({\n \".running\": { animationPlayState: \"running\" },\n \".paused\": { animationPlayState: \"paused\" },\n });\n\n matchUtilities(\n { \"fill-mode\": (value) => ({ animationFillMode: value }) },\n { values: theme(\"animationFillMode\") }\n );\n\n matchUtilities(\n { direction: (value) => ({ animationDirection: value }) },\n { values: theme(\"animationDirection\") }\n );\n\n matchUtilities(\n { repeat: (value) => ({ animationIterationCount: value }) },\n { values: theme(\"animationRepeat\") }\n );\n\n // 12. Add custom CSS\n if (cache.custom) {\n if (cache.custom.raw && typeof cache.custom.raw === 'string') {\n // Process the raw CSS string\n const processedCss = cache.custom.raw.replace(\n /theme\\(['\"](.*?)['\"]\\)/g, \n (match, themePath) => {\n // Split the theme path (e.g., 'colors.orange.300' -> ['colors', 'orange', '300'])\n const parts = themePath.split('.');\n \n // Get the value from theme\n let value = theme(parts[0]);\n for (let i = 1; i < parts.length; i++) {\n if (value && value[parts[i]]) {\n value = value[parts[i]];\n } else {\n value = null;\n break;\n }\n }\n \n return value || match; // Return the theme value or original if not found\n }\n );\n \n // Add the processed CSS\n addBase({\n // Using a style object with selectors\n ...processedCss.split('}')\n .filter(rule => rule.trim().length > 0)\n .map(rule => {\n const parts = rule.split('{');\n if (parts.length === 2) {\n const selector = parts[0].trim();\n const styles = parts[1].trim();\n \n // Convert CSS properties to object\n const styleObj = {};\n styles.split(';')\n .filter(prop => prop.trim().length > 0)\n .forEach(prop => {\n const [key, value] = prop.split(':').map(p => p.trim());\n if (key && value) {\n styleObj[key] = value;\n }\n });\n \n return { [selector]: styleObj };\n }\n return {};\n })\n .reduce((acc, item) => ({ ...acc, ...item }), {})\n });\n } else if (typeof cache.custom === 'object') {\n // Handle object format\n addBase(cache.custom);\n }\n }\n\n // Log success\n if (options.verbose) {\n console.log('[FrontFriend] Plugin loaded successfully');\n console.log(`[FrontFriend] Colors: ${Object.keys(cache.variables || {}).length}`);\n console.log(`[FrontFriend] Semantic vars: ${Object.keys(cache.semanticVariables || {}).length}`);\n console.log(`[FrontFriend] Fonts: ${(cache.fonts || []).length}`);\n console.log(`[FrontFriend] Animations: ${Object.keys(cache.animations || {}).length}`);\n console.log(`[FrontFriend] Additional classes: ${Array.isArray(cache.cls) ? cache.cls.length : 0}`);\n }\n };\n },\n function(options = {}) {\n // Return theme configuration\n const cacheManager = new CacheManager(process.cwd());\n const cache = cacheManager.exists() ? cacheManager.load() : null;\n \n // Default content paths matching the current-plugin approach\n const defaultContent = [\n './pages/**/*.{js,ts,jsx,tsx}',\n './components/**/*.{js,ts,jsx,tsx}',\n './app/**/*.{js,ts,jsx,tsx}',\n './src/**/*.{js,ts,jsx,tsx}',\n './stories/**/*.{js,ts,jsx,tsx}'\n ];\n \n // Log cache loading\n if (options.verbose && cache) {\n console.log('[FrontFriend] Cache loaded successfully');\n if (cache.cls && Array.isArray(cache.cls)) {\n console.log(`[FrontFriend] Loading ${cache.cls.length} additional classes for safelist`);\n }\n }\n\n return {\n theme: {\n extend: {\n // Extend colors if needed\n colors: options.extendColors || {},\n // Extend animations if needed\n animation: options.extendAnimations || {},\n // Add custom spacing values\n spacing: {\n '18': '4.5rem',\n '88': '22rem',\n '128': '32rem'\n },\n // Add custom box shadows\n boxShadow: {\n 'top-sm': '0 -1px 1px 0 rgba(0, 0, 0, 0.05)'\n },\n // Add border radius values\n borderRadius: {\n '2xl': '1rem'\n },\n // Animation extensions\n animationDelay: ({ theme }) => ({\n ...theme(\"transitionDelay\"),\n }),\n animationDuration: ({ theme }) => ({\n 0: \"0ms\",\n ...theme(\"transitionDuration\"),\n }),\n animationTimingFunction: ({ theme }) => ({\n ...theme(\"transitionTimingFunction\"),\n }),\n animationFillMode: {\n none: \"none\",\n forwards: \"forwards\",\n backwards: \"backwards\",\n both: \"both\",\n },\n animationDirection: {\n normal: \"normal\",\n reverse: \"reverse\",\n alternate: \"alternate\",\n \"alternate-reverse\": \"alternate-reverse\",\n },\n animationOpacity: ({ theme }) => ({\n DEFAULT: 0,\n ...theme(\"opacity\"),\n }),\n animationTranslate: ({ theme }) => ({\n DEFAULT: \"100%\",\n ...theme(\"translate\"),\n }),\n animationScale: ({ theme }) => ({\n DEFAULT: 0,\n ...theme(\"scale\"),\n }),\n animationRotate: ({ theme }) => ({\n DEFAULT: \"30deg\",\n ...theme(\"rotate\"),\n }),\n animationRepeat: {\n 0: \"0\",\n 1: \"1\",\n infinite: \"infinite\",\n },\n keyframes: {\n enter: {\n from: {\n opacity: \"var(--tw-enter-opacity, 1)\",\n transform:\n \"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))\",\n },\n },\n exit: {\n to: {\n opacity: \"var(--tw-exit-opacity, 1)\",\n transform:\n \"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))\",\n },\n },\n },\n }\n },\n // Include safelist from cache and additional classes\n safelist: [\n ...(cache?.safelist || []),\n {\n 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))?$/,\n },\n {\n pattern: /^(layer-(below|surface|raised|popover|dialog|control)|overlay-(mid|strong|subtle|low))$/,\n },\n ...(cache?.cls || []),\n ],\n // Set content paths - merge options with defaults\n content: options.content || defaultContent\n };\n }\n);\n\n// Default export is the plugin\nmodule.exports = pluginExport;\n\n// Export components config and icons with getter functions\n// This allows dynamic resolution at runtime\n\n// Create getter for config\nObject.defineProperty(module.exports, 'config', {\n get: function() {\n // Check for webpack-injected global variable\n if (typeof __FF_CONFIG__ !== 'undefined') {\n return __FF_CONFIG__;\n }\n \n // Check if we're in a browser environment\n if (typeof window !== 'undefined' && window.__FF_CONFIG__) {\n return window.__FF_CONFIG__;\n }\n \n // Node.js: load from cache\n try {\n const cacheManager = new CacheManager(process.cwd());\n if (cacheManager.exists()) {\n const cache = cacheManager.load();\n if (cache) {\n return cache.componentsConfig || null;\n }\n }\n } catch (error) {\n // Config not available\n }\n \n return null;\n }\n});\n\n// Create getter for iconSet\nObject.defineProperty(module.exports, 'iconSet', {\n get: function() {\n // Check for webpack-injected global variable\n if (typeof __FF_ICONS__ !== 'undefined') {\n return __FF_ICONS__;\n }\n \n // Check if we're in a browser environment\n if (typeof window !== 'undefined' && window.__FF_ICONS__) {\n return window.__FF_ICONS__;\n }\n \n // Node.js: load from cache\n try {\n const cacheManager = new CacheManager(process.cwd());\n if (cacheManager.exists()) {\n const cache = cacheManager.load();\n if (cache) {\n return cache.icons || null;\n }\n }\n } catch (error) {\n // Icons not available\n }\n \n return null;\n }\n});\n\n// Export ffdc utility\nmodule.exports.ffdc = require('./ffdc.js');"],
|
|
5
|
+
"mappings": "8DAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CAGAA,EAAO,QAAU,SAAcC,EAAQ,CACrC,GAAI,CAACA,EACH,MAAO,CAAC,EAGV,GAAI,OAAOA,GAAW,SACpB,MAAM,IAAI,MAAM,0BAA0B,EAG5C,OAAOA,CACT,ICbA,IAAMC,EAAS,QAAQ,oBAAoB,EACrCC,EAAe,QAAQ,4BAA4B,EAEzD,SAASC,EAAcC,EAAQ,CAC7B,OAAO,OAAO,YACZ,OAAO,QAAQA,CAAM,EAAE,O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QAAS,6OACX,EACA,CACE,QAAS,yFACX,EACA,IAAIA,GAAA,YAAAA,EAAO,MAAO,CAAC,CACrB,EAEA,QAASN,EAAQ,SAAWoC,CAC9B,CACF,CACF,EAGA,OAAO,QAAUrC,EAMjB,OAAO,eAAe,OAAO,QAAS,SAAU,CAC9C,IAAK,UAAW,CAEd,GAAI,OAAO,cAAkB,IAC3B,OAAO,cAIT,GAAI,OAAO,OAAW,KAAe,OAAO,cAC1C,OAAO,OAAO,cAIhB,GAAI,CACF,IAAMM,EAAe,IAAIV,EAAa,QAAQ,IAAI,CAAC,EACnD,GAAIU,EAAa,OAAO,EAAG,CACzB,IAAMC,EAAQD,EAAa,KAAK,EAChC,GAAIC,EACF,OAAOA,EAAM,kBAAoB,IAErC,CACF,MAAgB,CAEhB,CAEA,OAAO,IACT,CACF,CAAC,EAGD,OAAO,eAAe,OAAO,QAAS,UAAW,CAC/C,IAAK,UAAW,CAEd,GAAI,OAAO,aAAiB,IAC1B,OAAO,aAIT,GAAI,OAAO,OAAW,KAAe,OAAO,aAC1C,OAAO,OAAO,aAIhB,GAAI,CACF,IAAMD,EAAe,IAAIV,EAAa,QAAQ,IAAI,CAAC,EACnD,GAAIU,EAAa,OAAO,EAAG,CACzB,IAAMC,EAAQD,EAAa,KAAK,EAChC,GAAIC,EACF,OAAOA,EAAM,OAAS,IAE1B,CACF,MAAgB,CAEhB,CAEA,OAAO,IACT,CACF,CAAC,EAGD,OAAO,QAAQ,KAAO",
|
|
6
6
|
"names": ["require_ffdc", "__commonJSMin", "exports", "module", "config", "plugin", "CacheManager", "filterDefault", "values", "key", "pluginExport", "options", "addBase", "addUtilities", "theme", "matchUtilities", "cacheManager", "cache", "rootVars", "value", "semanticUtilities", "cssVar", "match", "prefix", "name", "className", "bgUtilities", "textUtilities", "borderUtilities", "fillUtilities", "fontUtilities", "fontFace", "keyframeRules", "frames", "animationUtilities", "processedCss", "themePath", "parts", "i", "rule", "selector", "styles", "styleObj", "prop", "p", "acc", "item", "defaultContent"]
|
|
7
7
|
}
|
package/dist/next.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ import { NextConfig } from 'next';
|
|
|
5
5
|
* @param config - Next.js configuration object
|
|
6
6
|
* @returns Modified Next.js configuration
|
|
7
7
|
*/
|
|
8
|
-
export default function
|
|
8
|
+
export default function frontfriend(config?: NextConfig): NextConfig;
|
package/dist/next.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var h=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var C=h((J,y)=>{var N="https://app.frontfriend.dev",I="https://tokens-studio-donux.up.railway.app/api",v=".cache/frontfriend",k={JS:["tokens.js","variables.js","semanticVariables.js","semanticDarkVariables.js","cls.js","custom.js"],JSON:["fonts.json","icons.json","components-config.json","version.json","metadata.json"]},O={FF_ID:"FF_ID",FF_API_URL:"FF_API_URL"};y.exports={DEFAULT_API_URL:N,LEGACY_API_URL:I,CACHE_DIR_NAME:v,CACHE_TTL_DAYS:7,CACHE_TTL_MS:6048e5,CACHE_FILES:k,ENV_VARS:O}});var A=h((R,j)=>{var d=class extends Error{constructor(e,t,s){super(e),this.name="APIError",this.statusCode=t,this.url=s,this.code=`API_${t}`}},p=class extends Error{constructor(e,t){super(e),this.name="CacheError",this.operation=t,this.code=`CACHE_${t.toUpperCase()}`}},m=class extends Error{constructor(e,t){super(e),this.name="ConfigError",this.field=t,this.code=`CONFIG_${t.toUpperCase()}`}},_=class extends Error{constructor(e,t){super(e),this.name="ProcessingError",this.token=t,this.code="PROCESSING_ERROR"}};j.exports={APIError:d,CacheError:p,ConfigError:m,ProcessingError:_}});var w=h(($,E)=>{var n=require("fs"),f=require("path"),{CACHE_DIR_NAME:b,CACHE_TTL_MS:L,CACHE_FILES:x}=C(),{CacheError:D}=A(),F=class{constructor(e=process.cwd()){this.appRoot=e,this.cacheDir=f.join(e,"node_modules",b),this.metadataFile=f.join(this.cacheDir,"metadata.json"),this.maxAge=L}getCacheDir(){return this.cacheDir}exists(){return n.existsSync(this.cacheDir)}isValid(){if(!this.exists())return!1;try{if(!n.existsSync(this.metadataFile))return!1;let e=JSON.parse(n.readFileSync(this.metadataFile,"utf-8")),t=new Date(e.timestamp).getTime();return Date.now()-t<this.maxAge}catch{return!1}}load(){if(!this.exists())return null;try{let e={};for(let t of x.JS){let s=f.join(this.cacheDir,t);if(n.existsSync(s)){let o=t.replace(".js","");try{let a=n.readFileSync(s,"utf-8"),l={},i={exports:l};new Function("module","exports",a)(i,l),e[o]=i.exports}catch{}}}for(let t of x.JSON){let s=f.join(this.cacheDir,t);if(n.existsSync(s)){let o=t.replace(".json",""),a=n.readFileSync(s,"utf-8");e[o]=JSON.parse(a)}}return e["components-config"]&&(e.componentsConfig=e["components-config"],delete e["components-config"]),e}catch(e){throw new D(`Failed to load cache: ${e.message}`,"read")}}save(e){var t,s;try{n.mkdirSync(this.cacheDir,{recursive:!0});let o={timestamp:new Date().toISOString(),version:((t=e.metadata)==null?void 0:t.version)||"2.0.0",ffId:(s=e.metadata)==null?void 0:s.ffId};n.writeFileSync(this.metadataFile,JSON.stringify(o,null,2));let a=["tokens","variables","semanticVariables","semanticDarkVariables","cls","custom"];for(let i of a)if(e[i]!==void 0){let u=f.join(this.cacheDir,`${i}.js`),c=e[i];if(c==null||typeof c=="object"&&Object.keys(c).length===0||Array.isArray(c)&&c.length===0){let g=`module.exports = ${Array.isArray(c)?"[]":"{}"};`;n.writeFileSync(u,g)}else{let S=`module.exports = ${JSON.stringify(c,null,2)};`;n.writeFileSync(u,S)}}let l={fonts:e.fonts,icons:e.icons||e.iconSet,"components-config":e.componentsConfig,version:e.version};for(let[i,u]of Object.entries(l))if(u!==void 0){let c=f.join(this.cacheDir,`${i}.json`);n.writeFileSync(c,JSON.stringify(u,null,2))}}catch(o){throw new D(`Failed to save cache: ${o.message}`,"write")}}clear(){this.exists()&&n.rmSync(this.cacheDir,{recursive:!0,force:!0})}};E.exports=F});var T=w();function P(r={}){return{...r,webpack:(e,t)=>{typeof r.webpack=="function"&&(e=r.webpack(e,t));let s=new T(process.cwd());if(!s.exists())return console.warn('[FrontFriend Next.js] No cache found. Please run "npx frontfriend init" first.'),e;let o=s.load();if(!o)return console.error("[FrontFriend Next.js] Failed to load cache."),e;let{webpack:a}=t,l=a.DefinePlugin,i={__FF_CONFIG__:JSON.stringify(o.componentsConfig||null),__FF_ICONS__:JSON.stringify(o.icons||null)};return e.plugins=e.plugins||[],e.plugins.push(new l(i)),t.dev&&!t.isServer&&console.log("[FrontFriend Next.js] Injected configuration and icons into client build"),e}}}module.exports=P;
|
|
2
2
|
//# sourceMappingURL=next.js.map
|
package/dist/next.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../lib/core/constants.js", "../lib/core/errors.js", "../lib/core/cache-manager.js", "../next.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Configuration constants for FrontFriend Tailwind v2\n */\n\n// API Configuration\nconst DEFAULT_API_URL = 'https://app.frontfriend.dev';\nconst LEGACY_API_URL = 'https://tokens-studio-donux.up.railway.app/api';\n\n// Cache Configuration\nconst CACHE_DIR_NAME = '.cache/frontfriend';\nconst CACHE_TTL_DAYS = 7;\nconst CACHE_TTL_MS = CACHE_TTL_DAYS * 24 * 60 * 60 * 1000;\n\n// File names\nconst CACHE_FILES = {\n JS: [\n 'tokens.js',\n 'variables.js',\n 'semanticVariables.js',\n 'semanticDarkVariables.js',\n 'cls.js',\n 'custom.js'\n ],\n JSON: [\n 'fonts.json',\n 'icons.json',\n 'components-config.json',\n 'version.json',\n 'metadata.json'\n ]\n};\n\n// Environment variables\nconst ENV_VARS = {\n FF_ID: 'FF_ID',\n FF_API_URL: 'FF_API_URL'\n};\n\nmodule.exports = {\n DEFAULT_API_URL,\n LEGACY_API_URL,\n CACHE_DIR_NAME,\n CACHE_TTL_DAYS,\n CACHE_TTL_MS,\n CACHE_FILES,\n ENV_VARS\n};", "class APIError extends Error {\n constructor(message, statusCode, url) {\n super(message);\n this.name = 'APIError';\n this.statusCode = statusCode;\n this.url = url;\n this.code = `API_${statusCode}`;\n }\n}\n\nclass CacheError extends Error {\n constructor(message, operation) {\n super(message);\n this.name = 'CacheError';\n this.operation = operation;\n this.code = `CACHE_${operation.toUpperCase()}`;\n }\n}\n\nclass ConfigError extends Error {\n constructor(message, field) {\n super(message);\n this.name = 'ConfigError';\n this.field = field;\n this.code = `CONFIG_${field.toUpperCase()}`;\n }\n}\n\nclass ProcessingError extends Error {\n constructor(message, token) {\n super(message);\n this.name = 'ProcessingError';\n this.token = token;\n this.code = 'PROCESSING_ERROR';\n }\n}\n\nmodule.exports = {\n APIError,\n CacheError,\n ConfigError,\n ProcessingError\n};", "const fs = require('fs');\nconst path = require('path');\nconst { CACHE_DIR_NAME, CACHE_TTL_MS, CACHE_FILES } = require('./constants');\nconst { CacheError } = require('./errors');\n\nclass CacheManager {\n constructor(appRoot = process.cwd()) {\n this.appRoot = appRoot;\n this.cacheDir = path.join(appRoot, 'node_modules', CACHE_DIR_NAME);\n this.metadataFile = path.join(this.cacheDir, 'metadata.json');\n this.maxAge = CACHE_TTL_MS;\n }\n\n /**\n * Get the cache directory path\n * @returns {string} Cache directory path\n */\n getCacheDir() {\n return this.cacheDir;\n }\n\n /**\n * Check if cache directory exists\n * @returns {boolean} True if cache exists\n */\n exists() {\n return fs.existsSync(this.cacheDir);\n }\n\n /**\n * Check if cache is valid (exists and not expired)\n * @returns {boolean} True if cache is valid\n */\n isValid() {\n if (!this.exists()) {\n return false;\n }\n\n try {\n if (!fs.existsSync(this.metadataFile)) {\n return false;\n }\n\n const metadata = JSON.parse(fs.readFileSync(this.metadataFile, 'utf-8'));\n const timestamp = new Date(metadata.timestamp).getTime();\n const now = Date.now();\n \n return (now - timestamp) < this.maxAge;\n } catch (error) {\n return false;\n }\n }\n\n /**\n * Load all cached data\n * @returns {Object|null} Cached data object or null if not found\n */\n load() {\n if (!this.exists()) {\n return null;\n }\n\n try {\n const data = {};\n \n // Load all .js files\n for (const file of CACHE_FILES.JS) {\n const filePath = path.join(this.cacheDir, file);\n if (fs.existsSync(filePath)) {\n // Remove .js extension for key\n const key = file.replace('.js', '');\n try {\n // Use a more secure approach - parse the exported data\n const content = fs.readFileSync(filePath, 'utf-8');\n // Create a safe evaluation context\n const moduleExports = {};\n const fakeModule = { exports: moduleExports };\n \n // Use Function constructor to evaluate in isolated scope\n const evalFunc = new Function('module', 'exports', content);\n evalFunc(fakeModule, moduleExports);\n \n data[key] = fakeModule.exports;\n } catch (e) {\n // Skip files that can't be parsed\n }\n }\n }\n\n // Load all .json files\n for (const file of CACHE_FILES.JSON) {\n const filePath = path.join(this.cacheDir, file);\n if (fs.existsSync(filePath)) {\n const key = file.replace('.json', '');\n const content = fs.readFileSync(filePath, 'utf-8');\n data[key] = JSON.parse(content);\n }\n }\n\n // Rename components-config to componentsConfig for consistency\n if (data['components-config']) {\n data.componentsConfig = data['components-config'];\n delete data['components-config'];\n }\n\n return data;\n } catch (error) {\n throw new CacheError(`Failed to load cache: ${error.message}`, 'read');\n }\n }\n\n /**\n * Save data to cache\n * @param {Object} data - Data object to save\n * @throws {Error} If save operation fails\n */\n save(data) {\n try {\n // Create cache directory\n fs.mkdirSync(this.cacheDir, { recursive: true });\n\n // Save metadata first\n const metadata = {\n timestamp: new Date().toISOString(),\n version: data.metadata?.version || '2.0.0',\n ffId: data.metadata?.ffId\n };\n fs.writeFileSync(\n this.metadataFile,\n JSON.stringify(metadata, null, 2)\n );\n\n // Save .js files\n const jsFiles = [\n 'tokens',\n 'variables',\n 'semanticVariables',\n 'semanticDarkVariables',\n 'cls',\n 'custom'\n ];\n\n for (const key of jsFiles) {\n if (data[key] !== undefined) {\n const filePath = path.join(this.cacheDir, `${key}.js`);\n const value = data[key];\n \n // Ensure we have actual data to save\n if (value === null || value === undefined || \n (typeof value === 'object' && Object.keys(value).length === 0) ||\n (Array.isArray(value) && value.length === 0)) {\n // For empty objects/arrays, save a proper empty structure\n const emptyContent = Array.isArray(value) ? '[]' : '{}';\n const content = `module.exports = ${emptyContent};`;\n fs.writeFileSync(filePath, content);\n } else {\n const content = `module.exports = ${JSON.stringify(value, null, 2)};`;\n fs.writeFileSync(filePath, content);\n }\n }\n }\n\n // Save .json files\n const jsonData = {\n fonts: data.fonts,\n icons: data.icons || data.iconSet,\n 'components-config': data.componentsConfig,\n version: data.version\n };\n\n for (const [key, value] of Object.entries(jsonData)) {\n if (value !== undefined) {\n const filePath = path.join(this.cacheDir, `${key}.json`);\n fs.writeFileSync(filePath, JSON.stringify(value, null, 2));\n }\n }\n } catch (error) {\n throw new CacheError(`Failed to save cache: ${error.message}`, 'write');\n }\n }\n\n /**\n * Clear the cache directory\n */\n clear() {\n if (this.exists()) {\n fs.rmSync(this.cacheDir, { recursive: true, force: true });\n }\n }\n}\n\nmodule.exports = CacheManager;", "const CacheManager = require('./lib/core/cache-manager');\n\nfunction
|
|
5
|
-
"mappings": "8DAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CAKA,IAAMC,EAAkB,8BAClBC,EAAiB,iDAGjBC,EAAiB,qBAKjBC,EAAc,CAClB,GAAI,CACF,YACA,eACA,uBACA,2BACA,SACA,WACF,EACA,KAAM,CACJ,aACA,aACA,yBACA,eACA,eACF,CACF,EAGMC,EAAW,CACf,MAAO,QACP,WAAY,YACd,EAEAL,EAAO,QAAU,CACf,gBAAAC,EACA,eAAAC,EACA,eAAAC,EACA,iBACA,oBACA,YAAAC,EACA,SAAAC,CACF,IC9CA,IAAAC,EAAAC,EAAA,CAAAC,EAAAC,IAAA,KAAMC,EAAN,cAAuB,KAAM,CAC3B,YAAYC,EAASC,EAAYC,EAAK,CACpC,MAAMF,CAAO,EACb,KAAK,KAAO,WACZ,KAAK,WAAaC,EAClB,KAAK,IAAMC,EACX,KAAK,KAAO,OAAOD,CAAU,EAC/B,CACF,EAEME,EAAN,cAAyB,KAAM,CAC7B,YAAYH,EAASI,EAAW,CAC9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LjB,IAAMiB,EAAe,IAErB,SAASC,
|
|
6
|
-
"names": ["require_constants", "__commonJSMin", "exports", "module", "DEFAULT_API_URL", "LEGACY_API_URL", "CACHE_DIR_NAME", "CACHE_FILES", "ENV_VARS", "require_errors", "__commonJSMin", "exports", "module", "APIError", "message", "statusCode", "url", "CacheError", "operation", "ConfigError", "field", "ProcessingError", "token", "require_cache_manager", "__commonJSMin", "exports", "module", "fs", "path", "CACHE_DIR_NAME", "CACHE_TTL_MS", "CACHE_FILES", "CacheError", "CacheManager", "appRoot", "metadata", "timestamp", "data", "file", "filePath", "key", "content", "moduleExports", "fakeModule", "error", "_a", "_b", "jsFiles", "value", "jsonData", "CacheManager", "
|
|
4
|
+
"sourcesContent": ["/**\n * Configuration constants for FrontFriend Tailwind v2\n */\n\n// API Configuration\nconst DEFAULT_API_URL = 'https://app.frontfriend.dev';\nconst LEGACY_API_URL = 'https://tokens-studio-donux.up.railway.app/api';\n\n// Cache Configuration\nconst CACHE_DIR_NAME = '.cache/frontfriend';\nconst CACHE_TTL_DAYS = 7;\nconst CACHE_TTL_MS = CACHE_TTL_DAYS * 24 * 60 * 60 * 1000;\n\n// File names\nconst CACHE_FILES = {\n JS: [\n 'tokens.js',\n 'variables.js',\n 'semanticVariables.js',\n 'semanticDarkVariables.js',\n 'cls.js',\n 'custom.js'\n ],\n JSON: [\n 'fonts.json',\n 'icons.json',\n 'components-config.json',\n 'version.json',\n 'metadata.json'\n ]\n};\n\n// Environment variables\nconst ENV_VARS = {\n FF_ID: 'FF_ID',\n FF_API_URL: 'FF_API_URL'\n};\n\nmodule.exports = {\n DEFAULT_API_URL,\n LEGACY_API_URL,\n CACHE_DIR_NAME,\n CACHE_TTL_DAYS,\n CACHE_TTL_MS,\n CACHE_FILES,\n ENV_VARS\n};", "class APIError extends Error {\n constructor(message, statusCode, url) {\n super(message);\n this.name = 'APIError';\n this.statusCode = statusCode;\n this.url = url;\n this.code = `API_${statusCode}`;\n }\n}\n\nclass CacheError extends Error {\n constructor(message, operation) {\n super(message);\n this.name = 'CacheError';\n this.operation = operation;\n this.code = `CACHE_${operation.toUpperCase()}`;\n }\n}\n\nclass ConfigError extends Error {\n constructor(message, field) {\n super(message);\n this.name = 'ConfigError';\n this.field = field;\n this.code = `CONFIG_${field.toUpperCase()}`;\n }\n}\n\nclass ProcessingError extends Error {\n constructor(message, token) {\n super(message);\n this.name = 'ProcessingError';\n this.token = token;\n this.code = 'PROCESSING_ERROR';\n }\n}\n\nmodule.exports = {\n APIError,\n CacheError,\n ConfigError,\n ProcessingError\n};", "const fs = require('fs');\nconst path = require('path');\nconst { CACHE_DIR_NAME, CACHE_TTL_MS, CACHE_FILES } = require('./constants');\nconst { CacheError } = require('./errors');\n\nclass CacheManager {\n constructor(appRoot = process.cwd()) {\n this.appRoot = appRoot;\n this.cacheDir = path.join(appRoot, 'node_modules', CACHE_DIR_NAME);\n this.metadataFile = path.join(this.cacheDir, 'metadata.json');\n this.maxAge = CACHE_TTL_MS;\n }\n\n /**\n * Get the cache directory path\n * @returns {string} Cache directory path\n */\n getCacheDir() {\n return this.cacheDir;\n }\n\n /**\n * Check if cache directory exists\n * @returns {boolean} True if cache exists\n */\n exists() {\n return fs.existsSync(this.cacheDir);\n }\n\n /**\n * Check if cache is valid (exists and not expired)\n * @returns {boolean} True if cache is valid\n */\n isValid() {\n if (!this.exists()) {\n return false;\n }\n\n try {\n if (!fs.existsSync(this.metadataFile)) {\n return false;\n }\n\n const metadata = JSON.parse(fs.readFileSync(this.metadataFile, 'utf-8'));\n const timestamp = new Date(metadata.timestamp).getTime();\n const now = Date.now();\n \n return (now - timestamp) < this.maxAge;\n } catch (error) {\n return false;\n }\n }\n\n /**\n * Load all cached data\n * @returns {Object|null} Cached data object or null if not found\n */\n load() {\n if (!this.exists()) {\n return null;\n }\n\n try {\n const data = {};\n \n // Load all .js files\n for (const file of CACHE_FILES.JS) {\n const filePath = path.join(this.cacheDir, file);\n if (fs.existsSync(filePath)) {\n // Remove .js extension for key\n const key = file.replace('.js', '');\n try {\n // Use a more secure approach - parse the exported data\n const content = fs.readFileSync(filePath, 'utf-8');\n // Create a safe evaluation context\n const moduleExports = {};\n const fakeModule = { exports: moduleExports };\n \n // Use Function constructor to evaluate in isolated scope\n const evalFunc = new Function('module', 'exports', content);\n evalFunc(fakeModule, moduleExports);\n \n data[key] = fakeModule.exports;\n } catch (e) {\n // Skip files that can't be parsed\n }\n }\n }\n\n // Load all .json files\n for (const file of CACHE_FILES.JSON) {\n const filePath = path.join(this.cacheDir, file);\n if (fs.existsSync(filePath)) {\n const key = file.replace('.json', '');\n const content = fs.readFileSync(filePath, 'utf-8');\n data[key] = JSON.parse(content);\n }\n }\n\n // Rename components-config to componentsConfig for consistency\n if (data['components-config']) {\n data.componentsConfig = data['components-config'];\n delete data['components-config'];\n }\n\n return data;\n } catch (error) {\n throw new CacheError(`Failed to load cache: ${error.message}`, 'read');\n }\n }\n\n /**\n * Save data to cache\n * @param {Object} data - Data object to save\n * @throws {Error} If save operation fails\n */\n save(data) {\n try {\n // Create cache directory\n fs.mkdirSync(this.cacheDir, { recursive: true });\n\n // Save metadata first\n const metadata = {\n timestamp: new Date().toISOString(),\n version: data.metadata?.version || '2.0.0',\n ffId: data.metadata?.ffId\n };\n fs.writeFileSync(\n this.metadataFile,\n JSON.stringify(metadata, null, 2)\n );\n\n // Save .js files\n const jsFiles = [\n 'tokens',\n 'variables',\n 'semanticVariables',\n 'semanticDarkVariables',\n 'cls',\n 'custom'\n ];\n\n for (const key of jsFiles) {\n if (data[key] !== undefined) {\n const filePath = path.join(this.cacheDir, `${key}.js`);\n const value = data[key];\n \n // Ensure we have actual data to save\n if (value === null || value === undefined || \n (typeof value === 'object' && Object.keys(value).length === 0) ||\n (Array.isArray(value) && value.length === 0)) {\n // For empty objects/arrays, save a proper empty structure\n const emptyContent = Array.isArray(value) ? '[]' : '{}';\n const content = `module.exports = ${emptyContent};`;\n fs.writeFileSync(filePath, content);\n } else {\n const content = `module.exports = ${JSON.stringify(value, null, 2)};`;\n fs.writeFileSync(filePath, content);\n }\n }\n }\n\n // Save .json files\n const jsonData = {\n fonts: data.fonts,\n icons: data.icons || data.iconSet,\n 'components-config': data.componentsConfig,\n version: data.version\n };\n\n for (const [key, value] of Object.entries(jsonData)) {\n if (value !== undefined) {\n const filePath = path.join(this.cacheDir, `${key}.json`);\n fs.writeFileSync(filePath, JSON.stringify(value, null, 2));\n }\n }\n } catch (error) {\n throw new CacheError(`Failed to save cache: ${error.message}`, 'write');\n }\n }\n\n /**\n * Clear the cache directory\n */\n clear() {\n if (this.exists()) {\n fs.rmSync(this.cacheDir, { recursive: true, force: true });\n }\n }\n}\n\nmodule.exports = CacheManager;", "const CacheManager = require('./lib/core/cache-manager');\n\nfunction frontfriend(nextConfig = {}) {\n return {\n ...nextConfig,\n webpack: (config, options) => {\n // 1. Call existing webpack config if provided\n if (typeof nextConfig.webpack === 'function') {\n config = nextConfig.webpack(config, options);\n }\n\n // 2. Load cache with CacheManager\n const cacheManager = new CacheManager(process.cwd());\n \n if (!cacheManager.exists()) {\n console.warn('[FrontFriend Next.js] No cache found. Please run \"npx frontfriend init\" first.');\n return config;\n }\n\n const cache = cacheManager.load();\n if (!cache) {\n console.error('[FrontFriend Next.js] Failed to load cache.');\n return config;\n }\n\n // 4. Use webpack.DefinePlugin from options (works with both webpack 4 and 5)\n const { webpack } = options;\n const DefinePlugin = webpack.DefinePlugin;\n\n // 5. Inject __FF_CONFIG__ and __FF_ICONS__ as globals\n const definitions = {\n __FF_CONFIG__: JSON.stringify(cache.componentsConfig || null),\n __FF_ICONS__: JSON.stringify(cache.icons || null)\n };\n\n // Add DefinePlugin to plugins array\n config.plugins = config.plugins || [];\n config.plugins.push(new DefinePlugin(definitions));\n\n // Log success in development\n if (options.dev && !options.isServer) {\n console.log('[FrontFriend Next.js] Injected configuration and icons into client build');\n }\n\n // 6. Return modified config\n return config;\n }\n };\n}\n\nmodule.exports = frontfriend;"],
|
|
5
|
+
"mappings": "8DAAA,IAAA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,KAAK,IAAIK,EAAaC,CAAW,CAAC,EAG7CL,EAAQ,KAAO,CAACA,EAAQ,UAC1B,QAAQ,IAAI,0EAA0E,EAIjFD,CACT,CACF,CACF,CAEA,OAAO,QAAUF",
|
|
6
|
+
"names": ["require_constants", "__commonJSMin", "exports", "module", "DEFAULT_API_URL", "LEGACY_API_URL", "CACHE_DIR_NAME", "CACHE_FILES", "ENV_VARS", "require_errors", "__commonJSMin", "exports", "module", "APIError", "message", "statusCode", "url", "CacheError", "operation", "ConfigError", "field", "ProcessingError", "token", "require_cache_manager", "__commonJSMin", "exports", "module", "fs", "path", "CACHE_DIR_NAME", "CACHE_TTL_MS", "CACHE_FILES", "CacheError", "CacheManager", "appRoot", "metadata", "timestamp", "data", "file", "filePath", "key", "content", "moduleExports", "fakeModule", "error", "_a", "_b", "jsFiles", "value", "jsonData", "CacheManager", "frontfriend", "nextConfig", "config", "options", "cacheManager", "cache", "webpack", "DefinePlugin", "definitions"]
|
|
7
7
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ declare module '@frontfriend/tailwind' {
|
|
|
18
18
|
// Exported configuration and utilities
|
|
19
19
|
export const config: Record<string, any> | null;
|
|
20
20
|
export const iconSet: Record<string, string> | null;
|
|
21
|
-
export function ffdc(config: Record<string, any>): Record<string, any>;
|
|
21
|
+
export function ffdc(config: Record<string, any> | null | undefined): Record<string, any>;
|
|
22
22
|
|
|
23
23
|
export interface CacheData {
|
|
24
24
|
variables?: Record<string, string>;
|
|
@@ -73,7 +73,7 @@ declare module '@frontfriend/tailwind/next' {
|
|
|
73
73
|
* @param config - Next.js configuration object
|
|
74
74
|
* @returns Modified Next.js configuration
|
|
75
75
|
*/
|
|
76
|
-
export default function
|
|
76
|
+
export default function frontfriend(config?: NextConfig): NextConfig;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
declare module '@frontfriend/tailwind/cli' {
|
|
@@ -246,4 +246,15 @@ declare module '@frontfriend/tailwind/lib/core/constants' {
|
|
|
246
246
|
export const DEFAULT_API_URL: string;
|
|
247
247
|
export const DEFAULT_PREFIX: string;
|
|
248
248
|
export const CACHE_TTL: number;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
declare module '@frontfriend/tailwind/vite' {
|
|
252
|
+
import { Plugin } from 'vite';
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Vite plugin for FrontFriend globals injection
|
|
256
|
+
* @returns Vite plugin configuration
|
|
257
|
+
*/
|
|
258
|
+
export function frontfriend(): Plugin;
|
|
259
|
+
export default frontfriend;
|
|
249
260
|
}
|
package/dist/vite.d.ts
CHANGED
package/dist/vite.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"fs";import o from"path";function
|
|
1
|
+
import e from"fs";import o from"path";function c(){let i=null,r=null;return{name:"vite-plugin-frontfriend",config(){try{let n=o.join(process.cwd(),"node_modules",".cache","frontfriend");if(!e.existsSync(n))return console.warn('[FrontFriend Vite] No cache found. Please run "npx frontfriend init" first.'),{define:{__FF_CONFIG__:JSON.stringify({}),__FF_ICONS__:JSON.stringify({})}};let t=o.join(n,"components-config.json");e.existsSync(t)&&(i=JSON.parse(e.readFileSync(t,"utf-8")));let s=o.join(n,"icons.json");e.existsSync(s)&&(r=JSON.parse(e.readFileSync(s,"utf-8"))),!i&&!r&&console.warn('[FrontFriend Vite] Cache directory exists but no cache files found. Please run "npx frontfriend init" to refresh.')}catch(n){console.error("[FrontFriend Vite] Failed to load cache:",n.message)}return{define:{__FF_CONFIG__:JSON.stringify(i||{}),__FF_ICONS__:JSON.stringify(r||{})}}}}}var d=c;export{d as default,c as frontfriend};
|
|
2
2
|
//# sourceMappingURL=vite.mjs.map
|
package/dist/vite.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../vite.mjs"],
|
|
4
|
-
"sourcesContent": ["// Vite plugin for FrontFriend Tailwind\nimport fs from 'fs';\nimport path from 'path';\n\nexport function
|
|
5
|
-
"mappings": "AACA,OAAOA,MAAQ,KACf,OAAOC,MAAU,OAEV,SAASC,
|
|
6
|
-
"names": ["fs", "path", "
|
|
4
|
+
"sourcesContent": ["// Vite plugin for FrontFriend Tailwind\nimport fs from 'fs';\nimport path from 'path';\n\nexport function frontfriend() {\n let config = null;\n let icons = null;\n\n return {\n name: 'vite-plugin-frontfriend',\n \n config() {\n // Load cache during config phase\n try {\n const cacheDir = path.join(process.cwd(), 'node_modules', '.cache', 'frontfriend');\n \n // Check if cache directory exists\n if (!fs.existsSync(cacheDir)) {\n console.warn('[FrontFriend Vite] No cache found. Please run \"npx frontfriend init\" first.');\n return {\n define: {\n __FF_CONFIG__: JSON.stringify({}),\n __FF_ICONS__: JSON.stringify({})\n }\n };\n }\n \n const configPath = path.join(cacheDir, 'components-config.json');\n if (fs.existsSync(configPath)) {\n config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));\n }\n \n const iconsPath = path.join(cacheDir, 'icons.json');\n if (fs.existsSync(iconsPath)) {\n icons = JSON.parse(fs.readFileSync(iconsPath, 'utf-8'));\n }\n \n // Warn if cache files don't exist\n if (!config && !icons) {\n console.warn('[FrontFriend Vite] Cache directory exists but no cache files found. Please run \"npx frontfriend init\" to refresh.');\n }\n } catch (error) {\n console.error('[FrontFriend Vite] Failed to load cache:', error.message);\n }\n\n // Define global constants\n return {\n define: {\n __FF_CONFIG__: JSON.stringify(config || {}),\n __FF_ICONS__: JSON.stringify(icons || {})\n }\n };\n }\n };\n}\n\n// Default export for compatibility\nexport default frontfriend;"],
|
|
5
|
+
"mappings": "AACA,OAAOA,MAAQ,KACf,OAAOC,MAAU,OAEV,SAASC,GAAc,CAC5B,IAAIC,EAAS,KACTC,EAAQ,KAEZ,MAAO,CACL,KAAM,0BAEN,QAAS,CAEP,GAAI,CACF,IAAMC,EAAWJ,EAAK,KAAK,QAAQ,IAAI,EAAG,eAAgB,SAAU,aAAa,EAGjF,GAAI,CAACD,EAAG,WAAWK,CAAQ,EACzB,eAAQ,KAAK,6EAA6E,EACnF,CACL,OAAQ,CACN,cAAe,KAAK,UAAU,CAAC,CAAC,EAChC,aAAc,KAAK,UAAU,CAAC,CAAC,CACjC,CACF,EAGF,IAAMC,EAAaL,EAAK,KAAKI,EAAU,wBAAwB,EAC3DL,EAAG,WAAWM,CAAU,IAC1BH,EAAS,KAAK,MAAMH,EAAG,aAAaM,EAAY,OAAO,CAAC,GAG1D,IAAMC,EAAYN,EAAK,KAAKI,EAAU,YAAY,EAC9CL,EAAG,WAAWO,CAAS,IACzBH,EAAQ,KAAK,MAAMJ,EAAG,aAAaO,EAAW,OAAO,CAAC,GAIpD,CAACJ,GAAU,CAACC,GACd,QAAQ,KAAK,mHAAmH,CAEpI,OAASI,EAAO,CACd,QAAQ,MAAM,2CAA4CA,EAAM,OAAO,CACzE,CAGA,MAAO,CACL,OAAQ,CACN,cAAe,KAAK,UAAUL,GAAU,CAAC,CAAC,EAC1C,aAAc,KAAK,UAAUC,GAAS,CAAC,CAAC,CAC1C,CACF,CACF,CACF,CACF,CAGA,IAAOK,EAAQP",
|
|
6
|
+
"names": ["fs", "path", "frontfriend", "config", "icons", "cacheDir", "configPath", "iconsPath", "error", "vite_default"]
|
|
7
7
|
}
|