@intlayer/cli 7.2.3 → 7.3.0-canary.0

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.
Files changed (94) hide show
  1. package/README.md +2 -0
  2. package/dist/cjs/cli.cjs +7 -5
  3. package/dist/cjs/cli.cjs.map +1 -1
  4. package/dist/cjs/fill/fill.cjs +9 -10
  5. package/dist/cjs/fill/fill.cjs.map +1 -1
  6. package/dist/cjs/fill/formatFillData.cjs +9 -9
  7. package/dist/cjs/fill/formatFillData.cjs.map +1 -1
  8. package/dist/cjs/fill/listTranslationsTasks.cjs +4 -10
  9. package/dist/cjs/fill/listTranslationsTasks.cjs.map +1 -1
  10. package/dist/cjs/fill/translateDictionary.cjs +58 -19
  11. package/dist/cjs/fill/translateDictionary.cjs.map +1 -1
  12. package/dist/cjs/fill/writeFill.cjs +7 -4
  13. package/dist/cjs/fill/writeFill.cjs.map +1 -1
  14. package/dist/cjs/index.cjs +4 -3
  15. package/dist/cjs/reviewDoc.cjs +5 -3
  16. package/dist/cjs/reviewDoc.cjs.map +1 -1
  17. package/dist/cjs/reviewDocBlockAware.cjs +2 -2
  18. package/dist/cjs/reviewDocBlockAware.cjs.map +1 -1
  19. package/dist/cjs/test/index.cjs +3 -49
  20. package/dist/cjs/test/listMissingTranslations.cjs +5 -2
  21. package/dist/cjs/test/listMissingTranslations.cjs.map +1 -1
  22. package/dist/cjs/test/test.cjs +51 -0
  23. package/dist/cjs/test/test.cjs.map +1 -0
  24. package/dist/cjs/transform.cjs +3 -1
  25. package/dist/cjs/transform.cjs.map +1 -1
  26. package/dist/cjs/translateDoc.cjs +7 -5
  27. package/dist/cjs/translateDoc.cjs.map +1 -1
  28. package/dist/cjs/utils/checkAccess.cjs +12 -1
  29. package/dist/cjs/utils/checkAccess.cjs.map +1 -1
  30. package/dist/cjs/utils/chunkInference.cjs +18 -2
  31. package/dist/cjs/utils/chunkInference.cjs.map +1 -1
  32. package/dist/cjs/utils/setupAI.cjs +39 -0
  33. package/dist/cjs/utils/setupAI.cjs.map +1 -0
  34. package/dist/esm/cli.mjs +5 -3
  35. package/dist/esm/cli.mjs.map +1 -1
  36. package/dist/esm/fill/fill.mjs +10 -11
  37. package/dist/esm/fill/fill.mjs.map +1 -1
  38. package/dist/esm/fill/formatFillData.mjs +9 -9
  39. package/dist/esm/fill/formatFillData.mjs.map +1 -1
  40. package/dist/esm/fill/listTranslationsTasks.mjs +5 -11
  41. package/dist/esm/fill/listTranslationsTasks.mjs.map +1 -1
  42. package/dist/esm/fill/translateDictionary.mjs +59 -20
  43. package/dist/esm/fill/translateDictionary.mjs.map +1 -1
  44. package/dist/esm/fill/writeFill.mjs +7 -4
  45. package/dist/esm/fill/writeFill.mjs.map +1 -1
  46. package/dist/esm/index.mjs +3 -3
  47. package/dist/esm/reviewDoc.mjs +5 -3
  48. package/dist/esm/reviewDoc.mjs.map +1 -1
  49. package/dist/esm/reviewDocBlockAware.mjs +2 -2
  50. package/dist/esm/reviewDocBlockAware.mjs.map +1 -1
  51. package/dist/esm/test/index.mjs +3 -49
  52. package/dist/esm/test/listMissingTranslations.mjs +5 -3
  53. package/dist/esm/test/listMissingTranslations.mjs.map +1 -1
  54. package/dist/esm/test/test.mjs +50 -0
  55. package/dist/esm/test/test.mjs.map +1 -0
  56. package/dist/esm/transform.mjs +3 -1
  57. package/dist/esm/transform.mjs.map +1 -1
  58. package/dist/esm/translateDoc.mjs +7 -5
  59. package/dist/esm/translateDoc.mjs.map +1 -1
  60. package/dist/esm/utils/checkAccess.mjs +13 -2
  61. package/dist/esm/utils/checkAccess.mjs.map +1 -1
  62. package/dist/esm/utils/chunkInference.mjs +18 -2
  63. package/dist/esm/utils/chunkInference.mjs.map +1 -1
  64. package/dist/esm/utils/setupAI.mjs +38 -0
  65. package/dist/esm/utils/setupAI.mjs.map +1 -0
  66. package/dist/types/cli.d.ts.map +1 -1
  67. package/dist/types/fill/fill.d.ts.map +1 -1
  68. package/dist/types/fill/formatFillData.d.ts +1 -1
  69. package/dist/types/fill/formatFillData.d.ts.map +1 -1
  70. package/dist/types/fill/listTranslationsTasks.d.ts.map +1 -1
  71. package/dist/types/fill/translateDictionary.d.ts +4 -0
  72. package/dist/types/fill/translateDictionary.d.ts.map +1 -1
  73. package/dist/types/index.d.ts +4 -3
  74. package/dist/types/reviewDoc.d.ts.map +1 -1
  75. package/dist/types/reviewDocBlockAware.d.ts +3 -1
  76. package/dist/types/reviewDocBlockAware.d.ts.map +1 -1
  77. package/dist/types/test/index.d.ts +3 -12
  78. package/dist/types/test/listMissingTranslations.d.ts +12 -2
  79. package/dist/types/test/listMissingTranslations.d.ts.map +1 -1
  80. package/dist/types/test/test.d.ts +11 -0
  81. package/dist/types/test/test.d.ts.map +1 -0
  82. package/dist/types/transform.d.ts +2 -0
  83. package/dist/types/transform.d.ts.map +1 -1
  84. package/dist/types/translateDoc.d.ts +3 -2
  85. package/dist/types/translateDoc.d.ts.map +1 -1
  86. package/dist/types/utils/checkAccess.d.ts.map +1 -1
  87. package/dist/types/utils/chunkInference.d.ts +4 -2
  88. package/dist/types/utils/chunkInference.d.ts.map +1 -1
  89. package/dist/types/utils/setupAI.d.ts +21 -0
  90. package/dist/types/utils/setupAI.d.ts.map +1 -0
  91. package/package.json +11 -10
  92. package/dist/cjs/test/index.cjs.map +0 -1
  93. package/dist/esm/test/index.mjs.map +0 -1
  94. package/dist/types/test/index.d.ts.map +0 -1
@@ -0,0 +1,50 @@
1
+ import { listMissingTranslations } from "./listMissingTranslations.mjs";
2
+ import { formatLocale, formatPath, prepareIntlayer } from "@intlayer/chokidar";
3
+ import { ANSIColors, colon, colorize, colorizeKey, colorizeNumber, getAppLogger, getConfiguration } from "@intlayer/config";
4
+
5
+ //#region src/test/test.ts
6
+ const testMissingTranslations = async (options) => {
7
+ const config = getConfiguration(options?.configOptions);
8
+ const { locales, requiredLocales } = config.internationalization;
9
+ const appLogger = getAppLogger(config, { config: { prefix: "" } });
10
+ if (options?.build === true) await prepareIntlayer(config, { forceRun: true });
11
+ else if (typeof options?.build === "undefined") await prepareIntlayer(config);
12
+ const result = listMissingTranslations(options?.configOptions);
13
+ const maxKeyColSize = result.missingTranslations.map((t) => ` - ${t.key}`).reduce((max, t) => Math.max(max, t.length), 0);
14
+ const maxLocalesColSize = result.missingTranslations.map((t) => formatLocale(t.locales, false)).reduce((max, t) => Math.max(max, t.length), 0);
15
+ const formattedMissingTranslations = result.missingTranslations.map((translation) => [
16
+ colon(` - ${colorizeKey(translation.key)}`, {
17
+ colSize: maxKeyColSize,
18
+ maxSize: 40
19
+ }),
20
+ " - ",
21
+ colon(formatLocale(translation.locales, ANSIColors.RED), {
22
+ colSize: maxLocalesColSize,
23
+ maxSize: 40
24
+ }),
25
+ translation.filePath ? ` - ${formatPath(translation.filePath)}` : "",
26
+ translation.id ? " - remote" : ""
27
+ ].join(""));
28
+ appLogger(`Missing translations:`, { level: "info" });
29
+ formattedMissingTranslations.forEach((t) => {
30
+ appLogger(t, { level: "info" });
31
+ });
32
+ appLogger(`Locales: ${formatLocale(locales)}`);
33
+ appLogger(`Required locales: ${formatLocale(requiredLocales ?? locales)}`);
34
+ appLogger(`Missing locales: ${result.missingLocales.length === 0 ? colorize("-", ANSIColors.GREEN) : formatLocale(result.missingLocales, ANSIColors.RED)}`);
35
+ appLogger(`Missing required locales: ${result.missingRequiredLocales.length === 0 ? colorize("-", ANSIColors.GREEN) : formatLocale(result.missingRequiredLocales, ANSIColors.RED)}`);
36
+ appLogger(`Total missing locales: ${colorizeNumber(result.missingLocales.length, {
37
+ one: ANSIColors.RED,
38
+ other: ANSIColors.RED,
39
+ zero: ANSIColors.GREEN
40
+ })}`);
41
+ appLogger(`Total missing required locales: ${colorizeNumber(result.missingRequiredLocales.length, {
42
+ one: ANSIColors.RED,
43
+ other: ANSIColors.RED,
44
+ zero: ANSIColors.GREEN
45
+ })}`);
46
+ };
47
+
48
+ //#endregion
49
+ export { testMissingTranslations };
50
+ //# sourceMappingURL=test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.mjs","names":[],"sources":["../../../src/test/test.ts"],"sourcesContent":["import { formatLocale, formatPath, prepareIntlayer } from '@intlayer/chokidar';\nimport {\n ANSIColors,\n colon,\n colorize,\n colorizeKey,\n colorizeNumber,\n type GetConfigurationOptions,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { listMissingTranslations } from './listMissingTranslations';\n\ntype ListMissingTranslationsOptions = {\n configOptions?: GetConfigurationOptions;\n build?: boolean;\n};\n\nexport const testMissingTranslations = async (\n options?: ListMissingTranslationsOptions\n) => {\n const config = getConfiguration(options?.configOptions);\n const { locales, requiredLocales } = config.internationalization;\n\n const appLogger = getAppLogger(config, {\n config: {\n prefix: '',\n },\n });\n\n if (options?.build === true) {\n await prepareIntlayer(config, { forceRun: true });\n } else if (typeof options?.build === 'undefined') {\n await prepareIntlayer(config);\n }\n\n const result = listMissingTranslations(options?.configOptions);\n\n const maxKeyColSize = result.missingTranslations\n .map((t) => ` - ${t.key}`)\n .reduce((max, t) => Math.max(max, t.length), 0);\n const maxLocalesColSize = result.missingTranslations\n .map((t) => formatLocale(t.locales, false))\n .reduce((max, t) => Math.max(max, t.length), 0);\n\n const formattedMissingTranslations = result.missingTranslations.map(\n (translation) =>\n [\n colon(` - ${colorizeKey(translation.key)}`, {\n colSize: maxKeyColSize,\n maxSize: 40,\n }),\n ' - ',\n colon(formatLocale(translation.locales, ANSIColors.RED), {\n colSize: maxLocalesColSize,\n maxSize: 40,\n }),\n\n translation.filePath ? ` - ${formatPath(translation.filePath)}` : '',\n translation.id ? ' - remote' : '',\n ].join('')\n );\n\n appLogger(`Missing translations:`, {\n level: 'info',\n });\n\n formattedMissingTranslations.forEach((t) => {\n appLogger(t, {\n level: 'info',\n });\n });\n\n appLogger(`Locales: ${formatLocale(locales)}`);\n appLogger(`Required locales: ${formatLocale(requiredLocales ?? locales)}`);\n appLogger(\n `Missing locales: ${result.missingLocales.length === 0 ? colorize('-', ANSIColors.GREEN) : formatLocale(result.missingLocales, ANSIColors.RED)}`\n );\n\n appLogger(\n `Missing required locales: ${result.missingRequiredLocales.length === 0 ? colorize('-', ANSIColors.GREEN) : formatLocale(result.missingRequiredLocales, ANSIColors.RED)}`\n );\n appLogger(\n `Total missing locales: ${colorizeNumber(result.missingLocales.length, {\n one: ANSIColors.RED,\n other: ANSIColors.RED,\n zero: ANSIColors.GREEN,\n })}`\n );\n appLogger(\n `Total missing required locales: ${colorizeNumber(\n result.missingRequiredLocales.length,\n {\n one: ANSIColors.RED,\n other: ANSIColors.RED,\n zero: ANSIColors.GREEN,\n }\n )}`\n );\n};\n"],"mappings":";;;;;AAkBA,MAAa,0BAA0B,OACrC,YACG;CACH,MAAM,SAAS,iBAAiB,SAAS,cAAc;CACvD,MAAM,EAAE,SAAS,oBAAoB,OAAO;CAE5C,MAAM,YAAY,aAAa,QAAQ,EACrC,QAAQ,EACN,QAAQ,IACT,EACF,CAAC;AAEF,KAAI,SAAS,UAAU,KACrB,OAAM,gBAAgB,QAAQ,EAAE,UAAU,MAAM,CAAC;UACxC,OAAO,SAAS,UAAU,YACnC,OAAM,gBAAgB,OAAO;CAG/B,MAAM,SAAS,wBAAwB,SAAS,cAAc;CAE9D,MAAM,gBAAgB,OAAO,oBAC1B,KAAK,MAAM,MAAM,EAAE,MAAM,CACzB,QAAQ,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,OAAO,EAAE,EAAE;CACjD,MAAM,oBAAoB,OAAO,oBAC9B,KAAK,MAAM,aAAa,EAAE,SAAS,MAAM,CAAC,CAC1C,QAAQ,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,OAAO,EAAE,EAAE;CAEjD,MAAM,+BAA+B,OAAO,oBAAoB,KAC7D,gBACC;EACE,MAAM,MAAM,YAAY,YAAY,IAAI,IAAI;GAC1C,SAAS;GACT,SAAS;GACV,CAAC;EACF;EACA,MAAM,aAAa,YAAY,SAAS,WAAW,IAAI,EAAE;GACvD,SAAS;GACT,SAAS;GACV,CAAC;EAEF,YAAY,WAAW,MAAM,WAAW,YAAY,SAAS,KAAK;EAClE,YAAY,KAAK,cAAc;EAChC,CAAC,KAAK,GAAG,CACb;AAED,WAAU,yBAAyB,EACjC,OAAO,QACR,CAAC;AAEF,8BAA6B,SAAS,MAAM;AAC1C,YAAU,GAAG,EACX,OAAO,QACR,CAAC;GACF;AAEF,WAAU,YAAY,aAAa,QAAQ,GAAG;AAC9C,WAAU,qBAAqB,aAAa,mBAAmB,QAAQ,GAAG;AAC1E,WACE,oBAAoB,OAAO,eAAe,WAAW,IAAI,SAAS,KAAK,WAAW,MAAM,GAAG,aAAa,OAAO,gBAAgB,WAAW,IAAI,GAC/I;AAED,WACE,6BAA6B,OAAO,uBAAuB,WAAW,IAAI,SAAS,KAAK,WAAW,MAAM,GAAG,aAAa,OAAO,wBAAwB,WAAW,IAAI,GACxK;AACD,WACE,0BAA0B,eAAe,OAAO,eAAe,QAAQ;EACrE,KAAK,WAAW;EAChB,OAAO,WAAW;EAClB,MAAM,WAAW;EAClB,CAAC,GACH;AACD,WACE,mCAAmC,eACjC,OAAO,uBAAuB,QAC9B;EACE,KAAK,WAAW;EAChB,OAAO,WAAW;EAClB,MAAM,WAAW;EAClB,CACF,GACF"}
@@ -81,7 +81,9 @@ const transform = async (options) => {
81
81
  if (absoluteFiles.length === 0) return;
82
82
  await transformFiles(absoluteFiles, packageName, {
83
83
  configOptions: options.configOptions,
84
- outputDir: options.outputContentDeclarations
84
+ outputDir: options.outputContentDeclarations,
85
+ codeOnly: options.codeOnly,
86
+ declarationOnly: options.declarationOnly
85
87
  });
86
88
  };
