@intlayer/cli 8.11.1 → 8.11.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.
Files changed (58) hide show
  1. package/dist/cjs/IntlayerEventListener.cjs +5 -4
  2. package/dist/cjs/IntlayerEventListener.cjs.map +1 -1
  3. package/dist/cjs/_virtual/_utils_asset.cjs +0 -1
  4. package/dist/cjs/auth/sessionToken.cjs +0 -1
  5. package/dist/cjs/auth/sessionToken.cjs.map +1 -1
  6. package/dist/cjs/build.cjs +0 -1
  7. package/dist/cjs/build.cjs.map +1 -1
  8. package/dist/cjs/ci.cjs +0 -1
  9. package/dist/cjs/ci.cjs.map +1 -1
  10. package/dist/cjs/cli.cjs +0 -1
  11. package/dist/cjs/cli.cjs.map +1 -1
  12. package/dist/cjs/config.cjs +0 -1
  13. package/dist/cjs/config.cjs.map +1 -1
  14. package/dist/cjs/editor.cjs +0 -1
  15. package/dist/cjs/editor.cjs.map +1 -1
  16. package/dist/cjs/fill/formatAutoFilledFilePath.cjs +0 -1
  17. package/dist/cjs/fill/formatAutoFilledFilePath.cjs.map +1 -1
  18. package/dist/cjs/fill/formatFillData.cjs +0 -1
  19. package/dist/cjs/fill/formatFillData.cjs.map +1 -1
  20. package/dist/cjs/fill/writeFill.cjs +0 -1
  21. package/dist/cjs/fill/writeFill.cjs.map +1 -1
  22. package/dist/cjs/getTargetDictionary.cjs +0 -1
  23. package/dist/cjs/getTargetDictionary.cjs.map +1 -1
  24. package/dist/cjs/init.cjs +0 -1
  25. package/dist/cjs/init.cjs.map +1 -1
  26. package/dist/cjs/listContentDeclaration.cjs +0 -1
  27. package/dist/cjs/listContentDeclaration.cjs.map +1 -1
  28. package/dist/cjs/listProjects.cjs +0 -1
  29. package/dist/cjs/listProjects.cjs.map +1 -1
  30. package/dist/cjs/pushConfig.cjs +0 -1
  31. package/dist/cjs/pushConfig.cjs.map +1 -1
  32. package/dist/cjs/searchDoc.cjs +0 -1
  33. package/dist/cjs/searchDoc.cjs.map +1 -1
  34. package/dist/cjs/test/listMissingTranslations.cjs +0 -1
  35. package/dist/cjs/test/listMissingTranslations.cjs.map +1 -1
  36. package/dist/cjs/utils/calculateChunks.cjs +0 -1
  37. package/dist/cjs/utils/calculateChunks.cjs.map +1 -1
  38. package/dist/cjs/utils/checkLastUpdateTime.cjs +0 -1
  39. package/dist/cjs/utils/checkLastUpdateTime.cjs.map +1 -1
  40. package/dist/cjs/utils/chunkInference.cjs +0 -1
  41. package/dist/cjs/utils/chunkInference.cjs.map +1 -1
  42. package/dist/cjs/utils/getIsFileUpdatedRecently.cjs +0 -1
  43. package/dist/cjs/utils/getIsFileUpdatedRecently.cjs.map +1 -1
  44. package/dist/cjs/utils/getOutputFilePath.cjs +0 -1
  45. package/dist/cjs/utils/getOutputFilePath.cjs.map +1 -1
  46. package/dist/cjs/utils/getParentPackageJSON.cjs +0 -1
  47. package/dist/cjs/utils/getParentPackageJSON.cjs.map +1 -1
  48. package/dist/cjs/utils/mapChunksBetweenFiles.cjs +0 -1
  49. package/dist/cjs/utils/mapChunksBetweenFiles.cjs.map +1 -1
  50. package/dist/cjs/utils/openBrowser.cjs +0 -1
  51. package/dist/cjs/utils/openBrowser.cjs.map +1 -1
  52. package/dist/cjs/watch.cjs +0 -1
  53. package/dist/cjs/watch.cjs.map +1 -1
  54. package/dist/esm/IntlayerEventListener.mjs +6 -3
  55. package/dist/esm/IntlayerEventListener.mjs.map +1 -1
  56. package/dist/types/IntlayerEventListener.d.ts +1 -1
  57. package/dist/types/IntlayerEventListener.d.ts.map +1 -1
  58. package/package.json +13 -13
