UNPKG

@intlayer/chokidar

Version:

Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.

1 lines 1.62 kB
{"version":3,"file":"formatter.cjs","names":["system","ANSIColors","ENGLISH"],"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,4BAAaA,8BAAO,SAAS,IAAI,IAAI,IAC1D,EACC,KAAK,iBACJ,UAAU,QAAQ,yDAA4B,cAAc,KAAK,CACnE,EACC,KAAK,IAAI;AAEd,MAAa,gBACX,QACA,QAAgCC,wBAAW,UAE3C,CAAC,MAAM,EACJ,KAAK,EACL,KAAK,WAAW,kDAAiB,QAAQC,+BAAO,EAAE,IAAI,OAAO,EAAE,EAC/D,KAAK,SAAU,UAAU,QAAQ,6CAAgB,MAAM,KAAK,CAAE,EAC9D,KAAK,IAAI"}