87
89
 
@@ -1 +1 @@
1
- {"version":3,"file":"transform.mjs","names":["formatPath","packageName: PackageName"],"sources":["../../src/transform.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport { relative, resolve } from 'node:path';\nimport { multiselect } from '@clack/prompts';\nimport { type PackageName, transformFiles } from '@intlayer/chokidar';\nimport {\n colorizePath,\n type GetConfigurationOptions,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport fg from 'fast-glob';\n\ntype TransformOptions = {\n files?: string[];\n outputContentDeclarations?: string;\n configOptions?: GetConfigurationOptions;\n};\n\n// Helper to read package.json dependencies\nconst getDependencies = async (baseDir: string) => {\n try {\n const packageJsonPath = resolve(baseDir, 'package.json');\n if (!existsSync(packageJsonPath)) {\n // Try parent directory if not found in baseDir\n return {};\n }\n const file = await readFile(packageJsonPath, 'utf8');\n const packageJSON = JSON.parse(file);\n\n return packageJSON.dependencies;\n } catch {\n return {};\n }\n};\n\nexport const transform = async (options: TransformOptions) => {\n const configuration = getConfiguration(options.configOptions);\n const appLogger = getAppLogger(configuration);\n const { baseDir } = configuration.content;\n\n const formatPath = (path: string) => {\n const relativePath = relative(baseDir, path);\n return colorizePath(relativePath);\n };\n\n // Detect package\n const dependencies = await getDependencies(baseDir);\n let packageName: PackageName = 'react-intlayer';\n\n if (dependencies['next-intlayer']) {\n packageName = 'next-intlayer';\n } else if (dependencies['vue-intlayer']) {\n packageName = 'vue-intlayer';\n } else if (dependencies['svelte-intlayer']) {\n packageName = 'svelte-intlayer';\n } else if (dependencies['react-intlayer']) {\n packageName = 'react-intlayer';\n } else if (dependencies['preact-intlayer']) {\n packageName = 'preact-intlayer';\n } else if (dependencies['solid-intlayer']) {\n packageName = 'solid-intlayer';\n } else if (dependencies['angular-intlayer']) {\n packageName = 'angular-intlayer';\n } else if (dependencies['express-intlayer']) {\n packageName = 'express-intlayer';\n }\n\n let filesToTransform = options.files ?? [];\n\n if (filesToTransform.length === 0) {\n const globPattern = '**/*.{tsx,jsx,vue,svelte,ts,js}';\n const excludePattern = [\n '**/*.content.{ts,tsx,js,jsx,mjs,cjs}',\n '**/*.config.{ts,tsx,js,jsx,mjs,cjs}',\n '**/*.test.{ts,tsx,js,jsx,mjs,cjs}',\n '**/*.stories.{ts,tsx,js,jsx,mjs,cjs}',\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**',\n ];\n\n const allFiles = await fg(globPattern, {\n cwd: baseDir,\n ignore: excludePattern,\n absolute: true,\n });\n\n // Remove duplicates and non-existing files\n const uniqueFiles = [...new Set(allFiles)].filter((file) =>\n existsSync(file)\n );\n\n // Relative paths for selection\n const choices = uniqueFiles.map((file) => {\n const relPath = relative(baseDir, file);\n return {\n value: file,\n label: relPath,\n };\n });\n\n if (choices.length === 0) {\n appLogger('No transformable files found in the project.');\n return;\n }\n\n const selectedFiles = await multiselect({\n message: 'Select files to transform:',\n options: choices,\n required: false,\n });\n\n if (typeof selectedFiles === 'symbol') {\n // User cancelled\n process.exit(0);\n }\n\n filesToTransform = selectedFiles as string[];\n }\n\n if (filesToTransform.length === 0) {\n appLogger('No files selected for transformation.');\n return;\n }\n\n const absoluteFiles = filesToTransform\n .map((file) => resolve(baseDir, file))\n .filter((file) => {\n if (!existsSync(file)) {\n appLogger(`File not found: ${formatPath(file)}`);\n return false;\n }\n return true;\n });\n\n if (absoluteFiles.length === 0) {\n return;\n }\n\n await transformFiles(absoluteFiles, packageName, {\n configOptions: options.configOptions,\n outputDir: options.outputContentDeclarations,\n });\n};\n"],"mappings":";;;;;;;;;AAoBA,MAAM,kBAAkB,OAAO,YAAoB;AACjD,KAAI;EACF,MAAM,kBAAkB,QAAQ,SAAS,eAAe;AACxD,MAAI,CAAC,WAAW,gBAAgB,CAE9B,QAAO,EAAE;EAEX,MAAM,OAAO,MAAM,SAAS,iBAAiB,OAAO;AAGpD,SAFoB,KAAK,MAAM,KAAK,CAEjB;SACb;AACN,SAAO,EAAE;;;AAIb,MAAa,YAAY,OAAO,YAA8B;CAC5D,MAAM,gBAAgB,iBAAiB,QAAQ,cAAc;CAC7D,MAAM,YAAY,aAAa,cAAc;CAC7C,MAAM,EAAE,YAAY,cAAc;CAElC,MAAMA,gBAAc,SAAiB;AAEnC,SAAO,aADc,SAAS,SAAS,KAAK,CACX;;CAInC,MAAM,eAAe,MAAM,gBAAgB,QAAQ;CACnD,IAAIC,cAA2B;AAE/B,KAAI,aAAa,iBACf,eAAc;UACL,aAAa,gBACtB,eAAc;UACL,aAAa,mBACtB,eAAc;UACL,aAAa,kBACtB,eAAc;UACL,aAAa,mBACtB,eAAc;UACL,aAAa,kBACtB,eAAc;UACL,aAAa,oBACtB,eAAc;UACL,aAAa,oBACtB,eAAc;CAGhB,IAAI,mBAAmB,QAAQ,SAAS,EAAE;AAE1C,KAAI,iBAAiB,WAAW,GAAG;EAYjC,MAAM,WAAW,MAAM,GAXH,mCAWmB;GACrC,KAAK;GACL,QAZqB;IACrB;IACA;IACA;IACA;IACA;IACA;IACA;IACD;GAKC,UAAU;GACX,CAAC;EAQF,MAAM,UALc,CAAC,GAAG,IAAI,IAAI,SAAS,CAAC,CAAC,QAAQ,SACjD,WAAW,KAAK,CACjB,CAG2B,KAAK,SAAS;AAExC,UAAO;IACL,OAAO;IACP,OAHc,SAAS,SAAS,KAAK;IAItC;IACD;AAEF,MAAI,QAAQ,WAAW,GAAG;AACxB,aAAU,+CAA+C;AACzD;;EAGF,MAAM,gBAAgB,MAAM,YAAY;GACtC,SAAS;GACT,SAAS;GACT,UAAU;GACX,CAAC;AAEF,MAAI,OAAO,kBAAkB,SAE3B,SAAQ,KAAK,EAAE;AAGjB,qBAAmB;;AAGrB,KAAI,iBAAiB,WAAW,GAAG;AACjC,YAAU,wCAAwC;AAClD;;CAGF,MAAM,gBAAgB,iBACnB,KAAK,SAAS,QAAQ,SAAS,KAAK,CAAC,CACrC,QAAQ,SAAS;AAChB,MAAI,CAAC,WAAW,KAAK,EAAE;AACrB,aAAU,mBAAmBD,aAAW,KAAK,GAAG;AAChD,UAAO;;AAET,SAAO;GACP;AAEJ,KAAI,cAAc,WAAW,EAC3B;AAGF,OAAM,eAAe,eAAe,aAAa;EAC/C,eAAe,QAAQ;EACvB,WAAW,QAAQ;EACpB,CAAC"}
1
+ {"version":3,"file":"transform.mjs","names":["formatPath","packageName: PackageName"],"sources":["../../src/transform.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport { relative, resolve } from 'node:path';\nimport { multiselect } from '@clack/prompts';\nimport { type PackageName, transformFiles } from '@intlayer/chokidar';\nimport {\n colorizePath,\n type GetConfigurationOptions,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport fg from 'fast-glob';\n\ntype TransformOptions = {\n files?: string[];\n outputContentDeclarations?: string;\n configOptions?: GetConfigurationOptions;\n codeOnly?: boolean;\n declarationOnly?: boolean;\n};\n\n// Helper to read package.json dependencies\nconst getDependencies = async (baseDir: string) => {\n try {\n const packageJsonPath = resolve(baseDir, 'package.json');\n if (!existsSync(packageJsonPath)) {\n // Try parent directory if not found in baseDir\n return {};\n }\n const file = await readFile(packageJsonPath, 'utf8');\n const packageJSON = JSON.parse(file);\n\n return packageJSON.dependencies;\n } catch {\n return {};\n }\n};\n\nexport const transform = async (options: TransformOptions) => {\n const configuration = getConfiguration(options.configOptions);\n const appLogger = getAppLogger(configuration);\n const { baseDir } = configuration.content;\n\n const formatPath = (path: string) => {\n const relativePath = relative(baseDir, path);\n return colorizePath(relativePath);\n };\n\n // Detect package\n const dependencies = await getDependencies(baseDir);\n let packageName: PackageName = 'react-intlayer';\n\n if (dependencies['next-intlayer']) {\n packageName = 'next-intlayer';\n } else if (dependencies['vue-intlayer']) {\n packageName = 'vue-intlayer';\n } else if (dependencies['svelte-intlayer']) {\n packageName = 'svelte-intlayer';\n } else if (dependencies['react-intlayer']) {\n packageName = 'react-intlayer';\n } else if (dependencies['preact-intlayer']) {\n packageName = 'preact-intlayer';\n } else if (dependencies['solid-intlayer']) {\n packageName = 'solid-intlayer';\n } else if (dependencies['angular-intlayer']) {\n packageName = 'angular-intlayer';\n } else if (dependencies['express-intlayer']) {\n packageName = 'express-intlayer';\n }\n\n let filesToTransform = options.files ?? [];\n\n if (filesToTransform.length === 0) {\n const globPattern = '**/*.{tsx,jsx,vue,svelte,ts,js}';\n const excludePattern = [\n '**/*.content.{ts,tsx,js,jsx,mjs,cjs}',\n '**/*.config.{ts,tsx,js,jsx,mjs,cjs}',\n '**/*.test.{ts,tsx,js,jsx,mjs,cjs}',\n '**/*.stories.{ts,tsx,js,jsx,mjs,cjs}',\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**',\n ];\n\n const allFiles = await fg(globPattern, {\n cwd: baseDir,\n ignore: excludePattern,\n absolute: true,\n });\n\n // Remove duplicates and non-existing files\n const uniqueFiles = [...new Set(allFiles)].filter((file) =>\n existsSync(file)\n );\n\n // Relative paths for selection\n const choices = uniqueFiles.map((file) => {\n const relPath = relative(baseDir, file);\n return {\n value: file,\n label: relPath,\n };\n });\n\n if (choices.length === 0) {\n appLogger('No transformable files found in the project.');\n return;\n }\n\n const selectedFiles = await multiselect({\n message: 'Select files to transform:',\n options: choices,\n required: false,\n });\n\n if (typeof selectedFiles === 'symbol') {\n // User cancelled\n process.exit(0);\n }\n\n filesToTransform = selectedFiles as string[];\n }\n\n if (filesToTransform.length === 0) {\n appLogger('No files selected for transformation.');\n return;\n }\n\n const absoluteFiles = filesToTransform\n .map((file) => resolve(baseDir, file))\n .filter((file) => {\n if (!existsSync(file)) {\n appLogger(`File not found: ${formatPath(file)}`);\n return false;\n }\n return true;\n });\n\n if (absoluteFiles.length === 0) {\n return;\n }\n\n await transformFiles(absoluteFiles, packageName, {\n configOptions: options.configOptions,\n outputDir: options.outputContentDeclarations,\n codeOnly: options.codeOnly,\n declarationOnly: options.declarationOnly,\n });\n};\n"],"mappings":";;;;;;;;;AAsBA,MAAM,kBAAkB,OAAO,YAAoB;AACjD,KAAI;EACF,MAAM,kBAAkB,QAAQ,SAAS,eAAe;AACxD,MAAI,CAAC,WAAW,gBAAgB,CAE9B,QAAO,EAAE;EAEX,MAAM,OAAO,MAAM,SAAS,iBAAiB,OAAO;AAGpD,SAFoB,KAAK,MAAM,KAAK,CAEjB;SACb;AACN,SAAO,EAAE;;;AAIb,MAAa,YAAY,OAAO,YAA8B;CAC5D,MAAM,gBA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AAET,SAAO;GACP;AAEJ,KAAI,cAAc,WAAW,EAC3B;AAGF,OAAM,eAAe,eAAe,aAAa;EAC/C,eAAe,QAAQ;EACvB,WAAW,QAAQ;EACnB,UAAU,QAAQ;EAClB,iBAAiB,QAAQ;EAC1B,CAAC"}
@@ -1,4 +1,4 @@
1
- import { checkAIAccess } from "./utils/checkAccess.mjs";
1
+ import { setupAI } from "./utils/setupAI.mjs";
2
2
  import { readAsset } from "./_virtual/_utils_asset.mjs";
