@terai/dev 0.0.1 → 0.0.3

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/index.ts","../../src/commands/init.ts","../../../logger/src/logger.ts","../../../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js","../../../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js","../../../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js","../../../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js","../../../../node_modules/.pnpm/outdent@0.8.0/node_modules/outdent/src/index.ts","../../src/commands/extract.ts","../../../generator/src/generate.ts","../../src/commands/translate.ts"],"sourcesContent":["export * from './init'\nexport * from './extract'\nexport * from './translate'\n","// Dependencies\nimport { findConfig, setupConfig, setupTemplate } from '@terai/runtime'\nimport { input, select } from '@inquirer/prompts'\nimport { logger } from '@terai/logger'\nimport { outdent } from 'outdent'\nimport getPackageManager from 'preferred-pm'\n\n// Types\nimport type { Config, Locale } from '@terai/types'\nimport type { CAC } from 'cac'\n\nexport type InitOptions = Pick<Config, 'projectLocale'> & {\n cwd: string\n force?: boolean\n}\n\nexport function createInitCommand(cli: CAC, cwd: string) {\n return cli\n .command('init', 'Initialize config file')\n .option('-f, --force', 'Force overwrite existing config files')\n .option('--cwd <cwd>', 'Current working directory', { default: cwd })\n .action(initCmd)\n}\n\nexport async function initCmd({ cwd, force }: InitOptions) {\n logger.heading('init', 'Initialize config file')\n const configFile = findConfig({ cwd })\n const pmResult = await getPackageManager(cwd)\n const pm = pmResult?.name ?? 'npm'\n const cmd = pm === 'npm' ? 'npm run' : pm\n\n if (configFile && !force) {\n return logger.log(\n outdent`\n It looks like you already have terai created.\n You can now run ${logger.colors.cyan(`'${cmd} terai extract --watch'`)}\n `\n )\n }\n\n const projectLocale = (await input({\n message: 'What locale do you use for development?',\n default: 'en'\n })) as Locale\n\n const outDir = await input({\n message: 'Where do you want to place your generated files?',\n default: './locale-system'\n })\n\n const framework = (await select({\n message: 'Would you like to use any of these templates? (recommended)',\n choices: [\n {\n name: 'No',\n value: null\n },\n {\n name: 'Next',\n value: 'next'\n },\n {\n name: 'Vite',\n value: 'vite'\n }\n ]\n })) as 'next' | 'vite'\n\n const done = logger.time.success()\n\n await setupConfig({ cwd, projectLocale, outDir })\n\n if (framework) {\n await setupTemplate({ cwd, outDir, framework })\n }\n\n done('Config file created')\n\n logger.log(`🚀 You are set up to start using terai! Thanks for choosing it.`)\n}\n","// Dependencies\nimport process from 'node:process'\nimport chalk from 'chalk'\n\nfunction log(message: string) {\n return process.stdout.write(message + '\\n')\n}\n\nfunction logError(message: string) {\n return process.stderr.write(message + '\\n')\n}\n\nfunction logBullet(\n logger: typeof log | typeof logError,\n colorizePrefix: typeof chalk,\n colorizeText: typeof chalk,\n symbol: string,\n prefix: string,\n text?: string | string[]\n) {\n const textParts = Array.isArray(text) ? text : [text || ''].filter(Boolean)\n const formattedText = textParts\n .map(textPart => colorizeText(textPart))\n .join('')\n\n logger(\n `${' '.repeat(3)} ${colorizePrefix(symbol)} ${colorizePrefix(\n prefix\n )} ${formattedText}`\n )\n}\n\nfunction warn(prefix: string, text?: string | string[]) {\n logBullet(log, chalk.yellow, chalk.yellow, '●', prefix, text)\n}\n\nfunction debug(prefix: string, text?: string | string[]) {\n logBullet(log, chalk.yellow, chalk.dim, '●', prefix, text)\n}\n\nfunction info(prefix: string, text?: string | string[]) {\n logBullet(log, chalk.cyan, chalk.dim, '◼', prefix, text)\n}\n\nfunction success(text: string) {\n logBullet(log, chalk.green, chalk.dim, '✔', text)\n}\n\nfunction error(prefix: string, text?: string | string[]) {\n log('')\n logBullet(logError, chalk.red, chalk.red, '▲', prefix, text)\n}\n\nfunction heading(heading: string, description?: string) {\n return log(\n `\\n${chalk.bgWhite(` ${chalk.whiteBright(heading)} `)} ${chalk.bold(\n description\n )}\\n`\n )\n}\n\nconst timing = (fn: (str: string) => any) => () => {\n const start = performance.now()\n return (msg: string) => {\n const end = performance.now()\n const ms = end - start\n fn(`${msg} ${chalk.gray(`(${ms.toFixed(2)}ms)`)}`)\n }\n}\n\nexport const logger = {\n colors: chalk,\n log,\n heading,\n debug,\n info,\n warn,\n success,\n error,\n time: {\n success: timing(success),\n info: timing(info),\n debug: timing(debug)\n }\n}\n","const ANSI_BACKGROUND_OFFSET = 10;\n\nconst wrapAnsi16 = (offset = 0) => code => `\\u001B[${code + offset}m`;\n\nconst wrapAnsi256 = (offset = 0) => code => `\\u001B[${38 + offset};5;${code}m`;\n\nconst wrapAnsi16m = (offset = 0) => (red, green, blue) => `\\u001B[${38 + offset};2;${red};${green};${blue}m`;\n\nconst styles = {\n\tmodifier: {\n\t\treset: [0, 0],\n\t\t// 21 isn't widely supported and 22 does the same thing\n\t\tbold: [1, 22],\n\t\tdim: [2, 22],\n\t\titalic: [3, 23],\n\t\tunderline: [4, 24],\n\t\toverline: [53, 55],\n\t\tinverse: [7, 27],\n\t\thidden: [8, 28],\n\t\tstrikethrough: [9, 29],\n\t},\n\tcolor: {\n\t\tblack: [30, 39],\n\t\tred: [31, 39],\n\t\tgreen: [32, 39],\n\t\tyellow: [33, 39],\n\t\tblue: [34, 39],\n\t\tmagenta: [35, 39],\n\t\tcyan: [36, 39],\n\t\twhite: [37, 39],\n\n\t\t// Bright color\n\t\tblackBright: [90, 39],\n\t\tgray: [90, 39], // Alias of `blackBright`\n\t\tgrey: [90, 39], // Alias of `blackBright`\n\t\tredBright: [91, 39],\n\t\tgreenBright: [92, 39],\n\t\tyellowBright: [93, 39],\n\t\tblueBright: [94, 39],\n\t\tmagentaBright: [95, 39],\n\t\tcyanBright: [96, 39],\n\t\twhiteBright: [97, 39],\n\t},\n\tbgColor: {\n\t\tbgBlack: [40, 49],\n\t\tbgRed: [41, 49],\n\t\tbgGreen: [42, 49],\n\t\tbgYellow: [43, 49],\n\t\tbgBlue: [44, 49],\n\t\tbgMagenta: [45, 49],\n\t\tbgCyan: [46, 49],\n\t\tbgWhite: [47, 49],\n\n\t\t// Bright color\n\t\tbgBlackBright: [100, 49],\n\t\tbgGray: [100, 49], // Alias of `bgBlackBright`\n\t\tbgGrey: [100, 49], // Alias of `bgBlackBright`\n\t\tbgRedBright: [101, 49],\n\t\tbgGreenBright: [102, 49],\n\t\tbgYellowBright: [103, 49],\n\t\tbgBlueBright: [104, 49],\n\t\tbgMagentaBright: [105, 49],\n\t\tbgCyanBright: [106, 49],\n\t\tbgWhiteBright: [107, 49],\n\t},\n};\n\nexport const modifierNames = Object.keys(styles.modifier);\nexport const foregroundColorNames = Object.keys(styles.color);\nexport const backgroundColorNames = Object.keys(styles.bgColor);\nexport const colorNames = [...foregroundColorNames, ...backgroundColorNames];\n\nfunction assembleStyles() {\n\tconst codes = new Map();\n\n\tfor (const [groupName, group] of Object.entries(styles)) {\n\t\tfor (const [styleName, style] of Object.entries(group)) {\n\t\t\tstyles[styleName] = {\n\t\t\t\topen: `\\u001B[${style[0]}m`,\n\t\t\t\tclose: `\\u001B[${style[1]}m`,\n\t\t\t};\n\n\t\t\tgroup[styleName] = styles[styleName];\n\n\t\t\tcodes.set(style[0], style[1]);\n\t\t}\n\n\t\tObject.defineProperty(styles, groupName, {\n\t\t\tvalue: group,\n\t\t\tenumerable: false,\n\t\t});\n\t}\n\n\tObject.defineProperty(styles, 'codes', {\n\t\tvalue: codes,\n\t\tenumerable: false,\n\t});\n\n\tstyles.color.close = '\\u001B[39m';\n\tstyles.bgColor.close = '\\u001B[49m';\n\n\tstyles.color.ansi = wrapAnsi16();\n\tstyles.color.ansi256 = wrapAnsi256();\n\tstyles.color.ansi16m = wrapAnsi16m();\n\tstyles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);\n\tstyles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);\n\tstyles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);\n\n\t// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js\n\tObject.defineProperties(styles, {\n\t\trgbToAnsi256: {\n\t\t\tvalue(red, green, blue) {\n\t\t\t\t// We use the extended greyscale palette here, with the exception of\n\t\t\t\t// black and white. normal palette only has 4 greyscale shades.\n\t\t\t\tif (red === green && green === blue) {\n\t\t\t\t\tif (red < 8) {\n\t\t\t\t\t\treturn 16;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (red > 248) {\n\t\t\t\t\t\treturn 231;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn Math.round(((red - 8) / 247) * 24) + 232;\n\t\t\t\t}\n\n\t\t\t\treturn 16\n\t\t\t\t\t+ (36 * Math.round(red / 255 * 5))\n\t\t\t\t\t+ (6 * Math.round(green / 255 * 5))\n\t\t\t\t\t+ Math.round(blue / 255 * 5);\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToRgb: {\n\t\t\tvalue(hex) {\n\t\t\t\tconst matches = /[a-f\\d]{6}|[a-f\\d]{3}/i.exec(hex.toString(16));\n\t\t\t\tif (!matches) {\n\t\t\t\t\treturn [0, 0, 0];\n\t\t\t\t}\n\n\t\t\t\tlet [colorString] = matches;\n\n\t\t\t\tif (colorString.length === 3) {\n\t\t\t\t\tcolorString = [...colorString].map(character => character + character).join('');\n\t\t\t\t}\n\n\t\t\t\tconst integer = Number.parseInt(colorString, 16);\n\n\t\t\t\treturn [\n\t\t\t\t\t/* eslint-disable no-bitwise */\n\t\t\t\t\t(integer >> 16) & 0xFF,\n\t\t\t\t\t(integer >> 8) & 0xFF,\n\t\t\t\t\tinteger & 0xFF,\n\t\t\t\t\t/* eslint-enable no-bitwise */\n\t\t\t\t];\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToAnsi256: {\n\t\t\tvalue: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),\n\t\t\tenumerable: false,\n\t\t},\n\t\tansi256ToAnsi: {\n\t\t\tvalue(code) {\n\t\t\t\tif (code < 8) {\n\t\t\t\t\treturn 30 + code;\n\t\t\t\t}\n\n\t\t\t\tif (code < 16) {\n\t\t\t\t\treturn 90 + (code - 8);\n\t\t\t\t}\n\n\t\t\t\tlet red;\n\t\t\t\tlet green;\n\t\t\t\tlet blue;\n\n\t\t\t\tif (code >= 232) {\n\t\t\t\t\tred = (((code - 232) * 10) + 8) / 255;\n\t\t\t\t\tgreen = red;\n\t\t\t\t\tblue = red;\n\t\t\t\t} else {\n\t\t\t\t\tcode -= 16;\n\n\t\t\t\t\tconst remainder = code % 36;\n\n\t\t\t\t\tred = Math.floor(code / 36) / 5;\n\t\t\t\t\tgreen = Math.floor(remainder / 6) / 5;\n\t\t\t\t\tblue = (remainder % 6) / 5;\n\t\t\t\t}\n\n\t\t\t\tconst value = Math.max(red, green, blue) * 2;\n\n\t\t\t\tif (value === 0) {\n\t\t\t\t\treturn 30;\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tlet result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));\n\n\t\t\t\tif (value === 2) {\n\t\t\t\t\tresult += 60;\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\trgbToAnsi: {\n\t\t\tvalue: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToAnsi: {\n\t\t\tvalue: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),\n\t\t\tenumerable: false,\n\t\t},\n\t});\n\n\treturn styles;\n}\n\nconst ansiStyles = assembleStyles();\n\nexport default ansiStyles;\n","import process from 'node:process';\nimport os from 'node:os';\nimport tty from 'node:tty';\n\n// From: https://github.com/sindresorhus/has-flag/blob/main/index.js\n/// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {\nfunction hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) {\n\tconst prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');\n\tconst position = argv.indexOf(prefix + flag);\n\tconst terminatorPosition = argv.indexOf('--');\n\treturn position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);\n}\n\nconst {env} = process;\n\nlet flagForceColor;\nif (\n\thasFlag('no-color')\n\t|| hasFlag('no-colors')\n\t|| hasFlag('color=false')\n\t|| hasFlag('color=never')\n) {\n\tflagForceColor = 0;\n} else if (\n\thasFlag('color')\n\t|| hasFlag('colors')\n\t|| hasFlag('color=true')\n\t|| hasFlag('color=always')\n) {\n\tflagForceColor = 1;\n}\n\nfunction envForceColor() {\n\tif ('FORCE_COLOR' in env) {\n\t\tif (env.FORCE_COLOR === 'true') {\n\t\t\treturn 1;\n\t\t}\n\n\t\tif (env.FORCE_COLOR === 'false') {\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);\n\t}\n}\n\nfunction translateLevel(level) {\n\tif (level === 0) {\n\t\treturn false;\n\t}\n\n\treturn {\n\t\tlevel,\n\t\thasBasic: true,\n\t\thas256: level >= 2,\n\t\thas16m: level >= 3,\n\t};\n}\n\nfunction _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {\n\tconst noFlagForceColor = envForceColor();\n\tif (noFlagForceColor !== undefined) {\n\t\tflagForceColor = noFlagForceColor;\n\t}\n\n\tconst forceColor = sniffFlags ? flagForceColor : noFlagForceColor;\n\n\tif (forceColor === 0) {\n\t\treturn 0;\n\t}\n\n\tif (sniffFlags) {\n\t\tif (hasFlag('color=16m')\n\t\t\t|| hasFlag('color=full')\n\t\t\t|| hasFlag('color=truecolor')) {\n\t\t\treturn 3;\n\t\t}\n\n\t\tif (hasFlag('color=256')) {\n\t\t\treturn 2;\n\t\t}\n\t}\n\n\t// Check for Azure DevOps pipelines.\n\t// Has to be above the `!streamIsTTY` check.\n\tif ('TF_BUILD' in env && 'AGENT_NAME' in env) {\n\t\treturn 1;\n\t}\n\n\tif (haveStream && !streamIsTTY && forceColor === undefined) {\n\t\treturn 0;\n\t}\n\n\tconst min = forceColor || 0;\n\n\tif (env.TERM === 'dumb') {\n\t\treturn min;\n\t}\n\n\tif (process.platform === 'win32') {\n\t\t// Windows 10 build 10586 is the first Windows release that supports 256 colors.\n\t\t// Windows 10 build 14931 is the first release that supports 16m/TrueColor.\n\t\tconst osRelease = os.release().split('.');\n\t\tif (\n\t\t\tNumber(osRelease[0]) >= 10\n\t\t\t&& Number(osRelease[2]) >= 10_586\n\t\t) {\n\t\t\treturn Number(osRelease[2]) >= 14_931 ? 3 : 2;\n\t\t}\n\n\t\treturn 1;\n\t}\n\n\tif ('CI' in env) {\n\t\tif ('GITHUB_ACTIONS' in env || 'GITEA_ACTIONS' in env) {\n\t\t\treturn 3;\n\t\t}\n\n\t\tif (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn min;\n\t}\n\n\tif ('TEAMCITY_VERSION' in env) {\n\t\treturn /^(9\\.(0*[1-9]\\d*)\\.|\\d{2,}\\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;\n\t}\n\n\tif (env.COLORTERM === 'truecolor') {\n\t\treturn 3;\n\t}\n\n\tif (env.TERM === 'xterm-kitty') {\n\t\treturn 3;\n\t}\n\n\tif ('TERM_PROGRAM' in env) {\n\t\tconst version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);\n\n\t\tswitch (env.TERM_PROGRAM) {\n\t\t\tcase 'iTerm.app': {\n\t\t\t\treturn version >= 3 ? 3 : 2;\n\t\t\t}\n\n\t\t\tcase 'Apple_Terminal': {\n\t\t\t\treturn 2;\n\t\t\t}\n\t\t\t// No default\n\t\t}\n\t}\n\n\tif (/-256(color)?$/i.test(env.TERM)) {\n\t\treturn 2;\n\t}\n\n\tif (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {\n\t\treturn 1;\n\t}\n\n\tif ('COLORTERM' in env) {\n\t\treturn 1;\n\t}\n\n\treturn min;\n}\n\nexport function createSupportsColor(stream, options = {}) {\n\tconst level = _supportsColor(stream, {\n\t\tstreamIsTTY: stream && stream.isTTY,\n\t\t...options,\n\t});\n\n\treturn translateLevel(level);\n}\n\nconst supportsColor = {\n\tstdout: createSupportsColor({isTTY: tty.isatty(1)}),\n\tstderr: createSupportsColor({isTTY: tty.isatty(2)}),\n};\n\nexport default supportsColor;\n","// TODO: When targeting Node.js 16, use `String.prototype.replaceAll`.\nexport function stringReplaceAll(string, substring, replacer) {\n\tlet index = string.indexOf(substring);\n\tif (index === -1) {\n\t\treturn string;\n\t}\n\n\tconst substringLength = substring.length;\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\treturnValue += string.slice(endIndex, index) + substring + replacer;\n\t\tendIndex = index + substringLength;\n\t\tindex = string.indexOf(substring, endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.slice(endIndex);\n\treturn returnValue;\n}\n\nexport function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\tconst gotCR = string[index - 1] === '\\r';\n\t\treturnValue += string.slice(endIndex, (gotCR ? index - 1 : index)) + prefix + (gotCR ? '\\r\\n' : '\\n') + postfix;\n\t\tendIndex = index + 1;\n\t\tindex = string.indexOf('\\n', endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.slice(endIndex);\n\treturn returnValue;\n}\n","import ansiStyles from '#ansi-styles';\nimport supportsColor from '#supports-color';\nimport { // eslint-disable-line import/order\n\tstringReplaceAll,\n\tstringEncaseCRLFWithFirstIndex,\n} from './utilities.js';\n\nconst {stdout: stdoutColor, stderr: stderrColor} = supportsColor;\n\nconst GENERATOR = Symbol('GENERATOR');\nconst STYLER = Symbol('STYLER');\nconst IS_EMPTY = Symbol('IS_EMPTY');\n\n// `supportsColor.level` → `ansiStyles.color[name]` mapping\nconst levelMapping = [\n\t'ansi',\n\t'ansi',\n\t'ansi256',\n\t'ansi16m',\n];\n\nconst styles = Object.create(null);\n\nconst applyOptions = (object, options = {}) => {\n\tif (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {\n\t\tthrow new Error('The `level` option should be an integer from 0 to 3');\n\t}\n\n\t// Detect level if not set manually\n\tconst colorLevel = stdoutColor ? stdoutColor.level : 0;\n\tobject.level = options.level === undefined ? colorLevel : options.level;\n};\n\nexport class Chalk {\n\tconstructor(options) {\n\t\t// eslint-disable-next-line no-constructor-return\n\t\treturn chalkFactory(options);\n\t}\n}\n\nconst chalkFactory = options => {\n\tconst chalk = (...strings) => strings.join(' ');\n\tapplyOptions(chalk, options);\n\n\tObject.setPrototypeOf(chalk, createChalk.prototype);\n\n\treturn chalk;\n};\n\nfunction createChalk(options) {\n\treturn chalkFactory(options);\n}\n\nObject.setPrototypeOf(createChalk.prototype, Function.prototype);\n\nfor (const [styleName, style] of Object.entries(ansiStyles)) {\n\tstyles[styleName] = {\n\t\tget() {\n\t\t\tconst builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);\n\t\t\tObject.defineProperty(this, styleName, {value: builder});\n\t\t\treturn builder;\n\t\t},\n\t};\n}\n\nstyles.visible = {\n\tget() {\n\t\tconst builder = createBuilder(this, this[STYLER], true);\n\t\tObject.defineProperty(this, 'visible', {value: builder});\n\t\treturn builder;\n\t},\n};\n\nconst getModelAnsi = (model, level, type, ...arguments_) => {\n\tif (model === 'rgb') {\n\t\tif (level === 'ansi16m') {\n\t\t\treturn ansiStyles[type].ansi16m(...arguments_);\n\t\t}\n\n\t\tif (level === 'ansi256') {\n\t\t\treturn ansiStyles[type].ansi256(ansiStyles.rgbToAnsi256(...arguments_));\n\t\t}\n\n\t\treturn ansiStyles[type].ansi(ansiStyles.rgbToAnsi(...arguments_));\n\t}\n\n\tif (model === 'hex') {\n\t\treturn getModelAnsi('rgb', level, type, ...ansiStyles.hexToRgb(...arguments_));\n\t}\n\n\treturn ansiStyles[type][model](...arguments_);\n};\n\nconst usedModels = ['rgb', 'hex', 'ansi256'];\n\nfor (const model of usedModels) {\n\tstyles[model] = {\n\t\tget() {\n\t\t\tconst {level} = this;\n\t\t\treturn function (...arguments_) {\n\t\t\t\tconst styler = createStyler(getModelAnsi(model, levelMapping[level], 'color', ...arguments_), ansiStyles.color.close, this[STYLER]);\n\t\t\t\treturn createBuilder(this, styler, this[IS_EMPTY]);\n\t\t\t};\n\t\t},\n\t};\n\n\tconst bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);\n\tstyles[bgModel] = {\n\t\tget() {\n\t\t\tconst {level} = this;\n\t\t\treturn function (...arguments_) {\n\t\t\t\tconst styler = createStyler(getModelAnsi(model, levelMapping[level], 'bgColor', ...arguments_), ansiStyles.bgColor.close, this[STYLER]);\n\t\t\t\treturn createBuilder(this, styler, this[IS_EMPTY]);\n\t\t\t};\n\t\t},\n\t};\n}\n\nconst proto = Object.defineProperties(() => {}, {\n\t...styles,\n\tlevel: {\n\t\tenumerable: true,\n\t\tget() {\n\t\t\treturn this[GENERATOR].level;\n\t\t},\n\t\tset(level) {\n\t\t\tthis[GENERATOR].level = level;\n\t\t},\n\t},\n});\n\nconst createStyler = (open, close, parent) => {\n\tlet openAll;\n\tlet closeAll;\n\tif (parent === undefined) {\n\t\topenAll = open;\n\t\tcloseAll = close;\n\t} else {\n\t\topenAll = parent.openAll + open;\n\t\tcloseAll = close + parent.closeAll;\n\t}\n\n\treturn {\n\t\topen,\n\t\tclose,\n\t\topenAll,\n\t\tcloseAll,\n\t\tparent,\n\t};\n};\n\nconst createBuilder = (self, _styler, _isEmpty) => {\n\t// Single argument is hot path, implicit coercion is faster than anything\n\t// eslint-disable-next-line no-implicit-coercion\n\tconst builder = (...arguments_) => applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));\n\n\t// We alter the prototype because we must return a function, but there is\n\t// no way to create a function with a different prototype\n\tObject.setPrototypeOf(builder, proto);\n\n\tbuilder[GENERATOR] = self;\n\tbuilder[STYLER] = _styler;\n\tbuilder[IS_EMPTY] = _isEmpty;\n\n\treturn builder;\n};\n\nconst applyStyle = (self, string) => {\n\tif (self.level <= 0 || !string) {\n\t\treturn self[IS_EMPTY] ? '' : string;\n\t}\n\n\tlet styler = self[STYLER];\n\n\tif (styler === undefined) {\n\t\treturn string;\n\t}\n\n\tconst {openAll, closeAll} = styler;\n\tif (string.includes('\\u001B')) {\n\t\twhile (styler !== undefined) {\n\t\t\t// Replace any instances already present with a re-opening code\n\t\t\t// otherwise only the part of the string until said closing code\n\t\t\t// will be colored, and the rest will simply be 'plain'.\n\t\t\tstring = stringReplaceAll(string, styler.close, styler.open);\n\n\t\t\tstyler = styler.parent;\n\t\t}\n\t}\n\n\t// We can move both next actions out of loop, because remaining actions in loop won't have\n\t// any/visible effect on parts we add here. Close the styling before a linebreak and reopen\n\t// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92\n\tconst lfIndex = string.indexOf('\\n');\n\tif (lfIndex !== -1) {\n\t\tstring = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);\n\t}\n\n\treturn openAll + string + closeAll;\n};\n\nObject.defineProperties(createChalk.prototype, styles);\n\nconst chalk = createChalk();\nexport const chalkStderr = createChalk({level: stderrColor ? stderrColor.level : 0});\n\nexport {\n\tmodifierNames,\n\tforegroundColorNames,\n\tbackgroundColorNames,\n\tcolorNames,\n\n\t// TODO: Remove these aliases in the next major version\n\tmodifierNames as modifiers,\n\tforegroundColorNames as foregroundColors,\n\tbackgroundColorNames as backgroundColors,\n\tcolorNames as colors,\n} from './vendor/ansi-styles/index.js';\n\nexport {\n\tstdoutColor as supportsColor,\n\tstderrColor as supportsColorStderr,\n};\n\nexport default chalk;\n","type TODO = any;\n\n// In the absence of a WeakSet or WeakMap implementation, don't break, but don't cache either.\nfunction noop(...args: Array<any>) {}\nfunction createWeakMap<K extends object, V>(): MyWeakMap<K, V> {\n if (typeof WeakMap !== \"undefined\") {\n return new WeakMap<K, V>();\n } else {\n return fakeSetOrMap<K, V>();\n }\n}\n\ntype MyWeakMap<K extends object, V> = Pick<\n WeakMap<K, V>,\n \"delete\" | \"get\" | \"set\" | \"has\"\n>;\ntype MyWeakSetMap<K extends object, V> =\n & Pick<WeakMap<K, V>, \"delete\" | \"get\" | \"set\" | \"has\">\n & Pick<WeakSet<K>, \"add\">;\n\n/**\n * Creates and returns a no-op implementation of a WeakMap / WeakSet that never stores anything.\n */\nfunction fakeSetOrMap<K extends object, V = any>(): MyWeakSetMap<K, V> {\n return {\n add: noop as WeakSet<K>[\"add\"],\n delete: noop as WeakMap<K, V>[\"delete\"],\n get: noop as WeakMap<K, V>[\"get\"],\n set: noop as WeakMap<K, V>[\"set\"],\n has(k: K) {\n return false;\n },\n };\n}\n\n// Safe hasOwnProperty\nconst hop = Object.prototype.hasOwnProperty;\nconst has = function (obj: object, prop: string): boolean {\n return hop.call(obj, prop);\n};\n\n// Copy all own enumerable properties from source to target\nfunction extend<T, S extends object>(target: T, source: S) {\n type Extended = T & S;\n for (const prop in source) {\n if (has(source, prop)) {\n (target as any)[prop] = source[prop];\n }\n }\n return target as Extended;\n}\n\nconst reLeadingNewline = /^[ \\t]*(?:\\r\\n|\\r|\\n)/;\nconst reTrailingNewline = /(?:\\r\\n|\\r|\\n)[ \\t]*$/;\nconst reStartsWithNewlineOrIsEmpty = /^(?:[\\r\\n]|$)/;\nconst reDetectIndentation = /(?:\\r\\n|\\r|\\n)([ \\t]*)(?:[^ \\t\\r\\n]|$)/;\nconst reOnlyWhitespaceWithAtLeastOneNewline = /^[ \\t]*[\\r\\n][ \\t\\r\\n]*$/;\n\nfunction _outdentArray(\n strings: ReadonlyArray<string>,\n firstInterpolatedValueSetsIndentationLevel: boolean,\n options: Options,\n) {\n // If first interpolated value is a reference to outdent,\n // determine indentation level from the indentation of the interpolated value.\n let indentationLevel = 0;\n\n const match = strings[0].match(reDetectIndentation);\n if (match) {\n indentationLevel = match[1].length;\n }\n\n const reSource = `(\\\\r\\\\n|\\\\r|\\\\n).{0,${indentationLevel}}`;\n const reMatchIndent = new RegExp(reSource, \"g\");\n\n if (firstInterpolatedValueSetsIndentationLevel) {\n strings = strings.slice(1);\n }\n\n const { newline, trimLeadingNewline, trimTrailingNewline } = options;\n const normalizeNewlines = typeof newline === \"string\";\n const l = strings.length;\n const outdentedStrings = strings.map((v, i) => {\n // Remove leading indentation from all lines\n v = v.replace(reMatchIndent, \"$1\");\n // Trim a leading newline from the first string\n if (i === 0 && trimLeadingNewline) {\n v = v.replace(reLeadingNewline, \"\");\n }\n // Trim a trailing newline from the last string\n if (i === l - 1 && trimTrailingNewline) {\n v = v.replace(reTrailingNewline, \"\");\n }\n // Normalize newlines\n if (normalizeNewlines) {\n v = v.replace(/\\r\\n|\\n|\\r/g, (_) => newline as string);\n }\n return v;\n });\n return outdentedStrings;\n}\n\nfunction concatStringsAndValues(\n strings: ReadonlyArray<string>,\n values: ReadonlyArray<any>,\n): string {\n let ret = \"\";\n for (let i = 0, l = strings.length; i < l; i++) {\n ret += strings[i];\n if (i < l - 1) {\n ret += values[i];\n }\n }\n return ret;\n}\n\nfunction isTemplateStringsArray(v: any): v is TemplateStringsArray {\n return has(v, \"raw\") && has(v, \"length\");\n}\n\n/**\n * It is assumed that opts will not change. If this is a problem, clone your options object and pass the clone to\n * makeInstance\n * @param options\n * @return {outdent}\n */\nfunction createInstance(options: Options): Outdent {\n /** Cache of pre-processed template literal arrays */\n const arrayAutoIndentCache = createWeakMap<\n TemplateStringsArray,\n Array<string>\n >();\n /**\n * Cache of pre-processed template literal arrays, where first interpolated value is a reference to outdent,\n * before interpolated values are injected.\n */\n const arrayFirstInterpSetsIndentCache = createWeakMap<\n TemplateStringsArray,\n Array<string>\n >();\n\n /* tslint:disable:no-shadowed-variable */\n function outdent(\n stringsOrOptions: TemplateStringsArray,\n ...values: Array<any>\n ): string;\n function outdent(stringsOrOptions: Options): Outdent;\n function outdent(\n stringsOrOptions: TemplateStringsArray | Options,\n ...values: Array<any>\n ): string | Outdent {\n /* tslint:enable:no-shadowed-variable */\n if (isTemplateStringsArray(stringsOrOptions)) {\n const strings = stringsOrOptions;\n\n // Is first interpolated value a reference to outdent, alone on its own line, without any preceding non-whitespace?\n const firstInterpolatedValueSetsIndentationLevel =\n (values[0] === outdent || values[0] === defaultOutdent) &&\n reOnlyWhitespaceWithAtLeastOneNewline.test(strings[0]) &&\n reStartsWithNewlineOrIsEmpty.test(strings[1]);\n\n // Perform outdentation\n const cache = firstInterpolatedValueSetsIndentationLevel\n ? arrayFirstInterpSetsIndentCache\n : arrayAutoIndentCache;\n let renderedArray = cache.get(strings);\n if (!renderedArray) {\n renderedArray = _outdentArray(\n strings,\n firstInterpolatedValueSetsIndentationLevel,\n options,\n );\n cache.set(strings, renderedArray);\n }\n /** If no interpolated values, skip concatenation step */\n if (values.length === 0) {\n return renderedArray[0];\n }\n /** Concatenate string literals with interpolated values */\n const rendered = concatStringsAndValues(\n renderedArray,\n firstInterpolatedValueSetsIndentationLevel ? values.slice(1) : values,\n );\n\n return rendered;\n } else {\n // Create and return a new instance of outdent with the given options\n return createInstance(\n extend(extend({}, options), stringsOrOptions || {}),\n );\n }\n }\n\n const fullOutdent = extend(outdent, {\n string(str: string): string {\n return _outdentArray([str], false, options)[0];\n },\n });\n\n return fullOutdent;\n}\n\nconst defaultOutdent = createInstance({\n trimLeadingNewline: true,\n trimTrailingNewline: true,\n});\n\nexport interface Outdent {\n /**\n * Remove indentation from a template literal.\n */\n (strings: TemplateStringsArray, ...values: Array<any>): string;\n /**\n * Create and return a new Outdent instance with the given options.\n */\n (options: Options): Outdent;\n\n /**\n * Remove indentation from a string\n */\n string(str: string): string;\n\n // /**\n // * Remove indentation from a template literal, but return a tuple of the\n // * outdented TemplateStringsArray and\n // */\n // pass(strings: TemplateStringsArray, ...values: Array<any>): [TemplateStringsArray, ...Array<any>];\n}\nexport interface Options {\n trimLeadingNewline?: boolean;\n trimTrailingNewline?: boolean;\n /**\n * Normalize all newlines in the template literal to this value.\n * \n * If `null`, newlines are left untouched.\n * \n * Newlines that get normalized are '\\r\\n', '\\r', and '\\n'.\n * \n * Newlines within interpolated values are *never* normalized.\n * \n * Although intended for normalizing to '\\n' or '\\r\\n',\n * you can also set to any string; for example ' '.\n */\n newline?: string | null;\n}\n\n// Named exports. Simple and preferred.\n// import outdent from 'outdent';\nexport default defaultOutdent;\n// import {outdent} from 'outdent';\nexport { defaultOutdent as outdent };\n\n// In CommonJS environments, enable `var outdent = require('outdent');` by\n// replacing the exports object.\n// Make sure that our replacement includes the named exports from above.\ndeclare var module: any;\nif (typeof module !== \"undefined\") {\n // In webpack harmony-modules environments, module.exports is read-only,\n // so we fail gracefully.\n try {\n module.exports = defaultOutdent;\n Object.defineProperty(defaultOutdent, \"__esModule\", { value: true });\n (defaultOutdent as any).default = defaultOutdent;\n (defaultOutdent as any).outdent = defaultOutdent;\n } catch (e) {}\n}\n","// Dependencies\nimport { debounce } from 'perfect-debounce'\nimport { extract } from '@terai/extractor'\nimport { generate } from '@terai/generator'\nimport { loadConfig, runtime } from '@terai/runtime'\nimport { logger } from '@terai/logger'\nimport {\n convertExtractedMessagesToDictionary,\n stringify,\n groupDictionaryByChunks\n} from '@terai/utils'\n\n// Types\nimport type { CAC } from 'cac'\nimport type { BuildManifest } from '@terai/types'\n\nexport type ExtractOptions = {\n cwd: string\n force?: boolean\n watch?: boolean\n}\n\nexport function createExtractCommand(cli: CAC, cwd: string) {\n return cli\n .command('extract', 'Statically extract messages from your project')\n .option('-w, --watch', 'Watch files and rebuild')\n .option('--cwd <cwd>', 'Current working directory', { default: cwd })\n .action(extractCmd)\n}\n\nexport async function extractCmd(options: ExtractOptions) {\n logger.heading('extract', 'Statically extract messages from your project')\n\n const done = logger.time.success()\n\n const config = await loadConfig(options)\n const filesPaths = runtime.fs.glob({\n ...config,\n cwd: options.cwd\n })\n\n const outDirPath = runtime.path.resolve(options.cwd, config.outDir)\n const projectLocalePath = runtime.path.resolve(\n outDirPath,\n config.projectLocale\n )\n const manifestPath = runtime.path.resolve(\n outDirPath,\n '.terai',\n `locale-manifest.json`\n )\n\n logger.info('Scan:', `Processing files...`)\n\n async function extractor(files = filesPaths) {\n const extractedMessages = await extract({\n ...config,\n filesPaths: files,\n cwd: options.cwd\n })\n const dictionary = convertExtractedMessagesToDictionary(extractedMessages)\n const manifest: BuildManifest = {\n messages: extractedMessages\n }\n\n const dictionaries = groupDictionaryByChunks(\n dictionary,\n manifest,\n config.projectLocale\n )\n\n runtime.fs.remove(runtime.path.resolve(projectLocalePath))\n\n await generate({\n ...config,\n dictionaries,\n locale: config.projectLocale,\n cwd: options.cwd\n })\n\n runtime.fs.write(manifestPath, stringify(manifest))\n\n return Object.keys(dictionary).length\n }\n\n logger.info('Extraction:', 'Extracting messages...')\n\n const msgCount = await extractor()\n\n done(`Extracted ${msgCount} messages`)\n\n if (options.watch) {\n logger.log('')\n logger.info('Watch:', 'Watching files for changes...\\n')\n const configWatcher = runtime.fs.watch({\n ...config,\n ...options\n })\n\n configWatcher.on(\n 'change',\n debounce(async () => {\n const done = logger.time.success()\n logger.info('Extraction:', `Files changed, processing messages...`)\n\n const msgCount = await extractor()\n\n done(`Extracted ${msgCount} messages`)\n logger.log('')\n })\n )\n }\n}\n","// Dependencies\nimport { runtime } from '@terai/runtime'\nimport { stringify } from '@terai/utils'\n\n// Types\nimport type { Config, Locale, Dictionaries } from '@terai/types'\n\ntype GenerateOptions = {\n cwd: string\n locale: Locale\n dictionaries: Dictionaries\n} & Pick<Config, 'outDir'>\n\nexport async function generate({\n dictionaries,\n locale,\n cwd,\n outDir\n}: GenerateOptions) {\n const folderPath = runtime.path.resolve(cwd, outDir, locale)\n const output = []\n\n for (const id in dictionaries) {\n const fileDir = runtime.path.resolve(folderPath, id + '.json')\n const fileContent = dictionaries[id]\n const idOutput = stringify(fileContent)\n\n runtime.fs.write(fileDir, idOutput)\n\n output.push(idOutput)\n }\n\n return output\n}\n","// Dependencies\nimport { generate } from '@terai/generator'\nimport { loadConfig, runtime } from '@terai/runtime'\nimport { logger } from '@terai/logger'\nimport { translate } from '@terai/translator'\nimport { merge, stringify, groupDictionaryByChunks } from '@terai/utils'\n\n// Types\nimport type { CAC } from 'cac'\nimport type { Dictionary, BuildManifest } from '@terai/types'\n\nexport type TranslateOptions = {\n cwd: string\n}\n\nexport function createTranslateCommand(cli: CAC, cwd: string) {\n return cli\n .command('translate', 'Translate messages from your project')\n .option('--cwd <cwd>', 'Current working directory', { default: cwd })\n .action(translateCmd)\n}\n\nexport async function translateCmd({ cwd }: TranslateOptions) {\n logger.heading('translate', 'Translate messages from your project')\n const done = logger.time.success()\n\n const config = await loadConfig({ cwd })\n\n const outDirPath = runtime.path.resolve(cwd, config.outDir)\n const tmuDirPath = runtime.path.resolve(cwd, config.outDir, '.terai')\n const manifestPath = runtime.path.resolve(tmuDirPath, 'locale-manifest.json')\n const existsManifest = runtime.fs.exists(manifestPath)\n if (!existsManifest) {\n return logger.error(\n 'translate',\n `No locale-manifest.json found in ${tmuDirPath}. Please run \"extract\" first.`\n )\n }\n\n const buildManifest = JSON.parse(\n runtime.fs.readFile(manifestPath)\n ) as BuildManifest\n\n let totalTranslatedMsgs = 0\n let totalCachedMsgs = 0\n\n await Promise.all(\n config.outLocales.map(async locale => {\n try {\n let translatedDictionary: Dictionary = {}\n const untranslatedDictionary: Dictionary = {}\n const localeDirPath = runtime.path.resolve(outDirPath, locale)\n const localeCachePath = runtime.path.resolve(\n tmuDirPath,\n 'cache',\n `${locale}.cache.json`\n )\n const cacheExists = runtime.fs.exists(localeCachePath)\n let cache: Dictionary = cacheExists\n ? JSON.parse(runtime.fs.readFile(localeCachePath))\n : {}\n\n let localeCachedMsgs = 0\n let localeTranslatedMsgs = 0\n\n for (const id in buildManifest.messages) {\n const { value, chunksIds } = buildManifest.messages[id]\n const chnks = chunksIds.length ? chunksIds : [locale]\n\n for (const chunkId of chnks) {\n const chunkPath = runtime.path.resolve(\n localeDirPath,\n `${chunkId}.json`\n )\n const existsChunk = runtime.fs.exists(chunkPath)\n const chunk: Dictionary = existsChunk\n ? JSON.parse(runtime.fs.readFile(chunkPath))\n : {}\n const localeValue = chunk[id] ?? cache[id]\n\n if (!localeValue) {\n untranslatedDictionary[id] = value\n localeTranslatedMsgs++\n } else {\n translatedDictionary[id] = localeValue\n // Update cache in case local value is different\n cache[id] = localeValue\n localeCachedMsgs++\n }\n }\n }\n\n if (localeTranslatedMsgs > 0) {\n const translation = await translate({\n ...config,\n dictionary: untranslatedDictionary,\n locale\n })\n\n translatedDictionary = merge(translation, translatedDictionary)\n }\n\n cache = {\n ...cache,\n ...translatedDictionary\n }\n\n runtime.fs.remove(localeDirPath)\n\n const dictionaries = groupDictionaryByChunks(\n translatedDictionary,\n buildManifest,\n locale\n )\n\n await generate({\n ...config,\n dictionaries: dictionaries,\n locale,\n cwd\n })\n\n runtime.fs.write(localeCachePath, stringify(cache))\n\n totalTranslatedMsgs += localeTranslatedMsgs\n totalCachedMsgs += localeCachedMsgs\n\n logger.info(\n `Locale ${locale.toUpperCase()}:`,\n `${localeTranslatedMsgs} new messages translated, ${localeCachedMsgs} recovered from cache`\n )\n } catch (err) {\n if (err instanceof Error) {\n logger.error(\n `${locale} translation:`,\n `Error translating to ${locale}: ${err.message}\\n`\n )\n }\n }\n })\n )\n\n if (!totalTranslatedMsgs) {\n return done('Everything up-to-date')\n }\n\n done(\n `Translated ${totalTranslatedMsgs} messages, ${totalCachedMsgs} read from cache`\n )\n}\n"],"mappings":"ykBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,0BAAAE,GAAA,sBAAAC,GAAA,2BAAAC,GAAA,eAAAC,GAAA,YAAAC,GAAA,iBAAAC,KAAA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AAM,UAAQ,GAAG,SAASA,EAAS,CAAC,EACzC,CAAC,GACqBL,CAAE,GAAKH,EAAMG,CAAE,EAEpCM,GAIHb,EAAqBO,CAAE,EAAIM,EAE3BT,EAAMG,CAAE,EAAIM,EACZR,MANAJ,EAAuBM,CAAE,EAAIC,GAC7BF,IAOJ,CACF,CAEA,GAAIA,EAAuB,EAAG,CAC5B,IAAMQ,EAAc,QAAM,cAAU,CAClC,GAAGtB,EACH,WAAYS,EACZ,OAAAF,CACF,CAAC,EAEDC,KAAuB,SAAMc,EAAad,CAAoB,CAChE,CAEAI,EAAQ,CACN,GAAGA,EACH,GAAGJ,CACL,EAEA,UAAQ,GAAG,OAAOE,CAAa,EAE/B,IAAMa,MAAe,2BACnBf,EACAJ,EACAG,CACF,EAEA,MAAMiB,EAAS,CACb,GAAGxB,EACH,aAAcuB,GACd,OAAAhB,EACA,IAAAX,CACF,CAAC,EAED,UAAQ,GAAG,MAAMe,KAAiB,aAAUC,CAAK,CAAC,EAElDP,GAAuBS,EACvBR,GAAmBO,EAEnBf,EAAO,KACL,UAAUS,EAAO,YAAY,CAAC,IAC9B,GAAGO,CAAoB,6BAA6BD,CAAgB,uBACtE,CACF,OAASY,EAAK,CACRA,aAAe,OACjB3B,EAAO,MACL,GAAGS,CAAM,gBACT,wBAAwBA,CAAM,KAAKkB,EAAI,OAAO;AAAA,CAChD,CAEJ,CACF,CAAC,CACH,EAEI,CAACpB,EACH,OAAON,EAAK,uBAAuB,EAGrCA,EACE,cAAcM,CAAmB,cAAcC,CAAe,kBAChE,CACF","names":["commands_exports","__export","createExtractCommand","createInitCommand","createTranslateCommand","extractCmd","initCmd","translateCmd","__toCommonJS","import_runtime","import_prompts","import_node_process","import_node_os","import_node_tty","wrapAnsi16","offset","code","wrapAnsi256","wrapAnsi16m","red","green","blue","styles","modifierNames","foregroundColorNames","backgroundColorNames","colorNames","assembleStyles","codes","groupName","group","styleName","style","hex","matches","colorString","character","integer","remainder","value","result","ansiStyles","ansi_styles_default","hasFlag","flag","argv","process","prefix","position","terminatorPosition","env","flagForceColor","envForceColor","translateLevel","level","_supportsColor","haveStream","streamIsTTY","sniffFlags","noFlagForceColor","forceColor","min","osRelease","os","sign","version","createSupportsColor","stream","options","supportsColor","tty","supports_color_default","stringReplaceAll","string","substring","replacer","index","substringLength","endIndex","returnValue","stringEncaseCRLFWithFirstIndex","postfix","gotCR","stdoutColor","stderrColor","GENERATOR","STYLER","IS_EMPTY","levelMapping","applyOptions","object","colorLevel","chalkFactory","chalk","strings","createChalk","builder","createBuilder","createStyler","getModelAnsi","model","type","arguments_","usedModels","styler","bgModel","proto","open","close","parent","openAll","closeAll","self","_styler","_isEmpty","applyStyle","lfIndex","chalkStderr","source_default","log","message","logError","logBullet","logger","colorizePrefix","colorizeText","symbol","text","formattedText","textPart","warn","debug","info","success","error","heading","description","timing","fn","start","msg","ms","noop","args","_i","createWeakMap","fakeSetOrMap","k","hop","has","obj","prop","extend","target","source","reLeadingNewline","reTrailingNewline","reStartsWithNewlineOrIsEmpty","reDetectIndentation","reOnlyWhitespaceWithAtLeastOneNewline","_outdentArray","strings","firstInterpolatedValueSetsIndentationLevel","options","indentationLevel","match","reSource","reMatchIndent","newline","trimLeadingNewline","trimTrailingNewline","normalizeNewlines","l","outdentedStrings","i","_","concatStringsAndValues","values","ret","isTemplateStringsArray","v","createInstance","arrayAutoIndentCache","arrayFirstInterpSetsIndentCache","outdent","stringsOrOptions","defaultOutdent","cache","renderedArray","rendered","fullOutdent","str","defaultOutdent","import_preferred_pm","createInitCommand","cli","cwd","initCmd","force","ve","configFile","pm","getPackageManager","cmd","defaultOutdent","projectLocale","outDir","framework","done","import_perfect_debounce","import_extractor","import_runtime","import_utils","generate","dictionaries","locale","cwd","outDir","folderPath","runtime","output","id","fileDir","fileContent","idOutput","stringify","import_runtime","import_utils","createExtractCommand","cli","cwd","extractCmd","options","ve","done","config","filesPaths","outDirPath","projectLocalePath","manifestPath","extractor","files","extractedMessages","dictionary","manifest","dictionaries","d","msgCount","import_runtime","import_translator","import_utils","createTranslateCommand","cli","cwd","translateCmd","ve","done","config","outDirPath","tmuDirPath","manifestPath","buildManifest","totalTranslatedMsgs","totalCachedMsgs","locale","translatedDictionary","untranslatedDictionary","localeDirPath","localeCachePath","cache","localeCachedMsgs","localeTranslatedMsgs","id","value","chunksIds","chnks","chunkId","chunkPath","localeValue","translation","dictionaries","d","err"]}
1
+ {"version":3,"sources":["../../src/commands/index.ts","../../src/commands/init.ts","../../../logger/src/logger.ts","../../../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js","../../../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js","../../../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js","../../../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js","../../../../node_modules/.pnpm/outdent@0.8.0/node_modules/outdent/src/index.ts","../../src/commands/extract.ts","../../../generator/src/generate.ts","../../src/commands/translate.ts"],"sourcesContent":["export * from './init'\nexport * from './extract'\nexport * from './translate'\n","// Dependencies\nimport { findConfig, setupConfig, setupTemplate } from '@terai/runtime'\nimport { input, select } from '@inquirer/prompts'\nimport { logger } from '@terai/logger'\nimport { outdent } from 'outdent'\nimport getPackageManager from 'preferred-pm'\n\n// Types\nimport type { Config, Locale } from '@terai/types'\nimport type { CAC } from 'cac'\n\nexport type InitOptions = Pick<Config, 'projectLocale'> & {\n\tcwd: string\n\tforce?: boolean\n}\n\nexport function createInitCommand(cli: CAC, cwd: string) {\n\treturn cli\n\t\t.command('init', 'Initialize config file')\n\t\t.option('-f, --force', 'Force overwrite existing config files')\n\t\t.option('--cwd <cwd>', 'Current working directory', { default: cwd })\n\t\t.action(initCmd)\n}\n\nexport async function initCmd({ cwd, force }: InitOptions) {\n\tlogger.heading('init', 'Initialize config file')\n\tconst configFile = findConfig({ cwd })\n\tconst pmResult = await getPackageManager(cwd)\n\tconst pm = pmResult?.name ?? 'npm'\n\tconst cmd = pm === 'npm' ? 'npm run' : pm\n\n\tif (configFile && !force) {\n\t\treturn logger.log(\n\t\t\toutdent`\n It looks like you already have terai created.\n You can now run ${logger.colors.cyan(`'${cmd} terai extract --watch'`)}\n `\n\t\t)\n\t}\n\n\tconst projectLocale = (await input({\n\t\tmessage: 'What locale do you use for development?',\n\t\tdefault: 'en'\n\t})) as Locale\n\n\tconst outDir = await input({\n\t\tmessage: 'Where do you want to place your generated files?',\n\t\tdefault: './locale-system'\n\t})\n\n\tconst framework = (await select({\n\t\tmessage: 'Would you like to use any of these templates? (recommended)',\n\t\tchoices: [\n\t\t\t{\n\t\t\t\tname: 'No',\n\t\t\t\tvalue: null\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Next',\n\t\t\t\tvalue: 'next'\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Vite',\n\t\t\t\tvalue: 'vite'\n\t\t\t}\n\t\t]\n\t})) as 'next' | 'vite'\n\n\tconst done = logger.time.success()\n\n\tawait setupConfig({ cwd, projectLocale, outDir })\n\n\tif (framework) {\n\t\tawait setupTemplate({ cwd, outDir, framework })\n\t}\n\n\tdone('Config file created')\n\n\tlogger.log('🚀 You are set up to start using Terai! Thanks for choosing it.')\n}\n","// Dependencies\nimport process from 'node:process'\nimport chalk from 'chalk'\n\nfunction log(message: string) {\n\treturn process.stdout.write(`${message}\\n`)\n}\n\nfunction logError(message: string) {\n\treturn process.stderr.write(`${message}\\n`)\n}\n\nfunction logBullet(\n\tlogger: typeof log | typeof logError,\n\tcolorizePrefix: typeof chalk,\n\tcolorizeText: typeof chalk,\n\tsymbol: string,\n\tprefix: string,\n\ttext?: string | string[]\n) {\n\tconst textParts = Array.isArray(text) ? text : [text || ''].filter(Boolean)\n\tconst formattedText = textParts\n\t\t.map((textPart) => colorizeText(textPart))\n\t\t.join('')\n\n\tlogger(\n\t\t`${' '.repeat(3)} ${colorizePrefix(symbol)} ${colorizePrefix(\n\t\t\tprefix\n\t\t)} ${formattedText}`\n\t)\n}\n\nfunction warn(prefix: string, text?: string | string[]) {\n\tlogBullet(log, chalk.yellow, chalk.yellow, '●', prefix, text)\n}\n\nfunction debug(prefix: string, text?: string | string[]) {\n\tlogBullet(log, chalk.yellow, chalk.dim, '●', prefix, text)\n}\n\nfunction info(prefix: string, text?: string | string[]) {\n\tlogBullet(log, chalk.cyan, chalk.dim, '◼', prefix, text)\n}\n\nfunction success(text: string) {\n\tlogBullet(log, chalk.green, chalk.dim, '✔', text)\n}\n\nfunction error(prefix: string, text?: string | string[]) {\n\tlog('')\n\tlogBullet(logError, chalk.red, chalk.red, '▲', prefix, text)\n}\n\nfunction heading(heading: string, description?: string) {\n\treturn log(\n\t\t`\\n${chalk.bgWhite(` ${chalk.whiteBright(heading)} `)} ${chalk.bold(\n\t\t\tdescription\n\t\t)}\\n`\n\t)\n}\n\nconst timing = (fn: (str: string) => any) => () => {\n\tconst start = performance.now()\n\treturn (msg: string) => {\n\t\tconst end = performance.now()\n\t\tconst ms = end - start\n\t\tfn(`${msg} ${chalk.gray(`(${ms.toFixed(2)}ms)`)}`)\n\t}\n}\n\nexport const logger = {\n\tcolors: chalk,\n\tlog,\n\theading,\n\tdebug,\n\tinfo,\n\twarn,\n\tsuccess,\n\terror,\n\ttime: {\n\t\tsuccess: timing(success),\n\t\tinfo: timing(info),\n\t\tdebug: timing(debug)\n\t}\n}\n","const ANSI_BACKGROUND_OFFSET = 10;\n\nconst wrapAnsi16 = (offset = 0) => code => `\\u001B[${code + offset}m`;\n\nconst wrapAnsi256 = (offset = 0) => code => `\\u001B[${38 + offset};5;${code}m`;\n\nconst wrapAnsi16m = (offset = 0) => (red, green, blue) => `\\u001B[${38 + offset};2;${red};${green};${blue}m`;\n\nconst styles = {\n\tmodifier: {\n\t\treset: [0, 0],\n\t\t// 21 isn't widely supported and 22 does the same thing\n\t\tbold: [1, 22],\n\t\tdim: [2, 22],\n\t\titalic: [3, 23],\n\t\tunderline: [4, 24],\n\t\toverline: [53, 55],\n\t\tinverse: [7, 27],\n\t\thidden: [8, 28],\n\t\tstrikethrough: [9, 29],\n\t},\n\tcolor: {\n\t\tblack: [30, 39],\n\t\tred: [31, 39],\n\t\tgreen: [32, 39],\n\t\tyellow: [33, 39],\n\t\tblue: [34, 39],\n\t\tmagenta: [35, 39],\n\t\tcyan: [36, 39],\n\t\twhite: [37, 39],\n\n\t\t// Bright color\n\t\tblackBright: [90, 39],\n\t\tgray: [90, 39], // Alias of `blackBright`\n\t\tgrey: [90, 39], // Alias of `blackBright`\n\t\tredBright: [91, 39],\n\t\tgreenBright: [92, 39],\n\t\tyellowBright: [93, 39],\n\t\tblueBright: [94, 39],\n\t\tmagentaBright: [95, 39],\n\t\tcyanBright: [96, 39],\n\t\twhiteBright: [97, 39],\n\t},\n\tbgColor: {\n\t\tbgBlack: [40, 49],\n\t\tbgRed: [41, 49],\n\t\tbgGreen: [42, 49],\n\t\tbgYellow: [43, 49],\n\t\tbgBlue: [44, 49],\n\t\tbgMagenta: [45, 49],\n\t\tbgCyan: [46, 49],\n\t\tbgWhite: [47, 49],\n\n\t\t// Bright color\n\t\tbgBlackBright: [100, 49],\n\t\tbgGray: [100, 49], // Alias of `bgBlackBright`\n\t\tbgGrey: [100, 49], // Alias of `bgBlackBright`\n\t\tbgRedBright: [101, 49],\n\t\tbgGreenBright: [102, 49],\n\t\tbgYellowBright: [103, 49],\n\t\tbgBlueBright: [104, 49],\n\t\tbgMagentaBright: [105, 49],\n\t\tbgCyanBright: [106, 49],\n\t\tbgWhiteBright: [107, 49],\n\t},\n};\n\nexport const modifierNames = Object.keys(styles.modifier);\nexport const foregroundColorNames = Object.keys(styles.color);\nexport const backgroundColorNames = Object.keys(styles.bgColor);\nexport const colorNames = [...foregroundColorNames, ...backgroundColorNames];\n\nfunction assembleStyles() {\n\tconst codes = new Map();\n\n\tfor (const [groupName, group] of Object.entries(styles)) {\n\t\tfor (const [styleName, style] of Object.entries(group)) {\n\t\t\tstyles[styleName] = {\n\t\t\t\topen: `\\u001B[${style[0]}m`,\n\t\t\t\tclose: `\\u001B[${style[1]}m`,\n\t\t\t};\n\n\t\t\tgroup[styleName] = styles[styleName];\n\n\t\t\tcodes.set(style[0], style[1]);\n\t\t}\n\n\t\tObject.defineProperty(styles, groupName, {\n\t\t\tvalue: group,\n\t\t\tenumerable: false,\n\t\t});\n\t}\n\n\tObject.defineProperty(styles, 'codes', {\n\t\tvalue: codes,\n\t\tenumerable: false,\n\t});\n\n\tstyles.color.close = '\\u001B[39m';\n\tstyles.bgColor.close = '\\u001B[49m';\n\n\tstyles.color.ansi = wrapAnsi16();\n\tstyles.color.ansi256 = wrapAnsi256();\n\tstyles.color.ansi16m = wrapAnsi16m();\n\tstyles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);\n\tstyles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);\n\tstyles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);\n\n\t// From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js\n\tObject.defineProperties(styles, {\n\t\trgbToAnsi256: {\n\t\t\tvalue(red, green, blue) {\n\t\t\t\t// We use the extended greyscale palette here, with the exception of\n\t\t\t\t// black and white. normal palette only has 4 greyscale shades.\n\t\t\t\tif (red === green && green === blue) {\n\t\t\t\t\tif (red < 8) {\n\t\t\t\t\t\treturn 16;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (red > 248) {\n\t\t\t\t\t\treturn 231;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn Math.round(((red - 8) / 247) * 24) + 232;\n\t\t\t\t}\n\n\t\t\t\treturn 16\n\t\t\t\t\t+ (36 * Math.round(red / 255 * 5))\n\t\t\t\t\t+ (6 * Math.round(green / 255 * 5))\n\t\t\t\t\t+ Math.round(blue / 255 * 5);\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToRgb: {\n\t\t\tvalue(hex) {\n\t\t\t\tconst matches = /[a-f\\d]{6}|[a-f\\d]{3}/i.exec(hex.toString(16));\n\t\t\t\tif (!matches) {\n\t\t\t\t\treturn [0, 0, 0];\n\t\t\t\t}\n\n\t\t\t\tlet [colorString] = matches;\n\n\t\t\t\tif (colorString.length === 3) {\n\t\t\t\t\tcolorString = [...colorString].map(character => character + character).join('');\n\t\t\t\t}\n\n\t\t\t\tconst integer = Number.parseInt(colorString, 16);\n\n\t\t\t\treturn [\n\t\t\t\t\t/* eslint-disable no-bitwise */\n\t\t\t\t\t(integer >> 16) & 0xFF,\n\t\t\t\t\t(integer >> 8) & 0xFF,\n\t\t\t\t\tinteger & 0xFF,\n\t\t\t\t\t/* eslint-enable no-bitwise */\n\t\t\t\t];\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToAnsi256: {\n\t\t\tvalue: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),\n\t\t\tenumerable: false,\n\t\t},\n\t\tansi256ToAnsi: {\n\t\t\tvalue(code) {\n\t\t\t\tif (code < 8) {\n\t\t\t\t\treturn 30 + code;\n\t\t\t\t}\n\n\t\t\t\tif (code < 16) {\n\t\t\t\t\treturn 90 + (code - 8);\n\t\t\t\t}\n\n\t\t\t\tlet red;\n\t\t\t\tlet green;\n\t\t\t\tlet blue;\n\n\t\t\t\tif (code >= 232) {\n\t\t\t\t\tred = (((code - 232) * 10) + 8) / 255;\n\t\t\t\t\tgreen = red;\n\t\t\t\t\tblue = red;\n\t\t\t\t} else {\n\t\t\t\t\tcode -= 16;\n\n\t\t\t\t\tconst remainder = code % 36;\n\n\t\t\t\t\tred = Math.floor(code / 36) / 5;\n\t\t\t\t\tgreen = Math.floor(remainder / 6) / 5;\n\t\t\t\t\tblue = (remainder % 6) / 5;\n\t\t\t\t}\n\n\t\t\t\tconst value = Math.max(red, green, blue) * 2;\n\n\t\t\t\tif (value === 0) {\n\t\t\t\t\treturn 30;\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tlet result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));\n\n\t\t\t\tif (value === 2) {\n\t\t\t\t\tresult += 60;\n\t\t\t\t}\n\n\t\t\t\treturn result;\n\t\t\t},\n\t\t\tenumerable: false,\n\t\t},\n\t\trgbToAnsi: {\n\t\t\tvalue: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),\n\t\t\tenumerable: false,\n\t\t},\n\t\thexToAnsi: {\n\t\t\tvalue: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),\n\t\t\tenumerable: false,\n\t\t},\n\t});\n\n\treturn styles;\n}\n\nconst ansiStyles = assembleStyles();\n\nexport default ansiStyles;\n","import process from 'node:process';\nimport os from 'node:os';\nimport tty from 'node:tty';\n\n// From: https://github.com/sindresorhus/has-flag/blob/main/index.js\n/// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {\nfunction hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) {\n\tconst prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');\n\tconst position = argv.indexOf(prefix + flag);\n\tconst terminatorPosition = argv.indexOf('--');\n\treturn position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);\n}\n\nconst {env} = process;\n\nlet flagForceColor;\nif (\n\thasFlag('no-color')\n\t|| hasFlag('no-colors')\n\t|| hasFlag('color=false')\n\t|| hasFlag('color=never')\n) {\n\tflagForceColor = 0;\n} else if (\n\thasFlag('color')\n\t|| hasFlag('colors')\n\t|| hasFlag('color=true')\n\t|| hasFlag('color=always')\n) {\n\tflagForceColor = 1;\n}\n\nfunction envForceColor() {\n\tif ('FORCE_COLOR' in env) {\n\t\tif (env.FORCE_COLOR === 'true') {\n\t\t\treturn 1;\n\t\t}\n\n\t\tif (env.FORCE_COLOR === 'false') {\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);\n\t}\n}\n\nfunction translateLevel(level) {\n\tif (level === 0) {\n\t\treturn false;\n\t}\n\n\treturn {\n\t\tlevel,\n\t\thasBasic: true,\n\t\thas256: level >= 2,\n\t\thas16m: level >= 3,\n\t};\n}\n\nfunction _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {\n\tconst noFlagForceColor = envForceColor();\n\tif (noFlagForceColor !== undefined) {\n\t\tflagForceColor = noFlagForceColor;\n\t}\n\n\tconst forceColor = sniffFlags ? flagForceColor : noFlagForceColor;\n\n\tif (forceColor === 0) {\n\t\treturn 0;\n\t}\n\n\tif (sniffFlags) {\n\t\tif (hasFlag('color=16m')\n\t\t\t|| hasFlag('color=full')\n\t\t\t|| hasFlag('color=truecolor')) {\n\t\t\treturn 3;\n\t\t}\n\n\t\tif (hasFlag('color=256')) {\n\t\t\treturn 2;\n\t\t}\n\t}\n\n\t// Check for Azure DevOps pipelines.\n\t// Has to be above the `!streamIsTTY` check.\n\tif ('TF_BUILD' in env && 'AGENT_NAME' in env) {\n\t\treturn 1;\n\t}\n\n\tif (haveStream && !streamIsTTY && forceColor === undefined) {\n\t\treturn 0;\n\t}\n\n\tconst min = forceColor || 0;\n\n\tif (env.TERM === 'dumb') {\n\t\treturn min;\n\t}\n\n\tif (process.platform === 'win32') {\n\t\t// Windows 10 build 10586 is the first Windows release that supports 256 colors.\n\t\t// Windows 10 build 14931 is the first release that supports 16m/TrueColor.\n\t\tconst osRelease = os.release().split('.');\n\t\tif (\n\t\t\tNumber(osRelease[0]) >= 10\n\t\t\t&& Number(osRelease[2]) >= 10_586\n\t\t) {\n\t\t\treturn Number(osRelease[2]) >= 14_931 ? 3 : 2;\n\t\t}\n\n\t\treturn 1;\n\t}\n\n\tif ('CI' in env) {\n\t\tif ('GITHUB_ACTIONS' in env || 'GITEA_ACTIONS' in env) {\n\t\t\treturn 3;\n\t\t}\n\n\t\tif (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn min;\n\t}\n\n\tif ('TEAMCITY_VERSION' in env) {\n\t\treturn /^(9\\.(0*[1-9]\\d*)\\.|\\d{2,}\\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;\n\t}\n\n\tif (env.COLORTERM === 'truecolor') {\n\t\treturn 3;\n\t}\n\n\tif (env.TERM === 'xterm-kitty') {\n\t\treturn 3;\n\t}\n\n\tif ('TERM_PROGRAM' in env) {\n\t\tconst version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);\n\n\t\tswitch (env.TERM_PROGRAM) {\n\t\t\tcase 'iTerm.app': {\n\t\t\t\treturn version >= 3 ? 3 : 2;\n\t\t\t}\n\n\t\t\tcase 'Apple_Terminal': {\n\t\t\t\treturn 2;\n\t\t\t}\n\t\t\t// No default\n\t\t}\n\t}\n\n\tif (/-256(color)?$/i.test(env.TERM)) {\n\t\treturn 2;\n\t}\n\n\tif (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {\n\t\treturn 1;\n\t}\n\n\tif ('COLORTERM' in env) {\n\t\treturn 1;\n\t}\n\n\treturn min;\n}\n\nexport function createSupportsColor(stream, options = {}) {\n\tconst level = _supportsColor(stream, {\n\t\tstreamIsTTY: stream && stream.isTTY,\n\t\t...options,\n\t});\n\n\treturn translateLevel(level);\n}\n\nconst supportsColor = {\n\tstdout: createSupportsColor({isTTY: tty.isatty(1)}),\n\tstderr: createSupportsColor({isTTY: tty.isatty(2)}),\n};\n\nexport default supportsColor;\n","// TODO: When targeting Node.js 16, use `String.prototype.replaceAll`.\nexport function stringReplaceAll(string, substring, replacer) {\n\tlet index = string.indexOf(substring);\n\tif (index === -1) {\n\t\treturn string;\n\t}\n\n\tconst substringLength = substring.length;\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\treturnValue += string.slice(endIndex, index) + substring + replacer;\n\t\tendIndex = index + substringLength;\n\t\tindex = string.indexOf(substring, endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.slice(endIndex);\n\treturn returnValue;\n}\n\nexport function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\tconst gotCR = string[index - 1] === '\\r';\n\t\treturnValue += string.slice(endIndex, (gotCR ? index - 1 : index)) + prefix + (gotCR ? '\\r\\n' : '\\n') + postfix;\n\t\tendIndex = index + 1;\n\t\tindex = string.indexOf('\\n', endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.slice(endIndex);\n\treturn returnValue;\n}\n","import ansiStyles from '#ansi-styles';\nimport supportsColor from '#supports-color';\nimport { // eslint-disable-line import/order\n\tstringReplaceAll,\n\tstringEncaseCRLFWithFirstIndex,\n} from './utilities.js';\n\nconst {stdout: stdoutColor, stderr: stderrColor} = supportsColor;\n\nconst GENERATOR = Symbol('GENERATOR');\nconst STYLER = Symbol('STYLER');\nconst IS_EMPTY = Symbol('IS_EMPTY');\n\n// `supportsColor.level` → `ansiStyles.color[name]` mapping\nconst levelMapping = [\n\t'ansi',\n\t'ansi',\n\t'ansi256',\n\t'ansi16m',\n];\n\nconst styles = Object.create(null);\n\nconst applyOptions = (object, options = {}) => {\n\tif (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {\n\t\tthrow new Error('The `level` option should be an integer from 0 to 3');\n\t}\n\n\t// Detect level if not set manually\n\tconst colorLevel = stdoutColor ? stdoutColor.level : 0;\n\tobject.level = options.level === undefined ? colorLevel : options.level;\n};\n\nexport class Chalk {\n\tconstructor(options) {\n\t\t// eslint-disable-next-line no-constructor-return\n\t\treturn chalkFactory(options);\n\t}\n}\n\nconst chalkFactory = options => {\n\tconst chalk = (...strings) => strings.join(' ');\n\tapplyOptions(chalk, options);\n\n\tObject.setPrototypeOf(chalk, createChalk.prototype);\n\n\treturn chalk;\n};\n\nfunction createChalk(options) {\n\treturn chalkFactory(options);\n}\n\nObject.setPrototypeOf(createChalk.prototype, Function.prototype);\n\nfor (const [styleName, style] of Object.entries(ansiStyles)) {\n\tstyles[styleName] = {\n\t\tget() {\n\t\t\tconst builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);\n\t\t\tObject.defineProperty(this, styleName, {value: builder});\n\t\t\treturn builder;\n\t\t},\n\t};\n}\n\nstyles.visible = {\n\tget() {\n\t\tconst builder = createBuilder(this, this[STYLER], true);\n\t\tObject.defineProperty(this, 'visible', {value: builder});\n\t\treturn builder;\n\t},\n};\n\nconst getModelAnsi = (model, level, type, ...arguments_) => {\n\tif (model === 'rgb') {\n\t\tif (level === 'ansi16m') {\n\t\t\treturn ansiStyles[type].ansi16m(...arguments_);\n\t\t}\n\n\t\tif (level === 'ansi256') {\n\t\t\treturn ansiStyles[type].ansi256(ansiStyles.rgbToAnsi256(...arguments_));\n\t\t}\n\n\t\treturn ansiStyles[type].ansi(ansiStyles.rgbToAnsi(...arguments_));\n\t}\n\n\tif (model === 'hex') {\n\t\treturn getModelAnsi('rgb', level, type, ...ansiStyles.hexToRgb(...arguments_));\n\t}\n\n\treturn ansiStyles[type][model](...arguments_);\n};\n\nconst usedModels = ['rgb', 'hex', 'ansi256'];\n\nfor (const model of usedModels) {\n\tstyles[model] = {\n\t\tget() {\n\t\t\tconst {level} = this;\n\t\t\treturn function (...arguments_) {\n\t\t\t\tconst styler = createStyler(getModelAnsi(model, levelMapping[level], 'color', ...arguments_), ansiStyles.color.close, this[STYLER]);\n\t\t\t\treturn createBuilder(this, styler, this[IS_EMPTY]);\n\t\t\t};\n\t\t},\n\t};\n\n\tconst bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);\n\tstyles[bgModel] = {\n\t\tget() {\n\t\t\tconst {level} = this;\n\t\t\treturn function (...arguments_) {\n\t\t\t\tconst styler = createStyler(getModelAnsi(model, levelMapping[level], 'bgColor', ...arguments_), ansiStyles.bgColor.close, this[STYLER]);\n\t\t\t\treturn createBuilder(this, styler, this[IS_EMPTY]);\n\t\t\t};\n\t\t},\n\t};\n}\n\nconst proto = Object.defineProperties(() => {}, {\n\t...styles,\n\tlevel: {\n\t\tenumerable: true,\n\t\tget() {\n\t\t\treturn this[GENERATOR].level;\n\t\t},\n\t\tset(level) {\n\t\t\tthis[GENERATOR].level = level;\n\t\t},\n\t},\n});\n\nconst createStyler = (open, close, parent) => {\n\tlet openAll;\n\tlet closeAll;\n\tif (parent === undefined) {\n\t\topenAll = open;\n\t\tcloseAll = close;\n\t} else {\n\t\topenAll = parent.openAll + open;\n\t\tcloseAll = close + parent.closeAll;\n\t}\n\n\treturn {\n\t\topen,\n\t\tclose,\n\t\topenAll,\n\t\tcloseAll,\n\t\tparent,\n\t};\n};\n\nconst createBuilder = (self, _styler, _isEmpty) => {\n\t// Single argument is hot path, implicit coercion is faster than anything\n\t// eslint-disable-next-line no-implicit-coercion\n\tconst builder = (...arguments_) => applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));\n\n\t// We alter the prototype because we must return a function, but there is\n\t// no way to create a function with a different prototype\n\tObject.setPrototypeOf(builder, proto);\n\n\tbuilder[GENERATOR] = self;\n\tbuilder[STYLER] = _styler;\n\tbuilder[IS_EMPTY] = _isEmpty;\n\n\treturn builder;\n};\n\nconst applyStyle = (self, string) => {\n\tif (self.level <= 0 || !string) {\n\t\treturn self[IS_EMPTY] ? '' : string;\n\t}\n\n\tlet styler = self[STYLER];\n\n\tif (styler === undefined) {\n\t\treturn string;\n\t}\n\n\tconst {openAll, closeAll} = styler;\n\tif (string.includes('\\u001B')) {\n\t\twhile (styler !== undefined) {\n\t\t\t// Replace any instances already present with a re-opening code\n\t\t\t// otherwise only the part of the string until said closing code\n\t\t\t// will be colored, and the rest will simply be 'plain'.\n\t\t\tstring = stringReplaceAll(string, styler.close, styler.open);\n\n\t\t\tstyler = styler.parent;\n\t\t}\n\t}\n\n\t// We can move both next actions out of loop, because remaining actions in loop won't have\n\t// any/visible effect on parts we add here. Close the styling before a linebreak and reopen\n\t// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92\n\tconst lfIndex = string.indexOf('\\n');\n\tif (lfIndex !== -1) {\n\t\tstring = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);\n\t}\n\n\treturn openAll + string + closeAll;\n};\n\nObject.defineProperties(createChalk.prototype, styles);\n\nconst chalk = createChalk();\nexport const chalkStderr = createChalk({level: stderrColor ? stderrColor.level : 0});\n\nexport {\n\tmodifierNames,\n\tforegroundColorNames,\n\tbackgroundColorNames,\n\tcolorNames,\n\n\t// TODO: Remove these aliases in the next major version\n\tmodifierNames as modifiers,\n\tforegroundColorNames as foregroundColors,\n\tbackgroundColorNames as backgroundColors,\n\tcolorNames as colors,\n} from './vendor/ansi-styles/index.js';\n\nexport {\n\tstdoutColor as supportsColor,\n\tstderrColor as supportsColorStderr,\n};\n\nexport default chalk;\n","type TODO = any;\n\n// In the absence of a WeakSet or WeakMap implementation, don't break, but don't cache either.\nfunction noop(...args: Array<any>) {}\nfunction createWeakMap<K extends object, V>(): MyWeakMap<K, V> {\n if (typeof WeakMap !== \"undefined\") {\n return new WeakMap<K, V>();\n } else {\n return fakeSetOrMap<K, V>();\n }\n}\n\ntype MyWeakMap<K extends object, V> = Pick<\n WeakMap<K, V>,\n \"delete\" | \"get\" | \"set\" | \"has\"\n>;\ntype MyWeakSetMap<K extends object, V> =\n & Pick<WeakMap<K, V>, \"delete\" | \"get\" | \"set\" | \"has\">\n & Pick<WeakSet<K>, \"add\">;\n\n/**\n * Creates and returns a no-op implementation of a WeakMap / WeakSet that never stores anything.\n */\nfunction fakeSetOrMap<K extends object, V = any>(): MyWeakSetMap<K, V> {\n return {\n add: noop as WeakSet<K>[\"add\"],\n delete: noop as WeakMap<K, V>[\"delete\"],\n get: noop as WeakMap<K, V>[\"get\"],\n set: noop as WeakMap<K, V>[\"set\"],\n has(k: K) {\n return false;\n },\n };\n}\n\n// Safe hasOwnProperty\nconst hop = Object.prototype.hasOwnProperty;\nconst has = function (obj: object, prop: string): boolean {\n return hop.call(obj, prop);\n};\n\n// Copy all own enumerable properties from source to target\nfunction extend<T, S extends object>(target: T, source: S) {\n type Extended = T & S;\n for (const prop in source) {\n if (has(source, prop)) {\n (target as any)[prop] = source[prop];\n }\n }\n return target as Extended;\n}\n\nconst reLeadingNewline = /^[ \\t]*(?:\\r\\n|\\r|\\n)/;\nconst reTrailingNewline = /(?:\\r\\n|\\r|\\n)[ \\t]*$/;\nconst reStartsWithNewlineOrIsEmpty = /^(?:[\\r\\n]|$)/;\nconst reDetectIndentation = /(?:\\r\\n|\\r|\\n)([ \\t]*)(?:[^ \\t\\r\\n]|$)/;\nconst reOnlyWhitespaceWithAtLeastOneNewline = /^[ \\t]*[\\r\\n][ \\t\\r\\n]*$/;\n\nfunction _outdentArray(\n strings: ReadonlyArray<string>,\n firstInterpolatedValueSetsIndentationLevel: boolean,\n options: Options,\n) {\n // If first interpolated value is a reference to outdent,\n // determine indentation level from the indentation of the interpolated value.\n let indentationLevel = 0;\n\n const match = strings[0].match(reDetectIndentation);\n if (match) {\n indentationLevel = match[1].length;\n }\n\n const reSource = `(\\\\r\\\\n|\\\\r|\\\\n).{0,${indentationLevel}}`;\n const reMatchIndent = new RegExp(reSource, \"g\");\n\n if (firstInterpolatedValueSetsIndentationLevel) {\n strings = strings.slice(1);\n }\n\n const { newline, trimLeadingNewline, trimTrailingNewline } = options;\n const normalizeNewlines = typeof newline === \"string\";\n const l = strings.length;\n const outdentedStrings = strings.map((v, i) => {\n // Remove leading indentation from all lines\n v = v.replace(reMatchIndent, \"$1\");\n // Trim a leading newline from the first string\n if (i === 0 && trimLeadingNewline) {\n v = v.replace(reLeadingNewline, \"\");\n }\n // Trim a trailing newline from the last string\n if (i === l - 1 && trimTrailingNewline) {\n v = v.replace(reTrailingNewline, \"\");\n }\n // Normalize newlines\n if (normalizeNewlines) {\n v = v.replace(/\\r\\n|\\n|\\r/g, (_) => newline as string);\n }\n return v;\n });\n return outdentedStrings;\n}\n\nfunction concatStringsAndValues(\n strings: ReadonlyArray<string>,\n values: ReadonlyArray<any>,\n): string {\n let ret = \"\";\n for (let i = 0, l = strings.length; i < l; i++) {\n ret += strings[i];\n if (i < l - 1) {\n ret += values[i];\n }\n }\n return ret;\n}\n\nfunction isTemplateStringsArray(v: any): v is TemplateStringsArray {\n return has(v, \"raw\") && has(v, \"length\");\n}\n\n/**\n * It is assumed that opts will not change. If this is a problem, clone your options object and pass the clone to\n * makeInstance\n * @param options\n * @return {outdent}\n */\nfunction createInstance(options: Options): Outdent {\n /** Cache of pre-processed template literal arrays */\n const arrayAutoIndentCache = createWeakMap<\n TemplateStringsArray,\n Array<string>\n >();\n /**\n * Cache of pre-processed template literal arrays, where first interpolated value is a reference to outdent,\n * before interpolated values are injected.\n */\n const arrayFirstInterpSetsIndentCache = createWeakMap<\n TemplateStringsArray,\n Array<string>\n >();\n\n /* tslint:disable:no-shadowed-variable */\n function outdent(\n stringsOrOptions: TemplateStringsArray,\n ...values: Array<any>\n ): string;\n function outdent(stringsOrOptions: Options): Outdent;\n function outdent(\n stringsOrOptions: TemplateStringsArray | Options,\n ...values: Array<any>\n ): string | Outdent {\n /* tslint:enable:no-shadowed-variable */\n if (isTemplateStringsArray(stringsOrOptions)) {\n const strings = stringsOrOptions;\n\n // Is first interpolated value a reference to outdent, alone on its own line, without any preceding non-whitespace?\n const firstInterpolatedValueSetsIndentationLevel =\n (values[0] === outdent || values[0] === defaultOutdent) &&\n reOnlyWhitespaceWithAtLeastOneNewline.test(strings[0]) &&\n reStartsWithNewlineOrIsEmpty.test(strings[1]);\n\n // Perform outdentation\n const cache = firstInterpolatedValueSetsIndentationLevel\n ? arrayFirstInterpSetsIndentCache\n : arrayAutoIndentCache;\n let renderedArray = cache.get(strings);\n if (!renderedArray) {\n renderedArray = _outdentArray(\n strings,\n firstInterpolatedValueSetsIndentationLevel,\n options,\n );\n cache.set(strings, renderedArray);\n }\n /** If no interpolated values, skip concatenation step */\n if (values.length === 0) {\n return renderedArray[0];\n }\n /** Concatenate string literals with interpolated values */\n const rendered = concatStringsAndValues(\n renderedArray,\n firstInterpolatedValueSetsIndentationLevel ? values.slice(1) : values,\n );\n\n return rendered;\n } else {\n // Create and return a new instance of outdent with the given options\n return createInstance(\n extend(extend({}, options), stringsOrOptions || {}),\n );\n }\n }\n\n const fullOutdent = extend(outdent, {\n string(str: string): string {\n return _outdentArray([str], false, options)[0];\n },\n });\n\n return fullOutdent;\n}\n\nconst defaultOutdent = createInstance({\n trimLeadingNewline: true,\n trimTrailingNewline: true,\n});\n\nexport interface Outdent {\n /**\n * Remove indentation from a template literal.\n */\n (strings: TemplateStringsArray, ...values: Array<any>): string;\n /**\n * Create and return a new Outdent instance with the given options.\n */\n (options: Options): Outdent;\n\n /**\n * Remove indentation from a string\n */\n string(str: string): string;\n\n // /**\n // * Remove indentation from a template literal, but return a tuple of the\n // * outdented TemplateStringsArray and\n // */\n // pass(strings: TemplateStringsArray, ...values: Array<any>): [TemplateStringsArray, ...Array<any>];\n}\nexport interface Options {\n trimLeadingNewline?: boolean;\n trimTrailingNewline?: boolean;\n /**\n * Normalize all newlines in the template literal to this value.\n * \n * If `null`, newlines are left untouched.\n * \n * Newlines that get normalized are '\\r\\n', '\\r', and '\\n'.\n * \n * Newlines within interpolated values are *never* normalized.\n * \n * Although intended for normalizing to '\\n' or '\\r\\n',\n * you can also set to any string; for example ' '.\n */\n newline?: string | null;\n}\n\n// Named exports. Simple and preferred.\n// import outdent from 'outdent';\nexport default defaultOutdent;\n// import {outdent} from 'outdent';\nexport { defaultOutdent as outdent };\n\n// In CommonJS environments, enable `var outdent = require('outdent');` by\n// replacing the exports object.\n// Make sure that our replacement includes the named exports from above.\ndeclare var module: any;\nif (typeof module !== \"undefined\") {\n // In webpack harmony-modules environments, module.exports is read-only,\n // so we fail gracefully.\n try {\n module.exports = defaultOutdent;\n Object.defineProperty(defaultOutdent, \"__esModule\", { value: true });\n (defaultOutdent as any).default = defaultOutdent;\n (defaultOutdent as any).outdent = defaultOutdent;\n } catch (e) {}\n}\n","// Dependencies\nimport { debounce } from 'perfect-debounce'\nimport { extract } from '@terai/extractor'\nimport { generate } from '@terai/generator'\nimport { loadConfig, runtime } from '@terai/runtime'\nimport { logger } from '@terai/logger'\nimport {\n\tconvertExtractedMessagesToDictionary,\n\tstringify,\n\tgroupDictionaryByChunks\n} from '@terai/utils'\n\n// Types\nimport type { CAC } from 'cac'\nimport type { BuildManifest } from '@terai/types'\n\nexport type ExtractOptions = {\n\tcwd: string\n\tforce?: boolean\n\twatch?: boolean\n}\n\nexport function createExtractCommand(cli: CAC, cwd: string) {\n\treturn cli\n\t\t.command('extract', 'Statically extract messages from your project')\n\t\t.option('-w, --watch', 'Watch files and rebuild')\n\t\t.option('--cwd <cwd>', 'Current working directory', { default: cwd })\n\t\t.action(extractCmd)\n}\n\nexport async function extractCmd(options: ExtractOptions) {\n\tlogger.heading('extract', 'Statically extract messages from your project')\n\n\tconst done = logger.time.success()\n\n\tconst config = await loadConfig(options)\n\tconst filesPaths = runtime.fs.glob({\n\t\t...config,\n\t\tcwd: options.cwd\n\t})\n\n\tconst outDirPath = runtime.path.resolve(options.cwd, config.outDir)\n\tconst projectLocalePath = runtime.path.resolve(\n\t\toutDirPath,\n\t\tconfig.projectLocale\n\t)\n\tconst manifestPath = runtime.path.resolve(\n\t\toutDirPath,\n\t\t'.terai',\n\t\t'locale-manifest.json'\n\t)\n\n\tlogger.info('Scan:', 'Processing files...')\n\n\tasync function extractor(files = filesPaths) {\n\t\tconst extractedMessages = await extract({\n\t\t\t...config,\n\t\t\tfilesPaths: files,\n\t\t\tcwd: options.cwd\n\t\t})\n\t\tconst dictionary = convertExtractedMessagesToDictionary(extractedMessages)\n\t\tconst manifest: BuildManifest = {\n\t\t\tmessages: extractedMessages\n\t\t}\n\n\t\tconst dictionaries = groupDictionaryByChunks(\n\t\t\tdictionary,\n\t\t\tmanifest,\n\t\t\tconfig.projectLocale\n\t\t)\n\n\t\truntime.fs.remove(runtime.path.resolve(projectLocalePath))\n\n\t\tawait generate({\n\t\t\t...config,\n\t\t\tdictionaries,\n\t\t\tlocale: config.projectLocale,\n\t\t\tcwd: options.cwd\n\t\t})\n\n\t\truntime.fs.write(manifestPath, stringify(manifest))\n\n\t\treturn Object.keys(dictionary).length\n\t}\n\n\tlogger.info('Extraction:', 'Extracting messages...')\n\n\tconst msgCount = await extractor()\n\n\tdone(`Extracted ${msgCount} messages`)\n\n\tif (options.watch) {\n\t\tlogger.log('')\n\t\tlogger.info('Watch:', 'Watching files for changes...\\n')\n\t\tconst configWatcher = runtime.fs.watch({\n\t\t\t...config,\n\t\t\t...options\n\t\t})\n\n\t\tconfigWatcher.on(\n\t\t\t'change',\n\t\t\tdebounce(async () => {\n\t\t\t\tconst done = logger.time.success()\n\t\t\t\tlogger.info('Extraction:', 'Files changed, processing messages...')\n\n\t\t\t\tconst msgCount = await extractor()\n\n\t\t\t\tdone(`Extracted ${msgCount} messages`)\n\t\t\t\tlogger.log('')\n\t\t\t})\n\t\t)\n\t}\n}\n","// Dependencies\nimport { runtime } from '@terai/runtime'\nimport { stringify } from '@terai/utils'\n\n// Types\nimport type { Config, Locale, Dictionaries } from '@terai/types'\n\ntype GenerateOptions = {\n\tcwd: string\n\tlocale: Locale\n\tdictionaries: Dictionaries\n} & Pick<Config, 'outDir'>\n\nexport async function generate({\n\tdictionaries,\n\tlocale,\n\tcwd,\n\toutDir\n}: GenerateOptions) {\n\tconst folderPath = runtime.path.resolve(cwd, outDir, locale)\n\tconst output = []\n\n\tfor (const id in dictionaries) {\n\t\tconst fileDir = runtime.path.resolve(folderPath, `${id}.json`)\n\t\tconst fileContent = dictionaries[id]\n\t\tconst idOutput = stringify(fileContent)\n\n\t\truntime.fs.write(fileDir, idOutput)\n\n\t\toutput.push(idOutput)\n\t}\n\n\treturn output\n}\n","// Dependencies\nimport { generate } from '@terai/generator'\nimport { loadConfig, runtime } from '@terai/runtime'\nimport { logger } from '@terai/logger'\nimport { translate } from '@terai/translator'\nimport { merge, stringify, groupDictionaryByChunks } from '@terai/utils'\n\n// Types\nimport type { CAC } from 'cac'\nimport type { Dictionary, BuildManifest } from '@terai/types'\n\nexport type TranslateOptions = {\n\tcwd: string\n}\n\nexport function createTranslateCommand(cli: CAC, cwd: string) {\n\treturn cli\n\t\t.command('translate', 'Translate messages from your project')\n\t\t.option('--cwd <cwd>', 'Current working directory', { default: cwd })\n\t\t.action(translateCmd)\n}\n\nexport async function translateCmd({ cwd }: TranslateOptions) {\n\tlogger.heading('translate', 'Translate messages from your project')\n\tconst done = logger.time.success()\n\n\tconst config = await loadConfig({ cwd })\n\n\tconst outDirPath = runtime.path.resolve(cwd, config.outDir)\n\tconst tmuDirPath = runtime.path.resolve(cwd, config.outDir, '.terai')\n\tconst manifestPath = runtime.path.resolve(tmuDirPath, 'locale-manifest.json')\n\tconst existsManifest = runtime.fs.exists(manifestPath)\n\tif (!existsManifest) {\n\t\treturn logger.error(\n\t\t\t'translate',\n\t\t\t`No locale-manifest.json found in ${tmuDirPath}. Please run \"extract\" first.`\n\t\t)\n\t}\n\n\tconst buildManifest = JSON.parse(\n\t\truntime.fs.readFile(manifestPath)\n\t) as BuildManifest\n\n\tlet totalTranslatedMsgs = 0\n\tlet totalCachedMsgs = 0\n\n\tawait Promise.all(\n\t\tconfig.outLocales.map(async (locale) => {\n\t\t\ttry {\n\t\t\t\tlet translatedDictionary: Dictionary = {}\n\t\t\t\tconst untranslatedDictionary: Dictionary = {}\n\t\t\t\tconst localeDirPath = runtime.path.resolve(outDirPath, locale)\n\t\t\t\tconst localeCachePath = runtime.path.resolve(\n\t\t\t\t\ttmuDirPath,\n\t\t\t\t\t'cache',\n\t\t\t\t\t`${locale}.cache.json`\n\t\t\t\t)\n\t\t\t\tconst cacheExists = runtime.fs.exists(localeCachePath)\n\t\t\t\tlet cache: Dictionary = cacheExists\n\t\t\t\t\t? JSON.parse(runtime.fs.readFile(localeCachePath))\n\t\t\t\t\t: {}\n\n\t\t\t\tlet localeCachedMsgs = 0\n\t\t\t\tlet localeTranslatedMsgs = 0\n\n\t\t\t\tfor (const id in buildManifest.messages) {\n\t\t\t\t\tconst { value, chunksIds } = buildManifest.messages[id]\n\t\t\t\t\tconst chnks = chunksIds.length ? chunksIds : [locale]\n\n\t\t\t\t\tfor (const chunkId of chnks) {\n\t\t\t\t\t\tconst chunkPath = runtime.path.resolve(\n\t\t\t\t\t\t\tlocaleDirPath,\n\t\t\t\t\t\t\t`${chunkId}.json`\n\t\t\t\t\t\t)\n\t\t\t\t\t\tconst existsChunk = runtime.fs.exists(chunkPath)\n\t\t\t\t\t\tconst chunk: Dictionary = existsChunk\n\t\t\t\t\t\t\t? JSON.parse(runtime.fs.readFile(chunkPath))\n\t\t\t\t\t\t\t: {}\n\t\t\t\t\t\tconst localeValue = chunk[id] ?? cache[id]\n\n\t\t\t\t\t\tif (!localeValue) {\n\t\t\t\t\t\t\tuntranslatedDictionary[id] = value\n\t\t\t\t\t\t\tlocaleTranslatedMsgs++\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttranslatedDictionary[id] = localeValue\n\t\t\t\t\t\t\t// Update cache in case local value is different\n\t\t\t\t\t\t\tcache[id] = localeValue\n\t\t\t\t\t\t\tlocaleCachedMsgs++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (localeTranslatedMsgs > 0) {\n\t\t\t\t\tconst translation = await translate({\n\t\t\t\t\t\t...config,\n\t\t\t\t\t\tdictionary: untranslatedDictionary,\n\t\t\t\t\t\tlocale\n\t\t\t\t\t})\n\n\t\t\t\t\ttranslatedDictionary = merge(translation, translatedDictionary)\n\t\t\t\t}\n\n\t\t\t\tcache = {\n\t\t\t\t\t...cache,\n\t\t\t\t\t...translatedDictionary\n\t\t\t\t}\n\n\t\t\t\truntime.fs.remove(localeDirPath)\n\n\t\t\t\tconst dictionaries = groupDictionaryByChunks(\n\t\t\t\t\ttranslatedDictionary,\n\t\t\t\t\tbuildManifest,\n\t\t\t\t\tlocale\n\t\t\t\t)\n\n\t\t\t\tawait generate({\n\t\t\t\t\t...config,\n\t\t\t\t\tdictionaries: dictionaries,\n\t\t\t\t\tlocale,\n\t\t\t\t\tcwd\n\t\t\t\t})\n\n\t\t\t\truntime.fs.write(localeCachePath, stringify(cache))\n\n\t\t\t\ttotalTranslatedMsgs += localeTranslatedMsgs\n\t\t\t\ttotalCachedMsgs += localeCachedMsgs\n\n\t\t\t\tlogger.info(\n\t\t\t\t\t`Locale ${locale.toUpperCase()}:`,\n\t\t\t\t\t`${localeTranslatedMsgs} new messages translated, ${localeCachedMsgs} recovered from cache`\n\t\t\t\t)\n\t\t\t} catch (err) {\n\t\t\t\tif (err instanceof Error) {\n\t\t\t\t\tlogger.error(\n\t\t\t\t\t\t`${locale} translation:`,\n\t\t\t\t\t\t`Error translating to ${locale}: ${err.message}\\n`\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t)\n\n\tif (!totalTranslatedMsgs) {\n\t\treturn done('Everything up-to-date')\n\t}\n\n\tdone(\n\t\t`Translated ${totalTranslatedMsgs} messages, ${totalCachedMsgs} read from cache`\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,qBAAuD;AACvD,qBAA8B;;;ACD9B,0BAAoB;AEDpB,IAAAA,uBAAoB;AACpB,qBAAe;AACf,sBAAgB;ADFhB,IAAM,yBAAyB;AAE/B,IAAM,aAAa,CAAC,SAAS,MAAM,CAAA,SAAQ,QAAU,OAAO,MAAM;AAElE,IAAM,cAAc,CAAC,SAAS,MAAM,CAAA,SAAQ,QAAU,KAAK,MAAM,MAAM,IAAI;AAE3E,IAAM,cAAc,CAAC,SAAS,MAAM,CAAC,KAAK,OA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,QACD;AAEA,cAAM,SAAS;AAAA,UACd,GAAG;AAAA,UACH;AAAA,UACA;AAAA,UACA;AAAA,QACD,CAAC;AAED,gCAAQ,GAAG,MAAM,qBAAiB,yBAAU,KAAK,CAAC;AAElD,+BAAuB;AACvB,2BAAmB;AAEnB,eAAO;AAAA,UACN,UAAU,OAAO,YAAY,CAAC;AAAA,UAC9B,GAAG,oBAAoB,6BAA6B,gBAAgB;AAAA,QACrE;AAAA,MACD,SAAS,KAAK;AACb,YAAI,eAAe,OAAO;AACzB,iBAAO;AAAA,YACN,GAAG,MAAM;AAAA,YACT,wBAAwB,MAAM,KAAK,IAAI,OAAO;AAAA;AAAA,UAC/C;AAAA,QACD;AAAA,MACD;AAAA,IACD,CAAC;AAAA,EACF;AAEA,MAAI,CAAC,qBAAqB;AACzB,WAAO,KAAK,uBAAuB;AAAA,EACpC;AAEA;AAAA,IACC,cAAc,mBAAmB,cAAc,eAAe;AAAA,EAC/D;AACD;","names":["import_node_process","process","os","tty","styles","chalk","logger","heading","getPackageManager","import_runtime","import_runtime","import_utils","done","msgCount","import_runtime","import_utils"]}