@ls-stack/server-i18n 0.0.0-stage → 0.6.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.mjs","names":["z.object","z.array","z.string","z.number","fs","path","presolve","pjoin","prelative","psep","rc_record","rc_union","rc_string","rc_null","rc_object","rc_number","path","rc_parse","c"],"sources":["../../core/src/cli/ai-logger.ts","../../core/src/cli/ai-translator.ts","../../node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/package.json","../../node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js","../../core/src/cli/loadEnvFiles.ts","../../core/src/cli/findMissingTranslations.ts","../../core/src/cli/similarity.ts","../../node_modules/.pnpm/readdirp@5.0.0/node_modules/readdirp/index.js","../../node_modules/.pnpm/runcheck@1.15.0/node_modules/runcheck/dist/chunk-JPCZKLXK.js","../../core/src/cli/validation.ts","../src/cli.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport type {\n AIProvider,\n TokenUsage,\n TranslationContext,\n TranslationResult,\n} from './ai-translator';\n\nconst MAX_LOG_FILES = 10;\n\nexport type AiLogEntry = {\n timestamp: string;\n provider: AIProvider;\n model: string | undefined;\n prompt: string;\n contexts: TranslationContext[];\n results: Array<{\n sourceKey: string;\n result: TranslationResult | undefined;\n }>;\n usage: TokenUsage | undefined;\n durationMs: number;\n error: string | undefined;\n};\n\nfunction getAiLogsFolder(): string | null {\n return process.env['I18N_AI_LOGS_FOLDER'] || null;\n}\n\nfunction cleanupOldLogs(folder: string): void {\n const files = fs\n .readdirSync(folder)\n .filter((f) => f.startsWith('ai-log-') && f.endsWith('.json'))\n .sort();\n\n while (files.length >= MAX_LOG_FILES) {\n const oldest = files.shift();\n if (oldest) {\n fs.unlinkSync(path.join(folder, oldest));\n }\n }\n}\n\nexport function logAiGeneration(data: AiLogEntry): string | null {\n const folder = getAiLogsFolder();\n if (!folder) return null;\n\n fs.mkdirSync(folder, { recursive: true });\n cleanupOldLogs(folder);\n\n const timestamp = new Date().toISOString().replace(/[:.]/g, '-');\n const filename = `ai-log-${timestamp}.json`;\n const filepath = path.join(folder, filename);\n\n fs.writeFileSync(filepath, JSON.stringify(data, null, 2));\n\n console.info(`AI log saved to: ${filepath}`);\n\n return filepath;\n}\n","import type { LanguageModel } from 'ai';\nimport { z } from 'zod';\nimport type { PluralTranslation } from '../types';\nimport { logAiGeneration } from './ai-logger';\nimport type { SimilarityMatch } from './similarity';\n\ntype AnyLanguageModel =\n | LanguageModel\n | { readonly specificationVersion: 'v1' | 'v2' | 'v3' };\n\nexport type AIProvider = 'google' | 'openai';\n\nexport type TranslationContext = {\n sourceKey: string;\n targetLocale: string;\n isPlural: boolean;\n similarTranslations: SimilarityMatch[];\n};\n\nexport type TranslationResult =\n | { type: 'string'; value: string }\n | { type: 'plural'; value: PluralTranslation };\n\nexport type TokenUsage = {\n inputTokens: number;\n outputTokens: number;\n totalTokens: number;\n};\n\nexport type TranslateBatchResult = {\n translations: Map<string, TranslationResult>;\n model?: string;\n usage?: TokenUsage;\n};\n\nexport interface AITranslator {\n translateBatch(contexts: TranslationContext[]): Promise<TranslateBatchResult>;\n}\n\nfunction buildTranslationsSchema() {\n return z.object({\n strings: z.array(\n z.object({\n key: z.string(),\n translation: z.string(),\n }),\n ),\n plurals: z.array(\n z.object({\n key: z.string(),\n translation: z.object({\n zero: z.string().nullable(),\n one: z.string().nullable(),\n plus2: z.string(),\n many: z.string().nullable(),\n manyLimit: z.number().nullable(),\n }),\n }),\n ),\n });\n}\n\nfunction buildPrompt(contexts: TranslationContext[]): string {\n const lines: string[] = [\n '<role>',\n 'You are a professional translator specializing in i18n localization.',\n '</role>',\n '',\n '<instructions>',\n '- Translate the provided keys to the specified target locale',\n '- Keep placeholders like {1}, {2}, # exactly as they appear',\n '- For plural translations, provide an object with one and plus2 forms',\n '- Use similar existing translations as style/terminology reference',\n '- Respond with a JSON object containing two arrays: \"strings\" and \"plurals\"',\n '- Each item in \"strings\" has \"key\" (the original source key) and \"translation\" (the translated string)',\n '- Each item in \"plurals\" has \"key\" (the original source key) and \"translation\" (an object with plural forms)',\n '</instructions>',\n '',\n '<plural-format>',\n 'Plural translations must be objects with these keys:',\n ' one: text when count is 1',\n ' plus2: text when count is 2 or more (use # as the number placeholder)',\n '',\n 'English example: { \"one\": \"1 item\", \"plus2\": \"# items\" }',\n 'Portuguese example: { \"one\": \"1 item\", \"plus2\": \"# itens\" }',\n '</plural-format>',\n '',\n '<keys>',\n ];\n\n for (const ctx of contexts) {\n lines.push('');\n lines.push(`Key: \"${ctx.sourceKey}\"`);\n lines.push(`Locale: ${ctx.targetLocale}`);\n lines.push(`Type: ${ctx.isPlural ? 'plural' : 'string'}`);\n\n if (ctx.similarTranslations.length > 0) {\n lines.push('Similar translations:');\n for (const match of ctx.similarTranslations.slice(0, 3)) {\n const translationValue =\n typeof match.translation === 'string' ?\n match.translation\n : JSON.stringify(match.translation);\n lines.push(` \"${match.key}\" → ${translationValue}`);\n }\n }\n }\n\n lines.push('</keys>');\n\n return lines.join('\\n');\n}\n\nfunction parseGeneratedObject(\n obj: z.infer<ReturnType<typeof buildTranslationsSchema>>,\n contexts: TranslationContext[],\n): Map<string, TranslationResult> {\n const results = new Map<string, TranslationResult>();\n const validKeys = new Set(contexts.map((ctx) => ctx.sourceKey));\n const pluralKeys = new Set(\n contexts.filter((ctx) => ctx.isPlural).map((ctx) => ctx.sourceKey),\n );\n\n for (const item of obj.strings) {\n if (!validKeys.has(item.key) || pluralKeys.has(item.key)) continue;\n results.set(item.key, { type: 'string', value: item.translation });\n }\n\n for (const item of obj.plurals) {\n if (!validKeys.has(item.key) || !pluralKeys.has(item.key)) continue;\n results.set(item.key, {\n type: 'plural',\n value: {\n zero: item.translation.zero ?? undefined,\n one: item.translation.one ?? undefined,\n '+2': item.translation.plus2,\n many: item.translation.many ?? undefined,\n manyLimit: item.translation.manyLimit ?? undefined,\n },\n });\n }\n\n return results;\n}\n\nexport function createAITranslator(\n provider: AIProvider,\n model?: AnyLanguageModel,\n): AITranslator {\n return {\n async translateBatch(\n contexts: TranslationContext[],\n ): Promise<TranslateBatchResult> {\n if (contexts.length === 0) {\n return { translations: new Map() };\n }\n\n const ai = await import('ai');\n\n let languageModel: AnyLanguageModel;\n\n if (model) {\n languageModel = model;\n } else if (provider === 'google') {\n const { google } = await import('@ai-sdk/google');\n languageModel = google('gemini-2.5-flash') as AnyLanguageModel;\n } else {\n const { openai } = await import('@ai-sdk/openai');\n languageModel = openai('gpt-5-mini') as AnyLanguageModel;\n }\n\n const prompt = buildPrompt(contexts);\n const schema = buildTranslationsSchema();\n const startTime = Date.now();\n\n try {\n const result = await ai.generateText({\n model: languageModel as LanguageModel,\n output: ai.Output.object({\n schema,\n }),\n prompt,\n });\n\n const output = result.output as\n | z.infer<ReturnType<typeof buildTranslationsSchema>>\n | undefined;\n\n if (!output) {\n logAiGeneration({\n timestamp: new Date().toISOString(),\n provider,\n model: result.response.modelId,\n prompt,\n contexts,\n results: [],\n usage: undefined,\n durationMs: Date.now() - startTime,\n error: undefined,\n });\n return { translations: new Map() };\n }\n\n const { inputTokens, outputTokens, totalTokens } = result.usage;\n\n const usage =\n inputTokens !== undefined &&\n outputTokens !== undefined &&\n totalTokens !== undefined\n ? { inputTokens, outputTokens, totalTokens }\n : undefined;\n\n const translations = parseGeneratedObject(output, contexts);\n\n logAiGeneration({\n timestamp: new Date().toISOString(),\n provider,\n model: result.response.modelId,\n prompt,\n contexts,\n results: contexts.map((ctx) => ({\n sourceKey: ctx.sourceKey,\n result: translations.get(ctx.sourceKey),\n })),\n usage,\n durationMs: Date.now() - startTime,\n error: undefined,\n });\n\n return {\n translations,\n model: result.response.modelId,\n usage,\n };\n } catch (err) {\n logAiGeneration({\n timestamp: new Date().toISOString(),\n provider,\n model: undefined,\n prompt,\n contexts,\n results: [],\n usage: undefined,\n durationMs: Date.now() - startTime,\n error: err instanceof Error ? err.message : String(err),\n });\n throw err;\n }\n },\n };\n}\n","","const fs = require('fs')\nconst path = require('path')\nconst os = require('os')\nconst crypto = require('crypto')\nconst packageJson = require('../package.json')\n\nconst version = packageJson.version\n\n// Array of tips to display randomly\nconst TIPS = [\n '🔐 encrypt with Dotenvx: https://dotenvx.com',\n '🔐 prevent committing .env to code: https://dotenvx.com/precommit',\n '🔐 prevent building .env in docker: https://dotenvx.com/prebuild',\n '📡 add observability to secrets: https://dotenvx.com/ops',\n '👥 sync secrets across teammates & machines: https://dotenvx.com/ops',\n '🗂️ backup and recover secrets: https://dotenvx.com/ops',\n '✅ audit secrets and track compliance: https://dotenvx.com/ops',\n '🔄 add secrets lifecycle management: https://dotenvx.com/ops',\n '🔑 add access controls to secrets: https://dotenvx.com/ops',\n '🛠️ run anywhere with `dotenvx run -- yourcommand`',\n '⚙️ specify custom .env file path with { path: \\'/custom/path/.env\\' }',\n '⚙️ enable debug logging with { debug: true }',\n '⚙️ override existing env vars with { override: true }',\n '⚙️ suppress all logs with { quiet: true }',\n '⚙️ write to custom object with { processEnv: myObject }',\n '⚙️ load multiple .env files with { path: [\\'.env.local\\', \\'.env\\'] }'\n]\n\n// Get a random tip from the tips array\nfunction _getRandomTip () {\n return TIPS[Math.floor(Math.random() * TIPS.length)]\n}\n\nfunction parseBoolean (value) {\n if (typeof value === 'string') {\n return !['false', '0', 'no', 'off', ''].includes(value.toLowerCase())\n }\n return Boolean(value)\n}\n\nfunction supportsAnsi () {\n return process.stdout.isTTY // && process.env.TERM !== 'dumb'\n}\n\nfunction dim (text) {\n return supportsAnsi() ? `\\x1b[2m${text}\\x1b[0m` : text\n}\n\nconst LINE = /(?:^|^)\\s*(?:export\\s+)?([\\w.-]+)(?:\\s*=\\s*?|:\\s+?)(\\s*'(?:\\\\'|[^'])*'|\\s*\"(?:\\\\\"|[^\"])*\"|\\s*`(?:\\\\`|[^`])*`|[^#\\r\\n]+)?\\s*(?:#.*)?(?:$|$)/mg\n\n// Parse src into an Object\nfunction parse (src) {\n const obj = {}\n\n // Convert buffer to string\n let lines = src.toString()\n\n // Convert line breaks to same format\n lines = lines.replace(/\\r\\n?/mg, '\\n')\n\n let match\n while ((match = LINE.exec(lines)) != null) {\n const key = match[1]\n\n // Default undefined or null to empty string\n let value = (match[2] || '')\n\n // Remove whitespace\n value = value.trim()\n\n // Check if double quoted\n const maybeQuote = value[0]\n\n // Remove surrounding quotes\n value = value.replace(/^(['\"`])([\\s\\S]*)\\1$/mg, '$2')\n\n // Expand newlines if double quoted\n if (maybeQuote === '\"') {\n value = value.replace(/\\\\n/g, '\\n')\n value = value.replace(/\\\\r/g, '\\r')\n }\n\n // Add to object\n obj[key] = value\n }\n\n return obj\n}\n\nfunction _parseVault (options) {\n options = options || {}\n\n const vaultPath = _vaultPath(options)\n options.path = vaultPath // parse .env.vault\n const result = DotenvModule.configDotenv(options)\n if (!result.parsed) {\n const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`)\n err.code = 'MISSING_DATA'\n throw err\n }\n\n // handle scenario for comma separated keys - for use with key rotation\n // example: DOTENV_KEY=\"dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenvx.com/vault/.env.vault?environment=prod\"\n const keys = _dotenvKey(options).split(',')\n const length = keys.length\n\n let decrypted\n for (let i = 0; i < length; i++) {\n try {\n // Get full key\n const key = keys[i].trim()\n\n // Get instructions for decrypt\n const attrs = _instructions(result, key)\n\n // Decrypt\n decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key)\n\n break\n } catch (error) {\n // last key\n if (i + 1 >= length) {\n throw error\n }\n // try next key\n }\n }\n\n // Parse decrypted .env string\n return DotenvModule.parse(decrypted)\n}\n\nfunction _warn (message) {\n console.error(`[dotenv@${version}][WARN] ${message}`)\n}\n\nfunction _debug (message) {\n console.log(`[dotenv@${version}][DEBUG] ${message}`)\n}\n\nfunction _log (message) {\n console.log(`[dotenv@${version}] ${message}`)\n}\n\nfunction _dotenvKey (options) {\n // prioritize developer directly setting options.DOTENV_KEY\n if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {\n return options.DOTENV_KEY\n }\n\n // secondary infra already contains a DOTENV_KEY environment variable\n if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {\n return process.env.DOTENV_KEY\n }\n\n // fallback to empty string\n return ''\n}\n\nfunction _instructions (result, dotenvKey) {\n // Parse DOTENV_KEY. Format is a URI\n let uri\n try {\n uri = new URL(dotenvKey)\n } catch (error) {\n if (error.code === 'ERR_INVALID_URL') {\n const err = new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n }\n\n throw error\n }\n\n // Get decrypt key\n const key = uri.password\n if (!key) {\n const err = new Error('INVALID_DOTENV_KEY: Missing key part')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n }\n\n // Get environment\n const environment = uri.searchParams.get('environment')\n if (!environment) {\n const err = new Error('INVALID_DOTENV_KEY: Missing environment part')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n }\n\n // Get ciphertext payload\n const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`\n const ciphertext = result.parsed[environmentKey] // DOTENV_VAULT_PRODUCTION\n if (!ciphertext) {\n const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`)\n err.code = 'NOT_FOUND_DOTENV_ENVIRONMENT'\n throw err\n }\n\n return { ciphertext, key }\n}\n\nfunction _vaultPath (options) {\n let possibleVaultPath = null\n\n if (options && options.path && options.path.length > 0) {\n if (Array.isArray(options.path)) {\n for (const filepath of options.path) {\n if (fs.existsSync(filepath)) {\n possibleVaultPath = filepath.endsWith('.vault') ? filepath : `${filepath}.vault`\n }\n }\n } else {\n possibleVaultPath = options.path.endsWith('.vault') ? options.path : `${options.path}.vault`\n }\n } else {\n possibleVaultPath = path.resolve(process.cwd(), '.env.vault')\n }\n\n if (fs.existsSync(possibleVaultPath)) {\n return possibleVaultPath\n }\n\n return null\n}\n\nfunction _resolveHome (envPath) {\n return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath\n}\n\nfunction _configVault (options) {\n const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || (options && options.debug))\n const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || (options && options.quiet))\n\n if (debug || !quiet) {\n _log('Loading env from encrypted .env.vault')\n }\n\n const parsed = DotenvModule._parseVault(options)\n\n let processEnv = process.env\n if (options && options.processEnv != null) {\n processEnv = options.processEnv\n }\n\n DotenvModule.populate(processEnv, parsed, options)\n\n return { parsed }\n}\n\nfunction configDotenv (options) {\n const dotenvPath = path.resolve(process.cwd(), '.env')\n let encoding = 'utf8'\n let processEnv = process.env\n if (options && options.processEnv != null) {\n processEnv = options.processEnv\n }\n let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || (options && options.debug))\n let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || (options && options.quiet))\n\n if (options && options.encoding) {\n encoding = options.encoding\n } else {\n if (debug) {\n _debug('No encoding is specified. UTF-8 is used by default')\n }\n }\n\n let optionPaths = [dotenvPath] // default, look for .env\n if (options && options.path) {\n if (!Array.isArray(options.path)) {\n optionPaths = [_resolveHome(options.path)]\n } else {\n optionPaths = [] // reset default\n for (const filepath of options.path) {\n optionPaths.push(_resolveHome(filepath))\n }\n }\n }\n\n // Build the parsed data in a temporary object (because we need to return it). Once we have the final\n // parsed data, we will combine it with process.env (or options.processEnv if provided).\n let lastError\n const parsedAll = {}\n for (const path of optionPaths) {\n try {\n // Specifying an encoding returns a string instead of a buffer\n const parsed = DotenvModule.parse(fs.readFileSync(path, { encoding }))\n\n DotenvModule.populate(parsedAll, parsed, options)\n } catch (e) {\n if (debug) {\n _debug(`Failed to load ${path} ${e.message}`)\n }\n lastError = e\n }\n }\n\n const populated = DotenvModule.populate(processEnv, parsedAll, options)\n\n // handle user settings DOTENV_CONFIG_ options inside .env file(s)\n debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug)\n quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet)\n\n if (debug || !quiet) {\n const keysCount = Object.keys(populated).length\n const shortPaths = []\n for (const filePath of optionPaths) {\n try {\n const relative = path.relative(process.cwd(), filePath)\n shortPaths.push(relative)\n } catch (e) {\n if (debug) {\n _debug(`Failed to load ${filePath} ${e.message}`)\n }\n lastError = e\n }\n }\n\n _log(`injecting env (${keysCount}) from ${shortPaths.join(',')} ${dim(`-- tip: ${_getRandomTip()}`)}`)\n }\n\n if (lastError) {\n return { parsed: parsedAll, error: lastError }\n } else {\n return { parsed: parsedAll }\n }\n}\n\n// Populates process.env from .env file\nfunction config (options) {\n // fallback to original dotenv if DOTENV_KEY is not set\n if (_dotenvKey(options).length === 0) {\n return DotenvModule.configDotenv(options)\n }\n\n const vaultPath = _vaultPath(options)\n\n // dotenvKey exists but .env.vault file does not exist\n if (!vaultPath) {\n _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`)\n\n return DotenvModule.configDotenv(options)\n }\n\n return DotenvModule._configVault(options)\n}\n\nfunction decrypt (encrypted, keyStr) {\n const key = Buffer.from(keyStr.slice(-64), 'hex')\n let ciphertext = Buffer.from(encrypted, 'base64')\n\n const nonce = ciphertext.subarray(0, 12)\n const authTag = ciphertext.subarray(-16)\n ciphertext = ciphertext.subarray(12, -16)\n\n try {\n const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce)\n aesgcm.setAuthTag(authTag)\n return `${aesgcm.update(ciphertext)}${aesgcm.final()}`\n } catch (error) {\n const isRange = error instanceof RangeError\n const invalidKeyLength = error.message === 'Invalid key length'\n const decryptionFailed = error.message === 'Unsupported state or unable to authenticate data'\n\n if (isRange || invalidKeyLength) {\n const err = new Error('INVALID_DOTENV_KEY: It must be 64 characters long (or more)')\n err.code = 'INVALID_DOTENV_KEY'\n throw err\n } else if (decryptionFailed) {\n const err = new Error('DECRYPTION_FAILED: Please check your DOTENV_KEY')\n err.code = 'DECRYPTION_FAILED'\n throw err\n } else {\n throw error\n }\n }\n}\n\n// Populate process.env with parsed values\nfunction populate (processEnv, parsed, options = {}) {\n const debug = Boolean(options && options.debug)\n const override = Boolean(options && options.override)\n const populated = {}\n\n if (typeof parsed !== 'object') {\n const err = new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate')\n err.code = 'OBJECT_REQUIRED'\n throw err\n }\n\n // Set process.env\n for (const key of Object.keys(parsed)) {\n if (Object.prototype.hasOwnProperty.call(processEnv, key)) {\n if (override === true) {\n processEnv[key] = parsed[key]\n populated[key] = parsed[key]\n }\n\n if (debug) {\n if (override === true) {\n _debug(`\"${key}\" is already defined and WAS overwritten`)\n } else {\n _debug(`\"${key}\" is already defined and was NOT overwritten`)\n }\n }\n } else {\n processEnv[key] = parsed[key]\n populated[key] = parsed[key]\n }\n }\n\n return populated\n}\n\nconst DotenvModule = {\n configDotenv,\n _configVault,\n _parseVault,\n config,\n decrypt,\n parse,\n populate\n}\n\nmodule.exports.configDotenv = DotenvModule.configDotenv\nmodule.exports._configVault = DotenvModule._configVault\nmodule.exports._parseVault = DotenvModule._parseVault\nmodule.exports.config = DotenvModule.config\nmodule.exports.decrypt = DotenvModule.decrypt\nmodule.exports.parse = DotenvModule.parse\nmodule.exports.populate = DotenvModule.populate\n\nmodule.exports = DotenvModule\n","import { config } from 'dotenv';\n\nexport function loadEnvFiles(): void {\n config({ path: ['.env.local', '.env'], quiet: true });\n}\n","import ts from '@typescript/typescript6';\n\nexport type TranslationLocation = {\n file: string;\n line: number;\n column: number;\n};\n\nexport type TranslationUsage = {\n hash: string;\n isJsx: boolean;\n isPlural: boolean;\n hasOnlyPrimitiveInterpolations: boolean;\n locations: TranslationLocation[];\n};\n\nexport type I18nUsagesResult = {\n pluralTranslations: string[];\n stringTranslations: string[];\n jsxStringTranslations: Set<string>;\n jsxPluralTranslations: Set<string>;\n primitiveOnlyJsx: Set<string>;\n usageMap: Map<string, TranslationUsage>;\n};\n\nfunction getHashFromTemplate(template: ts.TemplateLiteral): string | null {\n if (ts.isNoSubstitutionTemplateLiteral(template)) {\n return template.text;\n }\n\n if (ts.isTemplateExpression(template)) {\n let hash = '';\n\n hash += template.head.text;\n\n template.templateSpans.forEach((span, i) => {\n hash += `{${i + 1}}${span.literal.text}`;\n });\n\n return hash;\n }\n\n return null;\n}\n\nfunction isPrimitiveInterpolation(node: ts.Expression): boolean {\n if (ts.isStringLiteral(node) || ts.isNumericLiteral(node)) {\n return true;\n }\n\n if (ts.isIdentifier(node)) {\n return true;\n }\n\n if (ts.isPropertyAccessExpression(node)) {\n return true;\n }\n\n if (ts.isCallExpression(node)) {\n return true;\n }\n\n if (ts.isConditionalExpression(node)) {\n return (\n isPrimitiveInterpolation(node.whenTrue) &&\n isPrimitiveInterpolation(node.whenFalse)\n );\n }\n\n if (ts.isBinaryExpression(node)) {\n return (\n isPrimitiveInterpolation(node.left) &&\n isPrimitiveInterpolation(node.right)\n );\n }\n\n if (ts.isParenthesizedExpression(node)) {\n return isPrimitiveInterpolation(node.expression);\n }\n\n if (ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node)) {\n return false;\n }\n\n if (ts.isJsxFragment(node)) {\n return false;\n }\n\n return true;\n}\n\nfunction hasOnlyPrimitiveInterpolations(template: ts.TemplateLiteral): boolean {\n if (ts.isNoSubstitutionTemplateLiteral(template)) {\n return true;\n }\n\n if (ts.isTemplateExpression(template)) {\n for (const span of template.templateSpans) {\n if (!isPrimitiveInterpolation(span.expression)) {\n return false;\n }\n }\n return true;\n }\n\n return true;\n}\n\nexport function getI18nUsagesInCode(\n fileName: string,\n code: string,\n): I18nUsagesResult {\n const checkFile =\n code.includes('i18n') ||\n code.includes('__`') ||\n code.includes('__p(') ||\n code.includes('__jsx`') ||\n code.includes('__pjsx(');\n\n if (!checkFile) {\n return {\n pluralTranslations: [],\n stringTranslations: [],\n jsxStringTranslations: new Set(),\n jsxPluralTranslations: new Set(),\n primitiveOnlyJsx: new Set(),\n usageMap: new Map(),\n };\n }\n\n const sourceFile = ts.createSourceFile(\n fileName,\n code,\n ts.ScriptTarget.Latest,\n undefined,\n ts.ScriptKind.TSX,\n );\n\n const pluralTranslations = new Set<string>();\n const stringTranslations = new Set<string>();\n const jsxStringTranslations = new Set<string>();\n const jsxPluralTranslations = new Set<string>();\n const primitiveOnlyJsx = new Set<string>();\n const usageMap = new Map<string, TranslationUsage>();\n\n function addUsage(\n hash: string,\n isJsx: boolean,\n isPlural: boolean,\n onlyPrimitives: boolean,\n node: ts.Node,\n ): void {\n const { line, character } = sourceFile.getLineAndCharacterOfPosition(\n node.getStart(sourceFile),\n );\n\n const location: TranslationLocation = {\n file: fileName,\n line: line + 1,\n column: character + 1,\n };\n\n const existing = usageMap.get(hash);\n if (existing) {\n existing.locations.push(location);\n if (!onlyPrimitives) {\n existing.hasOnlyPrimitiveInterpolations = false;\n }\n } else {\n usageMap.set(hash, {\n hash,\n isJsx,\n isPlural,\n hasOnlyPrimitiveInterpolations: onlyPrimitives,\n locations: [location],\n });\n }\n }\n\n function checkNode(node: ts.Node) {\n if (ts.isTaggedTemplateExpression(node)) {\n const tteNode = node;\n\n const isTranslationFn = (id: ts.Identifier | ts.PrivateIdentifier) => {\n const name = ts.idText(id as ts.Identifier);\n return name === '__';\n };\n const isJsxTranslationFn = (id: ts.Identifier | ts.PrivateIdentifier) => {\n const name = ts.idText(id as ts.Identifier);\n return name === '__jsx';\n };\n const isPluralTranslationFn = (\n id: ts.Identifier | ts.PrivateIdentifier,\n ) => {\n const name = ts.idText(id as ts.Identifier);\n return name === '__p';\n };\n const isJsxPluralTranslationFn = (\n id: ts.Identifier | ts.PrivateIdentifier,\n ) => {\n const name = ts.idText(id as ts.Identifier);\n return name === '__pjsx';\n };\n\n if (\n (ts.isIdentifier(tteNode.tag) && isTranslationFn(tteNode.tag)) ||\n (ts.isPropertyAccessExpression(tteNode.tag) &&\n isTranslationFn(tteNode.tag.name))\n ) {\n const template = tteNode.template;\n const hash = getHashFromTemplate(template);\n\n if (hash) {\n stringTranslations.add(hash);\n addUsage(hash, false, false, true, node);\n }\n } else if (\n (ts.isIdentifier(tteNode.tag) && isJsxTranslationFn(tteNode.tag)) ||\n (ts.isPropertyAccessExpression(tteNode.tag) &&\n isJsxTranslationFn(tteNode.tag.name))\n ) {\n const template = tteNode.template;\n const hash = getHashFromTemplate(template);\n\n if (hash) {\n stringTranslations.add(hash);\n jsxStringTranslations.add(hash);\n const onlyPrimitives = hasOnlyPrimitiveInterpolations(template);\n if (onlyPrimitives) {\n primitiveOnlyJsx.add(hash);\n }\n addUsage(hash, true, false, onlyPrimitives, node);\n }\n } else if (ts.isCallExpression(tteNode.tag)) {\n if (\n (ts.isIdentifier(tteNode.tag.expression) &&\n isPluralTranslationFn(tteNode.tag.expression)) ||\n (ts.isPropertyAccessExpression(tteNode.tag.expression) &&\n isPluralTranslationFn(tteNode.tag.expression.name))\n ) {\n const hash = getHashFromTemplate(tteNode.template);\n\n if (hash) {\n pluralTranslations.add(hash);\n addUsage(hash, false, true, true, node);\n }\n } else if (\n (ts.isIdentifier(tteNode.tag.expression) &&\n isJsxPluralTranslationFn(tteNode.tag.expression)) ||\n (ts.isPropertyAccessExpression(tteNode.tag.expression) &&\n isJsxPluralTranslationFn(tteNode.tag.expression.name))\n ) {\n const hash = getHashFromTemplate(tteNode.template);\n\n if (hash) {\n pluralTranslations.add(hash);\n jsxPluralTranslations.add(hash);\n const onlyPrimitives = hasOnlyPrimitiveInterpolations(\n tteNode.template,\n );\n if (onlyPrimitives) {\n primitiveOnlyJsx.add(hash);\n }\n addUsage(hash, true, true, onlyPrimitives, node);\n }\n }\n }\n }\n\n ts.forEachChild(node, checkNode);\n }\n\n checkNode(sourceFile);\n\n return {\n pluralTranslations: Array.from(pluralTranslations),\n stringTranslations: Array.from(stringTranslations),\n jsxStringTranslations,\n jsxPluralTranslations,\n primitiveOnlyJsx,\n usageMap,\n };\n}\n","import type { PluralTranslation } from '../types';\n\ntype SimilarityTranslation = string | PluralTranslation;\n\nexport type SimilarityMatch = {\n key: string;\n translation: SimilarityTranslation;\n score: number;\n};\n\ntype SimilarityEntry = {\n key: string;\n translation: SimilarityTranslation;\n wordTokens: Set<string>;\n gramTokens: Set<string>;\n normalizedKey: string;\n wordWeightSum: number;\n translationTokens: Set<string>;\n};\n\ntype SimilarityIndex = {\n entries: SimilarityEntry[];\n tokenToEntries: Map<string, number[]>;\n idf: Map<string, number>;\n maxIdf: number;\n};\n\nconst NUM_TOKEN = '__num__';\nconst NUM_TOKEN_PLACEHOLDER = 'numtoken';\n\nfunction normalizePlaceholders(text: string): string {\n let normalized = text.replace(/\\{[^}]*\\}/g, ` ${NUM_TOKEN} `);\n normalized = normalized.replace(/#/g, ` ${NUM_TOKEN} `);\n normalized = normalized.replace(/\\d+/g, ` ${NUM_TOKEN} `);\n return normalized;\n}\n\nfunction splitCamelCase(text: string): string {\n return text.replace(/([a-z0-9])([A-Z])/g, '$1 $2');\n}\n\nfunction tokenizeWords(text: string): Set<string> {\n let normalized = normalizePlaceholders(text);\n normalized = splitCamelCase(normalized);\n normalized = normalized.toLowerCase();\n normalized = normalized.replaceAll(NUM_TOKEN, ` ${NUM_TOKEN_PLACEHOLDER} `);\n normalized = normalized.replace(/[^a-z0-9]+/g, ' ');\n\n const tokens = new Set<string>();\n for (const rawToken of normalized.trim().split(/\\s+/)) {\n if (!rawToken) continue;\n const token =\n rawToken === NUM_TOKEN_PLACEHOLDER ? NUM_TOKEN : rawToken;\n if (token.length >= 2 || token === NUM_TOKEN) {\n tokens.add(token);\n }\n }\n\n return tokens;\n}\n\nfunction normalizeForGrams(text: string): string {\n let normalized = normalizePlaceholders(text);\n normalized = splitCamelCase(normalized);\n normalized = normalized.toLowerCase();\n normalized = normalized.replaceAll(NUM_TOKEN, NUM_TOKEN_PLACEHOLDER);\n normalized = normalized.replace(/[^a-z0-9]+/g, '');\n return normalized;\n}\n\nfunction tokenizeGrams(text: string): Set<string> {\n const normalized = normalizeForGrams(text);\n const tokens = new Set<string>();\n\n if (normalized.length >= 3) {\n for (let i = 0; i <= normalized.length - 3; i++) {\n tokens.add(`ng:${normalized.slice(i, i + 3)}`);\n }\n } else if (normalized.length === 2) {\n tokens.add(`ng2:${normalized}`);\n } else if (normalized.length === 1) {\n tokens.add(`ng1:${normalized}`);\n }\n\n return tokens;\n}\n\nfunction jaccardSimilarity(set1: Set<string>, set2: Set<string>): number {\n if (set1.size === 0 && set2.size === 0) return 0;\n\n let intersection = 0;\n for (const item of set1) {\n if (set2.has(item)) {\n intersection++;\n }\n }\n\n const union = set1.size + set2.size - intersection;\n return union === 0 ? 0 : intersection / union;\n}\n\nfunction commonPrefixScoreNormalized(a: string, b: string): number {\n let prefixLen = 0;\n const minLen = Math.min(a.length, b.length);\n\n for (let i = 0; i < minLen; i++) {\n if (a[i] === b[i]) {\n prefixLen++;\n } else {\n break;\n }\n }\n\n const maxLen = Math.max(a.length, b.length);\n return maxLen === 0 ? 0 : prefixLen / maxLen;\n}\n\nfunction getTokenWeight(\n token: string,\n idf: Map<string, number>,\n maxIdf: number,\n): number {\n return idf.get(token) ?? maxIdf;\n}\n\nfunction sumTokenWeights(\n tokens: Set<string>,\n idf: Map<string, number>,\n maxIdf: number,\n): number {\n let sum = 0;\n for (const token of tokens) {\n sum += getTokenWeight(token, idf, maxIdf);\n }\n return sum;\n}\n\nfunction weightedJaccard(\n set1: Set<string>,\n set2: Set<string>,\n idf: Map<string, number>,\n maxIdf: number,\n set1WeightSum?: number,\n set2WeightSum?: number,\n): number {\n if (set1.size === 0 && set2.size === 0) return 0;\n\n const weightSum1 =\n set1WeightSum ?? sumTokenWeights(set1, idf, maxIdf);\n const weightSum2 =\n set2WeightSum ?? sumTokenWeights(set2, idf, maxIdf);\n\n let intersectionWeight = 0;\n if (set1.size <= set2.size) {\n for (const token of set1) {\n if (set2.has(token)) {\n intersectionWeight += getTokenWeight(token, idf, maxIdf);\n }\n }\n } else {\n for (const token of set2) {\n if (set1.has(token)) {\n intersectionWeight += getTokenWeight(token, idf, maxIdf);\n }\n }\n }\n\n const union = weightSum1 + weightSum2 - intersectionWeight;\n return union === 0 ? 0 : intersectionWeight / union;\n}\n\nfunction toTranslationText(translation: SimilarityTranslation): string {\n if (typeof translation === 'string') return translation;\n\n const parts: string[] = [];\n if (translation.zero) parts.push(translation.zero);\n if (translation.one) parts.push(translation.one);\n if (translation['+2']) parts.push(translation['+2']);\n if (translation.many) parts.push(translation.many);\n return parts.join(' ');\n}\n\nexport function createSimilarityIndex(\n existingTranslations: Map<string, SimilarityTranslation>,\n): SimilarityIndex {\n const entries: SimilarityEntry[] = [];\n const tokenToEntries = new Map<string, number[]>();\n const documentFrequency = new Map<string, number>();\n\n for (const [key, translation] of existingTranslations) {\n const wordTokens = tokenizeWords(key);\n const gramTokens = tokenizeGrams(key);\n const normalizedKey = normalizeForGrams(key);\n const translationTokens = tokenizeWords(toTranslationText(translation));\n const entryIndex = entries.length;\n\n for (const token of wordTokens) {\n documentFrequency.set(token, (documentFrequency.get(token) ?? 0) + 1);\n const existing = tokenToEntries.get(token);\n if (existing) {\n existing.push(entryIndex);\n } else {\n tokenToEntries.set(token, [entryIndex]);\n }\n }\n\n entries.push({\n key,\n translation,\n wordTokens,\n gramTokens,\n normalizedKey,\n wordWeightSum: 0,\n translationTokens,\n });\n }\n\n const totalDocuments = entries.length;\n const idf = new Map<string, number>();\n for (const [token, count] of documentFrequency) {\n idf.set(token, Math.log((totalDocuments + 1) / (count + 1)) + 1);\n }\n\n const maxIdf = Math.log((totalDocuments + 1) / 1) + 1;\n\n for (const entry of entries) {\n entry.wordWeightSum = sumTokenWeights(entry.wordTokens, idf, maxIdf);\n }\n\n return {\n entries,\n tokenToEntries,\n idf,\n maxIdf,\n };\n}\n\nexport function findSimilarFromIndex(\n index: SimilarityIndex,\n sourceKey: string,\n maxResults = 5,\n): SimilarityMatch[] {\n if (index.entries.length === 0) {\n return [];\n }\n\n const sourceTokens = tokenizeWords(sourceKey);\n const sourceGrams = tokenizeGrams(sourceKey);\n const sourceNormalized = normalizeForGrams(sourceKey);\n const sourceWeightSum = sumTokenWeights(\n sourceTokens,\n index.idf,\n index.maxIdf,\n );\n\n let candidateIndexes: number[] = [];\n if (sourceTokens.size > 0) {\n const candidateSet = new Set<number>();\n for (const token of sourceTokens) {\n const matches = index.tokenToEntries.get(token);\n if (!matches) continue;\n for (const entryIndex of matches) {\n candidateSet.add(entryIndex);\n }\n }\n\n candidateIndexes =\n candidateSet.size === 0 ?\n index.entries.map((_entry, idx) => idx)\n : Array.from(candidateSet);\n } else {\n candidateIndexes = index.entries.map((_entry, idx) => idx);\n }\n\n const scored: { index: number; keyScore: number }[] = [];\n for (const entryIndex of candidateIndexes) {\n const entry = index.entries[entryIndex];\n if (!entry) {\n continue;\n }\n const wordScore = weightedJaccard(\n sourceTokens,\n entry.wordTokens,\n index.idf,\n index.maxIdf,\n sourceWeightSum,\n entry.wordWeightSum,\n );\n const gramScore = jaccardSimilarity(sourceGrams, entry.gramTokens);\n const prefixScore = commonPrefixScoreNormalized(\n sourceNormalized,\n entry.normalizedKey,\n );\n\n const keyScore = wordScore * 0.65 + gramScore * 0.25 + prefixScore * 0.1;\n\n if (keyScore >= 0.12) {\n scored.push({ index: entryIndex, keyScore });\n }\n }\n\n if (scored.length === 0) {\n return [];\n }\n\n scored.sort((a, b) => b.keyScore - a.keyScore);\n\n const topCount = Math.min(20, scored.length);\n const topEntry = scored[0];\n if (!topEntry) {\n return [];\n }\n const referenceTokens =\n index.entries[topEntry.index]?.translationTokens ?? new Set<string>();\n\n const finalCandidates: {\n index: number;\n finalScore: number;\n keyScore: number;\n }[] = [];\n\n for (let i = 0; i < topCount; i++) {\n const scoredEntry = scored[i];\n if (!scoredEntry) {\n continue;\n }\n const entry = index.entries[scoredEntry.index];\n if (!entry) {\n continue;\n }\n let translationScore = 0;\n\n if (referenceTokens.size > 0 && entry.translationTokens.size > 0) {\n translationScore = jaccardSimilarity(\n referenceTokens,\n entry.translationTokens,\n );\n }\n\n const finalScore = scoredEntry.keyScore * 0.85 + translationScore * 0.15;\n finalCandidates.push({\n index: scoredEntry.index,\n finalScore,\n keyScore: scoredEntry.keyScore,\n });\n }\n\n for (let i = topCount; i < scored.length; i++) {\n const scoredEntry = scored[i];\n if (!scoredEntry) {\n continue;\n }\n finalCandidates.push({\n index: scoredEntry.index,\n finalScore: scoredEntry.keyScore,\n keyScore: scoredEntry.keyScore,\n });\n }\n\n finalCandidates.sort((a, b) => {\n if (b.finalScore !== a.finalScore) {\n return b.finalScore - a.finalScore;\n }\n if (b.keyScore !== a.keyScore) {\n return b.keyScore - a.keyScore;\n }\n const aKey = index.entries[a.index]?.key ?? '';\n const bKey = index.entries[b.index]?.key ?? '';\n return aKey.localeCompare(bKey);\n });\n\n const results: SimilarityMatch[] = [];\n for (const candidate of finalCandidates.slice(0, maxResults)) {\n const entry = index.entries[candidate.index];\n if (!entry) continue;\n results.push({\n key: entry.key,\n translation: entry.translation,\n score: candidate.finalScore,\n });\n }\n return results;\n}\n\nexport function findSimilarTranslations(\n sourceKey: string,\n existingTranslations: Map<string, SimilarityTranslation>,\n maxResults = 5,\n): SimilarityMatch[] {\n if (existingTranslations.size === 0) {\n return [];\n }\n\n const index = createSimilarityIndex(existingTranslations);\n return findSimilarFromIndex(index, sourceKey, maxResults);\n}\n","import { lstat, readdir, realpath, stat } from 'node:fs/promises';\nimport { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from 'node:path';\nimport { Readable } from 'node:stream';\nexport const EntryTypes = {\n FILE_TYPE: 'files',\n DIR_TYPE: 'directories',\n FILE_DIR_TYPE: 'files_directories',\n EVERYTHING_TYPE: 'all',\n};\nconst defaultOptions = {\n root: '.',\n fileFilter: (_entryInfo) => true,\n directoryFilter: (_entryInfo) => true,\n type: EntryTypes.FILE_TYPE,\n lstat: false,\n depth: 2147483648,\n alwaysStat: false,\n highWaterMark: 4096,\n};\nObject.freeze(defaultOptions);\nconst RECURSIVE_ERROR_CODE = 'READDIRP_RECURSIVE_ERROR';\nconst NORMAL_FLOW_ERRORS = new Set(['ENOENT', 'EPERM', 'EACCES', 'ELOOP', RECURSIVE_ERROR_CODE]);\nconst ALL_TYPES = [\n EntryTypes.DIR_TYPE,\n EntryTypes.EVERYTHING_TYPE,\n EntryTypes.FILE_DIR_TYPE,\n EntryTypes.FILE_TYPE,\n];\nconst DIR_TYPES = new Set([\n EntryTypes.DIR_TYPE,\n EntryTypes.EVERYTHING_TYPE,\n EntryTypes.FILE_DIR_TYPE,\n]);\nconst FILE_TYPES = new Set([\n EntryTypes.EVERYTHING_TYPE,\n EntryTypes.FILE_DIR_TYPE,\n EntryTypes.FILE_TYPE,\n]);\nconst isNormalFlowError = (error) => NORMAL_FLOW_ERRORS.has(error.code);\nconst wantBigintFsStats = process.platform === 'win32';\nconst emptyFn = (_entryInfo) => true;\nconst normalizeFilter = (filter) => {\n if (filter === undefined)\n return emptyFn;\n if (typeof filter === 'function')\n return filter;\n if (typeof filter === 'string') {\n const fl = filter.trim();\n return (entry) => entry.basename === fl;\n }\n if (Array.isArray(filter)) {\n const trItems = filter.map((item) => item.trim());\n return (entry) => trItems.some((f) => entry.basename === f);\n }\n return emptyFn;\n};\n/** Readable readdir stream, emitting new files as they're being listed. */\nexport class ReaddirpStream extends Readable {\n parents;\n reading;\n parent;\n _stat;\n _maxDepth;\n _wantsDir;\n _wantsFile;\n _wantsEverything;\n _root;\n _isDirent;\n _statsProp;\n _rdOptions;\n _fileFilter;\n _directoryFilter;\n constructor(options = {}) {\n super({\n objectMode: true,\n autoDestroy: true,\n highWaterMark: options.highWaterMark,\n });\n const opts = { ...defaultOptions, ...options };\n const { root, type } = opts;\n this._fileFilter = normalizeFilter(opts.fileFilter);\n this._directoryFilter = normalizeFilter(opts.directoryFilter);\n const statMethod = opts.lstat ? lstat : stat;\n // Use bigint stats if it's windows and stat() supports options (node 10+).\n if (wantBigintFsStats) {\n this._stat = (path) => statMethod(path, { bigint: true });\n }\n else {\n this._stat = statMethod;\n }\n this._maxDepth =\n opts.depth != null && Number.isSafeInteger(opts.depth) ? opts.depth : defaultOptions.depth;\n this._wantsDir = type ? DIR_TYPES.has(type) : false;\n this._wantsFile = type ? FILE_TYPES.has(type) : false;\n this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;\n this._root = presolve(root);\n this._isDirent = !opts.alwaysStat;\n this._statsProp = this._isDirent ? 'dirent' : 'stats';\n this._rdOptions = { encoding: 'utf8', withFileTypes: this._isDirent };\n // Launch stream with one parent, the root dir.\n this.parents = [this._exploreDir(root, 1)];\n this.reading = false;\n this.parent = undefined;\n }\n async _read(batch) {\n if (this.reading)\n return;\n this.reading = true;\n try {\n while (!this.destroyed && batch > 0) {\n const par = this.parent;\n const fil = par && par.files;\n if (fil && fil.length > 0) {\n const { path, depth } = par;\n const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path));\n const awaited = await Promise.all(slice);\n for (const entry of awaited) {\n if (!entry)\n continue;\n if (this.destroyed)\n return;\n const entryType = await this._getEntryType(entry);\n if (entryType === 'directory' && this._directoryFilter(entry)) {\n if (depth <= this._maxDepth) {\n this.parents.push(this._exploreDir(entry.fullPath, depth + 1));\n }\n if (this._wantsDir) {\n this.push(entry);\n batch--;\n }\n }\n else if ((entryType === 'file' || this._includeAsFile(entry)) &&\n this._fileFilter(entry)) {\n if (this._wantsFile) {\n this.push(entry);\n batch--;\n }\n }\n }\n }\n else {\n const parent = this.parents.pop();\n if (!parent) {\n this.push(null);\n break;\n }\n this.parent = await parent;\n if (this.destroyed)\n return;\n }\n }\n }\n catch (error) {\n this.destroy(error);\n }\n finally {\n this.reading = false;\n }\n }\n async _exploreDir(path, depth) {\n let files;\n try {\n files = await readdir(path, this._rdOptions);\n }\n catch (error) {\n this._onError(error);\n }\n return { files, depth, path };\n }\n async _formatEntry(dirent, path) {\n let entry;\n const basename = this._isDirent ? dirent.name : dirent;\n try {\n const fullPath = presolve(pjoin(path, basename));\n entry = { path: prelative(this._root, fullPath), fullPath, basename };\n entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);\n }\n catch (err) {\n this._onError(err);\n return;\n }\n return entry;\n }\n _onError(err) {\n if (isNormalFlowError(err) && !this.destroyed) {\n this.emit('warn', err);\n }\n else {\n this.destroy(err);\n }\n }\n async _getEntryType(entry) {\n // entry may be undefined, because a warning or an error were emitted\n // and the statsProp is undefined\n if (!entry && this._statsProp in entry) {\n return '';\n }\n const stats = entry[this._statsProp];\n if (stats.isFile())\n return 'file';\n if (stats.isDirectory())\n return 'directory';\n if (stats && stats.isSymbolicLink()) {\n const full = entry.fullPath;\n try {\n const entryRealPath = await realpath(full);\n const entryRealPathStats = await lstat(entryRealPath);\n if (entryRealPathStats.isFile()) {\n return 'file';\n }\n if (entryRealPathStats.isDirectory()) {\n const len = entryRealPath.length;\n if (full.startsWith(entryRealPath) && full.substr(len, 1) === psep) {\n const recursiveError = new Error(`Circular symlink detected: \"${full}\" points to \"${entryRealPath}\"`);\n // @ts-ignore\n recursiveError.code = RECURSIVE_ERROR_CODE;\n return this._onError(recursiveError);\n }\n return 'directory';\n }\n }\n catch (error) {\n this._onError(error);\n return '';\n }\n }\n }\n _includeAsFile(entry) {\n const stats = entry && entry[this._statsProp];\n return stats && this._wantsEverything && !stats.isDirectory();\n }\n}\n/**\n * Streaming version: Reads all files and directories in given root recursively.\n * Consumes ~constant small amount of RAM.\n * @param root Root directory\n * @param options Options to specify root (start directory), filters and recursion depth\n */\nexport function readdirp(root, options = {}) {\n // @ts-ignore\n let type = options.entryType || options.type;\n if (type === 'both')\n type = EntryTypes.FILE_DIR_TYPE; // backwards-compatibility\n if (type)\n options.type = type;\n if (!root) {\n throw new Error('readdirp: root argument is required. Usage: readdirp(root, options)');\n }\n else if (typeof root !== 'string') {\n throw new TypeError('readdirp: root argument must be a string. Usage: readdirp(root, options)');\n }\n else if (type && !ALL_TYPES.includes(type)) {\n throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(', ')}`);\n }\n options.root = root;\n return new ReaddirpStream(options);\n}\n/**\n * Promise version: Reads all files and directories in given root recursively.\n * Compared to streaming version, will consume a lot of RAM e.g. when 1 million files are listed.\n * @returns array of paths and their entry infos\n */\nexport function readdirpPromise(root, options = {}) {\n return new Promise((resolve, reject) => {\n const files = [];\n readdirp(root, options)\n .on('data', (entry) => files.push(entry))\n .on('end', () => resolve(files))\n .on('error', (error) => reject(error));\n });\n}\nexport default readdirp;\n","function G(e,r){return{...r,u:e}}function b(e){if(S(e))return e;if(w(e)){let r={};for(let[n,t]of Object.entries(e))r[n]=b(t);return x(r)}else if(Array.isArray(e)){let[r,n]=e;switch(r){case\"optional\":return b(n).optional();case\"nullish_or\":return b(n).orNullish();case\"null_or\":return b(n).orNull();case\"array_of\":return P(b(n));case\"loose_array_of\":return E(b(n));case\"optional_array_of\":return P(b(n)).optional();case\"optional_loose_array_of\":return E(b(n)).optional();case\"null_or_array_of\":return P(b(n)).orNull();case\"null_or_loose_array_of\":return E(b(n)).orNull();case\"nullish_or_array_of\":return P(b(n)).orNullish();case\"nullish_or_loose_array_of\":return E(b(n)).orNullish();default:return r}}throw new Error(`invalid schema: ${e}`)}function x(e,{normalizeKeysFrom:r,extends:n}={}){let t={};for(let[o,a]of Object.entries(e))t[o]=b(a);let s=Object.entries(t).map(([o,a])=>({key:o,type:a}));return{...T,t,e:n?\"extends_object\":\"object\",T:\"\",o:!0,_:!!n,r(o,a){return f(this,o,a,()=>{if(!w(o)){if(a.a=-1,a.s&&!this.T)return!1;if(!this.T){let l=`${this.e}{ `,y=0;for(let{key:_,type:k}of s){if(l.length>100){l+=\", ...\";break}y!==0&&(l+=\", \"),l+=`${_}: ${k.e}`,y++}l+=\" }\",this.T=l}return{data:void 0,errors:[p(a,`Type '${j(o,!1)}' is not assignable to '${this.T}'`)]}}let i=this.e===\"strict_obj\"||a.i?new Set(Object.keys(o)):void 0;if(i&&i.size>s.length){a.a=-1;let l=[];if(a.s)return{data:void 0,errors:[p(a,`Expected strict object with ${s.length} keys but got ${i.size}`)]};for(let{key:y}of s)i.has(y)?i.delete(y):l.push(p(a,`Key '${y}' is missing`));for(let y of i)l.push(p(a,`Key '${y}' is not defined in the object shape`));return{data:void 0,errors:l}}let c={},h=[],g=a.n,m=-1;for(let l of s){let y=l.key,_=l.type,k=y;m+=1;let d=y===\"\"||y.includes(\" \")?`['${y}']`:`.${y}`,R=`${g}${d}`;a.n=R;let O=o[y],D=y;if(O===void 0&&_.u&&(O=o[_.u],D=_.u),O===void 0&&r===\"snake_case\"){let N=V(y);O=o[N],D=N}i?.delete(D);let B=_.r(O,a);if(B.ok)c[k]=B.data;else{for(let N of B.errors)a.n=R,h.push(N);if(a.s){a.a=m;break}}}if(i&&i.size>0)for(let l of i)a.n=g,h.push(p(a,`Key '${l}' is not defined in the object shape`));return h.length>0?{errors:h,data:void 0}:(a.n=g,this._?{errors:!1,data:{...o,...c}}:{errors:!1,data:c})})}}}function H(e,r){if(S(e)){if(!e.t)throw new Error(\"rc_obj_extends: schema must be an object type\");return{...e,e:\"extends_object\",_:!0}}return{...x(e,r),e:\"extends_object\",_:!0}}function X(e){if(!e.t)throw new Error(\"type does not have an object shape\");return e.t}function Y(e,r){return{...x(e,r),e:\"strict_obj\"}}function ee(e,{nonRecursive:r}={}){if(r){if(!e.t)throw new Error(\"rc_enable_obj_strict: nonRecursive option can only be used on object types\");return{...e,e:\"strict_obj\"}}return{...e,r(n,t){let s=t.i;t.i=!0;let o=e.r(n,t);return t.i=s,o}}}function re(...e){let r={};for(let n of e)Object.assign(r,n.t);return x(r)}function ne(e,r){let n={};if(!e.t)throw new Error(\"rc_obj_pick: obj must be an object type\");for(let t of r){let s=e.t[t];s&&(n[t]=s)}return x(n)}function te(e,r){let n={};if(!e.t)throw new Error(\"rc_obj_omit: obj must be an object type\");for(let t of Object.keys(e.t))r.includes(t)||(n[t]=e.t[t]);return x(n)}function se(){return(e,r)=>x(e,r)}function F(e,r){let n={};for(let[t,s]of Object.entries(r))n[t]=S(s)?s:x(s);return{...T,e:\"discriminated_union\",o:!0,r(t,s){return f(this,t,s,()=>{if(!w(t))return s.a=-1,!1;let o=t[e],a=s.n,u=n[o];if(!u){let c=j(o,!0);return{errors:[p({n:`${a}.${e}`},`Type '${c}' is not a valid discriminator`)],data:void 0}}s.n=`${a}|${e}: ${o}|`;let i=u.r(t,s);return s.n=a,i.ok?(i.data[e]=o,{errors:!1,data:i.data}):{errors:i.errors,data:void 0}})}}}function oe(e){return r=>F(e,r)}function ae(...e){let r=\"\",n=!0;for(let t of e)r&&(r+=\" & \"),t.o||(n=!1),r+=t.e.includes(\"|\")?`(${t.e})`:t.e;return{...T,e:r,o:n,r(t,s){return f(this,t,s,()=>{let o=null;for(let a of e){let u=a.r(t,s);if(u.ok)a.o&&(o={...o||{},...u.data});else return a.o?u:!1}return o?{data:o,errors:!1}:!0})}}}var ie=()=>{};function ue(e){return{...this,p:e===void 0?ie:e}}function ce(e){return be(this,e)}function le(e){return ge(this,e)}function ye(e){return _e(this,e)}function fe(e,r){return $(e,this,r)}function Te(e,r){return je(e,this,r)}function p(e,r){return`${e.n?`$${e.n}: `:\"\"}${r}`}function C(e,r){e.b.push(r.startsWith(\"$\")?r:p(e,r))}function J(e,r){r.forEach(n=>C(e,n))}function f(e,r,n,t){if(e.c&&r===void 0)return{ok:!0,data:r,errors:void 0};if(e.l&&r==null)return{ok:!0,data:r,errors:void 0};if(e.f&&r===null)return{ok:!0,data:r,errors:void 0};let s=t();if(s&&(s===!0||!s.errors))return{ok:!0,data:s===!0?r:s.data,errors:void 0};if(!n.y){let o=e.p;if(o!==void 0)return C(n,`Fallback used, errors -> ${L(s,n,e,r)}`),{ok:!0,data:U(o)?o(r):o,errors:void 0};if(e.g&&e.d){let a=e.d(r);if(a)return a.safeFix||C(n,`Autofixed from error -> ${L(s,n,e,r)}`),a.errors?{ok:!1,data:void 0,errors:a.errors.map(u=>p(n,u))}:{ok:!0,data:a.fixed,errors:void 0}}}return{ok:!1,data:void 0,errors:s?s.errors:[p(n,Q(e,r))]}}function L(e,r,n,t){return e?e.errors.map(s=>s.replace(r.n,\"\")).join(\"; \"):Q(n,t)}function de(e){return{...this,g:!0,d:e}}function pe(e){return{...this,r:(r,n)=>f(this,r,n,()=>{let t=this.r(r,n);if(!t.ok)return{errors:t.errors,data:void 0};let s=e(t.data);return s!==!0?{errors:[p(n,`Predicate failed${s===!1?` for type '${this.e}'`:`: ${s.error}`}`)],data:void 0}:{errors:!1,data:t.data}})}}function M(){return{...this,c:!0,e:`undefined | ${this.e}`}}function Q(e,r){return`Type '${j(r,!!e.k)}' is not assignable to '${e.e}'`}function Re(){return{...this,f:!0,e:`null | ${this.e}`}}function he(){return{...this,l:!0,e:`null | undefined | ${this.e}`}}var T={__rc_type:void 0,withFallback:ue,where:pe,r:void 0,e:void 0,optional:M,optionalKey:M,orNullish:he,withAutofix:de,orNull:Re,default:ce,nullishDefault:le,or:ye,parse:fe,parseJson:Te,R:void 0,p:void 0,m:void 0,c:!1,f:!1,l:!1,g:!1,k:!1,u:void 0,d:void 0,t:void 0,T:void 0,o:!1,_:!1},ze={...T,r(e,r){return f(this,e,r,()=>e===void 0)},e:\"undefined\"},Je={...T,r(e,r){return f(this,e,r,()=>e===null)},e:\"null\"},Qe={...T,r(e){return{ok:!0,data:e,errors:void 0}},e:\"any\"},Ze={...T,r(e){return{ok:!0,data:e,errors:void 0}},e:\"unknown\"},Ge={...T,r(e,r){return f(this,e,r,()=>typeof e==\"boolean\")},e:\"boolean\"},He={...T,r(e,r){return f(this,e,r,()=>typeof e==\"string\")},e:\"string\"},Xe={...T,r(e,r){return f(this,e,r,()=>typeof e==\"number\"&&!Number.isNaN(e))},e:\"number\"},Ye={...T,r(e,r){return f(this,e,r,()=>typeof e==\"object\"&&e instanceof Date&&!Number.isNaN(e.getTime()))},e:\"date\"};function er(e){return{...T,r(r,n){return f(this,r,n,()=>r instanceof e)},e:`instanceof_${e.name||\"AnonymousClass\"}`}}function rr(...e){let r=Array.isArray(e[0])?e[0]:e;if(r.length===0)throw new Error(\"rc_literal requires at least one literal\");return{...T,r(n,t){return f(this,n,t,()=>{for(let s of r)if(n===s)return!0;return!1})},k:!0,x:r,e:r.length==1?j(r[0],!0):r.map(n=>j(n,!0)).join(\" | \")}}function nr(e){if(!e.x)throw new Error(\"Type is not a literal type\");return e.x}var z=1;function _e(...e){if(e.length===0)throw new Error(\"Unions should have at least one type\");let r=\"\",n=!1;for(let t of e)r&&(r+=\" | \"),r+=t.e,!n&&t.o&&(n=!0);return{...T,e:r,o:n,r(t,s){return f(this,t,s,()=>{let o=s.n,a=[],u=0,i=!1,c=[],h=0;for(let g of e){h+=1,g.o&&(s.n=`${o}|union ${h}|`);let m=s.s;s.s=!0,s.a=0;let l=g.r(t,s),y=s.a;if(s.s=m,s.a=0,l.ok)return{data:l.data,errors:!1};g.o&&y!==-1?y>0?c.push(...l.errors):(u<z&&a.push(...l.errors),u+=1):i=!0}return s.n=o,c.length>0||a.length>0?((u>z||i)&&a.push(p(s,\"not matches any other union member\")),{errors:[...c,...a],data:void 0}):!1})}}}function be(e,r){return{...e,c:!1,l:!1,f:!1,r(t,s){return f(this,t,s,()=>{if(t===void 0)return n();let o=e.r(t,s);return o.ok?o.data===void 0?n():{data:o.data,errors:!1}:{data:void 0,errors:o.errors}})},e:`${e.e}_default`};function n(){return{data:U(r)?r():r,errors:!1}}}function ge(e,r){return{...e,c:!1,l:!1,f:!1,r(t,s){return f(this,t,s,()=>{if(t==null)return n();let o=e.r(t,s);return o.ok?o.data===null||o.data===void 0?n():{data:o.data,errors:!1}:{data:void 0,errors:o.errors}})},e:`${e.e}_nullish_default`};function n(){return{data:U(r)?r():r,errors:!1}}}function tr(e,r){return{...e,r(n,t){return f(this,n,t,()=>{let s=e.r(n,t);return s.ok?{data:s.data,errors:!1}:{data:U(r)?r():r,errors:!1}})}}}function ke(e,{checkKey:r,looseCheck:n}={}){return{...T,e:`record<string, ${e.e}>`,o:!0,r(t,s){return f(this,t,s,()=>{if(!w(t))return!1;let o={},a=[],u=s.n;for(let[i,c]of Object.entries(t)){let h=i===\"\"||i.includes(\" \")?`['${i}']`:`.${i}`,g=`${u}${h}`;if(s.n=g,r&&!r(i)){a.push(p(s,`Key '${i}' is not allowed`));continue}let m=t[i],l=e.r(c,s);if(l.ok)o[i]=m;else{let y=l.errors;for(let _ of y)a.push(_);if(s.s)break}}if(a.length>0)if(n)J(s,a);else return{errors:a,data:void 0};return s.n=u,{errors:!1,data:o}})}}}function sr(e,{checkKey:r}={}){return ke(e,{checkKey:r,looseCheck:!0})}function A(e,r,n,t=!1,s){let o=t&&!n.y&&!n.h,a=s?.unique,u=[],i=[],c=a?new Set:void 0,h=n.n,g=Array.isArray(r),m=-1;for(let l of e){m++;let y=g?r[m]:r,_=`[${m}]`,k=`${h}${_}`;if(n.n=k,s?.filter){let R=s.filter(l);if(typeof R==\"boolean\"){if(!R)continue}else if(\"errors\"in R)if(o){u.push([R.errors,k]);continue}else return{errors:R.errors,data:void 0};n.n=k}let d=y.r(l,n);if(n.n=k,d.ok&&c){let R=d.data,O=typeof a==\"string\";O?R=d.data[a]:typeof a==\"function\"&&(R=a(d.data)),c.has(R)?(O&&(n.n=`${h}${_}.${a}`),d={ok:!1,data:void 0,errors:[p(n,O?`Type '${y.t?.[a]?.e}' with value \"${R}\" is not unique`:typeof a==\"function\"?`Type '${y.e}' unique fn return with value \"${R}\" is not unique`:`${y.e} value is not unique`)]}):c.add(R)}if(d.ok)i.push(d.data);else if(o){u.push([d.errors,k]);continue}else return{errors:d.errors,data:void 0}}if(u.length>0){let l=[];for(let[y,_]of u){for(let k of y){let d=k.slice(_.length+1);d.startsWith(\": \")&&(d=d.slice(2)),(d.startsWith(\".\")||d.startsWith(\"[\"))&&(d=`#${d}`);let R=`$${_}: Rejected, error -> ${d}`;l.push(R)}J(n,l)}}return{errors:!1,data:i}}function P(e,r){return{...T,e:`${e.e}[]`,R:e,r(n,t){return f(this,n,t,()=>Array.isArray(n)?n.length===0?!0:A.call(this,n,e,t,!1,r):!1)}}}function or(e){if(!e.R)throw new Error(\"Type does not have an item type\");return e.R}function ar(e,{nonRecursive:r=!1}={}){if(r){if(!e.e.endsWith(\"[]\"))throw new Error(\"rc_disable_loose_array: nonRecursive option can only be used with array types\");return{...e,r(n,t){return f(this,n,t,()=>Array.isArray(n)?n.length===0?!0:A.call(this,n,e,t,!1):!1)}}}return{...e,r(n,t){let s=t.h;t.h=!0;let o=e.r(n,t);return t.h=s,o}}}function E(e,r){return{...T,R:e,e:`${e.e}[]`,r(n,t){return f(this,n,t,()=>Array.isArray(n)?n.length===0?!0:A.call(this,n,e,t,!0,r):!1)}}}function ir(e,r,n,t){return{...T,R:n,e:`${n.e}[]`,r(s,o){return f(this,s,o,()=>Array.isArray(s)?s.length===0?!0:A.call(this,s,n,o,t?.loose,{...t,filter(a){let u=e.r(a,o);return u.ok?r(u.data):{errors:u.errors}}}):!1)}}}function ur(e){return{...T,e:`[${e.map(r=>r.e).join(\", \")}]`,r(r,n){return f(this,r,n,()=>!Array.isArray(r)||r.length!==e.length?!1:A.call(this,r,e,n))}}}function q(e){e.warnings&&e.warnings.length>0&&console.warn(`Unwrap warnings: ${e.warnings.join(`\n`)}`)}function v(){if(this.errors)throw new I(this.errors);return q(this),this.value}function K(e){return this.errors?e:(q(this),this.value)}function W(){return this.errors?null:(q(this),this.value)}function $(e,r,{noWarnings:n=!1}={}){let t={b:[],n:\"\",s:!1,a:0,y:n,i:!1,h:!1},s=r.r(e,t);return s.ok?{error:!1,errors:!1,ok:!0,data:s.data,value:s.data,warnings:t.b.length>0?t.b:!1,unwrap:v,unwrapOr:K,unwrapOrNull:W}:{ok:!1,error:!0,errors:s.errors,unwrap:v,unwrapOr:K,unwrapOrNull:W}}function cr(e){return r=>$(r,e)}function lr(e,r,n){let t=$(e,r,n);return t.errors?{data:null,errors:t.errors,warnings:!1}:{data:t.value,errors:!1,warnings:t.warnings}}function yr(e){return me(e,null)}function me(e,r){return e.error?{value:r,errors:e.errors,warnings:!1}:{value:e.value,errors:!1,warnings:e.warnings}}var I=class extends Error{constructor(n){super(n.join(`\n`));this.errors=n}name=\"RcValidationError\"};function fr(e){if(e.errors)throw new I(e.errors);return e}function xe(e,r){let n={b:[],n:\"\",s:!1,a:0,y:!1,i:!1,h:!1};return r.r(e,n).ok}function Tr(e){return r=>xe(r,e)}function dr(e){let r;return{...T,e:\"recursive\",r(n,t){return r||(r={...e()},this.c&&(r.c=this.c),this.l&&(r.l=this.l),this.f&&(r.f=this.f),this.d&&(r.d=this.d),this.p&&(r.p=this.p),this.u&&(r.u=this.u)),r.r(n,t)}}}function Z(e,r,n,t){let s=e.n,o=e.s,a=e.i,u=e.y;e.s=!0,e.n=`${s}|output|`,t||(e.i=!0,e.y=!0);let i=r.r(n,e);return e.i=a,e.y=u,e.n=s,e.s=o,i}function Oe(e,r,{outputSchema:n,disableStrictOutputSchema:t}={}){return{...T,e:`${e.e}_transform`,r(s,o){return f(this,s,o,()=>{let a=null;if(n){let c=Z(o,n,s,t);if(c.ok)return{data:c.data,errors:!1};a=c.errors}let i={...e,e:this.e}.r(s,o);return i.ok?{errors:!1,data:r(i.data,e)}:{errors:[...a||[],...i.errors],data:void 0}})}}}function pr(e,r){return Oe(e,r)}function Rr(e,r,{outputSchema:n,disableStrictOutputSchema:t}={}){return{...T,e:`${e.e}_transform`,r(s,o){return f(this,s,o,()=>{let a=null;if(n){let c=Z(o,n,s,t);if(c.ok)return{errors:!1,data:c.data};a=c.errors}let i={...e,e:this.e}.r(s,o);if(i.ok){let c=r(i.data,e);return c.ok?{errors:!1,data:c.data}:{errors:typeof c.errors==\"string\"?[p(o,c.errors)]:c.errors.map(h=>p(o,h)),data:void 0}}return{errors:[...a||[],...i.errors],data:void 0}})}}}function j(e,r){let n=typeof e,t=(()=>{if(n===\"object\"){if(Array.isArray(e))return\"array\";if(!e)return\"null\"}return typeof e==\"number\"&&Number.isNaN(e)?\"NaN\":n})();return r&&(t===\"string\"||t===\"number\"||t===\"boolean\")?`${t}(${e})`:t}function hr(e){if(e.errors)throw new Error(`invalid input: ${e.errors.join(\", \")}`)}function w(e){return typeof e==\"object\"&&e!==null&&!Array.isArray(e)}function V(e){return e.replace(/\\W+/g,\" \").split(/ |\\B(?=[A-Z])/).map(r=>r.toLowerCase()).join(\"_\")}function je(e,r,n){try{if(typeof e!=\"string\")return{ok:!1,error:!0,errors:[`expected a json string, got ${j(e,!0)}`],unwrap:v,unwrapOr:K,unwrapOrNull:W};let t=JSON.parse(e);return $(t,r,n)}catch(t){return{ok:!1,error:!0,errors:[`json parsing error: ${w(t)?t.message:\"\"}`],unwrap:v,unwrapOr:K,unwrapOrNull:W}}}function U(e){return typeof e==\"function\"}function S(e){return w(e)&&\"__rc_type\"in e}function _r(e){return e}function br(e){return e.e}function gr(e,{errorOnWarnings:r=!1,onWarnings:n}={}){return{\"~standard\":{validate(t){let s=\"ok\"in e?e:$(t,e);return we(s,r,n)},vendor:\"runcheck\",version:1}}}function we(e,r,n){return r&&e.ok&&e.warnings?{issues:e.warnings.map(t=>({message:t}))}:e.ok?(n&&e.warnings&&n(e.warnings),{value:e.value}):{issues:e.errors.map(t=>({message:t}))}}function kr(e,r){let n=e[\"~standard\"];return{...T,e:r||`standard_schema_${n.vendor}@${n.version}`,r(t,s){return f(this,t,s,()=>{let o=n.validate(t);return\"value\"in o?{data:o.value,errors:!1}:\"issues\"in o?{data:void 0,errors:o.issues.map(a=>p(s,a.message))}:!1})}}}export{G as a,x as b,H as c,X as d,Y as e,ee as f,re as g,ne as h,te as i,se as j,F as k,oe as l,ae as m,p as n,f as o,T as p,ze as q,Je as r,Qe as s,Ze as t,Ge as u,He as v,Xe as w,Ye as x,er as y,rr as z,nr as A,_e as B,be as C,ge as D,tr as E,ke as F,sr as G,P as H,or as I,ar as J,E as K,ir as L,ur as M,$ as N,cr as O,lr as P,yr as Q,me as R,I as S,fr as T,xe as U,Tr as V,dr as W,Oe as X,pr as Y,Rr as Z,j as _,hr as $,w as aa,V as ba,je as ca,S as da,_r as ea,br as fa,gr as ga,kr as ha};\n//# sourceMappingURL=chunk-JPCZKLXK.js.map","import { readFileSync, writeFileSync } from 'fs';\nimport path from 'path';\nimport { readdirp, type EntryInfo } from 'readdirp';\nimport {\n rc_null,\n rc_number,\n rc_object,\n rc_parse,\n rc_record,\n rc_string,\n rc_union,\n} from 'runcheck';\nimport type { AITranslator, TranslationContext } from './ai-translator';\nimport {\n getI18nUsagesInCode,\n type I18nUsagesResult,\n type TranslationUsage,\n} from './findMissingTranslations';\nimport { createSimilarityIndex, findSimilarFromIndex } from './similarity';\n\ntype LocaleAITranslationTask = {\n fullPath: string;\n basename: string;\n cleanedExisting: Record<string, unknown>;\n regularMissingHashs: Set<string>;\n missingSpecialTranslations: string[];\n contexts: TranslationContext[];\n extraHashs: Set<string>;\n missingHashs: Set<string>;\n};\n\nexport type FileSystem = {\n readFileSync: (path: string, encoding: 'utf-8') => string;\n writeFileSync: (path: string, content: string) => void;\n scanDir: (\n dirPath: string,\n options: { fileFilter: (entry: { path: string }) => boolean },\n ) =>\n | AsyncIterable<{ fullPath: string; basename: string }>\n | Iterable<{ fullPath: string; basename: string }>;\n};\n\nexport type Logger = Pick<Console, 'log' | 'error' | 'info'>;\n\nexport type ValidationRuleName =\n | 'constant-translation'\n | 'unnecessary-plural'\n | 'jsx-without-interpolation'\n | 'jsx-without-jsx-nodes'\n | 'unnecessary-interpolated-affix'\n | 'max-translation-id-size';\n\nexport type RuleSeverity = 'error' | 'warning' | 'off';\n\nexport type ValidationRuleConfig = {\n [K in ValidationRuleName]?: RuleSeverity;\n};\n\nexport type ValidationOptions = {\n configDir: string;\n srcDir: string;\n defaultLocale?: string;\n fix?: boolean;\n noColor?: boolean;\n colorFn?: (color: 'red', text: string) => string;\n fs?: FileSystem;\n log?: Logger;\n aiTranslator?: AITranslator;\n rules?: ValidationRuleConfig;\n maxTranslationIdSize?: number;\n};\n\nconst pluralTranslationSchema = rc_object({\n manyLimit: rc_number.optional(),\n zero: rc_string.optional(),\n one: rc_string.optional(),\n '+2': rc_union(rc_string, rc_null),\n many: rc_string.optional(),\n});\n\nconst translationValueSchema = rc_union(\n rc_string,\n rc_null,\n pluralTranslationSchema,\n);\n\nconst translationFileSchema = rc_record(translationValueSchema);\n\ntype PluralTranslation = {\n manyLimit?: number;\n zero?: string;\n one?: string;\n '+2': string | null;\n many?: string;\n};\n\ntype TranslationValue = string | null | PluralTranslation;\n\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nconst MISSING_START_MARKER = '👇 missing start 👇';\nconst MISSING_END_MARKER = '👆 missing end 👆';\nconst MISSING_MARKER_VALUE = '🛑 delete this line 🛑';\n\nfunction isMarkerKey(key: string): boolean {\n return key === MISSING_START_MARKER || key === MISSING_END_MARKER;\n}\n\nfunction findMarkerLine(fileContent: string): number | null {\n const lines = fileContent.split('\\n');\n for (let i = 0; i < lines.length; i++) {\n if (lines[i]!.includes(MISSING_START_MARKER)) {\n return i + 1;\n }\n }\n return null;\n}\n\nfunction calculateInsertPosition(totalKeys: number): number {\n if (totalKeys === 0) return 0;\n return Math.floor(Math.random() * totalKeys);\n}\n\nfunction buildOrderedTranslations(\n existing: Record<string, unknown>,\n missing: Map<string, unknown>,\n insertPosition: number,\n addMarkers = true,\n aiTranslated?: Map<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n const existingKeys = Object.keys(existing).filter(\n (k) => k !== '' && !isMarkerKey(k),\n );\n\n const allNewKeys = new Map<string, unknown>();\n if (aiTranslated) {\n for (const [key, value] of aiTranslated) {\n allNewKeys.set(key, value);\n }\n }\n for (const [key, value] of missing) {\n allNewKeys.set(key, value);\n }\n\n let inserted = false;\n for (let i = 0; i < existingKeys.length; i++) {\n if (i === insertPosition && !inserted && allNewKeys.size > 0) {\n if (aiTranslated) {\n for (const [key, value] of aiTranslated) {\n result[key] = value;\n }\n }\n if (missing.size > 0) {\n if (addMarkers) {\n result[MISSING_START_MARKER] = MISSING_MARKER_VALUE;\n }\n for (const [key, value] of missing) {\n result[key] = value;\n }\n if (addMarkers) {\n result[MISSING_END_MARKER] = MISSING_MARKER_VALUE;\n }\n }\n inserted = true;\n }\n const key = existingKeys[i];\n if (key !== undefined) {\n result[key] = existing[key];\n }\n }\n\n if (!inserted && allNewKeys.size > 0) {\n if (aiTranslated) {\n for (const [key, value] of aiTranslated) {\n result[key] = value;\n }\n }\n if (missing.size > 0) {\n if (addMarkers) {\n result[MISSING_START_MARKER] = MISSING_MARKER_VALUE;\n }\n for (const [key, value] of missing) {\n result[key] = value;\n }\n if (addMarkers) {\n result[MISSING_END_MARKER] = MISSING_MARKER_VALUE;\n }\n }\n }\n\n result[''] = '';\n return result;\n}\n\nexport const defaultFs: FileSystem = {\n readFileSync: (filePath, encoding) => readFileSync(filePath, encoding),\n writeFileSync: (filePath, content) => writeFileSync(filePath, content),\n async *scanDir(dirPath, options) {\n for await (const entry_ of readdirp(dirPath, {\n fileFilter: options.fileFilter,\n directoryFilter: (entry) =>\n !entry.path.includes('node_modules') && !entry.path.includes('.git'),\n })) {\n const entry = entry_ as EntryInfo;\n yield { fullPath: entry.fullPath, basename: entry.basename };\n }\n },\n};\n\nfunction hasInterpolationPlaceholder(hash: string): boolean {\n return /\\{[0-9]+\\}/.test(hash);\n}\n\nfunction getInterpolationPrefix(value: string): string {\n const match = value.match(/^(.*?)\\{[0-9]+\\}/);\n return match ? (match[1] ?? '') : '';\n}\n\nfunction getInterpolationSuffix(value: string): string {\n const match = value.match(/\\{[0-9]+\\}([^{]*)$/);\n return match ? (match[1] ?? '') : '';\n}\n\nfunction isIgnoredAffix(value: string): boolean {\n return /^[\\s?!.()\"\"'']*$/.test(value);\n}\n\nfunction isPluralOnlyPlus2(value: Record<string, unknown>): boolean {\n return (\n value.zero === undefined &&\n value.one === undefined &&\n value.many === undefined\n );\n}\n\nfunction getStringValue(value: TranslationValue | undefined): string | null {\n if (value === undefined || value === null) {\n return null;\n }\n if (typeof value === 'string') {\n return value;\n }\n return value['+2'];\n}\n\ntype ValidationIssue = {\n rule: ValidationRuleName;\n hash: string;\n message: string;\n locations: Array<{ file: string; line: number; column: number }>;\n};\n\nfunction formatIssue(\n issue: ValidationIssue,\n severity: 'error' | 'warning',\n srcPath: string,\n): string {\n const icon = severity === 'error' ? '❌' : '⚠️';\n const location = issue.locations[0];\n if (location) {\n const relativePath = path.relative(\n path.dirname(srcPath),\n path.join(srcPath, location.file),\n );\n return `${icon} ${relativePath}:${location.line}:${location.column} ${issue.message}`;\n }\n return `${icon} ${issue.message}`;\n}\n\nexport async function validateTranslations(\n options: ValidationOptions,\n): Promise<{ hasError: boolean }> {\n const {\n configDir,\n srcDir,\n defaultLocale,\n fix = false,\n noColor = false,\n colorFn = (_, text) => text,\n fs = defaultFs,\n log = console,\n aiTranslator,\n rules = {},\n maxTranslationIdSize = 80,\n } = options;\n\n const getRuleSeverity = (rule: ValidationRuleName): RuleSeverity => {\n return rules[rule] ?? 'error';\n };\n\n const allStringTranslationHashs = new Set<string>();\n const allPluralTranslationHashs = new Set<string>();\n let hasError = false;\n\n const srcPath =\n path.isAbsolute(srcDir) ? srcDir : path.join(process.cwd(), srcDir);\n\n const globalUsageMap = new Map<string, TranslationUsage>();\n const globalJsxStringTranslations = new Set<string>();\n const globalJsxPluralTranslations = new Set<string>();\n const globalPrimitiveOnlyJsx = new Set<string>();\n\n for await (const entry of fs.scanDir(srcPath, {\n fileFilter: (entry) =>\n entry.path.endsWith('.ts') || entry.path.endsWith('.tsx'),\n })) {\n const { fullPath } = entry;\n\n const fileTextContent = fs.readFileSync(fullPath, 'utf-8');\n\n const relativePath = path.relative(srcPath, fullPath);\n const i18nUsages: I18nUsagesResult = getI18nUsagesInCode(\n relativePath,\n fileTextContent,\n );\n\n for (const hash of i18nUsages.stringTranslations) {\n allStringTranslationHashs.add(hash);\n }\n\n for (const hash of i18nUsages.pluralTranslations) {\n allPluralTranslationHashs.add(hash);\n }\n\n for (const hash of i18nUsages.jsxStringTranslations) {\n globalJsxStringTranslations.add(hash);\n }\n\n for (const hash of i18nUsages.jsxPluralTranslations) {\n globalJsxPluralTranslations.add(hash);\n }\n\n for (const hash of i18nUsages.primitiveOnlyJsx) {\n globalPrimitiveOnlyJsx.add(hash);\n }\n\n for (const [hash, usage] of i18nUsages.usageMap) {\n const existing = globalUsageMap.get(hash);\n if (existing) {\n existing.locations.push(...usage.locations);\n if (!usage.hasOnlyPrimitiveInterpolations) {\n existing.hasOnlyPrimitiveInterpolations = false;\n }\n } else {\n globalUsageMap.set(hash, { ...usage });\n }\n }\n }\n\n if (\n allStringTranslationHashs.size === 0 &&\n allPluralTranslationHashs.size === 0\n ) {\n log.error('❌ No translations found in dir: ', srcDir);\n return { hasError: true };\n }\n\n const configPath =\n path.isAbsolute(configDir) ? configDir : (\n path.join(process.cwd(), configDir)\n );\n\n const allLocaleTranslations = new Map<\n string,\n Record<string, TranslationValue>\n >();\n const localeFiles: Array<{ fullPath: string; basename: string }> = [];\n\n for await (const entry of fs.scanDir(configPath, {\n fileFilter: (entry) => entry.path.endsWith('.json'),\n })) {\n localeFiles.push(entry);\n }\n\n for (const { fullPath, basename } of localeFiles) {\n const fileParseResult = rc_parse(\n JSON.parse(fs.readFileSync(fullPath, 'utf-8')),\n translationFileSchema,\n );\n if (!fileParseResult.ok) {\n log.error(`❌ ${basename} has invalid format:`, fileParseResult.errors);\n hasError = true;\n continue;\n }\n const localeId = basename.replace('.json', '');\n allLocaleTranslations.set(localeId, fileParseResult.value);\n }\n\n const validationIssues: ValidationIssue[] = [];\n\n const allHashes = new Set([\n ...allStringTranslationHashs,\n ...allPluralTranslationHashs,\n ]);\n\n for (const hash of allHashes) {\n const isSpecial = hash.startsWith('$') || hash.includes('~~');\n if (isSpecial) continue;\n\n const usage = globalUsageMap.get(hash);\n const locations = usage?.locations ?? [];\n\n const maxIdSizeSeverity = getRuleSeverity('max-translation-id-size');\n if (maxIdSizeSeverity !== 'off' && hash.length > maxTranslationIdSize) {\n const truncated = hash.length > 40 ? `${hash.slice(0, 37)}...` : hash;\n validationIssues.push({\n rule: 'max-translation-id-size',\n hash,\n message: `translation ID exceeds ${maxTranslationIdSize} chars (${hash.length}): \"${truncated}\". Use a $shortId instead, e.g.: __\\`$myKey\\``,\n locations,\n });\n }\n\n const constantSeverity = getRuleSeverity('constant-translation');\n if (constantSeverity !== 'off') {\n const values: string[] = [];\n for (const [localeId, translations] of allLocaleTranslations) {\n const value = translations[hash];\n const strValue = getStringValue(value);\n\n const isDefaultLocaleEntry =\n defaultLocale !== undefined && localeId === defaultLocale;\n\n if (strValue !== null) {\n values.push(strValue);\n } else if (isDefaultLocaleEntry) {\n // null or undefined in fallback locale means the original key is used as the translation\n values.push(hash);\n }\n }\n\n if (values.length >= 2 && new Set(values).size === 1) {\n validationIssues.push({\n rule: 'constant-translation',\n hash,\n message: `constant translation \"${hash}\" has the same value in all locales. Either translate it differently per locale, or use plain strings if it doesn't need translation`,\n locations,\n });\n }\n }\n\n const unnecessaryPluralSeverity = getRuleSeverity('unnecessary-plural');\n if (\n unnecessaryPluralSeverity !== 'off' &&\n allPluralTranslationHashs.has(hash)\n ) {\n let allOnlyPlus2 = true;\n let hasAnyPluralTranslation = false;\n\n for (const [, translations] of allLocaleTranslations) {\n const value = translations[hash];\n if (value !== null && value !== undefined && isObject(value)) {\n hasAnyPluralTranslation = true;\n if (!isPluralOnlyPlus2(value)) {\n allOnlyPlus2 = false;\n break;\n }\n }\n }\n\n if (hasAnyPluralTranslation && allOnlyPlus2) {\n validationIssues.push({\n rule: 'unnecessary-plural',\n hash,\n message: `unnecessary plural \"${hash}\" only uses the +2 form in all locales. Use __\\`# items\\` with interpolation instead of __p(count)\\`# items\\`, or add zero/one/many forms if needed`,\n locations,\n });\n }\n }\n\n const jsxWithoutInterpolationSeverity = getRuleSeverity(\n 'jsx-without-interpolation',\n );\n if (jsxWithoutInterpolationSeverity !== 'off') {\n const isJsx =\n globalJsxStringTranslations.has(hash) ||\n globalJsxPluralTranslations.has(hash);\n if (isJsx && !hasInterpolationPlaceholder(hash)) {\n validationIssues.push({\n rule: 'jsx-without-interpolation',\n hash,\n message: `__jsx used without interpolations for \"${hash}\". Use __\\`${hash}\\` instead since there are no JSX elements to interpolate`,\n locations,\n });\n }\n }\n\n const jsxWithoutJsxNodesSeverity = getRuleSeverity('jsx-without-jsx-nodes');\n if (jsxWithoutJsxNodesSeverity !== 'off') {\n const isJsx =\n globalJsxStringTranslations.has(hash) ||\n globalJsxPluralTranslations.has(hash);\n const isPrimitiveOnly = globalPrimitiveOnlyJsx.has(hash);\n if (isJsx && isPrimitiveOnly && hasInterpolationPlaceholder(hash)) {\n validationIssues.push({\n rule: 'jsx-without-jsx-nodes',\n hash,\n message: `__jsx used but all interpolations are primitives (strings/numbers) for \"${hash}\". Use __\\`...\\` instead of __jsx\\`...\\` when not interpolating JSX elements`,\n locations,\n });\n }\n }\n\n const unnecessaryAffixSeverity = getRuleSeverity(\n 'unnecessary-interpolated-affix',\n );\n if (\n unnecessaryAffixSeverity !== 'off' &&\n hasInterpolationPlaceholder(hash)\n ) {\n const prefixes: string[] = [];\n const suffixes: string[] = [];\n\n for (const [localeId, translations] of allLocaleTranslations) {\n const value = translations[hash];\n const strValue = getStringValue(value);\n\n const isDefaultLocaleEntry =\n defaultLocale !== undefined && localeId === defaultLocale;\n\n const effectiveValue =\n strValue !== null ? strValue\n : isDefaultLocaleEntry ? hash\n : null;\n\n if (effectiveValue !== null) {\n prefixes.push(getInterpolationPrefix(effectiveValue));\n suffixes.push(getInterpolationSuffix(effectiveValue));\n }\n }\n\n if (prefixes.length >= 2) {\n const uniquePrefixes = new Set(prefixes);\n const prefix = prefixes[0] ?? '';\n if (\n uniquePrefixes.size === 1 &&\n prefix !== '' &&\n !isIgnoredAffix(prefix)\n ) {\n validationIssues.push({\n rule: 'unnecessary-interpolated-affix',\n hash,\n message: `prefix \"${prefix}\" before interpolation in \"${hash}\" is identical in all locales. Move it outside the translation: \"${prefix}\" + __\\`...\\``,\n locations,\n });\n }\n }\n\n if (suffixes.length >= 2) {\n const uniqueSuffixes = new Set(suffixes);\n const suffix = suffixes[0] ?? '';\n if (\n uniqueSuffixes.size === 1 &&\n suffix !== '' &&\n !isIgnoredAffix(suffix)\n ) {\n validationIssues.push({\n rule: 'unnecessary-interpolated-affix',\n hash,\n message: `suffix \"${suffix}\" after interpolation in \"${hash}\" is identical in all locales. Move it outside the translation: __\\`...\\` + \"${suffix}\"`,\n locations,\n });\n }\n }\n }\n }\n\n for (const issue of validationIssues) {\n const severity = getRuleSeverity(issue.rule);\n if (severity === 'off') continue;\n\n const message = formatIssue(issue, severity, srcPath);\n if (severity === 'error') {\n hasError = true;\n log.error(message);\n } else {\n log.info(message);\n }\n }\n\n const aiTranslationTasks: LocaleAITranslationTask[] = [];\n\n for (const { fullPath, basename } of localeFiles) {\n const invalidPluralTranslations: string[] = [];\n const invalidSpecialTranslations: string[] = [];\n const incompletePluralTranslations: string[] = [];\n\n const localeId = basename.replace('.json', '');\n const localeTranslations = allLocaleTranslations.get(localeId);\n\n if (!localeTranslations) {\n continue;\n }\n\n const isDefaultLocale = basename === `${defaultLocale}.json`;\n\n const localeFileHashs = Object.keys(localeTranslations);\n\n const extraHashs = new Set(localeFileHashs);\n const missingHashs = new Set<string>();\n\n for (const hash of allStringTranslationHashs) {\n // the default locale falls back to the source string, except for `$`\n // ids, whose source string is not displayable text\n if (!isDefaultLocale || hash.startsWith('$')) {\n missingHashs.add(hash);\n }\n }\n\n for (const hash of allPluralTranslationHashs) {\n missingHashs.add(hash);\n }\n\n extraHashs.delete('');\n\n for (const hash of localeFileHashs) {\n if (allStringTranslationHashs.has(hash)) {\n const translationValue = localeTranslations[hash];\n const isNullTranslation = translationValue === null;\n const isShortId = hash.startsWith('$');\n\n const isUnneededDefaultHash =\n isDefaultLocale &&\n !isShortId &&\n (isNullTranslation || translationValue === hash);\n\n const isIncompleteTranslation =\n defaultLocale !== undefined &&\n isNullTranslation &&\n (!isDefaultLocale || isShortId);\n\n if (isUnneededDefaultHash) {\n missingHashs.delete(hash);\n } else if (!isIncompleteTranslation) {\n missingHashs.delete(hash);\n extraHashs.delete(hash);\n }\n\n const isVariantOrPlaceholder =\n hash.includes('~~') || hash.startsWith('$');\n if (isVariantOrPlaceholder && translationValue === hash) {\n invalidSpecialTranslations.push(hash);\n }\n } else if (allPluralTranslationHashs.has(hash)) {\n missingHashs.delete(hash);\n extraHashs.delete(hash);\n\n const pluralValue = localeTranslations[hash];\n if (pluralValue !== undefined && !isObject(pluralValue)) {\n invalidPluralTranslations.push(hash);\n delete localeTranslations[hash];\n\n if (fix) {\n missingHashs.add(hash);\n }\n } else if (\n !isDefaultLocale &&\n isObject(pluralValue) &&\n pluralValue['+2'] === null\n ) {\n incompletePluralTranslations.push(hash);\n }\n } else {\n missingHashs.delete(hash);\n }\n }\n\n if (\n missingHashs.size > 0 ||\n extraHashs.size > 0 ||\n invalidPluralTranslations.length > 0 ||\n invalidSpecialTranslations.length > 0 ||\n incompletePluralTranslations.length > 0\n ) {\n if (!fix) {\n hasError = true;\n\n if (invalidPluralTranslations.length > 0) {\n log.error(\n `❌ ${basename} has invalid plural translations: `,\n invalidPluralTranslations,\n );\n }\n\n if (incompletePluralTranslations.length > 0) {\n log.error(\n `❌ ${basename} has incomplete plural translations ('+2' is null, which is only allowed in the default locale): `,\n incompletePluralTranslations,\n );\n }\n\n if (invalidSpecialTranslations.length > 0) {\n log.error(\n `❌ ${basename} has invalid special translations (value equals key): `,\n invalidSpecialTranslations,\n );\n }\n\n if (missingHashs.size > 0 || extraHashs.size > 0) {\n const parts: string[] = [];\n\n if (missingHashs.size) {\n const countStr =\n noColor ?\n String(missingHashs.size)\n : colorFn('red', String(missingHashs.size));\n parts.push(`missing ${countStr}`);\n }\n\n if (extraHashs.size) {\n const countStr =\n noColor ?\n String(extraHashs.size)\n : colorFn('red', String(extraHashs.size));\n parts.push(`extra ${countStr}`);\n }\n\n const allExtrasAreMarkers =\n extraHashs.size > 0 && [...extraHashs].every((k) => isMarkerKey(k));\n let lineInfo = '';\n if (allExtrasAreMarkers) {\n const fileContent = fs.readFileSync(fullPath, 'utf-8');\n const markerLine = findMarkerLine(fileContent);\n lineInfo = markerLine ? `:${markerLine}` : '';\n }\n\n log.error(\n `❌ ${basename}${lineInfo} has invalid translations: ${parts.join(', ')}`,\n );\n }\n } else {\n if (invalidSpecialTranslations.length > 0) {\n log.error(\n `❌ ${basename} has invalid special translations (value equals key): `,\n invalidSpecialTranslations,\n );\n } else if (\n missingHashs.size === 0 &&\n extraHashs.size > 0 &&\n [...extraHashs].every((k) => isMarkerKey(k))\n ) {\n const fileContent = fs.readFileSync(fullPath, 'utf-8');\n const markerLine = findMarkerLine(fileContent);\n const lineInfo = markerLine ? `:${markerLine}` : '';\n log.error(`❌ ${basename}${lineInfo} has missing translations`);\n } else {\n const cleanedExisting: Record<string, unknown> = {};\n for (const key of Object.keys(localeTranslations)) {\n if (key === '' || isMarkerKey(key) || extraHashs.has(key)) {\n continue;\n }\n cleanedExisting[key] = localeTranslations[key];\n }\n\n const missingSpecialTranslations: string[] = [];\n for (const hash of missingHashs) {\n const isSpecialTranslation =\n hash.startsWith('$') || hash.includes('~~');\n if (isSpecialTranslation) {\n missingSpecialTranslations.push(hash);\n }\n }\n\n const regularMissingHashs = new Set(\n [...missingHashs].filter(\n (h) => !h.startsWith('$') && !h.includes('~~'),\n ),\n );\n\n if (aiTranslator && missingSpecialTranslations.length > 0) {\n hasError = true;\n log.error(\n `❌ ${basename} has missing $ or ~~ translations that require manual translation:`,\n missingSpecialTranslations,\n );\n }\n\n if (aiTranslator && regularMissingHashs.size > 0) {\n const targetLocale = basename.replace('.json', '');\n\n const existingTranslationsMap = new Map<\n string,\n string | PluralTranslation\n >();\n for (const [key, value] of Object.entries(cleanedExisting)) {\n if (\n typeof value === 'string' ||\n (typeof value === 'object' && value !== null)\n ) {\n existingTranslationsMap.set(\n key,\n value as string | PluralTranslation,\n );\n }\n }\n // Include extra translations in the similarity index so that\n // renamed/modified source keys can still benefit from their\n // previous translations as context for AI generation\n for (const extraKey of extraHashs) {\n if (\n isMarkerKey(extraKey) ||\n existingTranslationsMap.has(extraKey)\n ) {\n continue;\n }\n const value = localeTranslations[extraKey];\n if (\n typeof value === 'string' ||\n (typeof value === 'object' && value !== null)\n ) {\n existingTranslationsMap.set(extraKey, value);\n }\n }\n\n const contexts: TranslationContext[] = [];\n const similarityIndex = createSimilarityIndex(\n existingTranslationsMap,\n );\n for (const hash of regularMissingHashs) {\n const isPlural = allPluralTranslationHashs.has(hash);\n const similarTranslations = findSimilarFromIndex(\n similarityIndex,\n hash,\n );\n contexts.push({\n sourceKey: hash,\n targetLocale,\n isPlural,\n similarTranslations,\n });\n }\n\n aiTranslationTasks.push({\n fullPath,\n basename,\n cleanedExisting,\n regularMissingHashs,\n missingSpecialTranslations,\n contexts,\n extraHashs,\n missingHashs,\n });\n } else {\n const missingMap = new Map<string, unknown>();\n\n for (const hash of missingHashs) {\n const value =\n allPluralTranslationHashs.has(hash) ?\n {\n zero: 'No x',\n one: '1 x',\n '+2': '# x',\n many: undefined,\n manyLimit: undefined,\n }\n : null;\n missingMap.set(hash, value);\n }\n\n const existingKeysCount = Object.keys(cleanedExisting).length;\n const insertPosition = calculateInsertPosition(existingKeysCount);\n\n const orderedTranslations = buildOrderedTranslations(\n cleanedExisting,\n missingMap,\n insertPosition,\n missingMap.size > 0,\n );\n\n const writtenContent = JSON.stringify(orderedTranslations, null, 2);\n\n if (missingHashs.size > 0) {\n hasError = true;\n const markerLine = findMarkerLine(writtenContent);\n const lineInfo = markerLine ? `:${markerLine}` : '';\n log.info(\n `🟠 ${basename}${lineInfo} translations keys were added`,\n );\n } else {\n log.info(`✅ ${basename} translations fixed`);\n }\n\n fs.writeFileSync(fullPath, writtenContent);\n }\n }\n }\n } else {\n log.info(`✅ ${basename} translations are up to date`);\n }\n }\n\n if (aiTranslationTasks.length > 0) {\n const aiResults = await Promise.all(\n aiTranslationTasks.map(async (task) => {\n try {\n const result = await aiTranslator!.translateBatch(task.contexts);\n return { task, result, error: null };\n } catch (error) {\n return { task, result: null, error };\n }\n }),\n );\n\n for (const { task, result, error } of aiResults) {\n const {\n fullPath,\n basename,\n cleanedExisting,\n regularMissingHashs,\n missingSpecialTranslations,\n missingHashs,\n } = task;\n\n const missingMap = new Map<string, unknown>();\n const aiTranslatedMap = new Map<string, unknown>();\n\n if (error) {\n log.error(\n `❌ AI translation failed for ${basename}:`,\n error instanceof Error ? error.message : error,\n );\n for (const hash of regularMissingHashs) {\n const value =\n allPluralTranslationHashs.has(hash) ?\n {\n zero: 'No x',\n one: '1 x',\n '+2': '# x',\n many: undefined,\n manyLimit: undefined,\n }\n : null;\n missingMap.set(hash, value);\n }\n } else if (result) {\n const { translations: aiTranslations, model, usage } = result;\n\n for (const hash of regularMissingHashs) {\n const aiResult = aiTranslations.get(hash);\n if (aiResult) {\n aiTranslatedMap.set(hash, aiResult.value);\n } else {\n const fallbackValue =\n allPluralTranslationHashs.has(hash) ?\n {\n zero: 'No x',\n one: '1 x',\n '+2': '# x',\n many: undefined,\n manyLimit: undefined,\n }\n : null;\n missingMap.set(hash, fallbackValue);\n }\n }\n\n if (model || usage) {\n const parts: string[] = [];\n if (model) parts.push(`Model: ${model}`);\n if (usage)\n parts.push(\n `Tokens: ${usage.inputTokens} in / ${usage.outputTokens} out`,\n );\n log.info(` ${basename}: ${parts.join(' | ')}`);\n }\n }\n\n for (const hash of missingSpecialTranslations) {\n const value =\n allPluralTranslationHashs.has(hash) ?\n {\n zero: 'No x',\n one: '1 x',\n '+2': '# x',\n many: undefined,\n manyLimit: undefined,\n }\n : null;\n missingMap.set(hash, value);\n }\n\n const existingKeysCount = Object.keys(cleanedExisting).length;\n const insertPosition = calculateInsertPosition(existingKeysCount);\n\n const orderedTranslations = buildOrderedTranslations(\n cleanedExisting,\n missingMap,\n insertPosition,\n missingMap.size > 0,\n aiTranslatedMap.size > 0 ? aiTranslatedMap : undefined,\n );\n\n const writtenContent = JSON.stringify(orderedTranslations, null, 2);\n\n if (missingHashs.size > 0) {\n if (missingMap.size === 0) {\n log.info(`✅ ${basename} translations were AI-generated`);\n } else {\n hasError = true;\n const markerLine = findMarkerLine(writtenContent);\n const lineInfo = markerLine ? `:${markerLine}` : '';\n log.info(`🟠 ${basename}${lineInfo} translations keys were added`);\n }\n } else {\n log.info(`✅ ${basename} translations fixed`);\n }\n\n fs.writeFileSync(fullPath, writtenContent);\n }\n }\n\n return { hasError };\n}\n","import {\n createAITranslator,\n loadEnvFiles,\n validateTranslations,\n type AIProvider,\n type AITranslator,\n type ValidationRuleConfig,\n type ValidationRuleName,\n} from '@ls-stack/i18n-core/cli';\nimport { consoleFmt as c } from '@ls-stack/utils/consoleFmt';\nimport { typeFlag } from 'type-flag';\n\nloadEnvFiles();\n\nconst parsed = typeFlag({\n 'config-dir': {\n type: String,\n alias: 'c',\n },\n 'src-dir': {\n type: String,\n alias: 'r',\n },\n default: {\n type: String,\n alias: 'd',\n },\n fix: {\n type: Boolean,\n alias: 'f',\n default: false,\n },\n 'no-color': {\n type: Boolean,\n default: false,\n },\n ai: {\n type: String,\n },\n 'max-id-size': {\n type: Number,\n default: 80,\n },\n 'disable-rule': {\n type: [String],\n default: [],\n },\n 'warn-rule': {\n type: [String],\n default: [],\n },\n});\n\nconst srcDir = parsed.flags['src-dir'];\nif (!srcDir) {\n console.error('--src-dir is required');\n process.exit(1);\n}\n\nconst configDir = parsed.flags['config-dir'];\nif (!configDir) {\n console.error('--config-dir is required');\n process.exit(1);\n}\n\nlet aiTranslator: AITranslator | undefined;\n\nconst aiProviderInput =\n parsed.flags.ai ?? process.env['I18N_AI_AUTO_TRANSLATE'];\n\nif (aiProviderInput) {\n if (aiProviderInput !== 'google' && aiProviderInput !== 'openai') {\n console.error(\n `Invalid AI provider: ${aiProviderInput}. Must be 'google' or 'openai'.`,\n );\n process.exit(1);\n }\n\n const provider: AIProvider = aiProviderInput;\n\n const apiKeyEnvVar =\n provider === 'google' ?\n 'GOOGLE_GENERATIVE_AI_API_KEY'\n : 'OPENAI_API_KEY';\n const hasApiKey = Boolean(process.env[apiKeyEnvVar]);\n\n if (!hasApiKey) {\n console.warn(\n `Warning: ${apiKeyEnvVar} not set. AI translation will be skipped.`,\n );\n } else {\n aiTranslator = createAITranslator(provider);\n }\n}\n\nconst validRuleNames: ValidationRuleName[] = [\n 'constant-translation',\n 'unnecessary-plural',\n 'jsx-without-interpolation',\n 'jsx-without-jsx-nodes',\n 'unnecessary-interpolated-affix',\n 'max-translation-id-size',\n];\n\nconst rules: ValidationRuleConfig = {};\n\nfor (const rule of parsed.flags['disable-rule']) {\n if (!validRuleNames.includes(rule as ValidationRuleName)) {\n console.error(`Unknown rule: ${rule}`);\n process.exit(1);\n }\n rules[rule as ValidationRuleName] = 'off';\n}\n\nfor (const rule of parsed.flags['warn-rule']) {\n if (!validRuleNames.includes(rule as ValidationRuleName)) {\n console.error(`Unknown rule: ${rule}`);\n process.exit(1);\n }\n rules[rule as ValidationRuleName] = 'warning';\n}\n\nconst { hasError } = await validateTranslations({\n srcDir,\n configDir,\n defaultLocale: parsed.flags.default,\n fix: parsed.flags.fix,\n noColor: parsed.flags['no-color'],\n colorFn: (color: string, text: string) => c.color(color as 'red', text),\n aiTranslator,\n rules,\n maxTranslationIdSize: parsed.flags['max-id-size'],\n});\n\nif (hasError) {\n process.exit(1);\n}\n"],"x_google_ignoreList":[2,3,7,8],"mappings":";;;;;;;;;;;;;AASA,MAAM,gBAAgB;AAiBtB,SAAS,kBAAiC;AACxC,QAAO,QAAQ,IAAI,0BAA0B;;AAG/C,SAAS,eAAe,QAAsB;CAC5C,MAAM,QAAQ,GACX,YAAY,OAAO,CACnB,QAAQ,MAAM,EAAE,WAAW,UAAU,IAAI,EAAE,SAAS,QAAQ,CAAC,CAC7D,MAAM;AAET,QAAO,MAAM,UAAU,eAAe;EACpC,MAAM,SAAS,MAAM,OAAO;AAC5B,MA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