3
3
  import { chunkInference } from "./utils/chunkInference.mjs";
4
4
  import { fixChunkStartEndChars } from "./utils/fixChunkStartEndChars.mjs";
@@ -16,7 +16,7 @@ import fg from "fast-glob";
16
16
  /**
17
17
  * Translate a single file for a given locale
18
18
  */
19
- const translateFile = async (baseFilePath, outputFilePath, locale, baseLocale, configuration, aiOptions, customInstructions) => {
19
+ const translateFile = async (baseFilePath, outputFilePath, locale, baseLocale, configuration, aiOptions, customInstructions, aiClient, aiConfig) => {
20
20
  try {
21
21
  const appLogger = getAppLogger(configuration, { config: { prefix: "" } });
22
22
  const fileContent = await readFile(baseFilePath, "utf-8");
@@ -53,7 +53,7 @@ const translateFile = async (baseFilePath, outputFilePath, locale, baseLocale, c
53
53
  role: "user",
54
54
  content: fileToTranslateCurrentChunk
55
55
  }
56
- ], aiOptions, configuration);
56
+ ], aiOptions, configuration, aiClient, aiConfig);
57
57
  appLogger([
58
58
  `${prefix}`,
59
59
  `${ANSIColors.GREY_DARK}[Chunk `,
@@ -87,7 +87,9 @@ const translateDoc = async ({ docPattern, locales, excludedGlobPattern, baseLoca
87
87
  nbSimultaneousFileProcessed = 10;
88
88
  }
89
89
  let docList = await fg(docPattern, { ignore: excludedGlobPattern });
90
- if (!await checkAIAccess(configuration, aiOptions)) return;
90
+ const aiResult = await setupAI(configuration, aiOptions);
91
+ if (!aiResult?.hasAIAccess) return;
92
+ const { aiClient, aiConfig } = aiResult;
91
93
  if (gitOptions) {
92
94
  const gitChangedFiles = await listGitFiles(gitOptions);
93
95
  if (gitChangedFiles) docList = docList.filter((path) => gitChangedFiles.some((gitFile) => join(process.cwd(), path) === gitFile));
@@ -118,7 +120,7 @@ const translateDoc = async ({ docPattern, locales, excludedGlobPattern, baseLoca
118
120
  appLogger(fileModificationData.message);
119
121
  return;
120
122
  }
121
- await translateFile(absoluteBaseFilePath, outputFilePath, locale, baseLocale, configuration, aiOptions, customInstructions);
123
+ await translateFile(absoluteBaseFilePath, outputFilePath, locale, baseLocale, configuration, aiOptions, customInstructions, aiClient, aiConfig);
122
124
  })), (task) => task(), nbSimultaneousFileProcessed ?? 3);
123
125
  };
124
126
 
