@frontfriend/tailwind 4.0.0 → 4.0.1

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/vite.mjs CHANGED
@@ -1,2 +1,7 @@
1
- import n from"fs";import e from"path";import{createRequire as m}from"module";import{fileURLToPath as p}from"url";var u=m(import.meta.url),{mergeComponentsConfig:c}=u("./lib/core/default-config.js"),a=e.dirname(p(import.meta.url));function _(){let r=c(null),t={};return{name:"vite-plugin-frontfriend",config(){let i=e.join(process.cwd(),"node_modules",".cache","frontfriend");try{if(!n.existsSync(i))return console.warn('[FrontFriend Vite] No cache found. Please run "npx frontfriend init" first.'),{define:{__FF_CONFIG__:JSON.stringify(r),__FF_ICONS__:JSON.stringify(t)},resolve:{alias:[{find:/^@frontfriend\/tailwind$/,replacement:e.join(a,"browser.mjs")}]}};let o=e.join(i,"components-config.json");n.existsSync(o)&&(r=c(JSON.parse(n.readFileSync(o,"utf-8"))));let f=e.join(i,"icons.json");n.existsSync(f)&&(t=JSON.parse(n.readFileSync(f,"utf-8"))),!r&&!t&&console.warn('[FrontFriend Vite] Cache directory exists but no cache files found. Please run "npx frontfriend init" to refresh.')}catch(o){console.error("[FrontFriend Vite] Failed to load cache:",o.message)}let s=e.join(i,"theme.css"),d=e.join(a,"browser.mjs"),l=[{find:/^@frontfriend\/tailwind$/,replacement:d},...n.existsSync(i)?[{find:"@frontfriend/tailwind/theme",replacement:s},{find:"@frontfriend/tailwind/theme.css",replacement:s}]:[]];return{define:{__FF_CONFIG__:JSON.stringify(r),__FF_ICONS__:JSON.stringify(t)},resolve:{alias:l}}}}}var y=_;export{y as default,_ as frontfriend};
1
+ import o from"fs";import n from"path";import{createRequire as m}from"module";import{fileURLToPath as p}from"url";var h=m(import.meta.url),{mergeComponentsConfig:u}=h("./lib/core/default-config.js"),l=n.dirname(p(import.meta.url));function _(i){return i.split(n.sep).join("/")}function F(i,r){let e=_(n.relative(n.dirname(i),r));return e.startsWith(".")||(e=`./${e}`),`@source "${e}";`}function S(i,r){let e=[n.join(l,"lib","core","default-config-data.js")],s=n.join(r,"classes.css");return o.existsSync(s)&&e.push(s),e.filter(t=>o.existsSync(t)).map(t=>F(i,t))}function g(){let i=u(null),r={},e=n.join(process.cwd(),"node_modules",".cache","frontfriend");return{name:"vite-plugin-frontfriend",enforce:"pre",config(s={}){e=n.join(s.root||process.cwd(),"node_modules",".cache","frontfriend");try{if(!o.existsSync(e))return console.warn('[FrontFriend Vite] No cache found. Please run "npx frontfriend init" first.'),{define:{__FF_CONFIG__:JSON.stringify(i),__FF_ICONS__:JSON.stringify(r)},resolve:{alias:[{find:/^@frontfriend\/tailwind$/,replacement:n.join(l,"browser.mjs")}]}};let c=n.join(e,"components-config.json");o.existsSync(c)&&(i=u(JSON.parse(o.readFileSync(c,"utf-8"))));let d=n.join(e,"icons.json");o.existsSync(d)&&(r=JSON.parse(o.readFileSync(d,"utf-8"))),!i&&!r&&console.warn('[FrontFriend Vite] Cache directory exists but no cache files found. Please run "npx frontfriend init" to refresh.')}catch(c){console.error("[FrontFriend Vite] Failed to load cache:",c.message)}let t=n.join(e,"theme.css"),f=n.join(l,"browser.mjs"),a=[{find:/^@frontfriend\/tailwind$/,replacement:f},...o.existsSync(e)?[{find:"@frontfriend/tailwind/theme",replacement:t},{find:"@frontfriend/tailwind/theme.css",replacement:t}]:[]];return{define:{__FF_CONFIG__:JSON.stringify(i),__FF_ICONS__:JSON.stringify(r)},resolve:{alias:a}}},transform(s,t){let f=t.split("?")[0];if(!f.endsWith(".css"))return null;let a=S(f,e).filter(c=>!s.includes(c));return a.length===0?null:{code:`${s}
2
+
3
+ /* Frontfriend Tailwind v4 registry source */
4
+ ${a.join(`
5
+ `)}
6
+ `,map:null}}}}var N=g;export{N as default,g as frontfriend};
2
7
  //# sourceMappingURL=vite.mjs.map
