@frontfriend/tailwind 2.5.4 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +30 -33
- package/dist/index.js +3 -3
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +3 -3
- package/dist/lib/core/api-client.js +1 -1
- package/dist/lib/core/api-client.js.map +3 -3
- package/dist/lib/core/cache-manager.js +6 -2
- package/dist/lib/core/component-downloader.js +2 -2
- package/dist/lib/core/component-downloader.js.map +3 -3
- package/dist/lib/core/env-utils.js +1 -1
- package/dist/lib/core/env-utils.js.map +2 -2
- package/dist/lib/core/file-utils.js +1 -1
- package/dist/lib/core/file-utils.js.map +2 -2
- package/dist/lib/core/local-token-reader.js +1 -1
- package/dist/lib/core/local-token-reader.js.map +2 -2
- package/dist/lib/core/path-utils.js +1 -1
- package/dist/lib/core/path-utils.js.map +2 -2
- package/dist/next.js +1 -1
- package/dist/next.js.map +3 -3
- package/dist/runtime.js +1 -1
- package/dist/runtime.js.map +3 -3
- package/dist/vite.js +1 -1
- package/dist/vite.js.map +3 -3
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../lib/core/file-utils.js", "../../../lib/core/path-utils.js"],
|
|
4
|
-
"sourcesContent": ["const fs = require('fs');\n\n/**\n * Read a JSON file safely, returning null if file doesn't exist\n * @param {string} filepath - Path to the JSON file\n * @returns {Object|null} Parsed JSON or null if file not found\n * @throws {Error} If JSON is invalid\n */\nfunction readJsonFileSafe(filepath) {\n try {\n const content = fs.readFileSync(filepath, 'utf8');\n return JSON.parse(content);\n } catch (error) {\n if (error.code === 'ENOENT') {\n return null; // File not found, return null like API would return 404\n }\n throw error;\n }\n}\n\n/**\n * Read a file safely, returning null if file doesn't exist\n * @param {string} filepath - Path to the file\n * @returns {string|null} File content or null if file not found\n * @throws {Error} For other file system errors\n */\nfunction readFileSafe(filepath) {\n try {\n
|
|
5
|
-
"mappings": "8DAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,KAAMC,EAAK,QAAQ,IAAI,EAQvB,SAASC,EAAiBC,EAAU,CAClC,GAAI,CACF,IAAMC,EAAUH,EAAG,aAAaE,EAAU,MAAM,EAChD,OAAO,KAAK,MAAMC,CAAO,CAC3B,OAASC,EAAO,CACd,GAAIA,EAAM,OAAS,SACjB,OAAO,KAET,MAAMA,CACR,CACF,
|
|
4
|
+
"sourcesContent": ["const fs = require('fs');\n\n/**\n * Read a JSON file safely, returning null if file doesn't exist\n * @param {string} filepath - Path to the JSON file\n * @returns {Object|null} Parsed JSON or null if file not found\n * @throws {Error} If JSON is invalid\n */\nfunction readJsonFileSafe(filepath) {\n try {\n const content = fs.readFileSync(filepath, 'utf8');\n return JSON.parse(content);\n } catch (error) {\n if (error.code === 'ENOENT') {\n return null; // File not found, return null like API would return 404\n }\n throw error;\n }\n}\n\n/**\n * Read a file safely, returning null if file doesn't exist\n * Strips UTF-8 BOM if present (fixes Windows compatibility)\n * @param {string} filepath - Path to the file\n * @returns {string|null} File content or null if file not found\n * @throws {Error} For other file system errors\n */\nfunction readFileSafe(filepath) {\n try {\n const content = fs.readFileSync(filepath, 'utf8');\n // Strip UTF-8 BOM if present (Windows compatibility)\n return content.replace(/^\\uFEFF/, '');\n } catch (error) {\n if (error.code === 'ENOENT') {\n return null; // File not found\n }\n throw error;\n }\n}\n\n/**\n * Write JSON data to a file with proper formatting\n * @param {string} filepath - Path to write the file\n * @param {Object} data - Data to write\n * @param {number} indent - Indentation level (default: 2)\n */\nfunction writeJsonFile(filepath, data, indent = 2) {\n const content = JSON.stringify(data, null, indent);\n fs.writeFileSync(filepath, content, 'utf8');\n}\n\n/**\n * Write module.exports file with JSON data\n * @param {string} filepath - Path to write the file\n * @param {Object} data - Data to export\n */\nfunction writeModuleExportsFile(filepath, data) {\n // Handle empty data cases\n if (data === null || data === undefined || \n (typeof data === 'object' && Object.keys(data).length === 0) ||\n (Array.isArray(data) && data.length === 0)) {\n const emptyContent = Array.isArray(data) ? '[]' : '{}';\n const content = `module.exports = ${emptyContent};`;\n fs.writeFileSync(filepath, content, 'utf8');\n } else {\n const content = `module.exports = ${JSON.stringify(data, null, 2)};`;\n fs.writeFileSync(filepath, content, 'utf8');\n }\n}\n\n/**\n * Check if a file exists\n * @param {string} filepath - Path to check\n * @returns {boolean} True if file exists\n */\nfunction fileExists(filepath) {\n return fs.existsSync(filepath);\n}\n\n/**\n * Create directory recursively\n * @param {string} dirpath - Directory path to create\n */\nfunction ensureDirectoryExists(dirpath) {\n fs.mkdirSync(dirpath, { recursive: true });\n}\n\n/**\n * Remove directory recursively\n * @param {string} dirpath - Directory path to remove\n */\nfunction removeDirectory(dirpath) {\n fs.rmSync(dirpath, { recursive: true, force: true });\n}\n\nmodule.exports = {\n readJsonFileSafe,\n readFileSafe,\n writeJsonFile,\n writeModuleExportsFile,\n fileExists,\n ensureDirectoryExists,\n removeDirectory\n};", "const path = require('path');\nconst { fileExists } = require('./file-utils');\n\n/**\n * Find a file by traversing up the directory tree\n * @param {string} filename - Name of the file to find\n * @param {string} startDir - Starting directory (defaults to cwd)\n * @returns {string|null} Full path to the file or null if not found\n */\nfunction findFileUpward(filename, startDir = process.cwd()) {\n let currentDir = startDir;\n \n while (currentDir !== path.parse(currentDir).root) {\n const filePath = path.join(currentDir, filename);\n \n if (fileExists(filePath)) {\n return filePath;\n }\n \n currentDir = path.dirname(currentDir);\n }\n \n return null;\n}\n\n/**\n * Find a directory by traversing up and checking multiple possible paths\n * @param {string} dirname - Name of the directory to find\n * @param {string} startDir - Starting directory (defaults to cwd)\n * @param {Function} validator - Optional function to validate the directory\n * @returns {string|null} Full path to the directory or null if not found\n */\nfunction findDirectoryUpward(dirname, startDir = process.cwd(), validator = null) {\n const possiblePaths = [];\n let currentDir = startDir;\n const maxLevels = 10; // Prevent infinite loop\n \n // Build list of possible paths\n for (let i = 0; i < maxLevels; i++) {\n // Direct path\n possiblePaths.push(path.join(currentDir, dirname));\n \n // Relative paths up to 3 levels\n if (i < 3) {\n possiblePaths.push(path.join(currentDir, '../'.repeat(i + 1) + dirname));\n }\n \n const parentDir = path.dirname(currentDir);\n if (parentDir === currentDir) break; // Reached root\n currentDir = parentDir;\n }\n \n // Also check from module directory (for when running from node_modules)\n possiblePaths.push(path.join(__dirname, '../../../', dirname));\n \n // Find first existing directory that passes validation\n for (const dirPath of possiblePaths) {\n if (fileExists(dirPath)) {\n if (!validator || validator(dirPath)) {\n return dirPath;\n }\n }\n }\n \n return null;\n}\n\n/**\n * Find a directory with multiple possible relative paths\n * @param {string[]} possiblePaths - Array of possible paths to check\n * @param {string} startDir - Starting directory (defaults to cwd)\n * @returns {string|null} Full path to the directory or null if not found\n */\nfunction findDirectoryWithPaths(possiblePaths, startDir = process.cwd()) {\n // Build absolute paths from the start directory\n const absolutePaths = possiblePaths.map(p => {\n if (path.isAbsolute(p)) {\n return p;\n }\n return path.join(startDir, p);\n });\n \n // Find first existing path\n for (const dirPath of absolutePaths) {\n if (fileExists(dirPath)) {\n return dirPath;\n }\n }\n \n return null;\n}\n\nmodule.exports = {\n findFileUpward,\n findDirectoryUpward,\n findDirectoryWithPaths\n};"],
|
|
5
|
+
"mappings": "8DAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,KAAMC,EAAK,QAAQ,IAAI,EAQvB,SAASC,EAAiBC,EAAU,CAClC,GAAI,CACF,IAAMC,EAAUH,EAAG,aAAaE,EAAU,MAAM,EAChD,OAAO,KAAK,MAAMC,CAAO,CAC3B,OAASC,EAAO,CACd,GAAIA,EAAM,OAAS,SACjB,OAAO,KAET,MAAMA,CACR,CACF,CASA,SAASC,EAAaH,EAAU,CAC9B,GAAI,CAGF,OAFgBF,EAAG,aAAaE,EAAU,MAAM,EAEjC,QAAQ,UAAW,EAAE,CACtC,OAASE,EAAO,CACd,GAAIA,EAAM,OAAS,SACjB,O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QK,CAAU,CACtC,CAEA,OAAO,IACT,CASA,SAASE,EAAoBC,EAASJ,EAAW,QAAQ,IAAI,EAAGK,EAAY,KAAM,CAChF,IAAMC,EAAgB,CAAC,EACnBL,EAAaD,EACXO,EAAY,GAGlB,QAASC,EAAI,EAAGA,EAAID,EAAWC,IAAK,CAElCF,EAAc,KAAKV,EAAK,KAAKK,EAAYG,CAAO,CAAC,EAG7CI,EAAI,GACNF,EAAc,KAAKV,EAAK,KAAKK,EAAY,MAAM,OAAOO,EAAI,CAAC,EAAIJ,CAAO,CAAC,EAGzE,IAAMK,EAAYb,EAAK,QAAQK,CAAU,EACzC,GAAIQ,IAAcR,EAAY,MAC9BA,EAAaQ,CACf,CAGAH,EAAc,KAAKV,EAAK,KAAK,UAAW,YAAaQ,CAAO,CAAC,EAG7D,QAAWM,KAAWJ,EACpB,GAAIT,EAAWa,CAAO,IAChB,CAACL,GAAaA,EAAUK,CAAO,GACjC,OAAOA,EAKb,OAAO,IACT,CAQA,SAASC,EAAuBL,EAAeN,EAAW,QAAQ,IAAI,EAAG,CAEvE,IAAMY,EAAgBN,EAAc,IAAIO,GAClCjB,EAAK,WAAWiB,CAAC,EACZA,EAEFjB,EAAK,KAAKI,EAAUa,CAAC,CAC7B,EAGD,QAAWH,KAAWE,EACpB,GAAIf,EAAWa,CAAO,EACpB,OAAOA,EAIX,OAAO,IACT,CAEA,OAAO,QAAU,CACf,eAAAZ,EACA,oBAAAK,EACA,uBAAAQ,CACF",
|
|
6
6
|
"names": ["require_file_utils", "__commonJSMin", "exports", "module", "fs", "readJsonFileSafe", "filepath", "content", "error", "readFileSafe", "writeJsonFile", "data", "indent", "writeModuleExportsFile", "fileExists", "ensureDirectoryExists", "dirpath", "removeDirectory", "path", "fileExists", "findFileUpward", "filename", "startDir", "currentDir", "filePath", "findDirectoryUpward", "dirname", "validator", "possiblePaths", "maxLevels", "i", "parentDir", "dirPath", "findDirectoryWithPaths", "absolutePaths", "p"]
|
|
7
7
|
}
|
package/dist/next.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var u=(
|
|
1
|
+
var u=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var S=u((W,_)=>{var L="https://app.frontfriend.dev",T="https://tokens-studio-donux.up.railway.app/api",k=".cache/frontfriend",P={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"]},b={FF_ID:"FF_ID",FF_API_URL:"FF_API_URL",FF_USE_LOCAL:"FF_USE_LOCAL"};_.exports={DEFAULT_API_URL:L,LEGACY_API_URL:T,CACHE_DIR_NAME:k,CACHE_TTL_DAYS:7,CACHE_TTL_MS:6048e5,CACHE_FILES:P,ENV_VARS:b}});var E=u((Z,y)=>{var h=class extends Error{constructor(e,t,s){super(e),this.name="APIError",this.statusCode=t,this.url=s,this.code=`API_${t}`}},d=class extends Error{constructor(e,t){super(e),this.name="CacheError",this.operation=t,this.code=`CACHE_${t.toUpperCase()}`}},p=class extends Error{constructor(e,t){super(e),this.name="ConfigError",this.field=t,this.code=`CONFIG_${t.toUpperCase()}`}},F=class extends Error{constructor(e,t){super(e),this.name="ProcessingError",this.token=t,this.code="PROCESSING_ERROR"}};y.exports={APIError:h,CacheError:d,ConfigError:p,ProcessingError:F}});var A=u((ee,C)=>{var c=require("fs");function J(n){try{let e=c.readFileSync(n,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}function U(n){try{return c.readFileSync(n,"utf8").replace(/^\uFEFF/,"")}catch(e){if(e.code==="ENOENT")return null;throw e}}function H(n,e,t=2){let s=JSON.stringify(e,null,t);c.writeFileSync(n,s,"utf8")}function R(n,e){if(e==null||typeof e=="object"&&Object.keys(e).length===0||Array.isArray(e)&&e.length===0){let s=`module.exports = ${Array.isArray(e)?"[]":"{}"};`;c.writeFileSync(n,s,"utf8")}else{let t=`module.exports = ${JSON.stringify(e,null,2)};`;c.writeFileSync(n,t,"utf8")}}function $(n){return c.existsSync(n)}function M(n){c.mkdirSync(n,{recursive:!0})}function V(n){c.rmSync(n,{recursive:!0,force:!0})}C.exports={readJsonFileSafe:J,readFileSafe:U,writeJsonFile:H,writeModuleExportsFile:R,fileExists:$,ensureDirectoryExists:M,removeDirectory:V}});var O=u((te,I)=>{var a=require("path"),{CACHE_DIR_NAME:q,CACHE_TTL_MS:G,CACHE_FILES:j}=S(),{CacheError:w}=E(),{readJsonFileSafe:x,readFileSafe:Y,writeJsonFile:D,writeModuleExportsFile:g,fileExists:N,ensureDirectoryExists:B,removeDirectory:X}=A(),m=class{constructor(e=process.cwd()){this.appRoot=e,this.cacheDir=a.join(e,"node_modules",q),this.metadataFile=a.join(this.cacheDir,"metadata.json"),this.maxAge=G}getCacheDir(){return this.cacheDir}exists(){return N(this.cacheDir)}isValid(){if(!this.exists())return!1;try{let e=x(this.metadataFile);if(!e)return!1;let 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 j.JS){let s=a.join(this.cacheDir,t);if(N(s)){let i=t.replace(".js","");try{let r=Y(s);if(r!==null){let l={},o={exports:l};new Function("module","exports",r)(o,l),e[i]=o.exports}}catch(r){console.warn(`[Frontfriend] Failed to load ${t}: ${r.message}`),(r.message.includes("Unexpected token")||r.message.includes("Invalid character"))&&console.warn("[Frontfriend] This might be a BOM or encoding issue. Try deleting node_modules/.cache/frontfriend and running `npx frontfriend init` again.")}}}for(let t of j.JSON){let s=a.join(this.cacheDir,t),i=t.replace(".json",""),r=x(s);r!==null&&(e[i]=r)}return e["components-config"]&&(e.componentsConfig=e["components-config"],delete e["components-config"]),e.cls&&!e.safelist&&(e.safelist=e.cls,delete e.cls),e}catch(e){throw new w(`Failed to load cache: ${e.message}`,"read")}}save(e){var t,s;try{B(this.cacheDir);let i={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};D(this.metadataFile,i);let r=["tokens","variables","semanticVariables","semanticDarkVariables","safelist","custom"];for(let o of r)if(e[o]!==void 0){let f=a.join(this.cacheDir,`${o}.js`);g(f,e[o])}if(e.safelist&&Array.isArray(e.safelist)){let o=a.join(this.cacheDir,"safelist.js");g(o,e.safelist)}let l={fonts:e.fonts,icons:e.icons||e.iconSet,"components-config":e.componentsConfig,version:e.version};for(let[o,f]of Object.entries(l))if(f!==void 0){let v=a.join(this.cacheDir,`${o}.json`);D(v,f)}}catch(i){throw new w(`Failed to save cache: ${i.message}`,"write")}}clear(){this.exists()&&X(this.cacheDir)}};I.exports=m});var z=O();function K(n={}){let e=new z(process.cwd()),t=null;return e.exists()?t=e.load():console.warn('[FrontFriend Next.js] No cache found. Please run "npx frontfriend init" first.'),{...n,env:{...n.env,NEXT_PUBLIC_FF_CONFIG:t?JSON.stringify(t.componentsConfig||null):"null",NEXT_PUBLIC_FF_ICONS:t?JSON.stringify(t.icons||null):"null"},webpack:(s,i)=>{if(typeof n.webpack=="function"&&(s=n.webpack(s,i)),!t)return s;let{webpack:r}=i,l=r.DefinePlugin,o={__FF_CONFIG__:JSON.stringify(t.componentsConfig||null),__FF_ICONS__:JSON.stringify(t.icons||null)};return s.plugins=s.plugins||[],s.plugins.push(new l(o)),i.dev&&!i.isServer&&console.log("[FrontFriend Next.js] Injected configuration and icons into client build"),s}}}module.exports=K;
|
|
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/file-utils.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 'safelist.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 FF_USE_LOCAL: 'FF_USE_LOCAL'\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');\n\n/**\n * Read a JSON file safely, returning null if file doesn't exist\n * @param {string} filepath - Path to the JSON file\n * @returns {Object|null} Parsed JSON or null if file not found\n * @throws {Error} If JSON is invalid\n */\nfunction readJsonFileSafe(filepath) {\n try {\n const content = fs.readFileSync(filepath, 'utf8');\n return JSON.parse(content);\n } catch (error) {\n if (error.code === 'ENOENT') {\n return null; // File not found, return null like API would return 404\n }\n throw error;\n }\n}\n\n/**\n * Read a file safely, returning null if file doesn't exist\n * @param {string} filepath - Path to the file\n * @returns {string|null} File content or null if file not found\n * @throws {Error} For other file system errors\n */\nfunction readFileSafe(filepath) {\n try {\n return fs.readFileSync(filepath, 'utf8');\n } catch (error) {\n if (error.code === 'ENOENT') {\n return null; // File not found\n }\n throw error;\n }\n}\n\n/**\n * Write JSON data to a file with proper formatting\n * @param {string} filepath - Path to write the file\n * @param {Object} data - Data to write\n * @param {number} indent - Indentation level (default: 2)\n */\nfunction writeJsonFile(filepath, data, indent = 2) {\n const content = JSON.stringify(data, null, indent);\n fs.writeFileSync(filepath, content, 'utf8');\n}\n\n/**\n * Write module.exports file with JSON data\n * @param {string} filepath - Path to write the file\n * @param {Object} data - Data to export\n */\nfunction writeModuleExportsFile(filepath, data) {\n // Handle empty data cases\n if (data === null || data === undefined || \n (typeof data === 'object' && Object.keys(data).length === 0) ||\n (Array.isArray(data) && data.length === 0)) {\n const emptyContent = Array.isArray(data) ? '[]' : '{}';\n const content = `module.exports = ${emptyContent};`;\n fs.writeFileSync(filepath, content, 'utf8');\n } else {\n const content = `module.exports = ${JSON.stringify(data, null, 2)};`;\n fs.writeFileSync(filepath, content, 'utf8');\n }\n}\n\n/**\n * Check if a file exists\n * @param {string} filepath - Path to check\n * @returns {boolean} True if file exists\n */\nfunction fileExists(filepath) {\n return fs.existsSync(filepath);\n}\n\n/**\n * Create directory recursively\n * @param {string} dirpath - Directory path to create\n */\nfunction ensureDirectoryExists(dirpath) {\n fs.mkdirSync(dirpath, { recursive: true });\n}\n\n/**\n * Remove directory recursively\n * @param {string} dirpath - Directory path to remove\n */\nfunction removeDirectory(dirpath) {\n fs.rmSync(dirpath, { recursive: true, force: true });\n}\n\nmodule.exports = {\n readJsonFileSafe,\n readFileSafe,\n writeJsonFile,\n writeModuleExportsFile,\n fileExists,\n ensureDirectoryExists,\n removeDirectory\n};", "const path = require('path');\nconst { CACHE_DIR_NAME, CACHE_TTL_MS, CACHE_FILES } = require('./constants');\nconst { CacheError } = require('./errors');\nconst { readJsonFileSafe, readFileSafe, writeJsonFile, writeModuleExportsFile, fileExists, ensureDirectoryExists, removeDirectory } = require('./file-utils');\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 fileExists(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 const metadata = readJsonFileSafe(this.metadataFile);\n if (!metadata) {\n return false;\n }\n\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 (fileExists(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 = readFileSafe(filePath);\n if (content !== null) {\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 }\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 const key = file.replace('.json', '');\n const content = readJsonFileSafe(filePath);\n if (content !== null) {\n data[key] = 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 // Backward compatibility: rename cls to safelist if present\n if (data.cls && !data.safelist) {\n data.safelist = data.cls;\n delete data.cls;\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 ensureDirectoryExists(this.cacheDir);\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 writeJsonFile(this.metadataFile, metadata);\n\n // Save .js files\n const jsFiles = [\n 'tokens',\n 'variables',\n 'semanticVariables',\n 'semanticDarkVariables',\n 'safelist',\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 writeModuleExportsFile(filePath, data[key]);\n }\n }\n \n // Also check for safelist specifically since it might be an array\n if (data.safelist && Array.isArray(data.safelist)) {\n const safelistPath = path.join(this.cacheDir, 'safelist.js');\n writeModuleExportsFile(safelistPath, data.safelist);\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 writeJsonFile(filePath, value);\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 removeDirectory(this.cacheDir);\n }\n }\n}\n\nmodule.exports = CacheManager;", "const CacheManager = require('./lib/core/cache-manager');\n\nfunction frontfriend(nextConfig = {}) {\n // Load cache once at config time\n const cacheManager = new CacheManager(process.cwd());\n let cache = null;\n\n if (cacheManager.exists()) {\n cache = cacheManager.load();\n } else {\n console.warn('[FrontFriend Next.js] No cache found. Please run \"npx frontfriend init\" first.');\n }\n\n return {\n ...nextConfig,\n // Environment variables work with both webpack and Turbopack\n env: {\n ...nextConfig.env,\n // Inject config as environment variables for Turbopack compatibility\n // Using NEXT_PUBLIC_ prefix as Next.js doesn't allow __ prefixed keys\n NEXT_PUBLIC_FF_CONFIG: cache ? JSON.stringify(cache.componentsConfig || null) : 'null',\n NEXT_PUBLIC_FF_ICONS: cache ? JSON.stringify(cache.icons || null) : 'null',\n },\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 if (!cache) {\n return config;\n }\n\n // 4. Use webpack.DefinePlugin from options (works with both webpack 4 and 5)\n // This is for webpack - Turbopack will use the env vars above\n const { webpack } = options;\n const DefinePlugin = webpack.DefinePlugin;\n\n // 5. Inject __FF_CONFIG__ and __FF_ICONS__ as globals for webpack\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,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CAKA,IAAMC,EAAkB,8BAClBC,EAAiB,iDAGjBC,EAAiB,qBAKjBC,EAAc,CAClB,GAAI,CACF,YACA,eACA,uBACA,2BACA,cACA,WACF,EACA,KAAM,CACJ,aACA,aACA,yBACA,eACA,eACF,CACF,EAGMC,EAAW,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EGACY_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_file_utils", "__commonJSMin", "exports", "module", "fs", "readJsonFileSafe", "filepath", "content", "error", "readFileSafe", "writeJsonFile", "data", "indent", "writeModuleExportsFile", "fileExists", "ensureDirectoryExists", "dirpath", "removeDirectory", "require_cache_manager", "__commonJSMin", "exports", "module", "path", "CACHE_DIR_NAME", "CACHE_TTL_MS", "CACHE_FILES", "CacheError", "readJsonFileSafe", "readFileSafe", "writeJsonFile", "writeModuleExportsFile", "fileExists", "ensureDirectoryExists", "removeDirectory", "CacheManager", "appRoot", "metadata", "timestamp", "data", "file", "filePath", "key", "content", "moduleExports", "fakeModule", "error", "_a", "_b", "jsFiles", "safelistPath", "jsonData", "value", "CacheManager", "frontfriend", "nextConfig", "cacheManager", "cache", "config", "options", "webpack", "DefinePlugin", "definitions"]
|
|
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 'safelist.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 FF_USE_LOCAL: 'FF_USE_LOCAL'\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');\n\n/**\n * Read a JSON file safely, returning null if file doesn't exist\n * @param {string} filepath - Path to the JSON file\n * @returns {Object|null} Parsed JSON or null if file not found\n * @throws {Error} If JSON is invalid\n */\nfunction readJsonFileSafe(filepath) {\n try {\n const content = fs.readFileSync(filepath, 'utf8');\n return JSON.parse(content);\n } catch (error) {\n if (error.code === 'ENOENT') {\n return null; // File not found, return null like API would return 404\n }\n throw error;\n }\n}\n\n/**\n * Read a file safely, returning null if file doesn't exist\n * Strips UTF-8 BOM if present (fixes Windows compatibility)\n * @param {string} filepath - Path to the file\n * @returns {string|null} File content or null if file not found\n * @throws {Error} For other file system errors\n */\nfunction readFileSafe(filepath) {\n try {\n const content = fs.readFileSync(filepath, 'utf8');\n // Strip UTF-8 BOM if present (Windows compatibility)\n return content.replace(/^\\uFEFF/, '');\n } catch (error) {\n if (error.code === 'ENOENT') {\n return null; // File not found\n }\n throw error;\n }\n}\n\n/**\n * Write JSON data to a file with proper formatting\n * @param {string} filepath - Path to write the file\n * @param {Object} data - Data to write\n * @param {number} indent - Indentation level (default: 2)\n */\nfunction writeJsonFile(filepath, data, indent = 2) {\n const content = JSON.stringify(data, null, indent);\n fs.writeFileSync(filepath, content, 'utf8');\n}\n\n/**\n * Write module.exports file with JSON data\n * @param {string} filepath - Path to write the file\n * @param {Object} data - Data to export\n */\nfunction writeModuleExportsFile(filepath, data) {\n // Handle empty data cases\n if (data === null || data === undefined || \n (typeof data === 'object' && Object.keys(data).length === 0) ||\n (Array.isArray(data) && data.length === 0)) {\n const emptyContent = Array.isArray(data) ? '[]' : '{}';\n const content = `module.exports = ${emptyContent};`;\n fs.writeFileSync(filepath, content, 'utf8');\n } else {\n const content = `module.exports = ${JSON.stringify(data, null, 2)};`;\n fs.writeFileSync(filepath, content, 'utf8');\n }\n}\n\n/**\n * Check if a file exists\n * @param {string} filepath - Path to check\n * @returns {boolean} True if file exists\n */\nfunction fileExists(filepath) {\n return fs.existsSync(filepath);\n}\n\n/**\n * Create directory recursively\n * @param {string} dirpath - Directory path to create\n */\nfunction ensureDirectoryExists(dirpath) {\n fs.mkdirSync(dirpath, { recursive: true });\n}\n\n/**\n * Remove directory recursively\n * @param {string} dirpath - Directory path to remove\n */\nfunction removeDirectory(dirpath) {\n fs.rmSync(dirpath, { recursive: true, force: true });\n}\n\nmodule.exports = {\n readJsonFileSafe,\n readFileSafe,\n writeJsonFile,\n writeModuleExportsFile,\n fileExists,\n ensureDirectoryExists,\n removeDirectory\n};", "const path = require('path');\nconst { CACHE_DIR_NAME, CACHE_TTL_MS, CACHE_FILES } = require('./constants');\nconst { CacheError } = require('./errors');\nconst { readJsonFileSafe, readFileSafe, writeJsonFile, writeModuleExportsFile, fileExists, ensureDirectoryExists, removeDirectory } = require('./file-utils');\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 fileExists(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 const metadata = readJsonFileSafe(this.metadataFile);\n if (!metadata) {\n return false;\n }\n\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 (fileExists(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 = readFileSafe(filePath);\n if (content !== null) {\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 }\n } catch (e) {\n // Log parsing errors to help debug Windows/encoding issues\n console.warn(`[Frontfriend] Failed to load ${file}: ${e.message}`);\n if (e.message.includes('Unexpected token') || e.message.includes('Invalid character')) {\n console.warn('[Frontfriend] This might be a BOM or encoding issue. Try deleting node_modules/.cache/frontfriend and running `npx frontfriend init` again.');\n }\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 const key = file.replace('.json', '');\n const content = readJsonFileSafe(filePath);\n if (content !== null) {\n data[key] = 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 // Backward compatibility: rename cls to safelist if present\n if (data.cls && !data.safelist) {\n data.safelist = data.cls;\n delete data.cls;\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 ensureDirectoryExists(this.cacheDir);\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 writeJsonFile(this.metadataFile, metadata);\n\n // Save .js files\n const jsFiles = [\n 'tokens',\n 'variables',\n 'semanticVariables',\n 'semanticDarkVariables',\n 'safelist',\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 writeModuleExportsFile(filePath, data[key]);\n }\n }\n \n // Also check for safelist specifically since it might be an array\n if (data.safelist && Array.isArray(data.safelist)) {\n const safelistPath = path.join(this.cacheDir, 'safelist.js');\n writeModuleExportsFile(safelistPath, data.safelist);\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 writeJsonFile(filePath, value);\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 removeDirectory(this.cacheDir);\n }\n }\n}\n\nmodule.exports = CacheManager;", "const CacheManager = require('./lib/core/cache-manager');\n\nfunction frontfriend(nextConfig = {}) {\n // Load cache once at config time\n const cacheManager = new CacheManager(process.cwd());\n let cache = null;\n\n if (cacheManager.exists()) {\n cache = cacheManager.load();\n } else {\n console.warn('[FrontFriend Next.js] No cache found. Please run \"npx frontfriend init\" first.');\n }\n\n return {\n ...nextConfig,\n // Environment variables work with both webpack and Turbopack\n env: {\n ...nextConfig.env,\n // Inject config as environment variables for Turbopack compatibility\n // Using NEXT_PUBLIC_ prefix as Next.js doesn't allow __ prefixed keys\n NEXT_PUBLIC_FF_CONFIG: cache ? JSON.stringify(cache.componentsConfig || null) : 'null',\n NEXT_PUBLIC_FF_ICONS: cache ? JSON.stringify(cache.icons || null) : 'null',\n },\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 if (!cache) {\n return config;\n }\n\n // 4. Use webpack.DefinePlugin from options (works with both webpack 4 and 5)\n // This is for webpack - Turbopack will use the env vars above\n const { webpack } = options;\n const DefinePlugin = webpack.DefinePlugin;\n\n // 5. Inject __FF_CONFIG__ and __FF_ICONS__ as globals for webpack\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,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CAKA,IAAMC,EAAkB,8BAClBC,EAAiB,iDAGjBC,EAAiB,qBAKjBC,EAAc,CAClB,GAAI,CACF,YACA,eACA,uBACA,2BACA,cACA,WACF,EACA,KAAM,CACJ,aACA,aACA,yBACA,eACA,eACF,CACF,EAGMC,EAAW,CACf,MAAO,QACP,WAAY,aACZ,aAAc,cAChB,EAEAL,EAAO,QAAU,CACf,gBAAAC,EACA,eAAAC,EACA,eAAAC,EACA,iBACA,oBACA,YAAAC,EACA,SAAAC,CACF,IC/CA,IAAAC,EAAAC,EAAA,CAAAC,EAAAC,IAAA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EGACY_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_file_utils", "__commonJSMin", "exports", "module", "fs", "readJsonFileSafe", "filepath", "content", "error", "readFileSafe", "writeJsonFile", "data", "indent", "writeModuleExportsFile", "fileExists", "ensureDirectoryExists", "dirpath", "removeDirectory", "require_cache_manager", "__commonJSMin", "exports", "module", "path", "CACHE_DIR_NAME", "CACHE_TTL_MS", "CACHE_FILES", "CacheError", "readJsonFileSafe", "readFileSafe", "writeJsonFile", "writeModuleExportsFile", "fileExists", "ensureDirectoryExists", "removeDirectory", "CacheManager", "appRoot", "metadata", "timestamp", "data", "file", "filePath", "key", "content", "moduleExports", "fakeModule", "e", "error", "_a", "_b", "jsFiles", "safelistPath", "jsonData", "value", "CacheManager", "frontfriend", "nextConfig", "cacheManager", "cache", "config", "options", "webpack", "DefinePlugin", "definitions"]
|
|
7
7
|
}
|
package/dist/runtime.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){"use strict";let i=function(){return typeof window<"u"&&window.__FF_CONFIG__?window.__FF_CONFIG__:typeof global<"u"&&global.__FF_CONFIG__?global.__FF_CONFIG__:null},
|
|
1
|
+
(function(){"use strict";function c(){let r=new Map,t={get:function(g,i){return i===Symbol.toPrimitive||i==="valueOf"?function(){return""}:i==="toString"||i===Symbol.toStringTag?function(){return""}:i==="constructor"?Object:(r.has(i)||r.set(i,c()),r.get(i))},has:function(g,i){return!(typeof i=="symbol"&&i.toString().includes("nodejs.util.inspect"))},ownKeys:function(g){return[]},getOwnPropertyDescriptor:function(g,i){return{enumerable:!0,configurable:!0}}};return new Proxy({},t)}let n=null,e=null,u=function(){return typeof window<"u"&&window.__FF_CONFIG__?window.__FF_CONFIG__:typeof global<"u"&&global.__FF_CONFIG__?global.__FF_CONFIG__:null},o=function(){return typeof window<"u"&&window.__FF_ICONS__?window.__FF_ICONS__:typeof global<"u"&&global.__FF_ICONS__?global.__FF_ICONS__:null},f=new Map,_=new Proxy({},{get:function(r,t){return t===Symbol.toPrimitive||t==="valueOf"?function(){return""}:t==="toString"||t===Symbol.toStringTag?function(){return"[object Object]"}:t==="constructor"?Object:(n||(n=u()),n&&t in n?n[t]:(f.has(t)||f.set(t,c()),f.get(t)))},has:function(r,t){return n||(n=u()),n?t in n:!0},ownKeys:function(r){return n||(n=u()),n?Object.keys(n):[]},getOwnPropertyDescriptor:function(r,t){return n||(n=u()),n&&t in n?Object.getOwnPropertyDescriptor(n,t):{enumerable:!0,configurable:!0}}}),a=new Proxy({},{get:function(r,t){return t===Symbol.toPrimitive||t==="valueOf"?function(){return""}:t==="toString"||t===Symbol.toStringTag?function(){return"[object Object]"}:t==="constructor"?Object:(e||(e=o()),e&&t in e?e[t]:null)},has:function(r,t){return e||(e=o()),e?t in e:!1},ownKeys:function(r){return e||(e=o()),e?Object.keys(e):[]},getOwnPropertyDescriptor:function(r,t){if(e||(e=o()),e&&t in e)return Object.getOwnPropertyDescriptor(e,t)}});function s(r){return!r||typeof r!="object"?c():r}let l={config:_,iconSet:a,ffdc:s,getIcon:function(r){return a[r]},refresh:function(){n=null,e=null,f.clear()}};typeof define=="function"&&define.amd?define([],function(){return l}):typeof module<"u"&&typeof module.exports<"u"&&(module.exports=l),typeof window<"u"&&(window.FrontFriend=l)})();
|
|
2
2
|
//# sourceMappingURL=runtime.js.map
|
package/dist/runtime.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../runtime.js"],
|
|
4
|
-
"sourcesContent": ["(function() {\n 'use strict';\n\n //
|
|
5
|
-
"mappings": "CAAC,UAAW,CACV,
|
|
6
|
-
"names": ["getConfig", "getIcons", "
|
|
4
|
+
"sourcesContent": ["(function() {\n 'use strict';\n\n /**\n * Creates a deep proxy that handles arbitrary nested property access\n * without throwing errors. Essential for SSR and build-time scenarios.\n */\n function createDeepProxy() {\n const cache = new Map();\n\n const handler = {\n get: function(target, prop) {\n // Handle special cases for type coercion\n if (prop === Symbol.toPrimitive || prop === 'valueOf') {\n return function() { return ''; };\n }\n if (prop === 'toString' || prop === Symbol.toStringTag) {\n return function() { return ''; };\n }\n if (prop === 'constructor') {\n return Object;\n }\n\n // Return cached proxy for referential equality\n if (!cache.has(prop)) {\n cache.set(prop, createDeepProxy());\n }\n return cache.get(prop);\n },\n\n has: function(target, prop) {\n // Return true for all properties except internal symbols\n if (typeof prop === 'symbol' && prop.toString().includes('nodejs.util.inspect')) {\n return false;\n }\n return true;\n },\n\n ownKeys: function(target) {\n return [];\n },\n\n getOwnPropertyDescriptor: function(target, prop) {\n return {\n enumerable: true,\n configurable: true,\n };\n },\n };\n\n return new Proxy({}, handler);\n }\n\n // Configuration loader\n let _config = null;\n let _iconSet = null;\n\n const getConfig = function() {\n // Check if running in browser\n if (typeof window !== 'undefined' && window.__FF_CONFIG__) {\n return window.__FF_CONFIG__;\n }\n // Check if in Node.js environment (for SSR)\n if (typeof global !== 'undefined' && global.__FF_CONFIG__) {\n return global.__FF_CONFIG__;\n }\n return null;\n };\n\n const getIcons = function() {\n // Check if running in browser\n if (typeof window !== 'undefined' && window.__FF_ICONS__) {\n return window.__FF_ICONS__;\n }\n // Check if in Node.js environment (for SSR)\n if (typeof global !== 'undefined' && global.__FF_ICONS__) {\n return global.__FF_ICONS__;\n }\n return null;\n };\n\n // Config proxy with lazy loading and memoization\n const configProxyCache = new Map();\n const configProxy = new Proxy({}, {\n get: function(target, prop) {\n // Handle special cases\n if (prop === Symbol.toPrimitive || prop === 'valueOf') {\n return function() { return ''; };\n }\n if (prop === 'toString' || prop === Symbol.toStringTag) {\n return function() { return '[object Object]'; };\n }\n if (prop === 'constructor') {\n return Object;\n }\n\n // Lazy load config\n if (!_config) {\n _config = getConfig();\n }\n\n // Return actual value if exists\n if (_config && prop in _config) {\n return _config[prop];\n }\n\n // Return memoized deep proxy for missing properties\n if (!configProxyCache.has(prop)) {\n configProxyCache.set(prop, createDeepProxy());\n }\n return configProxyCache.get(prop);\n },\n\n has: function(target, prop) {\n if (!_config) {\n _config = getConfig();\n }\n return _config ? prop in _config : true;\n },\n\n ownKeys: function(target) {\n if (!_config) {\n _config = getConfig();\n }\n return _config ? Object.keys(_config) : [];\n },\n\n getOwnPropertyDescriptor: function(target, prop) {\n if (!_config) {\n _config = getConfig();\n }\n if (_config && prop in _config) {\n return Object.getOwnPropertyDescriptor(_config, prop);\n }\n return {\n enumerable: true,\n configurable: true,\n };\n },\n });\n\n // IconSet proxy with lazy loading\n const iconSetProxy = new Proxy({}, {\n get: function(target, prop) {\n // Handle special cases\n if (prop === Symbol.toPrimitive || prop === 'valueOf') {\n return function() { return ''; };\n }\n if (prop === 'toString' || prop === Symbol.toStringTag) {\n return function() { return '[object Object]'; };\n }\n if (prop === 'constructor') {\n return Object;\n }\n\n // Lazy load icons\n if (!_iconSet) {\n _iconSet = getIcons();\n }\n\n // Return actual icon if exists\n if (_iconSet && prop in _iconSet) {\n return _iconSet[prop];\n }\n\n return null;\n },\n\n has: function(target, prop) {\n if (!_iconSet) {\n _iconSet = getIcons();\n }\n return _iconSet ? prop in _iconSet : false;\n },\n\n ownKeys: function(target) {\n if (!_iconSet) {\n _iconSet = getIcons();\n }\n return _iconSet ? Object.keys(_iconSet) : [];\n },\n\n getOwnPropertyDescriptor: function(target, prop) {\n if (!_iconSet) {\n _iconSet = getIcons();\n }\n if (_iconSet && prop in _iconSet) {\n return Object.getOwnPropertyDescriptor(_iconSet, prop);\n }\n return undefined;\n },\n });\n\n /**\n * FrontFriend Design Config (ffdc) - Safe config wrapper\n * Returns actual config if valid, or a deep proxy fallback for SSR safety\n */\n function ffdc(config) {\n if (!config || typeof config !== 'object') {\n return createDeepProxy();\n }\n return config;\n }\n\n // Public API\n const FrontFriend = {\n config: configProxy,\n iconSet: iconSetProxy,\n ffdc: ffdc,\n\n // Helper method to get a specific icon\n getIcon: function(name) {\n return iconSetProxy[name];\n },\n\n // Helper method to refresh config (useful for dynamic updates)\n refresh: function() {\n _config = null;\n _iconSet = null;\n configProxyCache.clear();\n }\n };\n\n // Detect environment and export accordingly\n \n // AMD (RequireJS) - check first since it might also have module defined\n if (typeof define === 'function' && define.amd) {\n define([], function() {\n return FrontFriend;\n });\n }\n // CommonJS (Node.js)\n else if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {\n module.exports = FrontFriend;\n }\n \n // Always attach to window in browser environment (even with module loaders)\n if (typeof window !== 'undefined') {\n window.FrontFriend = FrontFriend;\n }\n\n})();"],
|
|
5
|
+
"mappings": "CAAC,UAAW,CACV,aAMA,SAASA,GAAkB,CACzB,IAAMC,EAAQ,IAAI,IAEZC,EAAU,CACd,IAAK,SAASC,EAAQC,EAAM,CAE1B,OAAIA,IAAS,OAAO,aAAeA,IAAS,UACnC,UAAW,CAAE,MAAO,EAAI,EAE7BA,IAAS,YAAcA,IAAS,OAAO,YAClC,UAAW,CAAE,MAAO,EAAI,EAE7BA,IAAS,cACJ,QAIJH,EAAM,IAAIG,CAAI,GACjBH,EAAM,IAAIG,EAAMJ,EAAgB,CAAC,EAE5BC,EAAM,IAAIG,CAAI,EACvB,EAEA,IAAK,SAASD,EAAQC,EAAM,CAE1B,MAAI,SAAOA,GAAS,UAAYA,EAAK,SAAS,EAAE,SAAS,qBAAqB,EAIhF,EAEA,QAAS,SAASD,EAAQ,CACxB,MAAO,CAAC,CACV,EAEA,yBAA0B,SAASA,EAAQC,EAAM,CAC/C,MAAO,CACL,WAAY,GACZ,aAAc,EAChB,CACF,CACF,EAEA,OAAO,IAAI,MAAM,CAAC,EAAGF,CAAO,CAC9B,CAGA,IAAIG,EAAU,KACVC,EAAW,KAETC,EAAY,UAAW,CAE3B,OAAI,OAAO,OAAW,KAAe,OAAO,cACnC,OAAO,cAGZ,OAAO,OAAW,KAAe,OAAO,cACnC,OAAO,cAET,IACT,EAEMC,EAAW,UAAW,CAE1B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M,CAC1B,OAAKE,IACHA,EAAWE,EAAS,GAEfF,EAAWF,KAAQE,EAAW,EACvC,EAEA,QAAS,SAASH,EAAQ,CACxB,OAAKG,IACHA,EAAWE,EAAS,GAEfF,EAAW,OAAO,KAAKA,CAAQ,EAAI,CAAC,CAC7C,EAEA,yBAA0B,SAASH,EAAQC,EAAM,CAI/C,GAHKE,IACHA,EAAWE,EAAS,GAElBF,GAAYF,KAAQE,EACtB,OAAO,OAAO,yBAAyBA,EAAUF,CAAI,CAGzD,CACF,CAAC,EAMD,SAASQ,EAAKC,EAAQ,CACpB,MAAI,CAACA,GAAU,OAAOA,GAAW,SACxBb,EAAgB,EAElBa,CACT,CAGA,IAAMC,EAAc,CAClB,OAAQJ,EACR,QAASC,EACT,KAAMC,EAGN,QAAS,SAASG,EAAM,CACtB,OAAOJ,EAAaI,CAAI,CAC1B,EAGA,QAAS,UAAW,CAClBV,EAAU,KACVC,EAAW,KACXG,EAAiB,MAAM,CACzB,CACF,EAKI,OAAO,QAAW,YAAc,OAAO,IACzC,OAAO,CAAC,EAAG,UAAW,CACpB,OAAOK,CACT,CAAC,EAGM,OAAO,OAAW,KAAe,OAAO,OAAO,QAAY,MAClE,OAAO,QAAUA,GAIf,OAAO,OAAW,MACpB,OAAO,YAAcA,EAGzB,GAAG",
|
|
6
|
+
"names": ["createDeepProxy", "cache", "handler", "target", "prop", "_config", "_iconSet", "getConfig", "getIcons", "configProxyCache", "configProxy", "iconSetProxy", "ffdc", "config", "FrontFriend", "name"]
|
|
7
7
|
}
|
package/dist/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var u=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var C=u((Q,p)=>{var v="https://app.frontfriend.dev",b="https://tokens-studio-donux.up.railway.app/api",L=".cache/frontfriend",k={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"]},J={FF_ID:"FF_ID",FF_API_URL:"FF_API_URL",FF_USE_LOCAL:"FF_USE_LOCAL"};p.exports={DEFAULT_API_URL:v,LEGACY_API_URL:b,CACHE_DIR_NAME:L,CACHE_TTL_DAYS:7,CACHE_TTL_MS:6048e5,CACHE_FILES:k,ENV_VARS:J}});var
|
|
1
|
+
var u=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var C=u((Q,p)=>{var v="https://app.frontfriend.dev",b="https://tokens-studio-donux.up.railway.app/api",L=".cache/frontfriend",k={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"]},J={FF_ID:"FF_ID",FF_API_URL:"FF_API_URL",FF_USE_LOCAL:"FF_USE_LOCAL"};p.exports={DEFAULT_API_URL:v,LEGACY_API_URL:b,CACHE_DIR_NAME:L,CACHE_TTL_DAYS:7,CACHE_TTL_MS:6048e5,CACHE_FILES:k,ENV_VARS:J}});var S=u((W,g)=>{var h=class extends Error{constructor(e,t,s){super(e),this.name="APIError",this.statusCode=t,this.url=s,this.code=`API_${t}`}},_=class extends Error{constructor(e,t){super(e),this.name="CacheError",this.operation=t,this.code=`CACHE_${t.toUpperCase()}`}},F=class extends Error{constructor(e,t){super(e),this.name="ConfigError",this.field=t,this.code=`CONFIG_${t.toUpperCase()}`}},d=class extends Error{constructor(e,t){super(e),this.name="ProcessingError",this.token=t,this.code="PROCESSING_ERROR"}};g.exports={APIError:h,CacheError:_,ConfigError:F,ProcessingError:d}});var E=u((X,y)=>{var c=require("fs");function P(n){try{let e=c.readFileSync(n,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}function $(n){try{return c.readFileSync(n,"utf8").replace(/^\uFEFF/,"")}catch(e){if(e.code==="ENOENT")return null;throw e}}function R(n,e,t=2){let s=JSON.stringify(e,null,t);c.writeFileSync(n,s,"utf8")}function H(n,e){if(e==null||typeof e=="object"&&Object.keys(e).length===0||Array.isArray(e)&&e.length===0){let s=`module.exports = ${Array.isArray(e)?"[]":"{}"};`;c.writeFileSync(n,s,"utf8")}else{let t=`module.exports = ${JSON.stringify(e,null,2)};`;c.writeFileSync(n,t,"utf8")}}function V(n){return c.existsSync(n)}function M(n){c.mkdirSync(n,{recursive:!0})}function U(n){c.rmSync(n,{recursive:!0,force:!0})}y.exports={readJsonFileSafe:P,readFileSafe:$,writeJsonFile:R,writeModuleExportsFile:H,fileExists:V,ensureDirectoryExists:M,removeDirectory:U}});var T=u((Z,O)=>{var l=require("path"),{CACHE_DIR_NAME:G,CACHE_TTL_MS:q,CACHE_FILES:A}=C(),{CacheError:x}=S(),{readJsonFileSafe:j,readFileSafe:Y,writeJsonFile:D,writeModuleExportsFile:w,fileExists:I,ensureDirectoryExists:B,removeDirectory:z}=E(),m=class{constructor(e=process.cwd()){this.appRoot=e,this.cacheDir=l.join(e,"node_modules",G),this.metadataFile=l.join(this.cacheDir,"metadata.json"),this.maxAge=q}getCacheDir(){return this.cacheDir}exists(){return I(this.cacheDir)}isValid(){if(!this.exists())return!1;try{let e=j(this.metadataFile);if(!e)return!1;let 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 A.JS){let s=l.join(this.cacheDir,t);if(I(s)){let i=t.replace(".js","");try{let o=Y(s);if(o!==null){let a={},r={exports:a};new Function("module","exports",o)(r,a),e[i]=r.exports}}catch(o){console.warn(`[Frontfriend] Failed to load ${t}: ${o.message}`),(o.message.includes("Unexpected token")||o.message.includes("Invalid character"))&&console.warn("[Frontfriend] This might be a BOM or encoding issue. Try deleting node_modules/.cache/frontfriend and running `npx frontfriend init` again.")}}}for(let t of A.JSON){let s=l.join(this.cacheDir,t),i=t.replace(".json",""),o=j(s);o!==null&&(e[i]=o)}return e["components-config"]&&(e.componentsConfig=e["components-config"],delete e["components-config"]),e.cls&&!e.safelist&&(e.safelist=e.cls,delete e.cls),e}catch(e){throw new x(`Failed to load cache: ${e.message}`,"read")}}save(e){var t,s;try{B(this.cacheDir);let i={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};D(this.metadataFile,i);let o=["tokens","variables","semanticVariables","semanticDarkVariables","safelist","custom"];for(let r of o)if(e[r]!==void 0){let f=l.join(this.cacheDir,`${r}.js`);w(f,e[r])}if(e.safelist&&Array.isArray(e.safelist)){let r=l.join(this.cacheDir,"safelist.js");w(r,e.safelist)}let a={fonts:e.fonts,icons:e.icons||e.iconSet,"components-config":e.componentsConfig,version:e.version};for(let[r,f]of Object.entries(a))if(f!==void 0){let N=l.join(this.cacheDir,`${r}.json`);D(N,f)}}catch(i){throw new x(`Failed to save cache: ${i.message}`,"write")}}clear(){this.exists()&&z(this.cacheDir)}};O.exports=m});module.exports=function(){let e;return{name:"frontfriend-tailwind",configResolved(t){e=t},load(t){if(t==="virtual:frontfriend-config")try{let s=T(),i=new s((e==null?void 0:e.root)||process.cwd());if(!i.exists())return console.warn('[FrontFriend Vite] No cache found. Please run "npx frontfriend init" first.'),`
|
|
2
2
|
globalThis.__FF_CONFIG__ = null;
|
|
3
3
|
globalThis.__FF_ICONS__ = null;
|
|
4
4
|
`;let o;try{o=i.load()}catch{return console.error("[FrontFriend Vite] Failed to load cache."),`
|
package/dist/vite.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/file-utils.js", "../lib/core/cache-manager.js", "../vite.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 'safelist.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 FF_USE_LOCAL: 'FF_USE_LOCAL'\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');\n\n/**\n * Read a JSON file safely, returning null if file doesn't exist\n * @param {string} filepath - Path to the JSON file\n * @returns {Object|null} Parsed JSON or null if file not found\n * @throws {Error} If JSON is invalid\n */\nfunction readJsonFileSafe(filepath) {\n try {\n const content = fs.readFileSync(filepath, 'utf8');\n return JSON.parse(content);\n } catch (error) {\n if (error.code === 'ENOENT') {\n return null; // File not found, return null like API would return 404\n }\n throw error;\n }\n}\n\n/**\n * Read a file safely, returning null if file doesn't exist\n * @param {string} filepath - Path to the file\n * @returns {string|null} File content or null if file not found\n * @throws {Error} For other file system errors\n */\nfunction readFileSafe(filepath) {\n try {\n return fs.readFileSync(filepath, 'utf8');\n } catch (error) {\n if (error.code === 'ENOENT') {\n return null; // File not found\n }\n throw error;\n }\n}\n\n/**\n * Write JSON data to a file with proper formatting\n * @param {string} filepath - Path to write the file\n * @param {Object} data - Data to write\n * @param {number} indent - Indentation level (default: 2)\n */\nfunction writeJsonFile(filepath, data, indent = 2) {\n const content = JSON.stringify(data, null, indent);\n fs.writeFileSync(filepath, content, 'utf8');\n}\n\n/**\n * Write module.exports file with JSON data\n * @param {string} filepath - Path to write the file\n * @param {Object} data - Data to export\n */\nfunction writeModuleExportsFile(filepath, data) {\n // Handle empty data cases\n if (data === null || data === undefined || \n (typeof data === 'object' && Object.keys(data).length === 0) ||\n (Array.isArray(data) && data.length === 0)) {\n const emptyContent = Array.isArray(data) ? '[]' : '{}';\n const content = `module.exports = ${emptyContent};`;\n fs.writeFileSync(filepath, content, 'utf8');\n } else {\n const content = `module.exports = ${JSON.stringify(data, null, 2)};`;\n fs.writeFileSync(filepath, content, 'utf8');\n }\n}\n\n/**\n * Check if a file exists\n * @param {string} filepath - Path to check\n * @returns {boolean} True if file exists\n */\nfunction fileExists(filepath) {\n return fs.existsSync(filepath);\n}\n\n/**\n * Create directory recursively\n * @param {string} dirpath - Directory path to create\n */\nfunction ensureDirectoryExists(dirpath) {\n fs.mkdirSync(dirpath, { recursive: true });\n}\n\n/**\n * Remove directory recursively\n * @param {string} dirpath - Directory path to remove\n */\nfunction removeDirectory(dirpath) {\n fs.rmSync(dirpath, { recursive: true, force: true });\n}\n\nmodule.exports = {\n readJsonFileSafe,\n readFileSafe,\n writeJsonFile,\n writeModuleExportsFile,\n fileExists,\n ensureDirectoryExists,\n removeDirectory\n};", "const path = require('path');\nconst { CACHE_DIR_NAME, CACHE_TTL_MS, CACHE_FILES } = require('./constants');\nconst { CacheError } = require('./errors');\nconst { readJsonFileSafe, readFileSafe, writeJsonFile, writeModuleExportsFile, fileExists, ensureDirectoryExists, removeDirectory } = require('./file-utils');\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 fileExists(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 const metadata = readJsonFileSafe(this.metadataFile);\n if (!metadata) {\n return false;\n }\n\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 (fileExists(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 = readFileSafe(filePath);\n if (content !== null) {\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 }\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 const key = file.replace('.json', '');\n const content = readJsonFileSafe(filePath);\n if (content !== null) {\n data[key] = 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 // Backward compatibility: rename cls to safelist if present\n if (data.cls && !data.safelist) {\n data.safelist = data.cls;\n delete data.cls;\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 ensureDirectoryExists(this.cacheDir);\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 writeJsonFile(this.metadataFile, metadata);\n\n // Save .js files\n const jsFiles = [\n 'tokens',\n 'variables',\n 'semanticVariables',\n 'semanticDarkVariables',\n 'safelist',\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 writeModuleExportsFile(filePath, data[key]);\n }\n }\n \n // Also check for safelist specifically since it might be an array\n if (data.safelist && Array.isArray(data.safelist)) {\n const safelistPath = path.join(this.cacheDir, 'safelist.js');\n writeModuleExportsFile(safelistPath, data.safelist);\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 writeJsonFile(filePath, value);\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 removeDirectory(this.cacheDir);\n }\n }\n}\n\nmodule.exports = CacheManager;", "// CommonJS wrapper for vite.mjs to support Jest testing\nmodule.exports = function vitePlugin() {\n // Return a mock plugin for testing\n let config;\n \n return {\n name: 'frontfriend-tailwind',\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n },\n load(id) {\n if (id === 'virtual:frontfriend-config') {\n // Mock implementation for testing\n try {\n const CacheManager = require('./lib/core/cache-manager');\n const cacheManager = new CacheManager(config?.root || process.cwd());\n \n if (!cacheManager.exists()) {\n console.warn('[FrontFriend Vite] No cache found. Please run \"npx frontfriend init\" first.');\n return `\n globalThis.__FF_CONFIG__ = null;\n globalThis.__FF_ICONS__ = null;\n `;\n }\n \n let cache;\n try {\n cache = cacheManager.load();\n } catch (error) {\n console.error('[FrontFriend Vite] Failed to load cache.');\n return `\n globalThis.__FF_CONFIG__ = null;\n globalThis.__FF_ICONS__ = null;\n `;\n }\n \n if (!cache) {\n console.error('[FrontFriend Vite] Failed to load cache.');\n return `\n globalThis.__FF_CONFIG__ = null;\n globalThis.__FF_ICONS__ = null;\n `;\n }\n \n const componentsConfig = cache.componentsConfig || null;\n const icons = cache.icons || null;\n \n if (config?.command === 'serve') {\n console.log('[FrontFriend Vite] Injected configuration and icons into build');\n }\n \n return `\n globalThis.__FF_CONFIG__ = ${JSON.stringify(componentsConfig)};\n globalThis.__FF_ICONS__ = ${JSON.stringify(icons)};\n `;\n } catch (error) {\n // Handle any errors gracefully\n return `\n globalThis.__FF_CONFIG__ = null;\n globalThis.__FF_ICONS__ = null;\n `;\n }\n }\n \n return null;\n }\n };\n};"],
|
|
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,cACA,WACF,EACA,KAAM,CACJ,aACA,aACA,yBACA,eACA,eACF,CACF,EAGMC,EAAW,CACf,MAAO,QACP,WAAY,aACZ,aAAc,cAChB,EAEAL,EAAO,QAAU,CACf,gBAAAC,EACA,eAAAC,EACA,eAAAC,EACA,iBACA,oBACA,YAAAC,EACA,SAAAC,CACF,IC/CA,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,CAC9B,MAAMJ,CAAO,EACb,KAAK,KAAO,aACZ,KAAK,UAAYI,EACjB,KAAK,KAAO,SAASA,EAAU,YAAY,CAAC,EAC9C,CACF,EAEMC,EAAN,cAA0B,KAAM,CAC9B,YAAYL,EAASM,EAAO,CAC1B,MAAMN,CAAO,EACb,KAAK,KAAO,cACZ,KAAK,MAAQM,EACb,KAAK,KAAO,UAAUA,EAAM,YAAY,CAAC,EAC3C,CACF,EAEMC,EAAN,cAA8B,KAAM,CAClC,YAAYP,EAASQ,EAAO,CAC1B,MAAMR,CAAO,EACb,KAAK,KAAO,kBACZ,KAAK,MAAQQ,EACb,KAAK,KAAO,kBACd,CACF,EAEAV,EAAO,QAAU,CACf,SAAAC,EACA,WAAAI,EACA,YAAAE,EACA,gBAAAE,CACF,IC1CA,IAAAE,EAAAC,EAAA,CAAAC,EAAAC,IAAA,KAAMC,EAAK,QAAQ,IAAI,EAQvB,SAASC,EAAiBC,EAAU,CAClC,GAAI,CACF,IAAMC,EAAUH,EAAG,aAAaE,EAAU,MAAM,EAChD,OAAO,KAAK,MAAMC,CAAO,CAC3B,OAASC,EAAO,CACd,GAAIA,EAAM,OAAS,SACjB,OAAO,KAET,MAAMA,CACR,CACF,
|
|
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_file_utils", "__commonJSMin", "exports", "module", "fs", "readJsonFileSafe", "filepath", "content", "error", "readFileSafe", "writeJsonFile", "data", "indent", "writeModuleExportsFile", "fileExists", "ensureDirectoryExists", "dirpath", "removeDirectory", "require_cache_manager", "__commonJSMin", "exports", "module", "path", "CACHE_DIR_NAME", "CACHE_TTL_MS", "CACHE_FILES", "CacheError", "readJsonFileSafe", "readFileSafe", "writeJsonFile", "writeModuleExportsFile", "fileExists", "ensureDirectoryExists", "removeDirectory", "CacheManager", "appRoot", "metadata", "timestamp", "data", "file", "filePath", "key", "content", "moduleExports", "fakeModule", "error", "_a", "_b", "jsFiles", "safelistPath", "jsonData", "value", "config", "resolvedConfig", "id", "CacheManager", "cacheManager", "cache", "componentsConfig", "icons"]
|
|
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 'safelist.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 FF_USE_LOCAL: 'FF_USE_LOCAL'\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');\n\n/**\n * Read a JSON file safely, returning null if file doesn't exist\n * @param {string} filepath - Path to the JSON file\n * @returns {Object|null} Parsed JSON or null if file not found\n * @throws {Error} If JSON is invalid\n */\nfunction readJsonFileSafe(filepath) {\n try {\n const content = fs.readFileSync(filepath, 'utf8');\n return JSON.parse(content);\n } catch (error) {\n if (error.code === 'ENOENT') {\n return null; // File not found, return null like API would return 404\n }\n throw error;\n }\n}\n\n/**\n * Read a file safely, returning null if file doesn't exist\n * Strips UTF-8 BOM if present (fixes Windows compatibility)\n * @param {string} filepath - Path to the file\n * @returns {string|null} File content or null if file not found\n * @throws {Error} For other file system errors\n */\nfunction readFileSafe(filepath) {\n try {\n const content = fs.readFileSync(filepath, 'utf8');\n // Strip UTF-8 BOM if present (Windows compatibility)\n return content.replace(/^\\uFEFF/, '');\n } catch (error) {\n if (error.code === 'ENOENT') {\n return null; // File not found\n }\n throw error;\n }\n}\n\n/**\n * Write JSON data to a file with proper formatting\n * @param {string} filepath - Path to write the file\n * @param {Object} data - Data to write\n * @param {number} indent - Indentation level (default: 2)\n */\nfunction writeJsonFile(filepath, data, indent = 2) {\n const content = JSON.stringify(data, null, indent);\n fs.writeFileSync(filepath, content, 'utf8');\n}\n\n/**\n * Write module.exports file with JSON data\n * @param {string} filepath - Path to write the file\n * @param {Object} data - Data to export\n */\nfunction writeModuleExportsFile(filepath, data) {\n // Handle empty data cases\n if (data === null || data === undefined || \n (typeof data === 'object' && Object.keys(data).length === 0) ||\n (Array.isArray(data) && data.length === 0)) {\n const emptyContent = Array.isArray(data) ? '[]' : '{}';\n const content = `module.exports = ${emptyContent};`;\n fs.writeFileSync(filepath, content, 'utf8');\n } else {\n const content = `module.exports = ${JSON.stringify(data, null, 2)};`;\n fs.writeFileSync(filepath, content, 'utf8');\n }\n}\n\n/**\n * Check if a file exists\n * @param {string} filepath - Path to check\n * @returns {boolean} True if file exists\n */\nfunction fileExists(filepath) {\n return fs.existsSync(filepath);\n}\n\n/**\n * Create directory recursively\n * @param {string} dirpath - Directory path to create\n */\nfunction ensureDirectoryExists(dirpath) {\n fs.mkdirSync(dirpath, { recursive: true });\n}\n\n/**\n * Remove directory recursively\n * @param {string} dirpath - Directory path to remove\n */\nfunction removeDirectory(dirpath) {\n fs.rmSync(dirpath, { recursive: true, force: true });\n}\n\nmodule.exports = {\n readJsonFileSafe,\n readFileSafe,\n writeJsonFile,\n writeModuleExportsFile,\n fileExists,\n ensureDirectoryExists,\n removeDirectory\n};", "const path = require('path');\nconst { CACHE_DIR_NAME, CACHE_TTL_MS, CACHE_FILES } = require('./constants');\nconst { CacheError } = require('./errors');\nconst { readJsonFileSafe, readFileSafe, writeJsonFile, writeModuleExportsFile, fileExists, ensureDirectoryExists, removeDirectory } = require('./file-utils');\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 fileExists(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 const metadata = readJsonFileSafe(this.metadataFile);\n if (!metadata) {\n return false;\n }\n\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 (fileExists(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 = readFileSafe(filePath);\n if (content !== null) {\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 }\n } catch (e) {\n // Log parsing errors to help debug Windows/encoding issues\n console.warn(`[Frontfriend] Failed to load ${file}: ${e.message}`);\n if (e.message.includes('Unexpected token') || e.message.includes('Invalid character')) {\n console.warn('[Frontfriend] This might be a BOM or encoding issue. Try deleting node_modules/.cache/frontfriend and running `npx frontfriend init` again.');\n }\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 const key = file.replace('.json', '');\n const content = readJsonFileSafe(filePath);\n if (content !== null) {\n data[key] = 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 // Backward compatibility: rename cls to safelist if present\n if (data.cls && !data.safelist) {\n data.safelist = data.cls;\n delete data.cls;\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 ensureDirectoryExists(this.cacheDir);\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 writeJsonFile(this.metadataFile, metadata);\n\n // Save .js files\n const jsFiles = [\n 'tokens',\n 'variables',\n 'semanticVariables',\n 'semanticDarkVariables',\n 'safelist',\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 writeModuleExportsFile(filePath, data[key]);\n }\n }\n \n // Also check for safelist specifically since it might be an array\n if (data.safelist && Array.isArray(data.safelist)) {\n const safelistPath = path.join(this.cacheDir, 'safelist.js');\n writeModuleExportsFile(safelistPath, data.safelist);\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 writeJsonFile(filePath, value);\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 removeDirectory(this.cacheDir);\n }\n }\n}\n\nmodule.exports = CacheManager;", "// CommonJS wrapper for vite.mjs to support Jest testing\nmodule.exports = function vitePlugin() {\n // Return a mock plugin for testing\n let config;\n \n return {\n name: 'frontfriend-tailwind',\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n },\n load(id) {\n if (id === 'virtual:frontfriend-config') {\n // Mock implementation for testing\n try {\n const CacheManager = require('./lib/core/cache-manager');\n const cacheManager = new CacheManager(config?.root || process.cwd());\n \n if (!cacheManager.exists()) {\n console.warn('[FrontFriend Vite] No cache found. Please run \"npx frontfriend init\" first.');\n return `\n globalThis.__FF_CONFIG__ = null;\n globalThis.__FF_ICONS__ = null;\n `;\n }\n \n let cache;\n try {\n cache = cacheManager.load();\n } catch (error) {\n console.error('[FrontFriend Vite] Failed to load cache.');\n return `\n globalThis.__FF_CONFIG__ = null;\n globalThis.__FF_ICONS__ = null;\n `;\n }\n \n if (!cache) {\n console.error('[FrontFriend Vite] Failed to load cache.');\n return `\n globalThis.__FF_CONFIG__ = null;\n globalThis.__FF_ICONS__ = null;\n `;\n }\n \n const componentsConfig = cache.componentsConfig || null;\n const icons = cache.icons || null;\n \n if (config?.command === 'serve') {\n console.log('[FrontFriend Vite] Injected configuration and icons into build');\n }\n \n return `\n globalThis.__FF_CONFIG__ = ${JSON.stringify(componentsConfig)};\n globalThis.__FF_ICONS__ = ${JSON.stringify(icons)};\n `;\n } catch (error) {\n // Handle any errors gracefully\n return `\n globalThis.__FF_CONFIG__ = null;\n globalThis.__FF_ICONS__ = null;\n `;\n }\n }\n \n return null;\n }\n };\n};"],
|
|
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,cACA,WACF,EACA,KAAM,CACJ,aACA,aACA,yBACA,eACA,eACF,CACF,EAGMC,EAAW,CACf,MAAO,QACP,WAAY,aACZ,aAAc,cAChB,EAEAL,EAAO,QAAU,CACf,gBAAAC,EACA,eAAAC,EACA,eAAAC,EACA,iBACA,oBACA,YAAAC,EACA,SAAAC,CACF,IC/CA,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,EAA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AgB,KAAK,QAAQ,CAEjC,CACF,EAEAZ,EAAO,QAAUa,IChMjB,OAAO,QAAU,UAAsB,CAErC,IAAImB,EAEJ,MAAO,CACL,KAAM,uBACN,eAAeC,EAAgB,CAC7BD,EAASC,CACX,EACA,KAAKC,EAAI,CACP,GAAIA,IAAO,6BAET,GAAI,CACF,IAAMC,EAAe,IACfC,EAAe,IAAID,GAAaH,GAAA,YAAAA,EAAQ,OAAQ,QAAQ,IAAI,CAAC,EAEnE,GAAI,CAACI,EAAa,OAAO,EACvB,eAAQ,KAAK,6EAA6E,EACnF;AAAA;AAAA;AAAA,cAMT,IAAIC,EACJ,GAAI,CACFA,EAAQD,EAAa,KAAK,CAC5B,MAAgB,CACd,eAAQ,MAAM,0CAA0C,EACjD;AAAA;AAAA;AAAA,aAIT,CAEA,GAAI,CAACC,EACH,eAAQ,MAAM,0CAA0C,EACjD;AAAA;AAAA;AAAA,cAMT,IAAMC,EAAmBD,EAAM,kBAAoB,KAC7CE,EAAQF,EAAM,OAAS,KAE7B,OAAIL,GAAA,YAAAA,EAAQ,WAAY,SACtB,QAAQ,IAAI,gEAAgE,EAGvE;AAAA,yCACwB,KAAK,UAAUM,CAAgB,CAAC;AAAA,wCACjC,KAAK,UAAUC,CAAK,CAAC;AAAA,WAErD,MAAgB,CAEd,MAAO;AAAA;AAAA;AAAA,WAIT,CAGF,OAAO,IACT,CACF,CACF",
|
|
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_file_utils", "__commonJSMin", "exports", "module", "fs", "readJsonFileSafe", "filepath", "content", "error", "readFileSafe", "writeJsonFile", "data", "indent", "writeModuleExportsFile", "fileExists", "ensureDirectoryExists", "dirpath", "removeDirectory", "require_cache_manager", "__commonJSMin", "exports", "module", "path", "CACHE_DIR_NAME", "CACHE_TTL_MS", "CACHE_FILES", "CacheError", "readJsonFileSafe", "readFileSafe", "writeJsonFile", "writeModuleExportsFile", "fileExists", "ensureDirectoryExists", "removeDirectory", "CacheManager", "appRoot", "metadata", "timestamp", "data", "file", "filePath", "key", "content", "moduleExports", "fakeModule", "e", "error", "_a", "_b", "jsFiles", "safelistPath", "jsonData", "value", "config", "resolvedConfig", "id", "CacheManager", "cacheManager", "cache", "componentsConfig", "icons"]
|
|
7
7
|
}
|