@@ -1 +1 @@
1
- {"version":3,"file":"getTargetDictionary.cjs","names":[],"sources":["../../src/getTargetDictionary.ts"],"sourcesContent":["import { join, relative } from 'node:path';\nimport { type ListGitFilesOptions, listGitFiles } from '@intlayer/chokidar/cli';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\n\nexport const ensureArray = <T>(value: T | T[]): T[] => [value].flat() as T[];\n\n// Arguments for the fill function\nexport type GetTargetDictionaryOptions = {\n file?: string | string[];\n keys?: string | string[];\n excludedKeys?: string | string[];\n filter?: (entry: Dictionary) => boolean; // DictionaryEntry needs to be defined\n pathFilter?: string | string[];\n gitOptions?: ListGitFilesOptions;\n configOptions?: GetConfigurationOptions;\n};\n\nexport const getTargetUnmergedDictionaries = async (\n options?: GetTargetDictionaryOptions\n): Promise<Dictionary[]> => {\n const configuration = getConfiguration(options?.configOptions);\n\n const { baseDir } = configuration.system;\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(configuration);\n let result = Object.values(unmergedDictionariesRecord).flat();\n\n // 1. if filePath not defined, list all content declaration files based on unmerged dictionaries list\n if (typeof options?.file !== 'undefined') {\n const fileArray = ensureArray(options?.file);\n const relativeFilePaths = fileArray.map((file) =>\n file.startsWith('/') ? relative(baseDir, file) : join('./', file)\n );\n\n result = result.filter(\n (dict) =>\n dict.filePath &&\n // Check for absolute path\n relativeFilePaths.includes(dict.filePath)\n );\n }\n\n if (typeof options?.keys !== 'undefined') {\n result = result.filter((dict) =>\n ensureArray(options?.keys)?.includes(dict.key)\n );\n }\n\n if (typeof options?.excludedKeys !== 'undefined') {\n result = result.filter(\n (dict) => !ensureArray(options?.excludedKeys)?.includes(dict.key)\n );\n }\n\n if (typeof options?.pathFilter !== 'undefined') {\n result = result.filter((dict) =>\n ensureArray(options?.pathFilter)?.includes(dict.filePath ?? '')\n );\n }\n\n if (typeof options?.filter !== 'undefined') {\n result = result.filter(options?.filter);\n }\n\n const gitOptions = options?.gitOptions;\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 result = result.filter((dict) => {\n if (!dict.filePath) return false;\n\n return gitChangedFiles.some((gitFile) => dict.filePath === gitFile);\n });\n }\n }\n\n return result;\n};\n"],"mappings":";;;;;;;;AASA,MAAa,eAAkB,UAAwB,CAAC,KAAK,EAAE,KAAK;AAapE,MAAa,gCAAgC,OAC3C,YAC0B;CAC1B,MAAM,4DAAiC,SAAS,aAAa;CAE7D,MAAM,EAAE,YAAY,cAAc;CAElC,MAAM,gGAAqD,aAAa;CACxE,IAAI,SAAS,OAAO,OAAO,0BAA0B,EAAE,KAAK;CAG5D,IAAI,OAAO,SAAS,SAAS,aAAa;EAExC,MAAM,oBADY,YAAY,SAAS,IACL,EAAE,KAAK,SACvC,KAAK,WAAW,GAAG,4BAAa,SAAS,IAAI,wBAAS,MAAM,IAAI,CAClE;EAEA,SAAS,OAAO,QACb,SACC,KAAK,YAEL,kBAAkB,SAAS,KAAK,QAAQ,CAC5C;CACF;CAEA,IAAI,OAAO,SAAS,SAAS,aAC3B,SAAS,OAAO,QAAQ,SACtB,YAAY,SAAS,IAAI,GAAG,SAAS,KAAK,GAAG,CAC/C;CAGF,IAAI,OAAO,SAAS,iBAAiB,aACnC,SAAS,OAAO,QACb,SAAS,CAAC,YAAY,SAAS,YAAY,GAAG,SAAS,KAAK,GAAG,CAClE;CAGF,IAAI,OAAO,SAAS,eAAe,aACjC,SAAS,OAAO,QAAQ,SACtB,YAAY,SAAS,UAAU,GAAG,SAAS,KAAK,YAAY,EAAE,CAChE;CAGF,IAAI,OAAO,SAAS,WAAW,aAC7B,SAAS,OAAO,OAAO,SAAS,MAAM;CAGxC,MAAM,aAAa,SAAS;CAC5B,IAAI,YAAY;EACd,MAAM,kBAAkB,+CAAmB,UAAU;EAErD,IAAI,iBAIF,SAAS,OAAO,QAAQ,SAAS;GAC/B,IAAI,CAAC,KAAK,UAAU,OAAO;GAE3B,OAAO,gBAAgB,MAAM,YAAY,KAAK,aAAa,OAAO;EACpE,CAAC;CAEL;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"getTargetDictionary.cjs","names":[],"sources":["../../src/getTargetDictionary.ts"],"sourcesContent":["import { join, relative } from 'node:path';\nimport { type ListGitFilesOptions, listGitFiles } from '@intlayer/chokidar/cli';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\n\nexport const ensureArray = <T>(value: T | T[]): T[] => [value].flat() as T[];\n\n// Arguments for the fill function\nexport type GetTargetDictionaryOptions = {\n file?: string | string[];\n keys?: string | string[];\n excludedKeys?: string | string[];\n filter?: (entry: Dictionary) => boolean; // DictionaryEntry needs to be defined\n pathFilter?: string | string[];\n gitOptions?: ListGitFilesOptions;\n configOptions?: GetConfigurationOptions;\n};\n\nexport const getTargetUnmergedDictionaries = async (\n options?: GetTargetDictionaryOptions\n): Promise<Dictionary[]> => {\n const configuration = getConfiguration(options?.configOptions);\n\n const { baseDir } = configuration.system;\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(configuration);\n let result = Object.values(unmergedDictionariesRecord).flat();\n\n // 1. if filePath not defined, list all content declaration files based on unmerged dictionaries list\n if (typeof options?.file !== 'undefined') {\n const fileArray = ensureArray(options?.file);\n const relativeFilePaths = fileArray.map((file) =>\n file.startsWith('/') ? relative(baseDir, file) : join('./', file)\n );\n\n result = result.filter(\n (dict) =>\n dict.filePath &&\n // Check for absolute path\n relativeFilePaths.includes(dict.filePath)\n );\n }\n\n if (typeof options?.keys !== 'undefined') {\n result = result.filter((dict) =>\n ensureArray(options?.keys)?.includes(dict.key)\n );\n }\n\n if (typeof options?.excludedKeys !== 'undefined') {\n result = result.filter(\n (dict) => !ensureArray(options?.excludedKeys)?.includes(dict.key)\n );\n }\n\n if (typeof options?.pathFilter !== 'undefined') {\n result = result.filter((dict) =>\n ensureArray(options?.pathFilter)?.includes(dict.filePath ?? '')\n );\n }\n\n if (typeof options?.filter !== 'undefined') {\n result = result.filter(options?.filter);\n }\n\n const gitOptions = options?.gitOptions;\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 result = result.filter((dict) => {\n if (!dict.filePath) return false;\n\n return gitChangedFiles.some((gitFile) => dict.filePath === gitFile);\n });\n }\n }\n\n return result;\n};\n"],"mappings":";;;;;;;AASA,MAAa,eAAkB,UAAwB,CAAC,KAAK,EAAE,KAAK;AAapE,MAAa,gCAAgC,OAC3C,YAC0B;CAC1B,MAAM,4DAAiC,SAAS,aAAa;CAE7D,MAAM,EAAE,YAAY,cAAc;CAElC,MAAM,gGAAqD,aAAa;CACxE,IAAI,SAAS,OAAO,OAAO,0BAA0B,EAAE,KAAK;CAG5D,IAAI,OAAO,SAAS,SAAS,aAAa;EAExC,MAAM,oBADY,YAAY,SAAS,IACL,EAAE,KAAK,SACvC,KAAK,WAAW,GAAG,4BAAa,SAAS,IAAI,wBAAS,MAAM,IAAI,CAClE;EAEA,SAAS,OAAO,QACb,SACC,KAAK,YAEL,kBAAkB,SAAS,KAAK,QAAQ,CAC5C;CACF;CAEA,IAAI,OAAO,SAAS,SAAS,aAC3B,SAAS,OAAO,QAAQ,SACtB,YAAY,SAAS,IAAI,GAAG,SAAS,KAAK,GAAG,CAC/C;CAGF,IAAI,OAAO,SAAS,iBAAiB,aACnC,SAAS,OAAO,QACb,SAAS,CAAC,YAAY,SAAS,YAAY,GAAG,SAAS,KAAK,GAAG,CAClE;CAGF,IAAI,OAAO,SAAS,eAAe,aACjC,SAAS,OAAO,QAAQ,SACtB,YAAY,SAAS,UAAU,GAAG,SAAS,KAAK,YAAY,EAAE,CAChE;CAGF,IAAI,OAAO,SAAS,WAAW,aAC7B,SAAS,OAAO,OAAO,SAAS,MAAM;CAGxC,MAAM,aAAa,SAAS;CAC5B,IAAI,YAAY;EACd,MAAM,kBAAkB,+CAAmB,UAAU;EAErD,IAAI,iBAIF,SAAS,OAAO,QAAQ,SAAS;GAC/B,IAAI,CAAC,KAAK,UAAU,OAAO;GAE3B,OAAO,gBAAgB,MAAM,YAAY,KAAK,aAAa,OAAO;EACpE,CAAC;CAEL;CAEA,OAAO;AACT"}
package/dist/cjs/init.cjs CHANGED
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  let node_fs = require("node:fs");
4
3
  let node_path = require("node:path");
5
4
  let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
@@ -1 +1 @@
1
- {"version":3,"file":"init.cjs","names":[],"sources":["../../src/init.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport { type InitOptions, initIntlayer } from '@intlayer/chokidar/cli';\n\nexport const findProjectRoot = (startDir: string) => {\n let currentDir = startDir;\n\n while (currentDir !== resolve(currentDir, '..')) {\n if (existsSync(join(currentDir, 'package.json'))) {\n return currentDir;\n }\n currentDir = resolve(currentDir, '..');\n }\n\n // If no package.json is found, return the start directory.\n // The initIntlayer function will handle the missing package.json error.\n return startDir;\n};\n\nexport const init = async (projectRoot?: string, options?: InitOptions) => {\n const root = projectRoot\n ? findProjectRoot(resolve(projectRoot))\n : findProjectRoot(process.cwd());\n\n await initIntlayer(root, options);\n};\n"],"mappings":";;;;;;;AAIA,MAAa,mBAAmB,aAAqB;CACnD,IAAI,aAAa;CAEjB,OAAO,sCAAuB,YAAY,IAAI,GAAG;EAC/C,gDAAoB,YAAY,cAAc,CAAC,GAC7C,OAAO;EAET,oCAAqB,YAAY,IAAI;CACvC;CAIA,OAAO;AACT;AAEA,MAAa,OAAO,OAAO,aAAsB,YAA0B;CAKzE,+CAJa,cACT,uCAAwB,WAAW,CAAC,IACpC,gBAAgB,QAAQ,IAAI,CAAC,GAER,OAAO;AAClC"}
1
+ {"version":3,"file":"init.cjs","names":[],"sources":["../../src/init.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport { type InitOptions, initIntlayer } from '@intlayer/chokidar/cli';\n\nexport const findProjectRoot = (startDir: string) => {\n let currentDir = startDir;\n\n while (currentDir !== resolve(currentDir, '..')) {\n if (existsSync(join(currentDir, 'package.json'))) {\n return currentDir;\n }\n currentDir = resolve(currentDir, '..');\n }\n\n // If no package.json is found, return the start directory.\n // The initIntlayer function will handle the missing package.json error.\n return startDir;\n};\n\nexport const init = async (projectRoot?: string, options?: InitOptions) => {\n const root = projectRoot\n ? findProjectRoot(resolve(projectRoot))\n : findProjectRoot(process.cwd());\n\n await initIntlayer(root, options);\n};\n"],"mappings":";;;;;;AAIA,MAAa,mBAAmB,aAAqB;CACnD,IAAI,aAAa;CAEjB,OAAO,sCAAuB,YAAY,IAAI,GAAG;EAC/C,gDAAoB,YAAY,cAAc,CAAC,GAC7C,OAAO;EAET,oCAAqB,YAAY,IAAI;CACvC;CAIA,OAAO;AACT;AAEA,MAAa,OAAO,OAAO,aAAsB,YAA0B;CAKzE,+CAJa,cACT,uCAAwB,WAAW,CAAC,IACpC,gBAAgB,QAAQ,IAAI,CAAC,GAER,OAAO;AAClC"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  let node_path = require("node:path");
4
3
  let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
5
4
  let _intlayer_chokidar_utils = require("@intlayer/chokidar/utils");
@@ -1 +1 @@
1
- {"version":3,"file":"listContentDeclaration.cjs","names":[],"sources":["../../src/listContentDeclaration.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { prepareIntlayer } from '@intlayer/chokidar/cli';\nimport { formatPath } from '@intlayer/chokidar/utils';\nimport {\n colon,\n colorizeKey,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\n\ntype ListContentDeclarationOptions = {\n configOptions?: GetConfigurationOptions;\n json?: boolean;\n absolute?: boolean;\n};\n\nexport const listContentDeclarationRows = async (\n options?: ListContentDeclarationOptions\n) => {\n const config = getConfiguration(options?.configOptions);\n\n await prepareIntlayer(config);\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(config);\n\n const rows = Object.values(unmergedDictionariesRecord)\n .flat()\n .map((dictionary) => ({\n key: dictionary.key ?? '',\n path: options?.absolute\n ? (dictionary.filePath ?? 'Remote')\n : relative(config.system.baseDir, dictionary.filePath ?? 'Remote'),\n }));\n return rows;\n};\n\nexport const listContentDeclaration = async (\n options?: ListContentDeclarationOptions\n) => {\n const rows = await listContentDeclarationRows(options);\n\n if (options?.json) {\n console.log(JSON.stringify(rows));\n return;\n }\n\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n const lines = rows.map((row) =>\n [\n colon(` - ${colorizeKey(row.key)}`, {\n colSize: rows.map((row) => row.key.length),\n maxSize: 60,\n }),\n ' - ',\n formatPath(row.path),\n ].join('')\n );\n\n appLogger(`Content declaration files:`);\n\n lines.forEach((line) => {\n appLogger(line, {\n level: 'info',\n });\n });\n\n appLogger(`Total content declaration files: ${colorizeNumber(rows.length)}`);\n};\n"],"mappings":";;;;;;;;;;AAqBA,MAAa,6BAA6B,OACxC,YACG;CACH,MAAM,qDAA0B,SAAS,aAAa;CAEtD,kDAAsB,MAAM;CAE5B,MAAM,gGAAqD,MAAM;CAUjE,OARa,OAAO,OAAO,0BAA0B,EAClD,KAAK,EACL,KAAK,gBAAgB;EACpB,KAAK,WAAW,OAAO;EACvB,MAAM,SAAS,WACV,WAAW,YAAY,mCACf,OAAO,OAAO,SAAS,WAAW,YAAY,QAAQ;CACrE,EACQ;AACZ;AAEA,MAAa,yBAAyB,OACpC,YACG;CACH,MAAM,OAAO,MAAM,2BAA2B,OAAO;CAErD,IAAI,SAAS,MAAM;EACjB,QAAQ,IAAI,KAAK,UAAU,IAAI,CAAC;EAChC;CACF;CAGA,MAAM,kGAD0B,SAAS,aACL,CAAC;CAErC,MAAM,QAAQ,KAAK,KAAK,QACtB;qCACQ,+CAAkB,IAAI,GAAG,KAAK;GAClC,SAAS,KAAK,KAAK,QAAQ,IAAI,IAAI,MAAM;GACzC,SAAS;EACX,CAAC;EACD;2CACW,IAAI,IAAI;CACrB,EAAE,KAAK,EAAE,CACX;CAEA,UAAU,4BAA4B;CAEtC,MAAM,SAAS,SAAS;EACtB,UAAU,MAAM,EACd,OAAO,OACT,CAAC;CACH,CAAC;CAED,UAAU,gFAAmD,KAAK,MAAM,GAAG;AAC7E"}
1
+ {"version":3,"file":"listContentDeclaration.cjs","names":[],"sources":["../../src/listContentDeclaration.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { prepareIntlayer } from '@intlayer/chokidar/cli';\nimport { formatPath } from '@intlayer/chokidar/utils';\nimport {\n colon,\n colorizeKey,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\n\ntype ListContentDeclarationOptions = {\n configOptions?: GetConfigurationOptions;\n json?: boolean;\n absolute?: boolean;\n};\n\nexport const listContentDeclarationRows = async (\n options?: ListContentDeclarationOptions\n) => {\n const config = getConfiguration(options?.configOptions);\n\n await prepareIntlayer(config);\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(config);\n\n const rows = Object.values(unmergedDictionariesRecord)\n .flat()\n .map((dictionary) => ({\n key: dictionary.key ?? '',\n path: options?.absolute\n ? (dictionary.filePath ?? 'Remote')\n : relative(config.system.baseDir, dictionary.filePath ?? 'Remote'),\n }));\n return rows;\n};\n\nexport const listContentDeclaration = async (\n options?: ListContentDeclarationOptions\n) => {\n const rows = await listContentDeclarationRows(options);\n\n if (options?.json) {\n console.log(JSON.stringify(rows));\n return;\n }\n\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n const lines = rows.map((row) =>\n [\n colon(` - ${colorizeKey(row.key)}`, {\n colSize: rows.map((row) => row.key.length),\n maxSize: 60,\n }),\n ' - ',\n formatPath(row.path),\n ].join('')\n );\n\n appLogger(`Content declaration files:`);\n\n lines.forEach((line) => {\n appLogger(line, {\n level: 'info',\n });\n });\n\n appLogger(`Total content declaration files: ${colorizeNumber(rows.length)}`);\n};\n"],"mappings":";;;;;;;;;AAqBA,MAAa,6BAA6B,OACxC,YACG;CACH,MAAM,qDAA0B,SAAS,aAAa;CAEtD,kDAAsB,MAAM;CAE5B,MAAM,gGAAqD,MAAM;CAUjE,OARa,OAAO,OAAO,0BAA0B,EAClD,KAAK,EACL,KAAK,gBAAgB;EACpB,KAAK,WAAW,OAAO;EACvB,MAAM,SAAS,WACV,WAAW,YAAY,mCACf,OAAO,OAAO,SAAS,WAAW,YAAY,QAAQ;CACrE,EACQ;AACZ;AAEA,MAAa,yBAAyB,OACpC,YACG;CACH,MAAM,OAAO,MAAM,2BAA2B,OAAO;CAErD,IAAI,SAAS,MAAM;EACjB,QAAQ,IAAI,KAAK,UAAU,IAAI,CAAC;EAChC;CACF;CAGA,MAAM,kGAD0B,SAAS,aACL,CAAC;CAErC,MAAM,QAAQ,KAAK,KAAK,QACtB;qCACQ,+CAAkB,IAAI,GAAG,KAAK;GAClC,SAAS,KAAK,KAAK,QAAQ,IAAI,IAAI,MAAM;GACzC,SAAS;EACX,CAAC;EACD;2CACW,IAAI,IAAI;CACrB,EAAE,KAAK,EAAE,CACX;CAEA,UAAU,4BAA4B;CAEtC,MAAM,SAAS,SAAS;EACtB,UAAU,MAAM,EACd,OAAO,OACT,CAAC;CACH,CAAC;CAED,UAAU,gFAAmD,KAAK,MAAM,GAAG;AAC7E"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  let node_path = require("node:path");
4
3
  let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"listProjects.cjs","names":[],"sources":["../../src/listProjects.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { type ListProjectsOptions, listProjects } from '@intlayer/chokidar/cli';\n\nexport type ListProjectsCommandOptions = ListProjectsOptions & {\n json?: boolean;\n absolute?: boolean;\n};\n\nexport const listProjectsCommand = async (\n options?: ListProjectsCommandOptions\n) => {\n const { searchDir, projectsPath } = await listProjects(options);\n\n const projectsRelativePath = projectsPath\n .map((projectPath) =>\n options?.absolute ? projectPath : relative(searchDir, projectPath)\n )\n .map((projectPath) => (projectPath === '' ? '.' : projectPath));\n\n if (options?.json) {\n console.dir(projectsRelativePath, { depth: null, arrayLimit: null });\n return;\n }\n\n if (projectsPath.length === 0) {\n console.log('No Intlayer projects found.');\n return;\n }\n\n console.log(`Found ${projectsPath.length} Intlayer project(s):\\n`);\n projectsPath.forEach((project) => {\n console.log(` - ${project}`);\n });\n};\n"],"mappings":";;;;;;AAQA,MAAa,sBAAsB,OACjC,YACG;CACH,MAAM,EAAE,WAAW,iBAAiB,+CAAmB,OAAO;CAE9D,MAAM,uBAAuB,aAC1B,KAAK,gBACJ,SAAS,WAAW,sCAAuB,WAAW,WAAW,CACnE,EACC,KAAK,gBAAiB,gBAAgB,KAAK,MAAM,WAAY;CAEhE,IAAI,SAAS,MAAM;EACjB,QAAQ,IAAI,sBAAsB;GAAE,OAAO;GAAM,YAAY;EAAK,CAAC;EACnE;CACF;CAEA,IAAI,aAAa,WAAW,GAAG;EAC7B,QAAQ,IAAI,6BAA6B;EACzC;CACF;CAEA,QAAQ,IAAI,SAAS,aAAa,OAAO,wBAAwB;CACjE,aAAa,SAAS,YAAY;EAChC,QAAQ,IAAI,OAAO,SAAS;CAC9B,CAAC;AACH"}
1
+ {"version":3,"file":"listProjects.cjs","names":[],"sources":["../../src/listProjects.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { type ListProjectsOptions, listProjects } from '@intlayer/chokidar/cli';\n\nexport type ListProjectsCommandOptions = ListProjectsOptions & {\n json?: boolean;\n absolute?: boolean;\n};\n\nexport const listProjectsCommand = async (\n options?: ListProjectsCommandOptions\n) => {\n const { searchDir, projectsPath } = await listProjects(options);\n\n const projectsRelativePath = projectsPath\n .map((projectPath) =>\n options?.absolute ? projectPath : relative(searchDir, projectPath)\n )\n .map((projectPath) => (projectPath === '' ? '.' : projectPath));\n\n if (options?.json) {\n console.dir(projectsRelativePath, { depth: null, arrayLimit: null });\n return;\n }\n\n if (projectsPath.length === 0) {\n console.log('No Intlayer projects found.');\n return;\n }\n\n console.log(`Found ${projectsPath.length} Intlayer project(s):\\n`);\n projectsPath.forEach((project) => {\n console.log(` - ${project}`);\n });\n};\n"],"mappings":";;;;;AAQA,MAAa,sBAAsB,OACjC,YACG;CACH,MAAM,EAAE,WAAW,iBAAiB,+CAAmB,OAAO;CAE9D,MAAM,uBAAuB,aAC1B,KAAK,gBACJ,SAAS,WAAW,sCAAuB,WAAW,WAAW,CACnE,EACC,KAAK,gBAAiB,gBAAgB,KAAK,MAAM,WAAY;CAEhE,IAAI,SAAS,MAAM;EACjB,QAAQ,IAAI,sBAAsB;GAAE,OAAO;GAAM,YAAY;EAAK,CAAC;EACnE;CACF;CAEA,IAAI,aAAa,WAAW,GAAG;EAC7B,QAAQ,IAAI,6BAA6B;EACzC;CACF;CAEA,QAAQ,IAAI,SAAS,aAAa,OAAO,wBAAwB;CACjE,aAAa,SAAS,YAAY;EAChC,QAAQ,IAAI,OAAO,SAAS;CAC9B,CAAC;AACH"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  const require_utils_checkAccess = require('./utils/checkAccess.cjs');
4
3
  let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
5
4
  let _intlayer_config_colors = require("@intlayer/config/colors");
@@ -1 +1 @@
1
- {"version":3,"file":"pushConfig.cjs","names":["checkCMSAuth","getAuthenticatedAPI","CYAN","GREY_DARK"],"sources":["../../src/pushConfig.ts"],"sourcesContent":["import { logConfigDetails } from '@intlayer/chokidar/cli';\nimport { CYAN, GREY_DARK } from '@intlayer/config/colors';\nimport {\n colorize,\n colorizeObject,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { checkCMSAuth, getAuthenticatedAPI } from './utils/checkAccess';\n\ntype PushOptions = {\n configOptions?: GetConfigurationOptions;\n};\n\nexport const pushConfig = async (options?: PushOptions) => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(config);\n\n const hasCMSAuth = await checkCMSAuth(config, false);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = await getAuthenticatedAPI(config);\n\n // Push the project configuration\n const getDictionariesKeysResult =\n await intlayerAPI.project.pushProjectConfiguration(config);\n\n if (!getDictionariesKeysResult.data) {\n appLogger(\n `Error pushing project configuration. Run ${colorize('npx intlayer login', CYAN)} command to authenticate.`,\n {\n level: 'error',\n }\n );\n throw new Error('Error pushing project configuration');\n }\n\n appLogger('Project configuration pushed successfully');\n\n appLogger(colorize('--------------------------------', GREY_DARK));\n appLogger(colorizeObject(getDictionariesKeysResult.data.configuration));\n appLogger(colorize('--------------------------------', GREY_DARK));\n};\n"],"mappings":";;;;;;;;;AAiBA,MAAa,aAAa,OAAO,YAA0B;CACzD,MAAM,qDAA0B,SAAS,aAAa;CACtD,6CAAiB,SAAS,aAAa;CAEvC,MAAM,sDAAyB,MAAM;CAIrC,IAAI,CAAC,MAFoBA,uCAAa,QAAQ,KAAK,GAElC;CAKjB,MAAM,4BACJ,OAAM,MAJkBC,8CAAoB,MAAM,GAIhC,QAAQ,yBAAyB,MAAM;CAE3D,IAAI,CAAC,0BAA0B,MAAM;EACnC,UACE,kFAAqD,sBAAsBC,4BAAI,EAAE,4BACjF,EACE,OAAO,QACT,CACF;EACA,MAAM,IAAI,MAAM,qCAAqC;CACvD;CAEA,UAAU,2CAA2C;CAErD,gDAAmB,oCAAoCC,iCAAS,CAAC;CACjE,sDAAyB,0BAA0B,KAAK,aAAa,CAAC;CACtE,gDAAmB,oCAAoCA,iCAAS,CAAC;AACnE"}
1
+ {"version":3,"file":"pushConfig.cjs","names":["checkCMSAuth","getAuthenticatedAPI","CYAN","GREY_DARK"],"sources":["../../src/pushConfig.ts"],"sourcesContent":["import { logConfigDetails } from '@intlayer/chokidar/cli';\nimport { CYAN, GREY_DARK } from '@intlayer/config/colors';\nimport {\n colorize,\n colorizeObject,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { checkCMSAuth, getAuthenticatedAPI } from './utils/checkAccess';\n\ntype PushOptions = {\n configOptions?: GetConfigurationOptions;\n};\n\nexport const pushConfig = async (options?: PushOptions) => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(config);\n\n const hasCMSAuth = await checkCMSAuth(config, false);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = await getAuthenticatedAPI(config);\n\n // Push the project configuration\n const getDictionariesKeysResult =\n await intlayerAPI.project.pushProjectConfiguration(config);\n\n if (!getDictionariesKeysResult.data) {\n appLogger(\n `Error pushing project configuration. Run ${colorize('npx intlayer login', CYAN)} command to authenticate.`,\n {\n level: 'error',\n }\n );\n throw new Error('Error pushing project configuration');\n }\n\n appLogger('Project configuration pushed successfully');\n\n appLogger(colorize('--------------------------------', GREY_DARK));\n appLogger(colorizeObject(getDictionariesKeysResult.data.configuration));\n appLogger(colorize('--------------------------------', GREY_DARK));\n};\n"],"mappings":";;;;;;;;AAiBA,MAAa,aAAa,OAAO,YAA0B;CACzD,MAAM,qDAA0B,SAAS,aAAa;CACtD,6CAAiB,SAAS,aAAa;CAEvC,MAAM,sDAAyB,MAAM;CAIrC,IAAI,CAAC,MAFoBA,uCAAa,QAAQ,KAAK,GAElC;CAKjB,MAAM,4BACJ,OAAM,MAJkBC,8CAAoB,MAAM,GAIhC,QAAQ,yBAAyB,MAAM;CAE3D,IAAI,CAAC,0BAA0B,MAAM;EACnC,UACE,kFAAqD,sBAAsBC,4BAAI,EAAE,4BACjF,EACE,OAAO,QACT,CACF;EACA,MAAM,IAAI,MAAM,qCAAqC;CACvD;CAEA,UAAU,2CAA2C;CAErD,gDAAmB,oCAAoCC,iCAAS,CAAC;CACjE,sDAAyB,0BAA0B,KAAK,aAAa,CAAC;CACtE,gDAAmB,oCAAoCA,iCAAS,CAAC;AACnE"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
4
3
  let _intlayer_config_logger = require("@intlayer/config/logger");
5
4
  let _intlayer_config_node = require("@intlayer/config/node");
@@ -1 +1 @@
1
- {"version":3,"file":"searchDoc.cjs","names":[],"sources":["../../src/searchDoc.ts"],"sourcesContent":["import { getSearchAPI } from '@intlayer/api';\nimport { logConfigDetails } from '@intlayer/chokidar/cli';\nimport {\n colorizeKey,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\n\ninterface SearchDocOptions {\n query: string;\n limit?: number;\n configOptions?: GetConfigurationOptions;\n}\n\nexport const searchDoc = async ({\n query,\n limit = 10,\n configOptions,\n}: SearchDocOptions) => {\n const config = getConfiguration(configOptions);\n logConfigDetails(configOptions);\n\n const appLogger = getAppLogger(config);\n\n try {\n const { searchDoc } = getSearchAPI(undefined, config);\n const response = await searchDoc({\n input: query,\n limit: limit.toString(),\n returnContent: 'true',\n });\n\n if (!response.data || !Array.isArray(response.data)) {\n appLogger('No relevant chunks found.');\n return;\n }\n\n const chunks = response.data;\n\n appLogger(`Found ${colorizeNumber(chunks.length)} relevant chunks:`);\n\n chunks.forEach((chunk: any) => {\n appLogger('---');\n appLogger(`${colorizeKey('File')}: ${chunk.fileKey}`);\n appLogger(`${colorizeKey('Title')}: ${chunk.docName}`);\n appLogger(`${colorizeKey('URL')}: ${chunk.docUrl}`);\n appLogger(`${colorizeKey('Chunk')}: ${chunk.chunkNumber}`);\n appLogger(`${colorizeKey('Content')}:`);\n appLogger(chunk.content);\n });\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n appLogger(`Search failed: ${errorMessage}`, { level: 'error' });\n }\n};\n"],"mappings":";;;;;;;;AAkBA,MAAa,YAAY,OAAO,EAC9B,OACA,QAAQ,IACR,oBACsB;CACtB,MAAM,qDAA0B,aAAa;CAC7C,6CAAiB,aAAa;CAE9B,MAAM,sDAAyB,MAAM;CAErC,IAAI;EACF,MAAM,EAAE,8CAA2B,QAAW,MAAM;EACpD,MAAM,WAAW,MAAM,UAAU;GAC/B,OAAO;GACP,OAAO,MAAM,SAAS;GACtB,eAAe;EACjB,CAAC;EAED,IAAI,CAAC,SAAS,QAAQ,CAAC,MAAM,QAAQ,SAAS,IAAI,GAAG;GACnD,UAAU,2BAA2B;GACrC;EACF;EAEA,MAAM,SAAS,SAAS;EAExB,UAAU,qDAAwB,OAAO,MAAM,EAAE,kBAAkB;EAEnE,OAAO,SAAS,UAAe;GAC7B,UAAU,KAAK;GACf,UAAU,4CAAe,MAAM,EAAE,IAAI,MAAM,SAAS;GACpD,UAAU,4CAAe,OAAO,EAAE,IAAI,MAAM,SAAS;GACrD,UAAU,4CAAe,KAAK,EAAE,IAAI,MAAM,QAAQ;GAClD,UAAU,4CAAe,OAAO,EAAE,IAAI,MAAM,aAAa;GACzD,UAAU,4CAAe,SAAS,EAAE,EAAE;GACtC,UAAU,MAAM,OAAO;EACzB,CAAC;CACH,SAAS,OAAO;EAGd,UAAU,kBADR,iBAAiB,QAAQ,MAAM,UAAU,+BACC,EAAE,OAAO,QAAQ,CAAC;CAChE;AACF"}
1
+ {"version":3,"file":"searchDoc.cjs","names":[],"sources":["../../src/searchDoc.ts"],"sourcesContent":["import { getSearchAPI } from '@intlayer/api';\nimport { logConfigDetails } from '@intlayer/chokidar/cli';\nimport {\n colorizeKey,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\n\ninterface SearchDocOptions {\n query: string;\n limit?: number;\n configOptions?: GetConfigurationOptions;\n}\n\nexport const searchDoc = async ({\n query,\n limit = 10,\n configOptions,\n}: SearchDocOptions) => {\n const config = getConfiguration(configOptions);\n logConfigDetails(configOptions);\n\n const appLogger = getAppLogger(config);\n\n try {\n const { searchDoc } = getSearchAPI(undefined, config);\n const response = await searchDoc({\n input: query,\n limit: limit.toString(),\n returnContent: 'true',\n });\n\n if (!response.data || !Array.isArray(response.data)) {\n appLogger('No relevant chunks found.');\n return;\n }\n\n const chunks = response.data;\n\n appLogger(`Found ${colorizeNumber(chunks.length)} relevant chunks:`);\n\n chunks.forEach((chunk: any) => {\n appLogger('---');\n appLogger(`${colorizeKey('File')}: ${chunk.fileKey}`);\n appLogger(`${colorizeKey('Title')}: ${chunk.docName}`);\n appLogger(`${colorizeKey('URL')}: ${chunk.docUrl}`);\n appLogger(`${colorizeKey('Chunk')}: ${chunk.chunkNumber}`);\n appLogger(`${colorizeKey('Content')}:`);\n appLogger(chunk.content);\n });\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n appLogger(`Search failed: ${errorMessage}`, { level: 'error' });\n }\n};\n"],"mappings":";;;;;;;AAkBA,MAAa,YAAY,OAAO,EAC9B,OACA,QAAQ,IACR,oBACsB;CACtB,MAAM,qDAA0B,aAAa;CAC7C,6CAAiB,aAAa;CAE9B,MAAM,sDAAyB,MAAM;CAErC,IAAI;EACF,MAAM,EAAE,8CAA2B,QAAW,MAAM;EACpD,MAAM,WAAW,MAAM,UAAU;GAC/B,OAAO;GACP,OAAO,MAAM,SAAS;GACtB,eAAe;EACjB,CAAC;EAED,IAAI,CAAC,SAAS,QAAQ,CAAC,MAAM,QAAQ,SAAS,IAAI,GAAG;GACnD,UAAU,2BAA2B;GACrC;EACF;EAEA,MAAM,SAAS,SAAS;EAExB,UAAU,qDAAwB,OAAO,MAAM,EAAE,kBAAkB;EAEnE,OAAO,SAAS,UAAe;GAC7B,UAAU,KAAK;GACf,UAAU,4CAAe,MAAM,EAAE,IAAI,MAAM,SAAS;GACpD,UAAU,4CAAe,OAAO,EAAE,IAAI,MAAM,SAAS;GACrD,UAAU,4CAAe,KAAK,EAAE,IAAI,MAAM,QAAQ;GAClD,UAAU,4CAAe,OAAO,EAAE,IAAI,MAAM,aAAa;GACzD,UAAU,4CAAe,SAAS,EAAE,EAAE;GACtC,UAAU,MAAM,OAAO;EACzB,CAAC;CACH,SAAS,OAAO;EAGd,UAAU,kBADR,iBAAiB,QAAQ,MAAM,UAAU,+BACC,EAAE,OAAO,QAAQ,CAAC;CAChE;AACF"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
4
3
  let _intlayer_config_node = require("@intlayer/config/node");
5
4
  let _intlayer_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
@@ -1 +1 @@
1
- {"version":3,"file":"listMissingTranslations.cjs","names":[],"sources":["../../../src/test/listMissingTranslations.ts"],"sourcesContent":["import { logConfigDetails } from '@intlayer/chokidar/cli';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getMissingLocalesContentFromDictionary } from '@intlayer/core/plugins';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\n\nexport const listMissingTranslationsWithConfig = (\n configuration: IntlayerConfig\n) => {\n const unmergedDictionariesRecord = getUnmergedDictionaries(configuration);\n const mergedDictionaries = getDictionaries(configuration);\n\n const missingTranslations: {\n key: string;\n filePath?: string;\n id?: string;\n locales: Locale[];\n }[] = [];\n\n const { locales, requiredLocales } = configuration.internationalization;\n\n // Use the union of keys from both unmerged and merged dictionaries so that\n // dictionaries compiled only as merged (no per-locale split) are still checked.\n const dictionariesKeys = new Set([\n ...Object.keys(unmergedDictionariesRecord),\n ...Object.keys(mergedDictionaries),\n ]);\n\n for (const dictionaryKey of dictionariesKeys) {\n const dictionaries: Dictionary[] =\n unmergedDictionariesRecord[dictionaryKey] ?? [];\n\n const multilingualDictionary: Dictionary[] = dictionaries.filter(\n (dictionary) => !dictionary.locale\n );\n\n // Test all by merging all dictionaries to ensure no per-locale dictionary is missing\n for (const dictionary of multilingualDictionary) {\n const missingLocales = getMissingLocalesContentFromDictionary(\n dictionary,\n locales\n );\n\n if (missingLocales.length > 0) {\n missingTranslations.push({\n key: dictionaryKey,\n id: dictionary.id,\n filePath: dictionary.filePath,\n locales: missingLocales,\n });\n }\n }\n\n const perLocaleDictionary: Dictionary[] = dictionaries.filter(\n (dictionary) => dictionary.locale\n );\n\n // If there are no unmerged dictionaries for this key, fall back to the\n // merged dictionary directly (covers the case where the dict was compiled\n // as merged-only and unmerged_dictionaries.cjs is empty for this key).\n if (dictionaries.length === 0) {\n const mergedDictionary = mergedDictionaries[dictionaryKey];\n\n if (mergedDictionary) {\n const missingLocales = getMissingLocalesContentFromDictionary(\n mergedDictionary,\n locales\n );\n\n if (missingLocales.length > 0) {\n missingTranslations.push({\n key: dictionaryKey,\n id: mergedDictionary.id,\n filePath: mergedDictionary.filePath,\n locales: missingLocales,\n });\n }\n }\n\n continue;\n }\n\n if (perLocaleDictionary.length === 0) {\n continue;\n }\n\n const mergedDictionary = mergedDictionaries[dictionaryKey];\n\n const missingLocales = getMissingLocalesContentFromDictionary(\n mergedDictionary,\n locales\n );\n\n if (missingLocales.length > 0) {\n missingTranslations.push({\n key: dictionaryKey,\n locales: missingLocales,\n });\n }\n }\n\n const missingLocalesSet = new Set(\n missingTranslations.flatMap(\n (missingTranslation) => missingTranslation.locales\n )\n );\n const missingLocales = Array.from(missingLocalesSet);\n\n const missingRequiredLocales = missingLocales.filter((locale) =>\n (requiredLocales ?? locales).includes(locale)\n );\n\n return { missingTranslations, missingLocales, missingRequiredLocales };\n};\n\nexport const listMissingTranslations = (\n configurationOptions?: GetConfigurationOptions\n) => {\n const configuration = getConfiguration(configurationOptions);\n logConfigDetails(configurationOptions);\n\n return listMissingTranslationsWithConfig(configuration);\n};\n"],"mappings":";;;;;;;;;AAYA,MAAa,qCACX,kBACG;CACH,MAAM,gGAAqD,aAAa;CACxE,MAAM,uEAAqC,aAAa;CAExD,MAAM,sBAKA,CAAC;CAEP,MAAM,EAAE,SAAS,oBAAoB,cAAc;CAInD,MAAM,mBAAmB,IAAI,IAAI,CAC/B,GAAG,OAAO,KAAK,0BAA0B,GACzC,GAAG,OAAO,KAAK,kBAAkB,CACnC,CAAC;CAED,KAAK,MAAM,iBAAiB,kBAAkB;EAC5C,MAAM,eACJ,2BAA2B,kBAAkB,CAAC;EAEhD,MAAM,yBAAuC,aAAa,QACvD,eAAe,CAAC,WAAW,MAC9B;EAGA,KAAK,MAAM,cAAc,wBAAwB;GAC/C,MAAM,oFACJ,YACA,OACF;GAEA,IAAI,eAAe,SAAS,GAC1B,oBAAoB,KAAK;IACvB,KAAK;IACL,IAAI,WAAW;IACf,UAAU,WAAW;IACrB,SAAS;GACX,CAAC;EAEL;EAEA,MAAM,sBAAoC,aAAa,QACpD,eAAe,WAAW,MAC7B;EAKA,IAAI,aAAa,WAAW,GAAG;GAC7B,MAAM,mBAAmB,mBAAmB;GAE5C,IAAI,kBAAkB;IACpB,MAAM,oFACJ,kBACA,OACF;IAEA,IAAI,eAAe,SAAS,GAC1B,oBAAoB,KAAK;KACvB,KAAK;KACL,IAAI,iBAAiB;KACrB,UAAU,iBAAiB;KAC3B,SAAS;IACX,CAAC;GAEL;GAEA;EACF;EAEA,IAAI,oBAAoB,WAAW,GACjC;EAGF,MAAM,mBAAmB,mBAAmB;EAE5C,MAAM,oFACJ,kBACA,OACF;EAEA,IAAI,eAAe,SAAS,GAC1B,oBAAoB,KAAK;GACvB,KAAK;GACL,SAAS;EACX,CAAC;CAEL;CAEA,MAAM,oBAAoB,IAAI,IAC5B,oBAAoB,SACjB,uBAAuB,mBAAmB,OAC7C,CACF;CACA,MAAM,iBAAiB,MAAM,KAAK,iBAAiB;CAMnD,OAAO;EAAE;EAAqB;EAAgB,wBAJf,eAAe,QAAQ,YACnD,mBAAmB,SAAS,SAAS,MAAM,CAGqB;CAAE;AACvE;AAEA,MAAa,2BACX,yBACG;CACH,MAAM,4DAAiC,oBAAoB;CAC3D,6CAAiB,oBAAoB;CAErC,OAAO,kCAAkC,aAAa;AACxD"}
1
+ {"version":3,"file":"listMissingTranslations.cjs","names":[],"sources":["../../../src/test/listMissingTranslations.ts"],"sourcesContent":["import { logConfigDetails } from '@intlayer/chokidar/cli';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getMissingLocalesContentFromDictionary } from '@intlayer/core/plugins';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\n\nexport const listMissingTranslationsWithConfig = (\n configuration: IntlayerConfig\n) => {\n const unmergedDictionariesRecord = getUnmergedDictionaries(configuration);\n const mergedDictionaries = getDictionaries(configuration);\n\n const missingTranslations: {\n key: string;\n filePath?: string;\n id?: string;\n locales: Locale[];\n }[] = [];\n\n const { locales, requiredLocales } = configuration.internationalization;\n\n // Use the union of keys from both unmerged and merged dictionaries so that\n // dictionaries compiled only as merged (no per-locale split) are still checked.\n const dictionariesKeys = new Set([\n ...Object.keys(unmergedDictionariesRecord),\n ...Object.keys(mergedDictionaries),\n ]);\n\n for (const dictionaryKey of dictionariesKeys) {\n const dictionaries: Dictionary[] =\n unmergedDictionariesRecord[dictionaryKey] ?? [];\n\n const multilingualDictionary: Dictionary[] = dictionaries.filter(\n (dictionary) => !dictionary.locale\n );\n\n // Test all by merging all dictionaries to ensure no per-locale dictionary is missing\n for (const dictionary of multilingualDictionary) {\n const missingLocales = getMissingLocalesContentFromDictionary(\n dictionary,\n locales\n );\n\n if (missingLocales.length > 0) {\n missingTranslations.push({\n key: dictionaryKey,\n id: dictionary.id,\n filePath: dictionary.filePath,\n locales: missingLocales,\n });\n }\n }\n\n const perLocaleDictionary: Dictionary[] = dictionaries.filter(\n (dictionary) => dictionary.locale\n );\n\n // If there are no unmerged dictionaries for this key, fall back to the\n // merged dictionary directly (covers the case where the dict was compiled\n // as merged-only and unmerged_dictionaries.cjs is empty for this key).\n if (dictionaries.length === 0) {\n const mergedDictionary = mergedDictionaries[dictionaryKey];\n\n if (mergedDictionary) {\n const missingLocales = getMissingLocalesContentFromDictionary(\n mergedDictionary,\n locales\n );\n\n if (missingLocales.length > 0) {\n missingTranslations.push({\n key: dictionaryKey,\n id: mergedDictionary.id,\n filePath: mergedDictionary.filePath,\n locales: missingLocales,\n });\n }\n }\n\n continue;\n }\n\n if (perLocaleDictionary.length === 0) {\n continue;\n }\n\n const mergedDictionary = mergedDictionaries[dictionaryKey];\n\n const missingLocales = getMissingLocalesContentFromDictionary(\n mergedDictionary,\n locales\n );\n\n if (missingLocales.length > 0) {\n missingTranslations.push({\n key: dictionaryKey,\n locales: missingLocales,\n });\n }\n }\n\n const missingLocalesSet = new Set(\n missingTranslations.flatMap(\n (missingTranslation) => missingTranslation.locales\n )\n );\n const missingLocales = Array.from(missingLocalesSet);\n\n const missingRequiredLocales = missingLocales.filter((locale) =>\n (requiredLocales ?? locales).includes(locale)\n );\n\n return { missingTranslations, missingLocales, missingRequiredLocales };\n};\n\nexport const listMissingTranslations = (\n configurationOptions?: GetConfigurationOptions\n) => {\n const configuration = getConfiguration(configurationOptions);\n logConfigDetails(configurationOptions);\n\n return listMissingTranslationsWithConfig(configuration);\n};\n"],"mappings":";;;;;;;;AAYA,MAAa,qCACX,kBACG;CACH,MAAM,gGAAqD,aAAa;CACxE,MAAM,uEAAqC,aAAa;CAExD,MAAM,sBAKA,CAAC;CAEP,MAAM,EAAE,SAAS,oBAAoB,cAAc;CAInD,MAAM,mBAAmB,IAAI,IAAI,CAC/B,GAAG,OAAO,KAAK,0BAA0B,GACzC,GAAG,OAAO,KAAK,kBAAkB,CACnC,CAAC;CAED,KAAK,MAAM,iBAAiB,kBAAkB;EAC5C,MAAM,eACJ,2BAA2B,kBAAkB,CAAC;EAEhD,MAAM,yBAAuC,aAAa,QACvD,eAAe,CAAC,WAAW,MAC9B;EAGA,KAAK,MAAM,cAAc,wBAAwB;GAC/C,MAAM,oFACJ,YACA,OACF;GAEA,IAAI,eAAe,SAAS,GAC1B,oBAAoB,KAAK;IACvB,KAAK;IACL,IAAI,WAAW;IACf,UAAU,WAAW;IACrB,SAAS;GACX,CAAC;EAEL;EAEA,MAAM,sBAAoC,aAAa,QACpD,eAAe,WAAW,MAC7B;EAKA,IAAI,aAAa,WAAW,GAAG;GAC7B,MAAM,mBAAmB,mBAAmB;GAE5C,IAAI,kBAAkB;IACpB,MAAM,oFACJ,kBACA,OACF;IAEA,IAAI,eAAe,SAAS,GAC1B,oBAAoB,KAAK;KACvB,KAAK;KACL,IAAI,iBAAiB;KACrB,UAAU,iBAAiB;KAC3B,SAAS;IACX,CAAC;GAEL;GAEA;EACF;EAEA,IAAI,oBAAoB,WAAW,GACjC;EAGF,MAAM,mBAAmB,mBAAmB;EAE5C,MAAM,oFACJ,kBACA,OACF;EAEA,IAAI,eAAe,SAAS,GAC1B,oBAAoB,KAAK;GACvB,KAAK;GACL,SAAS;EACX,CAAC;CAEL;CAEA,MAAM,oBAAoB,IAAI,IAC5B,oBAAoB,SACjB,uBAAuB,mBAAmB,OAC7C,CACF;CACA,MAAM,iBAAiB,MAAM,KAAK,iBAAiB;CAMnD,OAAO;EAAE;EAAqB;EAAgB,wBAJf,eAAe,QAAQ,YACnD,mBAAmB,SAAS,SAAS,MAAM,CAGqB;CAAE;AACvE;AAEA,MAAa,2BACX,yBACG;CACH,MAAM,4DAAiC,oBAAoB;CAC3D,6CAAiB,oBAAoB;CAErC,OAAO,kCAAkC,aAAa;AACxD"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_chokidar_utils = require("@intlayer/chokidar/utils");
4
3
 
5
4
  //#region src/utils/calculateChunks.ts
@@ -1 +1 @@
1
- {"version":3,"file":"calculateChunks.cjs","names":[],"sources":["../../../src/utils/calculateChunks.ts"],"sourcesContent":["import { splitTextByLines } from '@intlayer/chokidar/utils';\n\nexport type ChunkLineResult = {\n lineStart: number;\n lineLength: number;\n charStart: number;\n charLength: number;\n content: string;\n};\n\nconst DEFAULT_MAX_CHARS_PER_CHUNK = 800;\nconst DEFAULT_OVERLAP_CHARS = 0;\n\nexport const chunkText = (\n text: string,\n maxCharsPerChunk: number = DEFAULT_MAX_CHARS_PER_CHUNK,\n overlapChars: number = DEFAULT_OVERLAP_CHARS\n): ChunkLineResult[] => {\n if (maxCharsPerChunk <= 0) {\n throw new Error('maxCharsPerChunk must be greater than 0');\n }\n\n const splittedText = splitTextByLines(text);\n\n // Split text into lines to facilitate the translation\n const lines: ChunkLineResult[] = [];\n let charStartAcc = 0;\n\n splittedText.forEach((line, index) => {\n lines.push({\n content: line,\n lineStart: index,\n lineLength: 1,\n charStart: charStartAcc,\n charLength: line.length,\n });\n charStartAcc += line.length;\n });\n\n // Group lines\n // as long as the chunk length is less than maxCharsPerChunk\n // if a line longer than maxCharsPerChunk, keep it alone\n // if a line is not longer than maxCharsPerChunk, it is grouped\n const groupedLines: ChunkLineResult[] = lines.reduce(\n (acc: ChunkLineResult[], line) => {\n // If this line alone exceeds maxCharsPerChunk, keep it separate\n if (line.content.length > maxCharsPerChunk) {\n acc.push(line);\n return acc;\n }\n\n // If we have no chunks yet, start with this line\n if (acc.length === 0) {\n acc.push(line);\n return acc;\n }\n\n // Get the last chunk\n const lastChunk = acc[acc.length - 1];\n\n // Calculate what the combined length would be (including newline character)\n const combinedLength = lastChunk.content.length + line.content.length;\n\n // If combining would exceed the limit, start a new chunk\n if (combinedLength > maxCharsPerChunk) {\n acc.push(line);\n return acc;\n }\n\n // Otherwise, combine with the last chunk\n const combinedContent = lastChunk.content + line.content;\n const updatedChunk = {\n content: combinedContent,\n lineStart: lastChunk.lineStart,\n lineLength: lastChunk.lineLength + line.lineLength,\n charStart: lastChunk.charStart,\n charLength: combinedContent.length,\n };\n\n acc[acc.length - 1] = updatedChunk;\n return acc;\n },\n []\n );\n\n // If one line is longer than maxCharsPerChunk, split it into multiple chunks\n const splittedLines: ChunkLineResult[] = groupedLines.flatMap((line) => {\n const chunk: ChunkLineResult[] = [];\n\n if (line.content.length <= maxCharsPerChunk) {\n chunk.push(line);\n return chunk;\n }\n\n for (let i = 0; i < line.content.length; i += maxCharsPerChunk) {\n const slicedContent = line.content.slice(i, i + maxCharsPerChunk);\n chunk.push({\n content: slicedContent,\n lineStart: line.lineStart,\n lineLength: 1,\n charStart: line.charStart + i,\n charLength: slicedContent.length,\n });\n }\n return chunk;\n });\n\n if (overlapChars === 0) return splittedLines;\n\n const overlapChunks: ChunkLineResult[] =\n splittedLines.length > 0 ? [splittedLines[0]] : [];\n\n for (let i = 1; i < splittedLines.length; i++) {\n const previousChunk = splittedLines[i - 1];\n const chunk = splittedLines[i];\n\n const overlapContent = previousChunk.content.slice(-overlapChars);\n const overlapLineNb = splitTextByLines(overlapContent).length;\n\n const overlapContentWithoutPartialLine = overlapContent.slice(\n overlapLineNb > 1 ? overlapContent.indexOf('\\n') + 1 : 0,\n overlapContent.length\n );\n\n const newContent = overlapContentWithoutPartialLine + chunk.content;\n const newLineLength = splitTextByLines(newContent).length;\n const lineDiff = chunk.lineLength - newLineLength;\n\n const overlappedChunk = {\n content: newContent,\n lineStart: chunk.lineStart + lineDiff,\n lineLength: chunk.lineLength - lineDiff,\n charStart: chunk.charStart - overlapContentWithoutPartialLine.length,\n charLength: newContent.length,\n };\n\n overlapChunks.push(overlappedChunk);\n }\n\n return overlapChunks;\n};\n"],"mappings":";;;;;AAUA,MAAM,8BAA8B;AACpC,MAAM,wBAAwB;AAE9B,MAAa,aACX,MACA,mBAA2B,6BAC3B,eAAuB,0BACD;CACtB,IAAI,oBAAoB,GACtB,MAAM,IAAI,MAAM,yCAAyC;CAG3D,MAAM,8DAAgC,IAAI;CAG1C,MAAM,QAA2B,CAAC;CAClC,IAAI,eAAe;CAEnB,aAAa,SAAS,MAAM,UAAU;EACpC,MAAM,KAAK;GACT,SAAS;GACT,WAAW;GACX,YAAY;GACZ,WAAW;GACX,YAAY,KAAK;EACnB,CAAC;EACD,gBAAgB,KAAK;CACvB,CAAC;CAiDD,MAAM,gBA3CkC,MAAM,QAC3C,KAAwB,SAAS;EAEhC,IAAI,KAAK,QAAQ,SAAS,kBAAkB;GAC1C,IAAI,KAAK,IAAI;GACb,OAAO;EACT;EAGA,IAAI,IAAI,WAAW,GAAG;GACpB,IAAI,KAAK,IAAI;GACb,OAAO;EACT;EAGA,MAAM,YAAY,IAAI,IAAI,SAAS;EAMnC,IAHuB,UAAU,QAAQ,SAAS,KAAK,QAAQ,SAG1C,kBAAkB;GACrC,IAAI,KAAK,IAAI;GACb,OAAO;EACT;EAGA,MAAM,kBAAkB,UAAU,UAAU,KAAK;EACjD,MAAM,eAAe;GACnB,SAAS;GACT,WAAW,UAAU;GAC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"file":"calculateChunks.cjs","names":[],"sources":["../../../src/utils/calculateChunks.ts"],"sourcesContent":["import { splitTextByLines } from '@intlayer/chokidar/utils';\n\nexport type ChunkLineResult = {\n lineStart: number;\n lineLength: number;\n charStart: number;\n charLength: number;\n content: string;\n};\n\nconst DEFAULT_MAX_CHARS_PER_CHUNK = 800;\nconst DEFAULT_OVERLAP_CHARS = 0;\n\nexport const chunkText = (\n text: string,\n maxCharsPerChunk: number = DEFAULT_MAX_CHARS_PER_CHUNK,\n overlapChars: number = DEFAULT_OVERLAP_CHARS\n): ChunkLineResult[] => {\n if (maxCharsPerChunk <= 0) {\n throw new Error('maxCharsPerChunk must be greater than 0');\n }\n\n const splittedText = splitTextByLines(text);\n\n // Split text into lines to facilitate the translation\n const lines: ChunkLineResult[] = [];\n let charStartAcc = 0;\n\n splittedText.forEach((line, index) => {\n lines.push({\n content: line,\n lineStart: index,\n lineLength: 1,\n charStart: charStartAcc,\n charLength: line.length,\n });\n charStartAcc += line.length;\n });\n\n // Group lines\n // as long as the chunk length is less than maxCharsPerChunk\n // if a line longer than maxCharsPerChunk, keep it alone\n // if a line is not longer than maxCharsPerChunk, it is grouped\n const groupedLines: ChunkLineResult[] = lines.reduce(\n (acc: ChunkLineResult[], line) => {\n // If this line alone exceeds maxCharsPerChunk, keep it separate\n if (line.content.length > maxCharsPerChunk) {\n acc.push(line);\n return acc;\n }\n\n // If we have no chunks yet, start with this line\n if (acc.length === 0) {\n acc.push(line);\n return acc;\n }\n\n // Get the last chunk\n const lastChunk = acc[acc.length - 1];\n\n // Calculate what the combined length would be (including newline character)\n const combinedLength = lastChunk.content.length + line.content.length;\n\n // If combining would exceed the limit, start a new chunk\n if (combinedLength > maxCharsPerChunk) {\n acc.push(line);\n return acc;\n }\n\n // Otherwise, combine with the last chunk\n const combinedContent = lastChunk.content + line.content;\n const updatedChunk = {\n content: combinedContent,\n lineStart: lastChunk.lineStart,\n lineLength: lastChunk.lineLength + line.lineLength,\n charStart: lastChunk.charStart,\n charLength: combinedContent.length,\n };\n\n acc[acc.length - 1] = updatedChunk;\n return acc;\n },\n []\n );\n\n // If one line is longer than maxCharsPerChunk, split it into multiple chunks\n const splittedLines: ChunkLineResult[] = groupedLines.flatMap((line) => {\n const chunk: ChunkLineResult[] = [];\n\n if (line.content.length <= maxCharsPerChunk) {\n chunk.push(line);\n return chunk;\n }\n\n for (let i = 0; i < line.content.length; i += maxCharsPerChunk) {\n const slicedContent = line.content.slice(i, i + maxCharsPerChunk);\n chunk.push({\n content: slicedContent,\n lineStart: line.lineStart,\n lineLength: 1,\n charStart: line.charStart + i,\n charLength: slicedContent.length,\n });\n }\n return chunk;\n });\n\n if (overlapChars === 0) return splittedLines;\n\n const overlapChunks: ChunkLineResult[] =\n splittedLines.length > 0 ? [splittedLines[0]] : [];\n\n for (let i = 1; i < splittedLines.length; i++) {\n const previousChunk = splittedLines[i - 1];\n const chunk = splittedLines[i];\n\n const overlapContent = previousChunk.content.slice(-overlapChars);\n const overlapLineNb = splitTextByLines(overlapContent).length;\n\n const overlapContentWithoutPartialLine = overlapContent.slice(\n overlapLineNb > 1 ? overlapContent.indexOf('\\n') + 1 : 0,\n overlapContent.length\n );\n\n const newContent = overlapContentWithoutPartialLine + chunk.content;\n const newLineLength = splitTextByLines(newContent).length;\n const lineDiff = chunk.lineLength - newLineLength;\n\n const overlappedChunk = {\n content: newContent,\n lineStart: chunk.lineStart + lineDiff,\n lineLength: chunk.lineLength - lineDiff,\n charStart: chunk.charStart - overlapContentWithoutPartialLine.length,\n charLength: newContent.length,\n };\n\n overlapChunks.push(overlappedChunk);\n }\n\n return overlapChunks;\n};\n"],"mappings":";;;;AAUA,MAAM,8BAA8B;AACpC,MAAM,wBAAwB;AAE9B,MAAa,aACX,MACA,mBAA2B,6BAC3B,eAAuB,0BACD;CACtB,IAAI,oBAAoB,GACtB,MAAM,IAAI,MAAM,yCAAyC;CAG3D,MAAM,8DAAgC,IAAI;CAG1C,MAAM,QAA2B,CAAC;CAClC,IAAI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AAK,IAAI,IAAI,GAAG,IAAI,cAAc,QAAQ,KAAK;EAC7C,MAAM,gBAAgB,cAAc,IAAI;EACxC,MAAM,QAAQ,cAAc;EAE5B,MAAM,iBAAiB,cAAc,QAAQ,MAAM,CAAC,YAAY;EAChE,MAAM,+DAAiC,cAAc,EAAE;EAEvD,MAAM,mCAAmC,eAAe,MACtD,gBAAgB,IAAI,eAAe,QAAQ,IAAI,IAAI,IAAI,GACvD,eAAe,MACjB;EAEA,MAAM,aAAa,mCAAmC,MAAM;EAC5D,MAAM,+DAAiC,UAAU,EAAE;EACnD,MAAM,WAAW,MAAM,aAAa;EAEpC,MAAM,kBAAkB;GACtB,SAAS;GACT,WAAW,MAAM,YAAY;GAC7B,YAAY,MAAM,aAAa;GAC/B,WAAW,MAAM,YAAY,iCAAiC;GAC9D,YAAY,WAAW;EACzB;EAEA,cAAc,KAAK,eAAe;CACpC;CAEA,OAAO;AACT"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let node_fs = require("node:fs");
4
3
 
5
4
  //#region src/utils/checkLastUpdateTime.ts
@@ -1 +1 @@
1
- {"version":3,"file":"checkLastUpdateTime.cjs","names":[],"sources":["../../../src/utils/checkLastUpdateTime.ts"],"sourcesContent":["import { statSync } from 'node:fs';\n\n/**\n * Returns the last modification date of a file.\n *\n * @param filePath - Absolute or relative path to the file to inspect.\n * @returns Date instance representing the file's last modified time (mtime).\n * @throws Will propagate any error thrown by fs.statSync (e.g., file not found).\n */\nexport const checkLastUpdateTime = (filePath: string): Date => {\n const stats = statSync(filePath);\n return new Date(stats.mtime);\n};\n"],"mappings":";;;;;;;;;;;;AASA,MAAa,uBAAuB,aAA2B;CAC7D,MAAM,8BAAiB,QAAQ;CAC/B,OAAO,IAAI,KAAK,MAAM,KAAK;AAC7B"}
1
+ {"version":3,"file":"checkLastUpdateTime.cjs","names":[],"sources":["../../../src/utils/checkLastUpdateTime.ts"],"sourcesContent":["import { statSync } from 'node:fs';\n\n/**\n * Returns the last modification date of a file.\n *\n * @param filePath - Absolute or relative path to the file to inspect.\n * @returns Date instance representing the file's last modified time (mtime).\n * @throws Will propagate any error thrown by fs.statSync (e.g., file not found).\n */\nexport const checkLastUpdateTime = (filePath: string): Date => {\n const stats = statSync(filePath);\n return new Date(stats.mtime);\n};\n"],"mappings":";;;;;;;;;;;AASA,MAAa,uBAAuB,aAA2B;CAC7D,MAAM,8BAAiB,QAAQ;CAC/B,OAAO,IAAI,KAAK,MAAM,KAAK;AAC7B"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_utils_checkAccess = require('./checkAccess.cjs');
4
3
  let _intlayer_config_utils = require("@intlayer/config/utils");
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"chunkInference.cjs","names":["getAuthenticatedAPI"],"sources":["../../../src/utils/chunkInference.ts"],"sourcesContent":["import type {\n AIConfig,\n AIOptions,\n Messages,\n SystemMessage,\n} from '@intlayer/ai';\nimport { retryManager } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { getAuthenticatedAPI } from './checkAccess';\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 system: SystemMessage,\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 system,\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 = await getAuthenticatedAPI(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":";;;;;;;;;;AAoBA,MAAa,iBAAiB,OAC5B,QACA,UACA,WACA,eACA,UACA,aACkC;CAClC,IAAI;CAEJ,+CAAmB,YAAY;EAC7B,IAAI,YAAY,UAAU;GACxB,MAAM,WAAW,MAAM,SAAS,YAAY;IAC1C;IACA;IACA;GACF,CAAC;GAED,IAAI,CAAC,UACH,MAAM,IAAI,MAAM,yBAAyB;GAG3C,MAAM,EAAE,aAAa,cAAc;GAEnC,aAAa;IACX,aAAa,eAAe,WAAW;IACvC;GACF;GAEA;EACF;EAIA,MAAM,WAAW,OAAM,MAFLA,8CAAoB,aAAa,GAExB,GAAG,YAAY;GACxC;GACA;EACF,CAAC;EAED,IAAI,CAAC,SAAS,MACZ,MAAM,IAAI,MAAM,yBAAyB;EAG3C,MAAM,EAAE,aAAa,cAAc,SAAS;EAE5C,aAAa;GACX,aAAa,eAAe,WAAW;GACvC;EACF;CACF,CAAC,EAAE;CAEH,OAAO;AACT;AAEA,MAAM,kBAAkB,YAAoB;CAC1C,OAAO,QACJ,WAAW,qBAAqB,EAAE,EAClC,WAAW,oBAAoB,EAAE,EACjC,WAAW,mBAAmB,EAAE,EAChC,WAAW,kBAAkB,EAAE,EAC/B,WAAW,qBAAqB,EAAE,EAClC,WAAW,iBAAiB,EAAE,EAC9B,WAAW,gBAAgB,EAAE,EAC7B,WAAW,eAAe,EAAE,EAC5B,WAAW,kBAAkB,EAAE,EAC/B,WAAW,iBAAiB,EAAE,EAC9B,WAAW,gBAAgB,EAAE,EAC7B,WAAW,eAAe,EAAE,EAC5B,WAAW,eAAe,EAAE,EAC5B,WAAW,cAAc,EAAE,EAC3B,WAAW,aAAa,EAAE,EAC1B,WAAW,YAAY,EAAE;AAC9B"}
1
+ {"version":3,"file":"chunkInference.cjs","names":["getAuthenticatedAPI"],"sources":["../../../src/utils/chunkInference.ts"],"sourcesContent":["import type {\n AIConfig,\n AIOptions,\n Messages,\n SystemMessage,\n} from '@intlayer/ai';\nimport { retryManager } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { getAuthenticatedAPI } from './checkAccess';\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 system: SystemMessage,\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 system,\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 = await getAuthenticatedAPI(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":";;;;;;;;;AAoBA,MAAa,iBAAiB,OAC5B,QACA,UACA,WACA,eACA,UACA,aACkC;CAClC,IAAI;CAEJ,+CAAmB,YAAY;EAC7B,IAAI,YAAY,UAAU;GACxB,MAAM,WAAW,MAAM,SAAS,YAAY;IAC1C;IACA;IACA;GACF,CAAC;GAED,IAAI,CAAC,UACH,MAAM,IAAI,MAAM,yBAAyB;GAG3C,MAAM,EAAE,aAAa,cAAc;GAEnC,aAAa;IACX,aAAa,eAAe,WAAW;IACvC;GACF;GAEA;EACF;EAIA,MAAM,WAAW,OAAM,MAFLA,8CAAoB,aAAa,GAExB,GAAG,YAAY;GACxC;GACA;EACF,CAAC;EAED,IAAI,CAAC,SAAS,MACZ,MAAM,IAAI,MAAM,yBAAyB;EAG3C,MAAM,EAAE,aAAa,cAAc,SAAS;EAE5C,aAAa;GACX,aAAa,eAAe,WAAW;GACvC;EACF;CACF,CAAC,EAAE;CAEH,OAAO;AACT;AAEA,MAAM,kBAAkB,YAAoB;CAC1C,OAAO,QACJ,WAAW,qBAAqB,EAAE,EAClC,WAAW,oBAAoB,EAAE,EACjC,WAAW,mBAAmB,EAAE,EAChC,WAAW,kBAAkB,EAAE,EAC/B,WAAW,qBAAqB,EAAE,EAClC,WAAW,iBAAiB,EAAE,EAC9B,WAAW,gBAAgB,EAAE,EAC7B,WAAW,eAAe,EAAE,EAC5B,WAAW,kBAAkB,EAAE,EAC/B,WAAW,iBAAiB,EAAE,EAC9B,WAAW,gBAAgB,EAAE,EAC7B,WAAW,eAAe,EAAE,EAC5B,WAAW,eAAe,EAAE,EAC5B,WAAW,cAAc,EAAE,EAC3B,WAAW,aAAa,EAAE,EAC1B,WAAW,YAAY,EAAE;AAC9B"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let node_fs = require("node:fs");
4
3
 
5
4
  //#region src/utils/getIsFileUpdatedRecently.ts
@@ -1 +1 @@
1
- {"version":3,"file":"getIsFileUpdatedRecently.cjs","names":[],"sources":["../../../src/utils/getIsFileUpdatedRecently.ts"],"sourcesContent":["import { statSync } from 'node:fs';\n\nconst SKIP_RANGE_OF_LAST_UPDATE_TIME: number = 0; //2 * 60 * 60 * 1000; // 2 hours\n\n/**\n * Check if file was updated recently, to skip re-translation\n */\nexport const getIsFileUpdatedRecently = (localeFilePath: string): boolean => {\n const stats = statSync(localeFilePath);\n const lastModified = new Date(stats.mtime);\n const threshold = new Date(Date.now() - SKIP_RANGE_OF_LAST_UPDATE_TIME);\n\n return lastModified > threshold;\n};\n"],"mappings":";;;;;AAEA,MAAM,iCAAyC;;;;AAK/C,MAAa,4BAA4B,mBAAoC;CAC3E,MAAM,8BAAiB,cAAc;CAIrC,OAAO,IAHkB,KAAK,MAAM,KAGlB,IAAI,IAFA,KAAK,KAAK,IAAI,IAAI,8BAEV;AAChC"}
1
+ {"version":3,"file":"getIsFileUpdatedRecently.cjs","names":[],"sources":["../../../src/utils/getIsFileUpdatedRecently.ts"],"sourcesContent":["import { statSync } from 'node:fs';\n\nconst SKIP_RANGE_OF_LAST_UPDATE_TIME: number = 0; //2 * 60 * 60 * 1000; // 2 hours\n\n/**\n * Check if file was updated recently, to skip re-translation\n */\nexport const getIsFileUpdatedRecently = (localeFilePath: string): boolean => {\n const stats = statSync(localeFilePath);\n const lastModified = new Date(stats.mtime);\n const threshold = new Date(Date.now() - SKIP_RANGE_OF_LAST_UPDATE_TIME);\n\n return lastModified > threshold;\n};\n"],"mappings":";;;;AAEA,MAAM,iCAAyC;;;;AAK/C,MAAa,4BAA4B,mBAAoC;CAC3E,MAAM,8BAAiB,cAAc;CAIrC,OAAO,IAHkB,KAAK,MAAM,KAGlB,IAAI,IAFA,KAAK,KAAK,IAAI,IAAI,8BAEV;AAChC"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_chokidar_utils = require("@intlayer/chokidar/utils");
4
3
  let _intlayer_config_utils = require("@intlayer/config/utils");
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"getOutputFilePath.cjs","names":[],"sources":["../../../src/utils/getOutputFilePath.ts"],"sourcesContent":["import { resolveRelativePath } from '@intlayer/chokidar/utils';\nimport { parseStringPattern } from '@intlayer/config/utils';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { Fill } from '@intlayer/types/dictionary';\nimport type {\n FilePathPattern,\n FilePathPatternContext,\n} from '@intlayer/types/filePathPattern';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\n/**\n * Get the output file path by replacing the base locale with the target locale\n *\n * This function handles two types of replacements:\n * 1. Actual locale values (e.g., `/en/` → `/fr/`)\n * 2. Template placeholders (e.g., `{{baseLocale}}` → `{{locale}}`, `{{baseLocaleName}}` → `{{localeName}}`)\n *\n * Replacement patterns:\n * - `/baseLocale/` → `/locale/`\n * - `\\baseLocale\\` → `\\locale\\`\n * - `_baseLocale.` → `_locale.`\n * - `baseLocale_` → `locale_`\n * - `.baseLocaleName.` → `.localeName.`\n * - `{{baseLocale}}` → `{{locale}}`\n * - `{{baseLocaleName}}` → `{{localeName}}`\n *\n * If no patterns match, appends `.locale` to the file extension.\n *\n * @param filePath - The input file path\n * @param locale - The target locale\n * @param baseLocale - The base locale to replace\n * @returns The output file path with locale replacements\n */\nexport const getOutputFilePath = (\n filePath: string,\n locale: LocalesValues,\n baseLocale: LocalesValues\n): string => {\n if (!filePath || !locale || !baseLocale) {\n throw new Error('filePath, locale, and baseLocale are required');\n }\n\n let outputFilePath = filePath;\n\n // Define replacement patterns with global flag to replace all occurrences\n const replacements = [\n // Template placeholders (processed first)\n {\n pattern: /\\{\\{baseLocale\\}\\}/g,\n replacement: '{{locale}}',\n },\n {\n pattern: /\\{\\{baseLocaleName\\}\\}/g,\n replacement: '{{localeName}}',\n },\n\n // Path separators (most specific first)\n {\n // Unix path separators\n pattern: new RegExp(`/${baseLocale}/`, 'g'),\n replacement: `/${locale}/`,\n },\n {\n // Windows path separators\n pattern: new RegExp(`\\\\\\\\${baseLocale}\\\\\\\\`, 'g'),\n replacement: `\\\\${locale}\\\\`,\n },\n\n // File naming patterns\n {\n // file_en.md → file_fr.md\n pattern: new RegExp(`_${baseLocale}\\\\.`, 'g'),\n replacement: `_${locale}.`,\n },\n {\n // /file_en.md → /file_fr.md\n pattern: new RegExp(`/${baseLocale}_`, 'g'),\n replacement: `/${locale}_`,\n },\n {\n // Start of filename pattern en_guide.md → fr_guide.md (or after path separator)\n pattern: new RegExp(`(^|[\\\\/])${baseLocale}_`, 'g'),\n replacement: `$1${locale}_`,\n },\n {\n // Dot delimited pattern guide.en.md → guide.fr.md\n pattern: new RegExp(`\\\\.${baseLocale}\\\\.`, 'g'),\n replacement: `.${locale}.`,\n },\n ];\n\n // Apply all replacements\n for (const { pattern, replacement } of replacements) {\n outputFilePath = outputFilePath.replace(pattern, replacement);\n }\n\n // If no changes were made, append locale as extension\n if (outputFilePath === filePath) {\n const lastDotIndex = filePath.lastIndexOf('.');\n if (lastDotIndex > 0) {\n // Insert locale before the file extension\n return `${filePath.slice(0, lastDotIndex)}.${locale}${filePath.slice(lastDotIndex)}`;\n } else {\n // No extension found, just append\n return `${filePath}.${locale}`;\n }\n }\n\n return outputFilePath;\n};\n\n/**\n * Get the effective FilePathPattern for a given locale from a Fill/CompilerOutput value.\n *\n * - If Fill is an object, returns the pattern for that locale (or `false` if disabled/missing).\n * - If Fill is a string/function, returns it as-is (applies to all locales).\n * - If Fill is `false`, returns `false` (disabled for all locales).\n * - If Fill is `true` or a locale entry is `true`, returns `undefined` (use default).\n */\nexport const getPatternForLocale = (\n output: Fill,\n locale: Locale\n): FilePathPattern | false | undefined => {\n if (output === false) return false;\n if (output === true) return undefined;\n if (typeof output === 'string' || typeof output === 'function')\n return output as FilePathPattern;\n if (typeof output === 'object' && output !== null) {\n const entry = (output as Record<string, boolean | FilePathPattern>)[locale];\n if (entry === undefined || entry === false) return false;\n if (entry === true) return undefined;\n return entry as FilePathPattern;\n }\n return false;\n};\n\n/**\n * Resolve a Fill/CompilerOutput pattern to an absolute file path for a given locale.\n * Returns `false` if the locale is disabled or no pattern is configured.\n */\nexport const resolveOutputPattern = async (\n output: Fill,\n locale: Locale,\n context: FilePathPatternContext,\n sourceFilePath: string,\n baseDir: string\n): Promise<string | false> => {\n const pattern = getPatternForLocale(output, locale);\n if (pattern === false || pattern === undefined) return false;\n\n const rawPath =\n typeof pattern === 'function'\n ? await pattern(context)\n : parseStringPattern(pattern, context);\n\n return resolveRelativePath(rawPath, sourceFilePath, baseDir);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,qBACX,UACA,QACA,eACW;CACX,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,YAC3B,MAAM,IAAI,MAAM,+CAA+C;CAGjE,IAAI,iBAAiB;CAGrB,MAAM,eAAe;EAEnB;GACE,SAAS;GACT,aAAa;EACf;EACA;GACE,SAAS;G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U,oBAAoB,QAAQ,MAAM;CAClD,IAAI,YAAY,SAAS,YAAY,QAAW,OAAO;CAOvD,yDAJE,OAAO,YAAY,aACf,MAAM,QAAQ,OAAO,mDACF,SAAS,OAAO,GAEL,gBAAgB,OAAO;AAC7D"}
1
+ {"version":3,"file":"getOutputFilePath.cjs","names":[],"sources":["../../../src/utils/getOutputFilePath.ts"],"sourcesContent":["import { resolveRelativePath } from '@intlayer/chokidar/utils';\nimport { parseStringPattern } from '@intlayer/config/utils';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { Fill } from '@intlayer/types/dictionary';\nimport type {\n FilePathPattern,\n FilePathPatternContext,\n} from '@intlayer/types/filePathPattern';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\n/**\n * Get the output file path by replacing the base locale with the target locale\n *\n * This function handles two types of replacements:\n * 1. Actual locale values (e.g., `/en/` → `/fr/`)\n * 2. Template placeholders (e.g., `{{baseLocale}}` → `{{locale}}`, `{{baseLocaleName}}` → `{{localeName}}`)\n *\n * Replacement patterns:\n * - `/baseLocale/` → `/locale/`\n * - `\\baseLocale\\` → `\\locale\\`\n * - `_baseLocale.` → `_locale.`\n * - `baseLocale_` → `locale_`\n * - `.baseLocaleName.` → `.localeName.`\n * - `{{baseLocale}}` → `{{locale}}`\n * - `{{baseLocaleName}}` → `{{localeName}}`\n *\n * If no patterns match, appends `.locale` to the file extension.\n *\n * @param filePath - The input file path\n * @param locale - The target locale\n * @param baseLocale - The base locale to replace\n * @returns The output file path with locale replacements\n */\nexport const getOutputFilePath = (\n filePath: string,\n locale: LocalesValues,\n baseLocale: LocalesValues\n): string => {\n if (!filePath || !locale || !baseLocale) {\n throw new Error('filePath, locale, and baseLocale are required');\n }\n\n let outputFilePath = filePath;\n\n // Define replacement patterns with global flag to replace all occurrences\n const replacements = [\n // Template placeholders (processed first)\n {\n pattern: /\\{\\{baseLocale\\}\\}/g,\n replacement: '{{locale}}',\n },\n {\n pattern: /\\{\\{baseLocaleName\\}\\}/g,\n replacement: '{{localeName}}',\n },\n\n // Path separators (most specific first)\n {\n // Unix path separators\n pattern: new RegExp(`/${baseLocale}/`, 'g'),\n replacement: `/${locale}/`,\n },\n {\n // Windows path separators\n pattern: new RegExp(`\\\\\\\\${baseLocale}\\\\\\\\`, 'g'),\n replacement: `\\\\${locale}\\\\`,\n },\n\n // File naming patterns\n {\n // file_en.md → file_fr.md\n pattern: new RegExp(`_${baseLocale}\\\\.`, 'g'),\n replacement: `_${locale}.`,\n },\n {\n // /file_en.md → /file_fr.md\n pattern: new RegExp(`/${baseLocale}_`, 'g'),\n replacement: `/${locale}_`,\n },\n {\n // Start of filename pattern en_guide.md → fr_guide.md (or after path separator)\n pattern: new RegExp(`(^|[\\\\/])${baseLocale}_`, 'g'),\n replacement: `$1${locale}_`,\n },\n {\n // Dot delimited pattern guide.en.md → guide.fr.md\n pattern: new RegExp(`\\\\.${baseLocale}\\\\.`, 'g'),\n replacement: `.${locale}.`,\n },\n ];\n\n // Apply all replacements\n for (const { pattern, replacement } of replacements) {\n outputFilePath = outputFilePath.replace(pattern, replacement);\n }\n\n // If no changes were made, append locale as extension\n if (outputFilePath === filePath) {\n const lastDotIndex = filePath.lastIndexOf('.');\n if (lastDotIndex > 0) {\n // Insert locale before the file extension\n return `${filePath.slice(0, lastDotIndex)}.${locale}${filePath.slice(lastDotIndex)}`;\n } else {\n // No extension found, just append\n return `${filePath}.${locale}`;\n }\n }\n\n return outputFilePath;\n};\n\n/**\n * Get the effective FilePathPattern for a given locale from a Fill/CompilerOutput value.\n *\n * - If Fill is an object, returns the pattern for that locale (or `false` if disabled/missing).\n * - If Fill is a string/function, returns it as-is (applies to all locales).\n * - If Fill is `false`, returns `false` (disabled for all locales).\n * - If Fill is `true` or a locale entry is `true`, returns `undefined` (use default).\n */\nexport const getPatternForLocale = (\n output: Fill,\n locale: Locale\n): FilePathPattern | false | undefined => {\n if (output === false) return false;\n if (output === true) return undefined;\n if (typeof output === 'string' || typeof output === 'function')\n return output as FilePathPattern;\n if (typeof output === 'object' && output !== null) {\n const entry = (output as Record<string, boolean | FilePathPattern>)[locale];\n if (entry === undefined || entry === false) return false;\n if (entry === true) return undefined;\n return entry as FilePathPattern;\n }\n return false;\n};\n\n/**\n * Resolve a Fill/CompilerOutput pattern to an absolute file path for a given locale.\n * Returns `false` if the locale is disabled or no pattern is configured.\n */\nexport const resolveOutputPattern = async (\n output: Fill,\n locale: Locale,\n context: FilePathPatternContext,\n sourceFilePath: string,\n baseDir: string\n): Promise<string | false> => {\n const pattern = getPatternForLocale(output, locale);\n if (pattern === false || pattern === undefined) return false;\n\n const rawPath =\n typeof pattern === 'function'\n ? await pattern(context)\n : parseStringPattern(pattern, context);\n\n return resolveRelativePath(rawPath, sourceFilePath, baseDir);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,qBACX,UACA,QACA,eACW;CACX,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,YAC3B,MAAM,IAAI,MAAM,+CAA+C;CAGjE,IAAI,iBAAiB;CAGrB,MAAM,eAAe;EAEnB;GACE,SAAS;GACT,aAAa;EACf;EACA;GACE,SAAS;GACT,aAAa;EACf;EAGA;GAEE,SAAS,IAAI,OAAO,IAAI,WAAW,IAAI,GAAG;GAC1C,aAAa,IAAI,OAAO;EAC1B;EACA;GAEE,SAAS,IAAI,OAAO,OAAO,WAAW,OAAO,GAAG;GAChD,aAAa,KAAK,OAAO;EAC3B;EAGA;GAEE,SAAS,IAAI,OAAO,IAAI,WAAW,MAAM,GAAG;GAC5C,aAAa,IAAI,OAAO;EAC1B;EACA;GAEE,SAAS,IAAI,OAAO,IAAI,WAAW,IAAI,GAAG;GAC1C,aAAa,IAAI,OAAO;EAC1B;EACA;GAEE,SAAS,IAAI,OAAO,YAAY,WAAW,IAAI,GAAG;GAClD,aAAa,KAAK,OAAO;EAC3B;EACA;GAEE,SAAS,IAAI,OAAO,MAAM,WAAW,MAAM,GAAG;GAC9C,aAAa,IAAI,OAAO;EAC1B;CACF;CAGA,KAAK,MAAM,EAAE,SAAS,iBAAiB,cACrC,iBAAiB,eAAe,QAAQ,SAAS,WAAW;CAI9D,IAAI,mBAAmB,UAAU;EAC/B,MAAM,eAAe,SAAS,YAAY,GAAG;EAC7C,IAAI,eAAe,GAEjB,OAAO,GAAG,SAAS,MAAM,GAAG,YAAY,EAAE,GAAG,SAAS,SAAS,MAAM,YAAY;OAGjF,OAAO,GAAG,SAAS,GAAG;CAE1B;CAEA,OAAO;AACT;;;;;;;;;AAUA,MAAa,uBACX,QACA,WACwC;CACxC,IAAI,WAAW,OAAO,OAAO;CAC7B,IAAI,WAAW,MAAM,OAAO;CAC5B,IAAI,OAAO,WAAW,YAAY,OAAO,WAAW,YAClD,OAAO;CACT,IAAI,OAAO,WAAW,YAAY,WAAW,MAAM;EACjD,MAAM,QAAS,OAAqD;EACpE,IAAI,UAAU,UAAa,UAAU,OAAO,OAAO;EACnD,IAAI,UAAU,MAAM,OAAO;EAC3B,OAAO;CACT;CACA,OAAO;AACT;;;;;AAMA,MAAa,uBAAuB,OAClC,QACA,QACA,SACA,gBACA,YAC4B;CAC5B,MAAM,UAAU,oBAAoB,QAAQ,MAAM;CAClD,IAAI,YAAY,SAAS,YAAY,QAAW,OAAO;CAOvD,yDAJE,OAAO,YAAY,aACf,MAAM,QAAQ,OAAO,mDACF,SAAS,OAAO,GAEL,gBAAgB,OAAO;AAC7D"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let node_fs = require("node:fs");
4
3
  let node_path = require("node:path");
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"getParentPackageJSON.cjs","names":[],"sources":["../../../src/utils/getParentPackageJSON.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\n\ntype PackageJSON = {\n name?: string;\n version?: string;\n private: boolean;\n description?: string;\n homepage?: string;\n bugs: {\n url?: string;\n };\n repository: {\n type?: string;\n url?: string;\n };\n license?: string;\n author: {\n name?: string;\n url?: string;\n };\n contributors?: {\n name?: string;\n email?: string;\n url?: string;\n }[];\n type?: string;\n scripts: Record<string, string>;\n devDependencies: Record<string, string>;\n packageManager?: string;\n engines: Record<string, string>;\n};\n\nexport const getParentPackageJSON = (startDir: string): PackageJSON => {\n let currentDir = startDir;\n\n while (currentDir !== dirname(currentDir)) {\n // Stop when we reach the root\n const packageJsonPath = resolve(currentDir, 'package.json');\n\n if (existsSync(packageJsonPath)) {\n return JSON.parse(readFileSync(packageJsonPath, 'utf8'));\n }\n\n // Move up one directory level\n currentDir = dirname(currentDir);\n }\n\n // Check the root directory as well\n const rootPackageJsonPath = resolve(currentDir, 'package.json');\n if (existsSync(rootPackageJsonPath)) {\n return JSON.parse(readFileSync(rootPackageJsonPath, 'utf8'));\n }\n\n // If no package.json is found in any parent directory\n throw new Error(\n `No package.json found in any parent directory of ${startDir}`\n );\n};\n"],"mappings":";;;;;;AAiCA,MAAa,wBAAwB,aAAkC;CACrE,IAAI,aAAa;CAEjB,OAAO,sCAAuB,UAAU,GAAG;EAEzC,MAAM,yCAA0B,YAAY,cAAc;EAE1D,4BAAe,eAAe,GAC5B,OAAO,KAAK,gCAAmB,iBAAiB,MAAM,CAAC;EAIzD,oCAAqB,UAAU;CACjC;CAGA,MAAM,6CAA8B,YAAY,cAAc;CAC9D,4BAAe,mBAAmB,GAChC,OAAO,KAAK,gCAAmB,qBAAqB,MAAM,CAAC;CAI7D,MAAM,IAAI,MACR,oDAAoD,UACtD;AACF"}
1
+ {"version":3,"file":"getParentPackageJSON.cjs","names":[],"sources":["../../../src/utils/getParentPackageJSON.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\n\ntype PackageJSON = {\n name?: string;\n version?: string;\n private: boolean;\n description?: string;\n homepage?: string;\n bugs: {\n url?: string;\n };\n repository: {\n type?: string;\n url?: string;\n };\n license?: string;\n author: {\n name?: string;\n url?: string;\n };\n contributors?: {\n name?: string;\n email?: string;\n url?: string;\n }[];\n type?: string;\n scripts: Record<string, string>;\n devDependencies: Record<string, string>;\n packageManager?: string;\n engines: Record<string, string>;\n};\n\nexport const getParentPackageJSON = (startDir: string): PackageJSON => {\n let currentDir = startDir;\n\n while (currentDir !== dirname(currentDir)) {\n // Stop when we reach the root\n const packageJsonPath = resolve(currentDir, 'package.json');\n\n if (existsSync(packageJsonPath)) {\n return JSON.parse(readFileSync(packageJsonPath, 'utf8'));\n }\n\n // Move up one directory level\n currentDir = dirname(currentDir);\n }\n\n // Check the root directory as well\n const rootPackageJsonPath = resolve(currentDir, 'package.json');\n if (existsSync(rootPackageJsonPath)) {\n return JSON.parse(readFileSync(rootPackageJsonPath, 'utf8'));\n }\n\n // If no package.json is found in any parent directory\n throw new Error(\n `No package.json found in any parent directory of ${startDir}`\n );\n};\n"],"mappings":";;;;;AAiCA,MAAa,wBAAwB,aAAkC;CACrE,IAAI,aAAa;CAEjB,OAAO,sCAAuB,UAAU,GAAG;EAEzC,MAAM,yCAA0B,YAAY,cAAc;EAE1D,4BAAe,eAAe,GAC5B,OAAO,KAAK,gCAAmB,iBAAiB,MAAM,CAAC;EAIzD,oCAAqB,UAAU;CACjC;CAGA,MAAM,6CAA8B,YAAY,cAAc;CAC9D,4BAAe,mBAAmB,GAChC,OAAO,KAAK,gCAAmB,qBAAqB,MAAM,CAAC;CAI7D,MAAM,IAAI,MACR,oDAAoD,UACtD;AACF"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_utils_calculateChunks = require('./calculateChunks.cjs');
4
3
  let _intlayer_chokidar_utils = require("@intlayer/chokidar/utils");
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"mapChunksBetweenFiles.cjs","names":["chunkText"],"sources":["../../../src/utils/mapChunksBetweenFiles.ts"],"sourcesContent":["import { splitTextByLines } from '@intlayer/chokidar/utils';\nimport { type ChunkLineResult, chunkText } from './calculateChunks';\n\nexport interface ChunkMapping {\n baseChunk: ChunkLineResult;\n updatedChunk: ChunkLineResult | null; // null if the chunk was deleted\n hasChanges: boolean;\n}\n\n/**\n * Maps chunks from base file to corresponding chunks in updated file,\n * handling insertions, deletions, and modifications properly.\n */\nexport const mapChunksBetweenFiles = (\n baseFileContent: string,\n updatedFileContent: string,\n maxCharsPerChunk: number = 800,\n changedLines?: number[]\n): ChunkMapping[] => {\n const baseChunks = chunkText(baseFileContent, maxCharsPerChunk, 0);\n const baseLines = splitTextByLines(baseFileContent);\n const updatedLines = splitTextByLines(updatedFileContent);\n\n // Create a simple line mapping using LCS (Longest Common Subsequence) approach\n const lineMapping = createLineMapping(baseLines, updatedLines);\n\n return baseChunks.map((baseChunk): ChunkMapping => {\n // Map the base chunk's line range to the updated file\n const mappedRange = mapLineRange(\n baseChunk.lineStart,\n baseChunk.lineLength,\n lineMapping\n );\n\n if (!mappedRange) {\n // This chunk was completely deleted\n return {\n baseChunk,\n updatedChunk: null,\n hasChanges: true,\n };\n }\n\n // Create the corresponding chunk in the updated file\n const updatedChunk: ChunkLineResult = {\n lineStart: mappedRange.start,\n lineLength: mappedRange.length,\n charStart: 0, // Will be calculated when needed\n charLength: 0, // Will be calculated when needed\n content: extractLinesFromRange(\n updatedLines,\n mappedRange.start,\n mappedRange.length\n ),\n };\n\n // Calculate character positions\n updatedChunk.charStart = getCharStartForLine(\n updatedFileContent,\n updatedChunk.lineStart\n );\n updatedChunk.charLength = updatedChunk.content.length;\n\n // Determine if this chunk has changes\n const hasChanges = determineIfChunkHasChanges(\n baseChunk,\n updatedChunk,\n changedLines\n );\n\n return {\n baseChunk,\n updatedChunk,\n hasChanges,\n };\n });\n};\n\n/**\n * Creates a mapping between line numbers in base file and updated file\n * Returns a map where key = base line number, value = updated line number (or null if deleted)\n */\nconst createLineMapping = (\n baseLines: string[],\n updatedLines: string[]\n): Map<number, number | null> => {\n const mapping = new Map<number, number | null>();\n\n // Use a simple diff algorithm (similar to Myers algorithm but simplified)\n const dp: number[][] = Array(baseLines.length + 1)\n .fill(null)\n .map(() => Array(updatedLines.length + 1).fill(0));\n\n // Fill the DP table\n for (let i = 1; i <= baseLines.length; i++) {\n for (let j = 1; j <= updatedLines.length; j++) {\n if (baseLines[i - 1] === updatedLines[j - 1]) {\n dp[i][j] = dp[i - 1][j - 1] + 1;\n } else {\n dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);\n }\n }\n }\n\n // Backtrack to create the mapping\n let i = baseLines.length;\n let j = updatedLines.length;\n\n while (i > 0 || j > 0) {\n if (i > 0 && j > 0 && baseLines[i - 1] === updatedLines[j - 1]) {\n // Lines match\n mapping.set(i - 1, j - 1);\n i--;\n j--;\n } else if (i > 0 && (j === 0 || dp[i - 1][j] >= dp[i][j - 1])) {\n // Line was deleted from base\n mapping.set(i - 1, null);\n i--;\n } else {\n // Line was added to updated (no mapping needed for base)\n j--;\n }\n }\n\n return mapping;\n};\n\n/**\n * Maps a line range from base file to updated file using the line mapping\n */\nconst mapLineRange = (\n baseStart: number,\n baseLength: number,\n lineMapping: Map<number, number | null>\n): { start: number; length: number } | null => {\n const mappedLines: number[] = [];\n\n for (let i = baseStart; i < baseStart + baseLength; i++) {\n const mappedLine = lineMapping.get(i);\n if (mappedLine !== null && mappedLine !== undefined) {\n mappedLines.push(mappedLine);\n }\n }\n\n if (mappedLines.length === 0) {\n return null; // All lines were deleted\n }\n\n // Find the continuous range in the mapped lines\n mappedLines.sort((a, b) => a - b);\n const start = mappedLines[0];\n const end = mappedLines[mappedLines.length - 1];\n\n return {\n start,\n length: end - start + 1,\n };\n};\n\n/**\n * Extracts lines from a range in the lines array\n */\nconst extractLinesFromRange = (\n lines: string[],\n start: number,\n length: number\n): string => {\n const endIndex = Math.min(start + length, lines.length);\n return lines.slice(start, endIndex).join('');\n};\n\n/**\n * Gets the character position where a line starts in the text\n */\nconst getCharStartForLine = (text: string, lineNumber: number): number => {\n const lines = splitTextByLines(text);\n let charStart = 0;\n\n for (let i = 0; i < Math.min(lineNumber, lines.length); i++) {\n charStart += lines[i].length;\n }\n\n return charStart;\n};\n\n/**\n * Determines if a chunk has changes based on git changed lines or content comparison\n */\nconst determineIfChunkHasChanges = (\n baseChunk: ChunkLineResult,\n updatedChunk: ChunkLineResult,\n changedLines?: number[]\n): boolean => {\n // If we have git changed lines, use them for precise detection\n if (changedLines && changedLines.length > 0) {\n return changedLines.some(\n (line) =>\n line >= updatedChunk.lineStart &&\n line < updatedChunk.lineStart + updatedChunk.lineLength\n );\n }\n\n // Fallback to content comparison\n return baseChunk.content !== updatedChunk.content;\n};\n"],"mappings":";;;;;;;;;;AAaA,MAAa,yBACX,iBACA,oBACA,mBAA2B,KAC3B,iBACmB;CACnB,MAAM,aAAaA,wCAAU,iBAAiB,kBAAkB,CAAC;CACjE,MAAM,2DAA6B,eAAe;CAClD,MAAM,8DAAgC,kBAAkB;CAGxD,MAAM,cAAc,kBAAkB,WAAW,YAAY;CAE7D,OAAO,WAAW,KAAK,cAA4B;EAEjD,MAAM,cAAc,aAClB,UAAU,WACV,UAAU,YACV,WACF;EAEA,IAAI,CAAC,aAEH,OAAO;GACL;GACA,cAAc;GACd,YAAY;EACd;EAIF,MAAM,eAAgC;GACpC,WAAW,YAAY;GACvB,YAAY,YAAY;GACxB,WAAW;GACX,YAAY;GACZ,SAAS,sBACP,cACA,YAAY,OACZ,YAAY,MACd;EACF;EAGA,aAAa,YAAY,oBACvB,oBACA,aAAa,SACf;EACA,aAAa,aAAa,aAAa,QAAQ;EAS/C,OAAO;GACL;GACA;GACA,YATiB,2BACjB,WACA,cACA,YAMS;EACX;CACF,CAAC;AACH;;;;;AAMA,MAAM,qBACJ,WACA,iBAC+B;CAC/B,MAAM,0BAAU,IAAI,IAA2B;CAG/C,MAAM,KAAiB,MAAM,UAAU,SAAS,CAAC,EAC9C,KAAK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AAO,QAAQ,EAAE,KAAK,EAAE;AAC7C;;;;AAKA,MAAM,uBAAuB,MAAc,eAA+B;CACxE,MAAM,uDAAyB,IAAI;CACnC,IAAI,YAAY;CAEhB,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,IAAI,YAAY,MAAM,MAAM,GAAG,KACtD,aAAa,MAAM,GAAG;CAGxB,OAAO;AACT;;;;AAKA,MAAM,8BACJ,WACA,cACA,iBACY;CAEZ,IAAI,gBAAgB,aAAa,SAAS,GACxC,OAAO,aAAa,MACjB,SACC,QAAQ,aAAa,aACrB,OAAO,aAAa,YAAY,aAAa,UACjD;CAIF,OAAO,UAAU,YAAY,aAAa;AAC5C"}
1
+ {"version":3,"file":"mapChunksBetweenFiles.cjs","names":["chunkText"],"sources":["../../../src/utils/mapChunksBetweenFiles.ts"],"sourcesContent":["import { splitTextByLines } from '@intlayer/chokidar/utils';\nimport { type ChunkLineResult, chunkText } from './calculateChunks';\n\nexport interface ChunkMapping {\n baseChunk: ChunkLineResult;\n updatedChunk: ChunkLineResult | null; // null if the chunk was deleted\n hasChanges: boolean;\n}\n\n/**\n * Maps chunks from base file to corresponding chunks in updated file,\n * handling insertions, deletions, and modifications properly.\n */\nexport const mapChunksBetweenFiles = (\n baseFileContent: string,\n updatedFileContent: string,\n maxCharsPerChunk: number = 800,\n changedLines?: number[]\n): ChunkMapping[] => {\n const baseChunks = chunkText(baseFileContent, maxCharsPerChunk, 0);\n const baseLines = splitTextByLines(baseFileContent);\n const updatedLines = splitTextByLines(updatedFileContent);\n\n // Create a simple line mapping using LCS (Longest Common Subsequence) approach\n const lineMapping = createLineMapping(baseLines, updatedLines);\n\n return baseChunks.map((baseChunk): ChunkMapping => {\n // Map the base chunk's line range to the updated file\n const mappedRange = mapLineRange(\n baseChunk.lineStart,\n baseChunk.lineLength,\n lineMapping\n );\n\n if (!mappedRange) {\n // This chunk was completely deleted\n return {\n baseChunk,\n updatedChunk: null,\n hasChanges: true,\n };\n }\n\n // Create the corresponding chunk in the updated file\n const updatedChunk: ChunkLineResult = {\n lineStart: mappedRange.start,\n lineLength: mappedRange.length,\n charStart: 0, // Will be calculated when needed\n charLength: 0, // Will be calculated when needed\n content: extractLinesFromRange(\n updatedLines,\n mappedRange.start,\n mappedRange.length\n ),\n };\n\n // Calculate character positions\n updatedChunk.charStart = getCharStartForLine(\n updatedFileContent,\n updatedChunk.lineStart\n );\n updatedChunk.charLength = updatedChunk.content.length;\n\n // Determine if this chunk has changes\n const hasChanges = determineIfChunkHasChanges(\n baseChunk,\n updatedChunk,\n changedLines\n );\n\n return {\n baseChunk,\n updatedChunk,\n hasChanges,\n };\n });\n};\n\n/**\n * Creates a mapping between line numbers in base file and updated file\n * Returns a map where key = base line number, value = updated line number (or null if deleted)\n */\nconst createLineMapping = (\n baseLines: string[],\n updatedLines: string[]\n): Map<number, number | null> => {\n const mapping = new Map<number, number | null>();\n\n // Use a simple diff algorithm (similar to Myers algorithm but simplified)\n const dp: number[][] = Array(baseLines.length + 1)\n .fill(null)\n .map(() => Array(updatedLines.length + 1).fill(0));\n\n // Fill the DP table\n for (let i = 1; i <= baseLines.length; i++) {\n for (let j = 1; j <= updatedLines.length; j++) {\n if (baseLines[i - 1] === updatedLines[j - 1]) {\n dp[i][j] = dp[i - 1][j - 1] + 1;\n } else {\n dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);\n }\n }\n }\n\n // Backtrack to create the mapping\n let i = baseLines.length;\n let j = updatedLines.length;\n\n while (i > 0 || j > 0) {\n if (i > 0 && j > 0 && baseLines[i - 1] === updatedLines[j - 1]) {\n // Lines match\n mapping.set(i - 1, j - 1);\n i--;\n j--;\n } else if (i > 0 && (j === 0 || dp[i - 1][j] >= dp[i][j - 1])) {\n // Line was deleted from base\n mapping.set(i - 1, null);\n i--;\n } else {\n // Line was added to updated (no mapping needed for base)\n j--;\n }\n }\n\n return mapping;\n};\n\n/**\n * Maps a line range from base file to updated file using the line mapping\n */\nconst mapLineRange = (\n baseStart: number,\n baseLength: number,\n lineMapping: Map<number, number | null>\n): { start: number; length: number } | null => {\n const mappedLines: number[] = [];\n\n for (let i = baseStart; i < baseStart + baseLength; i++) {\n const mappedLine = lineMapping.get(i);\n if (mappedLine !== null && mappedLine !== undefined) {\n mappedLines.push(mappedLine);\n }\n }\n\n if (mappedLines.length === 0) {\n return null; // All lines were deleted\n }\n\n // Find the continuous range in the mapped lines\n mappedLines.sort((a, b) => a - b);\n const start = mappedLines[0];\n const end = mappedLines[mappedLines.length - 1];\n\n return {\n start,\n length: end - start + 1,\n };\n};\n\n/**\n * Extracts lines from a range in the lines array\n */\nconst extractLinesFromRange = (\n lines: string[],\n start: number,\n length: number\n): string => {\n const endIndex = Math.min(start + length, lines.length);\n return lines.slice(start, endIndex).join('');\n};\n\n/**\n * Gets the character position where a line starts in the text\n */\nconst getCharStartForLine = (text: string, lineNumber: number): number => {\n const lines = splitTextByLines(text);\n let charStart = 0;\n\n for (let i = 0; i < Math.min(lineNumber, lines.length); i++) {\n charStart += lines[i].length;\n }\n\n return charStart;\n};\n\n/**\n * Determines if a chunk has changes based on git changed lines or content comparison\n */\nconst determineIfChunkHasChanges = (\n baseChunk: ChunkLineResult,\n updatedChunk: ChunkLineResult,\n changedLines?: number[]\n): boolean => {\n // If we have git changed lines, use them for precise detection\n if (changedLines && changedLines.length > 0) {\n return changedLines.some(\n (line) =>\n line >= updatedChunk.lineStart &&\n line < updatedChunk.lineStart + updatedChunk.lineLength\n );\n }\n\n // Fallback to content comparison\n return baseChunk.content !== updatedChunk.content;\n};\n"],"mappings":";;;;;;;;;AAaA,MAAa,yBACX,iBACA,oBACA,mBAA2B,KAC3B,iBACmB;CACnB,MAAM,aAAaA,wCAAU,iBAAiB,kBAAkB,CAAC;CACjE,MAAM,2DAA6B,eAAe;CAClD,MAAM,8DAAgC,kBAAkB;CAGxD,MAAM,cAAc,kBAAkB,WAAW,YAAY;CAE7D,OAAO,WAAW,KAAK,cAA4B;EAEjD,MAAM,cAAc,aAClB,UAAU,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YACA,gBAC6C;CAC7C,MAAM,cAAwB,CAAC;CAE/B,KAAK,IAAI,IAAI,WAAW,IAAI,YAAY,YAAY,KAAK;EACvD,MAAM,aAAa,YAAY,IAAI,CAAC;EACpC,IAAI,eAAe,QAAQ,eAAe,QACxC,YAAY,KAAK,UAAU;CAE/B;CAEA,IAAI,YAAY,WAAW,GACzB,OAAO;CAIT,YAAY,MAAM,GAAG,MAAM,IAAI,CAAC;CAChC,MAAM,QAAQ,YAAY;CAG1B,OAAO;EACL;EACA,QAJU,YAAY,YAAY,SAAS,KAI7B,QAAQ;CACxB;AACF;;;;AAKA,MAAM,yBACJ,OACA,OACA,WACW;CACX,MAAM,WAAW,KAAK,IAAI,QAAQ,QAAQ,MAAM,MAAM;CACtD,OAAO,MAAM,MAAM,OAAO,QAAQ,EAAE,KAAK,EAAE;AAC7C;;;;AAKA,MAAM,uBAAuB,MAAc,eAA+B;CACxE,MAAM,uDAAyB,IAAI;CACnC,IAAI,YAAY;CAEhB,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,IAAI,YAAY,MAAM,MAAM,GAAG,KACtD,aAAa,MAAM,GAAG;CAGxB,OAAO;AACT;;;;AAKA,MAAM,8BACJ,WACA,cACA,iBACY;CAEZ,IAAI,gBAAgB,aAAa,SAAS,GACxC,OAAO,aAAa,MACjB,SACC,QAAQ,aAAa,aACrB,OAAO,aAAa,YAAY,aAAa,UACjD;CAIF,OAAO,UAAU,YAAY,aAAa;AAC5C"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let node_child_process = require("node:child_process");
4
3
  let node_os = require("node:os");
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"openBrowser.cjs","names":[],"sources":["../../../src/utils/openBrowser.ts"],"sourcesContent":["import { exec } from 'node:child_process';\nimport { platform } from 'node:os';\n\nexport const openBrowser = (url: string) => {\n const osPlatform = platform();\n let command = '';\n\n if (osPlatform === 'darwin') {\n command = `open \"${url}\"`;\n } else if (osPlatform === 'win32') {\n command = `start \"${url}\"`;\n } else {\n command = `xdg-open \"${url}\"`;\n }\n\n exec(command, (error) => {\n if (error) {\n console.error(`Failed to open browser: ${error.message}`);\n }\n });\n};\n"],"mappings":";;;;;;AAGA,MAAa,eAAe,QAAgB;CAC1C,MAAM,mCAAsB;CAC5B,IAAI,UAAU;CAEd,IAAI,eAAe,UACjB,UAAU,SAAS,IAAI;MAClB,IAAI,eAAe,SACxB,UAAU,UAAU,IAAI;MAExB,UAAU,aAAa,IAAI;CAG7B,6BAAK,UAAU,UAAU;EACvB,IAAI,OACF,QAAQ,MAAM,2BAA2B,MAAM,SAAS;CAE5D,CAAC;AACH"}
1
+ {"version":3,"file":"openBrowser.cjs","names":[],"sources":["../../../src/utils/openBrowser.ts"],"sourcesContent":["import { exec } from 'node:child_process';\nimport { platform } from 'node:os';\n\nexport const openBrowser = (url: string) => {\n const osPlatform = platform();\n let command = '';\n\n if (osPlatform === 'darwin') {\n command = `open \"${url}\"`;\n } else if (osPlatform === 'win32') {\n command = `start \"${url}\"`;\n } else {\n command = `xdg-open \"${url}\"`;\n }\n\n exec(command, (error) => {\n if (error) {\n console.error(`Failed to open browser: ${error.message}`);\n }\n });\n};\n"],"mappings":";;;;;AAGA,MAAa,eAAe,QAAgB;CAC1C,MAAM,mCAAsB;CAC5B,IAAI,UAAU;CAEd,IAAI,eAAe,UACjB,UAAU,SAAS,IAAI;MAClB,IAAI,eAAe,SACxB,UAAU,UAAU,IAAI;MAExB,UAAU,aAAa,IAAI;CAG7B,6BAAK,UAAU,UAAU;EACvB,IAAI,OACF,QAAQ,MAAM,2BAA2B,MAAM,SAAS;CAE5D,CAAC;AACH"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
4
3
  let _intlayer_chokidar_utils = require("@intlayer/chokidar/utils");
5
4
  let _intlayer_config_logger = require("@intlayer/config/logger");
@@ -1 +1 @@
1
- {"version":3,"file":"watch.cjs","names":[],"sources":["../../src/watch.ts"],"sourcesContent":["import { logConfigDetails } from '@intlayer/chokidar/cli';\nimport { runParallel } from '@intlayer/chokidar/utils';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\n\ntype WatchOptions = {\n skipPrepare?: boolean;\n with?: string | string[];\n configOptions?: GetConfigurationOptions;\n};\n\n/**\n * Get locales dictionaries .content.{json|ts|tsx|js|jsx|mjs|cjs} and build the JSON dictionaries in the .intlayer directory.\n * Watch mode available to get the change in the .content.{json|ts|tsx|js|jsx|mjs|cjs}\n */\nexport const watchContentDeclaration = async (options?: WatchOptions) => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(config);\n\n // Store references to the child process\n let parallelProcess: ReturnType<typeof runParallel> | undefined;\n\n if (options?.with) {\n parallelProcess = runParallel(options.with);\n // Handle the promise to avoid unhandled rejection\n parallelProcess.result.catch(() => {\n // Parallel process failed or was terminated\n process.exit(1);\n });\n }\n\n // Capture the watcher instance\n const watcher = await watch({\n persistent: true,\n skipPrepare: options?.skipPrepare ?? false,\n });\n\n // Define a Graceful Shutdown function\n let isShuttingDown = false;\n const handleShutdown = async () => {\n // Prevent multiple calls\n if (isShuttingDown) return;\n isShuttingDown = true;\n\n appLogger('Stopping Intlayer watcher...');\n\n try {\n // Kill the parallel process (e.g., Next.js) before closing the watcher\n if (parallelProcess) {\n parallelProcess.kill();\n }\n\n // Close the file watcher to stop \"esbuild service not running\" errors\n await watcher.close();\n } catch (error) {\n console.error('Error during shutdown:', error);\n } finally {\n process.exit(0);\n }\n };\n\n // Attach Signal Listeners\n process.on('SIGINT', handleShutdown);\n process.on('SIGTERM', handleShutdown);\n};\n"],"mappings":";;;;;;;;;;;;;AAmBA,MAAa,0BAA0B,OAAO,YAA2B;CACvE,MAAM,qDAA0B,SAAS,aAAa;CACtD,6CAAiB,SAAS,aAAa;CAEvC,MAAM,sDAAyB,MAAM;CAGrC,IAAI;CAEJ,IAAI,SAAS,MAAM;EACjB,4DAA8B,QAAQ,IAAI;EAE1C,gBAAgB,OAAO,YAAY;GAEjC,QAAQ,KAAK,CAAC;EAChB,CAAC;CACH;CAGA,MAAM,UAAU,4CAAY;EAC1B,YAAY;EACZ,aAAa,SAAS,eAAe;CACvC,CAAC;CAGD,IAAI,iBAAiB;CACrB,MAAM,iBAAiB,YAAY;EAEjC,IAAI,gBAAgB;EACpB,iBAAiB;EAEjB,UAAU,8BAA8B;EAExC,IAAI;GAEF,IAAI,iBACF,gBAAgB,KAAK;GAIvB,MAAM,QAAQ,MAAM;EACtB,SAAS,OAAO;GACd,QAAQ,MAAM,0BAA0B,KAAK;EAC/C,UAAU;GACR,QAAQ,KAAK,CAAC;EAChB;CACF;CAGA,QAAQ,GAAG,UAAU,cAAc;CACnC,QAAQ,GAAG,WAAW,cAAc;AACtC"}
1
+ {"version":3,"file":"watch.cjs","names":[],"sources":["../../src/watch.ts"],"sourcesContent":["import { logConfigDetails } from '@intlayer/chokidar/cli';\nimport { runParallel } from '@intlayer/chokidar/utils';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\n\ntype WatchOptions = {\n skipPrepare?: boolean;\n with?: string | string[];\n configOptions?: GetConfigurationOptions;\n};\n\n/**\n * Get locales dictionaries .content.{json|ts|tsx|js|jsx|mjs|cjs} and build the JSON dictionaries in the .intlayer directory.\n * Watch mode available to get the change in the .content.{json|ts|tsx|js|jsx|mjs|cjs}\n */\nexport const watchContentDeclaration = async (options?: WatchOptions) => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(config);\n\n // Store references to the child process\n let parallelProcess: ReturnType<typeof runParallel> | undefined;\n\n if (options?.with) {\n parallelProcess = runParallel(options.with);\n // Handle the promise to avoid unhandled rejection\n parallelProcess.result.catch(() => {\n // Parallel process failed or was terminated\n process.exit(1);\n });\n }\n\n // Capture the watcher instance\n const watcher = await watch({\n persistent: true,\n skipPrepare: options?.skipPrepare ?? false,\n });\n\n // Define a Graceful Shutdown function\n let isShuttingDown = false;\n const handleShutdown = async () => {\n // Prevent multiple calls\n if (isShuttingDown) return;\n isShuttingDown = true;\n\n appLogger('Stopping Intlayer watcher...');\n\n try {\n // Kill the parallel process (e.g., Next.js) before closing the watcher\n if (parallelProcess) {\n parallelProcess.kill();\n }\n\n // Close the file watcher to stop \"esbuild service not running\" errors\n await watcher.close();\n } catch (error) {\n console.error('Error during shutdown:', error);\n } finally {\n process.exit(0);\n }\n };\n\n // Attach Signal Listeners\n process.on('SIGINT', handleShutdown);\n process.on('SIGTERM', handleShutdown);\n};\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAa,0BAA0B,OAAO,YAA2B;CACvE,MAAM,qDAA0B,SAAS,aAAa;CACtD,6CAAiB,SAAS,aAAa;CAEvC,MAAM,sDAAyB,MAAM;CAGrC,IAAI;CAEJ,IAAI,SAAS,MAAM;EACjB,4DAA8B,QAAQ,IAAI;EAE1C,gBAAgB,OAAO,YAAY;GAEjC,QAAQ,KAAK,CAAC;EAChB,CAAC;CACH;CAGA,MAAM,UAAU,4CAAY;EAC1B,YAAY;EACZ,aAAa,SAAS,eAAe;CACvC,CAAC;CAGD,IAAI,iBAAiB;CACrB,MAAM,iBAAiB,YAAY;EAEjC,IAAI,gBAAgB;EACpB,iBAAiB;EAEjB,UAAU,8BAA8B;EAExC,IAAI;GAEF,IAAI,iBACF,gBAAgB,KAAK;GAIvB,MAAM,QAAQ,MAAM;EACtB,SAAS,OAAO;GACd,QAAQ,MAAM,0BAA0B,KAAK;EAC/C,UAAU;GACR,QAAQ,KAAK,CAAC;EAChB;CACF;CAGA,QAAQ,GAAG,UAAU,cAAc;CACnC,QAAQ,GAAG,WAAW,cAAc;AACtC"}
@@ -1,6 +1,6 @@
1
1
  import { getAppLogger } from "@intlayer/config/logger";
2
2
  import { getIntlayerAPIProxy } from "@intlayer/api";
3
- import configuration from "@intlayer/config/built";
3
+ import { editor, log } from "@intlayer/config/built";
4
4
  import { EventSource } from "eventsource";
5
5
 
6
6
  //#region src/IntlayerEventListener.ts
@@ -30,7 +30,7 @@ import { EventSource } from "eventsource";
30
30
  */
31
31
  var IntlayerEventListener = class {
32
32
  intlayerConfig;
33
- appLogger = getAppLogger(configuration);
33
+ appLogger = getAppLogger({ log });
34
34
  eventSource = null;
35
35
  reconnectAttempts = 0;
36
36
  maxReconnectAttempts = 5;
@@ -57,7 +57,10 @@ var IntlayerEventListener = class {
57
57
  * Callback triggered when connection encounters an error.
58
58
  */
59
59
  onConnectionError;
60
- constructor(intlayerConfig = configuration) {
60
+ constructor(intlayerConfig = {
61
+ log,
62
+ editor
63
+ }) {
61
64
  this.intlayerConfig = intlayerConfig;
62
65
  this.appLogger = getAppLogger(this.intlayerConfig);
63
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"IntlayerEventListener.mjs","names":[],"sources":["../../src/IntlayerEventListener.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\n// @ts-ignore: @intlayer/backend is not built yet\nimport type { DictionaryAPI, MessageEventData } from '@intlayer/backend';\nimport { default as configuration } from '@intlayer/config/built';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { EventSource } from 'eventsource';\n\nexport type IntlayerMessageEvent = MessageEvent;\n\n/**\n * IntlayerEventListener class to listen for dictionary changes via SSE (Server-Sent Events).\n *\n * Usage example:\n *\n * import { buildIntlayerDictionary } from './transpiler/declaration_file_to_dictionary/intlayer_dictionary';\n * import { IntlayerEventListener } from '@intlayer/api';\n *\n * export const checkDictionaryChanges = async () => {\n * // Instantiate the listener\n * const eventListener = new IntlayerEventListener();\n *\n * // Set up your callbacks\n * eventListener.onDictionaryChange = async (dictionary) => {\n * await buildIntlayerDictionary(dictionary);\n * };\n *\n * // Initialize the listener\n * await eventListener.initialize();\n *\n * // Optionally, clean up later when you’re done\n * // eventListener.cleanup();\n * };\n */\nexport class IntlayerEventListener {\n private appLogger = getAppLogger(configuration);\n\n private eventSource: EventSource | null = null;\n private reconnectAttempts = 0;\n private maxReconnectAttempts = 5;\n private reconnectDelay = 1000; // Start with 1 second\n private isManuallyDisconnected = false;\n private reconnectTimeout: NodeJS.Timeout | null = null;\n\n /**\n * Callback triggered when a Dictionary is ADDED.\n */\n public onDictionaryAdded?: (dictionary: DictionaryAPI) => any;\n\n /**\n * Callback triggered when a Dictionary is UPDATED.\n */\n public onDictionaryChange?: (dictionary: DictionaryAPI) => any;\n\n /**\n * Callback triggered when a Dictionary is DELETED.\n */\n public onDictionaryDeleted?: (dictionary: DictionaryAPI) => any;\n\n /**\n * Callback triggered when connection is established or re-established.\n */\n public onConnectionOpen?: () => any;\n\n /**\n * Callback triggered when connection encounters an error.\n */\n public onConnectionError?: (error: Event) => any;\n\n constructor(private intlayerConfig: IntlayerConfig = configuration) {\n this.appLogger = getAppLogger(this.intlayerConfig);\n }\n\n /**\n * Initializes the EventSource connection using the given intlayerConfig\n * (or the default config if none was provided).\n */\n public async initialize(): Promise<void> {\n this.isManuallyDisconnected = false;\n await this.connect();\n }\n\n /**\n * Establishes the EventSource connection with automatic reconnection support.\n */\n private async connect(): Promise<void> {\n try {\n const backendURL = this.intlayerConfig.editor.backendURL;\n\n // Retrieve the access token via proxy\n const accessToken = await getIntlayerAPIProxy(\n undefined,\n this.intlayerConfig\n ).oAuth.getOAuth2AccessToken();\n\n if (!accessToken) {\n throw new Error('Failed to retrieve access token');\n }\n\n const API_ROUTE = `${backendURL}/api/event-listener`;\n\n // Close existing connection if any\n if (this.eventSource) {\n this.eventSource.close();\n }\n\n this.eventSource = new EventSource(API_ROUTE, {\n fetch: (input, init) =>\n fetch(input, {\n ...init,\n headers: {\n ...(init?.headers ?? {}),\n Authorization: `Bearer ${accessToken.data?.accessToken}`,\n },\n }),\n });\n\n this.eventSource.onopen = () => {\n this.reconnectAttempts = 0;\n this.reconnectDelay = 1000; // Reset delay\n this.onConnectionOpen?.();\n };\n\n this.eventSource.onmessage = (event) => this.handleMessage(event);\n this.eventSource.onerror = (event) => this.handleError(event);\n } catch (_error) {\n this.appLogger('Failed to establish EventSource connection:', {\n level: 'error',\n });\n this.scheduleReconnect();\n }\n }\n\n /**\n * Cleans up (closes) the EventSource connection.\n */\n public cleanup(): void {\n this.isManuallyDisconnected = true;\n\n if (this.reconnectTimeout) {\n clearTimeout(this.reconnectTimeout);\n this.reconnectTimeout = null;\n }\n\n if (this.eventSource) {\n this.eventSource.close();\n this.eventSource = null;\n }\n }\n\n /**\n * Schedules a reconnection attempt with exponential backoff.\n */\n private scheduleReconnect(): void {\n if (\n this.isManuallyDisconnected ||\n this.reconnectAttempts >= this.maxReconnectAttempts\n ) {\n if (this.reconnectAttempts >= this.maxReconnectAttempts) {\n this.appLogger(\n [\n `Max reconnection attempts (${this.maxReconnectAttempts}) reached. Giving up.`,\n ],\n {\n level: 'error',\n }\n );\n }\n return;\n }\n\n this.reconnectAttempts++;\n const delay = this.reconnectDelay * 2 ** (this.reconnectAttempts - 1); // Exponential backoff\n\n this.appLogger(\n `Scheduling reconnection attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts} in ${delay}ms`\n );\n\n this.reconnectTimeout = setTimeout(async () => {\n if (!this.isManuallyDisconnected) {\n await this.connect();\n }\n }, delay);\n }\n\n /**\n * Handles incoming SSE messages, parses the event data,\n * and invokes the appropriate callback.\n */\n private async handleMessage(event: IntlayerMessageEvent): Promise<void> {\n try {\n const { data } = event;\n\n const dataJSON: MessageEventData[] = JSON.parse(data);\n\n for (const dataEl of dataJSON) {\n switch (dataEl.object) {\n case 'DICTIONARY':\n switch (dataEl.status) {\n case 'ADDED':\n await this.onDictionaryAdded?.(dataEl.data);\n break;\n case 'UPDATED':\n await this.onDictionaryChange?.(dataEl.data);\n break;\n case 'DELETED':\n await this.onDictionaryDeleted?.(dataEl.data);\n break;\n default:\n this.appLogger(\n ['Unhandled dictionary status:', dataEl.status],\n {\n level: 'error',\n }\n );\n break;\n }\n break;\n default:\n this.appLogger(['Unknown object type:', dataEl.object], {\n level: 'error',\n });\n break;\n }\n }\n } catch (error) {\n this.appLogger(['Error processing dictionary update:', error], {\n level: 'error',\n });\n }\n }\n\n /**\n * Handles any SSE errors and attempts reconnection if appropriate.\n */\n private handleError(event: Event): void {\n const errorEvent = event as any;\n\n // Log detailed error information\n this.appLogger(\n [\n 'EventSource error:',\n {\n type: errorEvent.type,\n message: errorEvent.message,\n code: errorEvent.code,\n readyState: this.eventSource?.readyState,\n url: this.eventSource?.url,\n },\n ],\n {\n level: 'error',\n }\n );\n\n // Notify error callback\n this.onConnectionError?.(event);\n\n // Check if this is a connection close error\n const isConnectionClosed =\n errorEvent.type === 'error' &&\n (errorEvent.message?.includes('terminated') ||\n errorEvent.message?.includes('closed') ||\n this.eventSource?.readyState === EventSource.CLOSED);\n\n if (isConnectionClosed && !this.isManuallyDisconnected) {\n this.appLogger(\n 'Connection was terminated by server, attempting to reconnect...'\n );\n this.scheduleReconnect();\n } else {\n // For other types of errors, close the connection\n this.cleanup();\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,IAAa,wBAAb,MAAmC;CAmCb;CAlCpB,AAAQ,YAAY,aAAa,aAAa;CAE9C,AAAQ,cAAkC;CAC1C,AAAQ,oBAAoB;CAC5B,AAAQ,uBAAuB;CAC/B,AAAQ,iBAAiB;CACzB,AAAQ,yBAAyB;CACjC,AAAQ,mBAA0C;;;;CAKlD,AAAO;;;;CAKP,AAAO;;;;CAKP,AAAO;;;;CAKP,AAAO;;;;CAKP,AAAO;CA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YAAY,KACxC,WAAW,SAAS,SAAS,QAAQ,KACrC,KAAK,aAAa,eAAe,YAAY,WAEvB,CAAC,KAAK,wBAAwB;GACtD,KAAK,UACH,iEACF;GACA,KAAK,kBAAkB;EACzB,OAEE,KAAK,QAAQ;CAEjB;AACF"}
1
+ {"version":3,"file":"IntlayerEventListener.mjs","names":[],"sources":["../../src/IntlayerEventListener.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\n// @ts-ignore: @intlayer/backend is not built yet\nimport type { DictionaryAPI, MessageEventData } from '@intlayer/backend';\nimport { editor, log } from '@intlayer/config/built';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { EventSource } from 'eventsource';\n\nexport type IntlayerMessageEvent = MessageEvent;\n\n/**\n * IntlayerEventListener class to listen for dictionary changes via SSE (Server-Sent Events).\n *\n * Usage example:\n *\n * import { buildIntlayerDictionary } from './transpiler/declaration_file_to_dictionary/intlayer_dictionary';\n * import { IntlayerEventListener } from '@intlayer/api';\n *\n * export const checkDictionaryChanges = async () => {\n * // Instantiate the listener\n * const eventListener = new IntlayerEventListener();\n *\n * // Set up your callbacks\n * eventListener.onDictionaryChange = async (dictionary) => {\n * await buildIntlayerDictionary(dictionary);\n * };\n *\n * // Initialize the listener\n * await eventListener.initialize();\n *\n * // Optionally, clean up later when you’re done\n * // eventListener.cleanup();\n * };\n */\nexport class IntlayerEventListener {\n private appLogger = getAppLogger({ log });\n\n private eventSource: EventSource | null = null;\n private reconnectAttempts = 0;\n private maxReconnectAttempts = 5;\n private reconnectDelay = 1000; // Start with 1 second\n private isManuallyDisconnected = false;\n private reconnectTimeout: NodeJS.Timeout | null = null;\n\n /**\n * Callback triggered when a Dictionary is ADDED.\n */\n public onDictionaryAdded?: (dictionary: DictionaryAPI) => any;\n\n /**\n * Callback triggered when a Dictionary is UPDATED.\n */\n public onDictionaryChange?: (dictionary: DictionaryAPI) => any;\n\n /**\n * Callback triggered when a Dictionary is DELETED.\n */\n public onDictionaryDeleted?: (dictionary: DictionaryAPI) => any;\n\n /**\n * Callback triggered when connection is established or re-established.\n */\n public onConnectionOpen?: () => any;\n\n /**\n * Callback triggered when connection encounters an error.\n */\n public onConnectionError?: (error: Event) => any;\n\n constructor(\n private intlayerConfig: Pick<IntlayerConfig, 'log' | 'editor'> = {\n log,\n editor,\n }\n ) {\n this.appLogger = getAppLogger(this.intlayerConfig);\n }\n\n /**\n * Initializes the EventSource connection using the given intlayerConfig\n * (or the default config if none was provided).\n */\n public async initialize(): Promise<void> {\n this.isManuallyDisconnected = false;\n await this.connect();\n }\n\n /**\n * Establishes the EventSource connection with automatic reconnection support.\n */\n private async connect(): Promise<void> {\n try {\n const backendURL = this.intlayerConfig.editor.backendURL;\n\n // Retrieve the access token via proxy\n const accessToken = await getIntlayerAPIProxy(\n undefined,\n this.intlayerConfig\n ).oAuth.getOAuth2AccessToken();\n\n if (!accessToken) {\n throw new Error('Failed to retrieve access token');\n }\n\n const API_ROUTE = `${backendURL}/api/event-listener`;\n\n // Close existing connection if any\n if (this.eventSource) {\n this.eventSource.close();\n }\n\n this.eventSource = new EventSource(API_ROUTE, {\n fetch: (input, init) =>\n fetch(input, {\n ...init,\n headers: {\n ...(init?.headers ?? {}),\n Authorization: `Bearer ${accessToken.data?.accessToken}`,\n },\n }),\n });\n\n this.eventSource.onopen = () => {\n this.reconnectAttempts = 0;\n this.reconnectDelay = 1000; // Reset delay\n this.onConnectionOpen?.();\n };\n\n this.eventSource.onmessage = (event) => this.handleMessage(event);\n this.eventSource.onerror = (event) => this.handleError(event);\n } catch (_error) {\n this.appLogger('Failed to establish EventSource connection:', {\n level: 'error',\n });\n this.scheduleReconnect();\n }\n }\n\n /**\n * Cleans up (closes) the EventSource connection.\n */\n public cleanup(): void {\n this.isManuallyDisconnected = true;\n\n if (this.reconnectTimeout) {\n clearTimeout(this.reconnectTimeout);\n this.reconnectTimeout = null;\n }\n\n if (this.eventSource) {\n this.eventSource.close();\n this.eventSource = null;\n }\n }\n\n /**\n * Schedules a reconnection attempt with exponential backoff.\n */\n private scheduleReconnect(): void {\n if (\n this.isManuallyDisconnected ||\n this.reconnectAttempts >= this.maxReconnectAttempts\n ) {\n if (this.reconnectAttempts >= this.maxReconnectAttempts) {\n this.appLogger(\n [\n `Max reconnection attempts (${this.maxReconnectAttempts}) reached. Giving up.`,\n ],\n {\n level: 'error',\n }\n );\n }\n return;\n }\n\n this.reconnectAttempts++;\n const delay = this.reconnectDelay * 2 ** (this.reconnectAttempts - 1); // Exponential backoff\n\n this.appLogger(\n `Scheduling reconnection attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts} in ${delay}ms`\n );\n\n this.reconnectTimeout = setTimeout(async () => {\n if (!this.isManuallyDisconnected) {\n await this.connect();\n }\n }, delay);\n }\n\n /**\n * Handles incoming SSE messages, parses the event data,\n * and invokes the appropriate callback.\n */\n private async handleMessage(event: IntlayerMessageEvent): Promise<void> {\n try {\n const { data } = event;\n\n const dataJSON: MessageEventData[] = JSON.parse(data);\n\n for (const dataEl of dataJSON) {\n switch (dataEl.object) {\n case 'DICTIONARY':\n switch (dataEl.status) {\n case 'ADDED':\n await this.onDictionaryAdded?.(dataEl.data);\n break;\n case 'UPDATED':\n await this.onDictionaryChange?.(dataEl.data);\n break;\n case 'DELETED':\n await this.onDictionaryDeleted?.(dataEl.data);\n break;\n default:\n this.appLogger(\n ['Unhandled dictionary status:', dataEl.status],\n {\n level: 'error',\n }\n );\n break;\n }\n break;\n default:\n this.appLogger(['Unknown object type:', dataEl.object], {\n level: 'error',\n });\n break;\n }\n }\n } catch (error) {\n this.appLogger(['Error processing dictionary update:', error], {\n level: 'error',\n });\n }\n }\n\n /**\n * Handles any SSE errors and attempts reconnection if appropriate.\n */\n private handleError(event: Event): void {\n const errorEvent = event as any;\n\n // Log detailed error information\n this.appLogger(\n [\n 'EventSource error:',\n {\n type: errorEvent.type,\n message: errorEvent.message,\n code: errorEvent.code,\n readyState: this.eventSource?.readyState,\n url: this.eventSource?.url,\n },\n ],\n {\n level: 'error',\n }\n );\n\n // Notify error callback\n this.onConnectionError?.(event);\n\n // Check if this is a connection close error\n const isConnectionClosed =\n errorEvent.type === 'error' &&\n (errorEvent.message?.includes('terminated') ||\n errorEvent.message?.includes('closed') ||\n this.eventSource?.readyState === EventSource.CLOSED);\n\n if (isConnectionClosed && !this.isManuallyDisconnected) {\n this.appLogger(\n 'Connection was terminated by server, attempting to reconnect...'\n );\n this.scheduleReconnect();\n } else {\n // For other types of errors, close the connection\n this.cleanup();\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,IAAa,wBAAb,MAAmC;CAoCvB;CAnCV,AAAQ,YAAY,aAAa,EAAE,IAAI,CAAC;CAExC,AAAQ,cAAkC;CAC1C,AAAQ,oBAAoB;CAC5B,AAAQ,uBAAuB;CAC/B,AAAQ,iBAAiB;CACzB,AAAQ,yBAAyB;CACjC,AAAQ,mBAA0C;;;;CAKlD,AAAO;;;;CAKP,AAAO;;;;CAKP,AAAO;;;;CAKP,AAAO;;;;CAKP,AAAO;CAEP,YACE,AAAQ,iBAAyD;EAC/D;EACA;CACF,GACA;EAJQ;EAKR,KAAK,YAAY,aAAa,KAAK,cAAc;CACnD;;;;;CAMA,MAAa,aAA4B;EACvC,KAAK,yBAAyB;EAC9B,MAAM,KAAK,QAAQ;CACrB;;;;CAKA,MAAc,UAAyB;EACrC,IAAI;GACF,MAAM,aAAa,KAAK,eAAe,OAAO;GAG9C,MAAM,cAAc,MAAM,oBACxB,QACA,KAAK,cACP,EAAE,MAAM,qBAAqB;GAE7B,IAAI,CAAC,aACH,MAAM,IAAI,MAAM,iCAAiC;GAGnD,MAAM,YAAY,GAAG,WAAW;GAGhC,IAAI,KAAK,aACP,KAAK,YAAY,MAAM;GAGzB,KAAK,cAAc,IAAI,YAAY,WAAW,EAC5C,QAAQ,OAAO,SACb,MAAM,OAAO;IACX,GAAG;IACH,SAAS;KACP,GAAI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AK,oBAAoB,OAAO,IAAI;OAC1C;MACF,KAAK;OACH,MAAM,KAAK,qBAAqB,OAAO,IAAI;OAC3C;MACF,KAAK;OACH,MAAM,KAAK,sBAAsB,OAAO,IAAI;OAC5C;MACF;OACE,KAAK,UACH,CAAC,gCAAgC,OAAO,MAAM,GAC9C,EACE,OAAO,QACT,CACF;OACA;KACJ;KACA;IACF;KACE,KAAK,UAAU,CAAC,wBAAwB,OAAO,MAAM,GAAG,EACtD,OAAO,QACT,CAAC;KACD;GACJ;EAEJ,SAAS,OAAO;GACd,KAAK,UAAU,CAAC,uCAAuC,KAAK,GAAG,EAC7D,OAAO,QACT,CAAC;EACH;CACF;;;;CAKA,AAAQ,YAAY,OAAoB;EACtC,MAAM,aAAa;EAGnB,KAAK,UACH,CACE,sBACA;GACE,MAAM,WAAW;GACjB,SAAS,WAAW;GACpB,MAAM,WAAW;GACjB,YAAY,KAAK,aAAa;GAC9B,KAAK,KAAK,aAAa;EACzB,CACF,GACA,EACE,OAAO,QACT,CACF;EAGA,KAAK,oBAAoB,KAAK;EAS9B,IALE,WAAW,SAAS,YACnB,WAAW,SAAS,SAAS,YAAY,KACxC,WAAW,SAAS,SAAS,QAAQ,KACrC,KAAK,aAAa,eAAe,YAAY,WAEvB,CAAC,KAAK,wBAAwB;GACtD,KAAK,UACH,iEACF;GACA,KAAK,kBAAkB;EACzB,OAEE,KAAK,QAAQ;CAEjB;AACF"}
@@ -56,7 +56,7 @@ declare class IntlayerEventListener {
56
56
  * Callback triggered when connection encounters an error.
57
57
  */
58
58
  onConnectionError?: (error: Event) => any;
59
- constructor(intlayerConfig?: IntlayerConfig);
59
+ constructor(intlayerConfig?: Pick<IntlayerConfig, 'log' | 'editor'>);
60
60
  /**
61
61
  * Initializes the EventSource connection using the given intlayerConfig
62
62
  * (or the default config if none was provided).
@@ -1 +1 @@
1
- {"version":3,"file":"IntlayerEventListener.d.ts","names":[],"sources":["../../src/IntlayerEventListener.ts"],"mappings":";;;;KAQY,oBAA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OAAA;;;;EAmDP,OAAA,CAAA;;;;UAiBC,iBAAA;;;;;UAoCM,aAAA;;;;UA8CN,WAAA;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/cli",
3
- "version": "8.11.1",
3
+ "version": "8.11.2",
4
4
  "private": false,
5
5
  "description": "Provides uniform command-line interface scripts for Intlayer, used in packages like intlayer-cli and intlayer.",
6
6
  "keywords": [
@@ -67,33 +67,33 @@
67
67
  },
68
68
  "dependencies": {
69
69
  "@clack/prompts": "0.11.0",
70
- "@intlayer/api": "8.11.1",
71
- "@intlayer/babel": "8.11.1",
72
- "@intlayer/chokidar": "8.11.1",
73
- "@intlayer/config": "8.11.1",
74
- "@intlayer/core": "8.11.1",
75
- "@intlayer/dictionaries-entry": "8.11.1",
76
- "@intlayer/remote-dictionaries-entry": "8.11.1",
77
- "@intlayer/types": "8.11.1",
78
- "@intlayer/unmerged-dictionaries-entry": "8.11.1",
70
+ "@intlayer/api": "8.11.2",
71
+ "@intlayer/babel": "8.11.2",
72
+ "@intlayer/chokidar": "8.11.2",
73
+ "@intlayer/config": "8.11.2",
74
+ "@intlayer/core": "8.11.2",
75
+ "@intlayer/dictionaries-entry": "8.11.2",
76
+ "@intlayer/remote-dictionaries-entry": "8.11.2",
77
+ "@intlayer/types": "8.11.2",
78
+ "@intlayer/unmerged-dictionaries-entry": "8.11.2",
79
79
  "commander": "14.0.3",
80
80
  "enquirer": "^2.4.1",
81
81
  "eventsource": "4.1.0",
82
82
  "fast-glob": "3.3.3"
83
83
  },
84
84
  "devDependencies": {
85
- "@intlayer/ai": "8.11.1",
85
+ "@intlayer/ai": "8.11.2",
86
86
  "@types/node": "25.9.1",
87
87
  "@utils/ts-config": "1.0.4",
88
88
  "@utils/ts-config-types": "1.0.4",
89
89
  "@utils/tsdown-config": "1.0.4",
90
90
  "rimraf": "6.1.3",
91
- "tsdown": "0.22.00",
91
+ "tsdown": "0.22.1",
92
92
  "typescript": "6.0.3",
93
93
  "vitest": "4.1.7"
94
94
  },
95
95
  "peerDependencies": {
96
- "@intlayer/ai": "8.11.1"
96
+ "@intlayer/ai": "8.11.2"
97
97
  },
98
98
  "peerDependenciesMeta": {
99
99
  "@intlayer/ai": {