@@ -1 +1 @@
1
- {"version":3,"file":"translateDoc.mjs","names":["docList: string[]"],"sources":["../../src/translateDoc.ts"],"sourcesContent":["import { existsSync, mkdirSync, writeFileSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport { dirname, join, relative } from 'node:path';\nimport { readAsset } from 'utils:asset';\nimport type { AIOptions } from '@intlayer/api';\nimport {\n formatLocale,\n formatPath,\n getChunk,\n type ListGitFilesOptions,\n listGitFiles,\n parallelize,\n} from '@intlayer/chokidar';\nimport {\n ANSIColors,\n colon,\n colorize,\n colorizeNumber,\n type GetConfigurationOptions,\n getAppLogger,\n getConfiguration,\n retryManager,\n} from '@intlayer/config';\nimport type { IntlayerConfig, Locale } from '@intlayer/types';\nimport fg from 'fast-glob';\nimport { chunkText } from './utils/calculateChunks';\nimport { checkAIAccess } from './utils/checkAccess';\nimport { checkFileModifiedRange } from './utils/checkFileModifiedRange';\nimport { chunkInference } from './utils/chunkInference';\nimport { fixChunkStartEndChars } from './utils/fixChunkStartEndChars';\nimport { getOutputFilePath } from './utils/getOutputFilePath';\n\n/**\n * Translate a single file for a given locale\n */\nexport const translateFile = async (\n baseFilePath: string,\n outputFilePath: string,\n locale: Locale,\n baseLocale: Locale,\n configuration: IntlayerConfig,\n aiOptions?: AIOptions,\n customInstructions?: string\n) => {\n try {\n const appLogger = getAppLogger(configuration, {\n config: {\n prefix: '',\n },\n });\n\n // Determine the target locale file path\n const fileContent = await readFile(baseFilePath, 'utf-8');\n\n let fileResultContent = fileContent;\n\n // Prepare the base prompt for ChatGPT\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 filePrefixText = `${ANSIColors.GREY_DARK}[${formatPath(baseFilePath)}${ANSIColors.GREY_DARK}] `;\n const filePrefix = [\n colon(filePrefixText, { colSize: 40 }),\n `→ ${ANSIColors.RESET}`,\n ].join('');\n\n const prefixText = `${ANSIColors.GREY_DARK}[${formatPath(baseFilePath)}${ANSIColors.GREY_DARK}][${formatLocale(locale)}${ANSIColors.GREY_DARK}] `;\n const prefix = [\n colon(prefixText, { colSize: 40 }),\n `→ ${ANSIColors.RESET}`,\n ].join('');\n\n // 1. Chunk the file by number of lines instead of characters\n const chunks = chunkText(fileContent);\n appLogger(\n `${filePrefix}Base file splitted into ${colorizeNumber(chunks.length)} chunks`\n );\n\n for await (const [i, chunk] of chunks.entries()) {\n const isFirstChunk = i === 0;\n\n // Build the chunk-specific prompt\n const getPrevChunkPrompt = () =>\n `**CHUNK ${i} of ${chunks.length}** that has been translated in ${formatLocale(locale)}:\\n` +\n `///chunkStart///` +\n getChunk(fileResultContent, chunks[i - 1]) +\n `///chunkEnd///`;\n\n const getBaseChunkContextPrompt = () =>\n `**CHUNK ${i + 1} to ${Math.min(i + 3, chunks.length)} of ${chunks.length}** is the base chunk in ${formatLocale(baseLocale, false)} as reference.\\n` +\n `///chunksStart///` +\n (chunks[i - 1]?.content ?? '') +\n chunks[i].content +\n (chunks[i + 1]?.content ?? '') +\n `///chunksEnd///`;\n\n const fileToTranslateCurrentChunk = chunk.content;\n\n // Make the actual translation call\n const chunkTranslation = await retryManager(async () => {\n const result = await chunkInference(\n [\n { role: 'system', content: basePrompt },\n\n { role: 'system', content: getBaseChunkContextPrompt() },\n ...(isFirstChunk\n ? []\n : [{ role: 'system', content: getPrevChunkPrompt() } as const]),\n {\n role: 'system',\n content: `The next user message will be the **CHUNK ${colorizeNumber(i + 1)} of ${colorizeNumber(chunks.length)}** in ${formatLocale(baseLocale, false)} to translate in ${formatLocale(locale, false)}:`,\n },\n { role: 'user', content: fileToTranslateCurrentChunk },\n ],\n aiOptions,\n configuration\n );\n\n appLogger(\n [\n `${prefix}`,\n `${ANSIColors.GREY_DARK}[Chunk `,\n colorizeNumber(i + 1),\n `${ANSIColors.GREY_DARK} of `,\n colorizeNumber(chunks.length),\n `${ANSIColors.GREY_DARK}] →${ANSIColors.RESET} `,\n `${colorizeNumber(result.tokenUsed)} tokens used`,\n ].join('')\n );\n\n const fixedTranslatedChunkResult = fixChunkStartEndChars(\n result?.fileContent,\n fileToTranslateCurrentChunk\n );\n\n return fixedTranslatedChunkResult;\n })();\n\n // Replace the chunk in the file content\n fileResultContent = fileResultContent.replace(\n fileToTranslateCurrentChunk,\n chunkTranslation\n );\n }\n\n // 4. Write the final translation to the appropriate file path\n mkdirSync(dirname(outputFilePath), { recursive: true });\n writeFileSync(outputFilePath, fileResultContent);\n\n const relativePath = relative(\n configuration.content.baseDir,\n outputFilePath\n );\n\n appLogger(\n `${colorize('✔', ANSIColors.GREEN)} File ${formatPath(relativePath)} created/updated successfully.`\n );\n } catch (error) {\n console.error(error);\n }\n};\n\ntype TranslateDocOptions = {\n docPattern: string[];\n locales: Locale[];\n excludedGlobPattern: string[];\n baseLocale: Locale;\n aiOptions?: AIOptions;\n nbSimultaneousFileProcessed?: number;\n configOptions?: GetConfigurationOptions;\n customInstructions?: string;\n skipIfModifiedBefore?: number | string | Date;\n skipIfModifiedAfter?: number | string | Date;\n skipIfExists?: boolean;\n gitOptions?: ListGitFilesOptions;\n};\n\n/**\n * Main translate function: scans all .md files in \"en/\" (unless you specified DOC_LIST),\n * then translates them to each locale in LOCALE_LIST.\n */\nexport const translateDoc = async ({\n docPattern,\n locales,\n excludedGlobPattern,\n baseLocale,\n aiOptions,\n nbSimultaneousFileProcessed,\n configOptions,\n customInstructions,\n skipIfModifiedBefore,\n skipIfModifiedAfter,\n skipIfExists,\n gitOptions,\n}: TranslateDocOptions) => {\n const configuration = getConfiguration(configOptions);\n const appLogger = getAppLogger(configuration);\n\n if (nbSimultaneousFileProcessed && nbSimultaneousFileProcessed > 10) {\n appLogger(\n `Warning: nbSimultaneousFileProcessed is set to ${nbSimultaneousFileProcessed}, which is greater than 10. Setting it to 10.`\n );\n nbSimultaneousFileProcessed = 10; // Limit the number of simultaneous file processed to 10\n }\n\n let docList: string[] = await fg(docPattern, {\n ignore: excludedGlobPattern,\n });\n\n const hasCMSAuth = await checkAIAccess(configuration, aiOptions);\n\n if (!hasCMSAuth) return;\n\n if (gitOptions) {\n const gitChangedFiles = await listGitFiles(gitOptions);\n\n if (gitChangedFiles) {\n // Convert dictionary file paths to be relative to git root for comparison\n\n // Filter dictionaries based on git changed files\n docList = docList.filter((path) =>\n gitChangedFiles.some((gitFile) => join(process.cwd(), path) === gitFile)\n );\n }\n }\n\n // OAuth handled by API proxy internally\n\n appLogger(`Base locale is ${formatLocale(baseLocale)}`);\n appLogger(\n `Translating ${colorizeNumber(locales.length)} locales: [ ${formatLocale(locales)} ]`\n );\n\n appLogger(`Translating ${colorizeNumber(docList.length)} files:`);\n appLogger(docList.map((path) => ` - ${formatPath(path)}\\n`));\n\n // Create all tasks to be processed\n const allTasks = docList.flatMap((docPath) =>\n locales.map((locale) => async () => {\n appLogger(\n `Translating file: ${formatPath(docPath)} to ${formatLocale(locale)}`\n );\n\n const absoluteBaseFilePath = join(configuration.content.baseDir, docPath);\n const outputFilePath = getOutputFilePath(\n absoluteBaseFilePath,\n locale,\n baseLocale\n );\n\n // Skip if file exists and skipIfExists option is enabled\n if (skipIfExists && existsSync(outputFilePath)) {\n const relativePath = relative(\n configuration.content.baseDir,\n outputFilePath\n );\n appLogger(\n `${colorize('⊘', ANSIColors.YELLOW)} File ${formatPath(relativePath)} already exists, skipping.`\n );\n return;\n }\n\n // check if the file exist, otherwise create it\n if (!existsSync(outputFilePath)) {\n appLogger(`File ${outputFilePath} does not exist, creating it...`);\n mkdirSync(dirname(outputFilePath), { recursive: true });\n writeFileSync(outputFilePath, '');\n }\n\n const fileModificationData = checkFileModifiedRange(outputFilePath, {\n skipIfModifiedBefore,\n skipIfModifiedAfter,\n });\n\n if (fileModificationData.isSkipped) {\n appLogger(fileModificationData.message);\n return;\n }\n\n await translateFile(\n absoluteBaseFilePath,\n outputFilePath,\n locale as Locale,\n baseLocale,\n configuration,\n aiOptions,\n customInstructions\n );\n })\n );\n\n await parallelize(\n allTasks,\n (task) => task(),\n nbSimultaneousFileProcessed ?? 3\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmCA,MAAa,gBAAgB,OAC3B,cACA,gBACA,QACA,YACA,eACA,WACA,uBACG;AACH,KAAI;EACF,MAAM,YAAY,aAAa,eAAe,EAC5C,QAAQ,EACN,QAAQ,IACT,EACF,CAAC;EAGF,MAAM,cAAc,MAAM,SAAS,cAAc,QAAQ;EAEzD,IAAI,oBAAoB;EAGxB,MAAM,aAAa,UAAU,iCAAiC,QAAQ,CACnE,WAAW,kBAAkB,GAAG,aAAa,QAAQ,MAAM,GAAG,CAC9D,WAAW,sBAAsB,GAAG,aAAa,YAAY,MAAM,GAAG,CACtE,QAAQ,0BAA0B,WAAW,sBAAsB,IAAI,CACvE,QAAQ,0BAA0B,sBAAsB,IAAI;EAG/D,MAAM,aAAa,CACjB,MAFqB,GAAG,WAAW,UAAU,GAAG,WAAW,aAAa,GAAG,WAAW,UAAU,KAE1E,EAAE,SAAS,IAAI,CAAC,EACtC,KAAK,WAAW,QACjB,CAAC,KAAK,GAAG;EAGV,MAAM,SAAS,CACb,MAFiB,GAAG,WAAW,UAAU,GAAG,WAAW,aAAa,G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5D,OAAM,YAtDW,QAAQ,SAAS,YAChC,QAAQ,KAAK,WAAW,YAAY;AAClC,YACE,qBAAqB,WAAW,QAAQ,CAAC,MAAM,aAAa,OAAO,GACpE;EAED,MAAM,uBAAuB,KAAK,cAAc,QAAQ,SAAS,QAAQ;EACzE,MAAM,iBAAiB,kBACrB,sBACA,QACA,WACD;AAGD,MAAI,gBAAgB,WAAW,eAAe,EAAE;GAC9C,MAAM,eAAe,SACnB,cAAc,QAAQ,SACtB,eACD;AACD,aACE,GAAG,SAAS,KAAK,WAAW,OAAO,CAAC,QAAQ,WAAW,aAAa,CAAC,4BACtE;AACD;;AAIF,MAAI,CAAC,WAAW,eAAe,EAAE;AAC/B,aAAU,QAAQ,eAAe,iCAAiC;AAClE,aAAU,QAAQ,eAAe,EAAE,EAAE,WAAW,MAAM,CAAC;AACvD,iBAAc,gBAAgB,GAAG;;EAGnC,MAAM,uBAAuB,uBAAuB,gBAAgB;GAClE;GACA;GACD,CAAC;AAEF,MAAI,qBAAqB,WAAW;AAClC,aAAU,qBAAqB,QAAQ;AACvC;;AAGF,QAAM,cACJ,sBACA,gBACA,QACA,YACA,eACA,WACA,mBACD;GACD,CACH,GAIE,SAAS,MAAM,EAChB,+BAA+B,EAChC"}
1
+ {"version":3,"file":"translateDoc.mjs","names":["docList: string[]"],"sources":["../../src/translateDoc.ts"],"sourcesContent":["import { existsSync, mkdirSync, writeFileSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport { dirname, join, relative } from 'node:path';\nimport { readAsset } from 'utils:asset';\nimport type { AIConfig, AIOptions } from '@intlayer/ai';\nimport {\n formatLocale,\n formatPath,\n getChunk,\n type ListGitFilesOptions,\n listGitFiles,\n parallelize,\n} from '@intlayer/chokidar';\nimport {\n ANSIColors,\n colon,\n colorize,\n colorizeNumber,\n type GetConfigurationOptions,\n getAppLogger,\n getConfiguration,\n retryManager,\n} from '@intlayer/config';\nimport type { IntlayerConfig, Locale } from '@intlayer/types';\nimport fg from 'fast-glob';\nimport { chunkText } from './utils/calculateChunks';\nimport { checkFileModifiedRange } from './utils/checkFileModifiedRange';\nimport { chunkInference } from './utils/chunkInference';\nimport { fixChunkStartEndChars } from './utils/fixChunkStartEndChars';\nimport { getOutputFilePath } from './utils/getOutputFilePath';\nimport { type AIClient, setupAI } from './utils/setupAI';\n\n/**\n * Translate a single file for a given locale\n */\nexport const translateFile = async (\n baseFilePath: string,\n outputFilePath: string,\n locale: Locale,\n baseLocale: Locale,\n configuration: IntlayerConfig,\n aiOptions?: AIOptions,\n customInstructions?: string,\n aiClient?: AIClient,\n aiConfig?: AIConfig\n) => {\n try {\n const appLogger = getAppLogger(configuration, {\n config: {\n prefix: '',\n },\n });\n\n // Determine the target locale file path\n const fileContent = await readFile(baseFilePath, 'utf-8');\n\n let fileResultContent = fileContent;\n\n // Prepare the base prompt for ChatGPT\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 filePrefixText = `${ANSIColors.GREY_DARK}[${formatPath(baseFilePath)}${ANSIColors.GREY_DARK}] `;\n const filePrefix = [\n colon(filePrefixText, { colSize: 40 }),\n `→ ${ANSIColors.RESET}`,\n ].join('');\n\n const prefixText = `${ANSIColors.GREY_DARK}[${formatPath(baseFilePath)}${ANSIColors.GREY_DARK}][${formatLocale(locale)}${ANSIColors.GREY_DARK}] `;\n const prefix = [\n colon(prefixText, { colSize: 40 }),\n `→ ${ANSIColors.RESET}`,\n ].join('');\n\n // 1. Chunk the file by number of lines instead of characters\n const chunks = chunkText(fileContent);\n appLogger(\n `${filePrefix}Base file splitted into ${colorizeNumber(chunks.length)} chunks`\n );\n\n for await (const [i, chunk] of chunks.entries()) {\n const isFirstChunk = i === 0;\n\n // Build the chunk-specific prompt\n const getPrevChunkPrompt = () =>\n `**CHUNK ${i} of ${chunks.length}** that has been translated in ${formatLocale(locale)}:\\n` +\n `///chunkStart///` +\n getChunk(fileResultContent, chunks[i - 1]) +\n `///chunkEnd///`;\n\n const getBaseChunkContextPrompt = () =>\n `**CHUNK ${i + 1} to ${Math.min(i + 3, chunks.length)} of ${chunks.length}** is the base chunk in ${formatLocale(baseLocale, false)} as reference.\\n` +\n `///chunksStart///` +\n (chunks[i - 1]?.content ?? '') +\n chunks[i].content +\n (chunks[i + 1]?.content ?? '') +\n `///chunksEnd///`;\n\n const fileToTranslateCurrentChunk = chunk.content;\n\n // Make the actual translation call\n const chunkTranslation = await retryManager(async () => {\n const result = await chunkInference(\n [\n { role: 'system', content: basePrompt },\n\n { role: 'system', content: getBaseChunkContextPrompt() },\n ...(isFirstChunk\n ? []\n : [{ role: 'system', content: getPrevChunkPrompt() } as const]),\n {\n role: 'system',\n content: `The next user message will be the **CHUNK ${colorizeNumber(i + 1)} of ${colorizeNumber(chunks.length)}** in ${formatLocale(baseLocale, false)} to translate in ${formatLocale(locale, false)}:`,\n },\n { role: 'user', content: fileToTranslateCurrentChunk },\n ],\n aiOptions,\n configuration,\n aiClient,\n aiConfig\n );\n\n appLogger(\n [\n `${prefix}`,\n `${ANSIColors.GREY_DARK}[Chunk `,\n colorizeNumber(i + 1),\n `${ANSIColors.GREY_DARK} of `,\n colorizeNumber(chunks.length),\n `${ANSIColors.GREY_DARK}] →${ANSIColors.RESET} `,\n `${colorizeNumber(result.tokenUsed)} tokens used`,\n ].join('')\n );\n\n const fixedTranslatedChunkResult = fixChunkStartEndChars(\n result?.fileContent,\n fileToTranslateCurrentChunk\n );\n\n return fixedTranslatedChunkResult;\n })();\n\n // Replace the chunk in the file content\n fileResultContent = fileResultContent.replace(\n fileToTranslateCurrentChunk,\n chunkTranslation\n );\n }\n\n // 4. Write the final translation to the appropriate file path\n mkdirSync(dirname(outputFilePath), { recursive: true });\n writeFileSync(outputFilePath, fileResultContent);\n\n const relativePath = relative(\n configuration.content.baseDir,\n outputFilePath\n );\n\n appLogger(\n `${colorize('✔', ANSIColors.GREEN)} File ${formatPath(relativePath)} created/updated successfully.`\n );\n } catch (error) {\n console.error(error);\n }\n};\n\ntype TranslateDocOptions = {\n docPattern: string[];\n locales: Locale[];\n excludedGlobPattern: string[];\n baseLocale: Locale;\n aiOptions?: AIOptions;\n nbSimultaneousFileProcessed?: number;\n configOptions?: GetConfigurationOptions;\n customInstructions?: string;\n skipIfModifiedBefore?: number | string | Date;\n skipIfModifiedAfter?: number | string | Date;\n skipIfExists?: boolean;\n gitOptions?: ListGitFilesOptions;\n};\n\n/**\n * Main translate function: scans all .md files in \"en/\" (unless you specified DOC_LIST),\n * then translates them to each locale in LOCALE_LIST.\n */\nexport const translateDoc = async ({\n docPattern,\n locales,\n excludedGlobPattern,\n baseLocale,\n aiOptions,\n nbSimultaneousFileProcessed,\n configOptions,\n customInstructions,\n skipIfModifiedBefore,\n skipIfModifiedAfter,\n skipIfExists,\n gitOptions,\n}: TranslateDocOptions) => {\n const configuration = getConfiguration(configOptions);\n const appLogger = getAppLogger(configuration);\n\n if (nbSimultaneousFileProcessed && nbSimultaneousFileProcessed > 10) {\n appLogger(\n `Warning: nbSimultaneousFileProcessed is set to ${nbSimultaneousFileProcessed}, which is greater than 10. Setting it to 10.`\n );\n nbSimultaneousFileProcessed = 10; // Limit the number of simultaneous file processed to 10\n }\n\n let docList: string[] = await fg(docPattern, {\n ignore: excludedGlobPattern,\n });\n\n const aiResult = await setupAI(configuration, aiOptions);\n\n if (!aiResult?.hasAIAccess) return;\n\n const { aiClient, aiConfig } = aiResult;\n\n if (gitOptions) {\n const gitChangedFiles = await listGitFiles(gitOptions);\n\n if (gitChangedFiles) {\n // Convert dictionary file paths to be relative to git root for comparison\n\n // Filter dictionaries based on git changed files\n docList = docList.filter((path) =>\n gitChangedFiles.some((gitFile) => join(process.cwd(), path) === gitFile)\n );\n }\n }\n\n // OAuth handled by API proxy internally\n\n appLogger(`Base locale is ${formatLocale(baseLocale)}`);\n appLogger(\n `Translating ${colorizeNumber(locales.length)} locales: [ ${formatLocale(locales)} ]`\n );\n\n appLogger(`Translating ${colorizeNumber(docList.length)} files:`);\n appLogger(docList.map((path) => ` - ${formatPath(path)}\\n`));\n\n // Create all tasks to be processed\n const allTasks = docList.flatMap((docPath) =>\n locales.map((locale) => async () => {\n appLogger(\n `Translating file: ${formatPath(docPath)} to ${formatLocale(locale)}`\n );\n\n const absoluteBaseFilePath = join(configuration.content.baseDir, docPath);\n const outputFilePath = getOutputFilePath(\n absoluteBaseFilePath,\n locale,\n baseLocale\n );\n\n // Skip if file exists and skipIfExists option is enabled\n if (skipIfExists && existsSync(outputFilePath)) {\n const relativePath = relative(\n configuration.content.baseDir,\n outputFilePath\n );\n appLogger(\n `${colorize('⊘', ANSIColors.YELLOW)} File ${formatPath(relativePath)} already exists, skipping.`\n );\n return;\n }\n\n // check if the file exist, otherwise create it\n if (!existsSync(outputFilePath)) {\n appLogger(`File ${outputFilePath} does not exist, creating it...`);\n mkdirSync(dirname(outputFilePath), { recursive: true });\n writeFileSync(outputFilePath, '');\n }\n\n const fileModificationData = checkFileModifiedRange(outputFilePath, {\n skipIfModifiedBefore,\n skipIfModifiedAfter,\n });\n\n if (fileModificationData.isSkipped) {\n appLogger(fileModificationData.message);\n return;\n }\n\n await translateFile(\n absoluteBaseFilePath,\n outputFilePath,\n locale as Locale,\n baseLocale,\n configuration,\n aiOptions,\n customInstructions,\n aiClient,\n aiConfig\n );\n })\n );\n\n await parallelize(\n allTasks,\n (task) => task(),\n nbSimultaneousFileProcessed ?? 3\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmCA,MAAa,gBAAgB,OAC3B,cACA,gBACA,QACA,YACA,eACA,WACA,oBACA,UACA,aACG;AACH,KAAI;EACF,MAAM,YAAY,aAAa,eAAe,EAC5C,QAAQ,EACN,QAAQ,IACT,EACF,CAAC;EAGF,MAAM,cAAc,MAAM,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AM,cACJ,sBACA,gBACA,QACA,YACA,eACA,WACA,oBACA,UACA,SACD;GACD,CACH,GAIE,SAAS,MAAM,EAChB,+BAA+B,EAChC"}
@@ -1,5 +1,5 @@
1
1
  import { getIntlayerAPIProxy } from "@intlayer/api";
2
- import { extractErrorMessage, getAppLogger } from "@intlayer/config";
2
+ import { ANSIColors, colorize, extractErrorMessage, getAppLogger } from "@intlayer/config";
3
3
 
4
4
  //#region src/utils/checkAccess.ts
5
5
  const checkCMSAuth = async (configuration) => {
@@ -22,7 +22,18 @@ const checkAIAccess = async (configuration, aiOptions) => {
22
22
  const hasCMSAuth = Boolean(configuration.editor.clientId && configuration.editor.clientSecret);
23
23
  if (Boolean(configuration.ai?.apiKey || aiOptions?.apiKey)) return true;
24
24
  if (!hasCMSAuth) {
25
- appLogger("AI options or API key not provided.", { level: "error" });
25
+ appLogger([
26
+ "AI options or API key not provided. You can either retreive the CMS access key on",
27
+ colorize("https://intlayer.org/dahboard", ANSIColors.GREY),
28
+ colorize("(see doc:", ANSIColors.GREY_DARK),
29
+ colorize("https://intlayer.org/doc/concept/cms", ANSIColors.GREY),
30
+ colorize(")", ANSIColors.GREY_DARK),
31
+ ". Alternatively, you can add your own OpenAI API key in the settings",
32
+ colorize("(see doc:", ANSIColors.GREY_DARK),
33
+ colorize("https://intlayer.org/doc/concept/configuration", ANSIColors.GREY),
34
+ colorize(")", ANSIColors.GREY_DARK),
35
+ "."
36
+ ], { level: "error" });
26
37
  return false;
27
38
  }
28
39
  return await checkCMSAuth(configuration);
@@ -1 +1 @@
1
- {"version":3,"file":"checkAccess.mjs","names":[],"sources":["../../../src/utils/checkAccess.ts"],"sourcesContent":["import type { AIOptions } from '@intlayer/api';\nimport { getIntlayerAPIProxy } from '@intlayer/api';\nimport { extractErrorMessage, getAppLogger } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\n\nexport const checkCMSAuth = async (\n configuration: IntlayerConfig\n): Promise<boolean> => {\n const appLogger = getAppLogger(configuration, {\n config: {\n prefix: '',\n },\n });\n\n const hasCMSAuth =\n configuration.editor.clientId && configuration.editor.clientSecret;\n if (!hasCMSAuth) {\n appLogger('CMS auth not provided.', {\n level: 'error',\n });\n\n return false;\n }\n const intlayerAPI = getIntlayerAPIProxy(undefined, configuration);\n\n try {\n await intlayerAPI.oAuth.getOAuth2AccessToken();\n } catch (error) {\n const message = extractErrorMessage(error);\n\n appLogger(message, {\n level: 'error',\n });\n return false;\n }\n\n return true;\n};\n\nexport const checkAIAccess = async (\n configuration: IntlayerConfig,\n aiOptions?: AIOptions\n): Promise<boolean> => {\n const appLogger = getAppLogger(configuration);\n\n const hasCMSAuth = Boolean(\n configuration.editor.clientId && configuration.editor.clientSecret\n );\n const hasHisOwnAIAPIKey = Boolean(\n configuration.ai?.apiKey || aiOptions?.apiKey\n );\n\n if (hasHisOwnAIAPIKey) {\n return true;\n }\n\n // User need to provide either his own AI API key or the CMS auth\n if (!hasCMSAuth) {\n appLogger('AI options or API key not provided.', {\n level: 'error',\n });\n\n return false;\n }\n\n // If the user do not have his own AI API key, we need to check the CMS auth\n return await checkCMSAuth(configuration);\n};\n"],"mappings":";;;;AAKA,MAAa,eAAe,OAC1B,kBACqB;CACrB,MAAM,YAAY,aAAa,eAAe,EAC5C,QAAQ,EACN,QAAQ,IACT,EACF,CAAC;AAIF,KAAI,EADF,cAAc,OAAO,YAAY,cAAc,OAAO,eACvC;AACf,YAAU,0BAA0B,EAClC,OAAO,SACR,CAAC;AAEF,SAAO;;CAET,MAAM,cAAc,oBAAoB,QAAW,cAAc;AAEjE,KAAI;AACF,QAAM,YAAY,MAAM,sBAAsB;UACvC,OAAO;AAGd,YAFgB,oBAAoB,MAAM,EAEvB,EACjB,OAAO,SACR,CAAC;AACF,SAAO;;AAGT,QAAO;;AAGT,MAAa,gBAAgB,OAC3B,eACA,cACqB;CACrB,MAAM,YAAY,aAAa,cAAc;CAE7C,MAAM,aAAa,QACjB,cAAc,OAAO,YAAY,cAAc,OAAO,aACvD;AAKD,KAJ0B,QACxB,cAAc,IAAI,UAAU,WAAW,OACxC,CAGC,QAAO;AAIT,KAAI,CAAC,YAAY;AACf,YAAU,uCAAuC,EAC/C,OAAO,SACR,CAAC;AAEF,SAAO;;AAIT,QAAO,MAAM,aAAa,cAAc"}
1
+ {"version":3,"file":"checkAccess.mjs","names":[],"sources":["../../../src/utils/checkAccess.ts"],"sourcesContent":["import type { AIOptions } from '@intlayer/api';\nimport { getIntlayerAPIProxy } from '@intlayer/api';\nimport {\n ANSIColors,\n colorize,\n extractErrorMessage,\n getAppLogger,\n} from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\n\nexport const checkCMSAuth = async (\n configuration: IntlayerConfig\n): Promise<boolean> => {\n const appLogger = getAppLogger(configuration, {\n config: {\n prefix: '',\n },\n });\n\n const hasCMSAuth =\n configuration.editor.clientId && configuration.editor.clientSecret;\n if (!hasCMSAuth) {\n appLogger('CMS auth not provided.', {\n level: 'error',\n });\n\n return false;\n }\n const intlayerAPI = getIntlayerAPIProxy(undefined, configuration);\n\n try {\n await intlayerAPI.oAuth.getOAuth2AccessToken();\n } catch (error) {\n const message = extractErrorMessage(error);\n\n appLogger(message, {\n level: 'error',\n });\n return false;\n }\n\n return true;\n};\n\nexport const checkAIAccess = async (\n configuration: IntlayerConfig,\n aiOptions?: AIOptions\n): Promise<boolean> => {\n const appLogger = getAppLogger(configuration);\n\n const hasCMSAuth = Boolean(\n configuration.editor.clientId && configuration.editor.clientSecret\n );\n const hasHisOwnAIAPIKey = Boolean(\n configuration.ai?.apiKey || aiOptions?.apiKey\n );\n\n if (hasHisOwnAIAPIKey) {\n return true;\n }\n\n // User need to provide either his own AI API key or the CMS auth\n if (!hasCMSAuth) {\n appLogger(\n [\n 'AI options or API key not provided. You can either retreive the CMS access key on',\n colorize('https://intlayer.org/dahboard', ANSIColors.GREY),\n colorize('(see doc:', ANSIColors.GREY_DARK),\n colorize('https://intlayer.org/doc/concept/cms', ANSIColors.GREY),\n colorize(')', ANSIColors.GREY_DARK),\n '. Alternatively, you can add your own OpenAI API key in the settings',\n colorize('(see doc:', ANSIColors.GREY_DARK),\n colorize(\n 'https://intlayer.org/doc/concept/configuration',\n ANSIColors.GREY\n ),\n colorize(')', ANSIColors.GREY_DARK),\n '.',\n ],\n {\n level: 'error',\n }\n );\n\n return false;\n }\n\n // If the user do not have his own AI API key, we need to check the CMS auth\n return await checkCMSAuth(configuration);\n};\n"],"mappings":";;;;AAUA,MAAa,eAAe,OAC1B,kBACqB;CACrB,MAAM,YAAY,aAAa,eAAe,EAC5C,QAAQ,EACN,QAAQ,IACT,EACF,CAAC;AAIF,KAAI,EADF,cAAc,OAAO,YAAY,cAAc,OAAO,eACvC;AACf,YAAU,0BAA0B,EAClC,OAAO,SACR,CAAC;AAEF,SAAO;;CAET,MAAM,cAAc,oBAAoB,QAAW,cAAc;AAEjE,KAAI;AACF,QAAM,YAAY,MAAM,sBAAsB;UACvC,OAAO;AAGd,YAFgB,oBAAoB,MAAM,EAEvB,EACjB,OAAO,SACR,CAAC;AACF,SAAO;;AAGT,QAAO;;AAGT,MAAa,gBAAgB,OAC3B,eACA,cACqB;CACrB,MAAM,YAAY,aAAa,cAAc;CAE7C,MAAM,aAAa,QACjB,cAAc,OAAO,YAAY,cAAc,OAAO,aACvD;AAKD,KAJ0B,QACxB,cAAc,IAAI,UAAU,WAAW,OACxC,CAGC,QAAO;AAIT,KAAI,CAAC,YAAY;AACf,YACE;GACE;GACA,SAAS,iCAAiC,WAAW,KAAK;GAC1D,SAAS,aAAa,WAAW,UAAU;GAC3C,SAAS,wCAAwC,WAAW,KAAK;GACjE,SAAS,KAAK,WAAW,UAAU;GACnC;GACA,SAAS,aAAa,WAAW,UAAU;GAC3C,SACE,kDACA,WAAW,KACZ;GACD,SAAS,KAAK,WAAW,UAAU;GACnC;GACD,EACD,EACE,OAAO,SACR,CACF;AAED,SAAO;;AAIT,QAAO,MAAM,aAAa,cAAc"}
@@ -6,9 +6,22 @@ import { retryManager } from "@intlayer/config";
6
6
  * Translates a single chunk via the OpenAI API.
7
7
  * Includes retry logic if the call fails.
8
8
  */
9
- const chunkInference = async (messages, aiOptions, configuration) => {
9
+ const chunkInference = async (messages, aiOptions, configuration, aiClient, aiConfig) => {
10
10
  let lastResult;
11
11
  await retryManager(async () => {
12
+ if (aiClient && aiConfig) {
13
+ const response$1 = await aiClient.customQuery({
14
+ aiConfig,
15
+ messages
16
+ });
17
+ if (!response$1) throw new Error("No response from AI API");
18
+ const { fileContent: fileContent$1, tokenUsed: tokenUsed$1 } = response$1;
19
+ lastResult = {
20
+ fileContent: processContent(fileContent$1),
21
+ tokenUsed: tokenUsed$1
22
+ };
23
+ return;
24
+ }
12
25
  const response = await getIntlayerAPIProxy(void 0, configuration).ai.customQuery({
13
26
  aiOptions,
14
27
  messages
@@ -16,12 +29,15 @@ const chunkInference = async (messages, aiOptions, configuration) => {
16
29
  if (!response.data) throw new Error("No response from AI API");
17
30
  const { fileContent, tokenUsed } = response.data;
18
31
  lastResult = {
19
- fileContent: fileContent.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", ""),
32
+ fileContent: processContent(fileContent),
20
33
  tokenUsed
21
34
  };
22
35
  })();
23
36
  return lastResult;
24
37
  };
38
+ const processContent = (content) => {
39
+ 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", "");
40
+ };
25
41
 
26
42
  //#endregion
27
43
  export { chunkInference };
@@ -1 +1 @@
1
- {"version":3,"file":"chunkInference.mjs","names":["lastResult: ChunkInferenceResult"],"sources":["../../../src/utils/chunkInference.ts"],"sourcesContent":["import {\n type AIOptions,\n getIntlayerAPIProxy,\n type Messages,\n} from '@intlayer/api';\nimport { retryManager } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\n\ntype ChunkInferenceResult = {\n fileContent: string;\n tokenUsed: number;\n};\n\n/**\n * Translates a single chunk via the OpenAI API.\n * Includes retry logic if the call fails.\n */\nexport const chunkInference = async (\n messages: Messages,\n aiOptions?: AIOptions,\n configuration?: IntlayerConfig\n): Promise<ChunkInferenceResult> => {\n let lastResult: ChunkInferenceResult;\n\n await retryManager(async () => {\n const api = getIntlayerAPIProxy(undefined, configuration);\n\n const response = await api.ai.customQuery({\n aiOptions,\n messages,\n });\n\n if (!response.data) {\n throw new Error('No response from AI API');\n }\n\n const { fileContent, tokenUsed } = response.data;\n\n const newContent = fileContent\n .replaceAll('///chunksStart///', '')\n .replaceAll('///chunkStart///', '')\n .replaceAll('///chunksEnd///', '')\n .replaceAll('///chunkEnd///', '')\n .replaceAll('///chunksStart///', '')\n .replaceAll('chunkStart///', '')\n .replaceAll('chunksEnd///', '')\n .replaceAll('chunkEnd///', '')\n .replaceAll('///chunksStart', '')\n .replaceAll('///chunkStart', '')\n .replaceAll('///chunksEnd', '')\n .replaceAll('///chunkEnd', '')\n .replaceAll('chunksStart', '')\n .replaceAll('chunkStart', '')\n .replaceAll('chunksEnd', '')\n .replaceAll('chunkEnd', '');\n\n lastResult = {\n fileContent: newContent,\n tokenUsed,\n };\n })();\n\n return lastResult!;\n};\n"],"mappings":";;;;;;;;AAiBA,MAAa,iBAAiB,OAC5B,UACA,WACA,kBACkC;CAClC,IAAIA;AAEJ,OAAM,aAAa,YAAY;EAG7B,MAAM,WAAW,MAFL,oBAAoB,QAAW,cAAc,CAE9B,GAAG,YAAY;GACxC;GACA;GACD,CAAC;AAEF,MAAI,CAAC,SAAS,KACZ,OAAM,IAAI,MAAM,0BAA0B;EAG5C,MAAM,EAAE,aAAa,cAAc,SAAS;AAoB5C,eAAa;GACX,aAnBiB,YAChB,WAAW,qBAAqB,GAAG,CACnC,WAAW,oBAAoB,GAAG,CAClC,WAAW,mBAAmB,GAAG,CACjC,WAAW,kBAAkB,GAAG,CAChC,WAAW,qBAAqB,GAAG,CACnC,WAAW,iBAAiB,GAAG,CAC/B,WAAW,gBAAgB,GAAG,CAC9B,WAAW,eAAe,GAAG,CAC7B,WAAW,kBAAkB,GAAG,CAChC,WAAW,iBAAiB,GAAG,CAC/B,WAAW,gBAAgB,GAAG,CAC9B,WAAW,eAAe,GAAG,CAC7B,WAAW,eAAe,GAAG,CAC7B,WAAW,cAAc,GAAG,CAC5B,WAAW,aAAa,GAAG,CAC3B,WAAW,YAAY,GAAG;GAI3B;GACD;GACD,EAAE;AAEJ,QAAO"}
1
+ {"version":3,"file":"chunkInference.mjs","names":["lastResult: ChunkInferenceResult","response","fileContent"],"sources":["../../../src/utils/chunkInference.ts"],"sourcesContent":["import type { AIConfig, AIOptions } from '@intlayer/ai';\nimport { getIntlayerAPIProxy, type Messages } from '@intlayer/api';\nimport { retryManager } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport type { AIClient } from './setupAI';\n\ntype ChunkInferenceResult = {\n fileContent: string;\n tokenUsed: number;\n};\n\n/**\n * Translates a single chunk via the OpenAI API.\n * Includes retry logic if the call fails.\n */\nexport const chunkInference = async (\n messages: Messages,\n aiOptions?: AIOptions,\n configuration?: IntlayerConfig,\n aiClient?: AIClient,\n aiConfig?: AIConfig\n): Promise<ChunkInferenceResult> => {\n let lastResult: ChunkInferenceResult;\n\n await retryManager(async () => {\n if (aiClient && aiConfig) {\n const response = await aiClient.customQuery({\n aiConfig,\n messages,\n });\n\n if (!response) {\n throw new Error('No response from AI API');\n }\n\n const { fileContent, tokenUsed } = response;\n\n lastResult = {\n fileContent: processContent(fileContent),\n tokenUsed,\n };\n\n return;\n }\n\n const api = getIntlayerAPIProxy(undefined, configuration);\n\n const response = await api.ai.customQuery({\n aiOptions,\n messages,\n });\n\n if (!response.data) {\n throw new Error('No response from AI API');\n }\n\n const { fileContent, tokenUsed } = response.data;\n\n lastResult = {\n fileContent: processContent(fileContent),\n tokenUsed,\n };\n })();\n\n return lastResult!;\n};\n\nconst processContent = (content: string) => {\n return content\n .replaceAll('///chunksStart///', '')\n .replaceAll('///chunkStart///', '')\n .replaceAll('///chunksEnd///', '')\n .replaceAll('///chunkEnd///', '')\n .replaceAll('///chunksStart///', '')\n .replaceAll('chunkStart///', '')\n .replaceAll('chunksEnd///', '')\n .replaceAll('chunkEnd///', '')\n .replaceAll('///chunksStart', '')\n .replaceAll('///chunkStart', '')\n .replaceAll('///chunksEnd', '')\n .replaceAll('///chunkEnd', '')\n .replaceAll('chunksStart', '')\n .replaceAll('chunkStart', '')\n .replaceAll('chunksEnd', '')\n .replaceAll('chunkEnd', '');\n};\n"],"mappings":";;;;;;;;AAeA,MAAa,iBAAiB,OAC5B,UACA,WACA,eACA,UACA,aACkC;CAClC,IAAIA;AAEJ,OAAM,aAAa,YAAY;AAC7B,MAAI,YAAY,UAAU;GACxB,MAAMC,aAAW,MAAM,SAAS,YAAY;IAC1C;IACA;IACD,CAAC;AAEF,OAAI,CAACA,WACH,OAAM,IAAI,MAAM,0BAA0B;GAG5C,MAAM,EAAE,4BAAa,2BAAcA;AAEnC,gBAAa;IACX,aAAa,eAAeC,cAAY;IACxC;IACD;AAED;;EAKF,MAAM,WAAW,MAFL,oBAAoB,QAAW,cAAc,CAE9B,GAAG,YAAY;GACxC;GACA;GACD,CAAC;AAEF,MAAI,CAAC,SAAS,KACZ,OAAM,IAAI,MAAM,0BAA0B;EAG5C,MAAM,EAAE,aAAa,cAAc,SAAS;AAE5C,eAAa;GACX,aAAa,eAAe,YAAY;GACxC;GACD;GACD,EAAE;AAEJ,QAAO;;AAGT,MAAM,kBAAkB,YAAoB;AAC1C,QAAO,QACJ,WAAW,qBAAqB,GAAG,CACnC,WAAW,oBAAoB,GAAG,CAClC,WAAW,mBAAmB,GAAG,CACjC,WAAW,kBAAkB,GAAG,CAChC,WAAW,qBAAqB,GAAG,CACnC,WAAW,iBAAiB,GAAG,CAC/B,WAAW,gBAAgB,GAAG,CAC9B,WAAW,eAAe,GAAG,CAC7B,WAAW,kBAAkB,GAAG,CAChC,WAAW,iBAAiB,GAAG,CAC/B,WAAW,gBAAgB,GAAG,CAC9B,WAAW,eAAe,GAAG,CAC7B,WAAW,eAAe,GAAG,CAC7B,WAAW,cAAc,GAAG,CAC5B,WAAW,aAAa,GAAG,CAC3B,WAAW,YAAY,GAAG"}
@@ -0,0 +1,38 @@
1
+ import { checkAIAccess } from "./checkAccess.mjs";
2
+ import { ANSIColors, colorize, getAppLogger } from "@intlayer/config";
3
+
4
+ //#region src/utils/setupAI.ts
5
+ /**
6
+ * Checks if the @intlayer/ai package is available and configured when an API key is provided.
7
+ * If API key is present but package is missing, logs a warning.
8
+ * Also checks if the user has access to AI (either via local key or CMS auth).
9
+ */
10
+ const setupAI = async (configuration, aiOptions) => {
11
+ const appLogger = getAppLogger(configuration);
12
+ const hasAIAccess = await checkAIAccess(configuration, aiOptions);
13
+ if (aiOptions?.apiKey) try {
14
+ const aiClient = await import("@intlayer/ai");
15
+ const aiConfig = await aiClient.getAIConfig({ userOptions: aiOptions });
16
+ if (!aiConfig) throw new Error("AI configuration is missing");
17
+ return {
18
+ aiClient,
19
+ aiConfig,
20
+ isCustomAI: true,
21
+ hasAIAccess
22
+ };
23
+ } catch {
24
+ appLogger([
25
+ colorize("Using your API key, you can install the", ANSIColors.GREY),
26
+ colorize("@intlayer/ai", ANSIColors.GREY_LIGHT),
27
+ colorize("package to run the process locally, with no dependency of the Intlayer server", ANSIColors.GREY)
28
+ ], { level: "warn" });
29
+ }
30
+ return {
31
+ isCustomAI: false,
32
+ hasAIAccess
33
+ };
34
+ };
35
+
36
+ //#endregion
37
+ export { setupAI };
38
+ //# sourceMappingURL=setupAI.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupAI.mjs","names":[],"sources":["../../../src/utils/setupAI.ts"],"sourcesContent":["import type { AIConfig, AIOptions } from '@intlayer/ai';\nimport { ANSIColors, colorize, getAppLogger } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { checkAIAccess } from './checkAccess';\n\nexport type AIClient = typeof import('@intlayer/ai');\n\ntype SetupAIResult = {\n aiClient?: AIClient;\n aiConfig?: AIConfig;\n isCustomAI: boolean;\n hasAIAccess: boolean;\n};\n\n/**\n * Checks if the @intlayer/ai package is available and configured when an API key is provided.\n * If API key is present but package is missing, logs a warning.\n * Also checks if the user has access to AI (either via local key or CMS auth).\n */\nexport const setupAI = async (\n configuration: IntlayerConfig,\n aiOptions?: AIOptions\n): Promise<SetupAIResult | undefined> => {\n const appLogger = getAppLogger(configuration);\n\n const hasAIAccess = await checkAIAccess(configuration, aiOptions);\n\n if (aiOptions?.apiKey) {\n try {\n // Dynamically import the AI package if an API key is provided\n const aiClient = await import('@intlayer/ai');\n\n const aiConfig = await aiClient.getAIConfig({\n userOptions: aiOptions,\n });\n\n if (!aiConfig) {\n throw new Error('AI configuration is missing');\n }\n\n return {\n aiClient,\n aiConfig,\n isCustomAI: true,\n hasAIAccess,\n };\n } catch {\n appLogger(\n [\n colorize('Using your API key, you can install the', ANSIColors.GREY),\n colorize('@intlayer/ai', ANSIColors.GREY_LIGHT),\n colorize(\n 'package to run the process locally, with no dependency of the Intlayer server',\n ANSIColors.GREY\n ),\n ],\n {\n level: 'warn',\n }\n );\n }\n }\n\n return {\n isCustomAI: false,\n hasAIAccess,\n };\n};\n"],"mappings":";;;;;;;;;AAmBA,MAAa,UAAU,OACrB,eACA,cACuC;CACvC,MAAM,YAAY,aAAa,cAAc;CAE7C,MAAM,cAAc,MAAM,cAAc,eAAe,UAAU;AAEjE,KAAI,WAAW,OACb,KAAI;EAEF,MAAM,WAAW,MAAM,OAAO;EAE9B,MAAM,WAAW,MAAM,SAAS,YAAY,EAC1C,aAAa,WACd,CAAC;AAEF,MAAI,CAAC,SACH,OAAM,IAAI,MAAM,8BAA8B;AAGhD,SAAO;GACL;GACA;GACA,YAAY;GACZ;GACD;SACK;AACN,YACE;GACE,SAAS,2CAA2C,WAAW,KAAK;GACpE,SAAS,gBAAgB,WAAW,WAAW;GAC/C,SACE,iFACA,WAAW,KACZ;GACF,EACD,EACE,OAAO,QACR,CACF;;AAIL,QAAO;EACL,YAAY;EACZ;EACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","names":[],"sources":["../../src/cli.ts"],"sourcesContent":[],"mappings":";;;cAiCa;KAsIR,UAAA;EAtIQ,MAAA,CAAA,EAAA,MAEA;EAoIR,OAAA,CAAA,EAAA,OAAU;AAKf,CAAA;AA2Da,KA3DD,oBAAA,GAkmBX;;;;;IA7lBG;;;;;;;;;cAsDS,cAAa"}
1
+ {"version":3,"file":"cli.d.ts","names":[],"sources":["../../src/cli.ts"],"sourcesContent":[],"mappings":";;;cAiCa;KAsIR,UAAA;EAtIQ,MAAA,CAAA,EAAA,MAEA;EAoIR,OAAA,CAAA,EAAA,OAAU;AAKf,CAAA;AA2Da,KA3DD,oBAAA,GAsmBX;;;;;IAjmBG;;;;;;;;;cAsDS,cAAa"}
@@ -1 +1 @@
1
- {"version":3,"file":"fill.d.ts","names":[],"sources":["../../../src/fill/fill.ts"],"sourcesContent":[],"mappings":";;;;;;KAoCY,WAAA;iBACK;EADL,aAAA,CAAW,EAEL,MAFK,GAEI,MAFJ,EAAA;EACN,IAAA,CAAA,EAAA,UAAA,GAAA,QAAA;EACC,UAAA,CAAA,EAEH,mBAFG;EAAS,SAAA,CAAA,EAGb,SAHa;EAEZ,OAAA,CAAA,EAAA,OAAA;EACD,wBAAA,CAAA,EAAA,MAAA;EAMV,iBAAA,CAAA,EAAA,MAAA;EAA0B,KAAA,CAAA,EAAA,OAAA;EAKjB,YAwIZ,CAAA,EAAA,OAxIoC;IALjC;;;;cAKS,iBAAwB,gBAAc"}
1
+ {"version":3,"file":"fill.d.ts","names":[],"sources":["../../../src/fill/fill.ts"],"sourcesContent":[],"mappings":";;;;;;KAmCY,WAAA;iBACK;EADL,aAAA,CAAW,EAEL,MAFK,GAEI,MAFJ,EAAA;EACN,IAAA,CAAA,EAAA,UAAA,GAAA,QAAA;EACC,UAAA,CAAA,EAEH,mBAFG;EAAS,SAAA,CAAA,EAGb,SAHa;EAEZ,OAAA,CAAA,EAAA,OAAA;EACD,wBAAA,CAAA,EAAA,MAAA;EAMV,iBAAA,CAAA,EAAA,MAAA;EAA0B,KAAA,CAAA,EAAA,OAAA;EAKjB,YAoIZ,CAAA,EAAA,OApIoC;IALjC;;;;cAKS,iBAAwB,gBAAc"}
@@ -6,7 +6,7 @@ type FillData = {
6
6
  filePath: string;
7
7
  isPerLocale: boolean;
8
8
  };
9
- declare const formatFillData: (autoFillField: Fill, localeList: LocalesValues[], filePath: string, dictionaryKey: string, configuration: IntlayerConfig) => FillData[];
9
+ declare const formatFillData: (fillField: Fill, localeList: LocalesValues[], filePath: string, dictionaryKey: string, configuration: IntlayerConfig) => FillData[];
10
10
  //#endregion
11
11
  export { FillData, formatFillData };
12
12
  //# sourceMappingURL=formatFillData.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"formatFillData.d.ts","names":[],"sources":["../../../src/fill/formatFillData.ts"],"sourcesContent":[],"mappings":";;;KAGY,QAAA;cACE;EADF,QAAA,EAAA,MAAQ;EAMP,WAAA,EAAA,OA2FZ;CA1FgB;AACH,cAFD,cAEC,EAAA,CAAA,aAAA,EADG,IACH,EAAA,UAAA,EAAA,aAAA,EAAA,EAAA,QAAA,EAAA,MAAA,EAAA,aAAA,EAAA,MAAA,EAAA,aAAA,EAGG,cAHH,EAAA,GAIX,QAJW,EAAA"}
1
+ {"version":3,"file":"formatFillData.d.ts","names":[],"sources":["../../../src/fill/formatFillData.ts"],"sourcesContent":[],"mappings":";;;KAGY,QAAA;cACE;EADF,QAAA,EAAA,MAAQ;EAMP,WAAA,EAAA,OAyFZ;CAxFY;AACC,cAFD,cAEC,EAAA,CAAA,SAAA,EADD,IACC,EAAA,UAAA,EAAA,aAAA,EAAA,EAAA,QAAA,EAAA,MAAA,EAAA,aAAA,EAAA,MAAA,EAAA,aAAA,EAGG,cAHH,EAAA,GAIX,QAJW,EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"listTranslationsTasks.d.ts","names":[],"sources":["../../../src/fill/listTranslationsTasks.ts"],"sourcesContent":[],"mappings":";;;KAuBY,eAAA;;EAAA,iBAAA,EAES,iBAFM;EAEN,YAAA,EACL,MADK;EACL,aAAA,EACC,MADD,EAAA;EACC,gBAAA,EAAA,MAAA;EAAM,kBAAA,EAAA,MAAA;AAKvB,CAAA;AACY,cADC,qBACD,EAAA,CAAA,QAAA,EAAA,iBAAA,EAAA,EAAA,aAAA,EACK,MADL,EAAA,EAAA,IAAA,EAAA,UAAA,GAAA,QAAA,EAAA,UAAA,EAGE,MAHF,EAAA,aAAA,EAIK,cAJL,EAAA,GAKT,eALS,EAAA"}
1
+ {"version":3,"file":"listTranslationsTasks.d.ts","names":[],"sources":["../../../src/fill/listTranslationsTasks.ts"],"sourcesContent":[],"mappings":";;;KAqBY,eAAA;;EAAA,iBAAA,EAES,iBAFM;EAEN,YAAA,EACL,MADK;EACL,aAAA,EACC,MADD,EAAA;EACC,gBAAA,EAAA,MAAA;EAAM,kBAAA,EAAA,MAAA;AAKvB,CAAA;AACY,cADC,qBACD,EAAA,CAAA,QAAA,EAAA,iBAAA,EAAA,EAAA,aAAA,EACK,MADL,EAAA,EAAA,IAAA,EAAA,UAAA,GAAA,QAAA,EAAA,UAAA,EAGE,MAHF,EAAA,aAAA,EAIK,cAJL,EAAA,GAKT,eALS,EAAA"}
@@ -1,7 +1,9 @@
1
1
  import { TranslationTask } from "./listTranslationsTasks.js";
2
+ import { AIClient } from "../utils/setupAI.js";
2
3
  import { Dictionary, IntlayerConfig } from "@intlayer/types";
3
4
  import { AIOptions } from "@intlayer/api";
4
5
  import * as _intlayer_chokidar0 from "@intlayer/chokidar";
6
+ import { AIConfig } from "@intlayer/ai";
5
7
 
6
8
  //#region src/fill/translateDictionary.d.ts
7
9
  type TranslateDictionaryResult = TranslationTask & {
@@ -15,6 +17,8 @@ type TranslateDictionaryOptions = {
15
17
  onSuccess?: () => void;
16
18
  onError?: (error: unknown) => void;
17
19
  getAbortError?: () => Error | null;
20
+ aiClient?: AIClient;
21
+ aiConfig?: AIConfig;
18
22
  };
19
23
  declare const translateDictionary: (task: TranslationTask, configuration: IntlayerConfig, options?: TranslateDictionaryOptions) => Promise<TranslateDictionaryResult>;
20
24
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"translateDictionary.d.ts","names":[],"sources":["../../../src/fill/translateDictionary.ts"],"sourcesContent":[],"mappings":";;;;;;KA6BK,yBAAA,GAA4B;oBACb;;AAH2C,KAM1D,0BAAA,GAJyB;EAIzB,IAAA,EAAA,UAAA,GAAA,QAAA;EAES,SAAA,CAAA,EAAA,SAAA;EAAS,YAAA,CAAA,EAAA,OAEqC;EAA/C,QAAA,CAAA,EAAA,UAAA,CAAA,OAFU,mBAAA,CAEqC,gBAA/C,CAAA;EAGW,SAAA,CAAA,EAAA,GAAA,GAAA,IAAA;EAAK,OAAA,CAAA,EAAA,CAAA,KAAA,EAAA,OAAA,EAAA,GAAA,IAAA;EAchB,aAAA,CAAA,EAAA,GAAA,GAdW,KAyUvB,GAAA,IAAA;CA1TO;AACS,cAFJ,mBAEI,EAAA,CAAA,IAAA,EADT,eACS,EAAA,aAAA,EAAA,cAAA,EAAA,OAAA,CAAA,EACL,0BADK,EAAA,GAEd,OAFc,CAEN,yBAFM,CAAA"}
1
+ {"version":3,"file":"translateDictionary.d.ts","names":[],"sources":["../../../src/fill/translateDictionary.ts"],"sourcesContent":[],"mappings":";;;;;;;;KAgCK,yBAAA,GAA4B;oBACb;;AAH2C,KAM1D,0BAAA,GAJyB;EAIzB,IAAA,EAAA,UAAA,GAAA,QAAA;EAES,SAAA,CAAA,EAAA,SAAA;EAAS,YAAA,CAAA,EAAA,OAEqC;EAA/C,QAAA,CAAA,EAAA,UAAA,CAAA,OAFU,mBAAA,CAEqC,gBAA/C,CAAA;EAGW,SAAA,CAAA,EAAA,GAAA,GAAA,IAAA;EACX,OAAA,CAAA,EAAA,CAAA,KAAA,EAAA,OAAA,EAAA,GAAA,IAAA;EACA,aAAA,CAAA,EAAA,GAAA,GAFW,KAEX,GAAA,IAAA;EAAQ,QAAA,CAAA,EADR,QACQ;EAcR,QAAA,CAAA,EAdA,QAcA;CACL;AACS,cAFJ,mBAEI,EAAA,CAAA,IAAA,EADT,eACS,EAAA,aAAA,EAAA,cAAA,EAAA,OAAA,CAAA,EACL,0BADK,EAAA,GAEd,OAFc,CAEN,yBAFM,CAAA"}
@@ -8,9 +8,10 @@ import { pull } from "./pull.js";
8
8
  import { push } from "./push/push.js";
9
9
  import { pushConfig } from "./pushConfig.js";
10
10
  import { reviewDoc } from "./reviewDoc.js";
11
- import { listMissingTranslations } from "./test/listMissingTranslations.js";
12
- import { testMissingTranslations } from "./test/index.js";
11
+ import { listMissingTranslations, listMissingTranslationsWithConfig } from "./test/listMissingTranslations.js";
12
+ import { testMissingTranslations } from "./test/test.js";
13
+ import "./test/index.js";
13
14
  import { transform } from "./transform.js";
14
15
  import { translateDoc, translateFile } from "./translateDoc.js";
15
16
  export * from "@intlayer/chokidar";
16
- export { ConfigurationOptions, FillOptions, build, dirname, fill, listContentDeclaration, listContentDeclarationRows, listMissingTranslations, liveSync, pull, push, pushConfig, reviewDoc, setAPI, startEditor, testMissingTranslations, transform, translateDoc, translateFile };
17
+ export { ConfigurationOptions, FillOptions, build, dirname, fill, listContentDeclaration, listContentDeclarationRows, listMissingTranslations, listMissingTranslationsWithConfig, liveSync, pull, push, pushConfig, reviewDoc, setAPI, startEditor, testMissingTranslations, transform, translateDoc, translateFile };
@@ -1 +1 @@
1
- {"version":3,"file":"reviewDoc.d.ts","names":[],"sources":["../../src/reviewDoc.ts"],"sourcesContent":[],"mappings":";;;;;;KA0BK,gBAAA;;EAAA,OAAA,EAEM,MAFN,EAAA;EAEM,mBAAA,EAAA,MAAA,EAAA;EAEG,UAAA,EAAA,MAAA;EACA,SAAA,CAAA,EAAA,SAAA;EAEI,2BAAA,CAAA,EAAA,MAAA;EAEyB,aAAA,CAAA,EAFzB,uBAEyB;EACD,kBAAA,CAAA,EAAA,MAAA;EAE3B,oBAAA,CAAA,EAAA,MAAA,GAAA,MAAA,GAH4B,IAG5B;EAAmB,mBAAA,CAAA,EAAA,MAAA,GAAA,MAAA,GAFQ,IAER;EAOrB,YAyHZ,CAAA,EAAA,OAAA;EAzH+B,UAAA,CAAA,EAPjB,mBAOiB;CAAA;;;;;AAAA,cAAnB,SAAmB,EAAA,CAAA;EAAA,UAAA;EAAA,OAAA;EAAA,mBAAA;EAAA,UAAA;EAAA,SAAA;EAAA,2BAAA;EAAA,aAAA;EAAA,kBAAA;EAAA,oBAAA;EAAA,mBAAA;EAAA,YAAA;EAAA;AAAA,CAAA,EAa7B,gBAb6B,EAAA,GAab,OAba,CAAA,IAAA,CAAA"}
1
+ {"version":3,"file":"reviewDoc.d.ts","names":[],"sources":["../../src/reviewDoc.ts"],"sourcesContent":[],"mappings":";;;;;;KA0BK,gBAAA;;EAAA,OAAA,EAEM,MAFN,EAAA;EAEM,mBAAA,EAAA,MAAA,EAAA;EAEG,UAAA,EAAA,MAAA;EACA,SAAA,CAAA,EAAA,SAAA;EAEI,2BAAA,CAAA,EAAA,MAAA;EAEyB,aAAA,CAAA,EAFzB,uBAEyB;EACD,kBAAA,CAAA,EAAA,MAAA;EAE3B,oBAAA,CAAA,EAAA,MAAA,GAAA,MAAA,GAH4B,IAG5B;EAAmB,mBAAA,CAAA,EAAA,MAAA,GAAA,MAAA,GAFQ,IAER;EAOrB,YA6HZ,CAAA,EAAA,OAAA;EA7H+B,UAAA,CAAA,EAPjB,mBAOiB;CAAA;;;;;AAAA,cAAnB,SAAmB,EAAA,CAAA;EAAA,UAAA;EAAA,OAAA;EAAA,mBAAA;EAAA,UAAA;EAAA,SAAA;EAAA,2BAAA;EAAA,aAAA;EAAA,kBAAA;EAAA,oBAAA;EAAA,mBAAA;EAAA,YAAA;EAAA;AAAA,CAAA,EAa7B,gBAb6B,EAAA,GAab,OAba,CAAA,IAAA,CAAA"}
@@ -1,6 +1,8 @@
1
+ import { AIClient } from "./utils/setupAI.js";
1
2
  import { Locale } from "@intlayer/types";
2
3
  import { GetConfigurationOptions } from "@intlayer/config";
3
4
  import { AIOptions } from "@intlayer/api";
5
+ import { AIConfig } from "@intlayer/ai";
4
6
 
5
7
  //#region src/reviewDocBlockAware.d.ts
6
8
 
@@ -13,7 +15,7 @@ import { AIOptions } from "@intlayer/api";
13
15
  * 4. Only sends changed/new blocks to AI for translation
14
16
  * 5. Handles reordering automatically
15
17
  */
16
- declare const reviewFileBlockAware: (baseFilePath: string, outputFilePath: string, locale: Locale, baseLocale: Locale, aiOptions?: AIOptions, configOptions?: GetConfigurationOptions, customInstructions?: string, changedLines?: number[]) => Promise<void>;
18
+ declare const reviewFileBlockAware: (baseFilePath: string, outputFilePath: string, locale: Locale, baseLocale: Locale, aiOptions?: AIOptions, configOptions?: GetConfigurationOptions, customInstructions?: string, changedLines?: number[], aiClient?: AIClient, aiConfig?: AIConfig) => Promise<void>;
17
19
  //#endregion
18
20
  export { reviewFileBlockAware };
19
21
  //# sourceMappingURL=reviewDocBlockAware.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reviewDocBlockAware.d.ts","names":[],"sources":["../../src/reviewDocBlockAware.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAkCA;;;;;;;cAAa,6EAGH,oBACI,oBACA,2BACI,kFAEO"}
1
+ {"version":3,"file":"reviewDocBlockAware.d.ts","names":[],"sources":["../../src/reviewDocBlockAware.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAoCA;;;;;;;AAUqB,cAVR,oBAUQ,EAAA,CAAA,YAAA,EAAA,MAAA,EAAA,cAAA,EAAA,MAAA,EAAA,MAAA,EAPX,MAOW,EAAA,UAAA,EANP,MAMO,EAAA,SAAA,CAAA,EALP,SAKO,EAAA,aAAA,CAAA,EAJH,uBAIG,EAAA,kBAAA,CAAA,EAAA,MAAA,EAAA,YAAA,CAAA,EAAA,MAAA,EAAA,EAAA,QAAA,CAAA,EADR,QACQ,EAAA,QAAA,CAAA,EAAR,QAAQ,EAAA,GAAA,OAAA,CAAA,IAAA,CAAA"}
@@ -1,12 +1,3 @@
1
- import { listMissingTranslations } from "./listMissingTranslations.js";
2
- import { GetConfigurationOptions } from "@intlayer/config";
3
-
4
- //#region src/test/index.d.ts
5
- type ListMissingTranslationsOptions = {
6
- configOptions?: GetConfigurationOptions;
7
- build?: boolean;
8
- };
9
- declare const testMissingTranslations: (options?: ListMissingTranslationsOptions) => Promise<void>;
10
- //#endregion
11
- export { listMissingTranslations, testMissingTranslations };
12
- //# sourceMappingURL=index.d.ts.map
1
+ import { listMissingTranslations, listMissingTranslationsWithConfig } from "./listMissingTranslations.js";
2
+ import { testMissingTranslations } from "./test.js";
3
+ export { listMissingTranslations, listMissingTranslationsWithConfig, testMissingTranslations };
@@ -1,7 +1,17 @@
1
- import { Locale } from "@intlayer/types";
1
+ import { IntlayerConfig, Locale } from "@intlayer/types";
2
2
  import { GetConfigurationOptions } from "@intlayer/config";
3
3
 
4
4
  //#region src/test/listMissingTranslations.d.ts
5
+ declare const listMissingTranslationsWithConfig: (configuration: IntlayerConfig) => {
6
+ missingTranslations: {
7
+ key: string;
8
+ filePath?: string;
9
+ id?: string;
10
+ locales: Locale[];
11
+ }[];
12
+ missingLocales: Locale[];
13
+ missingRequiredLocales: Locale[];
14
+ };
5
15
  declare const listMissingTranslations: (configurationOptions?: GetConfigurationOptions) => {
6
16
  missingTranslations: {
7
17
  key: string;
@@ -13,5 +23,5 @@ declare const listMissingTranslations: (configurationOptions?: GetConfigurationO
13
23
  missingRequiredLocales: Locale[];
14
24
  };
15
25
  //#endregion
16
- export { listMissingTranslations };
26
+ export { listMissingTranslations, listMissingTranslationsWithConfig };
17
27
  //# sourceMappingURL=listMissingTranslations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"listMissingTranslations.d.ts","names":[],"sources":["../../../src/test/listMissingTranslations.ts"],"sourcesContent":[],"mappings":";;;;cASa,iDACY;;IADZ,GAAA,EAAA,MAAA;IACY,QAAA,CAAA,EAAA,MAAA;IAUZ,EAAA,CAAA,EAAA,MAAA;aAAA"}
1
+ {"version":3,"file":"listMissingTranslations.d.ts","names":[],"sources":["../../../src/test/listMissingTranslations.ts"],"sourcesContent":[],"mappings":";;;;cASa,mDACI;;IADJ,GAAA,EAAA,MAAA;IACI,QAAA,CAAA,EAAA,MAAA;IASJ,EAAA,CAAA,EAAA,MAAA;aAAA;;;EAmEA,sBAAA,QAMZ,EAAA;CALwB;AApEZ,cAmEA,uBAnEA,EAAA,CAAA,oBAAA,CAAA,EAoEY,uBApEZ,EAAA,GAAA;;;;;aAAA"}
@@ -0,0 +1,11 @@
1
+ import { GetConfigurationOptions } from "@intlayer/config";
2
+
3
+ //#region src/test/test.d.ts
4
+ type ListMissingTranslationsOptions = {
5
+ configOptions?: GetConfigurationOptions;
6
+ build?: boolean;
7
+ };
8
+ declare const testMissingTranslations: (options?: ListMissingTranslationsOptions) => Promise<void>;
9
+ //#endregion
10
+ export { testMissingTranslations };
11
+ //# sourceMappingURL=test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.d.ts","names":[],"sources":["../../../src/test/test.ts"],"sourcesContent":[],"mappings":";;;KAaK,8BAAA;kBACa;EADb,KAAA,CAAA,EAAA,OAAA;AAKL,CAAA;cAAa,oCACD,mCAA8B"}
@@ -5,6 +5,8 @@ type TransformOptions = {
5
5
  files?: string[];
6
6
  outputContentDeclarations?: string;
7
7
  configOptions?: GetConfigurationOptions;
8
+ codeOnly?: boolean;
9
+ declarationOnly?: boolean;
8
10
  };
9
11
  declare const transform: (options: TransformOptions) => Promise<void>;
10
12
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"transform.d.ts","names":[],"sources":["../../src/transform.ts"],"sourcesContent":[],"mappings":";;;KAaK,gBAAA;;EAAA,yBAAgB,CAAA,EAAA,MAGH;EAoBL,aA4GZ,CAAA,EAhIiB,uBAoBuB;;cAA5B,qBAA4B,qBAAgB"}
1
+ {"version":3,"file":"transform.d.ts","names":[],"sources":["../../src/transform.ts"],"sourcesContent":[],"mappings":";;;KAaK,gBAAA;;EAAA,yBAAgB,CAAA,EAAA,MAGH;EAsBL,aA8GZ,CAAA,EApIiB,uBAsBuB;;;;cAA5B,qBAA4B,qBAAgB"}
@@ -1,14 +1,15 @@
1
+ import { AIClient } from "./utils/setupAI.js";
1
2
  import { IntlayerConfig, Locale } from "@intlayer/types";
2
3
  import { GetConfigurationOptions } from "@intlayer/config";
3
- import { AIOptions } from "@intlayer/api";
4
4
  import { ListGitFilesOptions } from "@intlayer/chokidar";
5
+ import { AIConfig, AIOptions } from "@intlayer/ai";
5
6
 
6
7
  //#region src/translateDoc.d.ts
7
8
 
8
9
  /**
9
10
  * Translate a single file for a given locale
10
11
  */
11
- declare const translateFile: (baseFilePath: string, outputFilePath: string, locale: Locale, baseLocale: Locale, configuration: IntlayerConfig, aiOptions?: AIOptions, customInstructions?: string) => Promise<void>;
12
+ declare const translateFile: (baseFilePath: string, outputFilePath: string, locale: Locale, baseLocale: Locale, configuration: IntlayerConfig, aiOptions?: AIOptions, customInstructions?: string, aiClient?: AIClient, aiConfig?: AIConfig) => Promise<void>;
12
13
  type TranslateDocOptions = {
13
14
  docPattern: string[];
14
15
  locales: Locale[];
@@ -1 +1 @@
1
- {"version":3,"file":"translateDoc.d.ts","names":[],"sources":["../../src/translateDoc.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAmCA;AAGU,cAHG,aAGH,EAAA,CAAA,YAAA,EAAA,MAAA,EAAA,cAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,UAAA,EACI,MADJ,EAAA,aAAA,EAEO,cAFP,EAAA,SAAA,CAAA,EAGI,SAHJ,EAAA,kBAAA,CAAA,EAAA,MAAA,EAAA,GAImB,OAJnB,CAAA,IAAA,CAAA;KA+HL,mBAAA,GA9HS;EACG,UAAA,EAAA,MAAA,EAAA;EACH,OAAA,EA8HH,MA9HG,EAAA;EACe,mBAAA,EAAA,MAAA,EAAA;EAAA,UAAA,EA+Hf,MA/He;EA2HxB,SAAA,CAAA,EAKS,SALT;EAEM,2BAAA,CAAA,EAAA,MAAA;EAEG,aAAA,CAAA,EAGI,uBAHJ;EACA,kBAAA,CAAA,EAAA,MAAA;EAEI,oBAAA,CAAA,EAAA,MAAA,GAAA,MAAA,GAEyB,IAFzB;EAEyB,mBAAA,CAAA,EAAA,MAAA,GAAA,MAAA,GACD,IADC;EACD,YAAA,CAAA,EAAA,OAAA;EAE3B,UAAA,CAAA,EAAA,mBAAA;CAAmB;AAOlC;;;;AAAmC,cAAtB,YAAsB,EAAA,CAAA;EAAA,UAAA;EAAA,OAAA;EAAA,mBAAA;EAAA,UAAA;EAAA,SAAA;EAAA,2BAAA;EAAA,aAAA;EAAA,kBAAA;EAAA,oBAAA;EAAA,mBAAA;EAAA,YAAA;EAAA;AAAA,CAAA,EAahC,mBAbgC,EAAA,GAab,OAba,CAAA,IAAA,CAAA"}
1
+ {"version":3,"file":"translateDoc.d.ts","names":[],"sources":["../../src/translateDoc.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAmCA;AAGU,cAHG,aAGH,EAAA,CAAA,YAAA,EAAA,MAAA,EAAA,cAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,UAAA,EACI,MADJ,EAAA,aAAA,EAEO,cAFP,EAAA,SAAA,CAAA,EAGI,SAHJ,EAAA,kBAAA,CAAA,EAAA,MAAA,EAAA,QAAA,CAAA,EAKG,QALH,EAAA,QAAA,CAAA,EAMG,QANH,EAAA,GAMW,OANX,CAAA,IAAA,CAAA;KAmIL,mBAAA,GAlIS;EACG,UAAA,EAAA,MAAA,EAAA;EACH,OAAA,EAkIH,MAlIG,EAAA;EAED,mBAAA,EAAA,MAAA,EAAA;EACA,UAAA,EAiIC,MAjID;EAAQ,SAAA,CAAA,EAkIP,SAlIO;EAAA,2BAAA,CAAA,EAAA,MAAA;EA6HhB,aAAA,CAAA,EAOa,uBAPM;EAEb,kBAAA,CAAA,EAAA,MAAA;EAEG,oBAAA,CAAA,EAAA,MAAA,GAAA,MAAA,GAK6B,IAL7B;EACA,mBAAA,CAAA,EAAA,MAAA,GAAA,MAAA,GAK4B,IAL5B;EAEI,YAAA,CAAA,EAAA,OAAA;EAEyB,UAAA,CAAA,EAG5B,mBAH4B;CACD;;;AAS1C;;AAAmC,cAAtB,YAAsB,EAAA,CAAA;EAAA,UAAA;EAAA,OAAA;EAAA,mBAAA;EAAA,UAAA;EAAA,SAAA;EAAA,2BAAA;EAAA,aAAA;EAAA,kBAAA;EAAA,oBAAA;EAAA,mBAAA;EAAA,YAAA;EAAA;AAAA,CAAA,EAahC,mBAbgC,EAAA,GAab,OAba,CAAA,IAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"checkAccess.d.ts","names":[],"sources":["../../../src/utils/checkAccess.ts"],"sourcesContent":[],"mappings":";;;;cAKa,8BACI,mBACd;cAgCU,+BACI,4BACH,cACX"}
1
+ {"version":3,"file":"checkAccess.d.ts","names":[],"sources":["../../../src/utils/checkAccess.ts"],"sourcesContent":[],"mappings":";;;;cAUa,8BACI,mBACd;cAgCU,+BACI,4BACH,cACX"}