@intlayer/chokidar
Version:
Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.
1 lines • 1.59 kB
Source Map (JSON)
{"version":3,"file":"formatter.mjs","names":[],"sources":["../../../src/utils/formatter.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { system } from '@intlayer/config/built';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n type ANSIColorsType,\n colorize,\n colorizePath,\n} from '@intlayer/config/logger';\nimport { getLocaleName } from '@intlayer/core/localization';\nimport { ENGLISH } from '@intlayer/types/locales';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\nexport const formatPath = (\n path: string | string[],\n color?: ANSIColorsType | false\n) =>\n [path]\n .flat()\n .map((path) =>\n path.startsWith('/') ? relative(system.baseDir, path) : path\n )\n .map((relativePath) =>\n color === false ? relativePath : colorizePath(relativePath, color)\n )\n .join(`, `);\n\nexport const formatLocale = (\n locale: LocalesValues | LocalesValues[],\n color: ANSIColorsType | false = ANSIColors.GREEN\n) =>\n [locale]\n .flat()\n .map((locale) => `${getLocaleName(locale, ENGLISH)} (${locale})`)\n .map((text) => (color === false ? text : colorize(text, color)))\n .join(`, `);\n"],"mappings":";;;;;;;;AAYA,MAAa,cACX,MACA,UAEA,CAAC,IAAI,EACF,KAAK,EACL,KAAK,SACJ,KAAK,WAAW,GAAG,IAAI,SAAS,OAAO,SAAS,IAAI,IAAI,IAC1D,EACC,KAAK,iBACJ,UAAU,QAAQ,eAAe,aAAa,cAAc,KAAK,CACnE,EACC,KAAK,IAAI;AAEd,MAAa,gBACX,QACA,QAAgC,WAAW,UAE3C,CAAC,MAAM,EACJ,KAAK,EACL,KAAK,WAAW,GAAG,cAAc,QAAQ,OAAO,EAAE,IAAI,OAAO,EAAE,EAC/D,KAAK,SAAU,UAAU,QAAQ,OAAO,SAAS,MAAM,KAAK,CAAE,EAC9D,KAAK,IAAI"}