UNPKG

translatinator

Version:

Automated translation management for web applications. Supports multiple translation engines (Google, DeepL, Yandex, LibreTranslate)

1 lines 44.6 kB
{"version":3,"sources":["../src/translator.ts","../src/cache.ts","../src/logger.ts","../src/translatinator.ts","../src/config.ts","../src/index.ts"],"sourcesContent":["import translate from \"translate\";\nimport { TranslatinatorConfig, TranslationCache, TranslationEntry } from './types';\nimport { CacheManager } from './cache';\nimport { Logger } from './logger';\n\nexport class TranslationService {\n private cache: CacheManager;\n private logger: Logger;\n private config: TranslatinatorConfig;\n\n constructor(config: TranslatinatorConfig, cache: CacheManager, logger: Logger) {\n this.config = config;\n this.cache = cache;\n this.logger = logger;\n this.setupTranslateEngine();\n }\n\n private setupTranslateEngine(): void {\n // Set the translation engine\n translate.engine = this.config.engine || 'google';\n \n // Set API key if provided\n if (this.config.apiKey) {\n translate.key = this.config.apiKey;\n } \n \n // Set custom endpoint URL if provided (for LibreTranslate, etc.)\n if (this.config.endpointUrl) {\n // Note: url setting might not be available in all versions of the translate package\n // This is for LibreTranslate or custom endpoints\n try {\n (translate as any).url = this.config.endpointUrl;\n } catch (error) {\n this.logger.warn('Custom endpoint URL setting is not supported by this version of the translate package');\n }\n }\n\n this.logger.debug(`Translation engine set to: ${translate.engine}`);\n }\n\n async translateText(text: string, targetLang: string, sourceLang: string = 'en'): Promise<string> {\n // Check cache first\n const cached = this.cache.getCachedTranslation(text, targetLang);\n if (cached && !this.config.force) {\n this.logger.debug(`Using cached translation for \"${text}\" -> ${targetLang}`);\n return cached.translated;\n }\n\n try {\n this.logger.debug(`Translating \"${text}\" from ${sourceLang} to ${targetLang}`);\n \n const translatedText = await translate(text, {\n from: sourceLang,\n to: targetLang\n });\n \n // Cache the translation\n this.cache.setCachedTranslation(text, targetLang, {\n original: text,\n translated: translatedText,\n timestamp: Date.now(),\n version: '1.0.0'\n });\n\n return translatedText;\n } catch (error) {\n this.logger.error(`Failed to translate \"${text}\" to ${targetLang}:`, error);\n throw error;\n }\n }\n\n async translateObject(obj: any, targetLang: string, sourceLang: string = 'en'): Promise<any> {\n if (typeof obj === 'string') {\n return await this.translateText(obj, targetLang, sourceLang);\n }\n\n if (Array.isArray(obj)) {\n const results = [];\n for (const item of obj) {\n results.push(await this.translateObject(item, targetLang, sourceLang));\n }\n return results;\n }\n\n if (typeof obj === 'object' && obj !== null) {\n const result: any = {};\n for (const [key, value] of Object.entries(obj)) {\n // Check if this key should be excluded\n if (this.shouldExcludeKey(key)) {\n result[key] = value;\n continue;\n }\n\n result[key] = await this.translateObject(value, targetLang, sourceLang);\n }\n return result;\n }\n\n return obj;\n }\n\n private shouldExcludeKey(key: string): boolean {\n if (!this.config.excludeKeys) return false;\n return this.config.excludeKeys.includes(key);\n }\n\n async getUsage(): Promise<any> {\n try {\n // The translate package doesn't provide usage information\n // This is a limitation when moving away from DeepL\n // We'll return a mock response or throw an error\n this.logger.warn('Usage information is not available with the current translation engine');\n return {\n character: { \n count: 0, \n limit: 'unlimited' \n },\n engine: translate.engine\n };\n } catch (error) {\n this.logger.error('Failed to get API usage:', error);\n throw error;\n }\n }\n}\n","import fs from 'fs-extra';\nimport * as path from 'path';\nimport { TranslationCache, TranslationEntry } from './types';\nimport { Logger } from './logger';\n\nexport class CacheManager {\n private cacheDir: string;\n private cachePath: string;\n private cache: TranslationCache;\n private logger: Logger;\n\n constructor(cacheDir: string, logger: Logger) {\n this.cacheDir = cacheDir;\n this.cachePath = path.join(cacheDir, 'translations.json');\n this.cache = {};\n this.logger = logger;\n }\n\n async initialize(): Promise<void> {\n try {\n await fs.ensureDir(this.cacheDir);\n \n if (await fs.pathExists(this.cachePath)) {\n const cacheData = await fs.readJson(this.cachePath);\n this.cache = cacheData || {};\n this.logger.debug(`Loaded translation cache with ${Object.keys(this.cache).length} entries`);\n } else {\n this.logger.debug('No existing cache found, starting fresh');\n }\n } catch (error) {\n this.logger.warn('Failed to load translation cache:', error);\n this.cache = {};\n }\n }\n\n getCachedTranslation(sourceText: string, targetLang: string): TranslationEntry | null {\n if (this.cache[sourceText] && this.cache[sourceText][targetLang]) {\n return this.cache[sourceText][targetLang];\n }\n return null;\n }\n\n setCachedTranslation(sourceText: string, targetLang: string, entry: TranslationEntry): void {\n if (!this.cache[sourceText]) {\n this.cache[sourceText] = {};\n }\n this.cache[sourceText][targetLang] = entry;\n }\n\n async saveCache(): Promise<void> {\n try {\n await fs.ensureDir(this.cacheDir);\n await fs.writeJson(this.cachePath, this.cache, { spaces: 2 });\n this.logger.debug('Translation cache saved successfully');\n } catch (error) {\n this.logger.error('Failed to save translation cache:', error);\n }\n }\n\n async clearCache(): Promise<void> {\n try {\n this.cache = {};\n if (await fs.pathExists(this.cachePath)) {\n await fs.remove(this.cachePath);\n }\n this.logger.info('Translation cache cleared');\n } catch (error) {\n this.logger.error('Failed to clear translation cache:', error);\n }\n }\n\n getCacheStats(): { totalEntries: number; languages: string[] } {\n const languages = new Set<string>();\n let totalEntries = 0;\n\n for (const sourceText in this.cache) {\n for (const lang in this.cache[sourceText]) {\n languages.add(lang);\n totalEntries++;\n }\n }\n\n return {\n totalEntries,\n languages: Array.from(languages)\n };\n }\n}\n","export class Logger {\n private verbose: boolean;\n\n constructor(verbose: boolean = false) {\n this.verbose = verbose;\n }\n\n info(message: string, ...args: any[]): void {\n console.log(`[INFO] ${message}`, ...args);\n }\n\n error(message: string, ...args: any[]): void {\n console.error(`[ERROR] ${message}`, ...args);\n }\n\n warn(message: string, ...args: any[]): void {\n console.warn(`[WARN] ${message}`, ...args);\n }\n\n debug(message: string, ...args: any[]): void {\n if (this.verbose) {\n console.log(`[DEBUG] ${message}`, ...args);\n }\n }\n\n success(message: string, ...args: any[]): void {\n console.log(`[SUCCESS] ${message}`, ...args);\n }\n}\n","import fs from 'fs-extra';\nimport * as path from 'path';\nimport * as chokidar from 'chokidar';\nimport { TranslatinatorConfig } from './types';\nimport { TranslationService } from './translator';\nimport { CacheManager } from './cache';\nimport { Logger } from './logger';\n\nexport class Translatinator {\n private config: TranslatinatorConfig;\n private translator: TranslationService;\n private cache: CacheManager;\n private logger: Logger;\n private watcher?: chokidar.FSWatcher;\n\n constructor(config: TranslatinatorConfig) {\n this.config = {\n engine: 'google',\n watch: false,\n force: false,\n filePattern: '{lang}.json',\n preserveFormatting: true,\n cacheDir: '.translatinator-cache',\n verbose: false,\n ...config\n };\n\n this.logger = new Logger(this.config.verbose);\n this.cache = new CacheManager(this.config.cacheDir!, this.logger);\n this.translator = new TranslationService(this.config, this.cache, this.logger);\n }\n\n async initialize(): Promise<void> {\n await this.cache.initialize();\n this.logger.info('Translatinator initialized');\n }\n\n async translateAll(): Promise<void> {\n try {\n this.logger.info('Starting translation process...');\n\n // Ensure locales directory exists\n await fs.ensureDir(this.config.localesDir);\n\n // Read source file\n const sourceFilePath = path.join(this.config.localesDir, this.config.sourceFile);\n \n if (!(await fs.pathExists(sourceFilePath))) {\n throw new Error(`Source file not found: ${sourceFilePath}`);\n }\n\n const sourceData = await fs.readJson(sourceFilePath);\n this.logger.info(`Loaded source data from ${this.config.sourceFile}`);\n\n // Translate to each target language\n for (const targetLang of this.config.targetLanguages) {\n await this.translateToLanguage(sourceData, targetLang);\n }\n\n // Save cache\n await this.cache.saveCache();\n \n this.logger.success('Translation process completed successfully!');\n } catch (error) {\n this.logger.error('Translation process failed:', error);\n throw error;\n }\n }\n\n private async translateToLanguage(sourceData: any, targetLang: string): Promise<void> {\n this.logger.info(`Translating to ${targetLang}...`);\n\n try {\n const targetFileName = this.config.filePattern!.replace('{lang}', targetLang);\n const targetFilePath = path.join(this.config.localesDir, targetFileName);\n\n // Load existing translations if not forcing\n let existingData = {};\n const fileExists = await fs.pathExists(targetFilePath);\n if (!this.config.force && fileExists) {\n existingData = await fs.readJson(targetFilePath);\n this.logger.debug(`Loaded existing translations for ${targetLang}`);\n }\n\n // When not forcing, preserve existing translations and only add missing keys\n let finalData: any;\n let translationsPerformed = false;\n\n if (this.config.force) {\n // Force mode: completely replace with new translations\n finalData = await this.translator.translateObject(sourceData, targetLang);\n translationsPerformed = true;\n } else {\n // Non-force mode: preserve existing values, only translate missing keys\n finalData = { ...existingData };\n const keysToTranslate = this.getMissingKeys(sourceData, existingData);\n \n if (Object.keys(keysToTranslate).length > 0) {\n const newTranslations = await this.translator.translateObject(keysToTranslate, targetLang);\n finalData = this.deepMerge(finalData, newTranslations);\n translationsPerformed = true;\n }\n }\n\n // Only write the file if translations were performed or file doesn't exist\n if (translationsPerformed || !fileExists) {\n await fs.writeJson(targetFilePath, finalData, { spaces: 2 });\n \n if (translationsPerformed) {\n this.logger.success(`✓ Created/updated ${targetFileName}`);\n } else {\n this.logger.success(`✓ Created ${targetFileName}`);\n }\n } else {\n this.logger.success(`✓ No translation required for ${targetFileName}`);\n }\n } catch (error) {\n this.logger.error(`Failed to translate to ${targetLang}:`, error);\n throw error;\n }\n }\n\n private deepMerge(target: any, source: any): any {\n if (typeof source !== 'object' || source === null) {\n return source;\n }\n\n if (Array.isArray(source)) {\n return source;\n }\n\n const result = { ...target };\n\n for (const key in source) {\n if (source.hasOwnProperty(key)) {\n if (typeof source[key] === 'object' && source[key] !== null && !Array.isArray(source[key])) {\n result[key] = this.deepMerge(result[key] || {}, source[key]);\n } else {\n result[key] = source[key];\n }\n }\n }\n\n return result;\n }\n\n private getMissingKeys(source: any, existing: any): any {\n if (typeof source !== 'object' || source === null) {\n return source;\n }\n\n if (Array.isArray(source)) {\n return source;\n }\n\n const result: any = {};\n\n for (const key in source) {\n if (source.hasOwnProperty(key)) {\n if (!(key in existing)) {\n // Key is missing, include it\n result[key] = source[key];\n } else if (typeof source[key] === 'object' && source[key] !== null && !Array.isArray(source[key])) {\n // Recursively check nested objects\n const nestedMissing = this.getMissingKeys(source[key], existing[key] || {});\n if (Object.keys(nestedMissing).length > 0) {\n result[key] = nestedMissing;\n }\n }\n }\n }\n\n return result;\n }\n\n async startWatching(): Promise<void> {\n if (!this.config.watch) {\n this.logger.warn('Watch mode is not enabled in configuration');\n return;\n }\n\n const sourceFilePath = path.join(this.config.localesDir, this.config.sourceFile);\n \n this.logger.info(`Starting file watcher for ${sourceFilePath}...`);\n\n this.watcher = chokidar.watch(sourceFilePath, {\n persistent: true,\n ignoreInitial: true\n });\n\n this.watcher.on('change', async () => {\n this.logger.info('Source file changed, triggering retranslation...');\n try {\n await this.translateAll();\n } catch (error) {\n this.logger.error('Auto-translation failed:', error);\n }\n });\n\n this.logger.info('File watcher started successfully');\n }\n\n async stopWatching(): Promise<void> {\n if (this.watcher) {\n await this.watcher.close();\n this.logger.info('File watcher stopped');\n }\n }\n\n async clearCache(): Promise<void> {\n await this.cache.clearCache();\n }\n\n async getUsageInfo(): Promise<any> {\n try {\n const usage = await this.translator.getUsage();\n const cacheStats = this.cache.getCacheStats();\n \n return {\n deeplUsage: usage,\n cacheStats\n };\n } catch (error) {\n this.logger.error('Failed to get usage info:', error);\n throw error;\n }\n }\n\n}\n","import fs from 'fs-extra';\nimport * as path from 'path';\nimport { TranslatinatorConfig } from './types';\n\nexport class ConfigLoader {\n static async loadConfig(configPath?: string): Promise<TranslatinatorConfig> {\n const defaultConfig: Partial<TranslatinatorConfig> = {\n engine: 'google',\n sourceFile: 'en.json',\n localesDir: './locales',\n watch: false,\n force: false,\n filePattern: '{lang}.json',\n preserveFormatting: true,\n cacheDir: '.translatinator-cache',\n verbose: false,\n targetLanguages: [],\n excludeKeys: []\n };\n\n // Load environment variables first (lowest priority)\n const envConfig: Partial<TranslatinatorConfig> = {};\n \n // Support both new and legacy environment variables\n if (process.env.TRANSLATION_API_KEY) {\n envConfig.apiKey = process.env.TRANSLATION_API_KEY;\n } else if (process.env.DEEPL_API_KEY) {\n envConfig.apiKey = process.env.DEEPL_API_KEY;\n envConfig.engine = 'deepl'; // Auto-set engine if using legacy env var\n }\n \n if (process.env.TRANSLATION_ENGINE) {\n envConfig.engine = process.env.TRANSLATION_ENGINE as any;\n }\n \n if (process.env.TRANSLATION_ENDPOINT_URL) {\n envConfig.endpointUrl = process.env.TRANSLATION_ENDPOINT_URL;\n }\n \n if (process.env.TRANSLATINATOR_SOURCE_FILE) {\n envConfig.sourceFile = process.env.TRANSLATINATOR_SOURCE_FILE;\n }\n \n if (process.env.TRANSLATINATOR_TARGET_LANGUAGES) {\n envConfig.targetLanguages = process.env.TRANSLATINATOR_TARGET_LANGUAGES.split(',');\n }\n\n // If a specific config path is provided, only try to load that file\n if (configPath) {\n if (await fs.pathExists(configPath)) {\n const fileExt = path.extname(configPath);\n let userConfig: Partial<TranslatinatorConfig> = {};\n\n if (fileExt === '.js') {\n // For JS files, we'll need to require them\n const configModule = require(path.resolve(configPath));\n userConfig = configModule.default || configModule;\n } else {\n // For JSON files\n userConfig = await fs.readJson(configPath);\n }\n\n // Config file takes precedence over environment variables\n return { ...defaultConfig, ...envConfig, ...userConfig } as TranslatinatorConfig;\n }\n \n // If specific path was provided but doesn't exist, just use defaults + env vars\n return { ...defaultConfig, ...envConfig } as TranslatinatorConfig;\n }\n\n // No specific path provided, search for config files in current directory\n const possibleConfigPaths = [\n 'translatinator.config.js',\n 'translatinator.config.json',\n '.translatinatorrc',\n '.translatinatorrc.json'\n ];\n\n for (const configFile of possibleConfigPaths) {\n if (await fs.pathExists(configFile)) {\n const fileExt = path.extname(configFile);\n let userConfig: Partial<TranslatinatorConfig> = {};\n\n if (fileExt === '.js') {\n // For JS files, we'll need to require them\n const configModule = require(path.resolve(configFile));\n userConfig = configModule.default || configModule;\n } else {\n // For JSON files\n userConfig = await fs.readJson(configFile);\n }\n\n // Config file takes precedence over environment variables\n return { ...defaultConfig, ...envConfig, ...userConfig } as TranslatinatorConfig;\n }\n }\n\n // No config file found, use defaults + environment variables\n return { ...defaultConfig, ...envConfig } as TranslatinatorConfig;\n }\n\n static async createSampleConfig(outputPath: string = 'translatinator.config.json'): Promise<void> {\n const sampleConfig: TranslatinatorConfig = {\n engine: 'google',\n apiKey: 'your-api-key-here',\n sourceFile: 'en.json',\n targetLanguages: ['de', 'fr', 'es', 'it', 'nl', 'pl'],\n localesDir: './locales',\n watch: false,\n force: false,\n filePattern: '{lang}.json',\n preserveFormatting: true,\n excludeKeys: ['version', 'build', 'debug'],\n cacheDir: '.translatinator-cache',\n verbose: false\n };\n\n await fs.writeJson(outputPath, sampleConfig, { spaces: 2 });\n }\n}\n","import { Translatinator } from './translatinator';\nimport { ConfigLoader } from './config';\n\nexport { Translatinator, ConfigLoader };\nexport * from './types';\n\n// Main programmatic API\nexport async function translate(configPath?: string): Promise<void> {\n const config = await ConfigLoader.loadConfig(configPath);\n\n // Check for API key\n const hasApiKey = config.apiKey;\n if (!hasApiKey || hasApiKey === 'your-api-key-here') {\n throw new Error('API key is required. Set it in config file or TRANSLATION_API_KEY environment variable.');\n }\n\n if (!config.targetLanguages || config.targetLanguages.length === 0) {\n throw new Error('Target languages must be specified in configuration.');\n }\n\n const translatinator = new Translatinator(config);\n await translatinator.initialize();\n await translatinator.translateAll();\n\n if (config.watch) {\n await translatinator.startWatching();\n // Keep the process running\n process.on('SIGINT', async () => {\n await translatinator.stopWatching();\n process.exit(0);\n });\n }\n}\n\n// Webpack plugin\nexport class TranslatinatorWebpackPlugin {\n private config: any;\n\n constructor(options: any = {}) {\n this.config = options;\n }\n\n apply(compiler: any): void {\n compiler.hooks.beforeCompile.tapAsync('TranslatinatorWebpackPlugin', async (params: any, callback: Function) => {\n try {\n await translate(this.config.configPath);\n callback();\n } catch (error) {\n callback(error);\n }\n });\n }\n}\n\n// Next.js plugin for development mode with file watching\nexport class TranslatinatorNextPlugin {\n private config: any;\n private translatinator?: any;\n private watcher?: any;\n private isInitialized = false;\n\n constructor(options: any = {}) {\n this.config = options;\n }\n\n apply(nextConfig: any = {}): any {\n return {\n ...nextConfig,\n webpack: (webpackConfig: any, { dev, isServer }: { dev: boolean; isServer: boolean }) => {\n // Only run on the server-side in development mode\n if (dev && isServer && !this.isInitialized) {\n // Use setImmediate to avoid blocking the webpack compilation\n setImmediate(() => {\n this.setupDevModeTranslation();\n });\n this.isInitialized = true;\n }\n\n // Call the original webpack function if it exists\n if (typeof nextConfig.webpack === 'function') {\n return nextConfig.webpack(webpackConfig, { dev, isServer });\n }\n\n return webpackConfig;\n },\n // Add experimental support for Turbopack\n experimental: {\n ...nextConfig.experimental,\n turbo: {\n ...nextConfig.experimental?.turbo,\n // Ensure our plugin works with Turbopack\n rules: {\n ...nextConfig.experimental?.turbo?.rules,\n },\n },\n },\n };\n }\n\n private async setupDevModeTranslation(): Promise<void> {\n try {\n const { Translatinator } = await import('./translatinator');\n const { ConfigLoader } = await import('./config');\n\n const config = await ConfigLoader.loadConfig(this.config.configPath);\n \n // Check for API key\n const hasApiKey = config.apiKey;\n if (!hasApiKey || hasApiKey === 'your-api-key-here') {\n console.warn('[Translatinator] No API key found, skipping translation setup');\n return;\n }\n\n if (!config.targetLanguages || config.targetLanguages.length === 0) {\n console.warn('[Translatinator] No target languages specified, skipping translation setup');\n return;\n }\n\n // Initialize translatinator\n this.translatinator = new Translatinator(config);\n await this.translatinator.initialize();\n\n // Run initial translation\n await this.translatinator.translateAll();\n\n // Set up file watching\n await this.setupFileWatcher(config);\n\n console.log('[Translatinator] Dev mode translation setup complete. Watching for changes...');\n } catch (error) {\n console.error('[Translatinator] Failed to setup dev mode translation:', error);\n }\n }\n\n private async setupFileWatcher(config: any): Promise<void> {\n const chokidar = await import('chokidar');\n const path = await import('path');\n\n const sourceFilePath = path.join(config.localesDir, config.sourceFile);\n \n this.watcher = chokidar.watch(sourceFilePath, {\n persistent: true,\n ignoreInitial: true\n });\n\n this.watcher.on('change', async () => {\n console.log('[Translatinator] Source file changed, updating translations...');\n try {\n if (this.translatinator) {\n await this.translatinator.translateAll();\n console.log('[Translatinator] Translations updated successfully');\n }\n } catch (error) {\n console.error('[Translatinator] Auto-translation failed:', error);\n }\n });\n\n // Cleanup on process exit\n process.on('SIGINT', async () => {\n if (this.watcher) {\n await this.watcher.close();\n }\n });\n\n process.on('SIGTERM', async () => {\n if (this.watcher) {\n await this.watcher.close();\n }\n });\n }\n}\n\n// Simplified function for Next.js integration\nexport function withTranslatinator(options: any = {}) {\n const plugin = new TranslatinatorNextPlugin(options);\n \n return (nextConfig: any = {}) => {\n return plugin.apply(nextConfig);\n };\n}\n\n// Standalone development watcher for Turbopack and other scenarios\nexport class TranslatinatorDevServer {\n private config: any;\n private translatinator?: any;\n private watcher?: any;\n private isRunning = false;\n\n constructor(options: any = {}) {\n this.config = options;\n }\n\n async start(): Promise<void> {\n if (this.isRunning) {\n console.log('[Translatinator Dev] Already running...');\n return;\n }\n\n try {\n const { Translatinator } = await import('./translatinator');\n const { ConfigLoader } = await import('./config');\n\n const config = await ConfigLoader.loadConfig(this.config.configPath);\n \n // Check for API key\n const hasApiKey = config.apiKey;\n if (!hasApiKey || hasApiKey === 'your-api-key-here') {\n console.warn('[Translatinator Dev] No API key found, translation watcher not started');\n return;\n }\n\n if (!config.targetLanguages || config.targetLanguages.length === 0) {\n console.warn('[Translatinator Dev] No target languages specified, translation watcher not started');\n return;\n }\n\n // Initialize translatinator\n this.translatinator = new Translatinator(config);\n await this.translatinator.initialize();\n\n // Run initial translation\n console.log('[Translatinator Dev] Running initial translation...');\n await this.translatinator.translateAll();\n\n // Set up file watching\n await this.setupFileWatcher(config);\n\n this.isRunning = true;\n console.log('[Translatinator Dev] Translation watcher started successfully! 🚀');\n console.log('[Translatinator Dev] Watching for changes in:', config.sourceFile);\n } catch (error) {\n console.error('[Translatinator Dev] Failed to start translation watcher:', error);\n }\n }\n\n async stop(): Promise<void> {\n if (this.watcher) {\n await this.watcher.close();\n this.watcher = undefined;\n }\n this.isRunning = false;\n console.log('[Translatinator Dev] Translation watcher stopped');\n }\n\n private async setupFileWatcher(config: any): Promise<void> {\n const chokidar = await import('chokidar');\n const path = await import('path');\n\n const sourceFilePath = path.join(config.localesDir, config.sourceFile);\n \n this.watcher = chokidar.watch(sourceFilePath, {\n persistent: true,\n ignoreInitial: true\n });\n\n this.watcher.on('change', async () => {\n console.log('[Translatinator Dev] 📝 Source file changed, updating translations...');\n try {\n if (this.translatinator) {\n await this.translatinator.translateAll();\n console.log('[Translatinator Dev] ✅ Translations updated successfully');\n }\n } catch (error) {\n console.error('[Translatinator Dev] ❌ Auto-translation failed:', error);\n }\n });\n\n // Cleanup on process exit\n const cleanup = async () => {\n await this.stop();\n };\n\n process.on('SIGINT', cleanup);\n process.on('SIGTERM', cleanup);\n process.on('beforeExit', cleanup);\n }\n}\n\n// Enhanced Next.js integration that works with both Webpack and Turbopack\nexport function withTranslatinatorDev(options: any = {}) {\n let devServer: TranslatinatorDevServer | null = null;\n \n return (nextConfig: any = {}) => {\n const config = {\n ...nextConfig,\n webpack: (webpackConfig: any, { dev, isServer }: { dev: boolean; isServer: boolean }) => {\n // Only run on the server-side in development mode\n if (dev && isServer && !devServer) {\n devServer = new TranslatinatorDevServer(options);\n // Start the dev server asynchronously to not block webpack\n setImmediate(() => {\n devServer?.start();\n });\n }\n\n // Call the original webpack function if it exists\n if (typeof nextConfig.webpack === 'function') {\n return nextConfig.webpack(webpackConfig, { dev, isServer });\n }\n\n return webpackConfig;\n },\n };\n\n // Handle process cleanup\n if (typeof process !== 'undefined') {\n const cleanup = async () => {\n if (devServer) {\n await devServer.stop();\n }\n };\n\n process.on('SIGINT', cleanup);\n process.on('SIGTERM', cleanup);\n process.on('beforeExit', cleanup);\n }\n\n return config;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sBAKa;AALb;AAAA;AAAA;AAAA,uBAAsB;AAKf,IAAM,qBAAN,MAAyB;AAAA,MAK9B,YAAY,QAA8B,OAAqB,QAAgB;AAC7E,aAAK,SAAS;AACd,aAAK,QAAQ;AACb,aAAK,SAAS;AACd,aAAK,qBAAqB;AAAA,MAC5B;AAAA,MAEQ,uBAA6B;AAEnC,yBAAAA,QAAU,SAAS,KAAK,OAAO,UAAU;AAGzC,YAAI,KAAK,OAAO,QAAQ;AACtB,2BAAAA,QAAU,MAAM,KAAK,OAAO;AAAA,QAC9B;AAGA,YAAI,KAAK,OAAO,aAAa;AAG3B,cAAI;AAC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AAGA,YAAI,OAAO,WAAW,YAAY,YAAY;AAC5C,iBAAO,WAAW,QAAQ,eAAe,EAAE,KAAK,SAAS,CAAC;AAAA,QAC5D;AAEA,eAAO;AAAA,MACT;AAAA,IACF;AAGA,QAAI,OAAO,YAAY,aAAa;AAClC,YAAM,UAAU,YAAY;AAC1B,YAAI,WAAW;AACb,gBAAM,UAAU,KAAK;AAAA,QACvB;AAAA,MACF;AAEA,cAAQ,GAAG,UAAU,OAAO;AAC5B,cAAQ,GAAG,WAAW,OAAO;AAC7B,cAAQ,GAAG,cAAc,OAAO;AAAA,IAClC;AAEA,WAAO;AAAA,EACT;AACF;","names":["translate","fs","import_fs_extra","path","fs","import_fs_extra","path","fs","translate","translate","Translatinator","ConfigLoader","chokidar","path"]}