package/dist/vite.mjs.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../vite.mjs"],
4
- "sourcesContent": ["// Vite plugin for FrontFriend Tailwind\nimport fs from 'fs';\nimport path from 'path';\nimport { createRequire } from 'module';\nimport { fileURLToPath } from 'url';\n\nconst require = createRequire(import.meta.url);\nconst { mergeComponentsConfig } = require('./lib/core/default-config.js');\nconst packageDir = path.dirname(fileURLToPath(import.meta.url));\n\nexport function frontfriend() {\n let config = mergeComponentsConfig(null);\n let icons = {};\n\n return {\n name: 'vite-plugin-frontfriend',\n \n config() {\n const cacheDir = path.join(process.cwd(), 'node_modules', '.cache', 'frontfriend');\n\n // Load cache during config phase\n try {\n \n // Check if cache directory exists\n if (!fs.existsSync(cacheDir)) {\n console.warn('[FrontFriend Vite] No cache found. Please run \"npx frontfriend init\" first.');\n return {\n define: {\n __FF_CONFIG__: JSON.stringify(config),\n __FF_ICONS__: JSON.stringify(icons)\n },\n resolve: {\n alias: [{ find: /^@frontfriend\\/tailwind$/, replacement: path.join(packageDir, 'browser.mjs') }]\n }\n };\n }\n \n const configPath = path.join(cacheDir, 'components-config.json');\n if (fs.existsSync(configPath)) {\n config = mergeComponentsConfig(JSON.parse(fs.readFileSync(configPath, 'utf-8')));\n }\n \n const iconsPath = path.join(cacheDir, 'icons.json');\n if (fs.existsSync(iconsPath)) {\n icons = JSON.parse(fs.readFileSync(iconsPath, 'utf-8'));\n }\n \n // Warn if cache files don't exist\n if (!config && !icons) {\n console.warn('[FrontFriend Vite] Cache directory exists but no cache files found. Please run \"npx frontfriend init\" to refresh.');\n }\n } catch (error) {\n console.error('[FrontFriend Vite] Failed to load cache:', error.message);\n }\n\n const themePath = path.join(cacheDir, 'theme.css');\n const browserRuntimePath = path.join(packageDir, 'browser.mjs');\n const alias = [\n { find: /^@frontfriend\\/tailwind$/, replacement: browserRuntimePath },\n ...(fs.existsSync(cacheDir)\n ? [\n { find: '@frontfriend/tailwind/theme', replacement: themePath },\n { find: '@frontfriend/tailwind/theme.css', replacement: themePath }\n ]\n : [])\n ];\n\n // Define global constants and expose the Tailwind v4 CSS-first theme file\n return {\n define: {\n __FF_CONFIG__: JSON.stringify(config),\n __FF_ICONS__: JSON.stringify(icons)\n },\n resolve: {\n alias\n }\n };\n }\n };\n}\n\n// Default export for compatibility\nexport default frontfriend;\n"],
5
- "mappings": "AACA,OAAOA,MAAQ,KACf,OAAOC,MAAU,OACjB,OAAS,iBAAAC,MAAqB,SAC9B,OAAS,iBAAAC,MAAqB,MAE9B,IAAMC,EAAUF,EAAc,YAAY,GAAG,EACvC,CAAE,sBAAAG,CAAsB,EAAID,EAAQ,8BAA8B,EAClEE,EAAaL,EAAK,QAAQE,EAAc,YAAY,GAAG,CAAC,EAEvD,SAASI,GAAc,CAC5B,IAAIC,EAASH,EAAsB,IAAI,EACnCI,EAAQ,CAAC,EAEb,MAAO,CACL,KAAM,0BAEN,QAAS,CACP,IAAMC,EAAWT,EAAK,KAAK,QAAQ,IAAI,EAAG,eAAgB,SAAU,aAAa,EAGjF,GAAI,CAGF,GAAI,CAACD,EAAG,WAAWU,CAAQ,EACzB,eAAQ,KAAK,6EAA6E,EACnF,CACL,OAAQ,CACN,cAAe,KAAK,UAAUF,CAAM,EACpC,aAAc,KAAK,UAAUC,CAAK,CACpC,EACA,QAAS,CACP,MAAO,CAAC,CAAE,KAAM,2BAA4B,YAAaR,EAAK,KAAKK,EAAY,aAAa,CAAE,CAAC,CACjG,CACF,EAGF,IAAMK,EAAaV,EAAK,KAAKS,EAAU,wBAAwB,EAC3DV,EAAG,WAAWW,CAAU,IAC1BH,EAASH,EAAsB,KAAK,MAAML,EAAG,aAAaW,EAAY,OAAO,CAAC,CAAC,GAGjF,IAAMC,EAAYX,EAAK,KAAKS,EAAU,YAAY,EAC9CV,EAAG,WAAWY,CAAS,IACzBH,EAAQ,KAAK,MAAMT,EAAG,aAAaY,EAAW,OAAO,CAAC,GAIpD,CAACJ,GAAU,CAACC,GACd,QAAQ,KAAK,mHAAmH,CAEpI,OAASI,EAAO,CACd,QAAQ,MAAM,2CAA4CA,EAAM,OAAO,CACzE,CAEA,IAAMC,EAAYb,EAAK,KAAKS,EAAU,WAAW,EAC3CK,EAAqBd,EAAK,KAAKK,EAAY,aAAa,EACxDU,EAAQ,CACZ,CAAE,KAAM,2BAA4B,YAAaD,CAAmB,EACpE,GAAIf,EAAG,WAAWU,CAAQ,EACtB,CACE,CAAE,KAAM,8BAA+B,YAAaI,CAAU,EAC9D,CAAE,KAAM,kCAAmC,YAAaA,CAAU,CACpE,EACA,CAAC,CACP,EAGA,MAAO,CACL,OAAQ,CACN,cAAe,KAAK,UAAUN,CAAM,EACpC,aAAc,KAAK,UAAUC,CAAK,CACpC,EACA,QAAS,CACP,MAAAO,CACF,CACF,CACF,CACF,CACF,CAGA,IAAOC,EAAQV",
6
- "names": ["fs", "path", "createRequire", "fileURLToPath", "require", "mergeComponentsConfig", "packageDir", "frontfriend", "config", "icons", "cacheDir", "configPath", "iconsPath", "error", "themePath", "browserRuntimePath", "alias", "vite_default"]
4
+ "sourcesContent": ["// Vite plugin for FrontFriend Tailwind\nimport fs from 'fs';\nimport path from 'path';\nimport { createRequire } from 'module';\nimport { fileURLToPath } from 'url';\n\nconst require = createRequire(import.meta.url);\nconst { mergeComponentsConfig } = require('./lib/core/default-config.js');\nconst packageDir = path.dirname(fileURLToPath(import.meta.url));\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\nfunction buildSourceDirectives(cssFile, cacheDir) {\n const sources = [path.join(packageDir, 'lib', 'core', 'default-config-data.js')];\n const cacheClassesPath = path.join(cacheDir, 'classes.css');\n if (fs.existsSync(cacheClassesPath)) sources.push(cacheClassesPath);\n\n return sources\n .filter(source => fs.existsSync(source))\n .map(source => cssSourceDirective(cssFile, source));\n}\n\nexport function frontfriend() {\n let config = mergeComponentsConfig(null);\n let icons = {};\n let cacheDir = path.join(process.cwd(), 'node_modules', '.cache', 'frontfriend');\n\n return {\n name: 'vite-plugin-frontfriend',\n enforce: 'pre',\n \n config(userConfig = {}) {\n cacheDir = path.join(userConfig.root || process.cwd(), 'node_modules', '.cache', 'frontfriend');\n\n // Load cache during config phase\n try {\n \n // Check if cache directory exists\n if (!fs.existsSync(cacheDir)) {\n console.warn('[FrontFriend Vite] No cache found. Please run \"npx frontfriend init\" first.');\n return {\n define: {\n __FF_CONFIG__: JSON.stringify(config),\n __FF_ICONS__: JSON.stringify(icons)\n },\n resolve: {\n alias: [{ find: /^@frontfriend\\/tailwind$/, replacement: path.join(packageDir, 'browser.mjs') }]\n }\n };\n }\n \n const configPath = path.join(cacheDir, 'components-config.json');\n if (fs.existsSync(configPath)) {\n config = mergeComponentsConfig(JSON.parse(fs.readFileSync(configPath, 'utf-8')));\n }\n \n const iconsPath = path.join(cacheDir, 'icons.json');\n if (fs.existsSync(iconsPath)) {\n icons = JSON.parse(fs.readFileSync(iconsPath, 'utf-8'));\n }\n \n // Warn if cache files don't exist\n if (!config && !icons) {\n console.warn('[FrontFriend Vite] Cache directory exists but no cache files found. Please run \"npx frontfriend init\" to refresh.');\n }\n } catch (error) {\n console.error('[FrontFriend Vite] Failed to load cache:', error.message);\n }\n\n const themePath = path.join(cacheDir, 'theme.css');\n const browserRuntimePath = path.join(packageDir, 'browser.mjs');\n const alias = [\n { find: /^@frontfriend\\/tailwind$/, replacement: browserRuntimePath },\n ...(fs.existsSync(cacheDir)\n ? [\n { find: '@frontfriend/tailwind/theme', replacement: themePath },\n { find: '@frontfriend/tailwind/theme.css', replacement: themePath }\n ]\n : [])\n ];\n\n // Define global constants and expose the Tailwind v4 CSS-first theme file\n return {\n define: {\n __FF_CONFIG__: JSON.stringify(config),\n __FF_ICONS__: JSON.stringify(icons)\n },\n resolve: {\n alias\n }\n };\n },\n\n transform(code, id) {\n const cssFile = id.split('?')[0];\n if (!cssFile.endsWith('.css')) return null;\n\n const directives = buildSourceDirectives(cssFile, cacheDir)\n .filter(directive => !code.includes(directive));\n if (directives.length === 0) return null;\n\n return {\n code: `${code}\\n\\n/* Frontfriend Tailwind v4 registry source */\\n${directives.join('\\n')}\\n`,\n map: null\n };\n }\n };\n}\n\n// Default export for compatibility\nexport default frontfriend;\n"],
5
+ "mappings": "AACA,OAAOA,MAAQ,KACf,OAAOC,MAAU,OACjB,OAAS,iBAAAC,MAAqB,SAC9B,OAAS,iBAAAC,MAAqB,MAE9B,IAAMC,EAAUF,EAAc,YAAY,GAAG,EACvC,CAAE,sBAAAG,CAAsB,EAAID,EAAQ,8BAA8B,EAClEE,EAAaL,EAAK,QAAQE,EAAc,YAAY,GAAG,CAAC,EAE9D,SAASI,EAAQC,EAAU,CACzB,OAAOA,EAAS,MAAMP,EAAK,GAAG,EAAE,KAAK,GAAG,CAC1C,CAEA,SAASQ,EAAmBC,EAASC,EAAY,CAC/C,IAAIC,EAAWL,EAAQN,EAAK,SAASA,EAAK,QAAQS,CAAO,EAAGC,CAAU,CAAC,EACvE,OAAKC,EAAS,WAAW,GAAG,IAAGA,EAAW,KAAKA,CAAQ,IAChD,YAAYA,CAAQ,IAC7B,CAEA,SAASC,EAAsBH,EAASI,EAAU,CAChD,IAAMC,EAAU,CAACd,EAAK,KAAKK,EAAY,MAAO,OAAQ,wBAAwB,CAAC,EACzEU,EAAmBf,EAAK,KAAKa,EAAU,aAAa,EAC1D,OAAId,EAAG,WAAWgB,CAAgB,GAAGD,EAAQ,KAAKC,CAAgB,EAE3DD,EACJ,OAAOE,GAAUjB,EAAG,WAAWiB,CAAM,CAAC,EACtC,IAAIA,GAAUR,EAAmBC,EAASO,CAAM,CAAC,CACtD,CAEO,SAASC,GAAc,CAC5B,IAAIC,EAASd,EAAsB,IAAI,EACnCe,EAAQ,CAAC,EACTN,EAAWb,EAAK,KAAK,QAAQ,IAAI,EAAG,eAAgB,SAAU,aAAa,EAE/E,MAAO,CACL,KAAM,0BACN,QAAS,MAET,OAAOoB,EAAa,CAA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EAAG,MAAM,GAAG,EAAE,CAAC,EAC/B,GAAI,CAACnB,EAAQ,SAAS,MAAM,EAAG,OAAO,KAEtC,IAAMoB,EAAajB,EAAsBH,EAASI,CAAQ,EACvD,OAAOiB,GAAa,CAACH,EAAK,SAASG,CAAS,CAAC,EAChD,OAAID,EAAW,SAAW,EAAU,KAE7B,CACL,KAAM,GAAGF,CAAI;AAAA;AAAA;AAAA,EAAsDE,EAAW,KAAK;AAAA,CAAI,CAAC;AAAA,EACxF,IAAK,IACP,CACF,CACF,CACF,CAGA,IAAOE,EAAQd",
6
+ "names": ["fs", "path", "createRequire", "fileURLToPath", "require", "mergeComponentsConfig", "packageDir", "toPosix", "filePath", "cssSourceDirective", "cssFile", "sourceFile", "relative", "buildSourceDirectives", "cacheDir", "sources", "cacheClassesPath", "source", "frontfriend", "config", "icons", "userConfig", "configPath", "iconsPath", "error", "themePath", "browserRuntimePath", "alias", "code", "id", "directives", "directive", "vite_default"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontfriend/tailwind",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "Design token management for Tailwind CSS",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/types/index.d.ts",