@frontfriend/tailwind 2.6.0 → 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/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/vite.js +1 -1
- package/dist/vite.js.map +3 -3
- package/package.json +7 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../lib/core/file-utils.js", "../../../lib/core/path-utils.js", "../../../lib/core/local-token-reader.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 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 { 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};", "const path = require('path');\nconst { findDirectoryUpward } = require('./path-utils');\nconst { readJsonFileSafe, readFileSafe, fileExists } = require('./file-utils');\n\n/**\n * LocalTokenReader - Reads tokens directly from the local file system\n * Mimics the APIClient interface but reads from apps/tokens directory\n */\nclass LocalTokenReader {\n constructor(ffId, options = {}) {\n this.ffId = ffId;\n this.tokensBasePath = options.tokensBasePath || this.findTokensPath();\n this.folderMap = this.loadFolderMap();\n this.projectFolder = this.folderMap[ffId];\n \n if (!this.projectFolder) {\n throw new Error(`No folder mapping found for ff-id: ${ffId}`);\n }\n \n this.projectPath = path.join(this.tokensBasePath, this.projectFolder);\n }\n\n /**\n * Find the tokens directory by looking for apps/tokens in parent directories\n */\n findTokensPath() {\n // Try to find apps/tokens first\n let tokensPath = findDirectoryUpward('apps/tokens', process.cwd(), (dir) => {\n return fileExists(path.join(dir, 'folderMap.json'));\n });\n \n // If not found, try just 'tokens'\n if (!tokensPath) {\n tokensPath = findDirectoryUpward('tokens', process.cwd(), (dir) => {\n return fileExists(path.join(dir, 'folderMap.json'));\n });\n }\n \n if (!tokensPath) {\n throw new Error('Could not find tokens directory with folderMap.json');\n }\n \n return tokensPath;\n }\n\n /**\n * Load the folder mapping from folderMap.json\n */\n loadFolderMap() {\n const folderMapPath = path.join(this.tokensBasePath, 'folderMap.json');\n const folderMap = readJsonFileSafe(folderMapPath);\n \n if (!folderMap) {\n throw new Error(`Failed to load folderMap.json: File not found`);\n }\n \n return folderMap;\n }\n\n /**\n * Fetch all token files (global, colors, semantic)\n * Mimics the APIClient.fetchTokens() method\n */\n async fetchTokens() {\n const figmaPath = path.join(this.projectPath, 'figma');\n \n // Try different possible paths for tokens\n const tokenPaths = {\n global: [\n path.join(figmaPath, 'Global Tokens', 'Default.json'),\n path.join(figmaPath, 'global.json')\n ],\n colors: [\n path.join(figmaPath, 'Global Colors', 'Default.json'),\n path.join(figmaPath, 'Global Colors', 'Light.json')\n ],\n semantic: [\n path.join(figmaPath, 'Semantic', 'Light.json'),\n path.join(figmaPath, 'Semantic', 'Default.json')\n ],\n semanticDark: [\n path.join(figmaPath, 'Semantic', 'Dark.json')\n ]\n };\n\n const results = {};\n \n // Try each possible path for each token type\n for (const [key, paths] of Object.entries(tokenPaths)) {\n for (const tokenPath of paths) {\n const content = readJsonFileSafe(tokenPath);\n if (content !== null) {\n results[key] = content;\n break; // Found it, no need to try other paths\n }\n }\n // If not found in any path, set to null\n if (!results[key]) {\n results[key] = null;\n }\n }\n\n return results;\n }\n\n /**\n * Fetch pre-processed tokens (if available in cache folder)\n */\n async fetchProcessedTokens() {\n const cachePath = path.join(this.projectPath, 'cache');\n \n if (!fileExists(cachePath)) {\n return null;\n }\n\n // Read all the cache files that would be in processed tokens\n const cacheFiles = {\n 'tokens.js': 'hashedTokens.js',\n 'variables.js': 'hashedVariables.js', \n 'semanticVariables.js': 'hashedSemanticVariables.js',\n 'semanticDarkVariables.js': 'hashedSemanticDarkVariables.js',\n 'safelist.js': 'safelist.js',\n 'custom.js': 'custom.js',\n 'fonts.json': 'fonts.json',\n 'icons.json': 'icons.json',\n 'components-config.json': 'encoded-config.json',\n 'version.json': 'version.json'\n };\n\n const processedData = {};\n \n for (const [key, fileName] of Object.entries(cacheFiles)) {\n const filePath = path.join(cachePath, fileName);\n if (key.endsWith('.js')) {\n processedData[key] = readFileSafe(filePath);\n } else {\n processedData[key] = readJsonFileSafe(filePath);\n }\n }\n\n // Only return if we have at least some data\n const hasData = Object.values(processedData).some(val => val !== null);\n return hasData ? processedData : null;\n }\n\n /**\n * Fetch components configuration\n */\n async fetchComponentsConfig() {\n return readJsonFileSafe(path.join(this.projectPath, 'components-config.json'));\n }\n\n /**\n * Fetch fonts configuration\n */\n async fetchFonts() {\n return readJsonFileSafe(path.join(this.projectPath, 'font.json'));\n }\n\n /**\n * Fetch icons configuration\n */\n async fetchIcons() {\n return readJsonFileSafe(path.join(this.projectPath, 'icons.json'));\n }\n\n /**\n * Fetch version information\n */\n async fetchVersion() {\n return readJsonFileSafe(path.join(this.projectPath, 'version.json'));\n }\n\n /**\n * Fetch custom CSS\n */\n async fetchCustomCss() {\n return readFileSafe(path.join(this.projectPath, 'custom.css'));\n }\n\n /**\n * Fetch plan metadata\n */\n async fetchPlanMetadata() {\n const metadata = readJsonFileSafe(path.join(this.projectPath, 'metadata.json'));\n \n // Default to full plan if no metadata exists\n return metadata || {\n planType: 'full',\n allowedComponents: null\n };\n }\n\n // Compatibility methods to match APIClient interface\n fetchJson() {\n throw new Error('fetchJson is not implemented in LocalTokenReader. Use specific fetch methods.');\n }\n\n fetchRaw() {\n throw new Error('fetchRaw is not implemented in LocalTokenReader. Use specific fetch methods.');\n }\n}\n\nmodule.exports = { LocalTokenReader };"],
|
|
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};", "const path = require('path');\nconst { findDirectoryUpward } = require('./path-utils');\nconst { readJsonFileSafe, readFileSafe, fileExists } = require('./file-utils');\n\n/**\n * LocalTokenReader - Reads tokens directly from the local file system\n * Mimics the APIClient interface but reads from apps/tokens directory\n */\nclass LocalTokenReader {\n constructor(ffId, options = {}) {\n this.ffId = ffId;\n this.tokensBasePath = options.tokensBasePath || this.findTokensPath();\n this.folderMap = this.loadFolderMap();\n this.projectFolder = this.folderMap[ffId];\n \n if (!this.projectFolder) {\n throw new Error(`No folder mapping found for ff-id: ${ffId}`);\n }\n \n this.projectPath = path.join(this.tokensBasePath, this.projectFolder);\n }\n\n /**\n * Find the tokens directory by looking for apps/tokens in parent directories\n */\n findTokensPath() {\n // Try to find apps/tokens first\n let tokensPath = findDirectoryUpward('apps/tokens', process.cwd(), (dir) => {\n return fileExists(path.join(dir, 'folderMap.json'));\n });\n \n // If not found, try just 'tokens'\n if (!tokensPath) {\n tokensPath = findDirectoryUpward('tokens', process.cwd(), (dir) => {\n return fileExists(path.join(dir, 'folderMap.json'));\n });\n }\n \n if (!tokensPath) {\n throw new Error('Could not find tokens directory with folderMap.json');\n }\n \n return tokensPath;\n }\n\n /**\n * Load the folder mapping from folderMap.json\n */\n loadFolderMap() {\n const folderMapPath = path.join(this.tokensBasePath, 'folderMap.json');\n const folderMap = readJsonFileSafe(folderMapPath);\n \n if (!folderMap) {\n throw new Error(`Failed to load folderMap.json: File not found`);\n }\n \n return folderMap;\n }\n\n /**\n * Fetch all token files (global, colors, semantic)\n * Mimics the APIClient.fetchTokens() method\n */\n async fetchTokens() {\n const figmaPath = path.join(this.projectPath, 'figma');\n \n // Try different possible paths for tokens\n const tokenPaths = {\n global: [\n path.join(figmaPath, 'Global Tokens', 'Default.json'),\n path.join(figmaPath, 'global.json')\n ],\n colors: [\n path.join(figmaPath, 'Global Colors', 'Default.json'),\n path.join(figmaPath, 'Global Colors', 'Light.json')\n ],\n semantic: [\n path.join(figmaPath, 'Semantic', 'Light.json'),\n path.join(figmaPath, 'Semantic', 'Default.json')\n ],\n semanticDark: [\n path.join(figmaPath, 'Semantic', 'Dark.json')\n ]\n };\n\n const results = {};\n \n // Try each possible path for each token type\n for (const [key, paths] of Object.entries(tokenPaths)) {\n for (const tokenPath of paths) {\n const content = readJsonFileSafe(tokenPath);\n if (content !== null) {\n results[key] = content;\n break; // Found it, no need to try other paths\n }\n }\n // If not found in any path, set to null\n if (!results[key]) {\n results[key] = null;\n }\n }\n\n return results;\n }\n\n /**\n * Fetch pre-processed tokens (if available in cache folder)\n */\n async fetchProcessedTokens() {\n const cachePath = path.join(this.projectPath, 'cache');\n \n if (!fileExists(cachePath)) {\n return null;\n }\n\n // Read all the cache files that would be in processed tokens\n const cacheFiles = {\n 'tokens.js': 'hashedTokens.js',\n 'variables.js': 'hashedVariables.js', \n 'semanticVariables.js': 'hashedSemanticVariables.js',\n 'semanticDarkVariables.js': 'hashedSemanticDarkVariables.js',\n 'safelist.js': 'safelist.js',\n 'custom.js': 'custom.js',\n 'fonts.json': 'fonts.json',\n 'icons.json': 'icons.json',\n 'components-config.json': 'encoded-config.json',\n 'version.json': 'version.json'\n };\n\n const processedData = {};\n \n for (const [key, fileName] of Object.entries(cacheFiles)) {\n const filePath = path.join(cachePath, fileName);\n if (key.endsWith('.js')) {\n processedData[key] = readFileSafe(filePath);\n } else {\n processedData[key] = readJsonFileSafe(filePath);\n }\n }\n\n // Only return if we have at least some data\n const hasData = Object.values(processedData).some(val => val !== null);\n return hasData ? processedData : null;\n }\n\n /**\n * Fetch components configuration\n */\n async fetchComponentsConfig() {\n return readJsonFileSafe(path.join(this.projectPath, 'components-config.json'));\n }\n\n /**\n * Fetch fonts configuration\n */\n async fetchFonts() {\n return readJsonFileSafe(path.join(this.projectPath, 'font.json'));\n }\n\n /**\n * Fetch icons configuration\n */\n async fetchIcons() {\n return readJsonFileSafe(path.join(this.projectPath, 'icons.json'));\n }\n\n /**\n * Fetch version information\n */\n async fetchVersion() {\n return readJsonFileSafe(path.join(this.projectPath, 'version.json'));\n }\n\n /**\n * Fetch custom CSS\n */\n async fetchCustomCss() {\n return readFileSafe(path.join(this.projectPath, 'custom.css'));\n }\n\n /**\n * Fetch plan metadata\n */\n async fetchPlanMetadata() {\n const metadata = readJsonFileSafe(path.join(this.projectPath, 'metadata.json'));\n \n // Default to full plan if no metadata exists\n return metadata || {\n planType: 'full',\n allowedComponents: null\n };\n }\n\n // Compatibility methods to match APIClient interface\n fetchJson() {\n throw new Error('fetchJson is not implemented in LocalTokenReader. Use specific fetch methods.');\n }\n\n fetchRaw() {\n throw new Error('fetchRaw is not implemented in LocalTokenReader. Use specific fetch methods.');\n }\n}\n\nmodule.exports = { LocalTokenReader };"],
|
|
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,OAAO,KAET,MAAMA,CACR,CACF,CAQA,SAASE,EAAcJ,EAAUK,EAAMC,EAAS,EAAG,CACjD,IAAML,EAAU,KAAK,UAAUI,EAAM,KAAMC,CAAM,EACjDR,EAAG,cAAcE,EAAUC,EAAS,MAAM,CAC5C,CAOA,SAASM,EAAuBP,EAAUK,EAAM,CAE9C,GAAIA,GAAS,MACR,OAAOA,GAAS,UAAY,OAAO,KAAKA,CAAI,EAAE,SAAW,GACzD,MAAM,QAAQA,CAAI,GAAKA,EAAK,SAAW,EAAI,CAE9C,IAAMJ,EAAU,oBADK,MAAM,QAAQI,CAAI,EAAI,KAAO,IACF,IAChDP,EAAG,cAAcE,EAAUC,EAAS,MAAM,CAC5C,KAAO,CACL,IAAMA,EAAU,oBAAoB,KAAK,UA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O,QAAQF,CAAU,EAAG,CACxD,IAAMG,EAAWvB,EAAK,KAAKmB,EAAWG,CAAQ,EAC1CP,EAAI,SAAS,KAAK,EACpBM,EAAcN,CAAG,EAAIZ,EAAaoB,CAAQ,EAE1CF,EAAcN,CAAG,EAAIb,EAAiBqB,CAAQ,CAElD,CAIA,OADgB,OAAO,OAAOF,CAAa,EAAE,KAAKG,GAAOA,IAAQ,IAAI,EACpDH,EAAgB,IACnC,CAKA,MAAM,uBAAwB,CAC5B,OAAOnB,EAAiBF,EAAK,KAAK,KAAK,YAAa,wBAAwB,CAAC,CAC/E,CAKA,MAAM,YAAa,CACjB,OAAOE,EAAiBF,EAAK,KAAK,KAAK,YAAa,WAAW,CAAC,CAClE,CAKA,MAAM,YAAa,CACjB,OAAOE,EAAiBF,EAAK,KAAK,KAAK,YAAa,YAAY,CAAC,CACnE,CAKA,MAAM,cAAe,CACnB,OAAOE,EAAiBF,EAAK,KAAK,KAAK,YAAa,cAAc,CAAC,CACrE,CAKA,MAAM,gBAAiB,CACrB,OAAOG,EAAaH,EAAK,KAAK,KAAK,YAAa,YAAY,CAAC,CAC/D,CAKA,MAAM,mBAAoB,CAIxB,OAHiBE,EAAiBF,EAAK,KAAK,KAAK,YAAa,eAAe,CAAC,GAG3D,CACjB,SAAU,OACV,kBAAmB,IACrB,CACF,CAGA,WAAY,CACV,MAAM,IAAI,MAAM,+EAA+E,CACjG,CAEA,UAAW,CACT,MAAM,IAAI,MAAM,8EAA8E,CAChG,CACF,EAEA,OAAO,QAAU,CAAE,iBAAAK,CAAiB",
|
|
6
6
|
"names": ["require_file_utils", "__commonJSMin", "exports", "module", "fs", "readJsonFileSafe", "filepath", "content", "error", "readFileSafe", "writeJsonFile", "data", "indent", "writeModuleExportsFile", "fileExists", "ensureDirectoryExists", "dirpath", "removeDirectory", "require_path_utils", "__commonJSMin", "exports", "module", "path", "fileExists", "findFileUpward", "filename", "startDir", "currentDir", "filePath", "findDirectoryUpward", "dirname", "validator", "possiblePaths", "maxLevels", "i", "parentDir", "dirPath", "findDirectoryWithPaths", "absolutePaths", "p", "path", "findDirectoryUpward", "readJsonFileSafe", "readFileSafe", "fileExists", "LocalTokenReader", "ffId", "options", "tokensPath", "dir", "folderMapPath", "folderMap", "figmaPath", "tokenPaths", "results", "key", "paths", "tokenPath", "content", "cachePath", "cacheFiles", "processedData", "fileName", "filePath", "val"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var h=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var y=h((b,
|
|
1
|
+
var h=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var y=h((b,f)=>{var c=require("fs");function d(r){try{let e=c.readFileSync(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}function a(r){try{return c.readFileSync(r,"utf8").replace(/^\uFEFF/,"")}catch(e){if(e.code==="ENOENT")return null;throw e}}function w(r,e,n=2){let t=JSON.stringify(e,null,n);c.writeFileSync(r,t,"utf8")}function F(r,e){if(e==null||typeof e=="object"&&Object.keys(e).length===0||Array.isArray(e)&&e.length===0){let t=`module.exports = ${Array.isArray(e)?"[]":"{}"};`;c.writeFileSync(r,t,"utf8")}else{let n=`module.exports = ${JSON.stringify(e,null,2)};`;c.writeFileSync(r,n,"utf8")}}function S(r){return c.existsSync(r)}function m(r){c.mkdirSync(r,{recursive:!0})}function x(r){c.rmSync(r,{recursive:!0,force:!0})}f.exports={readJsonFileSafe:d,readFileSafe:a,writeJsonFile:w,writeModuleExportsFile:F,fileExists:S,ensureDirectoryExists:m,removeDirectory:x}});var i=require("path"),{fileExists:u}=y();function E(r,e=process.cwd()){let n=e;for(;n!==i.parse(n).root;){let t=i.join(n,r);if(u(t))return t;n=i.dirname(n)}return null}function j(r,e=process.cwd(),n=null){let t=[],s=e,p=10;for(let o=0;o<p;o++){t.push(i.join(s,r)),o<3&&t.push(i.join(s,"../".repeat(o+1)+r));let l=i.dirname(s);if(l===s)break;s=l}t.push(i.join(__dirname,"../../../",r));for(let o of t)if(u(o)&&(!n||n(o)))return o;return null}function D(r,e=process.cwd()){let n=r.map(t=>i.isAbsolute(t)?t:i.join(e,t));for(let t of n)if(u(t))return t;return null}module.exports={findFileUpward:E,findDirectoryUpward:j,findDirectoryWithPaths:D};
|
|
2
2
|
//# sourceMappingURL=path-utils.js.map
|
|
@@ -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,OAAO,KAET,MAAMA,CACR,CACF,CAQA,SAASE,EAAcJ,EAAUK,EAAMC,EAAS,EAAG,CACjD,IAAML,EAAU,KAAK,UAAUI,EAAM,KAAMC,CAAM,EACjDR,EAAG,cAAcE,EAAUC,EAAS,MAAM,CAC5C,CAOA,SAASM,EAAuBP,EAAUK,EAAM,CAE9C,GAAIA,GAAS,MACR,OAAOA,GAAS,UAAY,OAAO,KAAKA,CAAI,EAAE,SAAW,GACzD,MAAM,QAAQA,CAAI,GAAKA,EAAK,SAAW,EAAI,CAE9C,IAAMJ,EAAU,oBADK,MAAM,QAAQI,CAAI,EAAI,KAAO,IACF,IAChDP,EAAG,cAAcE,EAAUC,EAAS,MAAM,CAC5C,KAAO,CACL,IAAMA,EAAU,oBAAoB,KAAK,UAAUI,EAAM,KAAM,CA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D,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,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,GAAAC,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", "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,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,C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AAGD,EAEH,IAAK,CACH,GAAGA,EAAW,IAGd,sBAAuBE,EAAQ,KAAK,UAAUA,EAAM,kBAAoB,IAAI,EAAI,OAChF,qBAAsBA,EAAQ,KAAK,UAAUA,EAAM,OAAS,IAAI,EAAI,MACtE,EACA,QAAS,CAACC,EAAQC,IAAY,CAM5B,GAJI,OAAOJ,EAAW,SAAY,aAChCG,EAASH,EAAW,QAAQG,EAAQC,CAAO,GAGzC,CAACF,EACH,OAAOC,EAKT,GAAM,CAAE,QAAAE,CAAQ,EAAID,EACdE,EAAeD,EAAQ,aAGvBE,EAAc,CAClB,cAAe,KAAK,UAAUL,EAAM,kBAAoB,IAAI,EAC5D,aAAc,KAAK,UAAUA,EAAM,OAAS,IAAI,CAClD,EAGA,OAAAC,EAAO,QAAUA,EAAO,SAAW,CAAC,EACpCA,EAAO,QAAQ,KAAK,IAAIG,EAAaC,CAAW,CAAC,EAG7CH,EAAQ,KAAO,CAACA,EAAQ,UAC1B,QAAQ,IAAI,0EAA0E,EAIjFD,CACT,CACF,CACF,CAEA,OAAO,QAAUJ",
|
|
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", "CacheManager", "frontfriend", "nextConfig", "cacheManager", "cache", "config", "options", "webpack", "DefinePlugin", "definitions"]
|
|
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__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,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,EAG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AAO;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
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontfriend/tailwind",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Design token management for Tailwind CSS",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -39,6 +39,11 @@
|
|
|
39
39
|
"default": "./dist/ffdc.js"
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"test": "jest",
|
|
44
|
+
"build": "node scripts/build.js",
|
|
45
|
+
"prepublishOnly": "npm run build"
|
|
46
|
+
},
|
|
42
47
|
"keywords": [
|
|
43
48
|
"tailwindcss",
|
|
44
49
|
"design-tokens",
|
|
@@ -68,9 +73,5 @@
|
|
|
68
73
|
"jest": "^29.0.0",
|
|
69
74
|
"esbuild": "^0.19.0",
|
|
70
75
|
"glob": "^10.0.0"
|
|
71
|
-
},
|
|
72
|
-
"scripts": {
|
|
73
|
-
"test": "jest",
|
|
74
|
-
"build": "node scripts/build.js"
|
|
75
76
|
}
|
|
76
|
-
}
|
|
77
|
+
}
|