@intlayer/cli 9.7.0 → 9.7.2
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.
- package/dist/cjs/IntlayerEventListener.cjs +1 -2
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -2
- package/dist/cjs/_virtual/_utils_asset.cjs +1 -2
- package/dist/cjs/auth/login.cjs +8 -9
- package/dist/cjs/auth/sessionToken.cjs +1 -2
- package/dist/cjs/auth/setupRepository.cjs +6 -7
- package/dist/cjs/build.cjs +2 -3
- package/dist/cjs/bundle.cjs +1 -2
- package/dist/cjs/bundle.cjs.map +1 -1
- package/dist/cjs/ci.cjs +2 -3
- package/dist/cjs/cli.cjs +8 -5
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/config.cjs +2 -3
- package/dist/cjs/editor.cjs +3 -4
- package/dist/cjs/extract.cjs +6 -7
- package/dist/cjs/fill/deepMergeContent.cjs +1 -2
- package/dist/cjs/fill/extractTranslatableContent.cjs +1 -2
- package/dist/cjs/fill/fill.cjs +9 -10
- package/dist/cjs/fill/formatAutoFilledFilePath.cjs +1 -2
- package/dist/cjs/fill/formatFillData.cjs +2 -3
- package/dist/cjs/fill/getAvailableLocalesInDictionary.cjs +1 -2
- package/dist/cjs/fill/getFilterMissingContentPerLocale.cjs +1 -2
- package/dist/cjs/fill/index.cjs +2 -2
- package/dist/cjs/fill/listTranslationsTasks.cjs +4 -5
- package/dist/cjs/fill/translateDictionary.cjs +7 -8
- package/dist/cjs/fill/writeFill.cjs +4 -5
- package/dist/cjs/getTargetDictionary.cjs +2 -3
- package/dist/cjs/index.cjs +28 -27
- package/dist/cjs/init.cjs +30 -13
- package/dist/cjs/init.cjs.map +1 -1
- package/dist/cjs/initChromeExtension.cjs +5 -6
- package/dist/cjs/initInfra.cjs +4 -5
- package/dist/cjs/initMCP.cjs +6 -7
- package/dist/cjs/initSkills.cjs +6 -7
- package/dist/cjs/listContentDeclaration.cjs +3 -4
- package/dist/cjs/listProjects.cjs +2 -3
- package/dist/cjs/liveSync.cjs +7 -8
- package/dist/cjs/loadPrompts.cjs +1 -2
- package/dist/cjs/pull.cjs +20 -13
- package/dist/cjs/pull.cjs.map +1 -1
- package/dist/cjs/push/pullLog.cjs +2 -3
- package/dist/cjs/push/push.cjs +12 -12
- package/dist/cjs/push/push.cjs.map +1 -1
- package/dist/cjs/pushConfig.cjs +4 -5
- package/dist/cjs/pushLog.cjs +2 -3
- package/dist/cjs/reviewDoc/reviewDoc.cjs +14 -14
- package/dist/cjs/reviewDoc/reviewDoc.cjs.map +1 -1
- package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs +9 -10
- package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs.map +1 -1
- package/dist/cjs/reviewDoc/reviewDocLog.cjs +2 -3
- package/dist/cjs/reviewDoc/reviewDocProgress.cjs +2 -3
- package/dist/cjs/reviewDoc/reviewDocSynthesis.cjs +2 -3
- package/dist/cjs/scan.cjs +2 -3
- package/dist/cjs/searchDoc.cjs +2 -3
- package/dist/cjs/test/index.cjs +2 -2
- package/dist/cjs/test/listMissingTranslations.cjs +2 -3
- package/dist/cjs/test/test.cjs +4 -5
- package/dist/cjs/translateDoc/index.cjs +3 -3
- package/dist/cjs/translateDoc/translateDoc.cjs +10 -11
- package/dist/cjs/translateDoc/translateDoc.cjs.map +1 -1
- package/dist/cjs/translateDoc/translateFile.cjs +10 -11
- package/dist/cjs/translateDoc/translateFile.cjs.map +1 -1
- package/dist/cjs/translateDoc/validation.cjs +1 -2
- package/dist/cjs/upgrade.cjs +3 -4
- package/dist/cjs/utils/calculateChunks.cjs +1 -2
- package/dist/cjs/utils/checkAccess.cjs +6 -7
- package/dist/cjs/utils/checkConfigConsistency.cjs +1 -2
- package/dist/cjs/utils/checkFileModifiedRange.cjs +3 -4
- package/dist/cjs/utils/checkLastUpdateTime.cjs +1 -2
- package/dist/cjs/utils/chunkInference.cjs +2 -3
- package/dist/cjs/utils/detectGitRepository.cjs +1 -2
- package/dist/cjs/utils/fixChunkStartEndChars.cjs +1 -2
- package/dist/cjs/utils/formatLineRanges.cjs +1 -2
- package/dist/cjs/utils/formatTimeDiff.cjs +1 -2
- package/dist/cjs/utils/getIsFileUpdatedRecently.cjs +1 -2
- package/dist/cjs/utils/getOutputFilePath.cjs +1 -2
- package/dist/cjs/utils/getParentPackageJSON.cjs +1 -2
- package/dist/cjs/utils/isInteractiveTerminal.cjs +1 -2
- package/dist/cjs/utils/listSpecialChars.cjs +1 -2
- package/dist/cjs/utils/mapChunksBetweenFiles.cjs +2 -3
- package/dist/cjs/utils/openBrowser.cjs +1 -2
- package/dist/cjs/utils/parseChoice.cjs +1 -2
- package/dist/cjs/utils/reorderParagraphs.cjs +2 -3
- package/dist/cjs/utils/selectCmsEnvironment.cjs +2 -3
- package/dist/cjs/utils/setupAI.cjs +3 -4
- package/dist/cjs/watch.cjs +2 -3
- package/dist/esm/IntlayerEventListener.mjs +1 -2
- package/dist/esm/_virtual/_rolldown/runtime.mjs +1 -2
- package/dist/esm/_virtual/_utils_asset.mjs +1 -2
- package/dist/esm/auth/login.mjs +4 -5
- package/dist/esm/auth/sessionToken.mjs +1 -2
- package/dist/esm/auth/setupRepository.mjs +3 -4
- package/dist/esm/build.mjs +2 -3
- package/dist/esm/bundle.mjs +1 -2
- package/dist/esm/bundle.mjs.map +1 -1
- package/dist/esm/ci.mjs +2 -3
- package/dist/esm/cli.mjs +7 -4
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/config.mjs +2 -3
- package/dist/esm/editor.mjs +2 -3
- package/dist/esm/extract.mjs +6 -7
- package/dist/esm/extract.mjs.map +1 -1
- package/dist/esm/fill/deepMergeContent.mjs +1 -2
- package/dist/esm/fill/extractTranslatableContent.mjs +1 -2
- package/dist/esm/fill/fill.mjs +5 -6
- package/dist/esm/fill/fill.mjs.map +1 -1
- package/dist/esm/fill/formatAutoFilledFilePath.mjs +1 -2
- package/dist/esm/fill/formatFillData.mjs +1 -2
- package/dist/esm/fill/getAvailableLocalesInDictionary.mjs +1 -2
- package/dist/esm/fill/getFilterMissingContentPerLocale.mjs +1 -2
- package/dist/esm/fill/index.mjs +1 -1
- package/dist/esm/fill/listTranslationsTasks.mjs +2 -3
- package/dist/esm/fill/translateDictionary.mjs +3 -4
- package/dist/esm/fill/writeFill.mjs +2 -3
- package/dist/esm/getTargetDictionary.mjs +2 -3
- package/dist/esm/index.mjs +14 -14
- package/dist/esm/init.mjs +24 -8
- package/dist/esm/init.mjs.map +1 -1
- package/dist/esm/initChromeExtension.mjs +2 -3
- package/dist/esm/initInfra.mjs +2 -3
- package/dist/esm/initMCP.mjs +3 -4
- package/dist/esm/initSkills.mjs +2 -3
- package/dist/esm/listContentDeclaration.mjs +3 -4
- package/dist/esm/listProjects.mjs +2 -3
- package/dist/esm/liveSync.mjs +4 -5
- package/dist/esm/loadPrompts.mjs +1 -2
- package/dist/esm/pull.mjs +16 -9
- package/dist/esm/pull.mjs.map +1 -1
- package/dist/esm/push/pullLog.mjs +1 -2
- package/dist/esm/push/push.mjs +9 -9
- package/dist/esm/push/push.mjs.map +1 -1
- package/dist/esm/pushConfig.mjs +2 -3
- package/dist/esm/pushLog.mjs +1 -2
- package/dist/esm/reviewDoc/reviewDoc.mjs +6 -6
- package/dist/esm/reviewDoc/reviewDoc.mjs.map +1 -1
- package/dist/esm/reviewDoc/reviewDocBlockAware.mjs +4 -5
- package/dist/esm/reviewDoc/reviewDocBlockAware.mjs.map +1 -1
- package/dist/esm/reviewDoc/reviewDocLog.mjs +2 -3
- package/dist/esm/reviewDoc/reviewDocProgress.mjs +1 -2
- package/dist/esm/reviewDoc/reviewDocSynthesis.mjs +1 -2
- package/dist/esm/scan.mjs +1 -2
- package/dist/esm/searchDoc.mjs +2 -3
- package/dist/esm/test/listMissingTranslations.mjs +2 -3
- package/dist/esm/test/test.mjs +2 -3
- package/dist/esm/translateDoc/index.mjs +2 -2
- package/dist/esm/translateDoc/translateDoc.mjs +5 -6
- package/dist/esm/translateDoc/translateDoc.mjs.map +1 -1
- package/dist/esm/translateDoc/translateFile.mjs +6 -7
- package/dist/esm/translateDoc/translateFile.mjs.map +1 -1
- package/dist/esm/translateDoc/validation.mjs +1 -2
- package/dist/esm/upgrade.mjs +2 -3
- package/dist/esm/utils/calculateChunks.mjs +1 -2
- package/dist/esm/utils/checkAccess.mjs +3 -4
- package/dist/esm/utils/checkConfigConsistency.mjs +1 -2
- package/dist/esm/utils/checkFileModifiedRange.mjs +1 -2
- package/dist/esm/utils/checkLastUpdateTime.mjs +1 -2
- package/dist/esm/utils/chunkInference.mjs +1 -2
- package/dist/esm/utils/detectGitRepository.mjs +1 -2
- package/dist/esm/utils/fixChunkStartEndChars.mjs +1 -2
- package/dist/esm/utils/formatLineRanges.mjs +1 -2
- package/dist/esm/utils/formatTimeDiff.mjs +1 -2
- package/dist/esm/utils/getIsFileUpdatedRecently.mjs +1 -2
- package/dist/esm/utils/getOutputFilePath.mjs +1 -2
- package/dist/esm/utils/getParentPackageJSON.mjs +1 -2
- package/dist/esm/utils/isInteractiveTerminal.mjs +1 -2
- package/dist/esm/utils/listSpecialChars.mjs +1 -2
- package/dist/esm/utils/mapChunksBetweenFiles.mjs +1 -2
- package/dist/esm/utils/openBrowser.mjs +1 -2
- package/dist/esm/utils/parseChoice.mjs +1 -2
- package/dist/esm/utils/reorderParagraphs.mjs +1 -2
- package/dist/esm/utils/selectCmsEnvironment.mjs +1 -2
- package/dist/esm/utils/setupAI.mjs +1 -2
- package/dist/esm/watch.mjs +2 -3
- package/dist/types/IntlayerEventListener.d.ts +1 -3
- package/dist/types/IntlayerEventListener.d.ts.map +1 -1
- package/dist/types/auth/login.d.ts +1 -2
- package/dist/types/auth/login.d.ts.map +1 -1
- package/dist/types/auth/sessionToken.d.ts +0 -2
- package/dist/types/auth/sessionToken.d.ts.map +1 -1
- package/dist/types/auth/setupRepository.d.ts +1 -2
- package/dist/types/auth/setupRepository.d.ts.map +1 -1
- package/dist/types/build.d.ts +1 -2
- package/dist/types/build.d.ts.map +1 -1
- package/dist/types/bundle.d.ts +0 -2
- package/dist/types/bundle.d.ts.map +1 -1
- package/dist/types/ci.d.ts +1 -2
- package/dist/types/ci.d.ts.map +1 -1
- package/dist/types/cli.d.ts +1 -2
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/config.d.ts +1 -2
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/editor.d.ts +1 -2
- package/dist/types/editor.d.ts.map +1 -1
- package/dist/types/extract.d.ts +1 -2
- package/dist/types/extract.d.ts.map +1 -1
- package/dist/types/fill/deepMergeContent.d.ts +0 -2
- package/dist/types/fill/deepMergeContent.d.ts.map +1 -1
- package/dist/types/fill/extractTranslatableContent.d.ts +0 -2
- package/dist/types/fill/extractTranslatableContent.d.ts.map +1 -1
- package/dist/types/fill/fill.d.ts +1 -3
- package/dist/types/fill/fill.d.ts.map +1 -1
- package/dist/types/fill/formatAutoFilledFilePath.d.ts +1 -3
- package/dist/types/fill/formatAutoFilledFilePath.d.ts.map +1 -1
- package/dist/types/fill/formatFillData.d.ts +0 -2
- package/dist/types/fill/formatFillData.d.ts.map +1 -1
- package/dist/types/fill/getAvailableLocalesInDictionary.d.ts +0 -2
- package/dist/types/fill/getAvailableLocalesInDictionary.d.ts.map +1 -1
- package/dist/types/fill/getFilterMissingContentPerLocale.d.ts +0 -2
- package/dist/types/fill/getFilterMissingContentPerLocale.d.ts.map +1 -1
- package/dist/types/fill/listTranslationsTasks.d.ts +0 -2
- package/dist/types/fill/listTranslationsTasks.d.ts.map +1 -1
- package/dist/types/fill/translateDictionary.d.ts +2 -3
- package/dist/types/fill/translateDictionary.d.ts.map +1 -1
- package/dist/types/fill/writeFill.d.ts +0 -2
- package/dist/types/fill/writeFill.d.ts.map +1 -1
- package/dist/types/getTargetDictionary.d.ts +0 -2
- package/dist/types/getTargetDictionary.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/init.d.ts +6 -3
- package/dist/types/init.d.ts.map +1 -1
- package/dist/types/initChromeExtension.d.ts +0 -2
- package/dist/types/initChromeExtension.d.ts.map +1 -1
- package/dist/types/initInfra.d.ts +0 -2
- package/dist/types/initInfra.d.ts.map +1 -1
- package/dist/types/initMCP.d.ts +0 -2
- package/dist/types/initMCP.d.ts.map +1 -1
- package/dist/types/initSkills.d.ts +0 -2
- package/dist/types/initSkills.d.ts.map +1 -1
- package/dist/types/listContentDeclaration.d.ts +1 -2
- package/dist/types/listContentDeclaration.d.ts.map +1 -1
- package/dist/types/listProjects.d.ts +0 -2
- package/dist/types/listProjects.d.ts.map +1 -1
- package/dist/types/liveSync.d.ts +1 -2
- package/dist/types/liveSync.d.ts.map +1 -1
- package/dist/types/loadPrompts.d.ts +0 -2
- package/dist/types/loadPrompts.d.ts.map +1 -1
- package/dist/types/pull.d.ts +15 -3
- package/dist/types/pull.d.ts.map +1 -1
- package/dist/types/push/pullLog.d.ts +0 -2
- package/dist/types/push/pullLog.d.ts.map +1 -1
- package/dist/types/push/push.d.ts +1 -2
- package/dist/types/push/push.d.ts.map +1 -1
- package/dist/types/pushConfig.d.ts +1 -2
- package/dist/types/pushConfig.d.ts.map +1 -1
- package/dist/types/pushLog.d.ts +0 -2
- package/dist/types/pushLog.d.ts.map +1 -1
- package/dist/types/reviewDoc/reviewDoc.d.ts +2 -3
- package/dist/types/reviewDoc/reviewDoc.d.ts.map +1 -1
- package/dist/types/reviewDoc/reviewDocBlockAware.d.ts +0 -2
- package/dist/types/reviewDoc/reviewDocBlockAware.d.ts.map +1 -1
- package/dist/types/reviewDoc/reviewDocLog.d.ts +0 -2
- package/dist/types/reviewDoc/reviewDocLog.d.ts.map +1 -1
- package/dist/types/reviewDoc/reviewDocProgress.d.ts +0 -2
- package/dist/types/reviewDoc/reviewDocProgress.d.ts.map +1 -1
- package/dist/types/reviewDoc/reviewDocSynthesis.d.ts +0 -2
- package/dist/types/reviewDoc/reviewDocSynthesis.d.ts.map +1 -1
- package/dist/types/scan.d.ts +0 -2
- package/dist/types/scan.d.ts.map +1 -1
- package/dist/types/searchDoc.d.ts +1 -2
- package/dist/types/searchDoc.d.ts.map +1 -1
- package/dist/types/test/listMissingTranslations.d.ts +1 -3
- package/dist/types/test/listMissingTranslations.d.ts.map +1 -1
- package/dist/types/test/test.d.ts +1 -2
- package/dist/types/test/test.d.ts.map +1 -1
- package/dist/types/translateDoc/index.d.ts +1 -1
- package/dist/types/translateDoc/translateDoc.d.ts +0 -2
- package/dist/types/translateDoc/translateDoc.d.ts.map +1 -1
- package/dist/types/translateDoc/translateFile.d.ts +0 -2
- package/dist/types/translateDoc/translateFile.d.ts.map +1 -1
- package/dist/types/translateDoc/types.d.ts +2 -4
- package/dist/types/translateDoc/types.d.ts.map +1 -1
- package/dist/types/translateDoc/validation.d.ts +0 -2
- package/dist/types/translateDoc/validation.d.ts.map +1 -1
- package/dist/types/upgrade.d.ts +0 -2
- package/dist/types/upgrade.d.ts.map +1 -1
- package/dist/types/utils/calculateChunks.d.ts +0 -2
- package/dist/types/utils/calculateChunks.d.ts.map +1 -1
- package/dist/types/utils/checkAccess.d.ts +1 -3
- package/dist/types/utils/checkAccess.d.ts.map +1 -1
- package/dist/types/utils/checkConfigConsistency.d.ts +0 -2
- package/dist/types/utils/checkConfigConsistency.d.ts.map +1 -1
- package/dist/types/utils/checkFileModifiedRange.d.ts +1 -2
- package/dist/types/utils/checkFileModifiedRange.d.ts.map +1 -1
- package/dist/types/utils/checkLastUpdateTime.d.ts +0 -2
- package/dist/types/utils/checkLastUpdateTime.d.ts.map +1 -1
- package/dist/types/utils/chunkInference.d.ts +1 -2
- package/dist/types/utils/chunkInference.d.ts.map +1 -1
- package/dist/types/utils/detectGitRepository.d.ts +0 -2
- package/dist/types/utils/detectGitRepository.d.ts.map +1 -1
- package/dist/types/utils/fixChunkStartEndChars.d.ts +0 -2
- package/dist/types/utils/fixChunkStartEndChars.d.ts.map +1 -1
- package/dist/types/utils/formatLineRanges.d.ts +0 -2
- package/dist/types/utils/formatLineRanges.d.ts.map +1 -1
- package/dist/types/utils/formatTimeDiff.d.ts +0 -2
- package/dist/types/utils/formatTimeDiff.d.ts.map +1 -1
- package/dist/types/utils/getIsFileUpdatedRecently.d.ts +0 -2
- package/dist/types/utils/getIsFileUpdatedRecently.d.ts.map +1 -1
- package/dist/types/utils/getOutputFilePath.d.ts +0 -2
- package/dist/types/utils/getOutputFilePath.d.ts.map +1 -1
- package/dist/types/utils/getParentPackageJSON.d.ts +1 -2
- package/dist/types/utils/getParentPackageJSON.d.ts.map +1 -1
- package/dist/types/utils/isInteractiveTerminal.d.ts +0 -2
- package/dist/types/utils/isInteractiveTerminal.d.ts.map +1 -1
- package/dist/types/utils/listSpecialChars.d.ts +1 -2
- package/dist/types/utils/listSpecialChars.d.ts.map +1 -1
- package/dist/types/utils/mapChunksBetweenFiles.d.ts +0 -2
- package/dist/types/utils/mapChunksBetweenFiles.d.ts.map +1 -1
- package/dist/types/utils/openBrowser.d.ts +0 -2
- package/dist/types/utils/openBrowser.d.ts.map +1 -1
- package/dist/types/utils/parseChoice.d.ts +0 -2
- package/dist/types/utils/parseChoice.d.ts.map +1 -1
- package/dist/types/utils/reorderParagraphs.d.ts +0 -2
- package/dist/types/utils/reorderParagraphs.d.ts.map +1 -1
- package/dist/types/utils/selectCmsEnvironment.d.ts +1 -3
- package/dist/types/utils/selectCmsEnvironment.d.ts.map +1 -1
- package/dist/types/utils/setupAI.d.ts +1 -2
- package/dist/types/utils/setupAI.d.ts.map +1 -1
- package/dist/types/watch.d.ts +1 -2
- package/dist/types/watch.d.ts.map +1 -1
- package/package.json +32 -32
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translateFile.mjs","names":[],"sources":["../../../src/translateDoc/translateFile.ts"],"sourcesContent":["import { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { dirname, relative } from 'node:path';\nimport { performance } from 'node:perf_hooks';\nimport { readAsset } from 'utils:asset';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n colon,\n colorize,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport { retryManager } from '@intlayer/config/utils';\nimport { formatLocale, formatPath } from '@intlayer/engine/utils';\nimport { chunkText } from '../utils/calculateChunks';\nimport { chunkInference } from '../utils/chunkInference';\nimport { fixChunkStartEndChars } from '../utils/fixChunkStartEndChars';\nimport type { TranslateFileOptions } from './types';\nimport { sanitizeChunk, validateTranslation } from './validation';\n\nexport const translateFile = async ({\n baseFilePath,\n outputFilePath,\n locale,\n baseLocale,\n configuration,\n errorState,\n aiOptions,\n customInstructions,\n aiClient,\n aiConfig,\n flushStrategy = 'incremental',\n onChunkReceive,\n limit, // The Global Limiter\n}: TranslateFileOptions): Promise<string | null> => {\n if (errorState.shouldStop) return null;\n\n const appLogger = getAppLogger(configuration, { config: { prefix: '' } });\n const fileStartTime = performance.now();\n\n try {\n const fileContent = await readFile(baseFilePath, 'utf-8');\n const chunks = chunkText(fileContent);\n const totalChunks = chunks.length;\n\n const filePrefixText = `${ANSIColors.GREY_DARK}[${formatPath(baseFilePath)}${ANSIColors.GREY_DARK}] `;\n const filePrefix = `${colon(filePrefixText, { colSize: 40 })}${ANSIColors.RESET}`;\n const prefixText = `${ANSIColors.GREY_DARK}[${formatPath(baseFilePath)}${ANSIColors.GREY_DARK}][${formatLocale(locale)}${ANSIColors.GREY_DARK}] `;\n const prefix = `${colon(prefixText, { colSize: 40 })}${ANSIColors.RESET}`;\n\n appLogger(\n `${filePrefix}Split into ${colorizeNumber(totalChunks)} chunks. Queuing...`\n );\n\n const basePrompt = readAsset('./prompts/TRANSLATE_PROMPT.md', 'utf-8')\n .replaceAll('{{localeName}}', `${formatLocale(locale, false)}`)\n .replaceAll('{{baseLocaleName}}', `${formatLocale(baseLocale, false)}`)\n .replace('{{applicationContext}}', aiOptions?.applicationContext ?? '-')\n .replace('{{customInstructions}}', customInstructions ?? '-');\n\n const translatedParts: string[] = new Array(totalChunks).fill('');\n\n // Fallback if no limiter is provided (runs immediately)\n const runTask = limit ?? ((fn) => fn());\n\n // MAP CHUNKS TO GLOBAL TASKS\n // This pushes ALL chunks for this file into the Global Queue immediately.\n // They will execute whenever the global concurrency slots open up.\n const tasks = chunks.map((chunk, i) =>\n runTask(async () => {\n if (errorState.shouldStop) return null;\n\n const chunkLogger = getAppLogger(configuration, {\n config: {\n prefix: `${prefix} ${ANSIColors.GREY_DARK}[${i + 1}/${totalChunks}] ${ANSIColors.RESET}`,\n },\n });\n\n const chunkStartTime = performance.now();\n const isFirstChunk = i === 0;\n const fileToTranslateCurrentChunk = chunk.content;\n\n // Context Preparation\n const getPrevChunkPrompt = () =>\n `>>> CONTEXT: PREVIOUS SOURCE CONTENT <<<\\n\\`\\`\\`\\n` +\n (chunks[i - 1]?.content ?? '') +\n `\\n\\`\\`\\`\\n>>> END PREVIOUS CONTEXT <<<`;\n\n const getBaseChunkContextPrompt = () =>\n `>>> CONTEXT: NEXT CONTENT <<<\\n\\`\\`\\`\\n` +\n (chunks[i + 1]?.content ?? '') +\n `\\n\\`\\`\\`\\n>>> END NEXT CONTEXT <<<`;\n\n chunkLogger('Process started');\n\n const chunkTranslation = retryManager(async () => {\n const result = await chunkInference(\n [\n { role: 'system', content: basePrompt },\n ...(chunks[i + 1]\n ? [\n {\n role: 'system',\n content: getBaseChunkContextPrompt(),\n } as const,\n ]\n : []),\n ...(isFirstChunk\n ? []\n : [{ role: 'system', content: getPrevChunkPrompt() } as const]),\n {\n role: 'system',\n content: [\n `You are translating TARGET CHUNK (${i + 1}/${totalChunks}).`,\n `Translate ONLY the target chunk. Preserve frontmatter/code exactly.`,\n ].join('\\n'),\n },\n ],\n [\n {\n role: 'user',\n content: `>>> TARGET CHUNK START <<<\\n${fileToTranslateCurrentChunk}\\n>>> TARGET CHUNK END <<<`,\n },\n ],\n aiOptions,\n configuration,\n aiClient,\n aiConfig\n );\n\n let processedChunk = sanitizeChunk(\n result?.fileContent,\n fileToTranslateCurrentChunk\n );\n processedChunk = fixChunkStartEndChars(\n processedChunk,\n fileToTranslateCurrentChunk\n );\n\n const isValid = validateTranslation(\n fileToTranslateCurrentChunk,\n processedChunk,\n chunkLogger\n );\n\n if (!isValid) {\n // Throwing an error here signals retryManager to try again\n throw new Error(\n `Validation failed for chunk ${i + 1}/${totalChunks}`\n );\n }\n\n return { content: processedChunk, tokens: result.tokenUsed };\n });\n\n const { content: translatedChunk, tokens } = await chunkTranslation();\n const chunkEndTime = performance.now();\n const chunkDuration = (chunkEndTime - chunkStartTime).toFixed(0);\n\n // Store Result\n translatedParts[i] = translatedChunk;\n\n if (onChunkReceive) {\n onChunkReceive(translatedChunk, i, totalChunks);\n }\n\n // Incremental Flush Strategy\n if (flushStrategy === 'incremental') {\n const isContiguous = translatedParts\n .slice(0, i + 1)\n .every((p) => p && p !== '');\n\n if (isContiguous) {\n let endIdx = 0;\n while (\n endIdx < totalChunks &&\n translatedParts[endIdx] &&\n translatedParts[endIdx] !== ''\n ) {\n endIdx++;\n }\n const currentContent = translatedParts.slice(0, endIdx).join('');\n // Write asynchronously/sync is fine here as node handles file locks reasonably well for single process\n await mkdir(dirname(outputFilePath), { recursive: true });\n await writeFile(outputFilePath, currentContent);\n }\n }\n\n chunkLogger(\n [\n `${colorizeNumber(tokens)} tokens used `,\n `${ANSIColors.GREY_DARK}in ${colorizeNumber(chunkDuration)}ms${ANSIColors.RESET}`,\n ].join('')\n );\n })\n );\n\n // Wait for all chunks for this specific file/locale to finish\n await Promise.all(tasks);\n\n // Final Flush\n const fullContent = translatedParts.join('');\n if (flushStrategy === 'end' || flushStrategy === 'incremental') {\n await mkdir(dirname(outputFilePath), { recursive: true });\n await writeFile(outputFilePath, fullContent);\n }\n\n const fileEndTime = performance.now();\n const totalDuration = ((fileEndTime - fileStartTime) / 1000).toFixed(2);\n const relativePath = relative(configuration.system.baseDir, outputFilePath);\n\n appLogger(\n `${colorize('✔', ANSIColors.GREEN)} File ${formatPath(relativePath)} completed in ${colorizeNumber(totalDuration)}s.`\n );\n\n return fullContent;\n } catch (error: any) {\n errorState.count++;\n const errorMessage = error?.message ?? JSON.stringify(error);\n appLogger(`${colorize('✖', ANSIColors.RED)} Error: ${errorMessage}`);\n if (errorState.count >= errorState.maxErrors) errorState.shouldStop = true;\n return null;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;AAmBA,MAAa,gBAAgB,OAAO,EAClC,cACA,gBACA,QACA,YACA,eACA,YACA,WACA,oBACA,UACA,UACA,gBAAgB,eAChB,gBACA,YACkD;CAClD,IAAI,WAAW,YAAY,OAAO;CAElC,MAAM,YAAY,aAAa,eAAe,EAAE,QAAQ,EAAE,QAAQ,GAAG,EAAE,CAAC;CACxE,MAAM,gBAAgB,YAAY,IAAI;CAEtC,IAAI;EACF,MAAM,cAAc,MAAM,SAAS,cAAc,OAAO;EACxD,MAAM,SAAS,UAAU,WAAW;EACpC,MAAM,cAAc,OAAO;EAE3B,MAAM,iBAAiB,GAAG,WAAW,UAAU,GAAG,WAAW,YAAY,IAAI,WAAW,UAAU;EAClG,MAAM,aAAa,GAAG,MAAM,gBAAgB,EAAE,SAAS,GAAG,CAAC,IAAI,WAAW;EAC1E,MAAM,aAAa,GAAG,WAAW,UAAU,GAAG,WAAW,YAAY,IAAI,WAAW,UAAU,IAAI,aAAa,MAAM,IAAI,WAAW,UAAU;EAC9I,MAAM,SAAS,GAAG,MAAM,YAAY,EAAE,SAAS,GAAG,CAAC,IAAI,WAAW;EAElE,UACE,GAAG,WAAW,aAAa,eAAe,WAAW,EAAE,oBACzD;EAEA,MAAM,aAAa,UAAU,iCAAiC,OAAO,CAAC,CACnE,WAAW,kBAAkB,GAAG,aAAa,QAAQ,KAAK,GAAG,CAAC,CAC9D,WAAW,sBAAsB,GAAG,aAAa,YAAY,KAAK,GAAG,CAAC,CACtE,QAAQ,0BAA0B,WAAW,sBAAsB,GAAG,CAAC,CACvE,QAAQ,0BAA0B,sBAAsB,GAAG;EAE9D,MAAM,kBAA4B,IAAI,MAAM,WAAW,CAAC,CAAC,KAAK,EAAE;EA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;EACnE,IAAI,WAAW,SAAS,WAAW,WAAW,WAAW,aAAa;EACtE,OAAO;CACT;AACF"}
|
|
1
|
+
{"version":3,"file":"translateFile.mjs","names":[],"sources":["../../../src/translateDoc/translateFile.ts"],"sourcesContent":["import { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { dirname, relative } from 'node:path';\nimport { performance } from 'node:perf_hooks';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n colon,\n colorize,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport { retryManager } from '@intlayer/config/utils';\nimport { formatLocale, formatPath } from '@intlayer/engine/utils';\nimport { readAsset } from 'utils:asset';\nimport { chunkText } from '../utils/calculateChunks';\nimport { chunkInference } from '../utils/chunkInference';\nimport { fixChunkStartEndChars } from '../utils/fixChunkStartEndChars';\nimport type { TranslateFileOptions } from './types';\nimport { sanitizeChunk, validateTranslation } from './validation';\n\nexport const translateFile = async ({\n baseFilePath,\n outputFilePath,\n locale,\n baseLocale,\n configuration,\n errorState,\n aiOptions,\n customInstructions,\n aiClient,\n aiConfig,\n flushStrategy = 'incremental',\n onChunkReceive,\n limit, // The Global Limiter\n}: TranslateFileOptions): Promise<string | null> => {\n if (errorState.shouldStop) return null;\n\n const appLogger = getAppLogger(configuration, { config: { prefix: '' } });\n const fileStartTime = performance.now();\n\n try {\n const fileContent = await readFile(baseFilePath, 'utf-8');\n const chunks = chunkText(fileContent);\n const totalChunks = chunks.length;\n\n const filePrefixText = `${ANSIColors.GREY_DARK}[${formatPath(baseFilePath)}${ANSIColors.GREY_DARK}] `;\n const filePrefix = `${colon(filePrefixText, { colSize: 40 })}${ANSIColors.RESET}`;\n const prefixText = `${ANSIColors.GREY_DARK}[${formatPath(baseFilePath)}${ANSIColors.GREY_DARK}][${formatLocale(locale)}${ANSIColors.GREY_DARK}] `;\n const prefix = `${colon(prefixText, { colSize: 40 })}${ANSIColors.RESET}`;\n\n appLogger(\n `${filePrefix}Split into ${colorizeNumber(totalChunks)} chunks. Queuing...`\n );\n\n const basePrompt = readAsset('./prompts/TRANSLATE_PROMPT.md', 'utf-8')\n .replaceAll('{{localeName}}', `${formatLocale(locale, false)}`)\n .replaceAll('{{baseLocaleName}}', `${formatLocale(baseLocale, false)}`)\n .replace('{{applicationContext}}', aiOptions?.applicationContext ?? '-')\n .replace('{{customInstructions}}', customInstructions ?? '-');\n\n const translatedParts: string[] = new Array(totalChunks).fill('');\n\n // Fallback if no limiter is provided (runs immediately)\n const runTask = limit ?? ((fn) => fn());\n\n // MAP CHUNKS TO GLOBAL TASKS\n // This pushes ALL chunks for this file into the Global Queue immediately.\n // They will execute whenever the global concurrency slots open up.\n const tasks = chunks.map((chunk, i) =>\n runTask(async () => {\n if (errorState.shouldStop) return null;\n\n const chunkLogger = getAppLogger(configuration, {\n config: {\n prefix: `${prefix} ${ANSIColors.GREY_DARK}[${i + 1}/${totalChunks}] ${ANSIColors.RESET}`,\n },\n });\n\n const chunkStartTime = performance.now();\n const isFirstChunk = i === 0;\n const fileToTranslateCurrentChunk = chunk.content;\n\n // Context Preparation\n const getPrevChunkPrompt = () =>\n `>>> CONTEXT: PREVIOUS SOURCE CONTENT <<<\\n\\`\\`\\`\\n${ \n chunks[i - 1]?.content ?? '' \n }\\n\\`\\`\\`\\n>>> END PREVIOUS CONTEXT <<<`;\n\n const getBaseChunkContextPrompt = () =>\n `>>> CONTEXT: NEXT CONTENT <<<\\n\\`\\`\\`\\n${ \n chunks[i + 1]?.content ?? '' \n }\\n\\`\\`\\`\\n>>> END NEXT CONTEXT <<<`;\n\n chunkLogger('Process started');\n\n const chunkTranslation = retryManager(async () => {\n const result = await chunkInference(\n [\n { role: 'system', content: basePrompt },\n ...(chunks[i + 1]\n ? [\n {\n role: 'system',\n content: getBaseChunkContextPrompt(),\n } as const,\n ]\n : []),\n ...(isFirstChunk\n ? []\n : [{ role: 'system', content: getPrevChunkPrompt() } as const]),\n {\n role: 'system',\n content: [\n `You are translating TARGET CHUNK (${i + 1}/${totalChunks}).`,\n `Translate ONLY the target chunk. Preserve frontmatter/code exactly.`,\n ].join('\\n'),\n },\n ],\n [\n {\n role: 'user',\n content: `>>> TARGET CHUNK START <<<\\n${fileToTranslateCurrentChunk}\\n>>> TARGET CHUNK END <<<`,\n },\n ],\n aiOptions,\n configuration,\n aiClient,\n aiConfig\n );\n\n let processedChunk = sanitizeChunk(\n result?.fileContent,\n fileToTranslateCurrentChunk\n );\n processedChunk = fixChunkStartEndChars(\n processedChunk,\n fileToTranslateCurrentChunk\n );\n\n const isValid = validateTranslation(\n fileToTranslateCurrentChunk,\n processedChunk,\n chunkLogger\n );\n\n if (!isValid) {\n // Throwing an error here signals retryManager to try again\n throw new Error(\n `Validation failed for chunk ${i + 1}/${totalChunks}`\n );\n }\n\n return { content: processedChunk, tokens: result.tokenUsed };\n });\n\n const { content: translatedChunk, tokens } = await chunkTranslation();\n const chunkEndTime = performance.now();\n const chunkDuration = (chunkEndTime - chunkStartTime).toFixed(0);\n\n // Store Result\n translatedParts[i] = translatedChunk;\n\n if (onChunkReceive) {\n onChunkReceive(translatedChunk, i, totalChunks);\n }\n\n // Incremental Flush Strategy\n if (flushStrategy === 'incremental') {\n const isContiguous = translatedParts\n .slice(0, i + 1)\n .every((p) => p && p !== '');\n\n if (isContiguous) {\n let endIdx = 0;\n while (\n endIdx < totalChunks &&\n translatedParts[endIdx] &&\n translatedParts[endIdx] !== ''\n ) {\n endIdx++;\n }\n const currentContent = translatedParts.slice(0, endIdx).join('');\n // Write asynchronously/sync is fine here as node handles file locks reasonably well for single process\n await mkdir(dirname(outputFilePath), { recursive: true });\n await writeFile(outputFilePath, currentContent);\n }\n }\n\n chunkLogger(\n [\n `${colorizeNumber(tokens)} tokens used `,\n `${ANSIColors.GREY_DARK}in ${colorizeNumber(chunkDuration)}ms${ANSIColors.RESET}`,\n ].join('')\n );\n })\n );\n\n // Wait for all chunks for this specific file/locale to finish\n await Promise.all(tasks);\n\n // Final Flush\n const fullContent = translatedParts.join('');\n if (flushStrategy === 'end' || flushStrategy === 'incremental') {\n await mkdir(dirname(outputFilePath), { recursive: true });\n await writeFile(outputFilePath, fullContent);\n }\n\n const fileEndTime = performance.now();\n const totalDuration = ((fileEndTime - fileStartTime) / 1000).toFixed(2);\n const relativePath = relative(configuration.system.baseDir, outputFilePath);\n\n appLogger(\n `${colorize('✔', ANSIColors.GREEN)} File ${formatPath(relativePath)} completed in ${colorizeNumber(totalDuration)}s.`\n );\n\n return fullContent;\n } catch (error: any) {\n errorState.count++;\n const errorMessage = error?.message ?? JSON.stringify(error);\n appLogger(`${colorize('✖', ANSIColors.RED)} Error: ${errorMessage}`);\n if (errorState.count >= errorState.maxErrors) errorState.shouldStop = true;\n return null;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;AAmBA,MAAa,gBAAgB,OAAO,EAClC,cACA,gBACA,QACA,YACA,eACA,YACA,WACA,oBACA,UACA,UACA,gBAAgB,eAChB,gBACA,YACkD;CAClD,IAAI,WAAW,YAAY,OAAO;CAElC,MAAM,YAAY,aAAa,eAAe,EAAE,QAAQ,EAAE,QAAQ,GAAG,EAAE,CAAC;CACxE,MAAM,gBAAgB,YAAY,IAAI;CAEtC,IAAI;EACF,MAAM,cAAc,MAAM,SAAS,cAAc,OAAO;EACxD,MAAM,SAAS,UAAU,WAAW;EACpC,MAAM,cAAc,OAAO;EAE3B,MAAM,iBAAiB,GAAG,WAAW,UAAU,GAAG,WAAW,YAAY,IAAI,WAAW,UAAU;EAClG,MAAM,aAAa,GAAG,MAAM,gBAAgB,EAAE,SAAS,GAAG,CAAC,IAAI,WAAW;EAC1E,MAAM,aAAa,GAAG,WAAW,UAAU,GAAG,WAAW,YAAY,IAAI,WAAW,UAAU,IAAI,aAAa,MAAM,IAAI,WAAW,UAAU;EAC9I,MAAM,SAAS,GAAG,MAAM,YAAY,EAAE,SAAS,GAAG,CAAC,IAAI,WAAW;EAElE,UACE,GAAG,WAAW,aAAa,eAAe,WAAW,EAAE,oBACzD;EAEA,MAAM,aAAa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,eAAe,SAAS,cAAc,OAAO,SAAS,cAAc;EAE1E,UACE,GAAG,SAAS,KAAK,WAAW,KAAK,EAAE,QAAQ,WAAW,YAAY,EAAE,gBAAgB,eAAe,aAAa,EAAE,GACpH;EAEA,OAAO;CACT,SAAS,OAAY;EACnB,WAAW;EACX,MAAM,eAAe,OAAO,WAAW,KAAK,UAAU,KAAK;EAC3D,UAAU,GAAG,SAAS,KAAK,WAAW,GAAG,EAAE,UAAU,cAAc;EACnE,IAAI,WAAW,SAAS,WAAW,WAAW,WAAW,aAAa;EACtE,OAAO;CACT;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/translateDoc/validation.ts
|
|
2
2
|
/**
|
|
3
3
|
* Validates that the translated content matches the structure of the original.
|
|
4
4
|
* Throws an error if a mismatch is found, triggering a retry.
|
|
@@ -42,6 +42,5 @@ const sanitizeChunk = (translated, original) => {
|
|
|
42
42
|
return cleaned;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
//#endregion
|
|
46
45
|
export { sanitizeChunk, validateTranslation };
|
|
47
46
|
//# sourceMappingURL=validation.mjs.map
|
package/dist/esm/upgrade.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { findProjectRoot } from "./init.mjs";
|
|
2
|
-
import { upgradeIntlayerPackages } from "@intlayer/engine/cli";
|
|
3
2
|
import { resolve } from "node:path";
|
|
3
|
+
import { upgradeIntlayerPackages } from "@intlayer/engine/cli";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/upgrade.ts
|
|
6
6
|
/**
|
|
7
7
|
* Lists the Intlayer packages of every `package.json` of the project and
|
|
8
8
|
* upgrades them to the version of the given dist-tag.
|
|
@@ -12,6 +12,5 @@ const upgrade = async (projectRoot, options) => {
|
|
|
12
12
|
await upgradeIntlayerPackages(root, options);
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
//#endregion
|
|
16
15
|
export { upgrade };
|
|
17
16
|
//# sourceMappingURL=upgrade.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { splitTextByLines } from "@intlayer/engine/utils";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/utils/calculateChunks.ts
|
|
4
4
|
const DEFAULT_MAX_CHARS_PER_CHUNK = 800;
|
|
5
5
|
const DEFAULT_OVERLAP_CHARS = 0;
|
|
6
6
|
const chunkText = (text, maxCharsPerChunk = DEFAULT_MAX_CHARS_PER_CHUNK, overlapChars = DEFAULT_OVERLAP_CHARS) => {
|
|
@@ -83,6 +83,5 @@ const chunkText = (text, maxCharsPerChunk = DEFAULT_MAX_CHARS_PER_CHUNK, overlap
|
|
|
83
83
|
return overlapChunks;
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
//#endregion
|
|
87
86
|
export { chunkText };
|
|
88
87
|
//# sourceMappingURL=calculateChunks.mjs.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { readCliSessionToken } from "../auth/sessionToken.mjs";
|
|
2
1
|
import { login } from "../auth/login.mjs";
|
|
2
|
+
import { readCliSessionToken } from "../auth/sessionToken.mjs";
|
|
3
3
|
import { checkConfigConsistency } from "./checkConfigConsistency.mjs";
|
|
4
4
|
import * as ANSIColors from "@intlayer/config/colors";
|
|
5
5
|
import { colorize, getAppLogger } from "@intlayer/config/logger";
|
|
6
|
-
import { extractErrorMessage } from "@intlayer/config/utils";
|
|
7
6
|
import { getIntlayerAPIProxy } from "@intlayer/api";
|
|
7
|
+
import { extractErrorMessage } from "@intlayer/config/utils";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// src/utils/checkAccess.ts
|
|
10
10
|
const getAuthenticatedAPI = async (configuration) => {
|
|
11
11
|
let sessionData = null;
|
|
12
12
|
if (configuration) sessionData = await readCliSessionToken(configuration);
|
|
@@ -108,6 +108,5 @@ const checkAIAccess = async (configuration, aiOptions, shouldCheckConfigConsiste
|
|
|
108
108
|
return await checkCMSAuth(configuration, shouldCheckConfigConsistency);
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
-
//#endregion
|
|
112
111
|
export { checkAIAccess, checkCMSAuth, getAuthenticatedAPI };
|
|
113
112
|
//# sourceMappingURL=checkAccess.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/checkConfigConsistency.ts
|
|
2
2
|
const checkConfigConsistency = (subset, superset) => {
|
|
3
3
|
for (const key in subset) {
|
|
4
4
|
const val1 = subset[key];
|
|
@@ -10,6 +10,5 @@ const checkConfigConsistency = (subset, superset) => {
|
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
//#endregion
|
|
14
13
|
export { checkConfigConsistency };
|
|
15
14
|
//# sourceMappingURL=checkConfigConsistency.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { checkLastUpdateTime } from "./checkLastUpdateTime.mjs";
|
|
2
2
|
import { formatTimeDiff } from "./formatTimeDiff.mjs";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/utils/checkFileModifiedRange.ts
|
|
5
5
|
/**
|
|
6
6
|
* Threshold that helps us differentiate between a numeric *timestamp* (ms from epoch)
|
|
7
7
|
* and a numeric *duration* (ms ago).
|
|
@@ -77,6 +77,5 @@ const checkFileModifiedRange = (filePath, options) => {
|
|
|
77
77
|
};
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
//#endregion
|
|
81
80
|
export { checkFileModifiedRange };
|
|
82
81
|
//# sourceMappingURL=checkFileModifiedRange.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { statSync } from "node:fs";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/utils/checkLastUpdateTime.ts
|
|
4
4
|
/**
|
|
5
5
|
* Returns the last modification date of a file.
|
|
6
6
|
*
|
|
@@ -13,6 +13,5 @@ const checkLastUpdateTime = (filePath) => {
|
|
|
13
13
|
return new Date(stats.mtime);
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
//#endregion
|
|
17
16
|
export { checkLastUpdateTime };
|
|
18
17
|
//# sourceMappingURL=checkLastUpdateTime.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getAuthenticatedAPI } from "./checkAccess.mjs";
|
|
2
2
|
import { retryManager } from "@intlayer/config/utils";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/utils/chunkInference.ts
|
|
5
5
|
/**
|
|
6
6
|
* Translates a single chunk via the OpenAI API.
|
|
7
7
|
* Includes retry logic if the call fails.
|
|
@@ -40,6 +40,5 @@ const processContent = (content) => {
|
|
|
40
40
|
return content.replaceAll("///chunksStart///", "").replaceAll("///chunkStart///", "").replaceAll("///chunksEnd///", "").replaceAll("///chunkEnd///", "").replaceAll("///chunksStart///", "").replaceAll("chunkStart///", "").replaceAll("chunksEnd///", "").replaceAll("chunkEnd///", "").replaceAll("///chunksStart", "").replaceAll("///chunkStart", "").replaceAll("///chunksEnd", "").replaceAll("///chunkEnd", "").replaceAll("chunksStart", "").replaceAll("chunkStart", "").replaceAll("chunksEnd", "").replaceAll("chunkEnd", "");
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
//#endregion
|
|
44
43
|
export { chunkInference };
|
|
45
44
|
//# sourceMappingURL=chunkInference.mjs.map
|
|
@@ -2,7 +2,7 @@ import { relative, sep } from "node:path";
|
|
|
2
2
|
import { searchConfigurationFile } from "@intlayer/config/node";
|
|
3
3
|
import { spawnSync } from "node:child_process";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/utils/detectGitRepository.ts
|
|
6
6
|
const HOST_PROVIDERS = {
|
|
7
7
|
"github.com": "github",
|
|
8
8
|
"gitlab.com": "gitlab",
|
|
@@ -80,6 +80,5 @@ const detectGitRepository = (projectRoot) => {
|
|
|
80
80
|
};
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
-
//#endregion
|
|
84
83
|
export { detectGitRepository, parseGitRemoteUrl };
|
|
85
84
|
//# sourceMappingURL=detectGitRepository.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/fixChunkStartEndChars.ts
|
|
2
2
|
const CHAR_TO_CHECK_FORMATTING = [
|
|
3
3
|
"```",
|
|
4
4
|
"\n\n",
|
|
@@ -22,6 +22,5 @@ const fixChunkStartEndChars = (reviewedChunkResult, baseChunkContext) => {
|
|
|
22
22
|
return result;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
//#endregion
|
|
26
25
|
export { fixChunkStartEndChars };
|
|
27
26
|
//# sourceMappingURL=fixChunkStartEndChars.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/formatLineRanges.ts
|
|
2
2
|
/**
|
|
3
3
|
* Formats a list of line numbers into a compact, human-readable string where
|
|
4
4
|
* runs of consecutive lines are collapsed into ranges.
|
|
@@ -37,6 +37,5 @@ const formatLineRanges = (lineNumbers, separator = ", ") => {
|
|
|
37
37
|
return groups.join(separator);
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
//#endregion
|
|
41
40
|
export { formatLineRanges };
|
|
42
41
|
//# sourceMappingURL=formatLineRanges.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/formatTimeDiff.ts
|
|
2
2
|
const formatTimeDiff = (realtiveTime) => {
|
|
3
3
|
const diff = realtiveTime.getTime();
|
|
4
4
|
const MS_IN_SECOND = 1e3;
|
|
@@ -14,6 +14,5 @@ const formatTimeDiff = (realtiveTime) => {
|
|
|
14
14
|
return `${minutes}m ${seconds}s`;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
//#endregion
|
|
18
17
|
export { formatTimeDiff };
|
|
19
18
|
//# sourceMappingURL=formatTimeDiff.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { statSync } from "node:fs";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/utils/getIsFileUpdatedRecently.ts
|
|
4
4
|
const SKIP_RANGE_OF_LAST_UPDATE_TIME = 0;
|
|
5
5
|
/**
|
|
6
6
|
* Check if file was updated recently, to skip re-translation
|
|
@@ -10,6 +10,5 @@ const getIsFileUpdatedRecently = (localeFilePath) => {
|
|
|
10
10
|
return new Date(stats.mtime) > /* @__PURE__ */ new Date(Date.now() - SKIP_RANGE_OF_LAST_UPDATE_TIME);
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
//#endregion
|
|
14
13
|
export { getIsFileUpdatedRecently };
|
|
15
14
|
//# sourceMappingURL=getIsFileUpdatedRecently.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolveRelativePath } from "@intlayer/engine/utils";
|
|
2
2
|
import { parseStringPattern } from "@intlayer/config/utils";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/utils/getOutputFilePath.ts
|
|
5
5
|
/**
|
|
6
6
|
* Get the output file path by replacing the base locale with the target locale
|
|
7
7
|
*
|
|
@@ -101,6 +101,5 @@ const resolveOutputPattern = async (output, locale, context, sourceFilePath, bas
|
|
|
101
101
|
return resolveRelativePath(rawPath, sourceFilePath, baseDir);
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
//#endregion
|
|
105
104
|
export { getOutputFilePath, getPatternForLocale, resolveOutputPattern };
|
|
106
105
|
//# sourceMappingURL=getOutputFilePath.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { dirname, resolve } from "node:path";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/utils/getParentPackageJSON.ts
|
|
5
5
|
const getParentPackageJSON = (startDir) => {
|
|
6
6
|
let currentDir = startDir;
|
|
7
7
|
while (currentDir !== dirname(currentDir)) {
|
|
@@ -14,6 +14,5 @@ const getParentPackageJSON = (startDir) => {
|
|
|
14
14
|
throw new Error(`No package.json found in any parent directory of ${startDir}`);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
//#endregion
|
|
18
17
|
export { getParentPackageJSON };
|
|
19
18
|
//# sourceMappingURL=getParentPackageJSON.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/isInteractiveTerminal.ts
|
|
2
2
|
/**
|
|
3
3
|
* Whether the process can prompt: both stdin and stdout are attached to a
|
|
4
4
|
* terminal. False for AI agents, CI and piped runs, where a prompt would print
|
|
@@ -6,6 +6,5 @@
|
|
|
6
6
|
*/
|
|
7
7
|
const isInteractiveTerminal = () => Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
8
8
|
|
|
9
|
-
//#endregion
|
|
10
9
|
export { isInteractiveTerminal };
|
|
11
10
|
//# sourceMappingURL=isInteractiveTerminal.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/listSpecialChars.ts
|
|
2
2
|
const SPECIAL_CHARS = [
|
|
3
3
|
" ",
|
|
4
4
|
"\\",
|
|
@@ -48,6 +48,5 @@ const listSpecialChars = (text) => {
|
|
|
48
48
|
return results;
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
//#endregion
|
|
52
51
|
export { listSpecialChars };
|
|
53
52
|
//# sourceMappingURL=listSpecialChars.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { chunkText } from "./calculateChunks.mjs";
|
|
2
2
|
import { splitTextByLines } from "@intlayer/engine/utils";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/utils/mapChunksBetweenFiles.ts
|
|
5
5
|
/**
|
|
6
6
|
* Maps chunks from base file to corresponding chunks in updated file,
|
|
7
7
|
* handling insertions, deletions, and modifications properly.
|
|
@@ -96,6 +96,5 @@ const determineIfChunkHasChanges = (baseChunk, updatedChunk, changedLines) => {
|
|
|
96
96
|
return baseChunk.content !== updatedChunk.content;
|
|
97
97
|
};
|
|
98
98
|
|
|
99
|
-
//#endregion
|
|
100
99
|
export { mapChunksBetweenFiles };
|
|
101
100
|
//# sourceMappingURL=mapChunksBetweenFiles.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { exec } from "node:child_process";
|
|
2
2
|
import { platform } from "node:os";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/utils/openBrowser.ts
|
|
5
5
|
const openBrowser = (url) => {
|
|
6
6
|
const osPlatform = platform();
|
|
7
7
|
let command = "";
|
|
@@ -13,6 +13,5 @@ const openBrowser = (url) => {
|
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
//#endregion
|
|
17
16
|
export { openBrowser };
|
|
18
17
|
//# sourceMappingURL=openBrowser.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/parseChoice.ts
|
|
2
2
|
/**
|
|
3
3
|
* Resolves a command-line value against its allowed choices, ignoring case.
|
|
4
4
|
*
|
|
@@ -15,6 +15,5 @@ const parseChoice = (value, choices, optionName) => {
|
|
|
15
15
|
return choice;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
//#endregion
|
|
19
18
|
export { parseChoice };
|
|
20
19
|
//# sourceMappingURL=parseChoice.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { listSpecialChars } from "./listSpecialChars.mjs";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/utils/reorderParagraphs.ts
|
|
4
4
|
/**
|
|
5
5
|
* Split a text into paragraphs.
|
|
6
6
|
*
|
|
@@ -88,6 +88,5 @@ const reorderParagraphs = (textToReorder, baseFileContent) => {
|
|
|
88
88
|
return [...leadingExtras, ...result].join("\n\n");
|
|
89
89
|
};
|
|
90
90
|
|
|
91
|
-
//#endregion
|
|
92
91
|
export { reorderParagraphs };
|
|
93
92
|
//# sourceMappingURL=reorderParagraphs.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as ANSIColors from "@intlayer/config/colors";
|
|
2
2
|
import { colorize, getAppLogger } from "@intlayer/config/logger";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/utils/selectCmsEnvironment.ts
|
|
5
5
|
/**
|
|
6
6
|
* Selects the CMS project environment that matches `environmentName`.
|
|
7
7
|
*
|
|
@@ -39,6 +39,5 @@ const selectCmsEnvironment = async (environmentName, intlayerAPI, config) => {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
//#endregion
|
|
43
42
|
export { selectCmsEnvironment };
|
|
44
43
|
//# sourceMappingURL=selectCmsEnvironment.mjs.map
|
|
@@ -2,7 +2,7 @@ import { checkAIAccess } from "./checkAccess.mjs";
|
|
|
2
2
|
import * as ANSIColors from "@intlayer/config/colors";
|
|
3
3
|
import { colorize, getAppLogger } from "@intlayer/config/logger";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/utils/setupAI.ts
|
|
6
6
|
globalThis.AI_SDK_LOG_WARNINGS = false;
|
|
7
7
|
const logAIConfig = (aiOptions, appLogger) => {
|
|
8
8
|
appLogger([
|
|
@@ -60,6 +60,5 @@ const setupAI = async (configuration, aiOptions) => {
|
|
|
60
60
|
};
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
//#endregion
|
|
64
63
|
export { setupAI };
|
|
65
64
|
//# sourceMappingURL=setupAI.mjs.map
|
package/dist/esm/watch.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { logConfigDetails } from "@intlayer/engine/cli";
|
|
2
1
|
import { getAppLogger } from "@intlayer/config/logger";
|
|
3
2
|
import { getConfiguration } from "@intlayer/config/node";
|
|
3
|
+
import { logConfigDetails } from "@intlayer/engine/cli";
|
|
4
4
|
import { claimCliContentWatcher, reportRedundantContentWatcher, runParallel } from "@intlayer/engine/utils";
|
|
5
5
|
import { watch } from "@intlayer/engine/watcher";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/watch.ts
|
|
8
8
|
/**
|
|
9
9
|
* Grace period granted to the `--with` child (e.g. Next.js/Turbopack) to exit
|
|
10
10
|
* after SIGTERM before it is force-killed with SIGKILL. Detached dev servers
|
|
@@ -67,6 +67,5 @@ const watchContentDeclaration = async (options) => {
|
|
|
67
67
|
process.on("SIGTERM", handleShutdown);
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
//#endregion
|
|
71
70
|
export { watchContentDeclaration };
|
|
72
71
|
//# sourceMappingURL=watch.mjs.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { DictionaryAPI } from "@intlayer/api";
|
|
2
1
|
import { IntlayerConfig } from "@intlayer/types/config";
|
|
3
|
-
|
|
2
|
+
import { DictionaryAPI } from "@intlayer/api";
|
|
4
3
|
export type IntlayerMessageEvent = MessageEvent;
|
|
5
4
|
/**
|
|
6
5
|
* IntlayerEventListener class to listen for dictionary changes via SSE (Server-Sent Events).
|
|
@@ -83,5 +82,4 @@ export declare class IntlayerEventListener {
|
|
|
83
82
|
*/
|
|
84
83
|
private handleError;
|
|
85
84
|
}
|
|
86
|
-
//#endregion
|
|
87
85
|
//# sourceMappingURL=IntlayerEventListener.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerEventListener.d.ts","names":[],"sources":["../../src/IntlayerEventListener.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"IntlayerEventListener.d.ts","names":[],"sources":["../../src/IntlayerEventListener.ts"],"mappings":";;YAOY,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;qBA0BtB;UAoCD;UAnCF;UAEA;UACA;UACA;UACA;UACA;UACA;;;;EAKD,qBAAqB,YAAY;;;;EAKjC,sBAAsB,YAAY;;;;EAKlC,uBAAuB,YAAY;;;;EAKnC;;;;EAKA,qBAAqB,OAAO;EAEnC,YACU,iBAAgB,KAAK;;;;;EAYlB,cAAc;;;;UAQb;;;;EAmDP;;;;UAiBC;;;;;UAoCM;;;;UA8CN"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { GetConfigurationOptions } from "@intlayer/config/node";
|
|
2
|
-
//#region src/auth/login.d.ts
|
|
3
2
|
type LoginOptions = {
|
|
4
3
|
cmsUrl?: string;
|
|
5
4
|
configOptions?: GetConfigurationOptions;
|
|
@@ -26,5 +25,5 @@ type LoginOptions = {
|
|
|
26
25
|
signal?: AbortSignal;
|
|
27
26
|
};
|
|
28
27
|
export declare const login: (options?: LoginOptions) => Promise<void>;
|
|
29
|
-
|
|
28
|
+
export {};
|
|
30
29
|
//# sourceMappingURL=login.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","names":[],"sources":["../../../src/auth/login.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"login.d.ts","names":[],"sources":["../../../src/auth/login.ts"],"mappings":";KAiEK;EACH;EACA,gBAAgB;;;;;;EAMhB;;;;;;;EAOA,iBAAiB;IACf;IACA;eACW;;;;;EAKb,SAAS;;qBAGE,QAAK,UAAmB,iBAAY"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { IntlayerConfig } from "@intlayer/types/config";
|
|
2
|
-
//#region src/auth/sessionToken.d.ts
|
|
3
2
|
export type CliSessionData = {
|
|
4
3
|
token: string;
|
|
5
4
|
expiresAt: string;
|
|
@@ -7,5 +6,4 @@ export type CliSessionData = {
|
|
|
7
6
|
export declare const writeCliSessionToken: (config: IntlayerConfig, token: string, expiresAt: Date) => Promise<void>;
|
|
8
7
|
export declare const readCliSessionToken: (config: IntlayerConfig) => Promise<CliSessionData | null>;
|
|
9
8
|
export declare const clearCliSessionToken: (config: IntlayerConfig) => Promise<void>;
|
|
10
|
-
//#endregion
|
|
11
9
|
//# sourceMappingURL=sessionToken.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionToken.d.ts","names":[],"sources":["../../../src/auth/sessionToken.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sessionToken.d.ts","names":[],"sources":["../../../src/auth/sessionToken.ts"],"mappings":";YAMY;EACV;EACA;;qBAMW,uBAAoB,QACvB,gBAAc,eACT,WACF,SACV;qBASU,sBAAmB,QACtB,mBACP,QAAQ;qBAsBE,uBAAoB,QACvB,mBACP"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DetectedGitRepository } from "../utils/detectGitRepository.js";
|
|
2
2
|
import { GetConfigurationOptions } from "@intlayer/config/node";
|
|
3
|
-
//#region src/auth/setupRepository.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Search params pre-filling the repository page with the local repository.
|
|
6
5
|
* Empty when none was detected: the user then picks it in the browser.
|
|
@@ -21,5 +20,5 @@ export type SetupRepositoryResult = {
|
|
|
21
20
|
* call back the local server once the repository and build settings are set.
|
|
22
21
|
*/
|
|
23
22
|
export declare const setupRepository: (options?: SetupRepositoryOptions) => Promise<SetupRepositoryResult>;
|
|
24
|
-
|
|
23
|
+
export {};
|
|
25
24
|
//# sourceMappingURL=setupRepository.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupRepository.d.ts","names":[],"sources":["../../../src/auth/setupRepository.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"setupRepository.d.ts","names":[],"sources":["../../../src/auth/setupRepository.ts"],"mappings":";;;;;;qBAqCa,4BAAyB,oBAChB,6CACnB;KAkBE;EACH;EACA,gBAAgB;;EAEhB,qBAAqB;;;YAIX;EACV;;;;;;qBAOW,kBAAe,UACjB,2BACR,QAAQ"}
|
package/dist/types/build.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { GetConfigurationOptions } from "@intlayer/config/node";
|
|
2
|
-
//#region src/build.d.ts
|
|
3
2
|
type BuildOptions = {
|
|
4
3
|
watch?: boolean;
|
|
5
4
|
skipPrepare?: boolean;
|
|
@@ -11,5 +10,5 @@ type BuildOptions = {
|
|
|
11
10
|
* Watch mode available to get the change in the .content.{json|ts|tsx|js|jsx|mjs|cjs}
|
|
12
11
|
*/
|
|
13
12
|
export declare const build: (options?: BuildOptions) => Promise<void>;
|
|
14
|
-
|
|
13
|
+
export {};
|
|
15
14
|
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","names":[],"sources":["../../src/build.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.d.ts","names":[],"sources":["../../src/build.ts"],"mappings":";KAaK;EACH;EACA;EACA;EACA,gBAAgB;;;;;;qBAOL,QAAK,UAAoB,iBAAY"}
|
package/dist/types/bundle.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","names":[],"sources":["../../src/bundle.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","names":[],"sources":["../../src/bundle.ts"],"mappings":";qBA6Ca,SAAM,SAAmB,0BAAwB"}
|
package/dist/types/ci.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/ci.d.ts
|
|
2
1
|
/** Command used to run the locally installed `intlayer` binary. */
|
|
3
2
|
type PackageManagerCommand = {
|
|
4
3
|
command: string;
|
|
@@ -51,5 +50,5 @@ export declare const removeCIFlag: (args: string[]) => string[];
|
|
|
51
50
|
* failed in at least one project, `0` otherwise.
|
|
52
51
|
*/
|
|
53
52
|
export declare const runCI: (commands: string[]) => Promise<number>;
|
|
54
|
-
|
|
53
|
+
export {};
|
|
55
54
|
//# sourceMappingURL=ci.d.ts.map
|
package/dist/types/ci.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci.d.ts","names":[],"sources":["../../src/ci.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ci.d.ts","names":[],"sources":["../../src/ci.ts"],"mappings":";KAuBK;EACH;EACA;;;;;;;;qBASW,2BAAwB,8BAElC;;;;;;;;;;qBAuCU,+BAA4B,aAC5B,qBACQ;;;;;;;;qBA2BR,sBAAmB,2BACL,mBACR;EAEd;EAAyB;;;qBAoBjB;;;;;qBAMA,eAAY;;;;;;;;;;;;qBAcZ,QAAK,uBAA+B"}
|
package/dist/types/cli.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
-
//#region src/cli.d.ts
|
|
3
2
|
export declare const dirname: string;
|
|
4
3
|
type LogOptions = {
|
|
5
4
|
prefix?: string;
|
|
@@ -21,5 +20,5 @@ export type ConfigurationOptions = {
|
|
|
21
20
|
* npm run intlayer push --dictionaries id1 id2 id3 --deleteLocaleDir
|
|
22
21
|
*/
|
|
23
22
|
export declare const setAPI: () => Command;
|
|
24
|
-
|
|
23
|
+
export {};
|
|
25
24
|
//# sourceMappingURL=cli.d.ts.map
|
package/dist/types/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","names":[],"sources":["../../src/cli.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.d.ts","names":[],"sources":["../../src/cli.ts"],"mappings":";qBAqBa;KAuJR;EACH;EACA;;YAGU;EACV;EACA;EACA;EACA;EACA;IACE;;;;;;;;;qBAiES,cAAa"}
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { GetConfigurationOptions } from "@intlayer/config/node";
|
|
2
|
-
//#region src/config.d.ts
|
|
3
2
|
type ConfigOptions = {
|
|
4
3
|
configOptions?: GetConfigurationOptions;
|
|
5
4
|
};
|
|
6
5
|
export declare const getConfig: (options?: ConfigOptions) => void;
|
|
7
|
-
|
|
6
|
+
export {};
|
|
8
7
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","names":[],"sources":["../../src/config.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","names":[],"sources":["../../src/config.ts"],"mappings":";KAOK;EACH,gBAAgB;;qBAgBL,YAAS,UAAc"}
|
package/dist/types/editor.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/editor.d.ts
|
|
2
1
|
type StartEditorOptions = {
|
|
3
2
|
env?: string;
|
|
4
3
|
envFile?: string;
|
|
@@ -14,5 +13,5 @@ export declare const getRemoteEditorRunners: (cliVersion: string | undefined) =>
|
|
|
14
13
|
* not installed).
|
|
15
14
|
*/
|
|
16
15
|
export declare const startEditor: (options: StartEditorOptions) => void;
|
|
17
|
-
|
|
16
|
+
export {};
|
|
18
17
|
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","names":[],"sources":["../../src/editor.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor.d.ts","names":[],"sources":["../../src/editor.ts"],"mappings":"A,KAYK;EACH;EACA;;;;;;qBAaW,yBAAsB,oCAE/B,iBAAiB;;;;;;qBA8DR,cAAW,SAAa"}
|