@frontfriend/tailwind 4.0.8 → 4.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../lib/core/components-config-schema.js", "../lib/core/file-utils.js", "../../../node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/package.json", "../../../node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/lib/main.js", "../lib/core/env-utils.js", "../ffdc.js", "../index.js"],
4
- "sourcesContent": ["/**\n * Shared componentsConfig schema for FrontFriend tools.\n *\n * The schema defines the canonical per-component envelope used by ffdc,\n * validation scripts, migration tooling, and registry completeness checks.\n * Keep this file as the single source of truth; consumers should re-export it\n * instead of maintaining local schema copies.\n */\n\nconst classValueSchema = {\n anyOf: [\n { type: 'string' },\n { type: 'number' },\n { type: 'boolean' },\n { type: 'null' },\n ],\n};\n\nconst componentsConfigSchema = {\n $id: 'https://frontfriend.dev/schemas/components-config.schema.json',\n type: 'object',\n additionalProperties: { $ref: '#/$defs/componentEnvelope' },\n $defs: {\n classValue: classValueSchema,\n classMap: {\n type: 'object',\n additionalProperties: {\n anyOf: [\n { $ref: '#/$defs/classValue' },\n { $ref: '#/$defs/classMap' },\n ],\n },\n },\n propMap: {\n type: 'object',\n additionalProperties: {\n anyOf: [\n { $ref: '#/$defs/classValue' },\n { $ref: '#/$defs/propMap' },\n ],\n },\n },\n componentEnvelope: {\n type: 'object',\n additionalProperties: false,\n properties: {\n // Root classes for the component itself.\n root: { anyOf: [{ type: 'string' }, { type: 'null' }] },\n\n // Canonical variant buckets: variants.variant, variants.size,\n // variants.iconPosition, etc. Values stay recursive so leaves can be\n // overridden independently during deep merges.\n variants: {\n type: 'object',\n additionalProperties: { $ref: '#/$defs/classMap' },\n },\n\n // Compatibility aliases for existing component code while v4 sources\n // move to the canonical variants/slots envelope.\n variant: { $ref: '#/$defs/classMap' },\n size: { $ref: '#/$defs/classMap' },\n sizes: { $ref: '#/$defs/classMap' },\n iconPosition: { $ref: '#/$defs/classMap' },\n color: { $ref: '#/$defs/classMap' },\n fullwidth: { $ref: '#/$defs/classMap' },\n\n // Named child slots. Each slot uses the same envelope so tooling can be\n // generic instead of component-specific.\n slots: {\n type: 'object',\n additionalProperties: { $ref: '#/$defs/componentEnvelope' },\n },\n\n // Compatibility alias for the Button icon slot.\n icon: { $ref: '#/$defs/componentEnvelope' },\n\n states: { $ref: '#/$defs/classMap' },\n compoundVariants: { $ref: '#/$defs/classMap' },\n defaultVariants: { $ref: '#/$defs/propMap' },\n props: { $ref: '#/$defs/propMap' },\n },\n },\n },\n};\n\nfunction isCSSClassString(value) {\n if (typeof value !== 'string') return false;\n\n if (value.trim().length === 0) return false;\n\n if (/^[0-9]+$/.test(value)) return false;\n\n if (value === 'true' || value === 'false') return false;\n\n const hasSpaces = /\\s/.test(value);\n const hasTailwindSyntax = /[-:\\[\\]\\/]/.test(value);\n\n if (hasSpaces || hasTailwindSyntax) return true;\n\n return true;\n}\n\nmodule.exports = {\n componentsConfigSchema,\n isCSSClassString,\n};\n", "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 plain text content to a file\n * @param {string} filepath - Path to write the file\n * @param {string} content - Text content to write\n */\nfunction writeTextFile(filepath, content) {\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 writeTextFile,\n writeModuleExportsFile,\n fileExists,\n ensureDirectoryExists,\n removeDirectory\n};\n", "{\n \"name\": \"dotenv\",\n \"version\": \"16.6.1\",\n \"description\": \"Loads environment variables from .env file\",\n \"main\": \"lib/main.js\",\n \"types\": \"lib/main.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./lib/main.d.ts\",\n \"require\": \"./lib/main.js\",\n \"default\": \"./lib/main.js\"\n },\n \"./config\": \"./config.js\",\n \"./config.js\": \"./config.js\",\n \"./lib/env-options\": \"./lib/env-options.js\",\n \"./lib/env-options.js\": \"./lib/env-options.js\",\n \"./lib/cli-options\": \"./lib/cli-options.js\",\n \"./lib/cli-options.js\": \"./lib/cli-options.js\",\n \"./package.json\": \"./package.json\"\n },\n \"scripts\": {\n \"dts-check\": \"tsc --project tests/types/tsconfig.json\",\n \"lint\": \"standard\",\n \"pretest\": \"npm run lint && npm run dts-check\",\n \"test\": \"tap run --allow-empty-coverage --disable-coverage --timeout=60000\",\n \"test:coverage\": \"tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov\",\n \"prerelease\": \"npm test\",\n \"release\": \"standard-version\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git://github.com/motdotla/dotenv.git\"\n },\n \"homepage\": \"https://github.com/motdotla/dotenv#readme\",\n \"funding\": \"https://dotenvx.com\",\n \"keywords\": [\n \"dotenv\",\n \"env\",\n \".env\",\n \"environment\",\n \"variables\",\n \"config\",\n \"settings\"\n ],\n \"readmeFilename\": \"README.md\",\n \"license\": \"BSD-2-Clause\",\n \"devDependencies\": {\n \"@types/node\": \"^18.11.3\",\n \"decache\": \"^4.6.2\",\n \"sinon\": \"^14.0.1\",\n \"standard\": \"^17.0.0\",\n \"standard-version\": \"^9.5.0\",\n \"tap\": \"^19.2.0\",\n \"typescript\": \"^4.8.4\"\n },\n \"engines\": {\n \"node\": \">=12\"\n },\n \"browser\": {\n \"fs\": false\n }\n}\n", "const fs = require('fs')\nconst path = require('path')\nconst os = require('os')\nconst crypto = require('crypto')\nconst packageJson = require('../package.json')\n\nconst version = packageJson.version\n\nconst LINE = /(?:^|^)\\s*(?:export\\s+)?([\\w.-]+)(?:\\s*=\\s*?|:\\s+?)(\\s*'(?:\\\\'|[^'])*'|\\s*\"(?:\\\\\"|[^\"])*\"|\\s*`(?:\\\\`|[^`])*`|[^#\\r\\n]+)?\\s*(?:#.*)?(?:$|$)/mg\n\n// Parse src into an Object\nfunction parse (src) {\n const obj = {}\n\n // Convert buffer to string\n let lines = src.toString()\n\n // Convert line breaks to same format\n lines = lines.replace(/\\r\\n?/mg, '\\n')\n\n let match\n while ((match = LINE.exec(lines)) != null) {\n const key = match[1]\n\n // Default undefined or null to empty string\n let value = (match[2] || '')\n\n // Remove whitespace\n value = value.trim()\n\n // Check if double quoted\n const maybeQuote = value[0]\n\n // Remove surrounding quotes\n value = value.replace(/^(['\"`])([\\s\\S]*)\\1$/mg, '$2')\n\n // Expand newlines if double quoted\n if (maybeQuote === '\"') {\n value = value.replace(/\\\\n/g, '\\n')\n value = value.replace(/\\\\r/g, '\\r')\n }\n\n // Add to object\n obj[key] = value\n }\n\n return obj\n}\n\nfunction _parseVault (options) {\n options = options || {}\n\n const vaultPath = _vaultPath(options)\n options.path = vaultPath // parse .env.vault\n const result = DotenvModule.configDotenv(options)\n if (!result.parsed) {\n const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`)\n err.code = 'MISSING_DATA'\n throw err\n }\n\n // handle scenario for comma separated keys - for use with key rotation\n // example: DOTENV_KEY=\"dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenvx.com/vault/.env.vault?environment=prod\"\n const keys = _dotenvKey(options).split(',')\n const length = keys.length\n\n let decrypted\n for (let i = 0; i < length; i++) {\n try {\n // Get full key\n const key = keys[i].trim()\n\n // Get instructions for decrypt\n const attrs = _instructions(result, key)\n\n // Decrypt\n decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key)\n\n break\n } catch (error) {\n // last key\n if (i + 1 >= length) {\n throw error\n }\n // try next key\n }\n }\n\n // Parse decrypted .env string\n return DotenvModule.parse(decrypted)\n}\n\nfunction _warn (message) {\n console.log(`[dotenv@${version}][WARN] ${message}`)\n}\n\nfunction _debug (message) {\n console.log(`[dotenv@${version}][DEBUG] ${message}`)\n}\n\nfunction _log (message) {\n console.log(`[dotenv@${version}] ${message}`)\n}\n\nfunction _dotenvKey (options) {\n // prioritize developer directly setting options.DOTENV_KEY\n if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {\n return options.DOTENV_KEY\n }\n\n // secondary infra already contains a DOTENV_KEY environment variable\n if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {\n return process.env.DOTENV_KEY\n }\n\n // fallback to empty string\n return ''\n}\n\nfunction _instructions (result, dotenvKey) {\n // Parse DOTENV_KEY. Format is a URI\n let uri\n try {\n uri = new URL(dotenvKey)\n } catch (error) {\n if (error.code === 'ERR_INVALID_URL') {\n const err = new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n }\n\n throw error\n }\n\n // Get decrypt key\n const key = uri.password\n if (!key) {\n const err = new Error('INVALID_DOTENV_KEY: Missing key part')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n }\n\n // Get environment\n const environment = uri.searchParams.get('environment')\n if (!environment) {\n const err = new Error('INVALID_DOTENV_KEY: Missing environment part')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n }\n\n // Get ciphertext payload\n const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`\n const ciphertext = result.parsed[environmentKey] // DOTENV_VAULT_PRODUCTION\n if (!ciphertext) {\n const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`)\n err.code = 'NOT_FOUND_DOTENV_ENVIRONMENT'\n throw err\n }\n\n return { ciphertext, key }\n}\n\nfunction _vaultPath (options) {\n let possibleVaultPath = null\n\n if (options && options.path && options.path.length > 0) {\n if (Array.isArray(options.path)) {\n for (const filepath of options.path) {\n if (fs.existsSync(filepath)) {\n possibleVaultPath = filepath.endsWith('.vault') ? filepath : `${filepath}.vault`\n }\n }\n } else {\n possibleVaultPath = options.path.endsWith('.vault') ? options.path : `${options.path}.vault`\n }\n } else {\n possibleVaultPath = path.resolve(process.cwd(), '.env.vault')\n }\n\n if (fs.existsSync(possibleVaultPath)) {\n return possibleVaultPath\n }\n\n return null\n}\n\nfunction _resolveHome (envPath) {\n return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath\n}\n\nfunction _configVault (options) {\n const debug = Boolean(options && options.debug)\n const quiet = options && 'quiet' in options ? options.quiet : true\n\n if (debug || !quiet) {\n _log('Loading env from encrypted .env.vault')\n }\n\n const parsed = DotenvModule._parseVault(options)\n\n let processEnv = process.env\n if (options && options.processEnv != null) {\n processEnv = options.processEnv\n }\n\n DotenvModule.populate(processEnv, parsed, options)\n\n return { parsed }\n}\n\nfunction configDotenv (options) {\n const dotenvPath = path.resolve(process.cwd(), '.env')\n let encoding = 'utf8'\n const debug = Boolean(options && options.debug)\n const quiet = options && 'quiet' in options ? options.quiet : true\n\n if (options && options.encoding) {\n encoding = options.encoding\n } else {\n if (debug) {\n _debug('No encoding is specified. UTF-8 is used by default')\n }\n }\n\n let optionPaths = [dotenvPath] // default, look for .env\n if (options && options.path) {\n if (!Array.isArray(options.path)) {\n optionPaths = [_resolveHome(options.path)]\n } else {\n optionPaths = [] // reset default\n for (const filepath of options.path) {\n optionPaths.push(_resolveHome(filepath))\n }\n }\n }\n\n // Build the parsed data in a temporary object (because we need to return it). Once we have the final\n // parsed data, we will combine it with process.env (or options.processEnv if provided).\n let lastError\n const parsedAll = {}\n for (const path of optionPaths) {\n try {\n // Specifying an encoding returns a string instead of a buffer\n const parsed = DotenvModule.parse(fs.readFileSync(path, { encoding }))\n\n DotenvModule.populate(parsedAll, parsed, options)\n } catch (e) {\n if (debug) {\n _debug(`Failed to load ${path} ${e.message}`)\n }\n lastError = e\n }\n }\n\n let processEnv = process.env\n if (options && options.processEnv != null) {\n processEnv = options.processEnv\n }\n\n DotenvModule.populate(processEnv, parsedAll, options)\n\n if (debug || !quiet) {\n const keysCount = Object.keys(parsedAll).length\n const shortPaths = []\n for (const filePath of optionPaths) {\n try {\n const relative = path.relative(process.cwd(), filePath)\n shortPaths.push(relative)\n } catch (e) {\n if (debug) {\n _debug(`Failed to load ${filePath} ${e.message}`)\n }\n lastError = e\n }\n }\n\n _log(`injecting env (${keysCount}) from ${shortPaths.join(',')}`)\n }\n\n if (lastError) {\n return { parsed: parsedAll, error: lastError }\n } else {\n return { parsed: parsedAll }\n }\n}\n\n// Populates process.env from .env file\nfunction config (options) {\n // fallback to original dotenv if DOTENV_KEY is not set\n if (_dotenvKey(options).length === 0) {\n return DotenvModule.configDotenv(options)\n }\n\n const vaultPath = _vaultPath(options)\n\n // dotenvKey exists but .env.vault file does not exist\n if (!vaultPath) {\n _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`)\n\n return DotenvModule.configDotenv(options)\n }\n\n return DotenvModule._configVault(options)\n}\n\nfunction decrypt (encrypted, keyStr) {\n const key = Buffer.from(keyStr.slice(-64), 'hex')\n let ciphertext = Buffer.from(encrypted, 'base64')\n\n const nonce = ciphertext.subarray(0, 12)\n const authTag = ciphertext.subarray(-16)\n ciphertext = ciphertext.subarray(12, -16)\n\n try {\n const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce)\n aesgcm.setAuthTag(authTag)\n return `${aesgcm.update(ciphertext)}${aesgcm.final()}`\n } catch (error) {\n const isRange = error instanceof RangeError\n const invalidKeyLength = error.message === 'Invalid key length'\n const decryptionFailed = error.message === 'Unsupported state or unable to authenticate data'\n\n if (isRange || invalidKeyLength) {\n const err = new Error('INVALID_DOTENV_KEY: It must be 64 characters long (or more)')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n } else if (decryptionFailed) {\n const err = new Error('DECRYPTION_FAILED: Please check your DOTENV_KEY')\n err.code = 'DECRYPTION_FAILED'\n throw err\n } else {\n throw error\n }\n }\n}\n\n// Populate process.env with parsed values\nfunction populate (processEnv, parsed, options = {}) {\n const debug = Boolean(options && options.debug)\n const override = Boolean(options && options.override)\n\n if (typeof parsed !== 'object') {\n const err = new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate')\n err.code = 'OBJECT_REQUIRED'\n throw err\n }\n\n // Set process.env\n for (const key of Object.keys(parsed)) {\n if (Object.prototype.hasOwnProperty.call(processEnv, key)) {\n if (override === true) {\n processEnv[key] = parsed[key]\n }\n\n if (debug) {\n if (override === true) {\n _debug(`\"${key}\" is already defined and WAS overwritten`)\n } else {\n _debug(`\"${key}\" is already defined and was NOT overwritten`)\n }\n }\n } else {\n processEnv[key] = parsed[key]\n }\n }\n}\n\nconst DotenvModule = {\n configDotenv,\n _configVault,\n _parseVault,\n config,\n decrypt,\n parse,\n populate\n}\n\nmodule.exports.configDotenv = DotenvModule.configDotenv\nmodule.exports._configVault = DotenvModule._configVault\nmodule.exports._parseVault = DotenvModule._parseVault\nmodule.exports.config = DotenvModule.config\nmodule.exports.decrypt = DotenvModule.decrypt\nmodule.exports.parse = DotenvModule.parse\nmodule.exports.populate = DotenvModule.populate\n\nmodule.exports = DotenvModule\n", "const path = require('path');\nconst { fileExists } = require('./file-utils');\n\n/**\n * Load .env.local file if it exists in the current working directory\n * @param {string} cwd - Current working directory (defaults to process.cwd())\n * @returns {boolean} True if .env.local was loaded\n */\nfunction loadEnvLocal(cwd = process.cwd()) {\n const envLocalPath = path.join(cwd, '.env.local');\n \n if (fileExists(envLocalPath)) {\n require('dotenv').config({ path: envLocalPath });\n console.log('\uD83D\uDCC4 Loaded .env.local');\n return true;\n }\n \n return false;\n}\n\n/**\n * Get an environment variable with optional default value\n * @param {string} name - Environment variable name\n * @param {string} defaultValue - Default value if not set\n * @returns {string|undefined} Environment variable value or default\n */\nfunction getEnvVar(name, defaultValue = undefined) {\n return process.env[name] || defaultValue;\n}\n\n/**\n * Check if an environment variable is set to 'true'\n * @param {string} name - Environment variable name\n * @returns {boolean} True if the env var is set to 'true'\n */\nfunction isEnvTrue(name) {\n return process.env[name] === 'true';\n}\n\nmodule.exports = {\n loadEnvLocal,\n getEnvVar,\n isEnvTrue\n};", "// ffdc.js - Simple config accessor\n// No base64 decoding, just returns the config object directly\n\nconst {\n componentsConfigSchema,\n isCSSClassString,\n} = require('./lib/core/components-config-schema');\n\nfunction ffdc(config) {\n if (!config) {\n return {};\n }\n\n if (typeof config !== 'object') {\n throw new Error('Config must be an object');\n }\n\n return config;\n}\n\nffdc.componentsConfigSchema = componentsConfigSchema;\nffdc.isCSSClassString = isCSSClassString;\n\nmodule.exports = ffdc;\n", "const plugin = require('tailwindcss/plugin');\nconst { componentsConfigSchema, isCSSClassString } = require('./lib/core/components-config-schema');\n\n// PostCSS is a peer dependency of Tailwind, so it should be available\n// We'll try to require it, but handle the case where it's not available\nlet postcss;\ntry {\n postcss = require('postcss');\n} catch (e) {\n // PostCSS not available - custom CSS parsing will be disabled\n postcss = null;\n}\n\nlet CacheManager;\nif (typeof window === 'undefined' && typeof process !== 'undefined' && process.versions && process.versions.node) {\n CacheManager = require('./lib/core/cache-manager');\n const { loadEnvLocal } = require('./lib/core/env-utils');\n // Load .env.local if it exists\n loadEnvLocal();\n}\n\nfunction filterDefault(values) {\n return Object.fromEntries(\n Object.entries(values).filter(([key]) => key !== \"DEFAULT\"),\n );\n}\n\nconst pluginExport = plugin.withOptions(\n function (options = {}) {\n return function ({ addBase, addUtilities, theme, matchUtilities }) {\n // 1. Load cache with CacheManager\n if (!CacheManager) {\n // should get cache in browser here\n return;\n }\n\n const cacheManager = new CacheManager(process.cwd());\n\n if (!cacheManager.exists()) {\n console.warn('[FrontFriend] No cache found. Please run \"npx frontfriend init\" first.');\n return;\n }\n\n if (!cacheManager.isValid()) {\n console.warn('[FrontFriend] Cache is expired. Please run \"npx frontfriend init\" to refresh.');\n }\n\n const cache = cacheManager.load();\n if (!cache) {\n console.error('[FrontFriend] Failed to load cache.');\n return;\n }\n\n // 2. Add CSS variables to :root\n const rootVars = {};\n\n // Add color variables\n if (cache.variables) {\n // Wrap HSL values in hsl() function\n for (const [key, value] of Object.entries(cache.variables)) {\n // Check if it's a color variable (contains HSL values)\n if (key.startsWith('--color-') && !value.startsWith('hsl(')) {\n rootVars[key] = `hsl(${value})`;\n } else {\n rootVars[key] = value;\n }\n }\n }\n\n // Add semantic variables (light mode)\n if (cache.semanticVariables) {\n for (const [key, value] of Object.entries(cache.semanticVariables)) {\n // Check if value contains HSL components (e.g., \"206 92% 5% / 0.9\")\n // These need to be wrapped in hsl() function\n if (typeof value === 'string' &&\n !value.startsWith('var(') &&\n !value.startsWith('hsl(') &&\n /^\\d+\\s+\\d+%\\s+\\d+%/.test(value)) {\n rootVars[key] = `hsl(${value})`;\n } else {\n // Semantic variables that point to other variables using var()\n // don't need wrapping\n rootVars[key] = value;\n }\n }\n }\n\n // Add root styles\n addBase({\n ':root': rootVars\n });\n\n // 3. Add dark mode support\n if (cache.semanticDarkVariables && Object.keys(cache.semanticDarkVariables).length > 0) {\n const darkVars = {};\n for (const [key, value] of Object.entries(cache.semanticDarkVariables)) {\n // Check if value contains HSL components\n if (typeof value === 'string' &&\n !value.startsWith('var(') &&\n !value.startsWith('hsl(') &&\n /^\\d+\\s+\\d+%\\s+\\d+%/.test(value)) {\n darkVars[key] = `hsl(${value})`;\n } else {\n darkVars[key] = value;\n }\n }\n\n addBase({\n ':root:not(.light)': darkVars\n });\n addBase({\n ':root:not(.dark)': rootVars\n });\n }\n\n\n // 4. Generate semantic color utilities from semantic variables\n if (cache.semanticVariables) {\n const semanticUtilities = {};\n\n // Process semantic variables into utility classes\n for (const [cssVar] of Object.entries(cache.semanticVariables)) {\n // Convert CSS variable to utility class name\n // --bg-brand-mid-default -> bg-brand-mid\n // --text-brand-strong -> text-brand-strong\n // --border-neutral-subtle-hover -> border-neutral-subtle-hover\n\n const match = cssVar.match(/^--(bg|text|border|layer|overlay|icon)-(.+)$/);\n if (match) {\n const [, prefix, name] = match;\n const className = `.${prefix}-${name}`;\n\n if (prefix === 'bg' || prefix === 'layer' || prefix === 'overlay') {\n semanticUtilities[className] = {\n backgroundColor: `var(${cssVar})`\n };\n } else if (prefix === 'text') {\n semanticUtilities[className] = {\n color: `var(${cssVar})`\n };\n } else if (prefix === 'border') {\n semanticUtilities[className] = {\n borderColor: `var(${cssVar})`\n };\n } else if (prefix === 'icon') {\n // Icon tokens map to both text color and fill\n semanticUtilities[`.text-${prefix}-${name}`] = {\n color: `var(${cssVar})`\n };\n semanticUtilities[`.fill-${prefix}-${name}`] = {\n fill: `var(${cssVar})`\n };\n }\n }\n }\n\n addUtilities(semanticUtilities);\n }\n\n // 5. Generate utilities from tokens (semantic-based utilities)\n if (cache.tokens) {\n // Background colors\n if (cache.tokens.backgroundColor) {\n const bgUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.backgroundColor)) {\n // The value already contains hsl() wrapper from the processor\n bgUtilities[`.bg-${name}`] = {\n backgroundColor: value\n };\n }\n addUtilities(bgUtilities);\n }\n\n // Text colors\n if (cache.tokens.textColor) {\n const textUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.textColor)) {\n textUtilities[`.text-${name}`] = {\n color: value\n };\n }\n addUtilities(textUtilities);\n }\n\n // Border colors\n if (cache.tokens.borderColor) {\n const borderUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.borderColor)) {\n borderUtilities[`.border-${name}`] = {\n borderColor: value\n };\n }\n addUtilities(borderUtilities);\n }\n\n // Fill colors (for SVG icons)\n if (cache.tokens.fill) {\n const fillUtilities = {};\n const textIconUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.fill)) {\n fillUtilities[`.fill-${name}`] = {\n fill: value\n };\n // Also create text-icon utilities for icon color classes\n if (name.startsWith('icon-')) {\n textIconUtilities[`.text-${name}`] = {\n color: value\n };\n }\n }\n addUtilities(fillUtilities);\n addUtilities(textIconUtilities);\n }\n\n // Font family utilities\n if (cache.tokens.fontFamily) {\n const fontUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.fontFamily)) {\n fontUtilities[`.font-${name}`] = {\n fontFamily: value\n };\n }\n addUtilities(fontUtilities);\n }\n }\n\n // 6. Add font faces\n if (cache.fonts && cache.fonts.length > 0) {\n // Convert font objects to Tailwind-compatible format\n cache.fonts.forEach(fontFace => {\n // Tailwind expects each @font-face as a separate rule\n addBase({\n '@font-face': fontFace\n });\n });\n }\n\n // 7. Add enter/exit animation utilities\n addUtilities({\n \"@keyframes enter\": theme(\"keyframes.enter\"),\n \"@keyframes exit\": theme(\"keyframes.exit\"),\n \".animate-in\": {\n animationName: \"enter\",\n animationDuration: theme(\"animationDuration.DEFAULT\"),\n \"--tw-enter-opacity\": \"initial\",\n \"--tw-enter-scale\": \"initial\",\n \"--tw-enter-rotate\": \"initial\",\n \"--tw-enter-translate-x\": \"initial\",\n \"--tw-enter-translate-y\": \"initial\",\n },\n \".animate-out\": {\n animationName: \"exit\",\n animationDuration: theme(\"animationDuration.DEFAULT\"),\n \"--tw-exit-opacity\": \"initial\",\n \"--tw-exit-scale\": \"initial\",\n \"--tw-exit-rotate\": \"initial\",\n \"--tw-exit-translate-x\": \"initial\",\n \"--tw-exit-translate-y\": \"initial\",\n },\n });\n\n // 10. Add animation match utilities\n matchUtilities(\n {\n \"fade-in\": (value) => ({ \"--tw-enter-opacity\": value }),\n \"fade-out\": (value) => ({ \"--tw-exit-opacity\": value }),\n },\n { values: theme(\"animationOpacity\") }\n );\n\n matchUtilities(\n {\n \"zoom-in\": (value) => ({ \"--tw-enter-scale\": value }),\n \"zoom-out\": (value) => ({ \"--tw-exit-scale\": value }),\n },\n { values: theme(\"animationScale\") }\n );\n\n matchUtilities(\n {\n \"spin-in\": (value) => ({ \"--tw-enter-rotate\": value }),\n \"spin-out\": (value) => ({ \"--tw-exit-rotate\": value }),\n },\n { values: theme(\"animationRotate\") }\n );\n\n matchUtilities(\n {\n \"slide-in-from-top\": (value) => ({\n \"--tw-enter-translate-y\": `-${value}`,\n }),\n \"slide-in-from-bottom\": (value) => ({\n \"--tw-enter-translate-y\": value,\n }),\n \"slide-in-from-left\": (value) => ({\n \"--tw-enter-translate-x\": `-${value}`,\n }),\n \"slide-in-from-right\": (value) => ({\n \"--tw-enter-translate-x\": value,\n }),\n \"slide-out-to-top\": (value) => ({\n \"--tw-exit-translate-y\": `-${value}`,\n }),\n \"slide-out-to-bottom\": (value) => ({\n \"--tw-exit-translate-y\": value,\n }),\n \"slide-out-to-left\": (value) => ({\n \"--tw-exit-translate-x\": `-${value}`,\n }),\n \"slide-out-to-right\": (value) => ({\n \"--tw-exit-translate-x\": value,\n }),\n },\n { values: theme(\"animationTranslate\") }\n );\n\n // 11. Add animation control utilities\n matchUtilities(\n { duration: (value) => ({ animationDuration: value }) },\n { values: filterDefault(theme(\"animationDuration\")) }\n );\n\n matchUtilities(\n { delay: (value) => ({ animationDelay: value }) },\n { values: theme(\"animationDelay\") }\n );\n\n matchUtilities(\n { ease: (value) => ({ animationTimingFunction: value }) },\n { values: filterDefault(theme(\"animationTimingFunction\")) }\n );\n\n addUtilities({\n \".running\": { animationPlayState: \"running\" },\n \".paused\": { animationPlayState: \"paused\" },\n });\n\n // Page main padding utilities (use CSS variables from project's custom.css)\n addUtilities({\n \".px-ff-main\": {\n paddingLeft: \"var(--ff-main-px)\",\n paddingRight: \"var(--ff-main-px)\",\n },\n \".py-ff-main\": {\n paddingTop: \"var(--ff-main-py)\",\n paddingBottom: \"var(--ff-main-py)\",\n },\n \".p-ff-main\": {\n paddingLeft: \"var(--ff-main-px)\",\n paddingRight: \"var(--ff-main-px)\",\n paddingTop: \"var(--ff-main-py)\",\n paddingBottom: \"var(--ff-main-py)\",\n },\n });\n\n matchUtilities(\n { \"fill-mode\": (value) => ({ animationFillMode: value }) },\n { values: theme(\"animationFillMode\") }\n );\n\n matchUtilities(\n { direction: (value) => ({ animationDirection: value }) },\n { values: theme(\"animationDirection\") }\n );\n\n matchUtilities(\n { repeat: (value) => ({ animationIterationCount: value }) },\n { values: theme(\"animationRepeat\") }\n );\n\n // 12. Add custom CSS\n if (cache.custom && cache.custom.raw && typeof cache.custom.raw === 'string') {\n const rawCss = cache.custom.raw.trim();\n\n if (!rawCss) {\n if (options.verbose) {\n console.warn('[FrontFriend] Empty custom CSS');\n }\n return;\n }\n\n // Check if PostCSS is available\n if (!postcss) {\n console.warn('[FrontFriend] PostCSS not available - custom CSS will not be added');\n return;\n }\n\n try {\n // Parse the CSS using PostCSS to get an AST\n const root = postcss.parse(rawCss);\n \n // Split nodes into base and utilities layers\n const baseNodes = [];\n const utilityNodes = [];\n \n root.each((node) => {\n // @keyframes, @font-face, @media, etc. go to base\n if (node.type === 'atrule') {\n // Special handling for @keyframes and other at-rules\n baseNodes.push(node);\n return;\n }\n \n // Regular rules\n if (node.type === 'rule') {\n // Class selectors starting with . go to utilities\n const isClassSelector = \n typeof node.selector === 'string' && \n node.selector.trim().startsWith('.');\n \n if (isClassSelector) {\n utilityNodes.push(node);\n } else {\n // Element selectors, IDs, attribute selectors, etc. go to base\n baseNodes.push(node);\n }\n return;\n }\n \n // Comments and other nodes go to base\n if (node.type !== 'comment') {\n baseNodes.push(node);\n }\n });\n \n // Add nodes to their respective layers\n // Tailwind accepts PostCSS nodes directly\n if (baseNodes.length > 0) {\n addBase(baseNodes);\n }\n \n if (utilityNodes.length > 0) {\n addUtilities(utilityNodes);\n }\n \n if (options.verbose) {\n console.log(`[FrontFriend] Added custom CSS: ${baseNodes.length} base rules, ${utilityNodes.length} utility classes`);\n }\n } catch (error) {\n console.error('[FrontFriend] Failed to parse custom CSS:', error.message);\n // Don't throw - just log the error and continue\n }\n } else if (!cache.custom) {\n // Check if custom.js file exists but failed to load\n const fs = require('fs');\n const path = require('path');\n const customJsPath = path.join(process.cwd(), 'node_modules', '.cache', 'frontfriend', 'custom.js');\n\n if (fs.existsSync(customJsPath)) {\n console.warn('[FrontFriend] custom.js file exists but failed to load. This may be due to a parsing error or BOM issue.');\n console.warn('[FrontFriend] Try deleting node_modules/.cache/frontfriend and running `npx frontfriend init` again.');\n }\n }\n\n // Log success\n if (options.verbose) {\n console.log('[FrontFriend] Plugin loaded successfully');\n console.log(`[FrontFriend] Colors: ${Object.keys(cache.variables || {}).length}`);\n console.log(`[FrontFriend] Semantic vars: ${Object.keys(cache.semanticVariables || {}).length}`);\n console.log(`[FrontFriend] Fonts: ${(cache.fonts || []).length}`);\n console.log(`[FrontFriend] Safelist classes: ${Array.isArray(cache.safelist) ? cache.safelist.length : 0}`);\n }\n };\n },\n function (options = {}) {\n // Return theme configuration\n let cache = null;\n if (CacheManager) {\n const cacheManager = new CacheManager(process.cwd());\n cache = cacheManager.exists() ? cacheManager.load() : null;\n }\n\n // Default content paths matching the current-plugin approach\n const defaultContent = [\n './pages/**/*.{js,ts,jsx,tsx}',\n './components/**/*.{js,ts,jsx,tsx}',\n './app/**/*.{js,ts,jsx,tsx}',\n './src/**/*.{js,ts,jsx,tsx}',\n './stories/**/*.{js,ts,jsx,tsx}'\n ];\n\n // Log cache loading\n if (options.verbose && cache) {\n console.log('[FrontFriend] Cache loaded successfully');\n if (cache.safelist && Array.isArray(cache.safelist)) {\n console.log(`[FrontFriend] Loading ${cache.safelist.length} classes for safelist`);\n }\n }\n\n return {\n theme: {\n extend: {\n // Extend colors if needed\n colors: options.extendColors || {},\n // Extend animations if needed\n animation: options.extendAnimations || {},\n // Add custom spacing values\n spacing: {\n '18': '4.5rem',\n '88': '22rem',\n '128': '32rem'\n },\n // Add custom box shadows\n boxShadow: {\n 'top-sm': '0 -1px 1px 0 rgba(0, 0, 0, 0.05)'\n },\n // Add border radius values\n borderRadius: {\n '2xl': '1rem'\n },\n // Animation extensions\n animationDelay: ({ theme }) => ({\n ...theme(\"transitionDelay\"),\n }),\n animationDuration: ({ theme }) => ({\n 0: \"0ms\",\n ...theme(\"transitionDuration\"),\n }),\n animationTimingFunction: ({ theme }) => ({\n ...theme(\"transitionTimingFunction\"),\n }),\n animationFillMode: {\n none: \"none\",\n forwards: \"forwards\",\n backwards: \"backwards\",\n both: \"both\",\n },\n animationDirection: {\n normal: \"normal\",\n reverse: \"reverse\",\n alternate: \"alternate\",\n \"alternate-reverse\": \"alternate-reverse\",\n },\n animationOpacity: ({ theme }) => ({\n DEFAULT: 0,\n ...theme(\"opacity\"),\n }),\n animationTranslate: ({ theme }) => ({\n DEFAULT: \"100%\",\n ...theme(\"translate\"),\n }),\n animationScale: ({ theme }) => ({\n DEFAULT: 0,\n ...theme(\"scale\"),\n }),\n animationRotate: ({ theme }) => ({\n DEFAULT: \"30deg\",\n ...theme(\"rotate\"),\n }),\n animationRepeat: {\n 0: \"0\",\n 1: \"1\",\n infinite: \"infinite\",\n },\n keyframes: {\n enter: {\n from: {\n opacity: \"var(--tw-enter-opacity, 1)\",\n transform:\n \"translate3d(var(--tw-enter-translate-x, 0), var(--tw-enter-translate-y, 0), 0) scale3d(var(--tw-enter-scale, 1), var(--tw-enter-scale, 1), var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))\",\n },\n },\n exit: {\n to: {\n opacity: \"var(--tw-exit-opacity, 1)\",\n transform:\n \"translate3d(var(--tw-exit-translate-x, 0), var(--tw-exit-translate-y, 0), 0) scale3d(var(--tw-exit-scale, 1), var(--tw-exit-scale, 1), var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))\",\n },\n },\n },\n }\n },\n // Include safelist from cache and additional classes\n // Filter out file: variant classes \u2014 chaining file-selector-button with other\n // pseudo-elements (e.g. ::placeholder) produces invalid CSS that crashes Turbopack.\n safelist: [\n ...(cache?.safelist || []).filter(s => typeof s !== 'string' || !s.startsWith('file:')),\n {\n pattern: /(text|fill)-icon-(neutral|positive|negative|warning|info|highlight|interactive|brand|inverse|onpositive|onnegative|onwarning|oninfo|onhighlight|oninteractive|onbrand)-(mid|strong|subtle|low)(-(neutral|hover|active|selected|disabled))?$/,\n },\n {\n pattern: /^(layer-(below|surface|raised|popover|dialog|control)|overlay-(mid|strong|subtle|low))$/,\n },\n ],\n // Set content paths - merge options with defaults\n content: options.content || defaultContent\n };\n }\n);\n\n// Default export is the plugin\nmodule.exports = pluginExport;\n\n// Export components config and icons with getter functions\n// This allows dynamic resolution at runtime\n\n// Create getter for config\nObject.defineProperty(module.exports, 'config', {\n get: function () {\n // Check for webpack-injected global variable\n if (typeof __FF_CONFIG__ !== 'undefined') {\n return __FF_CONFIG__;\n }\n\n // Check if we're in a browser environment\n if (typeof window !== 'undefined' && window.__FF_CONFIG__) {\n return window.__FF_CONFIG__;\n }\n\n // Node.js: load from cache\n if (CacheManager) {\n try {\n const cacheManager = new CacheManager(process.cwd());\n if (cacheManager.exists()) {\n const cache = cacheManager.load();\n if (cache) {\n return cache.componentsConfig || null;\n }\n }\n } catch (error) {\n // Config not available\n }\n }\n\n return null;\n }\n});\n\n// Create getter for iconSet\nObject.defineProperty(module.exports, 'iconSet', {\n get: function () {\n // Check for webpack-injected global variable\n if (typeof __FF_ICONS__ !== 'undefined') {\n return __FF_ICONS__;\n }\n\n // Check if we're in a browser environment\n if (typeof window !== 'undefined' && window.__FF_ICONS__) {\n return window.__FF_ICONS__;\n }\n\n // Node.js: load from cache\n if (CacheManager) {\n try {\n const cacheManager = new CacheManager(process.cwd());\n if (cacheManager.exists()) {\n const cache = cacheManager.load();\n if (cache) {\n return cache.icons || null;\n }\n }\n } catch (error) {\n // Icons not available\n }\n }\n\n return null;\n }\n});\n\n// Export shared componentsConfig schema utilities\nmodule.exports.componentsConfigSchema = componentsConfigSchema;\nmodule.exports.isCSSClassString = isCSSClassString;\n\n// Export ffdc utility\nmodule.exports.ffdc = require('./ffdc.js');"],
5
- "mappings": "8DAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,IAAA,CASA,IAAMC,EAAmB,CACvB,MAAO,CACL,CAAE,KAAM,QAAS,EACjB,CAAE,KAAM,QAAS,EACjB,CAAE,KAAM,SAAU,EAClB,CAAE,KAAM,MAAO,CACjB,CACF,EAEMC,EAAyB,CAC7B,IAAK,gEACL,KAAM,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,OAAO,QAAS,UAAW,CAC/C,IAAK,UAAY,CAEf,GAAI,OAAO,aAAiB,IAC1B,OAAO,aAIT,GAAI,OAAO,OAAW,KAAe,OAAO,aAC1C,OAAO,OAAO,aAIhB,GAAIZ,EACF,GAAI,CACF,IAAMW,EAAe,IAAIX,EAAa,QAAQ,IAAI,CAAC,EACnD,GAAIW,EAAa,OAAO,EAAG,CACzB,IAAMC,EAAQD,EAAa,KAAK,EAChC,GAAIC,EACF,OAAOA,EAAM,OAAS,IAE1B,CACF,MAAgB,CAEhB,CAGF,OAAO,IACT,CACF,CAAC,EAGD,OAAO,QAAQ,uBAAyBf,GACxC,OAAO,QAAQ,iBAAmBC,GAGlC,OAAO,QAAQ,KAAO",
4
+ "sourcesContent": ["/**\n * Shared componentsConfig schema for FrontFriend tools.\n *\n * The schema defines the canonical per-component envelope used by ffdc,\n * validation scripts, migration tooling, and registry completeness checks.\n * Keep this file as the single source of truth; consumers should re-export it\n * instead of maintaining local schema copies.\n */\n\nconst classValueSchema = {\n anyOf: [\n { type: 'string' },\n { type: 'number' },\n { type: 'boolean' },\n { type: 'null' },\n ],\n};\n\nconst componentsConfigSchema = {\n $id: 'https://frontfriend.dev/schemas/components-config.schema.json',\n type: 'object',\n // A component is a bare class string (e.g. spinner: \"animate-spin\") or a\n // strict envelope.\n additionalProperties: {\n anyOf: [{ $ref: '#/$defs/classValue' }, { $ref: '#/$defs/componentEnvelope' }],\n },\n $defs: {\n classValue: classValueSchema,\n\n // Permissive recursive tree used INSIDE `slots` and for `root`: leaves are\n // class values, objects nest freely. Slot internals are NOT namespaced\n // again (slots live at the component top level only), so e.g.\n // `slots.trigger.icon` and `slots.list.line` stay as plain nested keys.\n slotValue: {\n anyOf: [\n { $ref: '#/$defs/classValue' },\n { type: 'object', additionalProperties: { $ref: '#/$defs/slotValue' } },\n ],\n },\n\n // Variant / prop buckets: a class-value leaf or a (possibly nested) map.\n reservedBucket: {\n anyOf: [\n { $ref: '#/$defs/classValue' },\n { type: 'object', additionalProperties: { $ref: '#/$defs/slotValue' } },\n ],\n },\n\n // STRICT canonical v4 envelope: a fixed set of reserved buckets plus a\n // single `slots` namespace holding every named child slot.\n // `additionalProperties: false` is what standardizes the shape \u2014 any stray\n // top-level key (a slot left outside `slots`, a typo) is rejected.\n componentEnvelope: {\n type: 'object',\n additionalProperties: false,\n properties: {\n // Root classes for the component. Usually a class string; some\n // components (e.g. sidebar) nest a sub-tree under root.\n root: { $ref: '#/$defs/slotValue' },\n\n // Canonical variant buckets (variants.variant, variants.size, \u2026) plus\n // the flat compatibility aliases.\n variants: { type: 'object', additionalProperties: { $ref: '#/$defs/reservedBucket' } },\n variant: { $ref: '#/$defs/reservedBucket' },\n size: { $ref: '#/$defs/reservedBucket' },\n sizes: { $ref: '#/$defs/reservedBucket' },\n iconPosition: { $ref: '#/$defs/reservedBucket' },\n icons: { $ref: '#/$defs/reservedBucket' },\n color: { $ref: '#/$defs/reservedBucket' },\n fullwidth: { $ref: '#/$defs/reservedBucket' },\n states: { $ref: '#/$defs/reservedBucket' },\n compoundVariants: { $ref: '#/$defs/reservedBucket' },\n defaultVariants: { $ref: '#/$defs/reservedBucket' },\n props: { $ref: '#/$defs/reservedBucket' },\n\n // All named child slots (item, trigger, content, icon, menu, \u2026) live\n // here. Top-level only \u2014 slot internals stay direct.\n slots: { type: 'object', additionalProperties: { $ref: '#/$defs/slotValue' } },\n },\n },\n },\n};\n\nfunction isCSSClassString(value) {\n if (typeof value !== 'string') return false;\n\n if (value.trim().length === 0) return false;\n\n if (/^[0-9]+(?:\\.[0-9]+)?$/.test(value)) return false;\n\n if (value === 'true' || value === 'false') return false;\n\n const hasSpaces = /\\s/.test(value);\n const hasTailwindSyntax = /[-:\\[\\]\\/]/.test(value);\n\n if (hasSpaces || hasTailwindSyntax) return true;\n\n return true;\n}\n\nmodule.exports = {\n componentsConfigSchema,\n isCSSClassString,\n};\n", "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 plain text content to a file\n * @param {string} filepath - Path to write the file\n * @param {string} content - Text content to write\n */\nfunction writeTextFile(filepath, content) {\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 writeTextFile,\n writeModuleExportsFile,\n fileExists,\n ensureDirectoryExists,\n removeDirectory\n};\n", "{\n \"name\": \"dotenv\",\n \"version\": \"16.6.1\",\n \"description\": \"Loads environment variables from .env file\",\n \"main\": \"lib/main.js\",\n \"types\": \"lib/main.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./lib/main.d.ts\",\n \"require\": \"./lib/main.js\",\n \"default\": \"./lib/main.js\"\n },\n \"./config\": \"./config.js\",\n \"./config.js\": \"./config.js\",\n \"./lib/env-options\": \"./lib/env-options.js\",\n \"./lib/env-options.js\": \"./lib/env-options.js\",\n \"./lib/cli-options\": \"./lib/cli-options.js\",\n \"./lib/cli-options.js\": \"./lib/cli-options.js\",\n \"./package.json\": \"./package.json\"\n },\n \"scripts\": {\n \"dts-check\": \"tsc --project tests/types/tsconfig.json\",\n \"lint\": \"standard\",\n \"pretest\": \"npm run lint && npm run dts-check\",\n \"test\": \"tap run --allow-empty-coverage --disable-coverage --timeout=60000\",\n \"test:coverage\": \"tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov\",\n \"prerelease\": \"npm test\",\n \"release\": \"standard-version\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git://github.com/motdotla/dotenv.git\"\n },\n \"homepage\": \"https://github.com/motdotla/dotenv#readme\",\n \"funding\": \"https://dotenvx.com\",\n \"keywords\": [\n \"dotenv\",\n \"env\",\n \".env\",\n \"environment\",\n \"variables\",\n \"config\",\n \"settings\"\n ],\n \"readmeFilename\": \"README.md\",\n \"license\": \"BSD-2-Clause\",\n \"devDependencies\": {\n \"@types/node\": \"^18.11.3\",\n \"decache\": \"^4.6.2\",\n \"sinon\": \"^14.0.1\",\n \"standard\": \"^17.0.0\",\n \"standard-version\": \"^9.5.0\",\n \"tap\": \"^19.2.0\",\n \"typescript\": \"^4.8.4\"\n },\n \"engines\": {\n \"node\": \">=12\"\n },\n \"browser\": {\n \"fs\": false\n }\n}\n", "const fs = require('fs')\nconst path = require('path')\nconst os = require('os')\nconst crypto = require('crypto')\nconst packageJson = require('../package.json')\n\nconst version = packageJson.version\n\nconst LINE = /(?:^|^)\\s*(?:export\\s+)?([\\w.-]+)(?:\\s*=\\s*?|:\\s+?)(\\s*'(?:\\\\'|[^'])*'|\\s*\"(?:\\\\\"|[^\"])*\"|\\s*`(?:\\\\`|[^`])*`|[^#\\r\\n]+)?\\s*(?:#.*)?(?:$|$)/mg\n\n// Parse src into an Object\nfunction parse (src) {\n const obj = {}\n\n // Convert buffer to string\n let lines = src.toString()\n\n // Convert line breaks to same format\n lines = lines.replace(/\\r\\n?/mg, '\\n')\n\n let match\n while ((match = LINE.exec(lines)) != null) {\n const key = match[1]\n\n // Default undefined or null to empty string\n let value = (match[2] || '')\n\n // Remove whitespace\n value = value.trim()\n\n // Check if double quoted\n const maybeQuote = value[0]\n\n // Remove surrounding quotes\n value = value.replace(/^(['\"`])([\\s\\S]*)\\1$/mg, '$2')\n\n // Expand newlines if double quoted\n if (maybeQuote === '\"') {\n value = value.replace(/\\\\n/g, '\\n')\n value = value.replace(/\\\\r/g, '\\r')\n }\n\n // Add to object\n obj[key] = value\n }\n\n return obj\n}\n\nfunction _parseVault (options) {\n options = options || {}\n\n const vaultPath = _vaultPath(options)\n options.path = vaultPath // parse .env.vault\n const result = DotenvModule.configDotenv(options)\n if (!result.parsed) {\n const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`)\n err.code = 'MISSING_DATA'\n throw err\n }\n\n // handle scenario for comma separated keys - for use with key rotation\n // example: DOTENV_KEY=\"dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenvx.com/vault/.env.vault?environment=prod\"\n const keys = _dotenvKey(options).split(',')\n const length = keys.length\n\n let decrypted\n for (let i = 0; i < length; i++) {\n try {\n // Get full key\n const key = keys[i].trim()\n\n // Get instructions for decrypt\n const attrs = _instructions(result, key)\n\n // Decrypt\n decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key)\n\n break\n } catch (error) {\n // last key\n if (i + 1 >= length) {\n throw error\n }\n // try next key\n }\n }\n\n // Parse decrypted .env string\n return DotenvModule.parse(decrypted)\n}\n\nfunction _warn (message) {\n console.log(`[dotenv@${version}][WARN] ${message}`)\n}\n\nfunction _debug (message) {\n console.log(`[dotenv@${version}][DEBUG] ${message}`)\n}\n\nfunction _log (message) {\n console.log(`[dotenv@${version}] ${message}`)\n}\n\nfunction _dotenvKey (options) {\n // prioritize developer directly setting options.DOTENV_KEY\n if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {\n return options.DOTENV_KEY\n }\n\n // secondary infra already contains a DOTENV_KEY environment variable\n if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {\n return process.env.DOTENV_KEY\n }\n\n // fallback to empty string\n return ''\n}\n\nfunction _instructions (result, dotenvKey) {\n // Parse DOTENV_KEY. Format is a URI\n let uri\n try {\n uri = new URL(dotenvKey)\n } catch (error) {\n if (error.code === 'ERR_INVALID_URL') {\n const err = new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n }\n\n throw error\n }\n\n // Get decrypt key\n const key = uri.password\n if (!key) {\n const err = new Error('INVALID_DOTENV_KEY: Missing key part')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n }\n\n // Get environment\n const environment = uri.searchParams.get('environment')\n if (!environment) {\n const err = new Error('INVALID_DOTENV_KEY: Missing environment part')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n }\n\n // Get ciphertext payload\n const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`\n const ciphertext = result.parsed[environmentKey] // DOTENV_VAULT_PRODUCTION\n if (!ciphertext) {\n const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`)\n err.code = 'NOT_FOUND_DOTENV_ENVIRONMENT'\n throw err\n }\n\n return { ciphertext, key }\n}\n\nfunction _vaultPath (options) {\n let possibleVaultPath = null\n\n if (options && options.path && options.path.length > 0) {\n if (Array.isArray(options.path)) {\n for (const filepath of options.path) {\n if (fs.existsSync(filepath)) {\n possibleVaultPath = filepath.endsWith('.vault') ? filepath : `${filepath}.vault`\n }\n }\n } else {\n possibleVaultPath = options.path.endsWith('.vault') ? options.path : `${options.path}.vault`\n }\n } else {\n possibleVaultPath = path.resolve(process.cwd(), '.env.vault')\n }\n\n if (fs.existsSync(possibleVaultPath)) {\n return possibleVaultPath\n }\n\n return null\n}\n\nfunction _resolveHome (envPath) {\n return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath\n}\n\nfunction _configVault (options) {\n const debug = Boolean(options && options.debug)\n const quiet = options && 'quiet' in options ? options.quiet : true\n\n if (debug || !quiet) {\n _log('Loading env from encrypted .env.vault')\n }\n\n const parsed = DotenvModule._parseVault(options)\n\n let processEnv = process.env\n if (options && options.processEnv != null) {\n processEnv = options.processEnv\n }\n\n DotenvModule.populate(processEnv, parsed, options)\n\n return { parsed }\n}\n\nfunction configDotenv (options) {\n const dotenvPath = path.resolve(process.cwd(), '.env')\n let encoding = 'utf8'\n const debug = Boolean(options && options.debug)\n const quiet = options && 'quiet' in options ? options.quiet : true\n\n if (options && options.encoding) {\n encoding = options.encoding\n } else {\n if (debug) {\n _debug('No encoding is specified. UTF-8 is used by default')\n }\n }\n\n let optionPaths = [dotenvPath] // default, look for .env\n if (options && options.path) {\n if (!Array.isArray(options.path)) {\n optionPaths = [_resolveHome(options.path)]\n } else {\n optionPaths = [] // reset default\n for (const filepath of options.path) {\n optionPaths.push(_resolveHome(filepath))\n }\n }\n }\n\n // Build the parsed data in a temporary object (because we need to return it). Once we have the final\n // parsed data, we will combine it with process.env (or options.processEnv if provided).\n let lastError\n const parsedAll = {}\n for (const path of optionPaths) {\n try {\n // Specifying an encoding returns a string instead of a buffer\n const parsed = DotenvModule.parse(fs.readFileSync(path, { encoding }))\n\n DotenvModule.populate(parsedAll, parsed, options)\n } catch (e) {\n if (debug) {\n _debug(`Failed to load ${path} ${e.message}`)\n }\n lastError = e\n }\n }\n\n let processEnv = process.env\n if (options && options.processEnv != null) {\n processEnv = options.processEnv\n }\n\n DotenvModule.populate(processEnv, parsedAll, options)\n\n if (debug || !quiet) {\n const keysCount = Object.keys(parsedAll).length\n const shortPaths = []\n for (const filePath of optionPaths) {\n try {\n const relative = path.relative(process.cwd(), filePath)\n shortPaths.push(relative)\n } catch (e) {\n if (debug) {\n _debug(`Failed to load ${filePath} ${e.message}`)\n }\n lastError = e\n }\n }\n\n _log(`injecting env (${keysCount}) from ${shortPaths.join(',')}`)\n }\n\n if (lastError) {\n return { parsed: parsedAll, error: lastError }\n } else {\n return { parsed: parsedAll }\n }\n}\n\n// Populates process.env from .env file\nfunction config (options) {\n // fallback to original dotenv if DOTENV_KEY is not set\n if (_dotenvKey(options).length === 0) {\n return DotenvModule.configDotenv(options)\n }\n\n const vaultPath = _vaultPath(options)\n\n // dotenvKey exists but .env.vault file does not exist\n if (!vaultPath) {\n _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`)\n\n return DotenvModule.configDotenv(options)\n }\n\n return DotenvModule._configVault(options)\n}\n\nfunction decrypt (encrypted, keyStr) {\n const key = Buffer.from(keyStr.slice(-64), 'hex')\n let ciphertext = Buffer.from(encrypted, 'base64')\n\n const nonce = ciphertext.subarray(0, 12)\n const authTag = ciphertext.subarray(-16)\n ciphertext = ciphertext.subarray(12, -16)\n\n try {\n const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce)\n aesgcm.setAuthTag(authTag)\n return `${aesgcm.update(ciphertext)}${aesgcm.final()}`\n } catch (error) {\n const isRange = error instanceof RangeError\n const invalidKeyLength = error.message === 'Invalid key length'\n const decryptionFailed = error.message === 'Unsupported state or unable to authenticate data'\n\n if (isRange || invalidKeyLength) {\n const err = new Error('INVALID_DOTENV_KEY: It must be 64 characters long (or more)')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n } else if (decryptionFailed) {\n const err = new Error('DECRYPTION_FAILED: Please check your DOTENV_KEY')\n err.code = 'DECRYPTION_FAILED'\n throw err\n } else {\n throw error\n }\n }\n}\n\n// Populate process.env with parsed values\nfunction populate (processEnv, parsed, options = {}) {\n const debug = Boolean(options && options.debug)\n const override = Boolean(options && options.override)\n\n if (typeof parsed !== 'object') {\n const err = new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate')\n err.code = 'OBJECT_REQUIRED'\n throw err\n }\n\n // Set process.env\n for (const key of Object.keys(parsed)) {\n if (Object.prototype.hasOwnProperty.call(processEnv, key)) {\n if (override === true) {\n processEnv[key] = parsed[key]\n }\n\n if (debug) {\n if (override === true) {\n _debug(`\"${key}\" is already defined and WAS overwritten`)\n } else {\n _debug(`\"${key}\" is already defined and was NOT overwritten`)\n }\n }\n } else {\n processEnv[key] = parsed[key]\n }\n }\n}\n\nconst DotenvModule = {\n configDotenv,\n _configVault,\n _parseVault,\n config,\n decrypt,\n parse,\n populate\n}\n\nmodule.exports.configDotenv = DotenvModule.configDotenv\nmodule.exports._configVault = DotenvModule._configVault\nmodule.exports._parseVault = DotenvModule._parseVault\nmodule.exports.config = DotenvModule.config\nmodule.exports.decrypt = DotenvModule.decrypt\nmodule.exports.parse = DotenvModule.parse\nmodule.exports.populate = DotenvModule.populate\n\nmodule.exports = DotenvModule\n", "const path = require('path');\nconst { fileExists } = require('./file-utils');\n\n/**\n * Load .env.local file if it exists in the current working directory\n * @param {string} cwd - Current working directory (defaults to process.cwd())\n * @returns {boolean} True if .env.local was loaded\n */\nfunction loadEnvLocal(cwd = process.cwd()) {\n const envLocalPath = path.join(cwd, '.env.local');\n \n if (fileExists(envLocalPath)) {\n require('dotenv').config({ path: envLocalPath });\n console.log('\uD83D\uDCC4 Loaded .env.local');\n return true;\n }\n \n return false;\n}\n\n/**\n * Get an environment variable with optional default value\n * @param {string} name - Environment variable name\n * @param {string} defaultValue - Default value if not set\n * @returns {string|undefined} Environment variable value or default\n */\nfunction getEnvVar(name, defaultValue = undefined) {\n return process.env[name] || defaultValue;\n}\n\n/**\n * Check if an environment variable is set to 'true'\n * @param {string} name - Environment variable name\n * @returns {boolean} True if the env var is set to 'true'\n */\nfunction isEnvTrue(name) {\n return process.env[name] === 'true';\n}\n\nmodule.exports = {\n loadEnvLocal,\n getEnvVar,\n isEnvTrue\n};", "// ffdc.js - Simple config accessor\n// No base64 decoding, just returns the config object directly\n\nconst {\n componentsConfigSchema,\n isCSSClassString,\n} = require('./lib/core/components-config-schema');\n\nfunction ffdc(config) {\n if (!config) {\n return {};\n }\n\n if (typeof config !== 'object') {\n throw new Error('Config must be an object');\n }\n\n return config;\n}\n\nffdc.componentsConfigSchema = componentsConfigSchema;\nffdc.isCSSClassString = isCSSClassString;\n\nmodule.exports = ffdc;\n", "const plugin = require('tailwindcss/plugin');\nconst { componentsConfigSchema, isCSSClassString } = require('./lib/core/components-config-schema');\n\n// PostCSS is a peer dependency of Tailwind, so it should be available\n// We'll try to require it, but handle the case where it's not available\nlet postcss;\ntry {\n postcss = require('postcss');\n} catch (e) {\n // PostCSS not available - custom CSS parsing will be disabled\n postcss = null;\n}\n\nlet CacheManager;\nif (typeof window === 'undefined' && typeof process !== 'undefined' && process.versions && process.versions.node) {\n CacheManager = require('./lib/core/cache-manager');\n const { loadEnvLocal } = require('./lib/core/env-utils');\n // Load .env.local if it exists\n loadEnvLocal();\n}\n\nfunction filterDefault(values) {\n return Object.fromEntries(\n Object.entries(values).filter(([key]) => key !== \"DEFAULT\"),\n );\n}\n\nconst pluginExport = plugin.withOptions(\n function (options = {}) {\n return function ({ addBase, addUtilities, theme, matchUtilities }) {\n // 1. Load cache with CacheManager\n if (!CacheManager) {\n // should get cache in browser here\n return;\n }\n\n const cacheManager = new CacheManager(process.cwd());\n\n if (!cacheManager.exists()) {\n console.warn('[FrontFriend] No cache found. Please run \"npx frontfriend init\" first.');\n return;\n }\n\n if (!cacheManager.isValid()) {\n console.warn('[FrontFriend] Cache is expired. Please run \"npx frontfriend init\" to refresh.');\n }\n\n const cache = cacheManager.load();\n if (!cache) {\n console.error('[FrontFriend] Failed to load cache.');\n return;\n }\n\n // 2. Add CSS variables to :root\n const rootVars = {};\n\n // Add color variables\n if (cache.variables) {\n // Wrap HSL values in hsl() function\n for (const [key, value] of Object.entries(cache.variables)) {\n // Check if it's a color variable (contains HSL values)\n if (key.startsWith('--color-') && !value.startsWith('hsl(')) {\n rootVars[key] = `hsl(${value})`;\n } else {\n rootVars[key] = value;\n }\n }\n }\n\n // Add semantic variables (light mode)\n if (cache.semanticVariables) {\n for (const [key, value] of Object.entries(cache.semanticVariables)) {\n // Check if value contains HSL components (e.g., \"206 92% 5% / 0.9\")\n // These need to be wrapped in hsl() function\n if (typeof value === 'string' &&\n !value.startsWith('var(') &&\n !value.startsWith('hsl(') &&\n /^\\d+\\s+\\d+%\\s+\\d+%/.test(value)) {\n rootVars[key] = `hsl(${value})`;\n } else {\n // Semantic variables that point to other variables using var()\n // don't need wrapping\n rootVars[key] = value;\n }\n }\n }\n\n // Add root styles\n addBase({\n ':root': rootVars\n });\n\n // 3. Add dark mode support\n if (cache.semanticDarkVariables && Object.keys(cache.semanticDarkVariables).length > 0) {\n const darkVars = {};\n for (const [key, value] of Object.entries(cache.semanticDarkVariables)) {\n // Check if value contains HSL components\n if (typeof value === 'string' &&\n !value.startsWith('var(') &&\n !value.startsWith('hsl(') &&\n /^\\d+\\s+\\d+%\\s+\\d+%/.test(value)) {\n darkVars[key] = `hsl(${value})`;\n } else {\n darkVars[key] = value;\n }\n }\n\n addBase({\n ':root:not(.light)': darkVars\n });\n addBase({\n ':root:not(.dark)': rootVars\n });\n }\n\n\n // 4. Generate semantic color utilities from semantic variables\n if (cache.semanticVariables) {\n const semanticUtilities = {};\n\n // Process semantic variables into utility classes\n for (const [cssVar] of Object.entries(cache.semanticVariables)) {\n // Convert CSS variable to utility class name\n // --bg-brand-mid-default -> bg-brand-mid\n // --text-brand-strong -> text-brand-strong\n // --border-neutral-subtle-hover -> border-neutral-subtle-hover\n\n const match = cssVar.match(/^--(bg|text|border|layer|overlay|icon)-(.+)$/);\n if (match) {\n const [, prefix, name] = match;\n const className = `.${prefix}-${name}`;\n\n if (prefix === 'bg' || prefix === 'layer' || prefix === 'overlay') {\n semanticUtilities[className] = {\n backgroundColor: `var(${cssVar})`\n };\n } else if (prefix === 'text') {\n semanticUtilities[className] = {\n color: `var(${cssVar})`\n };\n } else if (prefix === 'border') {\n semanticUtilities[className] = {\n borderColor: `var(${cssVar})`\n };\n } else if (prefix === 'icon') {\n // Icon tokens map to both text color and fill\n semanticUtilities[`.text-${prefix}-${name}`] = {\n color: `var(${cssVar})`\n };\n semanticUtilities[`.fill-${prefix}-${name}`] = {\n fill: `var(${cssVar})`\n };\n }\n }\n }\n\n addUtilities(semanticUtilities);\n }\n\n // 5. Generate utilities from tokens (semantic-based utilities)\n if (cache.tokens) {\n // Background colors\n if (cache.tokens.backgroundColor) {\n const bgUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.backgroundColor)) {\n // The value already contains hsl() wrapper from the processor\n bgUtilities[`.bg-${name}`] = {\n backgroundColor: value\n };\n }\n addUtilities(bgUtilities);\n }\n\n // Text colors\n if (cache.tokens.textColor) {\n const textUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.textColor)) {\n textUtilities[`.text-${name}`] = {\n color: value\n };\n }\n addUtilities(textUtilities);\n }\n\n // Border colors\n if (cache.tokens.borderColor) {\n const borderUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.borderColor)) {\n borderUtilities[`.border-${name}`] = {\n borderColor: value\n };\n }\n addUtilities(borderUtilities);\n }\n\n // Fill colors (for SVG icons)\n if (cache.tokens.fill) {\n const fillUtilities = {};\n const textIconUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.fill)) {\n fillUtilities[`.fill-${name}`] = {\n fill: value\n };\n // Also create text-icon utilities for icon color classes\n if (name.startsWith('icon-')) {\n textIconUtilities[`.text-${name}`] = {\n color: value\n };\n }\n }\n addUtilities(fillUtilities);\n addUtilities(textIconUtilities);\n }\n\n // Font family utilities\n if (cache.tokens.fontFamily) {\n const fontUtilities = {};\n for (const [name, value] of Object.entries(cache.tokens.fontFamily)) {\n fontUtilities[`.font-${name}`] = {\n fontFamily: value\n };\n }\n addUtilities(fontUtilities);\n }\n }\n\n // 6. Add font faces\n if (cache.fonts && cache.fonts.length > 0) {\n // Convert font objects to Tailwind-compatible format\n cache.fonts.forEach(fontFace => {\n // Tailwind expects each @font-face as a separate rule\n addBase({\n '@font-face': fontFace\n });\n });\n }\n\n // 7. Add enter/exit animation utilities\n addUtilities({\n \"@keyframes enter\": theme(\"keyframes.enter\"),\n \"@keyframes exit\": theme(\"keyframes.exit\"),\n \".animate-in\": {\n animationName: \"enter\",\n animationDuration: theme(\"animationDuration.DEFAULT\"),\n \"--tw-enter-opacity\": \"initial\",\n \"--tw-enter-scale\": \"initial\",\n \"--tw-enter-rotate\": \"initial\",\n \"--tw-enter-translate-x\": \"initial\",\n \"--tw-enter-translate-y\": \"initial\",\n },\n \".animate-out\": {\n animationName: \"exit\",\n animationDuration: theme(\"animationDuration.DEFAULT\"),\n \"--tw-exit-opacity\": \"initial\",\n \"--tw-exit-scale\": \"initial\",\n \"--tw-exit-rotate\": \"initial\",\n \"--tw-exit-translate-x\": \"initial\",\n \"--tw-exit-translate-y\": \"initial\",\n },\n });\n\n // 10. Add animation match utilities\n matchUtilities(\n {\n \"fade-in\": (value) => ({ \"--tw-enter-opacity\": value }),\n \"fade-out\": (value) => ({ \"--tw-exit-opacity\": value }),\n },\n { values: theme(\"animationOpacity\") }\n );\n\n matchUtilities(\n {\n \"zoom-in\": (value) => ({ \"--tw-enter-scale\": value }),\n \"zoom-out\": (value) => ({ \"--tw-exit-scale\": value }),\n },\n { values: theme(\"animationScale\") }\n );\n\n matchUtilities(\n {\n \"spin-in\": (value) => ({ \"--tw-enter-rotate\": value }),\n \"spin-out\": (value) => ({ \"--tw-exit-rotate\": value }),\n },\n { values: theme(\"animationRotate\") }\n );\n\n matchUtilities(\n {\n \"slide-in-from-top\": (value) => ({\n \"--tw-enter-translate-y\": `-${value}`,\n }),\n \"slide-in-from-bottom\": (value) => ({\n \"--tw-enter-translate-y\": value,\n }),\n \"slide-in-from-left\": (value) => ({\n \"--tw-enter-translate-x\": `-${value}`,\n }),\n \"slide-in-from-right\": (value) => ({\n \"--tw-enter-translate-x\": value,\n }),\n \"slide-out-to-top\": (value) => ({\n \"--tw-exit-translate-y\": `-${value}`,\n }),\n \"slide-out-to-bottom\": (value) => ({\n \"--tw-exit-translate-y\": value,\n }),\n \"slide-out-to-left\": (value) => ({\n \"--tw-exit-translate-x\": `-${value}`,\n }),\n \"slide-out-to-right\": (value) => ({\n \"--tw-exit-translate-x\": value,\n }),\n },\n { values: theme(\"animationTranslate\") }\n );\n\n // 11. Add animation control utilities\n matchUtilities(\n { duration: (value) => ({ animationDuration: value }) },\n { values: filterDefault(theme(\"animationDuration\")) }\n );\n\n matchUtilities(\n { delay: (value) => ({ animationDelay: value }) },\n { values: theme(\"animationDelay\") }\n );\n\n matchUtilities(\n { ease: (value) => ({ animationTimingFunction: value }) },\n { values: filterDefault(theme(\"animationTimingFunction\")) }\n );\n\n addUtilities({\n \".running\": { animationPlayState: \"running\" },\n \".paused\": { animationPlayState: \"paused\" },\n });\n\n // Page main padding utilities (use CSS variables from project's custom.css)\n addUtilities({\n \".px-ff-main\": {\n paddingLeft: \"var(--ff-main-px)\",\n paddingRight: \"var(--ff-main-px)\",\n },\n \".py-ff-main\": {\n paddingTop: \"var(--ff-main-py)\",\n paddingBottom: \"var(--ff-main-py)\",\n },\n \".p-ff-main\": {\n paddingLeft: \"var(--ff-main-px)\",\n paddingRight: \"var(--ff-main-px)\",\n paddingTop: \"var(--ff-main-py)\",\n paddingBottom: \"var(--ff-main-py)\",\n },\n });\n\n matchUtilities(\n { \"fill-mode\": (value) => ({ animationFillMode: value }) },\n { values: theme(\"animationFillMode\") }\n );\n\n matchUtilities(\n { direction: (value) => ({ animationDirection: value }) },\n { values: theme(\"animationDirection\") }\n );\n\n matchUtilities(\n { repeat: (value) => ({ animationIterationCount: value }) },\n { values: theme(\"animationRepeat\") }\n );\n\n // 12. Add custom CSS\n if (cache.custom && cache.custom.raw && typeof cache.custom.raw === 'string') {\n const rawCss = cache.custom.raw.trim();\n\n if (!rawCss) {\n if (options.verbose) {\n console.warn('[FrontFriend] Empty custom CSS');\n }\n return;\n }\n\n // Check if PostCSS is available\n if (!postcss) {\n console.warn('[FrontFriend] PostCSS not available - custom CSS will not be added');\n return;\n }\n\n try {\n // Parse the CSS using PostCSS to get an AST\n const root = postcss.parse(rawCss);\n \n // Split nodes into base and utilities layers\n const baseNodes = [];\n const utilityNodes = [];\n \n root.each((node) => {\n // @keyframes, @font-face, @media, etc. go to base\n if (node.type === 'atrule') {\n // Special handling for @keyframes and other at-rules\n baseNodes.push(node);\n return;\n }\n \n // Regular rules\n if (node.type === 'rule') {\n // Class selectors starting with . go to utilities\n const isClassSelector = \n typeof node.selector === 'string' && \n node.selector.trim().startsWith('.');\n \n if (isClassSelector) {\n utilityNodes.push(node);\n } else {\n // Element selectors, IDs, attribute selectors, etc. go to base\n baseNodes.push(node);\n }\n return;\n }\n \n // Comments and other nodes go to base\n if (node.type !== 'comment') {\n baseNodes.push(node);\n }\n });\n \n // Add nodes to their respective layers\n // Tailwind accepts PostCSS nodes directly\n if (baseNodes.length > 0) {\n addBase(baseNodes);\n }\n \n if (utilityNodes.length > 0) {\n addUtilities(utilityNodes);\n }\n \n if (options.verbose) {\n console.log(`[FrontFriend] Added custom CSS: ${baseNodes.length} base rules, ${utilityNodes.length} utility classes`);\n }\n } catch (error) {\n console.error('[FrontFriend] Failed to parse custom CSS:', error.message);\n // Don't throw - just log the error and continue\n }\n } else if (!cache.custom) {\n // Check if custom.js file exists but failed to load\n const fs = require('fs');\n const path = require('path');\n const customJsPath = path.join(process.cwd(), 'node_modules', '.cache', 'frontfriend', 'custom.js');\n\n if (fs.existsSync(customJsPath)) {\n console.warn('[FrontFriend] custom.js file exists but failed to load. This may be due to a parsing error or BOM issue.');\n console.warn('[FrontFriend] Try deleting node_modules/.cache/frontfriend and running `npx frontfriend init` again.');\n }\n }\n\n // Log success\n if (options.verbose) {\n console.log('[FrontFriend] Plugin loaded successfully');\n console.log(`[FrontFriend] Colors: ${Object.keys(cache.variables || {}).length}`);\n console.log(`[FrontFriend] Semantic vars: ${Object.keys(cache.semanticVariables || {}).length}`);\n console.log(`[FrontFriend] Fonts: ${(cache.fonts || []).length}`);\n console.log(`[FrontFriend] Safelist classes: ${Array.isArray(cache.safelist) ? cache.safelist.length : 0}`);\n }\n };\n },\n function (options = {}) {\n // Return theme configuration\n let cache = null;\n if (CacheManager) {\n const cacheManager = new CacheManager(process.cwd());\n cache = cacheManager.exists() ? cacheManager.load() : null;\n }\n\n // Default content paths matching the current-plugin approach\n const defaultContent = [\n './pages/**/*.{js,ts,jsx,tsx}',\n './components/**/*.{js,ts,jsx,tsx}',\n './app/**/*.{js,ts,jsx,tsx}',\n './src/**/*.{js,ts,jsx,tsx}',\n './stories/**/*.{js,ts,jsx,tsx}'\n ];\n\n // Log cache loading\n if (options.verbose && cache) {\n console.log('[FrontFriend] Cache loaded successfully');\n if (cache.safelist && Array.isArray(cache.safelist)) {\n console.log(`[FrontFriend] Loading ${cache.safelist.length} classes for safelist`);\n }\n }\n\n return {\n theme: {\n extend: {\n // Extend colors if needed\n colors: options.extendColors || {},\n // Extend animations if needed\n animation: options.extendAnimations || {},\n // Add custom spacing values\n spacing: {\n '18': '4.5rem',\n '88': '22rem',\n '128': '32rem'\n },\n // Add custom box shadows\n boxShadow: {\n 'top-sm': '0 -1px 1px 0 rgba(0, 0, 0, 0.05)'\n },\n // Add border radius values\n borderRadius: {\n '2xl': '1rem'\n },\n // Animation extensions\n animationDelay: ({ theme }) => ({\n ...theme(\"transitionDelay\"),\n }),\n animationDuration: ({ theme }) => ({\n 0: \"0ms\",\n ...theme(\"transitionDuration\"),\n }),\n animationTimingFunction: ({ theme }) => ({\n ...theme(\"transitionTimingFunction\"),\n }),\n animationFillMode: {\n none: \"none\",\n forwards: \"forwards\",\n backwards: \"backwards\",\n both: \"both\",\n },\n animationDirection: {\n normal: \"normal\",\n reverse: \"reverse\",\n alternate: \"alternate\",\n \"alternate-reverse\": \"alternate-reverse\",\n },\n animationOpacity: ({ theme }) => ({\n DEFAULT: 0,\n ...theme(\"opacity\"),\n }),\n animationTranslate: ({ theme }) => ({\n DEFAULT: \"100%\",\n ...theme(\"translate\"),\n }),\n animationScale: ({ theme }) => ({\n DEFAULT: 0,\n ...theme(\"scale\"),\n }),\n animationRotate: ({ theme }) => ({\n DEFAULT: \"30deg\",\n ...theme(\"rotate\"),\n }),\n animationRepeat: {\n 0: \"0\",\n 1: \"1\",\n infinite: \"infinite\",\n },\n keyframes: {\n enter: {\n from: {\n opacity: \"var(--tw-enter-opacity, 1)\",\n transform:\n \"translate3d(var(--tw-enter-translate-x, 0), var(--tw-enter-translate-y, 0), 0) scale3d(var(--tw-enter-scale, 1), var(--tw-enter-scale, 1), var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))\",\n },\n },\n exit: {\n to: {\n opacity: \"var(--tw-exit-opacity, 1)\",\n transform:\n \"translate3d(var(--tw-exit-translate-x, 0), var(--tw-exit-translate-y, 0), 0) scale3d(var(--tw-exit-scale, 1), var(--tw-exit-scale, 1), var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))\",\n },\n },\n },\n }\n },\n // Include safelist from cache and additional classes\n // Filter out file: variant classes \u2014 chaining file-selector-button with other\n // pseudo-elements (e.g. ::placeholder) produces invalid CSS that crashes Turbopack.\n safelist: [\n ...(cache?.safelist || []).filter(s => typeof s !== 'string' || !s.startsWith('file:')),\n {\n pattern: /(text|fill)-icon-(neutral|positive|negative|warning|info|highlight|interactive|brand|inverse|onpositive|onnegative|onwarning|oninfo|onhighlight|oninteractive|onbrand)-(mid|strong|subtle|low)(-(neutral|hover|active|selected|disabled))?$/,\n },\n {\n pattern: /^(layer-(below|surface|raised|popover|dialog|control)|overlay-(mid|strong|subtle|low))$/,\n },\n ],\n // Set content paths - merge options with defaults\n content: options.content || defaultContent\n };\n }\n);\n\n// Default export is the plugin\nmodule.exports = pluginExport;\n\n// Export components config and icons with getter functions\n// This allows dynamic resolution at runtime\n\n// Create getter for config\nObject.defineProperty(module.exports, 'config', {\n get: function () {\n // Check for webpack-injected global variable\n if (typeof __FF_CONFIG__ !== 'undefined') {\n return __FF_CONFIG__;\n }\n\n // Check if we're in a browser environment\n if (typeof window !== 'undefined' && window.__FF_CONFIG__) {\n return window.__FF_CONFIG__;\n }\n\n // Node.js: load from cache\n if (CacheManager) {\n try {\n const cacheManager = new CacheManager(process.cwd());\n if (cacheManager.exists()) {\n const cache = cacheManager.load();\n if (cache) {\n return cache.componentsConfig || null;\n }\n }\n } catch (error) {\n // Config not available\n }\n }\n\n return null;\n }\n});\n\n// Create getter for iconSet\nObject.defineProperty(module.exports, 'iconSet', {\n get: function () {\n // Check for webpack-injected global variable\n if (typeof __FF_ICONS__ !== 'undefined') {\n return __FF_ICONS__;\n }\n\n // Check if we're in a browser environment\n if (typeof window !== 'undefined' && window.__FF_ICONS__) {\n return window.__FF_ICONS__;\n }\n\n // Node.js: load from cache\n if (CacheManager) {\n try {\n const cacheManager = new CacheManager(process.cwd());\n if (cacheManager.exists()) {\n const cache = cacheManager.load();\n if (cache) {\n return cache.icons || null;\n }\n }\n } catch (error) {\n // Icons not available\n }\n }\n\n return null;\n }\n});\n\n// Export shared componentsConfig schema utilities\nmodule.exports.componentsConfigSchema = componentsConfigSchema;\nmodule.exports.isCSSClassString = isCSSClassString;\n\n// Export ffdc utility\nmodule.exports.ffdc = require('./ffdc.js');"],
5
+ "mappings": "8DAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,IAAA,CASA,IAAMC,EAAmB,CACvB,MAAO,CACL,CAAE,KAAM,QAAS,EACjB,CAAE,KAAM,QAAS,EACjB,CAAE,KAAM,SAAU,EAClB,CAAE,KAAM,MAAO,CACjB,CACF,EAEMC,EAAyB,CAC7B,IAAK,gEACL,KAAM,SAGN,qBAAsB,CACpB,MAAO,CAAC,CAAE,KAAM,oBAAqB,EAAG,CAAE,KAAM,2BAA4B,CAAC,CAC/E,EACA,MAAO,CACL,WAAYD,EAMZ,UAAW,CACT,MAAO,CACL,CAAE,KAAM,oBAAqB,EAC7B,CAAE,KAAM,SAAU,qBAAsB,CAAE,KAAM,mBAAoB,CAAE,CACxE,CACF,EAGA,eAAgB,CACd,MAAO,CACL,CAAE,KAAM,oBAAqB,EAC7B,CAAE,KAAM,SAAU,qBAAsB,CAAE,KAAM,mBAAoB,CAAE,CACxE,CACF,EAMA,kBAAmB,CACjB,KAAM,SACN,qBAAsB,GACtB,WAAY,CAGV,KAAM,CAAE,KAAM,mBAAoB,EAIlC,SAAU,CAAE,KAAM,SAAU,qBAAsB,CAAE,KAAM,wBAAyB,CAAE,EACrF,QAAS,CAAE,KAAM,wBAAyB,EAC1C,KAAM,CAAE,KAAM,wBAAyB,EACvC,MAAO,CAAE,KAAM,wBAAyB,EACxC,aAAc,CAAE,KAAM,wBAAyB,EAC/C,MAAO,CAAE,KAAM,wBAAyB,EACxC,MAAO,CAAE,KAAM,wBAAyB,EACxC,UAAW,CAAE,KAAM,wBAAyB,EAC5C,OAAQ,CAAE,KAAM,wBAAyB,EACz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,yFACX,CACF,EAEA,QAAShC,EAAQ,SAAW+B,CAC9B,CACF,CACF,EAGA,OAAO,QAAUhC,GAMjB,OAAO,eAAe,OAAO,QAAS,SAAU,CAC9C,IAAK,UAAY,CAEf,GAAI,OAAO,cAAkB,IAC3B,OAAO,cAIT,GAAI,OAAO,OAAW,KAAe,OAAO,cAC1C,OAAO,OAAO,cAIhB,GAAIL,EACF,GAAI,CACF,IAAMW,EAAe,IAAIX,EAAa,QAAQ,IAAI,CAAC,EACnD,GAAIW,EAAa,OAAO,EAAG,CACzB,IAAMC,EAAQD,EAAa,KAAK,EAChC,GAAIC,EACF,OAAOA,EAAM,kBAAoB,IAErC,CACF,MAAgB,CAEhB,CAGF,OAAO,IACT,CACF,CAAC,EAGD,OAAO,eAAe,OAAO,QAAS,UAAW,CAC/C,IAAK,UAAY,CAEf,GAAI,OAAO,aAAiB,IAC1B,OAAO,aAIT,GAAI,OAAO,OAAW,KAAe,OAAO,aAC1C,OAAO,OAAO,aAIhB,GAAIZ,EACF,GAAI,CACF,IAAMW,EAAe,IAAIX,EAAa,QAAQ,IAAI,CAAC,EACnD,GAAIW,EAAa,OAAO,EAAG,CACzB,IAAMC,EAAQD,EAAa,KAAK,EAChC,GAAIC,EACF,OAAOA,EAAM,OAAS,IAE1B,CACF,MAAgB,CAEhB,CAGF,OAAO,IACT,CACF,CAAC,EAGD,OAAO,QAAQ,uBAAyBf,GACxC,OAAO,QAAQ,iBAAmBC,GAGlC,OAAO,QAAQ,KAAO",
6
6
  "names": ["require_components_config_schema", "__commonJSMin", "exports", "module", "classValueSchema", "componentsConfigSchema", "isCSSClassString", "value", "hasSpaces", "hasTailwindSyntax", "require_file_utils", "__commonJSMin", "exports", "module", "fs", "readJsonFileSafe", "filepath", "content", "error", "readFileSafe", "writeJsonFile", "data", "indent", "writeTextFile", "writeModuleExportsFile", "fileExists", "ensureDirectoryExists", "dirpath", "removeDirectory", "require_package", "__commonJSMin", "exports", "module", "require_main", "__commonJSMin", "exports", "module", "fs", "path", "os", "crypto", "packageJson", "version", "LINE", "parse", "src", "obj", "lines", "match", "key", "value", "maybeQuote", "_parseVault", "options", "vaultPath", "_vaultPath", "result", "DotenvModule", "err", "keys", "_dotenvKey", "length", "decrypted", "i", "attrs", "_instructions", "error", "_warn", "message", "_debug", "_log", "dotenvKey", "uri", "environment", "environmentKey", "ciphertext", "possibleVaultPath", "filepath", "_resolveHome", "envPath", "_configVault", "debug", "quiet", "parsed", "processEnv", "configDotenv", "dotenvPath", "encoding", "optionPaths", "lastError", "parsedAll", "e", "keysCount", "shortPaths", "filePath", "relative", "config", "decrypt", "encrypted", "keyStr", "nonce", "authTag", "aesgcm", "isRange", "invalidKeyLength", "decryptionFailed", "populate", "override", "require_env_utils", "__commonJSMin", "exports", "module", "path", "fileExists", "loadEnvLocal", "cwd", "envLocalPath", "getEnvVar", "name", "defaultValue", "isEnvTrue", "require_ffdc", "__commonJSMin", "exports", "module", "componentsConfigSchema", "isCSSClassString", "ffdc", "config", "plugin", "componentsConfigSchema", "isCSSClassString", "postcss", "CacheManager", "loadEnvLocal", "filterDefault", "values", "key", "pluginExport", "options", "addBase", "addUtilities", "theme", "matchUtilities", "cacheManager", "cache", "rootVars", "value", "darkVars", "semanticUtilities", "cssVar", "match", "prefix", "name", "className", "bgUtilities", "textUtilities", "borderUtilities", "fillUtilities", "textIconUtilities", "fontUtilities", "fontFace", "rawCss", "root", "baseNodes", "utilityNodes", "node", "error", "fs", "customJsPath", "defaultContent", "s"]
