@frontfriend/tailwind 4.0.19 → 4.0.21
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/browser.mjs +1 -1
- package/dist/browser.mjs.map +2 -2
- package/dist/cli.js +36 -36
- package/dist/components-config-schema.js +1 -1
- package/dist/components-config-schema.js.map +2 -2
- package/dist/ffdc.js +1 -1
- package/dist/ffdc.js.map +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +2 -2
- package/dist/lib/core/api-client.js +2 -2
- package/dist/lib/core/api-client.js.map +3 -3
- package/dist/lib/core/cache-manager.js +2 -1
- package/dist/lib/core/component-downloader.js +3 -3
- package/dist/lib/core/component-downloader.js.map +3 -3
- package/dist/lib/core/components-config-schema.js +1 -1
- package/dist/lib/core/components-config-schema.js.map +2 -2
- package/dist/lib/core/constants.js +1 -1
- package/dist/lib/core/constants.js.map +3 -3
- package/dist/lib/core/credentials.js +2 -2
- package/dist/lib/core/credentials.js.map +3 -3
- package/dist/next.js +1 -1
- package/dist/next.js.map +3 -3
- package/dist/vite.js +3 -3
- package/dist/vite.js.map +3 -3
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../lib/core/constants.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Configuration constants for FrontFriend Tailwind v2\n */\n\n// API Configuration. The platform currently lives on the dev deployment \u2014\n// keep this as the CLI default so `frontfriend login`/init work zero-config.\nconst DEFAULT_API_URL = 'https://app.dev.frontfriend.dev';\nconst LEGACY_API_URL = 'https://registry-legacy.frontfriend.dev';\n\n// Cache Configuration\nconst CACHE_DIR_NAME = '.cache/frontfriend';\nconst CACHE_TTL_DAYS = 7;\nconst CACHE_TTL_MS = CACHE_TTL_DAYS * 24 * 60 * 60 * 1000;\n\n// File names\nconst CACHE_FILES = {\n JS: [\n 'tokens.js',\n 'variables.js',\n 'semanticVariables.js',\n 'semanticDarkVariables.js',\n 'safelist.js',\n 'custom.js'\n ],\n JSON: [\n 'fonts.json',\n 'icons.json',\n 'components-config.json',\n 'version.json',\n 'metadata.json'\n ]\n};\n\n// Environment variables\nconst ENV_VARS = {\n FF_ID: 'FF_ID',\n FF_API_URL: 'FF_API_URL',\n FF_USE_LOCAL: 'FF_USE_LOCAL',\n FF_AUTH_TOKEN: 'FF_AUTH_TOKEN'\n};\n\nmodule.exports = {\n DEFAULT_API_URL,\n LEGACY_API_URL,\n CACHE_DIR_NAME,\n CACHE_TTL_DAYS,\n CACHE_TTL_MS,\n CACHE_FILES,\n ENV_VARS\n}
|
|
5
|
-
"mappings": "AAMA,IAAMA,EAAkB,kCAClBC,EAAiB,0CAGjBC,EAAiB,qBAKvB,IAAMC,EAAc,CAClB,GAAI,CACF,YACA,eACA,uBACA,2BACA,cACA,WACF,EACA,KAAM,CACJ,aACA,aACA,yBACA,eACA,eACF,CACF,EAGMC,EAAW,CACf,MAAO,QACP,WAAY,aACZ,aAAc,eACd,cAAe,eACjB,
|
|
6
|
-
"names": ["DEFAULT_API_URL", "LEGACY_API_URL", "CACHE_DIR_NAME", "CACHE_FILES", "ENV_VARS", "DEFAULT_API_URL", "LEGACY_API_URL", "CACHE_DIR_NAME"]
|
|
4
|
+
"sourcesContent": ["/**\n * Configuration constants for FrontFriend Tailwind v2\n */\n\n// API Configuration. The platform currently lives on the dev deployment \u2014\n// keep this as the CLI default so `frontfriend login`/init work zero-config.\nconst DEFAULT_API_URL = 'https://app.dev.frontfriend.dev';\nconst LEGACY_API_URL = 'https://registry-legacy.frontfriend.dev';\n\n// Cache Configuration\nconst CACHE_DIR_NAME = '.cache/frontfriend';\nconst CACHE_TTL_DAYS = 7;\nconst CACHE_TTL_MS = CACHE_TTL_DAYS * 24 * 60 * 60 * 1000;\n\n// File names\nconst CACHE_FILES = {\n JS: [\n 'tokens.js',\n 'variables.js',\n 'semanticVariables.js',\n 'semanticDarkVariables.js',\n 'safelist.js',\n 'custom.js'\n ],\n JSON: [\n 'fonts.json',\n 'icons.json',\n 'components-config.json',\n 'version.json',\n 'versionMetadata.json',\n 'metadata.json'\n ]\n};\n\n// Environment variables\nconst ENV_VARS = {\n FF_ID: 'FF_ID',\n FF_API_URL: 'FF_API_URL',\n FF_USE_LOCAL: 'FF_USE_LOCAL',\n FF_AUTH_TOKEN: 'FF_AUTH_TOKEN'\n};\n\n/**\n * The registry follows the app: with api-url app.dev.frontfriend.dev the\n * components must come from registry.dev.frontfriend.dev, not prod (the two\n * registries do not serve the same item set). Environments pair `app.<env>`\n * with `registry.<env>`, so derive the registry host by swapping the prefix.\n * Returns null for unknown api-url shapes (callers fall back to their default).\n */\nfunction deriveRegistryFromApiUrl(apiUrl) {\n if (!apiUrl) return null;\n try {\n const url = new URL(apiUrl);\n if (!url.hostname.startsWith('app.')) return null;\n return `${url.protocol}//${url.hostname.replace(/^app\\./, 'registry.')}`;\n } catch {\n return null;\n }\n}\n\nmodule.exports = {\n DEFAULT_API_URL,\n LEGACY_API_URL,\n CACHE_DIR_NAME,\n CACHE_TTL_DAYS,\n CACHE_TTL_MS,\n CACHE_FILES,\n ENV_VARS,\n deriveRegistryFromApiUrl\n};\n"],
|
|
5
|
+
"mappings": "AAMA,IAAMA,EAAkB,kCAClBC,EAAiB,0CAGjBC,EAAiB,qBAKvB,IAAMC,EAAc,CAClB,GAAI,CACF,YACA,eACA,uBACA,2BACA,cACA,WACF,EACA,KAAM,CACJ,aACA,aACA,yBACA,eACA,uBACA,eACF,CACF,EAGMC,EAAW,CACf,MAAO,QACP,WAAY,aACZ,aAAc,eACd,cAAe,eACjB,EASA,SAASC,EAAyBC,EAAQ,CACxC,GAAI,CAACA,EAAQ,OAAO,KACpB,GAAI,CACF,IAAMC,EAAM,IAAI,IAAID,CAAM,EAC1B,OAAKC,EAAI,SAAS,WAAW,MAAM,EAC5B,GAAGA,EAAI,QAAQ,KAAKA,EAAI,SAAS,QAAQ,SAAU,WAAW,CAAC,GADzB,IAE/C,MAAQ,CACN,OAAO,IACT,CACF,CAEA,OAAO,QAAU,CACf,gBAAAC,EACA,eAAAC,EACA,eAAAC,EACA,iBACA,oBACA,YAAAP,EACA,SAAAC,EACA,yBAAAC,CACF",
|
|
6
|
+
"names": ["DEFAULT_API_URL", "LEGACY_API_URL", "CACHE_DIR_NAME", "CACHE_FILES", "ENV_VARS", "deriveRegistryFromApiUrl", "apiUrl", "url", "DEFAULT_API_URL", "LEGACY_API_URL", "CACHE_DIR_NAME"]
|
|
7
7
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
`,{mode:384});try{i.chmodSync(c,384)}catch{}}function
|
|
1
|
+
var m=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var F=m((M,A)=>{var I="https://app.dev.frontfriend.dev",g="https://registry-legacy.frontfriend.dev",v=".cache/frontfriend",D={JS:["tokens.js","variables.js","semanticVariables.js","semanticDarkVariables.js","safelist.js","custom.js"],JSON:["fonts.json","icons.json","components-config.json","version.json","versionMetadata.json","metadata.json"]},H={FF_ID:"FF_ID",FF_API_URL:"FF_API_URL",FF_USE_LOCAL:"FF_USE_LOCAL",FF_AUTH_TOKEN:"FF_AUTH_TOKEN"};function $(e){if(!e)return null;try{let t=new URL(e);return t.hostname.startsWith("app.")?`${t.protocol}//${t.hostname.replace(/^app\./,"registry.")}`:null}catch{return null}}A.exports={DEFAULT_API_URL:I,LEGACY_API_URL:g,CACHE_DIR_NAME:v,CACHE_TTL_DAYS:7,CACHE_TTL_MS:6048e5,CACHE_FILES:D,ENV_VARS:H,deriveRegistryFromApiUrl:$}});var i=require("fs"),E=require("path"),P=require("os"),x=require("https"),j=require("http"),{URL:N}=require("url"),{DEFAULT_API_URL:y}=F(),p=E.join(P.homedir(),".frontfriend"),c=E.join(p,"credentials");function O(){return c}function k(){try{return i.existsSync(c)?JSON.parse(i.readFileSync(c,"utf8")):null}catch{return null}}function L(e){i.mkdirSync(p,{recursive:!0,mode:448}),i.writeFileSync(c,`${JSON.stringify(e,null,2)}
|
|
2
|
+
`,{mode:384});try{i.chmodSync(c,384)}catch{}}function b(){return i.existsSync(c)?(i.unlinkSync(c),!0):!1}function S(e,t=60*1e3){return!(e!=null&&e.accessToken)||!e.expiresAt||Date.now()+t>=e.expiresAt}function l(e){let t=new Error(`${e}. Run \`frontfriend login\` to re-authenticate.`);return t.code="FF_AUTH_REFRESH_FAILED",t}function w(e,t,r){return new Promise((u,s)=>{let f=new N(e),U=f.protocol==="https:"?x:j,C=JSON.stringify(t||{}),T=U.request({hostname:f.hostname,port:f.port,path:`${f.pathname}${f.search}`,method:"POST",headers:{"content-type":"application/json","content-length":Buffer.byteLength(C),...r?{authorization:`Bearer ${r}`}:{}}},n=>{let d="";n.on("data",o=>{d+=o}),n.on("end",()=>{if(n.statusCode>=300&&n.statusCode<400){let a=n.headers.location?` to ${n.headers.location}`:"",h=new Error(`HTTP ${n.statusCode}: redirected${a}`);h.statusCode=n.statusCode,h.body=d,s(h);return}let o=null;try{o=d?JSON.parse(d):null}catch{let h=n.headers["content-type"]||"unknown content-type",_=new Error(`Expected JSON from FrontFriend API at ${e}, but received ${h} (HTTP ${n.statusCode}). Check FF_API_URL or pass --api-url with the FrontFriend app URL.`);if(_.statusCode=n.statusCode,_.body=d,n.statusCode>=400){s(_);return}s(_);return}if(n.statusCode>=400){let a=new Error((o==null?void 0:o.error_description)||(o==null?void 0:o.error)||`HTTP ${n.statusCode}`);a.statusCode=n.statusCode,a.body=o,s(a);return}u(o)})});T.on("error",s),T.write(C),T.end()})}async function R(e,t=y){if(!(e!=null&&e.refreshToken)||!(e!=null&&e.deviceId))throw l("FrontFriend session expired");let r;try{r=await w(`${t}/api/plugin/token`,{grant_type:"refresh_token",refresh_token:e.refreshToken,device_id:e.deviceId})}catch(s){throw l((s==null?void 0:s.message)||"Could not refresh FrontFriend session")}if(!(r!=null&&r.access_token)||!(r!=null&&r.refresh_token))throw l("Could not refresh FrontFriend session");let u={accessToken:r.access_token,refreshToken:r.refresh_token,deviceId:r.device_id||e.deviceId,expiresAt:Date.now()+(r.expires_in||900)*1e3,refreshExpiresAt:Date.now()+(r.refresh_expires_in||604800)*1e3,ffApiUrl:t};return L(u),u}async function q(e={}){if(!e.skipCredentials){let t=k();if(t!=null&&t.accessToken||t!=null&&t.refreshToken){let r=e.baseURL||t.ffApiUrl||y;return t.accessToken&&!S(t)?t.accessToken:(await R(t,r)).accessToken}}return e.envToken?e.envToken:e.legacyToken?(e.silent||console.warn("\u26A0\uFE0F auth-token in frontfriend.config.js is deprecated. Run `frontfriend login` to store credentials outside the repo."),e.legacyToken):null}module.exports={getCredentialsPath:O,readCredentials:k,writeCredentials:L,deleteCredentials:b,isExpired:S,postJson:w,refreshCredentials:R,resolveAuthToken:q,createAuthRefreshError:l};
|
|
3
3
|
//# sourceMappingURL=credentials.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../lib/core/constants.js", "../../../lib/core/credentials.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Configuration constants for FrontFriend Tailwind v2\n */\n\n// API Configuration. The platform currently lives on the dev deployment \u2014\n// keep this as the CLI default so `frontfriend login`/init work zero-config.\nconst DEFAULT_API_URL = 'https://app.dev.frontfriend.dev';\nconst LEGACY_API_URL = 'https://registry-legacy.frontfriend.dev';\n\n// Cache Configuration\nconst CACHE_DIR_NAME = '.cache/frontfriend';\nconst CACHE_TTL_DAYS = 7;\nconst CACHE_TTL_MS = CACHE_TTL_DAYS * 24 * 60 * 60 * 1000;\n\n// File names\nconst CACHE_FILES = {\n JS: [\n 'tokens.js',\n 'variables.js',\n 'semanticVariables.js',\n 'semanticDarkVariables.js',\n 'safelist.js',\n 'custom.js'\n ],\n JSON: [\n 'fonts.json',\n 'icons.json',\n 'components-config.json',\n 'version.json',\n 'metadata.json'\n ]\n};\n\n// Environment variables\nconst ENV_VARS = {\n FF_ID: 'FF_ID',\n FF_API_URL: 'FF_API_URL',\n FF_USE_LOCAL: 'FF_USE_LOCAL',\n FF_AUTH_TOKEN: 'FF_AUTH_TOKEN'\n};\n\nmodule.exports = {\n DEFAULT_API_URL,\n LEGACY_API_URL,\n CACHE_DIR_NAME,\n CACHE_TTL_DAYS,\n CACHE_TTL_MS,\n CACHE_FILES,\n ENV_VARS\n}
|
|
5
|
-
"mappings": "8DAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CAMA,IAAMC,EAAkB,kCAClBC,EAAiB,0CAGjBC,EAAiB,qBAKjBC,EAAc,CAClB,GAAI,CACF,YACA,eACA,uBACA,2BACA,cACA,WACF,EACA,KAAM,CACJ,aACA,aACA,yBACA,eACA,eACF,CACF,EAGMC,EAAW,CACf,MAAO,QACP,WAAY,aACZ,aAAc,eACd,cAAe,eACjB,
|
|
6
|
-
"names": ["require_constants", "__commonJSMin", "exports", "module", "DEFAULT_API_URL", "LEGACY_API_URL", "CACHE_DIR_NAME", "CACHE_FILES", "ENV_VARS", "fs", "path", "os", "https", "http", "URL", "DEFAULT_API_URL", "CREDENTIALS_DIR", "CREDENTIALS_PATH", "getCredentialsPath", "readCredentials", "writeCredentials", "credentials", "deleteCredentials", "isExpired", "skewMs", "createAuthRefreshError", "message", "error", "postJson", "url", "body", "authToken", "resolve", "reject", "parsedUrl", "protocol", "payload", "request", "response", "data", "chunk", "redirectUrl", "parsed", "contentType", "apiError", "refreshCredentials", "baseURL", "refreshed", "resolveAuthToken", "options"]
|
|
4
|
+
"sourcesContent": ["/**\n * Configuration constants for FrontFriend Tailwind v2\n */\n\n// API Configuration. The platform currently lives on the dev deployment \u2014\n// keep this as the CLI default so `frontfriend login`/init work zero-config.\nconst DEFAULT_API_URL = 'https://app.dev.frontfriend.dev';\nconst LEGACY_API_URL = 'https://registry-legacy.frontfriend.dev';\n\n// Cache Configuration\nconst CACHE_DIR_NAME = '.cache/frontfriend';\nconst CACHE_TTL_DAYS = 7;\nconst CACHE_TTL_MS = CACHE_TTL_DAYS * 24 * 60 * 60 * 1000;\n\n// File names\nconst CACHE_FILES = {\n JS: [\n 'tokens.js',\n 'variables.js',\n 'semanticVariables.js',\n 'semanticDarkVariables.js',\n 'safelist.js',\n 'custom.js'\n ],\n JSON: [\n 'fonts.json',\n 'icons.json',\n 'components-config.json',\n 'version.json',\n 'versionMetadata.json',\n 'metadata.json'\n ]\n};\n\n// Environment variables\nconst ENV_VARS = {\n FF_ID: 'FF_ID',\n FF_API_URL: 'FF_API_URL',\n FF_USE_LOCAL: 'FF_USE_LOCAL',\n FF_AUTH_TOKEN: 'FF_AUTH_TOKEN'\n};\n\n/**\n * The registry follows the app: with api-url app.dev.frontfriend.dev the\n * components must come from registry.dev.frontfriend.dev, not prod (the two\n * registries do not serve the same item set). Environments pair `app.<env>`\n * with `registry.<env>`, so derive the registry host by swapping the prefix.\n * Returns null for unknown api-url shapes (callers fall back to their default).\n */\nfunction deriveRegistryFromApiUrl(apiUrl) {\n if (!apiUrl) return null;\n try {\n const url = new URL(apiUrl);\n if (!url.hostname.startsWith('app.')) return null;\n return `${url.protocol}//${url.hostname.replace(/^app\\./, 'registry.')}`;\n } catch {\n return null;\n }\n}\n\nmodule.exports = {\n DEFAULT_API_URL,\n LEGACY_API_URL,\n CACHE_DIR_NAME,\n CACHE_TTL_DAYS,\n CACHE_TTL_MS,\n CACHE_FILES,\n ENV_VARS,\n deriveRegistryFromApiUrl\n};\n", "const fs = require('fs');\nconst path = require('path');\nconst os = require('os');\nconst https = require('https');\nconst http = require('http');\nconst { URL } = require('url');\nconst { DEFAULT_API_URL } = require('./constants');\n\nconst CREDENTIALS_DIR = path.join(os.homedir(), '.frontfriend');\nconst CREDENTIALS_PATH = path.join(CREDENTIALS_DIR, 'credentials');\n\nfunction getCredentialsPath() {\n return CREDENTIALS_PATH;\n}\n\nfunction readCredentials() {\n try {\n if (!fs.existsSync(CREDENTIALS_PATH)) return null;\n return JSON.parse(fs.readFileSync(CREDENTIALS_PATH, 'utf8'));\n } catch {\n return null;\n }\n}\n\nfunction writeCredentials(credentials) {\n fs.mkdirSync(CREDENTIALS_DIR, { recursive: true, mode: 0o700 });\n fs.writeFileSync(CREDENTIALS_PATH, `${JSON.stringify(credentials, null, 2)}\\n`, { mode: 0o600 });\n try {\n fs.chmodSync(CREDENTIALS_PATH, 0o600);\n } catch {\n // Best effort on platforms that do not support chmod.\n }\n}\n\nfunction deleteCredentials() {\n if (fs.existsSync(CREDENTIALS_PATH)) {\n fs.unlinkSync(CREDENTIALS_PATH);\n return true;\n }\n return false;\n}\n\nfunction isExpired(credentials, skewMs = 60 * 1000) {\n return !credentials?.accessToken || !credentials.expiresAt || Date.now() + skewMs >= credentials.expiresAt;\n}\n\nfunction createAuthRefreshError(message) {\n const error = new Error(`${message}. Run \\`frontfriend login\\` to re-authenticate.`);\n error.code = 'FF_AUTH_REFRESH_FAILED';\n return error;\n}\n\nfunction postJson(url, body, authToken) {\n return new Promise((resolve, reject) => {\n const parsedUrl = new URL(url);\n const protocol = parsedUrl.protocol === 'https:' ? https : http;\n const payload = JSON.stringify(body || {});\n const request = protocol.request({\n hostname: parsedUrl.hostname,\n port: parsedUrl.port,\n path: `${parsedUrl.pathname}${parsedUrl.search}`,\n method: 'POST',\n headers: {\n 'content-type': 'application/json',\n 'content-length': Buffer.byteLength(payload),\n ...(authToken ? { authorization: `Bearer ${authToken}` } : {}),\n },\n }, response => {\n let data = '';\n response.on('data', chunk => { data += chunk; });\n response.on('end', () => {\n if (response.statusCode >= 300 && response.statusCode < 400) {\n const redirectUrl = response.headers.location ? ` to ${response.headers.location}` : '';\n const error = new Error(`HTTP ${response.statusCode}: redirected${redirectUrl}`);\n error.statusCode = response.statusCode;\n error.body = data;\n reject(error);\n return;\n }\n\n let parsed = null;\n try {\n parsed = data ? JSON.parse(data) : null;\n } catch (error) {\n const contentType = response.headers['content-type'] || 'unknown content-type';\n const apiError = new Error(\n `Expected JSON from FrontFriend API at ${url}, but received ${contentType} (HTTP ${response.statusCode}). ` +\n 'Check FF_API_URL or pass --api-url with the FrontFriend app URL.'\n );\n apiError.statusCode = response.statusCode;\n apiError.body = data;\n if (response.statusCode >= 400) {\n reject(apiError);\n return;\n }\n reject(apiError);\n return;\n }\n if (response.statusCode >= 400) {\n const error = new Error(parsed?.error_description || parsed?.error || `HTTP ${response.statusCode}`);\n error.statusCode = response.statusCode;\n error.body = parsed;\n reject(error);\n return;\n }\n resolve(parsed);\n });\n });\n request.on('error', reject);\n request.write(payload);\n request.end();\n });\n}\n\nasync function refreshCredentials(credentials, baseURL = DEFAULT_API_URL) {\n if (!credentials?.refreshToken || !credentials?.deviceId) {\n throw createAuthRefreshError('FrontFriend session expired');\n }\n\n let response;\n try {\n response = await postJson(`${baseURL}/api/plugin/token`, {\n grant_type: 'refresh_token',\n refresh_token: credentials.refreshToken,\n device_id: credentials.deviceId,\n });\n } catch (error) {\n throw createAuthRefreshError(error?.message || 'Could not refresh FrontFriend session');\n }\n\n if (!response?.access_token || !response?.refresh_token) {\n throw createAuthRefreshError('Could not refresh FrontFriend session');\n }\n\n const refreshed = {\n accessToken: response.access_token,\n refreshToken: response.refresh_token,\n deviceId: response.device_id || credentials.deviceId,\n expiresAt: Date.now() + (response.expires_in || 900) * 1000,\n refreshExpiresAt: Date.now() + (response.refresh_expires_in || 604800) * 1000,\n ffApiUrl: baseURL,\n };\n writeCredentials(refreshed);\n return refreshed;\n}\n\nasync function resolveAuthToken(options = {}) {\n if (!options.skipCredentials) {\n const credentials = readCredentials();\n if (credentials?.accessToken || credentials?.refreshToken) {\n const baseURL = options.baseURL || credentials.ffApiUrl || DEFAULT_API_URL;\n if (credentials.accessToken && !isExpired(credentials)) {\n return credentials.accessToken;\n }\n const refreshed = await refreshCredentials(credentials, baseURL);\n return refreshed.accessToken;\n }\n }\n\n if (options.envToken) return options.envToken;\n if (options.legacyToken) {\n if (!options.silent) {\n console.warn('\u26A0\uFE0F auth-token in frontfriend.config.js is deprecated. Run `frontfriend login` to store credentials outside the repo.');\n }\n return options.legacyToken;\n }\n return null;\n}\n\nmodule.exports = {\n getCredentialsPath,\n readCredentials,\n writeCredentials,\n deleteCredentials,\n isExpired,\n postJson,\n refreshCredentials,\n resolveAuthToken,\n createAuthRefreshError,\n};\n"],
|
|
5
|
+
"mappings": "8DAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,CAMA,IAAMC,EAAkB,kCAClBC,EAAiB,0CAGjBC,EAAiB,qBAKjBC,EAAc,CAClB,GAAI,CACF,YACA,eACA,uBACA,2BACA,cACA,WACF,EACA,KAAM,CACJ,aACA,aACA,yBACA,eACA,uBACA,eACF,CACF,EAGMC,EAAW,CACf,MAAO,QACP,WAAY,aACZ,aAAc,eACd,cAAe,eACjB,EASA,SAASC,EAAyBC,EAAQ,CACxC,GAAI,CAACA,EAAQ,OAAO,KACpB,GAAI,CACF,IAAMC,EAAM,IAAI,IAAID,CAAM,EAC1B,OAAKC,EAAI,SAAS,WAAW,MAAM,EAC5B,GAAGA,EAAI,QAAQ,KAAKA,EAAI,SAAS,QAAQ,SAAU,WAAW,CAAC,GADzB,IAE/C,MAAQ,CACN,OAAO,IACT,CACF,CAEAR,EAAO,QAAU,CACf,gBAAAC,EACA,eAAAC,EACA,eAAAC,EACA,iBACA,oBACA,YAAAC,EACA,SAAAC,EACA,yBAAAC,CACF,ICrEA,IAAMG,EAAK,QAAQ,IAAI,EACjBC,EAAO,QAAQ,MAAM,EACrBC,EAAK,QAAQ,IAAI,EACjBC,EAAQ,QAAQ,OAAO,EACvBC,EAAO,QAAQ,MAAM,EACrB,CAAE,IAAAC,CAAI,EAAI,QAAQ,KAAK,EACvB,CAAE,gBAAAC,CAAgB,EAAI,IAEtBC,EAAkBN,EAAK,KAAKC,EAAG,QAAQ,EAAG,cAAc,EACxDM,EAAmBP,EAAK,KAAKM,EAAiB,aAAa,EAEjE,SAASE,GAAqB,CAC5B,OAAOD,CACT,CAEA,SAASE,GAAkB,CACzB,GAAI,CACF,OAAKV,EAAG,WAAWQ,CAAg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URL", "LEGACY_API_URL", "CACHE_DIR_NAME", "CACHE_FILES", "ENV_VARS", "deriveRegistryFromApiUrl", "apiUrl", "url", "fs", "path", "os", "https", "http", "URL", "DEFAULT_API_URL", "CREDENTIALS_DIR", "CREDENTIALS_PATH", "getCredentialsPath", "readCredentials", "writeCredentials", "credentials", "deleteCredentials", "isExpired", "skewMs", "createAuthRefreshError", "message", "error", "postJson", "url", "body", "authToken", "resolve", "reject", "parsedUrl", "protocol", "payload", "request", "response", "data", "chunk", "redirectUrl", "parsed", "contentType", "apiError", "refreshCredentials", "baseURL", "refreshed", "resolveAuthToken", "options"]
|
|
7
7
|
}
|
package/dist/next.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var u=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var A=u((
|
|
1
|
+
var u=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var A=u((fe,E)=>{var J="https://app.dev.frontfriend.dev",U="https://registry-legacy.frontfriend.dev",H=".cache/frontfriend",M={JS:["tokens.js","variables.js","semanticVariables.js","semanticDarkVariables.js","safelist.js","custom.js"],JSON:["fonts.json","icons.json","components-config.json","version.json","versionMetadata.json","metadata.json"]},$={FF_ID:"FF_ID",FF_API_URL:"FF_API_URL",FF_USE_LOCAL:"FF_USE_LOCAL",FF_AUTH_TOKEN:"FF_AUTH_TOKEN"};function q(t){if(!t)return null;try{let e=new URL(t);return e.hostname.startsWith("app.")?`${e.protocol}//${e.hostname.replace(/^app\./,"registry.")}`:null}catch{return null}}E.exports={DEFAULT_API_URL:J,LEGACY_API_URL:U,CACHE_DIR_NAME:H,CACHE_TTL_DAYS:7,CACHE_TTL_MS:6048e5,CACHE_FILES:M,ENV_VARS:$,deriveRegistryFromApiUrl:q}});var j=u((ue,w)=>{var p=class extends Error{constructor(e,n,r){super(e),this.name="APIError",this.statusCode=n,this.url=r,this.code=`API_${n}`}},m=class extends Error{constructor(e,n){super(e),this.name="CacheError",this.operation=n,this.code=`CACHE_${n.toUpperCase()}`}},F=class extends Error{constructor(e,n){super(e),this.name="ConfigError",this.field=n,this.code=n?`CONFIG_${String(n).toUpperCase()}`:"CONFIG_ERROR"}},_=class extends Error{constructor(e,n){super(e),this.name="ProcessingError",this.token=n,this.code="PROCESSING_ERROR"}};w.exports={APIError:p,CacheError:m,ConfigError:F,ProcessingError:_}});var D=u((he,g)=>{var a=require("fs");function G(t){try{let e=a.readFileSync(t,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}function V(t){try{return a.readFileSync(t,"utf8").replace(/^\uFEFF/,"")}catch(e){if(e.code==="ENOENT")return null;throw e}}function Y(t,e,n=2){let r=JSON.stringify(e,null,n);a.writeFileSync(t,r,"utf8")}function B(t,e){a.writeFileSync(t,e,"utf8")}function K(t,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)?"[]":"{}"};`;a.writeFileSync(t,r,"utf8")}else{let n=`module.exports = ${JSON.stringify(e,null,2)};`;a.writeFileSync(t,n,"utf8")}}function X(t){return a.existsSync(t)}function W(t){a.mkdirSync(t,{recursive:!0})}function z(t){a.rmSync(t,{recursive:!0,force:!0})}g.exports={readJsonFileSafe:G,readFileSafe:V,writeJsonFile:Y,writeTextFile:B,writeModuleExportsFile:K,fileExists:X,ensureDirectoryExists:W,removeDirectory:z}});var L=u((de,I)=>{var c=require("path"),{CACHE_DIR_NAME:Q,CACHE_TTL_MS:Z,CACHE_FILES:x}=A(),{CacheError:v}=j(),{readJsonFileSafe:d,readFileSafe:ee,writeJsonFile:O,writeTextFile:N,writeModuleExportsFile:T,fileExists:y,ensureDirectoryExists:te,removeDirectory:ne}=D(),S=class{constructor(e=process.cwd()){this.appRoot=e,this.cacheDir=c.join(e,"node_modules",Q),this.metadataFile=c.join(this.cacheDir,"metadata.json"),this.maxAge=Z}getCacheDir(){return this.cacheDir}isLocalOnly(){let e=d(this.metadataFile);return(e==null?void 0:e.version)==="local-components"}getIconLibrary(){let e=c.join(this.cacheDir,"iconLibrary.json");return y(e)?d(e):null}exists(){return y(this.cacheDir)}isValid(){if(!this.exists())return!1;try{let e=d(this.metadataFile);if(!e)return!1;let n=new Date(e.timestamp).getTime();return Date.now()-n<this.maxAge}catch{return!1}}load(){if(!this.exists())return null;try{let e={};for(let n of x.JS){let r=c.join(this.cacheDir,n);if(y(r)){let s=n.replace(".js","");try{let o=ee(r);if(o!==null){let f={},i={exports:f};new Function("module","exports",o)(i,f),e[s]=i.exports}}catch(o){console.warn(`[Frontfriend] Failed to load ${n}: ${o.message}`),(o.message.includes("Unexpected token")||o.message.includes("Invalid character"))&&console.warn("[Frontfriend] This might be a BOM or encoding issue. Try deleting node_modules/.cache/frontfriend and running `npx frontfriend init` again.")}}}for(let n of x.JSON){let r=c.join(this.cacheDir,n),s=n.replace(".json",""),o=d(r);o!==null&&(e[s]=o)}return e["components-config"]&&(e.componentsConfig=e["components-config"],delete e["components-config"]),e.cls&&!e.safelist&&(e.safelist=e.cls,delete e.cls),e}catch(e){throw new v(`Failed to load cache: ${e.message}`,"read")}}save(e){var n,r;try{te(this.cacheDir);let s={timestamp:new Date().toISOString(),version:((n=e.metadata)==null?void 0:n.version)||"2.0.0",ffId:(r=e.metadata)==null?void 0:r.ffId},o=["tokens","variables","semanticVariables","semanticDarkVariables","safelist","custom"];for(let i of o)if(e[i]!==void 0){let l=c.join(this.cacheDir,`${i}.js`);T(l,e[i])}if(e.safelist&&Array.isArray(e.safelist)){let i=c.join(this.cacheDir,"safelist.js");T(i,e.safelist)}let f={fonts:e.fonts,icons:e.icons||e.iconSet,"components-config":e.componentsConfig,iconLibrary:e.iconLibrary,version:e.version,versionMetadata:e.versionMetadata};for(let[i,l]of Object.entries(f))if(l!==void 0){let h=c.join(this.cacheDir,`${i}.json`);O(h,l)}e.themeCSS!==void 0&&N(c.join(this.cacheDir,"theme.css"),e.themeCSS),e.classesContent!==void 0&&N(c.join(this.cacheDir,"classes.css"),e.classesContent),O(this.metadataFile,s)}catch(s){throw new v(`Failed to save cache: ${s.message}`,"write")}}clear(){this.exists()&&ne(this.cacheDir)}};I.exports=S});var P=u((pe,k)=>{var C='FrontFriend components configuration not found. Run "npx frontfriend init" or "npx frontfriend sync".',se="FrontFriend components configuration was not returned by the SaaS app. The cache was not updated.";function b(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function R(t,e=C){if(!b(t)||Object.keys(t).length===0)throw new Error(e);return t}function re(t){if(!t.exists())throw new Error(C);let e=t.load();return{componentsConfig:R(e==null?void 0:e.componentsConfig),icons:b(e.icons)?e.icons:{}}}k.exports={CACHE_ERROR_MESSAGE:C,SAAS_ERROR_MESSAGE:se,assertComponentsConfig:R,loadCachedComponents:re}});var oe=L(),{loadCachedComponents:ie}=P(),ce=require("path");function ae(t={}){let e=new oe(process.cwd()),{componentsConfig:n,icons:r}=ie(e);return{...t,env:{...t.env,NEXT_PUBLIC_FF_CONFIG:JSON.stringify(n),NEXT_PUBLIC_FF_ICONS:JSON.stringify(r)},webpack:(s,o)=>{if(typeof t.webpack=="function"&&(s=t.webpack(s,o)),typeof e.getCacheDir=="function"){let h=ce.join(e.getCacheDir(),"theme.css");s.resolve=s.resolve||{},s.resolve.alias=s.resolve.alias||{},s.resolve.alias["@frontfriend/tailwind/theme"]=h,s.resolve.alias["@frontfriend/tailwind/theme.css"]=h}let{webpack:f}=o,i=f.DefinePlugin,l={__FF_CONFIG__:JSON.stringify(n),__FF_ICONS__:JSON.stringify(r)};return s.plugins=s.plugins||[],s.plugins.push(new i(l)),o.dev&&!o.isServer&&console.log("[FrontFriend Next.js] Injected configuration and icons into client build"),s}}}module.exports=ae;
|
|
2
2
|
//# sourceMappingURL=next.js.map
|
package/dist/next.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../lib/core/constants.js", "../lib/core/errors.js", "../lib/core/file-utils.js", "../lib/core/cache-manager.js", "../lib/core/cached-components-config.js", "../next.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Configuration constants for FrontFriend Tailwind v2\n */\n\n// API Configuration. The platform currently lives on the dev deployment \u2014\n// keep this as the CLI default so `frontfriend login`/init work zero-config.\nconst DEFAULT_API_URL = 'https://app.dev.frontfriend.dev';\nconst LEGACY_API_URL = 'https://registry-legacy.frontfriend.dev';\n\n// Cache Configuration\nconst CACHE_DIR_NAME = '.cache/frontfriend';\nconst CACHE_TTL_DAYS = 7;\nconst CACHE_TTL_MS = CACHE_TTL_DAYS * 24 * 60 * 60 * 1000;\n\n// File names\nconst CACHE_FILES = {\n JS: [\n 'tokens.js',\n 'variables.js',\n 'semanticVariables.js',\n 'semanticDarkVariables.js',\n 'safelist.js',\n 'custom.js'\n ],\n JSON: [\n 'fonts.json',\n 'icons.json',\n 'components-config.json',\n 'version.json',\n 'metadata.json'\n ]\n};\n\n// Environment variables\nconst ENV_VARS = {\n FF_ID: 'FF_ID',\n FF_API_URL: 'FF_API_URL',\n FF_USE_LOCAL: 'FF_USE_LOCAL',\n FF_AUTH_TOKEN: 'FF_AUTH_TOKEN'\n};\n\nmodule.exports = {\n DEFAULT_API_URL,\n LEGACY_API_URL,\n CACHE_DIR_NAME,\n CACHE_TTL_DAYS,\n CACHE_TTL_MS,\n CACHE_FILES,\n ENV_VARS\n};", "class APIError extends Error {\n constructor(message, statusCode, url) {\n super(message);\n this.name = 'APIError';\n this.statusCode = statusCode;\n this.url = url;\n this.code = `API_${statusCode}`;\n }\n}\n\nclass CacheError extends Error {\n constructor(message, operation) {\n super(message);\n this.name = 'CacheError';\n this.operation = operation;\n this.code = `CACHE_${operation.toUpperCase()}`;\n }\n}\n\nclass ConfigError extends Error {\n constructor(message, field) {\n super(message);\n this.name = 'ConfigError';\n this.field = field;\n // `field` is optional; guard so a missing field never crashes (and masks)\n // the real error with `Cannot read properties of undefined (toUpperCase)`.\n this.code = field ? `CONFIG_${String(field).toUpperCase()}` : 'CONFIG_ERROR';\n }\n}\n\nclass ProcessingError extends Error {\n constructor(message, token) {\n super(message);\n this.name = 'ProcessingError';\n this.token = token;\n this.code = 'PROCESSING_ERROR';\n }\n}\n\nmodule.exports = {\n APIError,\n CacheError,\n ConfigError,\n ProcessingError\n};", "const fs = require('fs');\n\n/**\n * Read a JSON file safely, returning null if file doesn't exist\n * @param {string} filepath - Path to the JSON file\n * @returns {Object|null} Parsed JSON or null if file not found\n * @throws {Error} If JSON is invalid\n */\nfunction readJsonFileSafe(filepath) {\n try {\n const content = fs.readFileSync(filepath, 'utf8');\n return JSON.parse(content);\n } catch (error) {\n if (error.code === 'ENOENT') {\n return null; // File not found, return null like API would return 404\n }\n throw error;\n }\n}\n\n/**\n * Read a file safely, returning null if file doesn't exist\n * Strips UTF-8 BOM if present (fixes Windows compatibility)\n * @param {string} filepath - Path to the file\n * @returns {string|null} File content or null if file not found\n * @throws {Error} For other file system errors\n */\nfunction readFileSafe(filepath) {\n try {\n const content = fs.readFileSync(filepath, 'utf8');\n // Strip UTF-8 BOM if present (Windows compatibility)\n return content.replace(/^\\uFEFF/, '');\n } catch (error) {\n if (error.code === 'ENOENT') {\n return null; // File not found\n }\n throw error;\n }\n}\n\n/**\n * Write JSON data to a file with proper formatting\n * @param {string} filepath - Path to write the file\n * @param {Object} data - Data to write\n * @param {number} indent - Indentation level (default: 2)\n */\nfunction writeJsonFile(filepath, data, indent = 2) {\n const content = JSON.stringify(data, null, indent);\n fs.writeFileSync(filepath, content, 'utf8');\n}\n\n/**\n * Write 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", "const path = require('path');\nconst { CACHE_DIR_NAME, CACHE_TTL_MS, CACHE_FILES } = require('./constants');\nconst { CacheError } = require('./errors');\nconst { readJsonFileSafe, readFileSafe, writeJsonFile, writeTextFile, writeModuleExportsFile, fileExists, ensureDirectoryExists, removeDirectory } = require('./file-utils');\n\nclass CacheManager {\n constructor(appRoot = process.cwd()) {\n this.appRoot = appRoot;\n this.cacheDir = path.join(appRoot, 'node_modules', CACHE_DIR_NAME);\n this.metadataFile = path.join(this.cacheDir, 'metadata.json');\n this.maxAge = CACHE_TTL_MS;\n }\n\n /**\n * Get the cache directory path\n * @returns {string} Cache directory path\n */\n getCacheDir() {\n return this.cacheDir;\n }\n\n // True when the cache was authored locally by `migrate` (no cloud fetch yet).\n // init must NOT treat such a cache as \"already up to date\" \u2014 it still needs to\n // fetch the design system, otherwise migrate-then-init silently does nothing.\n isLocalOnly() {\n const metadata = readJsonFileSafe(this.metadataFile);\n return metadata?.version === 'local-components';\n }\n\n // The design system's icon library cached from processed-tokens (or null).\n getIconLibrary() {\n const filePath = path.join(this.cacheDir, 'iconLibrary.json');\n return fileExists(filePath) ? readJsonFileSafe(filePath) : null;\n }\n\n /**\n * Check if cache directory exists\n * @returns {boolean} True if cache exists\n */\n exists() {\n return fileExists(this.cacheDir);\n }\n\n /**\n * Check if cache is valid (exists and not expired)\n * @returns {boolean} True if cache is valid\n */\n isValid() {\n if (!this.exists()) {\n return false;\n }\n\n try {\n const metadata = readJsonFileSafe(this.metadataFile);\n if (!metadata) {\n return false;\n }\n\n const timestamp = new Date(metadata.timestamp).getTime();\n const now = Date.now();\n \n return (now - timestamp) < this.maxAge;\n } catch (error) {\n return false;\n }\n }\n\n /**\n * Load all cached data\n * @returns {Object|null} Cached data object or null if not found\n */\n load() {\n if (!this.exists()) {\n return null;\n }\n\n try {\n const data = {};\n \n // Load all .js files\n for (const file of CACHE_FILES.JS) {\n const filePath = path.join(this.cacheDir, file);\n if (fileExists(filePath)) {\n // Remove .js extension for key\n const key = file.replace('.js', '');\n try {\n // Use a more secure approach - parse the exported data\n const content = readFileSafe(filePath);\n if (content !== null) {\n // Create a safe evaluation context\n const moduleExports = {};\n const fakeModule = { exports: moduleExports };\n \n // Use Function constructor to evaluate in isolated scope\n const evalFunc = new Function('module', 'exports', content);\n evalFunc(fakeModule, moduleExports);\n\n data[key] = fakeModule.exports;\n }\n } catch (e) {\n // Log parsing errors to help debug Windows/encoding issues\n console.warn(`[Frontfriend] Failed to load ${file}: ${e.message}`);\n if (e.message.includes('Unexpected token') || e.message.includes('Invalid character')) {\n console.warn('[Frontfriend] This might be a BOM or encoding issue. Try deleting node_modules/.cache/frontfriend and running `npx frontfriend init` again.');\n }\n }\n }\n }\n\n // Load all .json files\n for (const file of CACHE_FILES.JSON) {\n const filePath = path.join(this.cacheDir, file);\n const key = file.replace('.json', '');\n const content = readJsonFileSafe(filePath);\n if (content !== null) {\n data[key] = content;\n }\n }\n\n // Rename components-config to componentsConfig for consistency\n if (data['components-config']) {\n data.componentsConfig = data['components-config'];\n delete data['components-config'];\n }\n\n // Backward compatibility: rename cls to safelist if present\n if (data.cls && !data.safelist) {\n data.safelist = data.cls;\n delete data.cls;\n }\n\n return data;\n } catch (error) {\n throw new CacheError(`Failed to load cache: ${error.message}`, 'read');\n }\n }\n\n /**\n * Save data to cache\n * @param {Object} data - Data object to save\n * @throws {Error} If save operation fails\n */\n save(data) {\n try {\n // Create cache directory\n ensureDirectoryExists(this.cacheDir);\n\n // Metadata is the cache commit marker. Write it last so an interrupted\n // refresh is never advertised as a complete, current cache.\n const metadata = {\n timestamp: new Date().toISOString(),\n version: data.metadata?.version || '2.0.0',\n ffId: data.metadata?.ffId\n };\n // Save .js files\n const jsFiles = [\n 'tokens',\n 'variables',\n 'semanticVariables',\n 'semanticDarkVariables',\n 'safelist',\n 'custom'\n ];\n\n for (const key of jsFiles) {\n if (data[key] !== undefined) {\n const filePath = path.join(this.cacheDir, `${key}.js`);\n writeModuleExportsFile(filePath, data[key]);\n }\n }\n \n // Also check for safelist specifically since it might be an array\n if (data.safelist && Array.isArray(data.safelist)) {\n const safelistPath = path.join(this.cacheDir, 'safelist.js');\n writeModuleExportsFile(safelistPath, data.safelist);\n }\n\n // Save .json files\n const jsonData = {\n fonts: data.fonts,\n icons: data.icons || data.iconSet,\n 'components-config': data.componentsConfig,\n iconLibrary: data.iconLibrary,\n version: data.version\n };\n\n for (const [key, value] of Object.entries(jsonData)) {\n if (value !== undefined) {\n const filePath = path.join(this.cacheDir, `${key}.json`);\n writeJsonFile(filePath, value);\n }\n }\n\n // Save Tailwind v4 CSS artifacts when generated by the token processor\n if (data.themeCSS !== undefined) {\n writeTextFile(path.join(this.cacheDir, 'theme.css'), data.themeCSS);\n }\n\n if (data.classesContent !== undefined) {\n writeTextFile(path.join(this.cacheDir, 'classes.css'), data.classesContent);\n }\n\n writeJsonFile(this.metadataFile, metadata);\n } catch (error) {\n throw new CacheError(`Failed to save cache: ${error.message}`, 'write');\n }\n }\n\n /**\n * Clear the cache directory\n */\n clear() {\n if (this.exists()) {\n removeDirectory(this.cacheDir);\n }\n }\n}\n\nmodule.exports = CacheManager;\n", "const CACHE_ERROR_MESSAGE =\n 'FrontFriend components configuration not found. Run \"npx frontfriend init\" or \"npx frontfriend sync\".';\nconst SAAS_ERROR_MESSAGE =\n 'FrontFriend components configuration was not returned by the SaaS app. The cache was not updated.';\n\nfunction isPlainObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\nfunction assertComponentsConfig(componentsConfig, message = CACHE_ERROR_MESSAGE) {\n if (!isPlainObject(componentsConfig) || Object.keys(componentsConfig).length === 0) {\n throw new Error(message);\n }\n\n return componentsConfig;\n}\n\nfunction loadCachedComponents(cacheManager) {\n if (!cacheManager.exists()) throw new Error(CACHE_ERROR_MESSAGE);\n\n const cache = cacheManager.load();\n const componentsConfig = assertComponentsConfig(cache?.componentsConfig);\n\n return {\n componentsConfig,\n icons: isPlainObject(cache.icons) ? cache.icons : {},\n };\n}\n\nmodule.exports = {\n CACHE_ERROR_MESSAGE,\n SAAS_ERROR_MESSAGE,\n assertComponentsConfig,\n loadCachedComponents,\n};\n", "const CacheManager = require('./lib/core/cache-manager');\nconst { loadCachedComponents } = require('./lib/core/cached-components-config');\nconst path = require('path');\n\nfunction frontfriend(nextConfig = {}) {\n // Load cache once at config time\n const cacheManager = new CacheManager(process.cwd());\n const { componentsConfig, icons } = loadCachedComponents(cacheManager);\n\n return {\n ...nextConfig,\n // Environment variables work with both webpack and Turbopack\n env: {\n ...nextConfig.env,\n // Inject config as environment variables for Turbopack compatibility\n // Using NEXT_PUBLIC_ prefix as Next.js doesn't allow __ prefixed keys\n NEXT_PUBLIC_FF_CONFIG: JSON.stringify(componentsConfig),\n NEXT_PUBLIC_FF_ICONS: JSON.stringify(icons),\n },\n webpack: (config, options) => {\n // 1. Call existing webpack config if provided\n if (typeof nextConfig.webpack === 'function') {\n config = nextConfig.webpack(config, options);\n }\n\n // 2. Add resolver aliases for Tailwind v4 CSS-first theme import.\n // Consumers can import '@frontfriend/tailwind/theme.css' from their app CSS.\n if (typeof cacheManager.getCacheDir === 'function') {\n const themePath = path.join(cacheManager.getCacheDir(), 'theme.css');\n config.resolve = config.resolve || {};\n config.resolve.alias = config.resolve.alias || {};\n config.resolve.alias['@frontfriend/tailwind/theme'] = themePath;\n config.resolve.alias['@frontfriend/tailwind/theme.css'] = themePath;\n }\n\n // 4. Use webpack.DefinePlugin from options (works with both webpack 4 and 5)\n // This is for webpack - Turbopack will use the env vars above\n const { webpack } = options;\n const DefinePlugin = webpack.DefinePlugin;\n\n // 5. Inject __FF_CONFIG__ and __FF_ICONS__ as globals for webpack\n const definitions = {\n __FF_CONFIG__: JSON.stringify(componentsConfig),\n __FF_ICONS__: JSON.stringify(icons)\n };\n\n // Add DefinePlugin to plugins array\n config.plugins = config.plugins || [];\n config.plugins.push(new DefinePlugin(definitions));\n\n // Log success in development\n if (options.dev && !options.isServer) {\n console.log('[FrontFriend Next.js] Injected configuration and icons into client build');\n }\n\n // 6. Return modified config\n return config;\n }\n };\n}\n\nmodule.exports = frontfriend;\n"],
|
|
5
|
-
"mappings": "8DAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,IAAA,CAMA,IAAMC,EAAkB,kCAClBC,EAAiB,0CAGjBC,EAAiB,qBAKjBC,EAAc,CAClB,GAAI,CACF,YACA,eACA,uBACA,2BACA,cACA,WACF,EACA,KAAM,CACJ,aACA,aACA,yBACA,eACA,eACF,CACF,EAGMC,EAAW,CACf,MAAO,QACP,WAAY,aACZ,aAAc,eACd,cAAe,eACjB,
|
|
6
|
-
"names": ["require_constants", "__commonJSMin", "exports", "module", "DEFAULT_API_URL", "LEGACY_API_URL", "CACHE_DIR_NAME", "CACHE_FILES", "ENV_VARS", "require_errors", "__commonJSMin", "exports", "module", "APIError", "message", "statusCode", "url", "CacheError", "operation", "ConfigError", "field", "ProcessingError", "token", "require_file_utils", "__commonJSMin", "exports", "module", "fs", "readJsonFileSafe", "filepath", "content", "error", "readFileSafe", "writeJsonFile", "data", "indent", "writeTextFile", "writeModuleExportsFile", "fileExists", "ensureDirectoryExists", "dirpath", "removeDirectory", "require_cache_manager", "__commonJSMin", "exports", "module", "path", "CACHE_DIR_NAME", "CACHE_TTL_MS", "CACHE_FILES", "CacheError", "readJsonFileSafe", "readFileSafe", "writeJsonFile", "writeTextFile", "writeModuleExportsFile", "fileExists", "ensureDirectoryExists", "removeDirectory", "CacheManager", "appRoot", "metadata", "filePath", "timestamp", "data", "file", "key", "content", "moduleExports", "fakeModule", "e", "error", "_a", "_b", "jsFiles", "safelistPath", "jsonData", "value", "require_cached_components_config", "__commonJSMin", "exports", "module", "CACHE_ERROR_MESSAGE", "SAAS_ERROR_MESSAGE", "isPlainObject", "value", "assertComponentsConfig", "componentsConfig", "message", "loadCachedComponents", "cacheManager", "cache", "CacheManager", "loadCachedComponents", "path", "frontfriend", "nextConfig", "cacheManager", "componentsConfig", "icons", "config", "options", "themePath", "webpack", "DefinePlugin", "definitions"]
|
|
4
|
+
"sourcesContent": ["/**\n * Configuration constants for FrontFriend Tailwind v2\n */\n\n// API Configuration. The platform currently lives on the dev deployment \u2014\n// keep this as the CLI default so `frontfriend login`/init work zero-config.\nconst DEFAULT_API_URL = 'https://app.dev.frontfriend.dev';\nconst LEGACY_API_URL = 'https://registry-legacy.frontfriend.dev';\n\n// Cache Configuration\nconst CACHE_DIR_NAME = '.cache/frontfriend';\nconst CACHE_TTL_DAYS = 7;\nconst CACHE_TTL_MS = CACHE_TTL_DAYS * 24 * 60 * 60 * 1000;\n\n// File names\nconst CACHE_FILES = {\n JS: [\n 'tokens.js',\n 'variables.js',\n 'semanticVariables.js',\n 'semanticDarkVariables.js',\n 'safelist.js',\n 'custom.js'\n ],\n JSON: [\n 'fonts.json',\n 'icons.json',\n 'components-config.json',\n 'version.json',\n 'versionMetadata.json',\n 'metadata.json'\n ]\n};\n\n// Environment variables\nconst ENV_VARS = {\n FF_ID: 'FF_ID',\n FF_API_URL: 'FF_API_URL',\n FF_USE_LOCAL: 'FF_USE_LOCAL',\n FF_AUTH_TOKEN: 'FF_AUTH_TOKEN'\n};\n\n/**\n * The registry follows the app: with api-url app.dev.frontfriend.dev the\n * components must come from registry.dev.frontfriend.dev, not prod (the two\n * registries do not serve the same item set). Environments pair `app.<env>`\n * with `registry.<env>`, so derive the registry host by swapping the prefix.\n * Returns null for unknown api-url shapes (callers fall back to their default).\n */\nfunction deriveRegistryFromApiUrl(apiUrl) {\n if (!apiUrl) return null;\n try {\n const url = new URL(apiUrl);\n if (!url.hostname.startsWith('app.')) return null;\n return `${url.protocol}//${url.hostname.replace(/^app\\./, 'registry.')}`;\n } catch {\n return null;\n }\n}\n\nmodule.exports = {\n DEFAULT_API_URL,\n LEGACY_API_URL,\n CACHE_DIR_NAME,\n CACHE_TTL_DAYS,\n CACHE_TTL_MS,\n CACHE_FILES,\n ENV_VARS,\n deriveRegistryFromApiUrl\n};\n", "class APIError extends Error {\n constructor(message, statusCode, url) {\n super(message);\n this.name = 'APIError';\n this.statusCode = statusCode;\n this.url = url;\n this.code = `API_${statusCode}`;\n }\n}\n\nclass CacheError extends Error {\n constructor(message, operation) {\n super(message);\n this.name = 'CacheError';\n this.operation = operation;\n this.code = `CACHE_${operation.toUpperCase()}`;\n }\n}\n\nclass ConfigError extends Error {\n constructor(message, field) {\n super(message);\n this.name = 'ConfigError';\n this.field = field;\n // `field` is optional; guard so a missing field never crashes (and masks)\n // the real error with `Cannot read properties of undefined (toUpperCase)`.\n this.code = field ? `CONFIG_${String(field).toUpperCase()}` : 'CONFIG_ERROR';\n }\n}\n\nclass ProcessingError extends Error {\n constructor(message, token) {\n super(message);\n this.name = 'ProcessingError';\n this.token = token;\n this.code = 'PROCESSING_ERROR';\n }\n}\n\nmodule.exports = {\n APIError,\n CacheError,\n ConfigError,\n ProcessingError\n};", "const fs = require('fs');\n\n/**\n * Read a JSON file safely, returning null if file doesn't exist\n * @param {string} filepath - Path to the JSON file\n * @returns {Object|null} Parsed JSON or null if file not found\n * @throws {Error} If JSON is invalid\n */\nfunction readJsonFileSafe(filepath) {\n try {\n const content = fs.readFileSync(filepath, 'utf8');\n return JSON.parse(content);\n } catch (error) {\n if (error.code === 'ENOENT') {\n return null; // File not found, return null like API would return 404\n }\n throw error;\n }\n}\n\n/**\n * Read a file safely, returning null if file doesn't exist\n * Strips UTF-8 BOM if present (fixes Windows compatibility)\n * @param {string} filepath - Path to the file\n * @returns {string|null} File content or null if file not found\n * @throws {Error} For other file system errors\n */\nfunction readFileSafe(filepath) {\n try {\n const content = fs.readFileSync(filepath, 'utf8');\n // Strip UTF-8 BOM if present (Windows compatibility)\n return content.replace(/^\\uFEFF/, '');\n } catch (error) {\n if (error.code === 'ENOENT') {\n return null; // File not found\n }\n throw error;\n }\n}\n\n/**\n * Write JSON data to a file with proper formatting\n * @param {string} filepath - Path to write the file\n * @param {Object} data - Data to write\n * @param {number} indent - Indentation level (default: 2)\n */\nfunction writeJsonFile(filepath, data, indent = 2) {\n const content = JSON.stringify(data, null, indent);\n fs.writeFileSync(filepath, content, 'utf8');\n}\n\n/**\n * Write 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", "const path = require('path');\nconst { CACHE_DIR_NAME, CACHE_TTL_MS, CACHE_FILES } = require('./constants');\nconst { CacheError } = require('./errors');\nconst { readJsonFileSafe, readFileSafe, writeJsonFile, writeTextFile, writeModuleExportsFile, fileExists, ensureDirectoryExists, removeDirectory } = require('./file-utils');\n\nclass CacheManager {\n constructor(appRoot = process.cwd()) {\n this.appRoot = appRoot;\n this.cacheDir = path.join(appRoot, 'node_modules', CACHE_DIR_NAME);\n this.metadataFile = path.join(this.cacheDir, 'metadata.json');\n this.maxAge = CACHE_TTL_MS;\n }\n\n /**\n * Get the cache directory path\n * @returns {string} Cache directory path\n */\n getCacheDir() {\n return this.cacheDir;\n }\n\n // True when the cache was authored locally by `migrate` (no cloud fetch yet).\n // init must NOT treat such a cache as \"already up to date\" \u2014 it still needs to\n // fetch the design system, otherwise migrate-then-init silently does nothing.\n isLocalOnly() {\n const metadata = readJsonFileSafe(this.metadataFile);\n return metadata?.version === 'local-components';\n }\n\n // The design system's icon library cached from processed-tokens (or null).\n getIconLibrary() {\n const filePath = path.join(this.cacheDir, 'iconLibrary.json');\n return fileExists(filePath) ? readJsonFileSafe(filePath) : null;\n }\n\n /**\n * Check if cache directory exists\n * @returns {boolean} True if cache exists\n */\n exists() {\n return fileExists(this.cacheDir);\n }\n\n /**\n * Check if cache is valid (exists and not expired)\n * @returns {boolean} True if cache is valid\n */\n isValid() {\n if (!this.exists()) {\n return false;\n }\n\n try {\n const metadata = readJsonFileSafe(this.metadataFile);\n if (!metadata) {\n return false;\n }\n\n const timestamp = new Date(metadata.timestamp).getTime();\n const now = Date.now();\n \n return (now - timestamp) < this.maxAge;\n } catch (error) {\n return false;\n }\n }\n\n /**\n * Load all cached data\n * @returns {Object|null} Cached data object or null if not found\n */\n load() {\n if (!this.exists()) {\n return null;\n }\n\n try {\n const data = {};\n \n // Load all .js files\n for (const file of CACHE_FILES.JS) {\n const filePath = path.join(this.cacheDir, file);\n if (fileExists(filePath)) {\n // Remove .js extension for key\n const key = file.replace('.js', '');\n try {\n // Use a more secure approach - parse the exported data\n const content = readFileSafe(filePath);\n if (content !== null) {\n // Create a safe evaluation context\n const moduleExports = {};\n const fakeModule = { exports: moduleExports };\n \n // Use Function constructor to evaluate in isolated scope\n const evalFunc = new Function('module', 'exports', content);\n evalFunc(fakeModule, moduleExports);\n\n data[key] = fakeModule.exports;\n }\n } catch (e) {\n // Log parsing errors to help debug Windows/encoding issues\n console.warn(`[Frontfriend] Failed to load ${file}: ${e.message}`);\n if (e.message.includes('Unexpected token') || e.message.includes('Invalid character')) {\n console.warn('[Frontfriend] This might be a BOM or encoding issue. Try deleting node_modules/.cache/frontfriend and running `npx frontfriend init` again.');\n }\n }\n }\n }\n\n // Load all .json files\n for (const file of CACHE_FILES.JSON) {\n const filePath = path.join(this.cacheDir, file);\n const key = file.replace('.json', '');\n const content = readJsonFileSafe(filePath);\n if (content !== null) {\n data[key] = content;\n }\n }\n\n // Rename components-config to componentsConfig for consistency\n if (data['components-config']) {\n data.componentsConfig = data['components-config'];\n delete data['components-config'];\n }\n\n // Backward compatibility: rename cls to safelist if present\n if (data.cls && !data.safelist) {\n data.safelist = data.cls;\n delete data.cls;\n }\n\n return data;\n } catch (error) {\n throw new CacheError(`Failed to load cache: ${error.message}`, 'read');\n }\n }\n\n /**\n * Save data to cache\n * @param {Object} data - Data object to save\n * @throws {Error} If save operation fails\n */\n save(data) {\n try {\n // Create cache directory\n ensureDirectoryExists(this.cacheDir);\n\n // Metadata is the cache commit marker. Write it last so an interrupted\n // refresh is never advertised as a complete, current cache.\n const metadata = {\n timestamp: new Date().toISOString(),\n version: data.metadata?.version || '2.0.0',\n ffId: data.metadata?.ffId\n };\n // Save .js files\n const jsFiles = [\n 'tokens',\n 'variables',\n 'semanticVariables',\n 'semanticDarkVariables',\n 'safelist',\n 'custom'\n ];\n\n for (const key of jsFiles) {\n if (data[key] !== undefined) {\n const filePath = path.join(this.cacheDir, `${key}.js`);\n writeModuleExportsFile(filePath, data[key]);\n }\n }\n \n // Also check for safelist specifically since it might be an array\n if (data.safelist && Array.isArray(data.safelist)) {\n const safelistPath = path.join(this.cacheDir, 'safelist.js');\n writeModuleExportsFile(safelistPath, data.safelist);\n }\n\n // Save .json files\n const jsonData = {\n fonts: data.fonts,\n icons: data.icons || data.iconSet,\n 'components-config': data.componentsConfig,\n iconLibrary: data.iconLibrary,\n version: data.version,\n versionMetadata: data.versionMetadata\n };\n\n for (const [key, value] of Object.entries(jsonData)) {\n if (value !== undefined) {\n const filePath = path.join(this.cacheDir, `${key}.json`);\n writeJsonFile(filePath, value);\n }\n }\n\n // Save Tailwind v4 CSS artifacts when generated by the token processor\n if (data.themeCSS !== undefined) {\n writeTextFile(path.join(this.cacheDir, 'theme.css'), data.themeCSS);\n }\n\n if (data.classesContent !== undefined) {\n writeTextFile(path.join(this.cacheDir, 'classes.css'), data.classesContent);\n }\n\n writeJsonFile(this.metadataFile, metadata);\n } catch (error) {\n throw new CacheError(`Failed to save cache: ${error.message}`, 'write');\n }\n }\n\n /**\n * Clear the cache directory\n */\n clear() {\n if (this.exists()) {\n removeDirectory(this.cacheDir);\n }\n }\n}\n\nmodule.exports = CacheManager;\n", "const CACHE_ERROR_MESSAGE =\n 'FrontFriend components configuration not found. Run \"npx frontfriend init\" or \"npx frontfriend sync\".';\nconst SAAS_ERROR_MESSAGE =\n 'FrontFriend components configuration was not returned by the SaaS app. The cache was not updated.';\n\nfunction isPlainObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\nfunction assertComponentsConfig(componentsConfig, message = CACHE_ERROR_MESSAGE) {\n if (!isPlainObject(componentsConfig) || Object.keys(componentsConfig).length === 0) {\n throw new Error(message);\n }\n\n return componentsConfig;\n}\n\nfunction loadCachedComponents(cacheManager) {\n if (!cacheManager.exists()) throw new Error(CACHE_ERROR_MESSAGE);\n\n const cache = cacheManager.load();\n const componentsConfig = assertComponentsConfig(cache?.componentsConfig);\n\n return {\n componentsConfig,\n icons: isPlainObject(cache.icons) ? cache.icons : {},\n };\n}\n\nmodule.exports = {\n CACHE_ERROR_MESSAGE,\n SAAS_ERROR_MESSAGE,\n assertComponentsConfig,\n loadCachedComponents,\n};\n", "const CacheManager = require('./lib/core/cache-manager');\nconst { loadCachedComponents } = require('./lib/core/cached-components-config');\nconst path = require('path');\n\nfunction frontfriend(nextConfig = {}) {\n // Load cache once at config time\n const cacheManager = new CacheManager(process.cwd());\n const { componentsConfig, icons } = loadCachedComponents(cacheManager);\n\n return {\n ...nextConfig,\n // Environment variables work with both webpack and Turbopack\n env: {\n ...nextConfig.env,\n // Inject config as environment variables for Turbopack compatibility\n // Using NEXT_PUBLIC_ prefix as Next.js doesn't allow __ prefixed keys\n NEXT_PUBLIC_FF_CONFIG: JSON.stringify(componentsConfig),\n NEXT_PUBLIC_FF_ICONS: JSON.stringify(icons),\n },\n webpack: (config, options) => {\n // 1. Call existing webpack config if provided\n if (typeof nextConfig.webpack === 'function') {\n config = nextConfig.webpack(config, options);\n }\n\n // 2. Add resolver aliases for Tailwind v4 CSS-first theme import.\n // Consumers can import '@frontfriend/tailwind/theme.css' from their app CSS.\n if (typeof cacheManager.getCacheDir === 'function') {\n const themePath = path.join(cacheManager.getCacheDir(), 'theme.css');\n config.resolve = config.resolve || {};\n config.resolve.alias = config.resolve.alias || {};\n config.resolve.alias['@frontfriend/tailwind/theme'] = themePath;\n config.resolve.alias['@frontfriend/tailwind/theme.css'] = themePath;\n }\n\n // 4. Use webpack.DefinePlugin from options (works with both webpack 4 and 5)\n // This is for webpack - Turbopack will use the env vars above\n const { webpack } = options;\n const DefinePlugin = webpack.DefinePlugin;\n\n // 5. Inject __FF_CONFIG__ and __FF_ICONS__ as globals for webpack\n const definitions = {\n __FF_CONFIG__: JSON.stringify(componentsConfig),\n __FF_ICONS__: JSON.stringify(icons)\n };\n\n // Add DefinePlugin to plugins array\n config.plugins = config.plugins || [];\n config.plugins.push(new DefinePlugin(definitions));\n\n // Log success in development\n if (options.dev && !options.isServer) {\n console.log('[FrontFriend Next.js] Injected configuration and icons into client build');\n }\n\n // 6. Return modified config\n return config;\n }\n };\n}\n\nmodule.exports = frontfriend;\n"],
|
|
5
|
+
"mappings": "8DAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,IAAA,CAMA,IAAMC,EAAkB,kCAClBC,EAAiB,0CAGjBC,EAAiB,qBAKjBC,EAAc,CAClB,GAAI,CACF,YACA,eACA,uBACA,2BACA,cACA,WACF,EACA,KAAM,CACJ,aACA,aACA,yBACA,eACA,uBACA,eACF,CACF,EAGMC,EAAW,CACf,MAAO,QACP,WAAY,aACZ,aAAc,eACd,cAAe,eACjB,EASA,SAASC,EAAyBC,EAAQ,CACxC,GAAI,CAACA,EAAQ,OAAO,KACpB,GAAI,CACF,IAAMC,EAAM,IAAI,IAAID,CAAM,EAC1B,OAAKC,EAAI,SAAS,WAAW,MAAM,EAC5B,GAAGA,EAAI,QAAQ,KAAKA,EAAI,SAAS,QAAQ,SAAU,WAAW,CAAC,GADzB,IAE/C,MAAQ,CACN,OAAO,IACT,CACF,CAEAR,EAAO,QAAU,CACf,gBAAAC,EACA,eAAAC,EACA,eAAAC,EACA,iBACA,oBACA,YAAAC,EACA,SAAAC,EACA,yBAAAC,CACF,ICrEA,IAAAG,EAAAC,EAAA,CAAAC,GAAAC,IAAA,KAAMC,EAAN,cAAuB,KAAM,CAC3B,YAAYC,EAASC,EAAYC,EAAK,CACpC,MAAMF,CAAO,EACb,KAAK,KAAO,WACZ,KAAK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,0EAA0E,EAIjFD,CACT,CACF,CACF,CAEA,OAAO,QAAUL",
|
|
6
|
+
"names": ["require_constants", "__commonJSMin", "exports", "module", "DEFAULT_API_URL", "LEGACY_API_URL", "CACHE_DIR_NAME", "CACHE_FILES", "ENV_VARS", "deriveRegistryFromApiUrl", "apiUrl", "url", "require_errors", "__commonJSMin", "exports", "module", "APIError", "message", "statusCode", "url", "CacheError", "operation", "ConfigError", "field", "ProcessingError", "token", "require_file_utils", "__commonJSMin", "exports", "module", "fs", "readJsonFileSafe", "filepath", "content", "error", "readFileSafe", "writeJsonFile", "data", "indent", "writeTextFile", "writeModuleExportsFile", "fileExists", "ensureDirectoryExists", "dirpath", "removeDirectory", "require_cache_manager", "__commonJSMin", "exports", "module", "path", "CACHE_DIR_NAME", "CACHE_TTL_MS", "CACHE_FILES", "CacheError", "readJsonFileSafe", "readFileSafe", "writeJsonFile", "writeTextFile", "writeModuleExportsFile", "fileExists", "ensureDirectoryExists", "removeDirectory", "CacheManager", "appRoot", "metadata", "filePath", "timestamp", "data", "file", "key", "content", "moduleExports", "fakeModule", "e", "error", "_a", "_b", "jsFiles", "safelistPath", "jsonData", "value", "require_cached_components_config", "__commonJSMin", "exports", "module", "CACHE_ERROR_MESSAGE", "SAAS_ERROR_MESSAGE", "isPlainObject", "value", "assertComponentsConfig", "componentsConfig", "message", "loadCachedComponents", "cacheManager", "cache", "CacheManager", "loadCachedComponents", "path", "frontfriend", "nextConfig", "cacheManager", "componentsConfig", "icons", "config", "options", "themePath", "webpack", "DefinePlugin", "definitions"]
|
|
7
7
|
}
|
package/dist/vite.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var h=(
|
|
1
|
+
var h=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var j=h((me,A)=>{var J="https://app.dev.frontfriend.dev",U="https://registry-legacy.frontfriend.dev",q=".cache/frontfriend",G={JS:["tokens.js","variables.js","semanticVariables.js","semanticDarkVariables.js","safelist.js","custom.js"],JSON:["fonts.json","icons.json","components-config.json","version.json","versionMetadata.json","metadata.json"]},V={FF_ID:"FF_ID",FF_API_URL:"FF_API_URL",FF_USE_LOCAL:"FF_USE_LOCAL",FF_AUTH_TOKEN:"FF_AUTH_TOKEN"};function Y(n){if(!n)return null;try{let e=new URL(n);return e.hostname.startsWith("app.")?`${e.protocol}//${e.hostname.replace(/^app\./,"registry.")}`:null}catch{return null}}A.exports={DEFAULT_API_URL:J,LEGACY_API_URL:U,CACHE_DIR_NAME:q,CACHE_TTL_DAYS:7,CACHE_TTL_MS:6048e5,CACHE_FILES:G,ENV_VARS:V,deriveRegistryFromApiUrl:Y}});var x=h((pe,g)=>{var p=class extends Error{constructor(e,t,o){super(e),this.name="APIError",this.statusCode=t,this.url=o,this.code=`API_${t}`}},F=class extends Error{constructor(e,t){super(e),this.name="CacheError",this.operation=t,this.code=`CACHE_${t.toUpperCase()}`}},_=class extends Error{constructor(e,t){super(e),this.name="ConfigError",this.field=t,this.code=t?`CONFIG_${String(t).toUpperCase()}`:"CONFIG_ERROR"}},y=class extends Error{constructor(e,t){super(e),this.name="ProcessingError",this.token=t,this.code="PROCESSING_ERROR"}};g.exports={APIError:p,CacheError:F,ConfigError:_,ProcessingError:y}});var v=h((Fe,D)=>{var l=require("fs");function W(n){try{let e=l.readFileSync(n,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}function K(n){try{return l.readFileSync(n,"utf8").replace(/^\uFEFF/,"")}catch(e){if(e.code==="ENOENT")return null;throw e}}function B(n,e,t=2){let o=JSON.stringify(e,null,t);l.writeFileSync(n,o,"utf8")}function z(n,e){l.writeFileSync(n,e,"utf8")}function Q(n,e){if(e==null||typeof e=="object"&&Object.keys(e).length===0||Array.isArray(e)&&e.length===0){let o=`module.exports = ${Array.isArray(e)?"[]":"{}"};`;l.writeFileSync(n,o,"utf8")}else{let t=`module.exports = ${JSON.stringify(e,null,2)};`;l.writeFileSync(n,t,"utf8")}}function X(n){return l.existsSync(n)}function Z(n){l.mkdirSync(n,{recursive:!0})}function ee(n){l.rmSync(n,{recursive:!0,force:!0})}D.exports={readJsonFileSafe:W,readFileSafe:K,writeJsonFile:B,writeTextFile:z,writeModuleExportsFile:Q,fileExists:X,ensureDirectoryExists:Z,removeDirectory:ee}});var N=h((_e,I)=>{var a=require("path"),{CACHE_DIR_NAME:ne,CACHE_TTL_MS:te,CACHE_FILES:O}=j(),{CacheError:R}=x(),{readJsonFileSafe:m,readFileSafe:re,writeJsonFile:T,writeTextFile:L,writeModuleExportsFile:b,fileExists:S,ensureDirectoryExists:se,removeDirectory:oe}=v(),E=class{constructor(e=process.cwd()){this.appRoot=e,this.cacheDir=a.join(e,"node_modules",ne),this.metadataFile=a.join(this.cacheDir,"metadata.json"),this.maxAge=te}getCacheDir(){return this.cacheDir}isLocalOnly(){let e=m(this.metadataFile);return(e==null?void 0:e.version)==="local-components"}getIconLibrary(){let e=a.join(this.cacheDir,"iconLibrary.json");return S(e)?m(e):null}exists(){return S(this.cacheDir)}isValid(){if(!this.exists())return!1;try{let e=m(this.metadataFile);if(!e)return!1;let t=new Date(e.timestamp).getTime();return Date.now()-t<this.maxAge}catch{return!1}}load(){if(!this.exists())return null;try{let e={};for(let t of O.JS){let o=a.join(this.cacheDir,t);if(S(o)){let c=t.replace(".js","");try{let r=re(o);if(r!==null){let i={},s={exports:i};new Function("module","exports",r)(s,i),e[c]=s.exports}}catch(r){console.warn(`[Frontfriend] Failed to load ${t}: ${r.message}`),(r.message.includes("Unexpected token")||r.message.includes("Invalid character"))&&console.warn("[Frontfriend] This might be a BOM or encoding issue. Try deleting node_modules/.cache/frontfriend and running `npx frontfriend init` again.")}}}for(let t of O.JSON){let o=a.join(this.cacheDir,t),c=t.replace(".json",""),r=m(o);r!==null&&(e[c]=r)}return e["components-config"]&&(e.componentsConfig=e["components-config"],delete e["components-config"]),e.cls&&!e.safelist&&(e.safelist=e.cls,delete e.cls),e}catch(e){throw new R(`Failed to load cache: ${e.message}`,"read")}}save(e){var t,o;try{se(this.cacheDir);let c={timestamp:new Date().toISOString(),version:((t=e.metadata)==null?void 0:t.version)||"2.0.0",ffId:(o=e.metadata)==null?void 0:o.ffId},r=["tokens","variables","semanticVariables","semanticDarkVariables","safelist","custom"];for(let s of r)if(e[s]!==void 0){let u=a.join(this.cacheDir,`${s}.js`);b(u,e[s])}if(e.safelist&&Array.isArray(e.safelist)){let s=a.join(this.cacheDir,"safelist.js");b(s,e.safelist)}let i={fonts:e.fonts,icons:e.icons||e.iconSet,"components-config":e.componentsConfig,iconLibrary:e.iconLibrary,version:e.version,versionMetadata:e.versionMetadata};for(let[s,u]of Object.entries(i))if(u!==void 0){let d=a.join(this.cacheDir,`${s}.json`);T(d,u)}e.themeCSS!==void 0&&L(a.join(this.cacheDir,"theme.css"),e.themeCSS),e.classesContent!==void 0&&L(a.join(this.cacheDir,"classes.css"),e.classesContent),T(this.metadataFile,c)}catch(c){throw new R(`Failed to save cache: ${c.message}`,"write")}}clear(){this.exists()&&oe(this.cacheDir)}};I.exports=E});var M=h((ye,H)=>{var C='FrontFriend components configuration not found. Run "npx frontfriend init" or "npx frontfriend sync".',ie="FrontFriend components configuration was not returned by the SaaS app. The cache was not updated.";function $(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function P(n,e=C){if(!$(n)||Object.keys(n).length===0)throw new Error(e);return n}function ce(n){if(!n.exists())throw new Error(C);let e=n.load();return{componentsConfig:P(e==null?void 0:e.componentsConfig),icons:$(e.icons)?e.icons:{}}}H.exports={CACHE_ERROR_MESSAGE:C,SAAS_ERROR_MESSAGE:ie,assertComponentsConfig:P,loadCachedComponents:ce}});var k=require("fs"),f=require("path"),ae=N(),{CACHE_ERROR_MESSAGE:le,loadCachedComponents:fe}=M();function ue(n){return n.split(f.sep).join("/")}function he(n,e){let t=ue(f.relative(f.dirname(n),e));return t.startsWith(".")||(t=`./${t}`),`@source "${t}";`}module.exports=function(){let e,t,o;function c(r){let i=r||process.cwd(),s=new ae(i);return t=typeof s.getCacheDir=="function"?s.getCacheDir():f.join(i,"node_modules",".cache","frontfriend"),o=fe(s),o}return{name:"frontfriend-tailwind",enforce:"pre",config(r={}){c(r.root||process.cwd());let i=f.join(t,"theme.css");if(!k.existsSync(i))throw new Error(le);let s=f.join(__dirname,"browser.mjs");return{resolve:{alias:[{find:/^@frontfriend\/tailwind$/,replacement:s},{find:"@frontfriend/tailwind/theme.css",replacement:i},{find:"@frontfriend/tailwind/theme",replacement:i}]}}},configResolved(r){e=r,t=t||f.join((r==null?void 0:r.root)||process.cwd(),"node_modules",".cache","frontfriend")},transform(r,i){let[s,u=""]=i.split("?");if(!s.endsWith(".css")||/(?:^|&)(?:url|raw|inline)(?:&|=|$)/.test(u))return null;let d=f.join(t||process.cwd(),"classes.css");if(!k.existsSync(d))return null;let w=he(s,d);return r.includes(w)?null:{code:`${r}
|
|
2
2
|
|
|
3
3
|
/* Frontfriend Tailwind v4 registry source */
|
|
4
4
|
${w}
|
|
5
|
-
`,map:null}},load(
|
|
5
|
+
`,map:null}},load(r){if(r!=="virtual:frontfriend-config")return null;let{componentsConfig:i,icons:s}=o||c((e==null?void 0:e.root)||process.cwd());return(e==null?void 0:e.command)==="serve"&&console.log("[FrontFriend Vite] Injected configuration and icons into build"),`
|
|
6
6
|
globalThis.__FF_CONFIG__ = ${JSON.stringify(i)};
|
|
7
|
-
globalThis.__FF_ICONS__ = ${JSON.stringify(
|
|
7
|
+
globalThis.__FF_ICONS__ = ${JSON.stringify(s)};
|
|
8
8
|
`}}};
|
|
9
9
|
//# sourceMappingURL=vite.js.map
|
package/dist/vite.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../lib/core/constants.js", "../lib/core/errors.js", "../lib/core/file-utils.js", "../lib/core/cache-manager.js", "../lib/core/cached-components-config.js", "../vite.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Configuration constants for FrontFriend Tailwind v2\n */\n\n// API Configuration. The platform currently lives on the dev deployment \u2014\n// keep this as the CLI default so `frontfriend login`/init work zero-config.\nconst DEFAULT_API_URL = 'https://app.dev.frontfriend.dev';\nconst LEGACY_API_URL = 'https://registry-legacy.frontfriend.dev';\n\n// Cache Configuration\nconst CACHE_DIR_NAME = '.cache/frontfriend';\nconst CACHE_TTL_DAYS = 7;\nconst CACHE_TTL_MS = CACHE_TTL_DAYS * 24 * 60 * 60 * 1000;\n\n// File names\nconst CACHE_FILES = {\n JS: [\n 'tokens.js',\n 'variables.js',\n 'semanticVariables.js',\n 'semanticDarkVariables.js',\n 'safelist.js',\n 'custom.js'\n ],\n JSON: [\n 'fonts.json',\n 'icons.json',\n 'components-config.json',\n 'version.json',\n 'metadata.json'\n ]\n};\n\n// Environment variables\nconst ENV_VARS = {\n FF_ID: 'FF_ID',\n FF_API_URL: 'FF_API_URL',\n FF_USE_LOCAL: 'FF_USE_LOCAL',\n FF_AUTH_TOKEN: 'FF_AUTH_TOKEN'\n};\n\nmodule.exports = {\n DEFAULT_API_URL,\n LEGACY_API_URL,\n CACHE_DIR_NAME,\n CACHE_TTL_DAYS,\n CACHE_TTL_MS,\n CACHE_FILES,\n ENV_VARS\n};", "class APIError extends Error {\n constructor(message, statusCode, url) {\n super(message);\n this.name = 'APIError';\n this.statusCode = statusCode;\n this.url = url;\n this.code = `API_${statusCode}`;\n }\n}\n\nclass CacheError extends Error {\n constructor(message, operation) {\n super(message);\n this.name = 'CacheError';\n this.operation = operation;\n this.code = `CACHE_${operation.toUpperCase()}`;\n }\n}\n\nclass ConfigError extends Error {\n constructor(message, field) {\n super(message);\n this.name = 'ConfigError';\n this.field = field;\n // `field` is optional; guard so a missing field never crashes (and masks)\n // the real error with `Cannot read properties of undefined (toUpperCase)`.\n this.code = field ? `CONFIG_${String(field).toUpperCase()}` : 'CONFIG_ERROR';\n }\n}\n\nclass ProcessingError extends Error {\n constructor(message, token) {\n super(message);\n this.name = 'ProcessingError';\n this.token = token;\n this.code = 'PROCESSING_ERROR';\n }\n}\n\nmodule.exports = {\n APIError,\n CacheError,\n ConfigError,\n ProcessingError\n};", "const fs = require('fs');\n\n/**\n * Read a JSON file safely, returning null if file doesn't exist\n * @param {string} filepath - Path to the JSON file\n * @returns {Object|null} Parsed JSON or null if file not found\n * @throws {Error} If JSON is invalid\n */\nfunction readJsonFileSafe(filepath) {\n try {\n const content = fs.readFileSync(filepath, 'utf8');\n return JSON.parse(content);\n } catch (error) {\n if (error.code === 'ENOENT') {\n return null; // File not found, return null like API would return 404\n }\n throw error;\n }\n}\n\n/**\n * Read a file safely, returning null if file doesn't exist\n * Strips UTF-8 BOM if present (fixes Windows compatibility)\n * @param {string} filepath - Path to the file\n * @returns {string|null} File content or null if file not found\n * @throws {Error} For other file system errors\n */\nfunction readFileSafe(filepath) {\n try {\n const content = fs.readFileSync(filepath, 'utf8');\n // Strip UTF-8 BOM if present (Windows compatibility)\n return content.replace(/^\\uFEFF/, '');\n } catch (error) {\n if (error.code === 'ENOENT') {\n return null; // File not found\n }\n throw error;\n }\n}\n\n/**\n * Write JSON data to a file with proper formatting\n * @param {string} filepath - Path to write the file\n * @param {Object} data - Data to write\n * @param {number} indent - Indentation level (default: 2)\n */\nfunction writeJsonFile(filepath, data, indent = 2) {\n const content = JSON.stringify(data, null, indent);\n fs.writeFileSync(filepath, content, 'utf8');\n}\n\n/**\n * Write 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", "const path = require('path');\nconst { CACHE_DIR_NAME, CACHE_TTL_MS, CACHE_FILES } = require('./constants');\nconst { CacheError } = require('./errors');\nconst { readJsonFileSafe, readFileSafe, writeJsonFile, writeTextFile, writeModuleExportsFile, fileExists, ensureDirectoryExists, removeDirectory } = require('./file-utils');\n\nclass CacheManager {\n constructor(appRoot = process.cwd()) {\n this.appRoot = appRoot;\n this.cacheDir = path.join(appRoot, 'node_modules', CACHE_DIR_NAME);\n this.metadataFile = path.join(this.cacheDir, 'metadata.json');\n this.maxAge = CACHE_TTL_MS;\n }\n\n /**\n * Get the cache directory path\n * @returns {string} Cache directory path\n */\n getCacheDir() {\n return this.cacheDir;\n }\n\n // True when the cache was authored locally by `migrate` (no cloud fetch yet).\n // init must NOT treat such a cache as \"already up to date\" \u2014 it still needs to\n // fetch the design system, otherwise migrate-then-init silently does nothing.\n isLocalOnly() {\n const metadata = readJsonFileSafe(this.metadataFile);\n return metadata?.version === 'local-components';\n }\n\n // The design system's icon library cached from processed-tokens (or null).\n getIconLibrary() {\n const filePath = path.join(this.cacheDir, 'iconLibrary.json');\n return fileExists(filePath) ? readJsonFileSafe(filePath) : null;\n }\n\n /**\n * Check if cache directory exists\n * @returns {boolean} True if cache exists\n */\n exists() {\n return fileExists(this.cacheDir);\n }\n\n /**\n * Check if cache is valid (exists and not expired)\n * @returns {boolean} True if cache is valid\n */\n isValid() {\n if (!this.exists()) {\n return false;\n }\n\n try {\n const metadata = readJsonFileSafe(this.metadataFile);\n if (!metadata) {\n return false;\n }\n\n const timestamp = new Date(metadata.timestamp).getTime();\n const now = Date.now();\n \n return (now - timestamp) < this.maxAge;\n } catch (error) {\n return false;\n }\n }\n\n /**\n * Load all cached data\n * @returns {Object|null} Cached data object or null if not found\n */\n load() {\n if (!this.exists()) {\n return null;\n }\n\n try {\n const data = {};\n \n // Load all .js files\n for (const file of CACHE_FILES.JS) {\n const filePath = path.join(this.cacheDir, file);\n if (fileExists(filePath)) {\n // Remove .js extension for key\n const key = file.replace('.js', '');\n try {\n // Use a more secure approach - parse the exported data\n const content = readFileSafe(filePath);\n if (content !== null) {\n // Create a safe evaluation context\n const moduleExports = {};\n const fakeModule = { exports: moduleExports };\n \n // Use Function constructor to evaluate in isolated scope\n const evalFunc = new Function('module', 'exports', content);\n evalFunc(fakeModule, moduleExports);\n\n data[key] = fakeModule.exports;\n }\n } catch (e) {\n // Log parsing errors to help debug Windows/encoding issues\n console.warn(`[Frontfriend] Failed to load ${file}: ${e.message}`);\n if (e.message.includes('Unexpected token') || e.message.includes('Invalid character')) {\n console.warn('[Frontfriend] This might be a BOM or encoding issue. Try deleting node_modules/.cache/frontfriend and running `npx frontfriend init` again.');\n }\n }\n }\n }\n\n // Load all .json files\n for (const file of CACHE_FILES.JSON) {\n const filePath = path.join(this.cacheDir, file);\n const key = file.replace('.json', '');\n const content = readJsonFileSafe(filePath);\n if (content !== null) {\n data[key] = content;\n }\n }\n\n // Rename components-config to componentsConfig for consistency\n if (data['components-config']) {\n data.componentsConfig = data['components-config'];\n delete data['components-config'];\n }\n\n // Backward compatibility: rename cls to safelist if present\n if (data.cls && !data.safelist) {\n data.safelist = data.cls;\n delete data.cls;\n }\n\n return data;\n } catch (error) {\n throw new CacheError(`Failed to load cache: ${error.message}`, 'read');\n }\n }\n\n /**\n * Save data to cache\n * @param {Object} data - Data object to save\n * @throws {Error} If save operation fails\n */\n save(data) {\n try {\n // Create cache directory\n ensureDirectoryExists(this.cacheDir);\n\n // Metadata is the cache commit marker. Write it last so an interrupted\n // refresh is never advertised as a complete, current cache.\n const metadata = {\n timestamp: new Date().toISOString(),\n version: data.metadata?.version || '2.0.0',\n ffId: data.metadata?.ffId\n };\n // Save .js files\n const jsFiles = [\n 'tokens',\n 'variables',\n 'semanticVariables',\n 'semanticDarkVariables',\n 'safelist',\n 'custom'\n ];\n\n for (const key of jsFiles) {\n if (data[key] !== undefined) {\n const filePath = path.join(this.cacheDir, `${key}.js`);\n writeModuleExportsFile(filePath, data[key]);\n }\n }\n \n // Also check for safelist specifically since it might be an array\n if (data.safelist && Array.isArray(data.safelist)) {\n const safelistPath = path.join(this.cacheDir, 'safelist.js');\n writeModuleExportsFile(safelistPath, data.safelist);\n }\n\n // Save .json files\n const jsonData = {\n fonts: data.fonts,\n icons: data.icons || data.iconSet,\n 'components-config': data.componentsConfig,\n iconLibrary: data.iconLibrary,\n version: data.version\n };\n\n for (const [key, value] of Object.entries(jsonData)) {\n if (value !== undefined) {\n const filePath = path.join(this.cacheDir, `${key}.json`);\n writeJsonFile(filePath, value);\n }\n }\n\n // Save Tailwind v4 CSS artifacts when generated by the token processor\n if (data.themeCSS !== undefined) {\n writeTextFile(path.join(this.cacheDir, 'theme.css'), data.themeCSS);\n }\n\n if (data.classesContent !== undefined) {\n writeTextFile(path.join(this.cacheDir, 'classes.css'), data.classesContent);\n }\n\n writeJsonFile(this.metadataFile, metadata);\n } catch (error) {\n throw new CacheError(`Failed to save cache: ${error.message}`, 'write');\n }\n }\n\n /**\n * Clear the cache directory\n */\n clear() {\n if (this.exists()) {\n removeDirectory(this.cacheDir);\n }\n }\n}\n\nmodule.exports = CacheManager;\n", "const CACHE_ERROR_MESSAGE =\n 'FrontFriend components configuration not found. Run \"npx frontfriend init\" or \"npx frontfriend sync\".';\nconst SAAS_ERROR_MESSAGE =\n 'FrontFriend components configuration was not returned by the SaaS app. The cache was not updated.';\n\nfunction isPlainObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\nfunction assertComponentsConfig(componentsConfig, message = CACHE_ERROR_MESSAGE) {\n if (!isPlainObject(componentsConfig) || Object.keys(componentsConfig).length === 0) {\n throw new Error(message);\n }\n\n return componentsConfig;\n}\n\nfunction loadCachedComponents(cacheManager) {\n if (!cacheManager.exists()) throw new Error(CACHE_ERROR_MESSAGE);\n\n const cache = cacheManager.load();\n const componentsConfig = assertComponentsConfig(cache?.componentsConfig);\n\n return {\n componentsConfig,\n icons: isPlainObject(cache.icons) ? cache.icons : {},\n };\n}\n\nmodule.exports = {\n CACHE_ERROR_MESSAGE,\n SAAS_ERROR_MESSAGE,\n assertComponentsConfig,\n loadCachedComponents,\n};\n", "const fs = require('fs');\nconst path = require('path');\nconst CacheManager = require('./lib/core/cache-manager');\nconst {\n CACHE_ERROR_MESSAGE,\n loadCachedComponents,\n} = require('./lib/core/cached-components-config');\n\nfunction toPosix(filePath) {\n return filePath.split(path.sep).join('/');\n}\n\nfunction cssSourceDirective(cssFile, sourceFile) {\n let relative = toPosix(path.relative(path.dirname(cssFile), sourceFile));\n if (!relative.startsWith('.')) relative = `./${relative}`;\n return `@source \"${relative}\";`;\n}\n\nmodule.exports = function vitePlugin() {\n let resolvedConfig;\n let cacheDir;\n let cachedComponents;\n\n function loadCache(root) {\n const appRoot = root || process.cwd();\n const cacheManager = new CacheManager(appRoot);\n cacheDir = typeof cacheManager.getCacheDir === 'function'\n ? cacheManager.getCacheDir()\n : path.join(appRoot, 'node_modules', '.cache', 'frontfriend');\n cachedComponents = loadCachedComponents(cacheManager);\n return cachedComponents;\n }\n\n return {\n name: 'frontfriend-tailwind',\n enforce: 'pre',\n\n config(userConfig = {}) {\n loadCache(userConfig.root || process.cwd());\n const themePath = path.join(cacheDir, 'theme.css');\n if (!fs.existsSync(themePath)) throw new Error(CACHE_ERROR_MESSAGE);\n\n const browserRuntimePath = path.join(__dirname, 'browser.mjs');\n return {\n resolve: {\n alias: [\n { find: /^@frontfriend\\/tailwind$/, replacement: browserRuntimePath },\n { find: '@frontfriend/tailwind/theme.css', replacement: themePath },\n { find: '@frontfriend/tailwind/theme', replacement: themePath },\n ],\n },\n };\n },\n\n configResolved(config) {\n resolvedConfig = config;\n cacheDir = cacheDir || path.join(config?.root || process.cwd(), 'node_modules', '.cache', 'frontfriend');\n },\n\n transform(code, id) {\n const [cssFile, query = ''] = id.split('?');\n if (!cssFile.endsWith('.css')) return null;\n if (/(?:^|&)(?:url|raw|inline)(?:&|=|$)/.test(query)) return null;\n\n const classesPath = path.join(cacheDir || process.cwd(), 'classes.css');\n if (!fs.existsSync(classesPath)) return null;\n const directive = cssSourceDirective(cssFile, classesPath);\n if (code.includes(directive)) return null;\n\n return {\n code: `${code}\\n\\n/* Frontfriend Tailwind v4 registry source */\\n${directive}\\n`,\n map: null,\n };\n },\n\n load(id) {\n if (id !== 'virtual:frontfriend-config') return null;\n const { componentsConfig, icons } = cachedComponents || loadCache(resolvedConfig?.root || process.cwd());\n\n if (resolvedConfig?.command === 'serve') {\n console.log('[FrontFriend Vite] Injected configuration and icons into build');\n }\n\n return `\n globalThis.__FF_CONFIG__ = ${JSON.stringify(componentsConfig)};\n globalThis.__FF_ICONS__ = ${JSON.stringify(icons)};\n `;\n },\n };\n};\n"],
|
|
5
|
-
"mappings": "8DAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,IAAA,CAMA,IAAMC,EAAkB,kCAClBC,EAAiB,0CAGjBC,EAAiB,qBAKjBC,EAAc,CAClB,GAAI,CACF,YACA,eACA,uBACA,2BACA,cACA,WACF,EACA,KAAM,CACJ,aACA,aACA,yBACA,eACA,eACF,CACF,EAGMC,EAAW,CACf,MAAO,QACP,WAAY,aACZ,aAAc,eACd,cAAe,eACjB,
|
|
6
|
-
"names": ["require_constants", "__commonJSMin", "exports", "module", "DEFAULT_API_URL", "LEGACY_API_URL", "CACHE_DIR_NAME", "CACHE_FILES", "ENV_VARS", "require_errors", "__commonJSMin", "exports", "module", "APIError", "message", "statusCode", "url", "CacheError", "operation", "ConfigError", "field", "ProcessingError", "token", "require_file_utils", "__commonJSMin", "exports", "module", "fs", "readJsonFileSafe", "filepath", "content", "error", "readFileSafe", "writeJsonFile", "data", "indent", "writeTextFile", "writeModuleExportsFile", "fileExists", "ensureDirectoryExists", "dirpath", "removeDirectory", "require_cache_manager", "__commonJSMin", "exports", "module", "path", "CACHE_DIR_NAME", "CACHE_TTL_MS", "CACHE_FILES", "CacheError", "readJsonFileSafe", "readFileSafe", "writeJsonFile", "writeTextFile", "writeModuleExportsFile", "fileExists", "ensureDirectoryExists", "removeDirectory", "CacheManager", "appRoot", "metadata", "filePath", "timestamp", "data", "file", "key", "content", "moduleExports", "fakeModule", "e", "error", "_a", "_b", "jsFiles", "safelistPath", "jsonData", "value", "require_cached_components_config", "__commonJSMin", "exports", "module", "CACHE_ERROR_MESSAGE", "SAAS_ERROR_MESSAGE", "isPlainObject", "value", "assertComponentsConfig", "componentsConfig", "message", "loadCachedComponents", "cacheManager", "cache", "fs", "path", "CacheManager", "CACHE_ERROR_MESSAGE", "loadCachedComponents", "toPosix", "filePath", "cssSourceDirective", "cssFile", "sourceFile", "relative", "resolvedConfig", "cacheDir", "cachedComponents", "loadCache", "root", "appRoot", "cacheManager", "userConfig", "themePath", "browserRuntimePath", "config", "code", "id", "query", "classesPath", "directive", "componentsConfig", "icons"]
|
|
4
|
+
"sourcesContent": ["/**\n * Configuration constants for FrontFriend Tailwind v2\n */\n\n// API Configuration. The platform currently lives on the dev deployment \u2014\n// keep this as the CLI default so `frontfriend login`/init work zero-config.\nconst DEFAULT_API_URL = 'https://app.dev.frontfriend.dev';\nconst LEGACY_API_URL = 'https://registry-legacy.frontfriend.dev';\n\n// Cache Configuration\nconst CACHE_DIR_NAME = '.cache/frontfriend';\nconst CACHE_TTL_DAYS = 7;\nconst CACHE_TTL_MS = CACHE_TTL_DAYS * 24 * 60 * 60 * 1000;\n\n// File names\nconst CACHE_FILES = {\n JS: [\n 'tokens.js',\n 'variables.js',\n 'semanticVariables.js',\n 'semanticDarkVariables.js',\n 'safelist.js',\n 'custom.js'\n ],\n JSON: [\n 'fonts.json',\n 'icons.json',\n 'components-config.json',\n 'version.json',\n 'versionMetadata.json',\n 'metadata.json'\n ]\n};\n\n// Environment variables\nconst ENV_VARS = {\n FF_ID: 'FF_ID',\n FF_API_URL: 'FF_API_URL',\n FF_USE_LOCAL: 'FF_USE_LOCAL',\n FF_AUTH_TOKEN: 'FF_AUTH_TOKEN'\n};\n\n/**\n * The registry follows the app: with api-url app.dev.frontfriend.dev the\n * components must come from registry.dev.frontfriend.dev, not prod (the two\n * registries do not serve the same item set). Environments pair `app.<env>`\n * with `registry.<env>`, so derive the registry host by swapping the prefix.\n * Returns null for unknown api-url shapes (callers fall back to their default).\n */\nfunction deriveRegistryFromApiUrl(apiUrl) {\n if (!apiUrl) return null;\n try {\n const url = new URL(apiUrl);\n if (!url.hostname.startsWith('app.')) return null;\n return `${url.protocol}//${url.hostname.replace(/^app\\./, 'registry.')}`;\n } catch {\n return null;\n }\n}\n\nmodule.exports = {\n DEFAULT_API_URL,\n LEGACY_API_URL,\n CACHE_DIR_NAME,\n CACHE_TTL_DAYS,\n CACHE_TTL_MS,\n CACHE_FILES,\n ENV_VARS,\n deriveRegistryFromApiUrl\n};\n", "class APIError extends Error {\n constructor(message, statusCode, url) {\n super(message);\n this.name = 'APIError';\n this.statusCode = statusCode;\n this.url = url;\n this.code = `API_${statusCode}`;\n }\n}\n\nclass CacheError extends Error {\n constructor(message, operation) {\n super(message);\n this.name = 'CacheError';\n this.operation = operation;\n this.code = `CACHE_${operation.toUpperCase()}`;\n }\n}\n\nclass ConfigError extends Error {\n constructor(message, field) {\n super(message);\n this.name = 'ConfigError';\n this.field = field;\n // `field` is optional; guard so a missing field never crashes (and masks)\n // the real error with `Cannot read properties of undefined (toUpperCase)`.\n this.code = field ? `CONFIG_${String(field).toUpperCase()}` : 'CONFIG_ERROR';\n }\n}\n\nclass ProcessingError extends Error {\n constructor(message, token) {\n super(message);\n this.name = 'ProcessingError';\n this.token = token;\n this.code = 'PROCESSING_ERROR';\n }\n}\n\nmodule.exports = {\n APIError,\n CacheError,\n ConfigError,\n ProcessingError\n};", "const fs = require('fs');\n\n/**\n * Read a JSON file safely, returning null if file doesn't exist\n * @param {string} filepath - Path to the JSON file\n * @returns {Object|null} Parsed JSON or null if file not found\n * @throws {Error} If JSON is invalid\n */\nfunction readJsonFileSafe(filepath) {\n try {\n const content = fs.readFileSync(filepath, 'utf8');\n return JSON.parse(content);\n } catch (error) {\n if (error.code === 'ENOENT') {\n return null; // File not found, return null like API would return 404\n }\n throw error;\n }\n}\n\n/**\n * Read a file safely, returning null if file doesn't exist\n * Strips UTF-8 BOM if present (fixes Windows compatibility)\n * @param {string} filepath - Path to the file\n * @returns {string|null} File content or null if file not found\n * @throws {Error} For other file system errors\n */\nfunction readFileSafe(filepath) {\n try {\n const content = fs.readFileSync(filepath, 'utf8');\n // Strip UTF-8 BOM if present (Windows compatibility)\n return content.replace(/^\\uFEFF/, '');\n } catch (error) {\n if (error.code === 'ENOENT') {\n return null; // File not found\n }\n throw error;\n }\n}\n\n/**\n * Write JSON data to a file with proper formatting\n * @param {string} filepath - Path to write the file\n * @param {Object} data - Data to write\n * @param {number} indent - Indentation level (default: 2)\n */\nfunction writeJsonFile(filepath, data, indent = 2) {\n const content = JSON.stringify(data, null, indent);\n fs.writeFileSync(filepath, content, 'utf8');\n}\n\n/**\n * Write 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", "const path = require('path');\nconst { CACHE_DIR_NAME, CACHE_TTL_MS, CACHE_FILES } = require('./constants');\nconst { CacheError } = require('./errors');\nconst { readJsonFileSafe, readFileSafe, writeJsonFile, writeTextFile, writeModuleExportsFile, fileExists, ensureDirectoryExists, removeDirectory } = require('./file-utils');\n\nclass CacheManager {\n constructor(appRoot = process.cwd()) {\n this.appRoot = appRoot;\n this.cacheDir = path.join(appRoot, 'node_modules', CACHE_DIR_NAME);\n this.metadataFile = path.join(this.cacheDir, 'metadata.json');\n this.maxAge = CACHE_TTL_MS;\n }\n\n /**\n * Get the cache directory path\n * @returns {string} Cache directory path\n */\n getCacheDir() {\n return this.cacheDir;\n }\n\n // True when the cache was authored locally by `migrate` (no cloud fetch yet).\n // init must NOT treat such a cache as \"already up to date\" \u2014 it still needs to\n // fetch the design system, otherwise migrate-then-init silently does nothing.\n isLocalOnly() {\n const metadata = readJsonFileSafe(this.metadataFile);\n return metadata?.version === 'local-components';\n }\n\n // The design system's icon library cached from processed-tokens (or null).\n getIconLibrary() {\n const filePath = path.join(this.cacheDir, 'iconLibrary.json');\n return fileExists(filePath) ? readJsonFileSafe(filePath) : null;\n }\n\n /**\n * Check if cache directory exists\n * @returns {boolean} True if cache exists\n */\n exists() {\n return fileExists(this.cacheDir);\n }\n\n /**\n * Check if cache is valid (exists and not expired)\n * @returns {boolean} True if cache is valid\n */\n isValid() {\n if (!this.exists()) {\n return false;\n }\n\n try {\n const metadata = readJsonFileSafe(this.metadataFile);\n if (!metadata) {\n return false;\n }\n\n const timestamp = new Date(metadata.timestamp).getTime();\n const now = Date.now();\n \n return (now - timestamp) < this.maxAge;\n } catch (error) {\n return false;\n }\n }\n\n /**\n * Load all cached data\n * @returns {Object|null} Cached data object or null if not found\n */\n load() {\n if (!this.exists()) {\n return null;\n }\n\n try {\n const data = {};\n \n // Load all .js files\n for (const file of CACHE_FILES.JS) {\n const filePath = path.join(this.cacheDir, file);\n if (fileExists(filePath)) {\n // Remove .js extension for key\n const key = file.replace('.js', '');\n try {\n // Use a more secure approach - parse the exported data\n const content = readFileSafe(filePath);\n if (content !== null) {\n // Create a safe evaluation context\n const moduleExports = {};\n const fakeModule = { exports: moduleExports };\n \n // Use Function constructor to evaluate in isolated scope\n const evalFunc = new Function('module', 'exports', content);\n evalFunc(fakeModule, moduleExports);\n\n data[key] = fakeModule.exports;\n }\n } catch (e) {\n // Log parsing errors to help debug Windows/encoding issues\n console.warn(`[Frontfriend] Failed to load ${file}: ${e.message}`);\n if (e.message.includes('Unexpected token') || e.message.includes('Invalid character')) {\n console.warn('[Frontfriend] This might be a BOM or encoding issue. Try deleting node_modules/.cache/frontfriend and running `npx frontfriend init` again.');\n }\n }\n }\n }\n\n // Load all .json files\n for (const file of CACHE_FILES.JSON) {\n const filePath = path.join(this.cacheDir, file);\n const key = file.replace('.json', '');\n const content = readJsonFileSafe(filePath);\n if (content !== null) {\n data[key] = content;\n }\n }\n\n // Rename components-config to componentsConfig for consistency\n if (data['components-config']) {\n data.componentsConfig = data['components-config'];\n delete data['components-config'];\n }\n\n // Backward compatibility: rename cls to safelist if present\n if (data.cls && !data.safelist) {\n data.safelist = data.cls;\n delete data.cls;\n }\n\n return data;\n } catch (error) {\n throw new CacheError(`Failed to load cache: ${error.message}`, 'read');\n }\n }\n\n /**\n * Save data to cache\n * @param {Object} data - Data object to save\n * @throws {Error} If save operation fails\n */\n save(data) {\n try {\n // Create cache directory\n ensureDirectoryExists(this.cacheDir);\n\n // Metadata is the cache commit marker. Write it last so an interrupted\n // refresh is never advertised as a complete, current cache.\n const metadata = {\n timestamp: new Date().toISOString(),\n version: data.metadata?.version || '2.0.0',\n ffId: data.metadata?.ffId\n };\n // Save .js files\n const jsFiles = [\n 'tokens',\n 'variables',\n 'semanticVariables',\n 'semanticDarkVariables',\n 'safelist',\n 'custom'\n ];\n\n for (const key of jsFiles) {\n if (data[key] !== undefined) {\n const filePath = path.join(this.cacheDir, `${key}.js`);\n writeModuleExportsFile(filePath, data[key]);\n }\n }\n \n // Also check for safelist specifically since it might be an array\n if (data.safelist && Array.isArray(data.safelist)) {\n const safelistPath = path.join(this.cacheDir, 'safelist.js');\n writeModuleExportsFile(safelistPath, data.safelist);\n }\n\n // Save .json files\n const jsonData = {\n fonts: data.fonts,\n icons: data.icons || data.iconSet,\n 'components-config': data.componentsConfig,\n iconLibrary: data.iconLibrary,\n version: data.version,\n versionMetadata: data.versionMetadata\n };\n\n for (const [key, value] of Object.entries(jsonData)) {\n if (value !== undefined) {\n const filePath = path.join(this.cacheDir, `${key}.json`);\n writeJsonFile(filePath, value);\n }\n }\n\n // Save Tailwind v4 CSS artifacts when generated by the token processor\n if (data.themeCSS !== undefined) {\n writeTextFile(path.join(this.cacheDir, 'theme.css'), data.themeCSS);\n }\n\n if (data.classesContent !== undefined) {\n writeTextFile(path.join(this.cacheDir, 'classes.css'), data.classesContent);\n }\n\n writeJsonFile(this.metadataFile, metadata);\n } catch (error) {\n throw new CacheError(`Failed to save cache: ${error.message}`, 'write');\n }\n }\n\n /**\n * Clear the cache directory\n */\n clear() {\n if (this.exists()) {\n removeDirectory(this.cacheDir);\n }\n }\n}\n\nmodule.exports = CacheManager;\n", "const CACHE_ERROR_MESSAGE =\n 'FrontFriend components configuration not found. Run \"npx frontfriend init\" or \"npx frontfriend sync\".';\nconst SAAS_ERROR_MESSAGE =\n 'FrontFriend components configuration was not returned by the SaaS app. The cache was not updated.';\n\nfunction isPlainObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\nfunction assertComponentsConfig(componentsConfig, message = CACHE_ERROR_MESSAGE) {\n if (!isPlainObject(componentsConfig) || Object.keys(componentsConfig).length === 0) {\n throw new Error(message);\n }\n\n return componentsConfig;\n}\n\nfunction loadCachedComponents(cacheManager) {\n if (!cacheManager.exists()) throw new Error(CACHE_ERROR_MESSAGE);\n\n const cache = cacheManager.load();\n const componentsConfig = assertComponentsConfig(cache?.componentsConfig);\n\n return {\n componentsConfig,\n icons: isPlainObject(cache.icons) ? cache.icons : {},\n };\n}\n\nmodule.exports = {\n CACHE_ERROR_MESSAGE,\n SAAS_ERROR_MESSAGE,\n assertComponentsConfig,\n loadCachedComponents,\n};\n", "const fs = require('fs');\nconst path = require('path');\nconst CacheManager = require('./lib/core/cache-manager');\nconst {\n CACHE_ERROR_MESSAGE,\n loadCachedComponents,\n} = require('./lib/core/cached-components-config');\n\nfunction toPosix(filePath) {\n return filePath.split(path.sep).join('/');\n}\n\nfunction cssSourceDirective(cssFile, sourceFile) {\n let relative = toPosix(path.relative(path.dirname(cssFile), sourceFile));\n if (!relative.startsWith('.')) relative = `./${relative}`;\n return `@source \"${relative}\";`;\n}\n\nmodule.exports = function vitePlugin() {\n let resolvedConfig;\n let cacheDir;\n let cachedComponents;\n\n function loadCache(root) {\n const appRoot = root || process.cwd();\n const cacheManager = new CacheManager(appRoot);\n cacheDir = typeof cacheManager.getCacheDir === 'function'\n ? cacheManager.getCacheDir()\n : path.join(appRoot, 'node_modules', '.cache', 'frontfriend');\n cachedComponents = loadCachedComponents(cacheManager);\n return cachedComponents;\n }\n\n return {\n name: 'frontfriend-tailwind',\n enforce: 'pre',\n\n config(userConfig = {}) {\n loadCache(userConfig.root || process.cwd());\n const themePath = path.join(cacheDir, 'theme.css');\n if (!fs.existsSync(themePath)) throw new Error(CACHE_ERROR_MESSAGE);\n\n const browserRuntimePath = path.join(__dirname, 'browser.mjs');\n return {\n resolve: {\n alias: [\n { find: /^@frontfriend\\/tailwind$/, replacement: browserRuntimePath },\n { find: '@frontfriend/tailwind/theme.css', replacement: themePath },\n { find: '@frontfriend/tailwind/theme', replacement: themePath },\n ],\n },\n };\n },\n\n configResolved(config) {\n resolvedConfig = config;\n cacheDir = cacheDir || path.join(config?.root || process.cwd(), 'node_modules', '.cache', 'frontfriend');\n },\n\n transform(code, id) {\n const [cssFile, query = ''] = id.split('?');\n if (!cssFile.endsWith('.css')) return null;\n if (/(?:^|&)(?:url|raw|inline)(?:&|=|$)/.test(query)) return null;\n\n const classesPath = path.join(cacheDir || process.cwd(), 'classes.css');\n if (!fs.existsSync(classesPath)) return null;\n const directive = cssSourceDirective(cssFile, classesPath);\n if (code.includes(directive)) return null;\n\n return {\n code: `${code}\\n\\n/* Frontfriend Tailwind v4 registry source */\\n${directive}\\n`,\n map: null,\n };\n },\n\n load(id) {\n if (id !== 'virtual:frontfriend-config') return null;\n const { componentsConfig, icons } = cachedComponents || loadCache(resolvedConfig?.root || process.cwd());\n\n if (resolvedConfig?.command === 'serve') {\n console.log('[FrontFriend Vite] Injected configuration and icons into build');\n }\n\n return `\n globalThis.__FF_CONFIG__ = ${JSON.stringify(componentsConfig)};\n globalThis.__FF_ICONS__ = ${JSON.stringify(icons)};\n `;\n },\n };\n};\n"],
|
|
5
|
+
"mappings": "8DAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,IAAA,CAMA,IA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AQ,IAAI,EAAG,aAAa,EACtE,GAAI,CAACZ,EAAG,WAAWyB,CAAW,EAAG,OAAO,KACxC,IAAMC,EAAYnB,GAAmBC,EAASiB,CAAW,EACzD,OAAIH,EAAK,SAASI,CAAS,EAAU,KAE9B,CACL,KAAM,GAAGJ,CAAI;AAAA;AAAA;AAAA,EAAsDI,CAAS;AAAA,EAC5E,IAAK,IACP,CACF,EAEA,KAAKH,EAAI,CACP,GAAIA,IAAO,6BAA8B,OAAO,KAChD,GAAM,CAAE,iBAAAI,EAAkB,MAAAC,CAAM,EAAIf,GAAoBC,GAAUH,GAAA,YAAAA,EAAgB,OAAQ,QAAQ,IAAI,CAAC,EAEvG,OAAIA,GAAA,YAAAA,EAAgB,WAAY,SAC9B,QAAQ,IAAI,gEAAgE,EAGvE;AAAA,qCACwB,KAAK,UAAUgB,CAAgB,CAAC;AAAA,oCACjC,KAAK,UAAUC,CAAK,CAAC;AAAA,OAErD,CACF,CACF",
|
|
6
|
+
"names": ["require_constants", "__commonJSMin", "exports", "module", "DEFAULT_API_URL", "LEGACY_API_URL", "CACHE_DIR_NAME", "CACHE_FILES", "ENV_VARS", "deriveRegistryFromApiUrl", "apiUrl", "url", "require_errors", "__commonJSMin", "exports", "module", "APIError", "message", "statusCode", "url", "CacheError", "operation", "ConfigError", "field", "ProcessingError", "token", "require_file_utils", "__commonJSMin", "exports", "module", "fs", "readJsonFileSafe", "filepath", "content", "error", "readFileSafe", "writeJsonFile", "data", "indent", "writeTextFile", "writeModuleExportsFile", "fileExists", "ensureDirectoryExists", "dirpath", "removeDirectory", "require_cache_manager", "__commonJSMin", "exports", "module", "path", "CACHE_DIR_NAME", "CACHE_TTL_MS", "CACHE_FILES", "CacheError", "readJsonFileSafe", "readFileSafe", "writeJsonFile", "writeTextFile", "writeModuleExportsFile", "fileExists", "ensureDirectoryExists", "removeDirectory", "CacheManager", "appRoot", "metadata", "filePath", "timestamp", "data", "file", "key", "content", "moduleExports", "fakeModule", "e", "error", "_a", "_b", "jsFiles", "safelistPath", "jsonData", "value", "require_cached_components_config", "__commonJSMin", "exports", "module", "CACHE_ERROR_MESSAGE", "SAAS_ERROR_MESSAGE", "isPlainObject", "value", "assertComponentsConfig", "componentsConfig", "message", "loadCachedComponents", "cacheManager", "cache", "fs", "path", "CacheManager", "CACHE_ERROR_MESSAGE", "loadCachedComponents", "toPosix", "filePath", "cssSourceDirective", "cssFile", "sourceFile", "relative", "resolvedConfig", "cacheDir", "cachedComponents", "loadCache", "root", "appRoot", "cacheManager", "userConfig", "themePath", "browserRuntimePath", "config", "code", "id", "query", "classesPath", "directive", "componentsConfig", "icons"]
|
|
7
7
|
}
|