@volverjs/ui-vue
Version:
@volverjs/ui-vue is a lightweight Vue 3 component library to accompany @volverjs/style.
2 lines (1 loc) • 2.09 kB
JavaScript
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("node:fs"),require("node:path"),require("yargs"),require("yargs/helpers"),require("@iconify/tools"),require("@iconify/utils"),require("chokidar")):"function"==typeof define&&define.amd?define(["exports","node:fs","node:path","yargs","yargs/helpers","@iconify/tools","@iconify/utils","chokidar"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self)["generate-icons"]={},e.fileSystem,e.path,e.yargs,e.helpers,e.tools,e.utils,e.chokidar)}(this,function(e,o,r,n,t,i,s,c){"use strict";function a(e,n="iconify",t={}){return o.readdirSync(e).forEach(i=>{o.statSync(`${e}/${i}`).isDirectory()?t=a(`${e}/${i}`,i,t):i.includes(".svg")&&(t[n]?t[n].push(r.join(e,"/",i)):t[n]=[r.join(e,"/",i)])}),t}function l(e,n,t){const c=a(e,t?.prefix);Object.keys(c).length?Object.keys(c).forEach(e=>{!async function(e,n,t,c){const a=i.blankIconSet(e);for(const r of n)try{const e=await o.promises.readFile(r,{encoding:"utf-8"}),n=new i.SVG(e);await i.cleanupSVG(n),c?.keepColors||await i.parseColors(n,{defaultColor:"currentColor",callback:(e,o,r)=>!r||i.isEmptyColor(r)||o.includes("var(")?o:"currentColor"}),await i.runSVGO(n);const t=r.replace(/^.*[\\/]/,"").split(".")[0].replace(/ /g,"-").replace(/[^a-z0-9-]/gi,"");a.fromSVG(t,n)}catch(d){console.error(d)}const l=a.export();try{s.validateIconSet(l)}catch(d){throw new Error(`Icon set is not valid: ${d?.message}`)}const f=`${t}/${l.prefix}.json`;o.mkdirSync(r.dirname(f),{recursive:!0}),o.writeFileSync(f,JSON.stringify(l))}(e,c[e],n,t),console.info(`Icons generated in: ${n}/${e}.json\n`)}):console.error(`There are no files in ${e}`)}const f=n(t.hideBin(process.argv)).argv,d=f.srcPath,p=f.destPath||d;d&&p||(console.error("Please specify the srcPath and destPath with --srcPath and --destPath"),process.exit());const u={prefix:f.prefix,keepColors:f.keepColors};f.watch?(l(d,p,u),c.watch(d,{ignoreInitial:!0}).on("add",()=>{l(d,p,u)}).on("change",()=>{l(d,p,u)})):l(d,p,u),e.createIconifyJsonFiles=l,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});