7
7
  }
@@ -1,4 +1,4 @@
1
- var $=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var D=$((et,Z)=>{var ke="https://app.frontfriend.dev",ve="https://registry-legacy.frontfriend.dev",Te=".cache/frontfriend",je={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"]},Pe={FF_ID:"FF_ID",FF_API_URL:"FF_API_URL",FF_USE_LOCAL:"FF_USE_LOCAL",FF_AUTH_TOKEN:"FF_AUTH_TOKEN"};Z.exports={DEFAULT_API_URL:ke,LEGACY_API_URL:ve,CACHE_DIR_NAME:Te,CACHE_TTL_DAYS:7,CACHE_TTL_MS:6048e5,CACHE_FILES:je,ENV_VARS:Pe}});var te=$((tt,ee)=>{var I=class extends Error{constructor(e,t,n){super(e),this.name="APIError",this.statusCode=t,this.url=n,this.code=`API_${t}`}},L=class extends Error{constructor(e,t){super(e),this.name="CacheError",this.operation=t,this.code=`CACHE_${t.toUpperCase()}`}},b=class extends Error{constructor(e,t){super(e),this.name="ConfigError",this.field=t,this.code=t?`CONFIG_${String(t).toUpperCase()}`:"CONFIG_ERROR"}},M=class extends Error{constructor(e,t){super(e),this.name="ProcessingError",this.token=t,this.code="PROCESSING_ERROR"}};ee.exports={APIError:I,CacheError:L,ConfigError:b,ProcessingError:M}});var x=$((st,se)=>{var w=require("fs");function Ue(r){try{let e=w.readFileSync(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}function _e(r){try{return w.readFileSync(r,"utf8").replace(/^\uFEFF/,"")}catch(e){if(e.code==="ENOENT")return null;throw e}}function Ae(r,e,t=2){let n=JSON.stringify(e,null,t);w.writeFileSync(r,n,"utf8")}function Se(r,e){w.writeFileSync(r,e,"utf8")}function De(r,e){if(e==null||typeof e=="object"&&Object.keys(e).length===0||Array.isArray(e)&&e.length===0){let n=`module.exports = ${Array.isArray(e)?"[]":"{}"};`;w.writeFileSync(r,n,"utf8")}else{let t=`module.exports = ${JSON.stringify(e,null,2)};`;w.writeFileSync(r,t,"utf8")}}function Ie(r){return w.existsSync(r)}function Le(r){w.mkdirSync(r,{recursive:!0})}function be(r){w.rmSync(r,{recursive:!0,force:!0})}se.exports={readJsonFileSafe:Ue,readFileSafe:_e,writeJsonFile:Ae,writeTextFile:Se,writeModuleExportsFile:De,fileExists:Ie,ensureDirectoryExists:Le,removeDirectory:be}});var re=$((nt,ne)=>{var C=require("path"),{fileExists:G}=x();function Me(r,e=process.cwd()){let t=e;for(;t!==C.parse(t).root;){let n=C.join(t,r);if(G(n))return n;t=C.dirname(t)}return null}function xe(r,e=process.cwd(),t=null){let n=[],s=e,i=10;for(let o=0;o<i;o++){n.push(C.join(s,r)),o<3&&n.push(C.join(s,"../".repeat(o+1)+r));let l=C.dirname(s);if(l===s)break;s=l}n.push(C.join(__dirname,"../../../",r));for(let o of n)if(G(o)&&(!t||t(o)))return o;return null}function Ge(r,e=process.cwd()){let t=r.map(n=>C.isAbsolute(n)?n:C.join(e,n));for(let n of t)if(G(n))return n;return null}ne.exports={findFileUpward:Me,findDirectoryUpward:xe,findDirectoryWithPaths:Ge}});var ce=$((rt,ae)=>{var p=require("path"),{findDirectoryUpward:oe}=re(),{readJsonFileSafe:F,readFileSafe:ie,fileExists:O}=x(),J=class{constructor(e,t={}){if(this.ffId=e,this.tokensBasePath=t.tokensBasePath||this.findTokensPath(),this.folderMap=this.loadFolderMap(),this.projectFolder=this.folderMap[e],!this.projectFolder)throw new Error(`No folder mapping found for ff-id: ${e}`);this.projectPath=p.join(this.tokensBasePath,this.projectFolder)}findTokensPath(){let e=oe("apps/tokens",process.cwd(),t=>O(p.join(t,"folderMap.json")));if(e||(e=oe("tokens",process.cwd(),t=>O(p.join(t,"folderMap.json")))),!e)throw new Error("Could not find tokens directory with folderMap.json");return e}loadFolderMap(){let e=p.join(this.tokensBasePath,"folderMap.json"),t=F(e);if(!t)throw new Error("Failed to load folderMap.json: File not found");return t}async fetchTokens(){let e=p.join(this.projectPath,"figma"),t={global:[p.join(e,"Global Tokens","Default.json"),p.join(e,"global.json")],colors:[p.join(e,"Global Colors","Default.json"),p.join(e,"Global Colors","Light.json")],semantic:[p.join(e,"Semantic","Light.json"),p.join(e,"Semantic","Default.json")],semanticDark:[p.join(e,"Semantic","Dark.json")]},n={};for(let[s,i]of Object.entries(t)){for(let o of i){let l=F(o);if(l!==null){n[s]=l;break}}n[s]||(n[s]=null)}return n}async fetchProcessedTokens(){let e=p.join(this.projectPath,"cache");if(!O(e))return null;let t=o=>{if(o===null)return null;let l={},c={exports:l};return new Function("module","exports",o)(c,l),c.exports},n={tokens:{fileName:"hashedTokens.js",type:"module"},variables:{fileName:"hashedVariables.js",type:"module"},semanticVariables:{fileName:"hashedSemanticVariables.js",type:"module"},semanticDarkVariables:{fileName:"hashedSemanticDarkVariables.js",type:"module"},safelist:{fileName:"safelist.js",type:"module"},custom:{fileName:"custom.js",type:"module"},fonts:{fileName:"fonts.json",type:"json"},icons:{fileName:"icons.json",type:"json"},componentsConfig:{fileName:"encoded-config.json",type:"json"},version:{fileName:"version.json",type:"json"}},s={};for(let[o,{fileName:l,type:c}]of Object.entries(n)){let a=p.join(e,l),d=c==="module"?t(ie(a)):F(a);d!==null&&(s[o]=d)}return Object.values(s).some(o=>o!==null)?s:null}async fetchComponentsConfig(){return F(p.join(this.projectPath,"components-config.json"))}async fetchFonts(){return F(p.join(this.projectPath,"font.json"))}async fetchIcons(){return F(p.join(this.projectPath,"icons.json"))}async fetchVersion(){return F(p.join(this.projectPath,"version.json"))}async fetchCustomCss(){return ie(p.join(this.projectPath,"custom.css"))}async fetchPlanMetadata(){return F(p.join(this.projectPath,"metadata.json"))||{planType:"full",allowedComponents:null}}fetchJson(){throw new Error("fetchJson is not implemented in LocalTokenReader. Use specific fetch methods.")}fetchRaw(){throw new Error("fetchRaw is not implemented in LocalTokenReader. Use specific fetch methods.")}};ae.exports={LocalTokenReader:J}});var we=$((ot,me)=>{var E=require("fs"),le=require("path"),Oe=require("os"),Je=require("https"),Ne=require("http"),{URL:qe}=require("url"),{DEFAULT_API_URL:de}=D(),he=le.join(Oe.homedir(),".frontfriend"),R=le.join(he,"credentials");function Be(){return R}function fe(){try{return E.existsSync(R)?JSON.parse(E.readFileSync(R,"utf8")):null}catch{return null}}function ue(r){E.mkdirSync(he,{recursive:!0,mode:448}),E.writeFileSync(R,`${JSON.stringify(r,null,2)}
2
- `,{mode:384});try{E.chmodSync(R,384)}catch{}}function Ve(){return E.existsSync(R)?(E.unlinkSync(R),!0):!1}function pe(r,e=60*1e3){return!(r!=null&&r.accessToken)||!r.expiresAt||Date.now()+e>=r.expiresAt}function U(r){let e=new Error(`${r}. Run \`frontfriend login\` to re-authenticate.`);return e.code="FF_AUTH_REFRESH_FAILED",e}function ge(r,e,t){return new Promise((n,s)=>{let i=new qe(r),o=i.protocol==="https:"?Je:Ne,l=JSON.stringify(e||{}),c=o.request({hostname:i.hostname,port:i.port,path:`${i.pathname}${i.search}`,method:"POST",headers:{"content-type":"application/json","content-length":Buffer.byteLength(l),...t?{authorization:`Bearer ${t}`}:{}}},a=>{let d="";a.on("data",h=>{d+=h}),a.on("end",()=>{if(a.statusCode>=300&&a.statusCode<400){let g=a.headers.location?` to ${a.headers.location}`:"",f=new Error(`HTTP ${a.statusCode}: redirected${g}`);f.statusCode=a.statusCode,f.body=d,s(f);return}let h=null;try{h=d?JSON.parse(d):null}catch(g){if(a.statusCode>=400){let f=new Error(`HTTP ${a.statusCode}: ${a.statusMessage||"Non-JSON response"}`);f.statusCode=a.statusCode,f.body=d,s(f);return}s(g);return}if(a.statusCode>=400){let g=new Error((h==null?void 0:h.error_description)||(h==null?void 0:h.error)||`HTTP ${a.statusCode}`);g.statusCode=a.statusCode,g.body=h,s(g);return}n(h)})});c.on("error",s),c.write(l),c.end()})}async function ye(r,e=de){if(!(r!=null&&r.refreshToken)||!(r!=null&&r.deviceId))throw U("FrontFriend session expired");let t;try{t=await ge(`${e}/api/plugin/token`,{grant_type:"refresh_token",refresh_token:r.refreshToken,device_id:r.deviceId})}catch(s){throw U((s==null?void 0:s.message)||"Could not refresh FrontFriend session")}if(!(t!=null&&t.access_token)||!(t!=null&&t.refresh_token))throw U("Could not refresh FrontFriend session");let n={accessToken:t.access_token,refreshToken:t.refresh_token,deviceId:t.device_id||r.deviceId,expiresAt:Date.now()+(t.expires_in||900)*1e3,refreshExpiresAt:Date.now()+(t.refresh_expires_in||604800)*1e3,ffApiUrl:e};return ue(n),n}async function He(r={}){if(!r.skipCredentials){let e=fe();if(e!=null&&e.accessToken||e!=null&&e.refreshToken){let t=r.baseURL||e.ffApiUrl||de;return e.accessToken&&!pe(e)?e.accessToken:(await ye(e,t)).accessToken}}return r.envToken?r.envToken:r.legacyToken?(r.silent||console.warn("\u26A0\uFE0F auth-token in frontfriend.config.js is deprecated. Run `frontfriend login` to store credentials outside the repo."),r.legacyToken):null}me.exports={getCredentialsPath:Be,readCredentials:fe,writeCredentials:ue,deleteCredentials:Ve,isExpired:pe,postJson:ge,refreshCredentials:ye,resolveAuthToken:He,createAuthRefreshError:U}});var Ee=$((it,$e)=>{var N=require("https"),q=require("http"),{URL:V}=require("url"),{DEFAULT_API_URL:We,LEGACY_API_URL:k,ENV_VARS:B}=D(),{APIError:y}=te(),{LocalTokenReader:Ye}=ce(),{resolveAuthToken:ze}=we(),_="Authentication required. Run `frontfriend login` to re-authenticate.";function Ce(r,e,t,n){return t?r.get(new V(e),{headers:{authorization:`Bearer ${t}`}},n):r.get(e,n)}function H(r,e=""){var n;let t=((n=r.headers)==null?void 0:n.location)||"";return r.statusCode===401||r.statusCode===403||r.statusCode>=300&&r.statusCode<400&&t.includes("/sign-in")||String(e).trim().startsWith("/sign-in")}function Fe(r,e,t=""){return H(r,t)?new y(_,r.statusCode,e):new y(`HTTP ${r.statusCode}: ${r.statusMessage}`,r.statusCode,e)}var W=class{constructor(e,t={}){this.ffId=e,this.baseURL=t.baseURL||process.env[B.FF_API_URL]||We,this.legacyAuthToken=t.authToken||null,this.authToken=null,this.skipCredentials=t.skipCredentials||!1,process.env[B.FF_USE_LOCAL]==="true"&&(console.log(" \u{1F3E0} Using local token reader"),this.localReader=new Ye(e,t))}async getAuthToken(){return this.authToken=await ze({baseURL:this.baseURL,envToken:process.env[B.FF_AUTH_TOKEN],legacyToken:this.legacyAuthToken,skipCredentials:this.skipCredentials}),this.authToken}async fetchJson(e,t={}){let n=await this.getAuthToken();return new Promise((s,i)=>{let o=e.startsWith("https")?N:q;Ce(o,e,n,l=>{let c="";if(l.statusCode>=300){i(Fe(l,e));return}l.on("data",a=>{c+=a}),l.on("end",()=>{try{let a=JSON.parse(c);t.returnHeaders?s({data:a,headers:l.headers}):s(a)}catch(a){if(H(l,c)){i(new y(_,l.statusCode,e));return}i(new y(`Invalid JSON response: ${a.message}`,l.statusCode,e))}}),l.on("error",a=>{i(new y(`Response error: ${a.message}`,l.statusCode,e))})}).on("error",l=>{i(new y(`Network error: ${l.message}`,0,e))})})}async fetchRaw(e){let t=await this.getAuthToken();return new Promise((n,s)=>{let i=e.startsWith("https")?N:q;Ce(i,e,t,o=>{let l="";if(o.statusCode>=400){s(new y(`HTTP ${o.statusCode}: ${o.statusMessage}`,o.statusCode,e));return}o.on("data",c=>{l+=c}),o.on("end",()=>{n(l)}),o.on("error",c=>{s(new y(`Response error: ${c.message}`,o.statusCode,e))})}).on("error",o=>{s(new y(`Network error: ${o.message}`,0,e))})})}async fetchTokens(){if(this.localReader)return this.localReader.fetchTokens();try{let s=`${this.baseURL}/api/design-systems/${this.ffId}/tokens`,i=await this.fetchJson(s);if(i&&i.tokens){let o=i.tokens;return{global:o["Global Tokens/Default"]||o.global||null,colors:o["Global Colors/Default"]||o.colors||null,semantic:o["Semantic/Light"]||o["semantic/light"]||null,semanticDark:o["Semantic/Dark"]||o["semantic/dark"]||null}}}catch(s){if(s.statusCode===400)throw new y("Design system not synced with Figma. Please sync tokens from Figma before using this design system.",400,`${this.baseURL}/api/design-systems/${this.ffId}/tokens`)}let e=k,t={global:`${e}/${this.ffId}/global-tokens/default.json`,colors:`${e}/${this.ffId}/global-colors/default.json`,semantic:`${e}/${this.ffId}/semantic/light.json`,semanticDark:`${e}/${this.ffId}/semantic/dark.json`},n=await Promise.all([this.fetchJson(t.global).catch(s=>s.statusCode===404?null:Promise.reject(s)),this.fetchJson(t.colors).catch(s=>s.statusCode===404?null:Promise.reject(s)),this.fetchJson(t.semantic).catch(s=>s.statusCode===404?null:Promise.reject(s)),this.fetchJson(t.semanticDark).catch(s=>s.statusCode===404?null:Promise.reject(s))]);return{global:n[0],colors:n[1],semantic:n[2],semanticDark:n[3]}}async fetchProcessedTokens(e={}){if(this.localReader)return this.localReader.fetchProcessedTokens();let t=new V(`${this.baseURL}/api/design-systems/${this.ffId}/processed-tokens`);e.tag&&t.searchParams.append("tag",e.tag),e.version&&t.searchParams.append("version",e.version),e.tailwindV4&&t.searchParams.append("tailwind","v4");let n=t.toString();try{let s=await this.fetchJson(n,{returnHeaders:!0});return s.headers&&(s.data.versionMetadata={version:s.headers["x-frontfriend-version"],tag:s.headers["x-frontfriend-tag"],cached:s.headers["x-frontfriend-cached"]==="true"}),s.data}catch(s){if(s.statusCode===404)return null;throw s.statusCode===400?new y("Design system not synced with Figma. Please sync tokens from Figma before using this design system.",400,n):s}}async sendJson(e,t,n){let s=await this.getAuthToken();if(!s)throw new y(_,401,e);return new Promise((i,o)=>{let l=new V(e),c=e.startsWith("https")?N:q,a=JSON.stringify(n||{}),d=c.request({hostname:l.hostname,port:l.port,path:`${l.pathname}${l.search}`,method:t,headers:{"content-type":"application/json","content-length":Buffer.byteLength(a),...s?{authorization:`Bearer ${s}`}:{}}},h=>{let g="";if(h.statusCode>=300){o(Fe(h,e));return}h.on("data",f=>{g+=f}),h.on("end",()=>{if(!g){i(null);return}try{i(JSON.parse(g))}catch(f){if(H(h,g)){o(new y(_,h.statusCode,e));return}o(new y(`Invalid JSON response: ${f.message}`,h.statusCode,e))}})});d.on("error",h=>{o(new y(`Network error: ${h.message}`,0,e))}),d.write(a),d.end()})}async pushComponentsConfig(e){let t=`${this.baseURL}/api/design-systems/${this.ffId}/components-config`;return this.sendJson(t,"PUT",{componentsConfig:e})}async fetchComponentsConfig(){if(this.localReader)return this.localReader.fetchComponentsConfig();let e=`${k}/${this.ffId}/components-config.json`;try{return await this.fetchJson(e)}catch(t){if(t.statusCode===404)return null;throw t}}async fetchFonts(){if(this.localReader)return this.localReader.fetchFonts();let e=`${k}/${this.ffId}/font.json`;try{return await this.fetchJson(e)}catch(t){if(t.statusCode===404)return null;throw t}}async fetchIcons(){if(this.localReader)return this.localReader.fetchIcons();let e=`${k}/${this.ffId}/icons.json`;try{return await this.fetchJson(e)}catch(t){if(t.statusCode===404)return null;throw t}}async fetchVersion(){if(this.localReader)return this.localReader.fetchVersion();let e=`${k}/${this.ffId}/version.json`;try{return await this.fetchJson(e)}catch(t){if(t.statusCode===404)return null;throw t}}async fetchCustomCss(){if(this.localReader)return this.localReader.fetchCustomCss();let e=`${k}/${this.ffId}/custom.css`;try{return await this.fetchRaw(e)}catch(t){if(t.statusCode===404)return null;throw t}}async fetchPlanMetadata(){if(this.localReader)return process.env.FF_DEBUG&&console.log(" \u2192 Using local reader for plan metadata"),this.localReader.fetchPlanMetadata();let e=`${this.baseURL}/api/design-systems/${this.ffId}/processed-tokens`;try{process.env.FF_DEBUG&&console.log(` \u2192 Fetching plan metadata from saas app: ${e}`);let t=await this.fetchJson(e);if(t&&t.metadata){let n={planType:t.metadata.planType||"full",allowedComponents:t.metadata.allowedComponents||null};return process.env.FF_DEBUG&&console.log(` \u2192 Found plan metadata in saas app: ${n.planType}, allowed: ${n.allowedComponents?n.allowedComponents.length+" components":"all"}`),n}}catch(t){if(t.statusCode===404){process.env.FF_DEBUG&&console.log(" \u2192 ff-id not found in saas app, trying legacy server");let n=`${k}/${this.ffId}/metadata`;try{process.env.FF_DEBUG&&console.log(` \u2192 Fetching from legacy server: ${n}`);let s=await this.fetchJson(n),i={planType:s.planType||"full",allowedComponents:s.allowedComponents||null};return process.env.FF_DEBUG&&console.log(` \u2192 Found in legacy server: ${i.planType}, allowed: ${i.allowedComponents?i.allowedComponents.length+" components":"all"}`),i}catch(s){if(s.statusCode===404)return process.env.FF_DEBUG&&console.log(" \u2192 ff-id not found in any server - access denied"),{planType:"denied",allowedComponents:[],error:"Design system not found. Please ensure your ff-id is valid."};throw s}}throw t}}};$e.exports={APIClient:W}});var Ke=require("https"),Qe=require("http"),m=require("fs"),u=require("path"),{URL:Y}=require("url"),Re=require("os"),v=process.env.FF_REGISTRY_URL||"https://registry.frontfriend.dev",Xe=["legacy","v4"],z=class{constructor(e={}){this.appRoot=e.appRoot||process.cwd(),this.framework=e.framework||this.detectFramework(),this.config=e.config||{},this.registryGeneration=this.resolveRegistryGeneration(e.registryGeneration),this.outputPath=e.outputPath||this.getDefaultOutputPath(),this.overwrite=e.overwrite||!1,this.downloadedComponents=new Set,this.downloadingComponents=new Set,this.ffId=this.config.ffId||this.config["ff-id"]||null,this.planMetadata=null}resolveRegistryGeneration(e){let t=this.config.registry,n=this.config.registryGeneration||this.config.registryVersion||(typeof t=="string"?t:(t==null?void 0:t.generation)||(t==null?void 0:t.version));return this.normalizeRegistryGeneration(e||n||(this.detectTailwindV4()?"v4":"legacy"))}normalizeRegistryGeneration(e){if(e==null||e==="")return"legacy";if(e==="v4"||e===4||e==="4")return"v4";if(e==="legacy")return"legacy";throw new Error(`Unsupported registry generation "${e}". Supported generations: ${Xe.join(", ")}.`)}readPackageJson(){let e=u.join(this.appRoot,"package.json");if(!m.existsSync(e))return null;try{return JSON.parse(m.readFileSync(e,"utf8"))}catch{return null}}getDependencyVersion(e){var n,s,i;let t=this.readPackageJson();return((n=t==null?void 0:t.dependencies)==null?void 0:n[e])||((s=t==null?void 0:t.devDependencies)==null?void 0:s[e])||((i=t==null?void 0:t.peerDependencies)==null?void 0:i[e])||null}getDependencyMajorVersion(e){var s;let t=this.getDependencyVersion(e),n=(s=t==null?void 0:t.match(/(\d+)/))==null?void 0:s[1];return n?Number(n):null}validateRuntimeCompatibility(){if(this.framework!=="react")return;let e=this.getDependencyVersion("react"),t=this.getDependencyMajorVersion("react");if(!(!e||!t)){if(this.registryGeneration==="v4"&&t<19)throw new Error(`Tailwind v4 React registry requires React 19; found react ${e}`);if(this.registryGeneration==="legacy"&&t>=19)throw new Error(`Legacy React registry targets React 18; found react ${e}. Use --registry v4 for React 19 projects.`)}}detectTailwindV4(){let e=this.getDependencyMajorVersion("tailwindcss");return e?e>=4:!1}getRegistryUrl(e,{custom:t=!1,index:n=!1}={}){let s=n?"index.json":`${e}.json`;return t?this.registryGeneration==="v4"?`${v}/custom/v4/${this.ffId}/${this.framework}/${s}`:`${v}/custom/${this.ffId}/${this.framework}/${s}`:this.registryGeneration==="v4"?`${v}/components/v4/${this.framework}/${s}`:`${v}/components/${this.framework}/${s}`}getRegistryDependencyName(e){if(typeof e!="string"||!/^[a-z][a-z0-9+.-]*:\/\//i.test(e))return e;try{let t=new Y(e),n=new Y(v);if(t.origin!==n.origin)throw new Error(`Unsupported registry dependency URL "${e}". Only Frontfriend registry URLs are supported by this downloader.`);let s=t.pathname.split("/").filter(Boolean).map(a=>decodeURIComponent(a)),i,o,l,c;if(s[0]!=="r")throw new Error(`Unsupported registry dependency URL "${e}". Expected a Frontfriend /r/{generation}/{framework}/{component}.json route.`);if(s[2]==="custom"?[,i,,l,o,c]=s:[,i,o,c]=s,!i||!o||!c||!c.endsWith(".json"))throw new Error(`Unsupported registry dependency URL "${e}". Expected a Frontfriend /r/{generation}/{framework}/{component}.json route.`);if(i!==this.registryGeneration)throw new Error(`Registry dependency URL "${e}" targets generation "${i}" but downloader is using "${this.registryGeneration}".`);if(o!==this.framework)throw new Error(`Registry dependency URL "${e}" targets framework "${o}" but downloader is using "${this.framework}".`);if(l&&l!==this.ffId)throw new Error(`Registry dependency URL "${e}" targets ff-id "${l}" but downloader is using "${this.ffId||"none"}".`);return c.endsWith(".json")?c.slice(0,-5):c}catch(t){if(t.message.startsWith("Unsupported registry dependency URL")||t.message.startsWith("Registry dependency URL"))throw t;return e}}detectFramework(){let e=u.join(this.appRoot,"package.json");if(m.existsSync(e)){let t=JSON.parse(m.readFileSync(e,"utf8")),n={...t.dependencies,...t.devDependencies};if(n.vue)return"vue";if(n.react)return"react"}return"react"}getDefaultOutputPath(){if(this.config.aliases&&this.config.aliases.ui){let t=this.config.aliases.ui.replace(/^@\//,"");return u.join(this.appRoot,t)}return this.framework==="vue"?u.join(this.appRoot,"src/components/ui"):u.join(this.appRoot,"components/ui")}fetchJson(e){let t=process.env.FF_USE_LOCAL==="true",n=process.env.FF_USE_LOCAL_REGISTRY==="true",s=e.includes(v);if(t||n&&s){process.env.FF_DEBUG&&n&&!t&&console.log(" \u2192 Using local registry for components");let i=["../../packages/registry","../../../packages/registry","../../../../packages/registry",u.join(__dirname,"../../../registry"),"packages/registry"],o;for(let a of i){let d=u.isAbsolute(a)?a:u.join(process.cwd(),a);if(m.existsSync(d)){o=d;break}}if(!o)return Promise.reject(new Error(`Local registry not found. Tried paths: ${i.join(", ")}`));let l=e.replace(v,"").replace(/^\//,""),c=u.join(o,...l.split("/"));try{let a=m.readFileSync(c,"utf8");return Promise.resolve(JSON.parse(a))}catch(a){return a.code==="ENOENT"?Promise.reject(new Error("HTTP 404: Not Found")):Promise.reject(a)}}return new Promise((i,o)=>{(new Y(e).protocol==="http:"?Qe:Ke).get(e,c=>{let a="";c.on("data",d=>{a+=d}),c.on("end",()=>{if(c.statusCode>=400){let d=c.statusMessage;try{let h=JSON.parse(a);d=h.error||h.message||d}catch{}o(new Error(`HTTP ${c.statusCode}: ${d}`));return}try{i(JSON.parse(a))}catch(d){o(new Error(`Invalid JSON response: ${d.message}`))}})}).on("error",c=>{o(c)})})}async getAllComponents(){var e;this.validateRuntimeCompatibility();try{let t=this.getRegistryUrl(null,{index:!0}),s=(await this.fetchJson(t)).components||[];if(this.ffId){try{await this.isComponentAllowed("dummy")}catch{if(this.planMetadata&&this.planMetadata.planType==="denied")throw new Error(this.planMetadata.error||"Access denied. Your ff-id was not found in any server.")}this.planMetadata&&this.planMetadata.planType==="trial"&&this.planMetadata.allowedComponents&&(s=s.filter(i=>this.planMetadata.allowedComponents.includes(i)),process.env.FF_DEBUG&&console.log(` \u2192 Trial plan: filtering to ${s.length} allowed components`))}return s}catch(t){throw t.message.includes("404")&&this.registryGeneration==="v4"?new Error(`Tailwind v4 registry not available for ${this.framework}`):((e=this.planMetadata)==null?void 0:e.planType)==="denied"||t.message.startsWith("Access denied.")?t:new Error(`Failed to fetch component index: ${t.message}`)}}async getCustomComponents(){if(!this.ffId)return process.env.FF_DEBUG&&console.log(" \u2192 No ff-id found, skipping custom components"),[];this.validateRuntimeCompatibility();try{let e=this.getRegistryUrl(null,{custom:!0,index:!0});process.env.FF_DEBUG&&console.log(` \u2192 Fetching custom components from: ${e}`);let t=await this.fetchJson(e);return process.env.FF_DEBUG&&console.log(` \u2192 Found custom components: ${JSON.stringify(t.components)}`),t.components||[]}catch(e){if(!e.message.includes("404"))throw new Error(`Failed to fetch custom component index: ${e.message}`);return process.env.FF_DEBUG&&console.log(` \u2192 No custom components found: ${e.message}`),[]}}async downloadComponents(e){process.env.FF_DEBUG&&console.log(` \u2192 ComponentDownloader initialized with ff-id: ${this.ffId}`);let t={successful:[],failed:[],dependencies:new Set};for(let n of e)try{let s=await this.downloadComponent(n);t.successful.push(n),s.forEach(i=>t.dependencies.add(i))}catch(s){t.failed.push({component:n,error:s.message})}return{successful:t.successful,failed:t.failed,dependencies:Array.from(t.dependencies)}}async isComponentAllowed(e){if(!this.planMetadata&&this.ffId){let{APIClient:t}=Ee(),n=new t(this.ffId,{baseURL:this.config["api-url"]||this.config.apiUrl});try{this.planMetadata=await n.fetchPlanMetadata(),process.env.FF_DEBUG&&console.log(` \u2192 Fetched plan metadata: ${this.planMetadata.planType}, allowed: ${this.planMetadata.allowedComponents?this.planMetadata.allowedComponents.length+" components":"all"}`)}catch(s){console.warn("Failed to fetch plan metadata:",s.message),this.planMetadata={planType:"full",allowedComponents:null}}}if(this.planMetadata&&this.planMetadata.planType==="denied")throw new Error(this.planMetadata.error||"Access denied. Your ff-id was not found in any server.");return!this.planMetadata||this.planMetadata.planType==="full"?!0:this.planMetadata.planType==="trial"&&this.planMetadata.allowedComponents?this.planMetadata.allowedComponents.includes(e):!1}async downloadComponent(e){if(this.validateRuntimeCompatibility(),this.downloadedComponents.has(e))return[];if(this.downloadingComponents.has(e))throw new Error(`Circular registry dependency detected while downloading "${e}"`);this.downloadingComponents.add(e);try{return await this.downloadComponentInternal(e)}finally{this.downloadingComponents.delete(e)}}async downloadComponentInternal(e){if(process.env.FF_DEBUG&&(console.log(` \u2192 Checking if component "${e}" is allowed...`),console.log(` \u2192 FF-ID: ${this.ffId}`)),!await this.isComponentAllowed(e)){let c=`Component "${e}" is not available in your trial plan. Please upgrade to access all components.`;throw console.error(`\u274C ${c}`),new Error(c)}console.log(`\u{1F4E5} Downloading ${e}...`);let n,s=!1;if(this.ffId){let c=this.getRegistryUrl(e,{custom:!0});try{n=await this.fetchJson(c),s=!0,process.env.FF_DEBUG&&console.log(` \u2192 Found custom component for ${e}`)}catch(a){if(!a.message.includes("404"))throw new Error(`Failed to fetch custom component "${e}": ${a.message}`);process.env.FF_DEBUG&&console.log(` \u2192 No custom component found for ${e}, trying standard`)}}if(!n){let c=this.getRegistryUrl(e);try{n=await this.fetchJson(c)}catch(a){throw a.message.includes("404")?this.registryGeneration==="v4"?new Error(`Tailwind v4 component "${e}" not migrated for ${this.framework}`):new Error(`Component "${e}" not found`):new Error(`Failed to fetch ${e}: ${a.message}`)}}if(!n.files||!Array.isArray(n.files))throw new Error(`Invalid component data for ${e}`);let i=[...n.dependencies||[]],o=(n.registryDependencies||[]).map(c=>{try{return{dep:c,dependencyName:this.getRegistryDependencyName(c)}}catch(a){throw this.registryGeneration==="v4"?new Error(`Failed to download required v4 registry dependency "${c}" for "${e}": ${a.message}`):a}}),l=async()=>{if(o.length>0){console.log(` \u{1F4E6} Installing registry dependencies: ${o.map(({dep:c})=>c).join(", ")}`);for(let{dep:c,dependencyName:a}of o)try{(await this.downloadComponent(a)).forEach(h=>i.push(h))}catch(d){if(this.registryGeneration==="v4")throw new Error(`Failed to download required v4 registry dependency "${c}" for "${e}": ${d.message}`);console.warn(` \u26A0\uFE0F Failed to download dependency ${c}: ${d.message}`)}}};this.registryGeneration==="v4"&&await l();for(let c of n.files)await this.writeComponentFile(c);return this.downloadedComponents.add(e),console.log(` \u2713 ${e} downloaded${s&&process.env.FF_DEBUG?" (custom)":""}`),this.registryGeneration!=="v4"&&await l(),i}async writeComponentFile(e){var d,h,g;let t=e.target||e.name||e.path;if(!t)throw new Error("Invalid component file descriptor: missing name/path/target");let n=f=>f.split("/").join(u.sep),s=(f,P,K)=>{let A=u.resolve(f),T=u.resolve(A,n(P)),j=u.relative(A,T);if(j===""||j.startsWith("..")||u.isAbsolute(j))throw new Error(`Unsafe component file path "${t}": resolves outside ${K}`);return T},i,o=(d=e.target)==null?void 0:d.match(/^@([^/]+)\//),l=f=>{var X;if(f==="ui")return u.resolve(this.outputPath);let T=(((X=this.config.aliases)==null?void 0:X[f])||{components:"components",hooks:"hooks",lib:"lib"}[f]||f).replace(/^@\//,"").replace(/^~\//,""),j=u.resolve(this.appRoot),Q=u.isAbsolute(T)?u.resolve(T):u.resolve(j,n(T)),S=u.relative(j,Q);if(S===""||S.startsWith("..")||u.isAbsolute(S))throw new Error(`Unsafe component file path "${t}": alias @${f} resolves outside app root`);return Q};if((h=e.target)!=null&&h.startsWith("@ui/"))i=s(this.outputPath,e.target.replace(/^@ui\//,""),"output root");else if(o){let f=o[1],P=l(f);i=s(P,e.target.replace(new RegExp(`^@${f}/`),""),`@${f} alias root`)}else(g=e.target)!=null&&g.startsWith("~/")?i=s(this.appRoot,e.target.replace(/^~\//,""),"app root"):e.target?i=s(this.appRoot,e.target.replace(/^\/+/,""),"app root"):i=s(this.outputPath,t,"output root");let c=u.dirname(i);if(m.existsSync(c)||m.mkdirSync(c,{recursive:!0}),m.existsSync(i)&&!this.overwrite){console.log(` \u26A0\uFE0F Skipping ${t} (already exists)`);return}let a=e.content;Re.EOL!==`
3
- `&&(a=e.content.replace(/\n/g,Re.EOL)),m.writeFileSync(i,a,"utf8")}};module.exports={ComponentDownloader:z};
1
+ var $=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var S=$((et,X)=>{var Re="https://app.frontfriend.dev",ke="https://registry-legacy.frontfriend.dev",Ue=".cache/frontfriend",ve={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"]},Te={FF_ID:"FF_ID",FF_API_URL:"FF_API_URL",FF_USE_LOCAL:"FF_USE_LOCAL",FF_AUTH_TOKEN:"FF_AUTH_TOKEN"};X.exports={DEFAULT_API_URL:Re,LEGACY_API_URL:ke,CACHE_DIR_NAME:Ue,CACHE_TTL_DAYS:7,CACHE_TTL_MS:6048e5,CACHE_FILES:ve,ENV_VARS:Te}});var ee=$((tt,Z)=>{var D=class extends Error{constructor(e,t,r){super(e),this.name="APIError",this.statusCode=t,this.url=r,this.code=`API_${t}`}},L=class extends Error{constructor(e,t){super(e),this.name="CacheError",this.operation=t,this.code=`CACHE_${t.toUpperCase()}`}},I=class extends Error{constructor(e,t){super(e),this.name="ConfigError",this.field=t,this.code=t?`CONFIG_${String(t).toUpperCase()}`:"CONFIG_ERROR"}},b=class extends Error{constructor(e,t){super(e),this.name="ProcessingError",this.token=t,this.code="PROCESSING_ERROR"}};Z.exports={APIError:D,CacheError:L,ConfigError:I,ProcessingError:b}});var M=$((st,te)=>{var w=require("fs");function je(n){try{let e=w.readFileSync(n,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}function Pe(n){try{return w.readFileSync(n,"utf8").replace(/^\uFEFF/,"")}catch(e){if(e.code==="ENOENT")return null;throw e}}function _e(n,e,t=2){let r=JSON.stringify(e,null,t);w.writeFileSync(n,r,"utf8")}function Ae(n,e){w.writeFileSync(n,e,"utf8")}function Se(n,e){if(e==null||typeof e=="object"&&Object.keys(e).length===0||Array.isArray(e)&&e.length===0){let r=`module.exports = ${Array.isArray(e)?"[]":"{}"};`;w.writeFileSync(n,r,"utf8")}else{let t=`module.exports = ${JSON.stringify(e,null,2)};`;w.writeFileSync(n,t,"utf8")}}function De(n){return w.existsSync(n)}function Le(n){w.mkdirSync(n,{recursive:!0})}function Ie(n){w.rmSync(n,{recursive:!0,force:!0})}te.exports={readJsonFileSafe:je,readFileSafe:Pe,writeJsonFile:_e,writeTextFile:Ae,writeModuleExportsFile:Se,fileExists:De,ensureDirectoryExists:Le,removeDirectory:Ie}});var re=$((rt,se)=>{var C=require("path"),{fileExists:x}=M();function be(n,e=process.cwd()){let t=e;for(;t!==C.parse(t).root;){let r=C.join(t,n);if(x(r))return r;t=C.dirname(t)}return null}function Me(n,e=process.cwd(),t=null){let r=[],s=e,i=10;for(let o=0;o<i;o++){r.push(C.join(s,n)),o<3&&r.push(C.join(s,"../".repeat(o+1)+n));let l=C.dirname(s);if(l===s)break;s=l}r.push(C.join(__dirname,"../../../",n));for(let o of r)if(x(o)&&(!t||t(o)))return o;return null}function xe(n,e=process.cwd()){let t=n.map(r=>C.isAbsolute(r)?r:C.join(e,r));for(let r of t)if(x(r))return r;return null}se.exports={findFileUpward:be,findDirectoryUpward:Me,findDirectoryWithPaths:xe}});var ae=$((nt,ie)=>{var p=require("path"),{findDirectoryUpward:ne}=re(),{readJsonFileSafe:F,readFileSafe:oe,fileExists:G}=M(),O=class{constructor(e,t={}){if(this.ffId=e,this.tokensBasePath=t.tokensBasePath||this.findTokensPath(),this.folderMap=this.loadFolderMap(),this.projectFolder=this.folderMap[e],!this.projectFolder)throw new Error(`No folder mapping found for ff-id: ${e}`);this.projectPath=p.join(this.tokensBasePath,this.projectFolder)}findTokensPath(){let e=ne("apps/tokens",process.cwd(),t=>G(p.join(t,"folderMap.json")));if(e||(e=ne("tokens",process.cwd(),t=>G(p.join(t,"folderMap.json")))),!e)throw new Error("Could not find tokens directory with folderMap.json");return e}loadFolderMap(){let e=p.join(this.tokensBasePath,"folderMap.json"),t=F(e);if(!t)throw new Error("Failed to load folderMap.json: File not found");return t}async fetchTokens(){let e=p.join(this.projectPath,"figma"),t={global:[p.join(e,"Global Tokens","Default.json"),p.join(e,"global.json")],colors:[p.join(e,"Global Colors","Default.json"),p.join(e,"Global Colors","Light.json")],semantic:[p.join(e,"Semantic","Light.json"),p.join(e,"Semantic","Default.json")],semanticDark:[p.join(e,"Semantic","Dark.json")]},r={};for(let[s,i]of Object.entries(t)){for(let o of i){let l=F(o);if(l!==null){r[s]=l;break}}r[s]||(r[s]=null)}return r}async fetchProcessedTokens(){let e=p.join(this.projectPath,"cache");if(!G(e))return null;let t=o=>{if(o===null)return null;let l={},c={exports:l};return new Function("module","exports",o)(c,l),c.exports},r={tokens:{fileName:"hashedTokens.js",type:"module"},variables:{fileName:"hashedVariables.js",type:"module"},semanticVariables:{fileName:"hashedSemanticVariables.js",type:"module"},semanticDarkVariables:{fileName:"hashedSemanticDarkVariables.js",type:"module"},safelist:{fileName:"safelist.js",type:"module"},custom:{fileName:"custom.js",type:"module"},fonts:{fileName:"fonts.json",type:"json"},icons:{fileName:"icons.json",type:"json"},componentsConfig:{fileName:"encoded-config.json",type:"json"},version:{fileName:"version.json",type:"json"}},s={};for(let[o,{fileName:l,type:c}]of Object.entries(r)){let a=p.join(e,l),d=c==="module"?t(oe(a)):F(a);d!==null&&(s[o]=d)}return Object.values(s).some(o=>o!==null)?s:null}async fetchComponentsConfig(){return F(p.join(this.projectPath,"components-config.json"))}async fetchFonts(){return F(p.join(this.projectPath,"font.json"))}async fetchIcons(){return F(p.join(this.projectPath,"icons.json"))}async fetchVersion(){return F(p.join(this.projectPath,"version.json"))}async fetchCustomCss(){return oe(p.join(this.projectPath,"custom.css"))}async fetchPlanMetadata(){return F(p.join(this.projectPath,"metadata.json"))||{planType:"full",allowedComponents:null}}fetchJson(){throw new Error("fetchJson is not implemented in LocalTokenReader. Use specific fetch methods.")}fetchRaw(){throw new Error("fetchRaw is not implemented in LocalTokenReader. Use specific fetch methods.")}};ie.exports={LocalTokenReader:O}});var me=$((ot,ye)=>{var E=require("fs"),ce=require("path"),Ge=require("os"),Oe=require("https"),Je=require("http"),{URL:Ne}=require("url"),{DEFAULT_API_URL:le}=S(),de=ce.join(Ge.homedir(),".frontfriend"),R=ce.join(de,"credentials");function Be(){return R}function he(){try{return E.existsSync(R)?JSON.parse(E.readFileSync(R,"utf8")):null}catch{return null}}function fe(n){E.mkdirSync(de,{recursive:!0,mode:448}),E.writeFileSync(R,`${JSON.stringify(n,null,2)}
2
+ `,{mode:384});try{E.chmodSync(R,384)}catch{}}function qe(){return E.existsSync(R)?(E.unlinkSync(R),!0):!1}function ue(n,e=60*1e3){return!(n!=null&&n.accessToken)||!n.expiresAt||Date.now()+e>=n.expiresAt}function j(n){let e=new Error(`${n}. Run \`frontfriend login\` to re-authenticate.`);return e.code="FF_AUTH_REFRESH_FAILED",e}function pe(n,e,t){return new Promise((r,s)=>{let i=new Ne(n),o=i.protocol==="https:"?Oe:Je,l=JSON.stringify(e||{}),c=o.request({hostname:i.hostname,port:i.port,path:`${i.pathname}${i.search}`,method:"POST",headers:{"content-type":"application/json","content-length":Buffer.byteLength(l),...t?{authorization:`Bearer ${t}`}:{}}},a=>{let d="";a.on("data",h=>{d+=h}),a.on("end",()=>{if(a.statusCode>=300&&a.statusCode<400){let g=a.headers.location?` to ${a.headers.location}`:"",f=new Error(`HTTP ${a.statusCode}: redirected${g}`);f.statusCode=a.statusCode,f.body=d,s(f);return}let h=null;try{h=d?JSON.parse(d):null}catch(g){if(a.statusCode>=400){let f=new Error(`HTTP ${a.statusCode}: ${a.statusMessage||"Non-JSON response"}`);f.statusCode=a.statusCode,f.body=d,s(f);return}s(g);return}if(a.statusCode>=400){let g=new Error((h==null?void 0:h.error_description)||(h==null?void 0:h.error)||`HTTP ${a.statusCode}`);g.statusCode=a.statusCode,g.body=h,s(g);return}r(h)})});c.on("error",s),c.write(l),c.end()})}async function ge(n,e=le){if(!(n!=null&&n.refreshToken)||!(n!=null&&n.deviceId))throw j("FrontFriend session expired");let t;try{t=await pe(`${e}/api/plugin/token`,{grant_type:"refresh_token",refresh_token:n.refreshToken,device_id:n.deviceId})}catch(s){throw j((s==null?void 0:s.message)||"Could not refresh FrontFriend session")}if(!(t!=null&&t.access_token)||!(t!=null&&t.refresh_token))throw j("Could not refresh FrontFriend session");let r={accessToken:t.access_token,refreshToken:t.refresh_token,deviceId:t.device_id||n.deviceId,expiresAt:Date.now()+(t.expires_in||900)*1e3,refreshExpiresAt:Date.now()+(t.refresh_expires_in||604800)*1e3,ffApiUrl:e};return fe(r),r}async function Ve(n={}){if(!n.skipCredentials){let e=he();if(e!=null&&e.accessToken||e!=null&&e.refreshToken){let t=n.baseURL||e.ffApiUrl||le;return e.accessToken&&!ue(e)?e.accessToken:(await ge(e,t)).accessToken}}return n.envToken?n.envToken:n.legacyToken?(n.silent||console.warn("\u26A0\uFE0F auth-token in frontfriend.config.js is deprecated. Run `frontfriend login` to store credentials outside the repo."),n.legacyToken):null}ye.exports={getCredentialsPath:Be,readCredentials:he,writeCredentials:fe,deleteCredentials:qe,isExpired:ue,postJson:pe,refreshCredentials:ge,resolveAuthToken:Ve,createAuthRefreshError:j}});var $e=$((it,Fe)=>{var J=require("https"),N=require("http"),{URL:q}=require("url"),{DEFAULT_API_URL:He,LEGACY_API_URL:k,ENV_VARS:B}=S(),{APIError:y}=ee(),{LocalTokenReader:We}=ae(),{resolveAuthToken:Ye}=me(),P="Authentication required. Run `frontfriend login` to re-authenticate.";function we(n,e,t,r){return t?n.get(new q(e),{headers:{authorization:`Bearer ${t}`}},r):n.get(e,r)}function V(n,e=""){var r;let t=((r=n.headers)==null?void 0:r.location)||"";return n.statusCode===401||n.statusCode===403||n.statusCode>=300&&n.statusCode<400&&t.includes("/sign-in")||String(e).trim().startsWith("/sign-in")}function Ce(n,e,t=""){return V(n,t)?new y(P,n.statusCode,e):new y(`HTTP ${n.statusCode}: ${n.statusMessage}`,n.statusCode,e)}var H=class{constructor(e,t={}){this.ffId=e,this.baseURL=t.baseURL||process.env[B.FF_API_URL]||He,this.legacyAuthToken=t.authToken||null,this.authToken=null,this.skipCredentials=t.skipCredentials||!1,process.env[B.FF_USE_LOCAL]==="true"&&(console.log(" \u{1F3E0} Using local token reader"),this.localReader=new We(e,t))}async getAuthToken(){return this.authToken=await Ye({baseURL:this.baseURL,envToken:process.env[B.FF_AUTH_TOKEN],legacyToken:this.legacyAuthToken,skipCredentials:this.skipCredentials}),this.authToken}async fetchJson(e,t={}){let r=await this.getAuthToken();return new Promise((s,i)=>{let o=e.startsWith("https")?J:N;we(o,e,r,l=>{let c="";if(l.statusCode>=300){i(Ce(l,e));return}l.on("data",a=>{c+=a}),l.on("end",()=>{try{let a=JSON.parse(c);t.returnHeaders?s({data:a,headers:l.headers}):s(a)}catch(a){if(V(l,c)){i(new y(P,l.statusCode,e));return}i(new y(`Invalid JSON response: ${a.message}`,l.statusCode,e))}}),l.on("error",a=>{i(new y(`Response error: ${a.message}`,l.statusCode,e))})}).on("error",l=>{i(new y(`Network error: ${l.message}`,0,e))})})}async fetchRaw(e){let t=await this.getAuthToken();return new Promise((r,s)=>{let i=e.startsWith("https")?J:N;we(i,e,t,o=>{let l="";if(o.statusCode>=400){s(new y(`HTTP ${o.statusCode}: ${o.statusMessage}`,o.statusCode,e));return}o.on("data",c=>{l+=c}),o.on("end",()=>{r(l)}),o.on("error",c=>{s(new y(`Response error: ${c.message}`,o.statusCode,e))})}).on("error",o=>{s(new y(`Network error: ${o.message}`,0,e))})})}async fetchTokens(){if(this.localReader)return this.localReader.fetchTokens();try{let s=`${this.baseURL}/api/design-systems/${this.ffId}/tokens`,i=await this.fetchJson(s);if(i&&i.tokens){let o=i.tokens;return{global:o["Global Tokens/Default"]||o.global||null,colors:o["Global Colors/Default"]||o.colors||null,semantic:o["Semantic/Light"]||o["semantic/light"]||null,semanticDark:o["Semantic/Dark"]||o["semantic/dark"]||null}}}catch(s){if(s.statusCode===400)throw new y("Design system not synced with Figma. Please sync tokens from Figma before using this design system.",400,`${this.baseURL}/api/design-systems/${this.ffId}/tokens`)}let e=k,t={global:`${e}/${this.ffId}/global-tokens/default.json`,colors:`${e}/${this.ffId}/global-colors/default.json`,semantic:`${e}/${this.ffId}/semantic/light.json`,semanticDark:`${e}/${this.ffId}/semantic/dark.json`},r=await Promise.all([this.fetchJson(t.global).catch(s=>s.statusCode===404?null:Promise.reject(s)),this.fetchJson(t.colors).catch(s=>s.statusCode===404?null:Promise.reject(s)),this.fetchJson(t.semantic).catch(s=>s.statusCode===404?null:Promise.reject(s)),this.fetchJson(t.semanticDark).catch(s=>s.statusCode===404?null:Promise.reject(s))]);return{global:r[0],colors:r[1],semantic:r[2],semanticDark:r[3]}}async fetchProcessedTokens(e={}){if(this.localReader)return this.localReader.fetchProcessedTokens();let t=new q(`${this.baseURL}/api/design-systems/${this.ffId}/processed-tokens`);e.tag&&t.searchParams.append("tag",e.tag),e.version&&t.searchParams.append("version",e.version),e.tailwindV4&&t.searchParams.append("tailwind","v4");let r=t.toString();try{let s=await this.fetchJson(r,{returnHeaders:!0});return s.headers&&(s.data.versionMetadata={version:s.headers["x-frontfriend-version"],tag:s.headers["x-frontfriend-tag"],cached:s.headers["x-frontfriend-cached"]==="true"}),s.data}catch(s){if(s.statusCode===404)return null;throw s.statusCode===400?new y("Design system not synced with Figma. Please sync tokens from Figma before using this design system.",400,r):s}}async sendJson(e,t,r){let s=await this.getAuthToken();if(!s)throw new y(P,401,e);return new Promise((i,o)=>{let l=new q(e),c=e.startsWith("https")?J:N,a=JSON.stringify(r||{}),d=c.request({hostname:l.hostname,port:l.port,path:`${l.pathname}${l.search}`,method:t,headers:{"content-type":"application/json","content-length":Buffer.byteLength(a),...s?{authorization:`Bearer ${s}`}:{}}},h=>{let g="";if(h.statusCode>=300){o(Ce(h,e));return}h.on("data",f=>{g+=f}),h.on("end",()=>{if(!g){i(null);return}try{i(JSON.parse(g))}catch(f){if(V(h,g)){o(new y(P,h.statusCode,e));return}o(new y(`Invalid JSON response: ${f.message}`,h.statusCode,e))}})});d.on("error",h=>{o(new y(`Network error: ${h.message}`,0,e))}),d.write(a),d.end()})}async pushComponentsConfig(e){let t=`${this.baseURL}/api/design-systems/${this.ffId}/components-config`;return this.sendJson(t,"PUT",{componentsConfig:e})}async fetchComponentsConfig(){if(this.localReader)return this.localReader.fetchComponentsConfig();let e=`${k}/${this.ffId}/components-config.json`;try{return await this.fetchJson(e)}catch(t){if(t.statusCode===404)return null;throw t}}async fetchFonts(){if(this.localReader)return this.localReader.fetchFonts();let e=`${k}/${this.ffId}/font.json`;try{return await this.fetchJson(e)}catch(t){if(t.statusCode===404)return null;throw t}}async fetchIcons(){if(this.localReader)return this.localReader.fetchIcons();let e=`${k}/${this.ffId}/icons.json`;try{return await this.fetchJson(e)}catch(t){if(t.statusCode===404)return null;throw t}}async fetchVersion(){if(this.localReader)return this.localReader.fetchVersion();let e=`${k}/${this.ffId}/version.json`;try{return await this.fetchJson(e)}catch(t){if(t.statusCode===404)return null;throw t}}async fetchCustomCss(){if(this.localReader)return this.localReader.fetchCustomCss();let e=`${k}/${this.ffId}/custom.css`;try{return await this.fetchRaw(e)}catch(t){if(t.statusCode===404)return null;throw t}}async fetchPlanMetadata(){if(this.localReader)return process.env.FF_DEBUG&&console.log(" \u2192 Using local reader for plan metadata"),this.localReader.fetchPlanMetadata();let e=`${this.baseURL}/api/design-systems/${this.ffId}/processed-tokens`;try{process.env.FF_DEBUG&&console.log(` \u2192 Fetching plan metadata from saas app: ${e}`);let t=await this.fetchJson(e);if(t&&t.metadata){let r={planType:t.metadata.planType||"full",allowedComponents:t.metadata.allowedComponents||null};return process.env.FF_DEBUG&&console.log(` \u2192 Found plan metadata in saas app: ${r.planType}, allowed: ${r.allowedComponents?r.allowedComponents.length+" components":"all"}`),r}}catch(t){if(t.statusCode===404){process.env.FF_DEBUG&&console.log(" \u2192 ff-id not found in saas app, trying legacy server");let r=`${k}/${this.ffId}/metadata`;try{process.env.FF_DEBUG&&console.log(` \u2192 Fetching from legacy server: ${r}`);let s=await this.fetchJson(r),i={planType:s.planType||"full",allowedComponents:s.allowedComponents||null};return process.env.FF_DEBUG&&console.log(` \u2192 Found in legacy server: ${i.planType}, allowed: ${i.allowedComponents?i.allowedComponents.length+" components":"all"}`),i}catch(s){if(s.statusCode===404)return process.env.FF_DEBUG&&console.log(" \u2192 ff-id not found in any server - access denied"),{planType:"denied",allowedComponents:[],error:"Design system not found. Please ensure your ff-id is valid."};throw s}}throw t}}};Fe.exports={APIClient:H}});var ze=require("https"),Ke=require("http"),m=require("fs"),u=require("path"),{URL:W}=require("url"),Ee=require("os"),Qe="https://registry.frontfriend.dev",Xe=["legacy","v4"],Y=class{constructor(e={}){this.appRoot=e.appRoot||process.cwd(),this.framework=e.framework||this.detectFramework(),this.config=e.config||{},this.registryGeneration=this.resolveRegistryGeneration(e.registryGeneration),this.outputPath=e.outputPath||this.getDefaultOutputPath(),this.overwrite=e.overwrite||!1,this.downloadedComponents=new Set,this.downloadingComponents=new Set,this.ffId=this.config.ffId||this.config["ff-id"]||null,this.registryUrl=this.resolveRegistryUrl(e.registryUrl),this.planMetadata=null}resolveRegistryUrl(e){let t=this.config.registry,r=this.config.registryUrl||this.config.registryBaseUrl||(typeof t=="object"?t.url||t.baseUrl:void 0);return(e||r||process.env.FF_REGISTRY_URL||Qe).replace(/\/+$/,"")}resolveRegistryGeneration(e){let t=this.config.registry,r=this.config.registryGeneration||this.config.registryVersion||(typeof t=="string"?t:(t==null?void 0:t.generation)||(t==null?void 0:t.version));return this.normalizeRegistryGeneration(e||r||(this.detectTailwindV4()?"v4":"legacy"))}normalizeRegistryGeneration(e){if(e==null||e==="")return"legacy";if(e==="v4"||e===4||e==="4")return"v4";if(e==="legacy")return"legacy";throw new Error(`Unsupported registry generation "${e}". Supported generations: ${Xe.join(", ")}.`)}readPackageJson(){let e=u.join(this.appRoot,"package.json");if(!m.existsSync(e))return null;try{return JSON.parse(m.readFileSync(e,"utf8"))}catch{return null}}getDependencyVersion(e){var r,s,i;let t=this.readPackageJson();return((r=t==null?void 0:t.dependencies)==null?void 0:r[e])||((s=t==null?void 0:t.devDependencies)==null?void 0:s[e])||((i=t==null?void 0:t.peerDependencies)==null?void 0:i[e])||null}getDependencyMajorVersion(e){var s;let t=this.getDependencyVersion(e),r=(s=t==null?void 0:t.match(/(\d+)/))==null?void 0:s[1];return r?Number(r):null}validateRuntimeCompatibility(){if(this.framework!=="react")return;let e=this.getDependencyVersion("react"),t=this.getDependencyMajorVersion("react");if(!(!e||!t)){if(this.registryGeneration==="v4"&&t<19)throw new Error(`Tailwind v4 React registry requires React 19; found react ${e}`);if(this.registryGeneration==="legacy"&&t>=19)throw new Error(`Legacy React registry targets React 18; found react ${e}. Use --registry v4 for React 19 projects.`)}}detectTailwindV4(){let e=this.getDependencyMajorVersion("tailwindcss");return e?e>=4:!1}getRegistryUrl(e,{custom:t=!1,index:r=!1}={}){let s=r?"index.json":`${e}.json`;return t?this.registryGeneration==="v4"?`${this.registryUrl}/custom/v4/${this.ffId}/${this.framework}/${s}`:`${this.registryUrl}/custom/${this.ffId}/${this.framework}/${s}`:this.registryGeneration==="v4"?`${this.registryUrl}/components/v4/${this.framework}/${s}`:`${this.registryUrl}/components/${this.framework}/${s}`}getRegistryDependencyName(e){if(typeof e!="string"||!/^[a-z][a-z0-9+.-]*:\/\//i.test(e))return e;try{let t=new W(e),r=new W(this.registryUrl);if(t.origin!==r.origin)throw new Error(`Unsupported registry dependency URL "${e}". Only Frontfriend registry URLs are supported by this downloader.`);let s=t.pathname.split("/").filter(Boolean).map(a=>decodeURIComponent(a)),i,o,l,c;if(s[0]!=="r")throw new Error(`Unsupported registry dependency URL "${e}". Expected a Frontfriend /r/{generation}/{framework}/{component}.json route.`);if(s[2]==="custom"?[,i,,l,o,c]=s:[,i,o,c]=s,!i||!o||!c||!c.endsWith(".json"))throw new Error(`Unsupported registry dependency URL "${e}". Expected a Frontfriend /r/{generation}/{framework}/{component}.json route.`);if(i!==this.registryGeneration)throw new Error(`Registry dependency URL "${e}" targets generation "${i}" but downloader is using "${this.registryGeneration}".`);if(o!==this.framework)throw new Error(`Registry dependency URL "${e}" targets framework "${o}" but downloader is using "${this.framework}".`);if(l&&l!==this.ffId)throw new Error(`Registry dependency URL "${e}" targets ff-id "${l}" but downloader is using "${this.ffId||"none"}".`);return c.endsWith(".json")?c.slice(0,-5):c}catch(t){if(t.message.startsWith("Unsupported registry dependency URL")||t.message.startsWith("Registry dependency URL"))throw t;return e}}detectFramework(){let e=u.join(this.appRoot,"package.json");if(m.existsSync(e)){let t=JSON.parse(m.readFileSync(e,"utf8")),r={...t.dependencies,...t.devDependencies};if(r.vue)return"vue";if(r.react)return"react"}return"react"}getDefaultOutputPath(){if(this.config.aliases&&this.config.aliases.ui){let t=this.config.aliases.ui.replace(/^@\//,"");return u.join(this.appRoot,t)}return this.framework==="vue"?u.join(this.appRoot,"src/components/ui"):u.join(this.appRoot,"components/ui")}fetchJson(e){let t=process.env.FF_USE_LOCAL==="true",r=process.env.FF_USE_LOCAL_REGISTRY==="true",s=e.includes(this.registryUrl);if(t||r&&s){process.env.FF_DEBUG&&r&&!t&&console.log(" \u2192 Using local registry for components");let i=["../../packages/registry","../../../packages/registry","../../../../packages/registry",u.join(__dirname,"../../../registry"),"packages/registry"],o;for(let a of i){let d=u.isAbsolute(a)?a:u.join(process.cwd(),a);if(m.existsSync(d)){o=d;break}}if(!o)return Promise.reject(new Error(`Local registry not found. Tried paths: ${i.join(", ")}`));let l=e.replace(this.registryUrl,"").replace(/^\//,""),c=u.join(o,...l.split("/"));try{let a=m.readFileSync(c,"utf8");return Promise.resolve(JSON.parse(a))}catch(a){return a.code==="ENOENT"?Promise.reject(new Error("HTTP 404: Not Found")):Promise.reject(a)}}return new Promise((i,o)=>{(new W(e).protocol==="http:"?Ke:ze).get(e,c=>{let a="";c.on("data",d=>{a+=d}),c.on("end",()=>{if(c.statusCode>=400){let d=c.statusMessage;try{let h=JSON.parse(a);d=h.error||h.message||d}catch{}o(new Error(`HTTP ${c.statusCode}: ${d}`));return}try{i(JSON.parse(a))}catch(d){o(new Error(`Invalid JSON response: ${d.message}`))}})}).on("error",c=>{o(c)})})}async getAllComponents(){var e;this.validateRuntimeCompatibility();try{let t=this.getRegistryUrl(null,{index:!0}),s=(await this.fetchJson(t)).components||[];if(this.ffId){try{await this.isComponentAllowed("dummy")}catch{if(this.planMetadata&&this.planMetadata.planType==="denied")throw new Error(this.planMetadata.error||"Access denied. Your ff-id was not found in any server.")}this.planMetadata&&this.planMetadata.planType==="trial"&&this.planMetadata.allowedComponents&&(s=s.filter(i=>this.planMetadata.allowedComponents.includes(i)),process.env.FF_DEBUG&&console.log(` \u2192 Trial plan: filtering to ${s.length} allowed components`))}return s}catch(t){throw t.message.includes("404")&&this.registryGeneration==="v4"?new Error(`Tailwind v4 registry not available for ${this.framework}`):((e=this.planMetadata)==null?void 0:e.planType)==="denied"||t.message.startsWith("Access denied.")?t:new Error(`Failed to fetch component index: ${t.message}`)}}async getCustomComponents(){if(!this.ffId)return process.env.FF_DEBUG&&console.log(" \u2192 No ff-id found, skipping custom components"),[];this.validateRuntimeCompatibility();try{let e=this.getRegistryUrl(null,{custom:!0,index:!0});process.env.FF_DEBUG&&console.log(` \u2192 Fetching custom components from: ${e}`);let t=await this.fetchJson(e);return process.env.FF_DEBUG&&console.log(` \u2192 Found custom components: ${JSON.stringify(t.components)}`),t.components||[]}catch(e){if(!e.message.includes("404"))throw new Error(`Failed to fetch custom component index: ${e.message}`);return process.env.FF_DEBUG&&console.log(` \u2192 No custom components found: ${e.message}`),[]}}async downloadComponents(e){process.env.FF_DEBUG&&console.log(` \u2192 ComponentDownloader initialized with ff-id: ${this.ffId}`);let t={successful:[],failed:[],dependencies:new Set};for(let r of e)try{let s=await this.downloadComponent(r);t.successful.push(r),s.forEach(i=>t.dependencies.add(i))}catch(s){t.failed.push({component:r,error:s.message})}return{successful:t.successful,failed:t.failed,dependencies:Array.from(t.dependencies)}}async isComponentAllowed(e){if(!this.planMetadata&&this.ffId){let{APIClient:t}=$e(),r=new t(this.ffId,{baseURL:this.config["api-url"]||this.config.apiUrl});try{this.planMetadata=await r.fetchPlanMetadata(),process.env.FF_DEBUG&&console.log(` \u2192 Fetched plan metadata: ${this.planMetadata.planType}, allowed: ${this.planMetadata.allowedComponents?this.planMetadata.allowedComponents.length+" components":"all"}`)}catch(s){console.warn("Failed to fetch plan metadata:",s.message),this.planMetadata={planType:"full",allowedComponents:null}}}if(this.planMetadata&&this.planMetadata.planType==="denied")throw new Error(this.planMetadata.error||"Access denied. Your ff-id was not found in any server.");return!this.planMetadata||this.planMetadata.planType==="full"?!0:this.planMetadata.planType==="trial"&&this.planMetadata.allowedComponents?this.planMetadata.allowedComponents.includes(e):!1}async downloadComponent(e){if(this.validateRuntimeCompatibility(),this.downloadedComponents.has(e))return[];if(this.downloadingComponents.has(e))throw new Error(`Circular registry dependency detected while downloading "${e}"`);this.downloadingComponents.add(e);try{return await this.downloadComponentInternal(e)}finally{this.downloadingComponents.delete(e)}}async downloadComponentInternal(e){if(process.env.FF_DEBUG&&(console.log(` \u2192 Checking if component "${e}" is allowed...`),console.log(` \u2192 FF-ID: ${this.ffId}`)),!await this.isComponentAllowed(e)){let c=`Component "${e}" is not available in your trial plan. Please upgrade to access all components.`;throw console.error(`\u274C ${c}`),new Error(c)}console.log(`\u{1F4E5} Downloading ${e}...`);let r,s=!1;if(this.ffId){let c=this.getRegistryUrl(e,{custom:!0});try{r=await this.fetchJson(c),s=!0,process.env.FF_DEBUG&&console.log(` \u2192 Found custom component for ${e}`)}catch(a){if(!a.message.includes("404"))throw new Error(`Failed to fetch custom component "${e}": ${a.message}`);process.env.FF_DEBUG&&console.log(` \u2192 No custom component found for ${e}, trying standard`)}}if(!r){let c=this.getRegistryUrl(e);try{r=await this.fetchJson(c)}catch(a){throw a.message.includes("404")?this.registryGeneration==="v4"?new Error(`Tailwind v4 component "${e}" not migrated for ${this.framework}`):new Error(`Component "${e}" not found`):new Error(`Failed to fetch ${e}: ${a.message}`)}}if(!r.files||!Array.isArray(r.files))throw new Error(`Invalid component data for ${e}`);let i=[...r.dependencies||[]],o=(r.registryDependencies||[]).map(c=>{try{return{dep:c,dependencyName:this.getRegistryDependencyName(c)}}catch(a){throw this.registryGeneration==="v4"?new Error(`Failed to download required v4 registry dependency "${c}" for "${e}": ${a.message}`):a}}),l=async()=>{if(o.length>0){console.log(` \u{1F4E6} Installing registry dependencies: ${o.map(({dep:c})=>c).join(", ")}`);for(let{dep:c,dependencyName:a}of o)try{(await this.downloadComponent(a)).forEach(h=>i.push(h))}catch(d){if(this.registryGeneration==="v4")throw new Error(`Failed to download required v4 registry dependency "${c}" for "${e}": ${d.message}`);console.warn(` \u26A0\uFE0F Failed to download dependency ${c}: ${d.message}`)}}};this.registryGeneration==="v4"&&await l();for(let c of r.files)await this.writeComponentFile(c);return this.downloadedComponents.add(e),console.log(` \u2713 ${e} downloaded${s&&process.env.FF_DEBUG?" (custom)":""}`),this.registryGeneration!=="v4"&&await l(),i}async writeComponentFile(e){var d,h,g;let t=e.target||e.name||e.path;if(!t)throw new Error("Invalid component file descriptor: missing name/path/target");let r=f=>f.split("/").join(u.sep),s=(f,T,z)=>{let _=u.resolve(f),U=u.resolve(_,r(T)),v=u.relative(_,U);if(v===""||v.startsWith("..")||u.isAbsolute(v))throw new Error(`Unsafe component file path "${t}": resolves outside ${z}`);return U},i,o=(d=e.target)==null?void 0:d.match(/^@([^/]+)\//),l=f=>{var Q;if(f==="ui")return u.resolve(this.outputPath);let U=(((Q=this.config.aliases)==null?void 0:Q[f])||{components:"components",hooks:"hooks",lib:"lib"}[f]||f).replace(/^@\//,"").replace(/^~\//,""),v=u.resolve(this.appRoot),K=u.isAbsolute(U)?u.resolve(U):u.resolve(v,r(U)),A=u.relative(v,K);if(A===""||A.startsWith("..")||u.isAbsolute(A))throw new Error(`Unsafe component file path "${t}": alias @${f} resolves outside app root`);return K};if((h=e.target)!=null&&h.startsWith("@ui/"))i=s(this.outputPath,e.target.replace(/^@ui\//,""),"output root");else if(o){let f=o[1],T=l(f);i=s(T,e.target.replace(new RegExp(`^@${f}/`),""),`@${f} alias root`)}else(g=e.target)!=null&&g.startsWith("~/")?i=s(this.appRoot,e.target.replace(/^~\//,""),"app root"):e.target?i=s(this.appRoot,e.target.replace(/^\/+/,""),"app root"):i=s(this.outputPath,t,"output root");let c=u.dirname(i);if(m.existsSync(c)||m.mkdirSync(c,{recursive:!0}),m.existsSync(i)&&!this.overwrite){console.log(` \u26A0\uFE0F Skipping ${t} (already exists)`);return}let a=e.content;Ee.EOL!==`
3
+ `&&(a=e.content.replace(/\n/g,Ee.EOL)),m.writeFileSync(i,a,"utf8")}};module.exports={ComponentDownloader:Y};
4
4
  //# sourceMappingURL=component-downloader.js.map