@intlayer/chokidar 7.5.0-canary.1 → 7.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs +4 -4
  2. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs.map +1 -1
  3. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs +2 -2
  4. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs.map +1 -1
  5. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +7 -7
  6. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs.map +1 -1
  7. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +5 -5
  8. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs.map +1 -1
  9. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +5 -5
  10. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs.map +1 -1
  11. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +5 -5
  12. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs.map +1 -1
  13. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +4 -4
  14. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs.map +1 -1
  15. package/dist/cjs/cleanOutputDir.cjs +2 -2
  16. package/dist/cjs/cleanOutputDir.cjs.map +1 -1
  17. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +3 -3
  18. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs.map +1 -1
  19. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs +3 -3
  20. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -1
  21. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs +2 -2
  22. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs.map +1 -1
  23. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs +2 -2
  24. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs.map +1 -1
  25. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs +2 -2
  26. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs.map +1 -1
  27. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs +2 -2
  28. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs.map +1 -1
  29. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs +2 -2
  30. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs.map +1 -1
  31. package/dist/cjs/createType/createModuleAugmentation.cjs +3 -3
  32. package/dist/cjs/createType/createModuleAugmentation.cjs.map +1 -1
  33. package/dist/cjs/createType/createType.cjs +3 -3
  34. package/dist/cjs/createType/createType.cjs.map +1 -1
  35. package/dist/cjs/fetchDistantDictionaries.cjs +6 -6
  36. package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
  37. package/dist/cjs/filterInvalidDictionaries.cjs +3 -3
  38. package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -1
  39. package/dist/cjs/formatDictionary.cjs +7 -7
  40. package/dist/cjs/formatDictionary.cjs.map +1 -1
  41. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs +2 -2
  42. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map +1 -1
  43. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +2 -2
  44. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs.map +1 -1
  45. package/dist/cjs/handleContentDeclarationFileChange.cjs +2 -2
  46. package/dist/cjs/handleContentDeclarationFileChange.cjs.map +1 -1
  47. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +2 -2
  48. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs.map +1 -1
  49. package/dist/cjs/listGitFiles.cjs +4 -4
  50. package/dist/cjs/listGitFiles.cjs.map +1 -1
  51. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +5 -5
  52. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs.map +1 -1
  53. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +4 -4
  54. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
  55. package/dist/cjs/loadDictionaries/loadDictionaries.cjs +11 -11
  56. package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
  57. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +6 -6
  58. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
  59. package/dist/cjs/loadDictionaries/log.cjs +17 -17
  60. package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
  61. package/dist/cjs/prepareIntlayer.cjs +14 -14
  62. package/dist/cjs/prepareIntlayer.cjs.map +1 -1
  63. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs +2 -2
  64. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs.map +1 -1
  65. package/dist/cjs/transformFiles/transformFiles.cjs +11 -11
  66. package/dist/cjs/transformFiles/transformFiles.cjs.map +1 -1
  67. package/dist/cjs/utils/formatter.cjs +7 -7
  68. package/dist/cjs/utils/formatter.cjs.map +1 -1
  69. package/dist/cjs/utils/runOnce.cjs +4 -4
  70. package/dist/cjs/utils/runOnce.cjs.map +1 -1
  71. package/dist/cjs/watcher.cjs +5 -5
  72. package/dist/cjs/watcher.cjs.map +1 -1
  73. package/dist/cjs/writeContentDeclaration/detectFormatCommand.cjs +2 -2
  74. package/dist/cjs/writeContentDeclaration/detectFormatCommand.cjs.map +1 -1
  75. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs +14 -14
  76. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs.map +1 -1
  77. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs +86 -86
  78. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs.map +1 -1
  79. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +5 -5
  80. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
  81. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +4 -4
  82. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
  83. package/dist/esm/transformFiles/transformFiles.mjs +2 -2
  84. package/dist/esm/transformFiles/transformFiles.mjs.map +1 -1
  85. package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts +2 -2
  86. package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts +3 -3
  87. package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts +3 -3
  88. package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts +2 -2
  89. package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts +2 -2
  90. package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts +2 -2
  91. package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts +2 -2
  92. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +2 -2
  93. package/dist/types/transformFiles/transformFiles.d.ts.map +1 -1
  94. package/dist/types/utils/getFormatFromExtension.d.ts.map +1 -1
  95. package/package.json +12 -12
@@ -1 +1 @@
1
- {"version":3,"file":"getBuiltFetchDictionariesPath.cjs","names":[],"sources":["../../../src/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.ts"],"sourcesContent":["import { existsSync, mkdirSync } from 'node:fs';\nimport { normalizePath } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport fg from 'fast-glob';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltFetchDictionariesPath = async (\n configuration: IntlayerConfig,\n format: 'cjs' | 'esm' = 'esm'\n) => {\n const { fetchDictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const extension = format === 'cjs' ? 'cjs' : 'mjs';\n\n const dictionariesPath: string[] = await fg(\n `${normalizePath(fetchDictionariesDir)}/**/*.${extension}`\n );\n\n return dictionariesPath;\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,gCAAgC,OAC3C,eACA,SAAwB,UACrB;CACH,MAAM,EAAE,sBAAsB,YAAY,cAAc;AAGxD,KAAI,yBAAY,QAAQ,CACtB,wBAAU,SAAS,EAAE,WAAW,MAAM,CAAC;CAGzC,MAAM,YAAY,WAAW,QAAQ,QAAQ;AAM7C,QAJmC,6BACjC,wCAAiB,qBAAqB,CAAC,QAAQ,YAChD"}
1
+ {"version":3,"file":"getBuiltFetchDictionariesPath.cjs","names":[],"sources":["../../../src/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.ts"],"sourcesContent":["import { existsSync, mkdirSync } from 'node:fs';\nimport { normalizePath } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport fg from 'fast-glob';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltFetchDictionariesPath = async (\n configuration: IntlayerConfig,\n format: 'cjs' | 'esm' = 'esm'\n) => {\n const { fetchDictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const extension = format === 'cjs' ? 'cjs' : 'mjs';\n\n const dictionariesPath: string[] = await fg(\n `${normalizePath(fetchDictionariesDir)}/**/*.${extension}`\n );\n\n return dictionariesPath;\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,gCAAgC,OAC3C,eACA,SAAwB,UACrB;CACH,MAAM,EAAE,sBAAsB,YAAY,cAAc;AAGxD,KAAI,yBAAY,QAAQ,CACtB,wBAAU,SAAS,EAAE,WAAW,MAAM,CAAC;CAGzC,MAAM,YAAY,WAAW,QAAQ,QAAQ;AAM7C,QAJmC,6BACjC,uCAAiB,qBAAqB,CAAC,QAAQ,YAChD"}
@@ -1,6 +1,6 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  let node_fs = require("node:fs");
3
- let __intlayer_config = require("@intlayer/config");
3
+ let _intlayer_config = require("@intlayer/config");
4
4
  let fast_glob = require("fast-glob");
5
5
  fast_glob = require_rolldown_runtime.__toESM(fast_glob);
6
6
 
@@ -11,7 +11,7 @@ fast_glob = require_rolldown_runtime.__toESM(fast_glob);
11
11
  const getBuiltRemoteDictionariesPath = async (configuration) => {
12
12
  const { remoteDictionariesDir, mainDir } = configuration.content;
13
13
  if (!(0, node_fs.existsSync)(mainDir)) (0, node_fs.mkdirSync)(mainDir, { recursive: true });
14
- return fast_glob.default.sync(`${(0, __intlayer_config.normalizePath)(remoteDictionariesDir)}/**/*.json`);
14
+ return fast_glob.default.sync(`${(0, _intlayer_config.normalizePath)(remoteDictionariesDir)}/**/*.json`);
15
15
  };
16
16
 
17
17
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"getBuiltRemoteDictionariesPath.cjs","names":["fg"],"sources":["../../../src/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.ts"],"sourcesContent":["import { existsSync, mkdirSync } from 'node:fs';\nimport { normalizePath } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport fg from 'fast-glob';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltRemoteDictionariesPath = async (\n configuration: IntlayerConfig\n) => {\n const { remoteDictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const dictionariesPath: string[] = fg.sync(\n `${normalizePath(remoteDictionariesDir)}/**/*.json`\n );\n\n return dictionariesPath;\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,iCAAiC,OAC5C,kBACG;CACH,MAAM,EAAE,uBAAuB,YAAY,cAAc;AAGzD,KAAI,yBAAY,QAAQ,CACtB,wBAAU,SAAS,EAAE,WAAW,MAAM,CAAC;AAOzC,QAJmCA,kBAAG,KACpC,wCAAiB,sBAAsB,CAAC,YACzC"}
1
+ {"version":3,"file":"getBuiltRemoteDictionariesPath.cjs","names":["fg"],"sources":["../../../src/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.ts"],"sourcesContent":["import { existsSync, mkdirSync } from 'node:fs';\nimport { normalizePath } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport fg from 'fast-glob';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltRemoteDictionariesPath = async (\n configuration: IntlayerConfig\n) => {\n const { remoteDictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const dictionariesPath: string[] = fg.sync(\n `${normalizePath(remoteDictionariesDir)}/**/*.json`\n );\n\n return dictionariesPath;\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,iCAAiC,OAC5C,kBACG;CACH,MAAM,EAAE,uBAAuB,YAAY,cAAc;AAGzD,KAAI,yBAAY,QAAQ,CACtB,wBAAU,SAAS,EAAE,WAAW,MAAM,CAAC;AAOzC,QAJmCA,kBAAG,KACpC,uCAAiB,sBAAsB,CAAC,YACzC"}
@@ -1,6 +1,6 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  let node_fs = require("node:fs");
3
- let __intlayer_config = require("@intlayer/config");
3
+ let _intlayer_config = require("@intlayer/config");
4
4
  let fast_glob = require("fast-glob");
5
5
  fast_glob = require_rolldown_runtime.__toESM(fast_glob);
6
6
 
@@ -11,7 +11,7 @@ fast_glob = require_rolldown_runtime.__toESM(fast_glob);
11
11
  const getBuiltUnmergedDictionariesPath = async (configuration) => {
12
12
  const { unmergedDictionariesDir, mainDir } = configuration.content;
13
13
  if (!(0, node_fs.existsSync)(mainDir)) (0, node_fs.mkdirSync)(mainDir, { recursive: true });
14
- return await (0, fast_glob.default)(`${(0, __intlayer_config.normalizePath)(unmergedDictionariesDir)}/**/*.json`);
14
+ return await (0, fast_glob.default)(`${(0, _intlayer_config.normalizePath)(unmergedDictionariesDir)}/**/*.json`);
15
15
  };
16
16
 
17
17
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"getBuiltUnmergedDictionariesPath.cjs","names":[],"sources":["../../../src/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.ts"],"sourcesContent":["import { existsSync, mkdirSync } from 'node:fs';\nimport { normalizePath } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport fg from 'fast-glob';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltUnmergedDictionariesPath = async (\n configuration: IntlayerConfig\n) => {\n const { unmergedDictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const dictionariesPath: string[] = await fg(\n `${normalizePath(unmergedDictionariesDir)}/**/*.json`\n );\n\n return dictionariesPath;\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,mCAAmC,OAC9C,kBACG;CACH,MAAM,EAAE,yBAAyB,YAAY,cAAc;AAG3D,KAAI,yBAAY,QAAQ,CACtB,wBAAU,SAAS,EAAE,WAAW,MAAM,CAAC;AAOzC,QAJmC,6BACjC,wCAAiB,wBAAwB,CAAC,YAC3C"}
1
+ {"version":3,"file":"getBuiltUnmergedDictionariesPath.cjs","names":[],"sources":["../../../src/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.ts"],"sourcesContent":["import { existsSync, mkdirSync } from 'node:fs';\nimport { normalizePath } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport fg from 'fast-glob';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltUnmergedDictionariesPath = async (\n configuration: IntlayerConfig\n) => {\n const { unmergedDictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const dictionariesPath: string[] = await fg(\n `${normalizePath(unmergedDictionariesDir)}/**/*.json`\n );\n\n return dictionariesPath;\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,mCAAmC,OAC9C,kBACG;CACH,MAAM,EAAE,yBAAyB,YAAY,cAAc;AAG3D,KAAI,yBAAY,QAAQ,CACtB,wBAAU,SAAS,EAAE,WAAW,MAAM,CAAC;AAOzC,QAJmC,6BACjC,uCAAiB,wBAAwB,CAAC,YAC3C"}
@@ -2,13 +2,13 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  const require_writeFileIfChanged = require('../writeFileIfChanged.cjs');
3
3
  const require_utils_getFileHash = require('../utils/getFileHash.cjs');
4
4
  let node_fs_promises = require("node:fs/promises");
5
- let __intlayer_config = require("@intlayer/config");
5
+ let _intlayer_config = require("@intlayer/config");
6
6
  let node_path = require("node:path");
7
7
  let fast_glob = require("fast-glob");
8
8
  fast_glob = require_rolldown_runtime.__toESM(fast_glob);
9
9
 
10
10
  //#region src/createType/createModuleAugmentation.ts
11
- const getTypeName = (key) => `${(0, __intlayer_config.kebabCaseToCamelCase)(key)}Content`;
11
+ const getTypeName = (key) => `${(0, _intlayer_config.kebabCaseToCamelCase)(key)}Content`;
12
12
  /** Returns lines like: [Locales.FRENCH]: 1; */
13
13
  const formatLocales = (locales) => locales.map((locale) => ` "${locale}": 1;`).join("\n");
14
14
  /** Generate the content of the module augmentation file */
@@ -46,7 +46,7 @@ const generateTypeIndexContent = (typeFiles, configuration) => {
46
46
  const createModuleAugmentation = async (configuration) => {
47
47
  const { moduleAugmentationDir, typesDir } = configuration.content;
48
48
  await (0, node_fs_promises.mkdir)(moduleAugmentationDir, { recursive: true });
49
- const tsContent = generateTypeIndexContent(await (0, fast_glob.default)((0, __intlayer_config.normalizePath)(`${typesDir}/*.ts`), { ignore: ["**/*.d.ts"] }), configuration);
49
+ const tsContent = generateTypeIndexContent(await (0, fast_glob.default)((0, _intlayer_config.normalizePath)(`${typesDir}/*.ts`), { ignore: ["**/*.d.ts"] }), configuration);
50
50
  await require_writeFileIfChanged.writeFileIfChanged((0, node_path.join)(moduleAugmentationDir, "intlayer.d.ts"), tsContent);
51
51
  };
52
52
 
@@ -1 +1 @@
1
- {"version":3,"file":"createModuleAugmentation.cjs","names":["getFileHash","formattedDictionaryMap: string","requiredLocales","writeFileIfChanged"],"sources":["../../../src/createType/createModuleAugmentation.ts"],"sourcesContent":["import { mkdir } from 'node:fs/promises';\nimport { basename, extname, join, relative } from 'node:path';\nimport { kebabCaseToCamelCase, normalizePath } from '@intlayer/config';\nimport type { IntlayerConfig, Locale } from '@intlayer/types';\nimport fg from 'fast-glob';\nimport { getFileHash } from '../utils/getFileHash';\nimport { writeFileIfChanged } from '../writeFileIfChanged';\n\nexport const getTypeName = (key: string): string =>\n `${kebabCaseToCamelCase(key)}Content`;\n\n/** Returns lines like: [Locales.FRENCH]: 1; */\nconst formatLocales = (locales: Locale[]) =>\n locales.map((locale) => ` \"${locale}\": 1;`).join('\\n');\n\n/** Generate the content of the module augmentation file */\nconst generateTypeIndexContent = (\n typeFiles: string[],\n configuration: IntlayerConfig\n): string => {\n const { content, internationalization } = configuration;\n const { moduleAugmentationDir } = content;\n const { locales, requiredLocales, strictMode } = internationalization;\n\n let fileContent = 'import \"intlayer\";\\n';\n\n // Build dictionary refs\n const dictionariesRef = typeFiles.map((dictionaryPath) => ({\n relativePath: `./${relative(moduleAugmentationDir, dictionaryPath)}`,\n id: basename(dictionaryPath, extname(dictionaryPath)),\n hash: `_${getFileHash(dictionaryPath)}`,\n }));\n\n // Import all dictionaries\n for (const dictionary of dictionariesRef) {\n fileContent += `import ${dictionary.hash} from '${dictionary.relativePath}';\\n`;\n }\n fileContent += '\\n';\n\n // Dictionary map entries (id: typeof <hash>)\n const formattedDictionaryMap: string = dictionariesRef\n .map((dictionary) => ` \"${dictionary.id}\": typeof ${dictionary.hash};`)\n .join('\\n');\n\n // Ensure required ⊆ declared; if empty, default required = declared\n const declared = locales;\n const requiredSanitized = requiredLocales?.length\n ? requiredLocales.filter((requiredLocales) =>\n declared.includes(requiredLocales)\n )\n : declared;\n\n const formattedDeclaredLocales = formatLocales(declared);\n const formattedRequiredLocales = formatLocales(requiredSanitized);\n\n // Choose strict mode registry key\n const strictKey =\n strictMode === 'strict'\n ? 'strict'\n : strictMode === 'inclusive'\n ? 'inclusive'\n : 'loose';\n\n /**\n * Module augmentation that ONLY adds keys to registries.\n * No types/aliases redefined here—avoids merge conflicts.\n */\n fileContent += `declare module 'intlayer' {\\n`;\n // Dictionaries registry\n fileContent += ` interface __DictionaryRegistry {\\n${formattedDictionaryMap}\\n }\\n\\n`;\n // Locales registries\n fileContent += ` interface __DeclaredLocalesRegistry {\\n${formattedDeclaredLocales}\\n }\\n\\n`;\n fileContent += ` interface __RequiredLocalesRegistry {\\n${formattedRequiredLocales}\\n }\\n\\n`;\n // Resolved strict mode (narrow the literal at build time)\n fileContent += ` interface __StrictModeRegistry { mode: '${strictKey}' }\\n`;\n fileContent += `}\\n`;\n\n return fileContent;\n};\n\n/** Generate the index file merging all the types */\nexport const createModuleAugmentation = async (\n configuration: IntlayerConfig\n) => {\n const { moduleAugmentationDir, typesDir } = configuration.content;\n\n await mkdir(moduleAugmentationDir, { recursive: true });\n\n const dictionariesTypesDefinitions: string[] = await fg(\n normalizePath(`${typesDir}/*.ts`),\n { ignore: ['**/*.d.ts'] }\n );\n\n const tsContent = generateTypeIndexContent(\n dictionariesTypesDefinitions,\n configuration\n );\n\n const tsFilePath = join(moduleAugmentationDir, 'intlayer.d.ts');\n await writeFileIfChanged(tsFilePath, tsContent);\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,eAAe,QAC1B,+CAAwB,IAAI,CAAC;;AAG/B,MAAM,iBAAiB,YACrB,QAAQ,KAAK,WAAW,QAAQ,OAAO,OAAO,CAAC,KAAK,KAAK;;AAG3D,MAAM,4BACJ,WACA,kBACW;CACX,MAAM,EAAE,SAAS,yBAAyB;CAC1C,MAAM,EAAE,0BAA0B;CAClC,MAAM,EAAE,SAAS,iBAAiB,eAAe;CAEjD,IAAI,cAAc;CAGlB,MAAM,kBAAkB,UAAU,KAAK,oBAAoB;EACzD,cAAc,6BAAc,uBAAuB,eAAe;EAClE,4BAAa,uCAAwB,eAAe,CAAC;EACrD,MAAM,IAAIA,sCAAY,eAAe;EACtC,EAAE;AAGH,MAAK,MAAM,cAAc,gBACvB,gBAAe,UAAU,WAAW,KAAK,SAAS,WAAW,aAAa;AAE5E,gBAAe;CAGf,MAAMC,yBAAiC,gBACpC,KAAK,eAAe,QAAQ,WAAW,GAAG,YAAY,WAAW,KAAK,GAAG,CACzE,KAAK,KAAK;CAGb,MAAM,WAAW;CACjB,MAAM,oBAAoB,iBAAiB,SACvC,gBAAgB,QAAQ,sBACtB,SAAS,SAASC,kBAAgB,CACnC,GACD;CAEJ,MAAM,2BAA2B,cAAc,SAAS;CACxD,MAAM,2BAA2B,cAAc,kBAAkB;CAGjE,MAAM,YACJ,eAAe,WACX,WACA,eAAe,cACb,cACA;;;;;AAMR,gBAAe;AAEf,gBAAe,uCAAuC,uBAAuB;AAE7E,gBAAe,4CAA4C,yBAAyB;AACpF,gBAAe,4CAA4C,yBAAyB;AAEpF,gBAAe,6CAA6C,UAAU;AACtE,gBAAe;AAEf,QAAO;;;AAIT,MAAa,2BAA2B,OACtC,kBACG;CACH,MAAM,EAAE,uBAAuB,aAAa,cAAc;AAE1D,mCAAY,uBAAuB,EAAE,WAAW,MAAM,CAAC;CAOvD,MAAM,YAAY,yBAL6B,kEAC/B,GAAG,SAAS,OAAO,EACjC,EAAE,QAAQ,CAAC,YAAY,EAAE,CAC1B,EAIC,cACD;AAGD,OAAMC,kEADkB,uBAAuB,gBAAgB,EAC1B,UAAU"}
1
+ {"version":3,"file":"createModuleAugmentation.cjs","names":["getFileHash","formattedDictionaryMap: string","requiredLocales","writeFileIfChanged"],"sources":["../../../src/createType/createModuleAugmentation.ts"],"sourcesContent":["import { mkdir } from 'node:fs/promises';\nimport { basename, extname, join, relative } from 'node:path';\nimport { kebabCaseToCamelCase, normalizePath } from '@intlayer/config';\nimport type { IntlayerConfig, Locale } from '@intlayer/types';\nimport fg from 'fast-glob';\nimport { getFileHash } from '../utils/getFileHash';\nimport { writeFileIfChanged } from '../writeFileIfChanged';\n\nexport const getTypeName = (key: string): string =>\n `${kebabCaseToCamelCase(key)}Content`;\n\n/** Returns lines like: [Locales.FRENCH]: 1; */\nconst formatLocales = (locales: Locale[]) =>\n locales.map((locale) => ` \"${locale}\": 1;`).join('\\n');\n\n/** Generate the content of the module augmentation file */\nconst generateTypeIndexContent = (\n typeFiles: string[],\n configuration: IntlayerConfig\n): string => {\n const { content, internationalization } = configuration;\n const { moduleAugmentationDir } = content;\n const { locales, requiredLocales, strictMode } = internationalization;\n\n let fileContent = 'import \"intlayer\";\\n';\n\n // Build dictionary refs\n const dictionariesRef = typeFiles.map((dictionaryPath) => ({\n relativePath: `./${relative(moduleAugmentationDir, dictionaryPath)}`,\n id: basename(dictionaryPath, extname(dictionaryPath)),\n hash: `_${getFileHash(dictionaryPath)}`,\n }));\n\n // Import all dictionaries\n for (const dictionary of dictionariesRef) {\n fileContent += `import ${dictionary.hash} from '${dictionary.relativePath}';\\n`;\n }\n fileContent += '\\n';\n\n // Dictionary map entries (id: typeof <hash>)\n const formattedDictionaryMap: string = dictionariesRef\n .map((dictionary) => ` \"${dictionary.id}\": typeof ${dictionary.hash};`)\n .join('\\n');\n\n // Ensure required ⊆ declared; if empty, default required = declared\n const declared = locales;\n const requiredSanitized = requiredLocales?.length\n ? requiredLocales.filter((requiredLocales) =>\n declared.includes(requiredLocales)\n )\n : declared;\n\n const formattedDeclaredLocales = formatLocales(declared);\n const formattedRequiredLocales = formatLocales(requiredSanitized);\n\n // Choose strict mode registry key\n const strictKey =\n strictMode === 'strict'\n ? 'strict'\n : strictMode === 'inclusive'\n ? 'inclusive'\n : 'loose';\n\n /**\n * Module augmentation that ONLY adds keys to registries.\n * No types/aliases redefined here—avoids merge conflicts.\n */\n fileContent += `declare module 'intlayer' {\\n`;\n // Dictionaries registry\n fileContent += ` interface __DictionaryRegistry {\\n${formattedDictionaryMap}\\n }\\n\\n`;\n // Locales registries\n fileContent += ` interface __DeclaredLocalesRegistry {\\n${formattedDeclaredLocales}\\n }\\n\\n`;\n fileContent += ` interface __RequiredLocalesRegistry {\\n${formattedRequiredLocales}\\n }\\n\\n`;\n // Resolved strict mode (narrow the literal at build time)\n fileContent += ` interface __StrictModeRegistry { mode: '${strictKey}' }\\n`;\n fileContent += `}\\n`;\n\n return fileContent;\n};\n\n/** Generate the index file merging all the types */\nexport const createModuleAugmentation = async (\n configuration: IntlayerConfig\n) => {\n const { moduleAugmentationDir, typesDir } = configuration.content;\n\n await mkdir(moduleAugmentationDir, { recursive: true });\n\n const dictionariesTypesDefinitions: string[] = await fg(\n normalizePath(`${typesDir}/*.ts`),\n { ignore: ['**/*.d.ts'] }\n );\n\n const tsContent = generateTypeIndexContent(\n dictionariesTypesDefinitions,\n configuration\n );\n\n const tsFilePath = join(moduleAugmentationDir, 'intlayer.d.ts');\n await writeFileIfChanged(tsFilePath, tsContent);\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,eAAe,QAC1B,8CAAwB,IAAI,CAAC;;AAG/B,MAAM,iBAAiB,YACrB,QAAQ,KAAK,WAAW,QAAQ,OAAO,OAAO,CAAC,KAAK,KAAK;;AAG3D,MAAM,4BACJ,WACA,kBACW;CACX,MAAM,EAAE,SAAS,yBAAyB;CAC1C,MAAM,EAAE,0BAA0B;CAClC,MAAM,EAAE,SAAS,iBAAiB,eAAe;CAEjD,IAAI,cAAc;CAGlB,MAAM,kBAAkB,UAAU,KAAK,oBAAoB;EACzD,cAAc,6BAAc,uBAAuB,eAAe;EAClE,4BAAa,uCAAwB,eAAe,CAAC;EACrD,MAAM,IAAIA,sCAAY,eAAe;EACtC,EAAE;AAGH,MAAK,MAAM,cAAc,gBACvB,gBAAe,UAAU,WAAW,KAAK,SAAS,WAAW,aAAa;AAE5E,gBAAe;CAGf,MAAMC,yBAAiC,gBACpC,KAAK,eAAe,QAAQ,WAAW,GAAG,YAAY,WAAW,KAAK,GAAG,CACzE,KAAK,KAAK;CAGb,MAAM,WAAW;CACjB,MAAM,oBAAoB,iBAAiB,SACvC,gBAAgB,QAAQ,sBACtB,SAAS,SAASC,kBAAgB,CACnC,GACD;CAEJ,MAAM,2BAA2B,cAAc,SAAS;CACxD,MAAM,2BAA2B,cAAc,kBAAkB;CAGjE,MAAM,YACJ,eAAe,WACX,WACA,eAAe,cACb,cACA;;;;;AAMR,gBAAe;AAEf,gBAAe,uCAAuC,uBAAuB;AAE7E,gBAAe,4CAA4C,yBAAyB;AACpF,gBAAe,4CAA4C,yBAAyB;AAEpF,gBAAe,6CAA6C,UAAU;AACtE,gBAAe;AAEf,QAAO;;;AAIT,MAAa,2BAA2B,OACtC,kBACG;CACH,MAAM,EAAE,uBAAuB,aAAa,cAAc;AAE1D,mCAAY,uBAAuB,EAAE,WAAW,MAAM,CAAC;CAOvD,MAAM,YAAY,yBAL6B,iEAC/B,GAAG,SAAS,OAAO,EACjC,EAAE,QAAQ,CAAC,YAAY,EAAE,CAC1B,EAIC,cACD;AAGD,OAAMC,kEADkB,uBAAuB,gBAAgB,EAC1B,UAAU"}
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  const require_utils_parallelize = require('../utils/parallelize.cjs');
3
3
  let node_fs_promises = require("node:fs/promises");
4
- let __intlayer_config = require("@intlayer/config");
4
+ let _intlayer_config = require("@intlayer/config");
5
5
  let node_path = require("node:path");
6
6
 
7
7
  //#region src/createType/createType.ts
@@ -16,8 +16,8 @@ const createTypes = async (dictionariesPaths, configuration) => {
16
16
  const { typesDir } = content;
17
17
  await (0, node_fs_promises.mkdir)(typesDir, { recursive: true });
18
18
  return (await require_utils_parallelize.parallelize(dictionariesPaths, async (dictionaryPath) => {
19
- const requireFunction = build.require ?? (0, __intlayer_config.getProjectRequire)();
20
- (0, __intlayer_config.clearModuleCache)(dictionaryPath);
19
+ const requireFunction = build.require ?? (0, _intlayer_config.getProjectRequire)();
20
+ (0, _intlayer_config.clearModuleCache)(dictionaryPath);
21
21
  const dictionary = requireFunction(dictionaryPath);
22
22
  if (!dictionary.key) return;
23
23
  const typeDefinition = generateTypeScriptType(dictionary);
@@ -1 +1 @@
1
- {"version":3,"file":"createType.cjs","names":["parallelize","dictionary: Dictionary","typeDefinition: string","outputPath: string"],"sources":["../../../src/createType/createType.ts"],"sourcesContent":["import { mkdir, writeFile } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport { clearModuleCache, getProjectRequire } from '@intlayer/config';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { parallelize } from '../utils/parallelize';\n\nexport const generateTypeScriptType = (dictionary: Dictionary) => {\n const jsonString = JSON.stringify(dictionary, null, 2);\n\n return `/* eslint-disable */\\nexport default ${jsonString} as const;\\n`;\n};\n/**\n * This function generates a TypeScript type definition from a JSON object\n */\nexport const createTypes = async (\n dictionariesPaths: string[],\n configuration: IntlayerConfig\n): Promise<string[]> => {\n const { build, content } = configuration;\n const { typesDir } = content;\n\n // Create type folders if they don't exist\n await mkdir(typesDir, { recursive: true });\n\n const results = await parallelize(\n dictionariesPaths,\n async (dictionaryPath): Promise<string | undefined> => {\n const requireFunction = build.require ?? getProjectRequire();\n clearModuleCache(dictionaryPath);\n\n const dictionary: Dictionary = requireFunction(dictionaryPath);\n\n if (!dictionary.key) {\n return undefined;\n }\n\n const typeDefinition: string = generateTypeScriptType(dictionary);\n\n const outputPath: string = resolve(typesDir, `${dictionary.key}.ts`);\n\n await writeFile(outputPath, typeDefinition);\n\n return outputPath;\n }\n );\n\n return results.filter(Boolean) as string[];\n};\n"],"mappings":";;;;;;;AAMA,MAAa,0BAA0B,eAA2B;AAGhE,QAAO,wCAFY,KAAK,UAAU,YAAY,MAAM,EAAE,CAEI;;;;;AAK5D,MAAa,cAAc,OACzB,mBACA,kBACsB;CACtB,MAAM,EAAE,OAAO,YAAY;CAC3B,MAAM,EAAE,aAAa;AAGrB,mCAAY,UAAU,EAAE,WAAW,MAAM,CAAC;AAwB1C,SAtBgB,MAAMA,sCACpB,mBACA,OAAO,mBAAgD;EACrD,MAAM,kBAAkB,MAAM,qDAA8B;AAC5D,0CAAiB,eAAe;EAEhC,MAAMC,aAAyB,gBAAgB,eAAe;AAE9D,MAAI,CAAC,WAAW,IACd;EAGF,MAAMC,iBAAyB,uBAAuB,WAAW;EAEjE,MAAMC,oCAA6B,UAAU,GAAG,WAAW,IAAI,KAAK;AAEpE,wCAAgB,YAAY,eAAe;AAE3C,SAAO;GAEV,EAEc,OAAO,QAAQ"}
1
+ {"version":3,"file":"createType.cjs","names":["parallelize","dictionary: Dictionary","typeDefinition: string","outputPath: string"],"sources":["../../../src/createType/createType.ts"],"sourcesContent":["import { mkdir, writeFile } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport { clearModuleCache, getProjectRequire } from '@intlayer/config';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { parallelize } from '../utils/parallelize';\n\nexport const generateTypeScriptType = (dictionary: Dictionary) => {\n const jsonString = JSON.stringify(dictionary, null, 2);\n\n return `/* eslint-disable */\\nexport default ${jsonString} as const;\\n`;\n};\n/**\n * This function generates a TypeScript type definition from a JSON object\n */\nexport const createTypes = async (\n dictionariesPaths: string[],\n configuration: IntlayerConfig\n): Promise<string[]> => {\n const { build, content } = configuration;\n const { typesDir } = content;\n\n // Create type folders if they don't exist\n await mkdir(typesDir, { recursive: true });\n\n const results = await parallelize(\n dictionariesPaths,\n async (dictionaryPath): Promise<string | undefined> => {\n const requireFunction = build.require ?? getProjectRequire();\n clearModuleCache(dictionaryPath);\n\n const dictionary: Dictionary = requireFunction(dictionaryPath);\n\n if (!dictionary.key) {\n return undefined;\n }\n\n const typeDefinition: string = generateTypeScriptType(dictionary);\n\n const outputPath: string = resolve(typesDir, `${dictionary.key}.ts`);\n\n await writeFile(outputPath, typeDefinition);\n\n return outputPath;\n }\n );\n\n return results.filter(Boolean) as string[];\n};\n"],"mappings":";;;;;;;AAMA,MAAa,0BAA0B,eAA2B;AAGhE,QAAO,wCAFY,KAAK,UAAU,YAAY,MAAM,EAAE,CAEI;;;;;AAK5D,MAAa,cAAc,OACzB,mBACA,kBACsB;CACtB,MAAM,EAAE,OAAO,YAAY;CAC3B,MAAM,EAAE,aAAa;AAGrB,mCAAY,UAAU,EAAE,WAAW,MAAM,CAAC;AAwB1C,SAtBgB,MAAMA,sCACpB,mBACA,OAAO,mBAAgD;EACrD,MAAM,kBAAkB,MAAM,oDAA8B;AAC5D,yCAAiB,eAAe;EAEhC,MAAMC,aAAyB,gBAAgB,eAAe;AAE9D,MAAI,CAAC,WAAW,IACd;EAGF,MAAMC,iBAAyB,uBAAuB,WAAW;EAEjE,MAAMC,oCAA6B,UAAU,GAAG,WAAW,IAAI,KAAK;AAEpE,wCAAgB,YAAY,eAAe;AAE3C,SAAO;GAEV,EAEc,OAAO,QAAQ"}
@@ -1,17 +1,17 @@
1
1
  const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
2
  const require_utils_parallelize = require('./utils/parallelize.cjs');
3
- let __intlayer_api = require("@intlayer/api");
4
- let __intlayer_config = require("@intlayer/config");
3
+ let _intlayer_api = require("@intlayer/api");
4
+ let _intlayer_config = require("@intlayer/config");
5
5
 
6
6
  //#region src/fetchDistantDictionaries.ts
7
7
  /**
8
8
  * Fetch distant dictionaries and update the logger with their statuses.
9
9
  */
10
10
  const fetchDistantDictionaries = async (options, onStatusUpdate) => {
11
- const config = (0, __intlayer_config.getConfiguration)();
12
- const appLogger = (0, __intlayer_config.getAppLogger)(config);
11
+ const config = (0, _intlayer_config.getConfiguration)();
12
+ const appLogger = (0, _intlayer_config.getAppLogger)(config);
13
13
  try {
14
- const intlayerAPI = (0, __intlayer_api.getIntlayerAPIProxy)(void 0, config);
14
+ const intlayerAPI = (0, _intlayer_api.getIntlayerAPIProxy)(void 0, config);
15
15
  const distantDictionariesKeys = options.dictionaryKeys;
16
16
  const processDictionary = async (dictionaryKey) => {
17
17
  onStatusUpdate?.([{
@@ -40,7 +40,7 @@ const fetchDistantDictionaries = async (options, onStatusUpdate) => {
40
40
  };
41
41
  return (await require_utils_parallelize.parallelize(distantDictionariesKeys, async (dictionaryKey) => await processDictionary(dictionaryKey))).filter((dict) => dict !== void 0);
42
42
  } catch (_error) {
43
- appLogger(`${__intlayer_config.x} Failed to fetch distant dictionaries`, { level: "error" });
43
+ appLogger(`${_intlayer_config.x} Failed to fetch distant dictionaries`, { level: "error" });
44
44
  return [];
45
45
  }
46
46
  };
@@ -1 +1 @@
1
- {"version":3,"file":"fetchDistantDictionaries.cjs","names":["parallelize","x"],"sources":["../../src/fetchDistantDictionaries.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\n// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getAppLogger, getConfiguration, x } from '@intlayer/config';\nimport type { DictionariesStatus } from './loadDictionaries';\nimport { parallelize } from './utils/parallelize';\n\ntype FetchDistantDictionariesOptions = {\n dictionaryKeys: string[];\n newDictionariesPath?: string;\n logPrefix?: string;\n};\n\n/**\n * Fetch distant dictionaries and update the logger with their statuses.\n */\nexport const fetchDistantDictionaries = async (\n options: FetchDistantDictionariesOptions,\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<DictionaryAPI[]> => {\n const config = getConfiguration();\n const appLogger = getAppLogger(config);\n try {\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n const distantDictionariesKeys = options.dictionaryKeys;\n // Process dictionaries in parallel with a concurrency limit\n const processDictionary = async (\n dictionaryKey: string\n ): Promise<DictionaryAPI | undefined> => {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'fetching',\n },\n ]);\n\n try {\n // Fetch the dictionary\n const getDictionaryResult =\n await intlayerAPI.dictionary.getDictionary(dictionaryKey);\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n onStatusUpdate?.([\n { dictionaryKey, type: 'remote', status: 'fetched' },\n ]);\n\n return distantDictionary;\n } catch (error) {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'error',\n error: `Error fetching dictionary ${dictionaryKey}: ${error}`,\n },\n ]);\n return undefined;\n }\n };\n\n const result = await parallelize(\n distantDictionariesKeys,\n async (dictionaryKey) => await processDictionary(dictionaryKey)\n );\n\n // Remove undefined values\n const filteredResult = result.filter(\n (dict: DictionaryAPI | undefined): dict is DictionaryAPI =>\n dict !== undefined\n );\n\n return filteredResult;\n } catch (_error) {\n appLogger(`${x} Failed to fetch distant dictionaries`, { level: 'error' });\n return [];\n }\n};\n"],"mappings":";;;;;;;;;AAgBA,MAAa,2BAA2B,OACtC,SACA,mBAC6B;CAC7B,MAAM,kDAA2B;CACjC,MAAM,gDAAyB,OAAO;AACtC,KAAI;EACF,MAAM,sDAAkC,QAAW,OAAO;EAE1D,MAAM,0BAA0B,QAAQ;EAExC,MAAM,oBAAoB,OACxB,kBACuC;AACvC,oBAAiB,CACf;IACE;IACA,MAAM;IACN,QAAQ;IACT,CACF,CAAC;AAEF,OAAI;IAKF,MAAM,qBAFJ,MAAM,YAAY,WAAW,cAAc,cAAc,EAEb;AAE9C,QAAI,CAAC,kBACH,OAAM,IAAI,MAAM,cAAc,cAAc,sBAAsB;AAGpE,qBAAiB,CACf;KAAE;KAAe,MAAM;KAAU,QAAQ;KAAW,CACrD,CAAC;AAEF,WAAO;YACA,OAAO;AACd,qBAAiB,CACf;KACE;KACA,MAAM;KACN,QAAQ;KACR,OAAO,6BAA6B,cAAc,IAAI;KACvD,CACF,CAAC;AACF;;;AAeJ,UAXe,MAAMA,sCACnB,yBACA,OAAO,kBAAkB,MAAM,kBAAkB,cAAc,CAChE,EAG6B,QAC3B,SACC,SAAS,OACZ;UAGM,QAAQ;AACf,YAAU,GAAGC,oBAAE,wCAAwC,EAAE,OAAO,SAAS,CAAC;AAC1E,SAAO,EAAE"}
1
+ {"version":3,"file":"fetchDistantDictionaries.cjs","names":["parallelize","x"],"sources":["../../src/fetchDistantDictionaries.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\n// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getAppLogger, getConfiguration, x } from '@intlayer/config';\nimport type { DictionariesStatus } from './loadDictionaries';\nimport { parallelize } from './utils/parallelize';\n\ntype FetchDistantDictionariesOptions = {\n dictionaryKeys: string[];\n newDictionariesPath?: string;\n logPrefix?: string;\n};\n\n/**\n * Fetch distant dictionaries and update the logger with their statuses.\n */\nexport const fetchDistantDictionaries = async (\n options: FetchDistantDictionariesOptions,\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<DictionaryAPI[]> => {\n const config = getConfiguration();\n const appLogger = getAppLogger(config);\n try {\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n const distantDictionariesKeys = options.dictionaryKeys;\n // Process dictionaries in parallel with a concurrency limit\n const processDictionary = async (\n dictionaryKey: string\n ): Promise<DictionaryAPI | undefined> => {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'fetching',\n },\n ]);\n\n try {\n // Fetch the dictionary\n const getDictionaryResult =\n await intlayerAPI.dictionary.getDictionary(dictionaryKey);\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n onStatusUpdate?.([\n { dictionaryKey, type: 'remote', status: 'fetched' },\n ]);\n\n return distantDictionary;\n } catch (error) {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'error',\n error: `Error fetching dictionary ${dictionaryKey}: ${error}`,\n },\n ]);\n return undefined;\n }\n };\n\n const result = await parallelize(\n distantDictionariesKeys,\n async (dictionaryKey) => await processDictionary(dictionaryKey)\n );\n\n // Remove undefined values\n const filteredResult = result.filter(\n (dict: DictionaryAPI | undefined): dict is DictionaryAPI =>\n dict !== undefined\n );\n\n return filteredResult;\n } catch (_error) {\n appLogger(`${x} Failed to fetch distant dictionaries`, { level: 'error' });\n return [];\n }\n};\n"],"mappings":";;;;;;;;;AAgBA,MAAa,2BAA2B,OACtC,SACA,mBAC6B;CAC7B,MAAM,iDAA2B;CACjC,MAAM,+CAAyB,OAAO;AACtC,KAAI;EACF,MAAM,qDAAkC,QAAW,OAAO;EAE1D,MAAM,0BAA0B,QAAQ;EAExC,MAAM,oBAAoB,OACxB,kBACuC;AACvC,oBAAiB,CACf;IACE;IACA,MAAM;IACN,QAAQ;IACT,CACF,CAAC;AAEF,OAAI;IAKF,MAAM,qBAFJ,MAAM,YAAY,WAAW,cAAc,cAAc,EAEb;AAE9C,QAAI,CAAC,kBACH,OAAM,IAAI,MAAM,cAAc,cAAc,sBAAsB;AAGpE,qBAAiB,CACf;KAAE;KAAe,MAAM;KAAU,QAAQ;KAAW,CACrD,CAAC;AAEF,WAAO;YACA,OAAO;AACd,qBAAiB,CACf;KACE;KACA,MAAM;KACN,QAAQ;KACR,OAAO,6BAA6B,cAAc,IAAI;KACvD,CACF,CAAC;AACF;;;AAeJ,UAXe,MAAMA,sCACnB,yBACA,OAAO,kBAAkB,MAAM,kBAAkB,cAAc,CAChE,EAG6B,QAC3B,SACC,SAAS,OACZ;UAGM,QAAQ;AACf,YAAU,GAAGC,mBAAE,wCAAwC,EAAE,OAAO,SAAS,CAAC;AAC1E,SAAO,EAAE"}
@@ -1,10 +1,10 @@
1
1
  const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
2
  const require_utils_formatter = require('./utils/formatter.cjs');
3
- let __intlayer_config_client = require("@intlayer/config/client");
3
+ let _intlayer_config_client = require("@intlayer/config/client");
4
4
 
5
5
  //#region src/filterInvalidDictionaries.ts
6
6
  const isInvalidDictionary = (dictionary, configuration) => {
7
- const appLogger = (0, __intlayer_config_client.getAppLogger)(configuration);
7
+ const appLogger = (0, _intlayer_config_client.getAppLogger)(configuration);
8
8
  if (!dictionary) return false;
9
9
  const location = Boolean(dictionary.location === "local") ? "Local" : "Remote";
10
10
  const hasKey = Boolean(dictionary.key);
@@ -15,7 +15,7 @@ const isInvalidDictionary = (dictionary, configuration) => {
15
15
  return false;
16
16
  }
17
17
  if (!hasContent) {
18
- appLogger(`${location} dictionary ${(0, __intlayer_config_client.colorizeKey)(dictionary.key)} has no content - ${dictionary.filePath ? require_utils_formatter.formatPath(dictionary.filePath) : (0, __intlayer_config_client.colorizePath)("Remote")}`, { level: "error" });
18
+ appLogger(`${location} dictionary ${(0, _intlayer_config_client.colorizeKey)(dictionary.key)} has no content - ${dictionary.filePath ? require_utils_formatter.formatPath(dictionary.filePath) : (0, _intlayer_config_client.colorizePath)("Remote")}`, { level: "error" });
19
19
  return false;
20
20
  }
21
21
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"filterInvalidDictionaries.cjs","names":["formatPath"],"sources":["../../src/filterInvalidDictionaries.ts"],"sourcesContent":["import {\n colorizeKey,\n colorizePath,\n getAppLogger,\n} from '@intlayer/config/client';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { formatPath } from './utils/formatter';\n\nexport const isInvalidDictionary = (\n dictionary: Dictionary | undefined,\n configuration?: IntlayerConfig\n): boolean => {\n const appLogger = getAppLogger(configuration);\n\n if (!dictionary) return false;\n\n const isLocal = Boolean(dictionary.location === 'local');\n const location = isLocal ? 'Local' : 'Remote';\n const hasKey = Boolean(dictionary.key);\n const hasContent = Boolean(dictionary.content);\n\n if (!hasKey) {\n appLogger(`${location} dictionary has no key`, {\n level: 'error',\n });\n appLogger(JSON.stringify(dictionary, null, 2), {\n level: 'error',\n });\n return false;\n }\n\n if (!hasContent) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has no content - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n return false;\n }\n\n return true;\n};\n\nexport const filterInvalidDictionaries = (\n dictionaries: (Dictionary | undefined)[] | undefined,\n configuration: IntlayerConfig\n): Dictionary[] =>\n (dictionaries ?? [])?.filter((dictionary) =>\n isInvalidDictionary(dictionary, configuration)\n ) as Dictionary[];\n"],"mappings":";;;;;AAQA,MAAa,uBACX,YACA,kBACY;CACZ,MAAM,uDAAyB,cAAc;AAE7C,KAAI,CAAC,WAAY,QAAO;CAGxB,MAAM,WADU,QAAQ,WAAW,aAAa,QAAQ,GAC7B,UAAU;CACrC,MAAM,SAAS,QAAQ,WAAW,IAAI;CACtC,MAAM,aAAa,QAAQ,WAAW,QAAQ;AAE9C,KAAI,CAAC,QAAQ;AACX,YAAU,GAAG,SAAS,yBAAyB,EAC7C,OAAO,SACR,CAAC;AACF,YAAU,KAAK,UAAU,YAAY,MAAM,EAAE,EAAE,EAC7C,OAAO,SACR,CAAC;AACF,SAAO;;AAGT,KAAI,CAAC,YAAY;AACf,YACE,GAAG,SAAS,wDAA0B,WAAW,IAAI,CAAC,oBAAoB,WAAW,WAAWA,mCAAW,WAAW,SAAS,8CAAgB,SAAS,IACxJ,EACE,OAAO,SACR,CACF;AACD,SAAO;;AAGT,QAAO;;AAGT,MAAa,6BACX,cACA,mBAEC,gBAAgB,EAAE,GAAG,QAAQ,eAC5B,oBAAoB,YAAY,cAAc,CAC/C"}
1
+ {"version":3,"file":"filterInvalidDictionaries.cjs","names":["formatPath"],"sources":["../../src/filterInvalidDictionaries.ts"],"sourcesContent":["import {\n colorizeKey,\n colorizePath,\n getAppLogger,\n} from '@intlayer/config/client';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { formatPath } from './utils/formatter';\n\nexport const isInvalidDictionary = (\n dictionary: Dictionary | undefined,\n configuration?: IntlayerConfig\n): boolean => {\n const appLogger = getAppLogger(configuration);\n\n if (!dictionary) return false;\n\n const isLocal = Boolean(dictionary.location === 'local');\n const location = isLocal ? 'Local' : 'Remote';\n const hasKey = Boolean(dictionary.key);\n const hasContent = Boolean(dictionary.content);\n\n if (!hasKey) {\n appLogger(`${location} dictionary has no key`, {\n level: 'error',\n });\n appLogger(JSON.stringify(dictionary, null, 2), {\n level: 'error',\n });\n return false;\n }\n\n if (!hasContent) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has no content - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n return false;\n }\n\n return true;\n};\n\nexport const filterInvalidDictionaries = (\n dictionaries: (Dictionary | undefined)[] | undefined,\n configuration: IntlayerConfig\n): Dictionary[] =>\n (dictionaries ?? [])?.filter((dictionary) =>\n isInvalidDictionary(dictionary, configuration)\n ) as Dictionary[];\n"],"mappings":";;;;;AAQA,MAAa,uBACX,YACA,kBACY;CACZ,MAAM,sDAAyB,cAAc;AAE7C,KAAI,CAAC,WAAY,QAAO;CAGxB,MAAM,WADU,QAAQ,WAAW,aAAa,QAAQ,GAC7B,UAAU;CACrC,MAAM,SAAS,QAAQ,WAAW,IAAI;CACtC,MAAM,aAAa,QAAQ,WAAW,QAAQ;AAE9C,KAAI,CAAC,QAAQ;AACX,YAAU,GAAG,SAAS,yBAAyB,EAC7C,OAAO,SACR,CAAC;AACF,YAAU,KAAK,UAAU,YAAY,MAAM,EAAE,EAAE,EAC7C,OAAO,SACR,CAAC;AACF,SAAO;;AAGT,KAAI,CAAC,YAAY;AACf,YACE,GAAG,SAAS,uDAA0B,WAAW,IAAI,CAAC,oBAAoB,WAAW,WAAWA,mCAAW,WAAW,SAAS,6CAAgB,SAAS,IACxJ,EACE,OAAO,SACR,CACF;AACD,SAAO;;AAGT,QAAO;;AAGT,MAAa,6BACX,cACA,mBAEC,gBAAgB,EAAE,GAAG,QAAQ,eAC5B,oBAAoB,YAAY,cAAc,CAC/C"}
@@ -1,22 +1,22 @@
1
1
  const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
- let __intlayer_core_messageFormat = require("@intlayer/core/messageFormat");
2
+ let _intlayer_core_messageFormat = require("@intlayer/core/messageFormat");
3
3
 
4
4
  //#region src/formatDictionary.ts
5
5
  const formatDictionary = (dictionary) => {
6
6
  if (dictionary.format === "icu") return {
7
7
  ...dictionary,
8
8
  format: "intlayer",
9
- content: (0, __intlayer_core_messageFormat.icuToIntlayerFormatter)(dictionary.content)
9
+ content: (0, _intlayer_core_messageFormat.icuToIntlayerFormatter)(dictionary.content)
10
10
  };
11
11
  if (dictionary.format === "i18next") return {
12
12
  ...dictionary,
13
13
  format: "intlayer",
14
- content: (0, __intlayer_core_messageFormat.i18nextToIntlayerFormatter)(dictionary.content)
14
+ content: (0, _intlayer_core_messageFormat.i18nextToIntlayerFormatter)(dictionary.content)
15
15
  };
16
16
  if (dictionary.format === "vue-i18n") return {
17
17
  ...dictionary,
18
18
  format: "intlayer",
19
- content: (0, __intlayer_core_messageFormat.vueI18nToIntlayerFormatter)(dictionary.content)
19
+ content: (0, _intlayer_core_messageFormat.vueI18nToIntlayerFormatter)(dictionary.content)
20
20
  };
21
21
  return dictionary;
22
22
  };
@@ -25,17 +25,17 @@ const formatDictionaryOutput = (dictionary) => {
25
25
  if (dictionary.format === "icu") return {
26
26
  ...dictionary,
27
27
  format: "icu",
28
- content: (0, __intlayer_core_messageFormat.intlayerToICUFormatter)(dictionary.content)
28
+ content: (0, _intlayer_core_messageFormat.intlayerToICUFormatter)(dictionary.content)
29
29
  };
30
30
  if (dictionary.format === "i18next") return {
31
31
  ...dictionary,
32
32
  format: "i18next",
33
- content: (0, __intlayer_core_messageFormat.intlayerToI18nextFormatter)(dictionary.content)
33
+ content: (0, _intlayer_core_messageFormat.intlayerToI18nextFormatter)(dictionary.content)
34
34
  };
35
35
  if (dictionary.format === "vue-i18n") return {
36
36
  ...dictionary,
37
37
  format: "vue-i18n",
38
- content: (0, __intlayer_core_messageFormat.intlayerToVueI18nFormatter)(dictionary.content)
38
+ content: (0, _intlayer_core_messageFormat.intlayerToVueI18nFormatter)(dictionary.content)
39
39
  };
40
40
  return dictionary;
41
41
  };
@@ -1 +1 @@
1
- {"version":3,"file":"formatDictionary.cjs","names":[],"sources":["../../src/formatDictionary.ts"],"sourcesContent":["import {\n i18nextToIntlayerFormatter,\n icuToIntlayerFormatter,\n intlayerToI18nextFormatter,\n intlayerToICUFormatter,\n intlayerToVueI18nFormatter,\n vueI18nToIntlayerFormatter,\n} from '@intlayer/core/messageFormat';\nimport type { Dictionary } from '@intlayer/types';\n\nexport const formatDictionary = (dictionary: Dictionary): Dictionary => {\n if (dictionary.format === 'icu') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: icuToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'i18next') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: i18nextToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: vueI18nToIntlayerFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionaries = (dictionaries: Dictionary[]): Dictionary[] =>\n dictionaries.map(formatDictionary);\n\nexport const formatDictionaryOutput = (dictionary: Dictionary) => {\n if (dictionary.format === 'icu') {\n return {\n ...dictionary,\n format: 'icu',\n content: intlayerToICUFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'i18next') {\n return {\n ...dictionary,\n format: 'i18next',\n content: intlayerToI18nextFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'vue-i18n',\n content: intlayerToVueI18nFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionariesOutput = (dictionaries: Dictionary[]) =>\n dictionaries.map(formatDictionaryOutput);\n"],"mappings":";;;;AAUA,MAAa,oBAAoB,eAAuC;AACtE,KAAI,WAAW,WAAW,MACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,mEAAgC,WAAW,QAAQ;EACpD;AAGH,KAAI,WAAW,WAAW,UACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,uEAAoC,WAAW,QAAQ;EACxD;AAGH,KAAI,WAAW,WAAW,WACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,uEAAoC,WAAW,QAAQ;EACxD;AAGH,QAAO;;AAGT,MAAa,sBAAsB,iBACjC,aAAa,IAAI,iBAAiB;AAEpC,MAAa,0BAA0B,eAA2B;AAChE,KAAI,WAAW,WAAW,MACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,mEAAgC,WAAW,QAAQ;EACpD;AAGH,KAAI,WAAW,WAAW,UACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,uEAAoC,WAAW,QAAQ;EACxD;AAGH,KAAI,WAAW,WAAW,WACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,uEAAoC,WAAW,QAAQ;EACxD;AAGH,QAAO;;AAGT,MAAa,4BAA4B,iBACvC,aAAa,IAAI,uBAAuB"}
1
+ {"version":3,"file":"formatDictionary.cjs","names":[],"sources":["../../src/formatDictionary.ts"],"sourcesContent":["import {\n i18nextToIntlayerFormatter,\n icuToIntlayerFormatter,\n intlayerToI18nextFormatter,\n intlayerToICUFormatter,\n intlayerToVueI18nFormatter,\n vueI18nToIntlayerFormatter,\n} from '@intlayer/core/messageFormat';\nimport type { Dictionary } from '@intlayer/types';\n\nexport const formatDictionary = (dictionary: Dictionary): Dictionary => {\n if (dictionary.format === 'icu') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: icuToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'i18next') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: i18nextToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: vueI18nToIntlayerFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionaries = (dictionaries: Dictionary[]): Dictionary[] =>\n dictionaries.map(formatDictionary);\n\nexport const formatDictionaryOutput = (dictionary: Dictionary) => {\n if (dictionary.format === 'icu') {\n return {\n ...dictionary,\n format: 'icu',\n content: intlayerToICUFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'i18next') {\n return {\n ...dictionary,\n format: 'i18next',\n content: intlayerToI18nextFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'vue-i18n',\n content: intlayerToVueI18nFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionariesOutput = (dictionaries: Dictionary[]) =>\n dictionaries.map(formatDictionaryOutput);\n"],"mappings":";;;;AAUA,MAAa,oBAAoB,eAAuC;AACtE,KAAI,WAAW,WAAW,MACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,kEAAgC,WAAW,QAAQ;EACpD;AAGH,KAAI,WAAW,WAAW,UACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,sEAAoC,WAAW,QAAQ;EACxD;AAGH,KAAI,WAAW,WAAW,WACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,sEAAoC,WAAW,QAAQ;EACxD;AAGH,QAAO;;AAGT,MAAa,sBAAsB,iBACjC,aAAa,IAAI,iBAAiB;AAEpC,MAAa,0BAA0B,eAA2B;AAChE,KAAI,WAAW,WAAW,MACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,kEAAgC,WAAW,QAAQ;EACpD;AAGH,KAAI,WAAW,WAAW,UACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,sEAAoC,WAAW,QAAQ;EACxD;AAGH,KAAI,WAAW,WAAW,WACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,sEAAoC,WAAW,QAAQ;EACxD;AAGH,QAAO;;AAGT,MAAa,4BAA4B,iBACvC,aAAa,IAAI,uBAAuB"}
@@ -1,6 +1,6 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  const require__utils_asset = require('../_virtual/_utils_asset.cjs');
3
- let __intlayer_config = require("@intlayer/config");
3
+ let _intlayer_config = require("@intlayer/config");
4
4
 
5
5
  //#region src/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.ts
6
6
  const getContentDeclarationFileTemplate = async (key, format, fileParams = {}) => {
@@ -20,7 +20,7 @@ const getContentDeclarationFileTemplate = async (key, format, fileParams = {}) =
20
20
  break;
21
21
  }
22
22
  const fileContent = require__utils_asset.readAsset(fileTemplate);
23
- const camelCaseKey = (0, __intlayer_config.kebabCaseToCamelCase)(key);
23
+ const camelCaseKey = (0, _intlayer_config.kebabCaseToCamelCase)(key);
24
24
  const nonCapitalizedCamelCaseKey = camelCaseKey.charAt(0).toLowerCase() + camelCaseKey.slice(1);
25
25
  const fileParamsString = Object.entries(fileParams).filter(([, value]) => value !== void 0).map(([key$1, value]) => {
26
26
  const formattedKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key$1) ? key$1 : JSON.stringify(key$1);
@@ -1 +1 @@
1
- {"version":3,"file":"getContentDeclarationFileTemplate.cjs","names":["fileTemplate: string","readAsset","key"],"sources":["../../../src/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.ts"],"sourcesContent":["import { readAsset } from 'utils:asset';\nimport { kebabCaseToCamelCase } from '@intlayer/config';\nimport type { Format } from '../utils/getFormatFromExtension';\n\nexport const getContentDeclarationFileTemplate = async (\n key: string,\n format: Format,\n fileParams: Record<string, any> = {}\n) => {\n let fileTemplate: string;\n\n switch (format) {\n case 'ts':\n fileTemplate = './tsTemplate.txt';\n break;\n case 'cjs':\n fileTemplate = './cjsTemplate.txt';\n break;\n case 'json':\n fileTemplate = './jsonTemplate.txt';\n break;\n default:\n fileTemplate = './esmTemplate.txt';\n break;\n }\n\n const fileContent = readAsset(fileTemplate);\n const camelCaseKey = kebabCaseToCamelCase(key);\n const nonCapitalizedCamelCaseKey =\n camelCaseKey.charAt(0).toLowerCase() + camelCaseKey.slice(1);\n\n const fileParamsString = Object.entries(fileParams)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => {\n const formattedKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key)\n ? key\n : JSON.stringify(key);\n\n if (typeof value === 'object') {\n return `\\n ${formattedKey}: ${JSON.stringify(value)},`;\n }\n\n if (typeof value === 'boolean' || typeof value === 'number') {\n return `\\n ${formattedKey}: ${value},`;\n }\n\n if (typeof value === 'string') {\n return `\\n ${formattedKey}: ${JSON.stringify(value)},`;\n }\n\n return `\\n ${formattedKey}: ${value},`;\n })\n .join('');\n\n return fileContent\n .replace('{{key}}', key)\n .replaceAll('{{name}}', nonCapitalizedCamelCaseKey)\n .replace('{{fileParams}}', fileParamsString);\n};\n"],"mappings":";;;;;AAIA,MAAa,oCAAoC,OAC/C,KACA,QACA,aAAkC,EAAE,KACjC;CACH,IAAIA;AAEJ,SAAQ,QAAR;EACE,KAAK;AACH,kBAAe;AACf;EACF,KAAK;AACH,kBAAe;AACf;EACF,KAAK;AACH,kBAAe;AACf;EACF;AACE,kBAAe;AACf;;CAGJ,MAAM,cAAcC,+BAAU,aAAa;CAC3C,MAAM,2DAAoC,IAAI;CAC9C,MAAM,6BACJ,aAAa,OAAO,EAAE,CAAC,aAAa,GAAG,aAAa,MAAM,EAAE;CAE9D,MAAM,mBAAmB,OAAO,QAAQ,WAAW,CAChD,QAAQ,GAAG,WAAW,UAAU,OAAU,CAC1C,KAAK,CAACC,OAAK,WAAW;EACrB,MAAM,eAAe,6BAA6B,KAAKA,MAAI,GACvDA,QACA,KAAK,UAAUA,MAAI;AAEvB,MAAI,OAAO,UAAU,SACnB,QAAO,OAAO,aAAa,IAAI,KAAK,UAAU,MAAM,CAAC;AAGvD,MAAI,OAAO,UAAU,aAAa,OAAO,UAAU,SACjD,QAAO,OAAO,aAAa,IAAI,MAAM;AAGvC,MAAI,OAAO,UAAU,SACnB,QAAO,OAAO,aAAa,IAAI,KAAK,UAAU,MAAM,CAAC;AAGvD,SAAO,OAAO,aAAa,IAAI,MAAM;GACrC,CACD,KAAK,GAAG;AAEX,QAAO,YACJ,QAAQ,WAAW,IAAI,CACvB,WAAW,YAAY,2BAA2B,CAClD,QAAQ,kBAAkB,iBAAiB"}
1
+ {"version":3,"file":"getContentDeclarationFileTemplate.cjs","names":["fileTemplate: string","readAsset","key"],"sources":["../../../src/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.ts"],"sourcesContent":["import { readAsset } from 'utils:asset';\nimport { kebabCaseToCamelCase } from '@intlayer/config';\nimport type { Format } from '../utils/getFormatFromExtension';\n\nexport const getContentDeclarationFileTemplate = async (\n key: string,\n format: Format,\n fileParams: Record<string, any> = {}\n) => {\n let fileTemplate: string;\n\n switch (format) {\n case 'ts':\n fileTemplate = './tsTemplate.txt';\n break;\n case 'cjs':\n fileTemplate = './cjsTemplate.txt';\n break;\n case 'json':\n fileTemplate = './jsonTemplate.txt';\n break;\n default:\n fileTemplate = './esmTemplate.txt';\n break;\n }\n\n const fileContent = readAsset(fileTemplate);\n const camelCaseKey = kebabCaseToCamelCase(key);\n const nonCapitalizedCamelCaseKey =\n camelCaseKey.charAt(0).toLowerCase() + camelCaseKey.slice(1);\n\n const fileParamsString = Object.entries(fileParams)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => {\n const formattedKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key)\n ? key\n : JSON.stringify(key);\n\n if (typeof value === 'object') {\n return `\\n ${formattedKey}: ${JSON.stringify(value)},`;\n }\n\n if (typeof value === 'boolean' || typeof value === 'number') {\n return `\\n ${formattedKey}: ${value},`;\n }\n\n if (typeof value === 'string') {\n return `\\n ${formattedKey}: ${JSON.stringify(value)},`;\n }\n\n return `\\n ${formattedKey}: ${value},`;\n })\n .join('');\n\n return fileContent\n .replace('{{key}}', key)\n .replaceAll('{{name}}', nonCapitalizedCamelCaseKey)\n .replace('{{fileParams}}', fileParamsString);\n};\n"],"mappings":";;;;;AAIA,MAAa,oCAAoC,OAC/C,KACA,QACA,aAAkC,EAAE,KACjC;CACH,IAAIA;AAEJ,SAAQ,QAAR;EACE,KAAK;AACH,kBAAe;AACf;EACF,KAAK;AACH,kBAAe;AACf;EACF,KAAK;AACH,kBAAe;AACf;EACF;AACE,kBAAe;AACf;;CAGJ,MAAM,cAAcC,+BAAU,aAAa;CAC3C,MAAM,0DAAoC,IAAI;CAC9C,MAAM,6BACJ,aAAa,OAAO,EAAE,CAAC,aAAa,GAAG,aAAa,MAAM,EAAE;CAE9D,MAAM,mBAAmB,OAAO,QAAQ,WAAW,CAChD,QAAQ,GAAG,WAAW,UAAU,OAAU,CAC1C,KAAK,CAACC,OAAK,WAAW;EACrB,MAAM,eAAe,6BAA6B,KAAKA,MAAI,GACvDA,QACA,KAAK,UAAUA,MAAI;AAEvB,MAAI,OAAO,UAAU,SACnB,QAAO,OAAO,aAAa,IAAI,KAAK,UAAU,MAAM,CAAC;AAGvD,MAAI,OAAO,UAAU,aAAa,OAAO,UAAU,SACjD,QAAO,OAAO,aAAa,IAAI,MAAM;AAGvC,MAAI,OAAO,UAAU,SACnB,QAAO,OAAO,aAAa,IAAI,KAAK,UAAU,MAAM,CAAC;AAGvD,SAAO,OAAO,aAAa,IAAI,MAAM;GACrC,CACD,KAAK,GAAG;AAEX,QAAO,YACJ,QAAQ,WAAW,IAAI,CACvB,WAAW,YAAY,2BAA2B,CAClD,QAAQ,kBAAkB,iBAAiB"}
@@ -5,11 +5,11 @@ const require_createDictionaryEntryPoint_createDictionaryEntryPoint = require('.
5
5
  const require_createType_createModuleAugmentation = require('./createType/createModuleAugmentation.cjs');
6
6
  const require_createType_createType = require('./createType/createType.cjs');
7
7
  const require_loadDictionaries_loadLocalDictionaries = require('./loadDictionaries/loadLocalDictionaries.cjs');
8
- let __intlayer_config = require("@intlayer/config");
8
+ let _intlayer_config = require("@intlayer/config");
9
9
 
10
10
  //#region src/handleAdditionalContentDeclarationFile.ts
11
11
  const handleAdditionalContentDeclarationFile = async (filePath, config) => {
12
- const appLogger = (0, __intlayer_config.getAppLogger)(config);
12
+ const appLogger = (0, _intlayer_config.getAppLogger)(config);
13
13
  appLogger(`Additional file detected: ${require_utils_formatter.formatPath(filePath)}`, { isVerbose: true });
14
14
  const dictionariesOutput = await require_buildIntlayerDictionary_buildIntlayerDictionary.buildDictionary(await require_loadDictionaries_loadLocalDictionaries.loadLocalDictionaries(filePath, config), config);
15
15
  await require_createType_createType.createTypes(Object.values(dictionariesOutput?.mergedDictionaries ?? {}).map((dictionary) => dictionary.dictionaryPath), config);
@@ -1 +1 @@
1
- {"version":3,"file":"handleAdditionalContentDeclarationFile.cjs","names":["formatPath","buildDictionary","loadLocalDictionaries","createTypes","createDictionaryEntryPoint"],"sources":["../../src/handleAdditionalContentDeclarationFile.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { createModuleAugmentation, createTypes } from './createType/index';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleAdditionalContentDeclarationFile = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Additional file detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n await createTypes(dictionariesPaths, config);\n\n await createDictionaryEntryPoint(config);\n\n appLogger('Dictionaries built', {\n isVerbose: true,\n });\n\n createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,yCAAyC,OACpD,UACA,WACG;CACH,MAAM,gDAAyB,OAAO;AAGtC,WAAU,6BAA6BA,mCAAW,SAAS,IAAI,EAC7D,WAAW,MACZ,CAAC;CAIF,MAAM,qBAAqB,MAAMC,wEAFN,MAAMC,qEAAsB,UAAU,OAAO,EAEH,OAAO;AAM5E,OAAMC,0CAJoB,OAAO,OAC/B,oBAAoB,sBAAsB,EAAE,CAC7C,CAAC,KAAK,eAAe,WAAW,eAAe,EAEX,OAAO;AAE5C,OAAMC,yFAA2B,OAAO;AAExC,WAAU,sBAAsB,EAC9B,WAAW,MACZ,CAAC;AAEF,sEAAyB,OAAO;AAEhC,WAAU,6BAA6B,EACrC,WAAW,MACZ,CAAC;AAIF,YAAW,MAAM,UAAU,OAAO,WAAW,EAAE,EAAE;EAC/C,MAAM,EAAE,sBAAsB,uBAAuB;AAErD,QAAM,OAAO,aAAa;GACxB,cAAc;IACZ;IACA;IACD;GACD,eAAe;GAChB,CAAC"}
1
+ {"version":3,"file":"handleAdditionalContentDeclarationFile.cjs","names":["formatPath","buildDictionary","loadLocalDictionaries","createTypes","createDictionaryEntryPoint"],"sources":["../../src/handleAdditionalContentDeclarationFile.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { createModuleAugmentation, createTypes } from './createType/index';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleAdditionalContentDeclarationFile = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Additional file detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n await createTypes(dictionariesPaths, config);\n\n await createDictionaryEntryPoint(config);\n\n appLogger('Dictionaries built', {\n isVerbose: true,\n });\n\n createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,yCAAyC,OACpD,UACA,WACG;CACH,MAAM,+CAAyB,OAAO;AAGtC,WAAU,6BAA6BA,mCAAW,SAAS,IAAI,EAC7D,WAAW,MACZ,CAAC;CAIF,MAAM,qBAAqB,MAAMC,wEAFN,MAAMC,qEAAsB,UAAU,OAAO,EAEH,OAAO;AAM5E,OAAMC,0CAJoB,OAAO,OAC/B,oBAAoB,sBAAsB,EAAE,CAC7C,CAAC,KAAK,eAAe,WAAW,eAAe,EAEX,OAAO;AAE5C,OAAMC,yFAA2B,OAAO;AAExC,WAAU,sBAAsB,EAC9B,WAAW,MACZ,CAAC;AAEF,sEAAyB,OAAO;AAEhC,WAAU,6BAA6B,EACrC,WAAW,MACZ,CAAC;AAIF,YAAW,MAAM,UAAU,OAAO,WAAW,EAAE,EAAE;EAC/C,MAAM,EAAE,sBAAsB,uBAAuB;AAErD,QAAM,OAAO,aAAa;GACxB,cAAc;IACZ;IACA;IACD;GACD,eAAe;GAChB,CAAC"}
@@ -6,11 +6,11 @@ const require_createDictionaryEntryPoint_createDictionaryEntryPoint = require('.
6
6
  const require_createType_createModuleAugmentation = require('./createType/createModuleAugmentation.cjs');
7
7
  const require_createType_createType = require('./createType/createType.cjs');
8
8
  const require_loadDictionaries_loadLocalDictionaries = require('./loadDictionaries/loadLocalDictionaries.cjs');
9
- let __intlayer_config = require("@intlayer/config");
9
+ let _intlayer_config = require("@intlayer/config");
10
10
 
11
11
  //#region src/handleContentDeclarationFileChange.ts
12
12
  const handleContentDeclarationFileChange = async (filePath, config) => {
13
- const appLogger = (0, __intlayer_config.getAppLogger)(config);
13
+ const appLogger = (0, _intlayer_config.getAppLogger)(config);
14
14
  appLogger(`Change detected: ${require_utils_formatter.formatPath(filePath)}`, { isVerbose: true });
15
15
  const dictionariesOutput = await require_buildIntlayerDictionary_buildIntlayerDictionary.buildDictionary(await require_loadDictionaries_loadLocalDictionaries.loadLocalDictionaries(filePath, config), config);
16
16
  const updatedDictionariesPaths = Object.values(dictionariesOutput?.mergedDictionaries ?? {}).map((dictionary) => dictionary.dictionaryPath);
@@ -1 +1 @@
1
- {"version":3,"file":"handleContentDeclarationFileChange.cjs","names":["formatPath","buildDictionary","loadLocalDictionaries","allDictionariesPaths: string[]","getBuiltDictionariesPath","createDictionaryEntryPoint"],"sources":["../../src/handleContentDeclarationFileChange.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { getBuiltDictionariesPath } from './createDictionaryEntryPoint/getBuiltDictionariesPath';\nimport { createTypes } from './createType';\nimport { createModuleAugmentation } from './createType/createModuleAugmentation';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleContentDeclarationFileChange = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Change detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n const updatedDictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n const allDictionariesPaths: string[] = await getBuiltDictionariesPath(config);\n\n createTypes(updatedDictionariesPaths, config);\n appLogger('TypeScript types built', {\n isVerbose: true,\n });\n\n if (\n updatedDictionariesPaths.some(\n (updatedDictionaryPath) =>\n !allDictionariesPaths.includes(updatedDictionaryPath)\n )\n ) {\n await createDictionaryEntryPoint(config);\n\n appLogger('Dictionary list built', {\n isVerbose: true,\n });\n }\n\n createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,qCAAqC,OAChD,UACA,WACG;CACH,MAAM,gDAAyB,OAAO;AAGtC,WAAU,oBAAoBA,mCAAW,SAAS,IAAI,EACpD,WAAW,MACZ,CAAC;CAIF,MAAM,qBAAqB,MAAMC,wEAFN,MAAMC,qEAAsB,UAAU,OAAO,EAEH,OAAO;CAC5E,MAAM,2BAA2B,OAAO,OACtC,oBAAoB,sBAAsB,EAAE,CAC7C,CAAC,KAAK,eAAe,WAAW,eAAe;CAEhD,MAAMC,uBAAiC,MAAMC,qFAAyB,OAAO;AAE7E,2CAAY,0BAA0B,OAAO;AAC7C,WAAU,0BAA0B,EAClC,WAAW,MACZ,CAAC;AAEF,KACE,yBAAyB,MACtB,0BACC,CAAC,qBAAqB,SAAS,sBAAsB,CACxD,EACD;AACA,QAAMC,yFAA2B,OAAO;AAExC,YAAU,yBAAyB,EACjC,WAAW,MACZ,CAAC;;AAGJ,sEAAyB,OAAO;AAEhC,WAAU,6BAA6B,EACrC,WAAW,MACZ,CAAC;AAIF,YAAW,MAAM,UAAU,OAAO,WAAW,EAAE,EAAE;EAC/C,MAAM,EAAE,sBAAsB,uBAAuB;AAErD,QAAM,OAAO,aAAa;GACxB,cAAc;IACZ;IACA;IACD;GACD,eAAe;GAChB,CAAC"}
1
+ {"version":3,"file":"handleContentDeclarationFileChange.cjs","names":["formatPath","buildDictionary","loadLocalDictionaries","allDictionariesPaths: string[]","getBuiltDictionariesPath","createDictionaryEntryPoint"],"sources":["../../src/handleContentDeclarationFileChange.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { getBuiltDictionariesPath } from './createDictionaryEntryPoint/getBuiltDictionariesPath';\nimport { createTypes } from './createType';\nimport { createModuleAugmentation } from './createType/createModuleAugmentation';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleContentDeclarationFileChange = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Change detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n const updatedDictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n const allDictionariesPaths: string[] = await getBuiltDictionariesPath(config);\n\n createTypes(updatedDictionariesPaths, config);\n appLogger('TypeScript types built', {\n isVerbose: true,\n });\n\n if (\n updatedDictionariesPaths.some(\n (updatedDictionaryPath) =>\n !allDictionariesPaths.includes(updatedDictionaryPath)\n )\n ) {\n await createDictionaryEntryPoint(config);\n\n appLogger('Dictionary list built', {\n isVerbose: true,\n });\n }\n\n createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,qCAAqC,OAChD,UACA,WACG;CACH,MAAM,+CAAyB,OAAO;AAGtC,WAAU,oBAAoBA,mCAAW,SAAS,IAAI,EACpD,WAAW,MACZ,CAAC;CAIF,MAAM,qBAAqB,MAAMC,wEAFN,MAAMC,qEAAsB,UAAU,OAAO,EAEH,OAAO;CAC5E,MAAM,2BAA2B,OAAO,OACtC,oBAAoB,sBAAsB,EAAE,CAC7C,CAAC,KAAK,eAAe,WAAW,eAAe;CAEhD,MAAMC,uBAAiC,MAAMC,qFAAyB,OAAO;AAE7E,2CAAY,0BAA0B,OAAO;AAC7C,WAAU,0BAA0B,EAClC,WAAW,MACZ,CAAC;AAEF,KACE,yBAAyB,MACtB,0BACC,CAAC,qBAAqB,SAAS,sBAAsB,CACxD,EACD;AACA,QAAMC,yFAA2B,OAAO;AAExC,YAAU,yBAAyB,EACjC,WAAW,MACZ,CAAC;;AAGJ,sEAAyB,OAAO;AAEhC,WAAU,6BAA6B,EACrC,WAAW,MACZ,CAAC;AAIF,YAAW,MAAM,UAAU,OAAO,WAAW,EAAE,EAAE;EAC/C,MAAM,EAAE,sBAAsB,uBAAuB;AAErD,QAAM,OAAO,aAAa;GACxB,cAAc;IACZ;IACA;IACD;GACD,eAAe;GAChB,CAAC"}
@@ -6,11 +6,11 @@ const require_createType_createModuleAugmentation = require('./createType/create
6
6
  const require_createType_createType = require('./createType/createType.cjs');
7
7
  const require_loadDictionaries_loadLocalDictionaries = require('./loadDictionaries/loadLocalDictionaries.cjs');
8
8
  const require_listDictionariesPath = require('./listDictionariesPath.cjs');
9
- let __intlayer_config = require("@intlayer/config");
9
+ let _intlayer_config = require("@intlayer/config");
10
10
 
11
11
  //#region src/handleUnlinkedContentDeclarationFile.ts
12
12
  const handleUnlinkedContentDeclarationFile = async (filePath, config) => {
13
- const appLogger = (0, __intlayer_config.getAppLogger)(config);
13
+ const appLogger = (0, _intlayer_config.getAppLogger)(config);
14
14
  appLogger(`Unlinked detected: ${require_utils_formatter.formatPath(filePath)}`, { isVerbose: true });
15
15
  const dictionariesOutput = await require_buildIntlayerDictionary_buildIntlayerDictionary.buildDictionary(await require_loadDictionaries_loadLocalDictionaries.loadLocalDictionaries(await require_listDictionariesPath.listDictionaries(config), config), config);
16
16
  await require_createType_createType.createTypes(Object.values(dictionariesOutput?.mergedDictionaries ?? {}).map((dictionary) => dictionary.dictionaryPath), config);
@@ -1 +1 @@
1
- {"version":3,"file":"handleUnlinkedContentDeclarationFile.cjs","names":["formatPath","buildDictionary","loadLocalDictionaries","listDictionaries","createTypes","createDictionaryEntryPoint","createModuleAugmentation"],"sources":["../../src/handleUnlinkedContentDeclarationFile.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { createTypes } from './createType';\nimport { createModuleAugmentation } from './createType/createModuleAugmentation';\nimport { listDictionaries } from './listDictionariesPath';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleUnlinkedContentDeclarationFile = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Unlinked detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const files: string[] = await listDictionaries(config);\n\n const localeDictionaries = await loadLocalDictionaries(files, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n await createTypes(dictionariesPaths, config);\n\n await createDictionaryEntryPoint();\n\n appLogger('Dictionaries rebuilt', {\n isVerbose: true,\n });\n\n await createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,uCAAuC,OAClD,UACA,WACG;CACH,MAAM,gDAAyB,OAAO;AAGtC,WAAU,sBAAsBA,mCAAW,SAAS,IAAI,EACtD,WAAW,MACZ,CAAC;CAMF,MAAM,qBAAqB,MAAMC,wEAFN,MAAMC,qEAFT,MAAMC,8CAAiB,OAAO,EAEQ,OAAO,EAEA,OAAO;AAM5E,OAAMC,0CAJoB,OAAO,OAC/B,oBAAoB,sBAAsB,EAAE,CAC7C,CAAC,KAAK,eAAe,WAAW,eAAe,EAEX,OAAO;AAE5C,OAAMC,0FAA4B;AAElC,WAAU,wBAAwB,EAChC,WAAW,MACZ,CAAC;AAEF,OAAMC,qEAAyB,OAAO;AAEtC,WAAU,6BAA6B,EACrC,WAAW,MACZ,CAAC;AAIF,YAAW,MAAM,UAAU,OAAO,WAAW,EAAE,EAAE;EAC/C,MAAM,EAAE,sBAAsB,uBAAuB;AAErD,QAAM,OAAO,aAAa;GACxB,cAAc;IACZ;IACA;IACD;GACD,eAAe;GAChB,CAAC"}
1
+ {"version":3,"file":"handleUnlinkedContentDeclarationFile.cjs","names":["formatPath","buildDictionary","loadLocalDictionaries","listDictionaries","createTypes","createDictionaryEntryPoint","createModuleAugmentation"],"sources":["../../src/handleUnlinkedContentDeclarationFile.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { createTypes } from './createType';\nimport { createModuleAugmentation } from './createType/createModuleAugmentation';\nimport { listDictionaries } from './listDictionariesPath';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleUnlinkedContentDeclarationFile = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Unlinked detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const files: string[] = await listDictionaries(config);\n\n const localeDictionaries = await loadLocalDictionaries(files, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n await createTypes(dictionariesPaths, config);\n\n await createDictionaryEntryPoint();\n\n appLogger('Dictionaries rebuilt', {\n isVerbose: true,\n });\n\n await createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,uCAAuC,OAClD,UACA,WACG;CACH,MAAM,+CAAyB,OAAO;AAGtC,WAAU,sBAAsBA,mCAAW,SAAS,IAAI,EACtD,WAAW,MACZ,CAAC;CAMF,MAAM,qBAAqB,MAAMC,wEAFN,MAAMC,qEAFT,MAAMC,8CAAiB,OAAO,EAEQ,OAAO,EAEA,OAAO;AAM5E,OAAMC,0CAJoB,OAAO,OAC/B,oBAAoB,sBAAsB,EAAE,CAC7C,CAAC,KAAK,eAAe,WAAW,eAAe,EAEX,OAAO;AAE5C,OAAMC,0FAA4B;AAElC,WAAU,wBAAwB,EAChC,WAAW,MACZ,CAAC;AAEF,OAAMC,qEAAyB,OAAO;AAEtC,WAAU,6BAA6B,EACrC,WAAW,MACZ,CAAC;AAIF,YAAW,MAAM,UAAU,OAAO,WAAW,EAAE,EAAE;EAC/C,MAAM,EAAE,sBAAsB,uBAAuB;AAErD,QAAM,OAAO,aAAa;GACxB,cAAc;IACZ;IACA;IACD;GACD,eAAe;GAChB,CAAC"}
@@ -1,9 +1,9 @@
1
1
  const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
2
  let node_fs = require("node:fs");
3
- let __intlayer_config = require("@intlayer/config");
3
+ let _intlayer_config = require("@intlayer/config");
4
4
  let node_path = require("node:path");
5
- let __intlayer_config_built = require("@intlayer/config/built");
6
- __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
5
+ let _intlayer_config_built = require("@intlayer/config/built");
6
+ _intlayer_config_built = require_rolldown_runtime.__toESM(_intlayer_config_built);
7
7
  let simple_git = require("simple-git");
8
8
  simple_git = require_rolldown_runtime.__toESM(simple_git);
9
9
 
@@ -12,7 +12,7 @@ const getGitRootDir = async () => {
12
12
  try {
13
13
  return (await (0, simple_git.default)().revparse(["--show-toplevel"])).trim();
14
14
  } catch (error) {
15
- (0, __intlayer_config.getAppLogger)(__intlayer_config_built.default)(`Error getting git root directory: ${error}`, { level: "error" });
15
+ (0, _intlayer_config.getAppLogger)(_intlayer_config_built.default)(`Error getting git root directory: ${error}`, { level: "error" });
16
16
  return null;
17
17
  }
18
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"listGitFiles.cjs","names":["configuration","diff: Set<string>","changedLines: Set<number>","match: RegExpExecArray | null"],"sources":["../../src/listGitFiles.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { getAppLogger } from '@intlayer/config';\nimport configuration from '@intlayer/config/built';\nimport simpleGit from 'simple-git';\n\nexport type DiffMode = 'gitDiff' | 'uncommitted' | 'unpushed' | 'untracked';\n\nconst getGitRootDir = async (): Promise<string | null> => {\n try {\n const git = simpleGit();\n const rootDir = await git.revparse(['--show-toplevel']);\n return rootDir.trim();\n } catch (error) {\n const appLogger = getAppLogger(configuration);\n appLogger(`Error getting git root directory: ${error}`, {\n level: 'error',\n });\n return null;\n }\n};\n\nexport type ListGitFilesOptions = {\n mode: DiffMode[];\n baseRef?: string;\n currentRef?: string;\n absolute?: boolean;\n};\n\nexport const listGitFiles = async ({\n mode,\n baseRef = 'origin/main',\n currentRef = 'HEAD', // HEAD points to the current branch's latest commit\n absolute = true,\n}: ListGitFilesOptions) => {\n try {\n const git = simpleGit();\n const diff: Set<string> = new Set();\n\n if (mode.includes('untracked')) {\n const status = await git.status();\n status.not_added.forEach((f) => diff.add(f));\n }\n\n if (mode.includes('uncommitted')) {\n // Get uncommitted changes\n const uncommittedDiff = await git.diff(['--name-only', 'HEAD']);\n\n const uncommittedFiles = uncommittedDiff.split('\\n').filter(Boolean);\n\n uncommittedFiles.forEach((file) => diff.add(file));\n }\n\n if (mode.includes('unpushed')) {\n // Get unpushed commits\n const unpushedDiff = await git.diff(['--name-only', '@{push}...HEAD']);\n\n const unpushedFiles = unpushedDiff.split('\\n').filter(Boolean);\n\n unpushedFiles.forEach((file) => diff.add(file));\n }\n\n if (mode.includes('gitDiff')) {\n // Get the base branch (usually main/master) from CI environment\n\n await git.fetch(baseRef);\n\n const diffBranch = await git.diff([\n '--name-only',\n `${baseRef}...${currentRef}`,\n ]);\n\n const gitDiffFiles = diffBranch.split('\\n').filter(Boolean);\n\n gitDiffFiles.forEach((file) => diff.add(file));\n }\n\n if (absolute) {\n const gitRootDir = await getGitRootDir();\n if (!gitRootDir) {\n return [];\n }\n return Array.from(diff).map((file) => join(gitRootDir, file));\n }\n\n return Array.from(diff);\n } catch (error) {\n console.warn('Failed to get changes list:', error);\n }\n};\n\nexport type ListGitLinesOptions = {\n mode: DiffMode[];\n baseRef?: string;\n currentRef?: string;\n};\n\nexport const listGitLines = async (\n filePath: string,\n {\n mode,\n baseRef = 'origin/main',\n currentRef = 'HEAD', // HEAD points to the current branch's latest commit\n }: ListGitLinesOptions\n): Promise<number[]> => {\n const git = simpleGit();\n // We collect **line numbers** (1-based) that were modified/added by the diff.\n // Using a Set ensures uniqueness when the same line is reported by several modes.\n const changedLines: Set<number> = new Set();\n\n /**\n * Extracts line numbers from a diff generated with `--unified=0`.\n * Each hunk header looks like: @@ -<oldStart>,<oldCount> +<newStart>,<newCount> @@\n * We consider both the \"+\" (new) side for additions and the \"-\" (old) side for deletions.\n * For deletions, we add the line before and after the deletion point in the current file.\n */\n const collectLinesFromDiff = (diffOutput: string) => {\n const hunkRegex = /@@ -(\\d+)(?:,(\\d+))? \\+(\\d+)(?:,(\\d+))? @@/g;\n let match: RegExpExecArray | null;\n\n while ((match = hunkRegex.exec(diffOutput)) !== null) {\n const oldCount = match[2] ? Number(match[2]) : 1;\n const newStart = Number(match[3]);\n const newCount = match[4] ? Number(match[4]) : 1;\n\n // Handle additions/modifications (+ side)\n if (newCount > 0) {\n for (let i = 0; i < newCount; i++) {\n changedLines.add(newStart + i);\n }\n }\n\n // Handle deletions (- side)\n if (oldCount > 0 && newCount === 0) {\n // For deletions, add the line before and after the deletion point\n // The deletion point in the new file is at newStart\n if (newStart > 1) {\n changedLines.add(newStart - 1); // Line before deletion\n }\n changedLines.add(newStart); // Line after deletion (if it exists)\n }\n }\n };\n\n // 1. Handle untracked files – when a file is untracked its entire content is new.\n if (mode.includes('untracked')) {\n const status = await git.status();\n const isUntracked = status.not_added.includes(filePath);\n if (isUntracked) {\n try {\n const content = readFileSync(filePath, 'utf-8');\n content.split('\\n').forEach((_, idx) => changedLines.add(idx + 1));\n } catch {\n // ignore read errors – file may have been deleted, etc.\n }\n }\n }\n\n // 2. Uncommitted changes (working tree vs HEAD)\n if (mode.includes('uncommitted')) {\n const diffOutput = await git.diff(['--unified=0', 'HEAD', '--', filePath]);\n collectLinesFromDiff(diffOutput);\n }\n\n // 3. Unpushed commits – compare local branch to its upstream\n if (mode.includes('unpushed')) {\n const diffOutput = await git.diff([\n '--unified=0',\n '@{push}...HEAD',\n '--',\n filePath,\n ]);\n collectLinesFromDiff(diffOutput);\n }\n\n // 4. Regular git diff between baseRef and currentRef (e.g., CI pull-request diff)\n if (mode.includes('gitDiff')) {\n await git.fetch(baseRef);\n const diffOutput = await git.diff([\n '--unified=0',\n `${baseRef}...${currentRef}`,\n '--',\n filePath,\n ]);\n collectLinesFromDiff(diffOutput);\n }\n\n // Return the list sorted for convenience\n return Array.from(changedLines).sort((a, b) => a - b);\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAM,gBAAgB,YAAoC;AACxD,KAAI;AAGF,UADgB,+BADO,CACG,SAAS,CAAC,kBAAkB,CAAC,EACxC,MAAM;UACd,OAAO;AAEd,sCAD+BA,gCAAc,CACnC,qCAAqC,SAAS,EACtD,OAAO,SACR,CAAC;AACF,SAAO;;;AAWX,MAAa,eAAe,OAAO,EACjC,MACA,UAAU,eACV,aAAa,QACb,WAAW,WACc;AACzB,KAAI;EACF,MAAM,+BAAiB;EACvB,MAAMC,uBAAoB,IAAI,KAAK;AAEnC,MAAI,KAAK,SAAS,YAAY,CAE5B,EADe,MAAM,IAAI,QAAQ,EAC1B,UAAU,SAAS,MAAM,KAAK,IAAI,EAAE,CAAC;AAG9C,MAAI,KAAK,SAAS,cAAc,CAM9B,EAJwB,MAAM,IAAI,KAAK,CAAC,eAAe,OAAO,CAAC,EAEtB,MAAM,KAAK,CAAC,OAAO,QAAQ,CAEnD,SAAS,SAAS,KAAK,IAAI,KAAK,CAAC;AAGpD,MAAI,KAAK,SAAS,WAAW,CAM3B,EAJqB,MAAM,IAAI,KAAK,CAAC,eAAe,iBAAiB,CAAC,EAEnC,MAAM,KAAK,CAAC,OAAO,QAAQ,CAEhD,SAAS,SAAS,KAAK,IAAI,KAAK,CAAC;AAGjD,MAAI,KAAK,SAAS,UAAU,EAAE;AAG5B,SAAM,IAAI,MAAM,QAAQ;AASxB,IAPmB,MAAM,IAAI,KAAK,CAChC,eACA,GAAG,QAAQ,KAAK,aACjB,CAAC,EAE8B,MAAM,KAAK,CAAC,OAAO,QAAQ,CAE9C,SAAS,SAAS,KAAK,IAAI,KAAK,CAAC;;AAGhD,MAAI,UAAU;GACZ,MAAM,aAAa,MAAM,eAAe;AACxC,OAAI,CAAC,WACH,QAAO,EAAE;AAEX,UAAO,MAAM,KAAK,KAAK,CAAC,KAAK,6BAAc,YAAY,KAAK,CAAC;;AAG/D,SAAO,MAAM,KAAK,KAAK;UAChB,OAAO;AACd,UAAQ,KAAK,+BAA+B,MAAM;;;AAUtD,MAAa,eAAe,OAC1B,UACA,EACE,MACA,UAAU,eACV,aAAa,aAEO;CACtB,MAAM,+BAAiB;CAGvB,MAAMC,+BAA4B,IAAI,KAAK;;;;;;;CAQ3C,MAAM,wBAAwB,eAAuB;EACnD,MAAM,YAAY;EAClB,IAAIC;AAEJ,UAAQ,QAAQ,UAAU,KAAK,WAAW,MAAM,MAAM;GACpD,MAAM,WAAW,MAAM,KAAK,OAAO,MAAM,GAAG,GAAG;GAC/C,MAAM,WAAW,OAAO,MAAM,GAAG;GACjC,MAAM,WAAW,MAAM,KAAK,OAAO,MAAM,GAAG,GAAG;AAG/C,OAAI,WAAW,EACb,MAAK,IAAI,IAAI,GAAG,IAAI,UAAU,IAC5B,cAAa,IAAI,WAAW,EAAE;AAKlC,OAAI,WAAW,KAAK,aAAa,GAAG;AAGlC,QAAI,WAAW,EACb,cAAa,IAAI,WAAW,EAAE;AAEhC,iBAAa,IAAI,SAAS;;;;AAMhC,KAAI,KAAK,SAAS,YAAY,EAG5B;OAFe,MAAM,IAAI,QAAQ,EACN,UAAU,SAAS,SAAS,CAErD,KAAI;AAEF,6BAD6B,UAAU,QAAQ,CACvC,MAAM,KAAK,CAAC,SAAS,GAAG,QAAQ,aAAa,IAAI,MAAM,EAAE,CAAC;UAC5D;;AAOZ,KAAI,KAAK,SAAS,cAAc,CAE9B,sBADmB,MAAM,IAAI,KAAK;EAAC;EAAe;EAAQ;EAAM;EAAS,CAAC,CAC1C;AAIlC,KAAI,KAAK,SAAS,WAAW,CAO3B,sBANmB,MAAM,IAAI,KAAK;EAChC;EACA;EACA;EACA;EACD,CAAC,CAC8B;AAIlC,KAAI,KAAK,SAAS,UAAU,EAAE;AAC5B,QAAM,IAAI,MAAM,QAAQ;AAOxB,uBANmB,MAAM,IAAI,KAAK;GAChC;GACA,GAAG,QAAQ,KAAK;GAChB;GACA;GACD,CAAC,CAC8B;;AAIlC,QAAO,MAAM,KAAK,aAAa,CAAC,MAAM,GAAG,MAAM,IAAI,EAAE"}
1
+ {"version":3,"file":"listGitFiles.cjs","names":["configuration","diff: Set<string>","changedLines: Set<number>","match: RegExpExecArray | null"],"sources":["../../src/listGitFiles.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { getAppLogger } from '@intlayer/config';\nimport configuration from '@intlayer/config/built';\nimport simpleGit from 'simple-git';\n\nexport type DiffMode = 'gitDiff' | 'uncommitted' | 'unpushed' | 'untracked';\n\nconst getGitRootDir = async (): Promise<string | null> => {\n try {\n const git = simpleGit();\n const rootDir = await git.revparse(['--show-toplevel']);\n return rootDir.trim();\n } catch (error) {\n const appLogger = getAppLogger(configuration);\n appLogger(`Error getting git root directory: ${error}`, {\n level: 'error',\n });\n return null;\n }\n};\n\nexport type ListGitFilesOptions = {\n mode: DiffMode[];\n baseRef?: string;\n currentRef?: string;\n absolute?: boolean;\n};\n\nexport const listGitFiles = async ({\n mode,\n baseRef = 'origin/main',\n currentRef = 'HEAD', // HEAD points to the current branch's latest commit\n absolute = true,\n}: ListGitFilesOptions) => {\n try {\n const git = simpleGit();\n const diff: Set<string> = new Set();\n\n if (mode.includes('untracked')) {\n const status = await git.status();\n status.not_added.forEach((f) => diff.add(f));\n }\n\n if (mode.includes('uncommitted')) {\n // Get uncommitted changes\n const uncommittedDiff = await git.diff(['--name-only', 'HEAD']);\n\n const uncommittedFiles = uncommittedDiff.split('\\n').filter(Boolean);\n\n uncommittedFiles.forEach((file) => diff.add(file));\n }\n\n if (mode.includes('unpushed')) {\n // Get unpushed commits\n const unpushedDiff = await git.diff(['--name-only', '@{push}...HEAD']);\n\n const unpushedFiles = unpushedDiff.split('\\n').filter(Boolean);\n\n unpushedFiles.forEach((file) => diff.add(file));\n }\n\n if (mode.includes('gitDiff')) {\n // Get the base branch (usually main/master) from CI environment\n\n await git.fetch(baseRef);\n\n const diffBranch = await git.diff([\n '--name-only',\n `${baseRef}...${currentRef}`,\n ]);\n\n const gitDiffFiles = diffBranch.split('\\n').filter(Boolean);\n\n gitDiffFiles.forEach((file) => diff.add(file));\n }\n\n if (absolute) {\n const gitRootDir = await getGitRootDir();\n if (!gitRootDir) {\n return [];\n }\n return Array.from(diff).map((file) => join(gitRootDir, file));\n }\n\n return Array.from(diff);\n } catch (error) {\n console.warn('Failed to get changes list:', error);\n }\n};\n\nexport type ListGitLinesOptions = {\n mode: DiffMode[];\n baseRef?: string;\n currentRef?: string;\n};\n\nexport const listGitLines = async (\n filePath: string,\n {\n mode,\n baseRef = 'origin/main',\n currentRef = 'HEAD', // HEAD points to the current branch's latest commit\n }: ListGitLinesOptions\n): Promise<number[]> => {\n const git = simpleGit();\n // We collect **line numbers** (1-based) that were modified/added by the diff.\n // Using a Set ensures uniqueness when the same line is reported by several modes.\n const changedLines: Set<number> = new Set();\n\n /**\n * Extracts line numbers from a diff generated with `--unified=0`.\n * Each hunk header looks like: @@ -<oldStart>,<oldCount> +<newStart>,<newCount> @@\n * We consider both the \"+\" (new) side for additions and the \"-\" (old) side for deletions.\n * For deletions, we add the line before and after the deletion point in the current file.\n */\n const collectLinesFromDiff = (diffOutput: string) => {\n const hunkRegex = /@@ -(\\d+)(?:,(\\d+))? \\+(\\d+)(?:,(\\d+))? @@/g;\n let match: RegExpExecArray | null;\n\n while ((match = hunkRegex.exec(diffOutput)) !== null) {\n const oldCount = match[2] ? Number(match[2]) : 1;\n const newStart = Number(match[3]);\n const newCount = match[4] ? Number(match[4]) : 1;\n\n // Handle additions/modifications (+ side)\n if (newCount > 0) {\n for (let i = 0; i < newCount; i++) {\n changedLines.add(newStart + i);\n }\n }\n\n // Handle deletions (- side)\n if (oldCount > 0 && newCount === 0) {\n // For deletions, add the line before and after the deletion point\n // The deletion point in the new file is at newStart\n if (newStart > 1) {\n changedLines.add(newStart - 1); // Line before deletion\n }\n changedLines.add(newStart); // Line after deletion (if it exists)\n }\n }\n };\n\n // 1. Handle untracked files – when a file is untracked its entire content is new.\n if (mode.includes('untracked')) {\n const status = await git.status();\n const isUntracked = status.not_added.includes(filePath);\n if (isUntracked) {\n try {\n const content = readFileSync(filePath, 'utf-8');\n content.split('\\n').forEach((_, idx) => changedLines.add(idx + 1));\n } catch {\n // ignore read errors – file may have been deleted, etc.\n }\n }\n }\n\n // 2. Uncommitted changes (working tree vs HEAD)\n if (mode.includes('uncommitted')) {\n const diffOutput = await git.diff(['--unified=0', 'HEAD', '--', filePath]);\n collectLinesFromDiff(diffOutput);\n }\n\n // 3. Unpushed commits – compare local branch to its upstream\n if (mode.includes('unpushed')) {\n const diffOutput = await git.diff([\n '--unified=0',\n '@{push}...HEAD',\n '--',\n filePath,\n ]);\n collectLinesFromDiff(diffOutput);\n }\n\n // 4. Regular git diff between baseRef and currentRef (e.g., CI pull-request diff)\n if (mode.includes('gitDiff')) {\n await git.fetch(baseRef);\n const diffOutput = await git.diff([\n '--unified=0',\n `${baseRef}...${currentRef}`,\n '--',\n filePath,\n ]);\n collectLinesFromDiff(diffOutput);\n }\n\n // Return the list sorted for convenience\n return Array.from(changedLines).sort((a, b) => a - b);\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAM,gBAAgB,YAAoC;AACxD,KAAI;AAGF,UADgB,+BADO,CACG,SAAS,CAAC,kBAAkB,CAAC,EACxC,MAAM;UACd,OAAO;AAEd,qCAD+BA,+BAAc,CACnC,qCAAqC,SAAS,EACtD,OAAO,SACR,CAAC;AACF,SAAO;;;AAWX,MAAa,eAAe,OAAO,EACjC,MACA,UAAU,eACV,aAAa,QACb,WAAW,WACc;AACzB,KAAI;EACF,MAAM,+BAAiB;EACvB,MAAMC,uBAAoB,IAAI,KAAK;AAEnC,MAAI,KAAK,SAAS,YAAY,CAE5B,EADe,MAAM,IAAI,QAAQ,EAC1B,UAAU,SAAS,MAAM,KAAK,IAAI,EAAE,CAAC;AAG9C,MAAI,KAAK,SAAS,cAAc,CAM9B,EAJwB,MAAM,IAAI,KAAK,CAAC,eAAe,OAAO,CAAC,EAEtB,MAAM,KAAK,CAAC,OAAO,QAAQ,CAEnD,SAAS,SAAS,KAAK,IAAI,KAAK,CAAC;AAGpD,MAAI,KAAK,SAAS,WAAW,CAM3B,EAJqB,MAAM,IAAI,KAAK,CAAC,eAAe,iBAAiB,CAAC,EAEnC,MAAM,KAAK,CAAC,OAAO,QAAQ,CAEhD,SAAS,SAAS,KAAK,IAAI,KAAK,CAAC;AAGjD,MAAI,KAAK,SAAS,UAAU,EAAE;AAG5B,SAAM,IAAI,MAAM,QAAQ;AASxB,IAPmB,MAAM,IAAI,KAAK,CAChC,eACA,GAAG,QAAQ,KAAK,aACjB,CAAC,EAE8B,MAAM,KAAK,CAAC,OAAO,QAAQ,CAE9C,SAAS,SAAS,KAAK,IAAI,KAAK,CAAC;;AAGhD,MAAI,UAAU;GACZ,MAAM,aAAa,MAAM,eAAe;AACxC,OAAI,CAAC,WACH,QAAO,EAAE;AAEX,UAAO,MAAM,KAAK,KAAK,CAAC,KAAK,6BAAc,YAAY,KAAK,CAAC;;AAG/D,SAAO,MAAM,KAAK,KAAK;UAChB,OAAO;AACd,UAAQ,KAAK,+BAA+B,MAAM;;;AAUtD,MAAa,eAAe,OAC1B,UACA,EACE,MACA,UAAU,eACV,aAAa,aAEO;CACtB,MAAM,+BAAiB;CAGvB,MAAMC,+BAA4B,IAAI,KAAK;;;;;;;CAQ3C,MAAM,wBAAwB,eAAuB;EACnD,MAAM,YAAY;EAClB,IAAIC;AAEJ,UAAQ,QAAQ,UAAU,KAAK,WAAW,MAAM,MAAM;GACpD,MAAM,WAAW,MAAM,KAAK,OAAO,MAAM,GAAG,GAAG;GAC/C,MAAM,WAAW,OAAO,MAAM,GAAG;GACjC,MAAM,WAAW,MAAM,KAAK,OAAO,MAAM,GAAG,GAAG;AAG/C,OAAI,WAAW,EACb,MAAK,IAAI,IAAI,GAAG,IAAI,UAAU,IAC5B,cAAa,IAAI,WAAW,EAAE;AAKlC,OAAI,WAAW,KAAK,aAAa,GAAG;AAGlC,QAAI,WAAW,EACb,cAAa,IAAI,WAAW,EAAE;AAEhC,iBAAa,IAAI,SAAS;;;;AAMhC,KAAI,KAAK,SAAS,YAAY,EAG5B;OAFe,MAAM,IAAI,QAAQ,EACN,UAAU,SAAS,SAAS,CAErD,KAAI;AAEF,6BAD6B,UAAU,QAAQ,CACvC,MAAM,KAAK,CAAC,SAAS,GAAG,QAAQ,aAAa,IAAI,MAAM,EAAE,CAAC;UAC5D;;AAOZ,KAAI,KAAK,SAAS,cAAc,CAE9B,sBADmB,MAAM,IAAI,KAAK;EAAC;EAAe;EAAQ;EAAM;EAAS,CAAC,CAC1C;AAIlC,KAAI,KAAK,SAAS,WAAW,CAO3B,sBANmB,MAAM,IAAI,KAAK;EAChC;EACA;EACA;EACA;EACD,CAAC,CAC8B;AAIlC,KAAI,KAAK,SAAS,UAAU,EAAE;AAC5B,QAAM,IAAI,MAAM,QAAQ;AAOxB,uBANmB,MAAM,IAAI,KAAK;GAChC;GACA,GAAG,QAAQ,KAAK;GAChB;GACA;GACD,CAAC,CAC8B;;AAIlC,QAAO,MAAM,KAAK,aAAa,CAAC,MAAM,GAAG,MAAM,IAAI,EAAE"}
@@ -1,6 +1,6 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  let node_fs_promises = require("node:fs/promises");
3
- let __intlayer_config = require("@intlayer/config");
3
+ let _intlayer_config = require("@intlayer/config");
4
4
  let node_path = require("node:path");
5
5
  let node_module = require("node:module");
6
6
 
@@ -41,9 +41,9 @@ const rewritePathsPlugin = (replaceModules, excludeModules) => {
41
41
  * Get the intlayer bundle to embed @intlayer/core and be able to mock @intlayer/config/built to mock the configuration file.
42
42
  */
43
43
  const getIntlayerBundle = async (configuration) => {
44
- const rootRequire = (0, __intlayer_config.getProjectRequire)(configuration.content.baseDir);
45
- const configPackageRequire = __intlayer_config.configESMxCJSRequire;
46
- const localRequire = __intlayer_config.isESModule ? (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href) : require;
44
+ const rootRequire = (0, _intlayer_config.getProjectRequire)(configuration.content.baseDir);
45
+ const configPackageRequire = _intlayer_config.configESMxCJSRequire;
46
+ const localRequire = _intlayer_config.isESModule ? (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href) : require;
47
47
  const configurationPath = (0, node_path.join)(configuration.content.configDir, `configuration.json`);
48
48
  const replaceModules = {
49
49
  defu: configPackageRequire.resolve("defu"),
@@ -54,7 +54,7 @@ const getIntlayerBundle = async (configuration) => {
54
54
  "@intlayer/core/file": localRequire.resolve("@intlayer/core/file")
55
55
  };
56
56
  const filePath = rootRequire.resolve("intlayer");
57
- return await (0, __intlayer_config.bundleFile)(await (0, node_fs_promises.readFile)(filePath, "utf-8"), filePath, {
57
+ return await (0, _intlayer_config.bundleFile)(await (0, node_fs_promises.readFile)(filePath, "utf-8"), filePath, {
58
58
  external: [...node_module.builtinModules, ...node_module.builtinModules.map((mod) => `node:${mod}`)],
59
59
  minify: true,
60
60
  plugins: [rewritePathsPlugin(replaceModules)]
@@ -1 +1 @@
1
- {"version":3,"file":"getIntlayerBundle.cjs","names":["configESMxCJSRequire","isESModule","builtinModules"],"sources":["../../../src/loadDictionaries/getIntlayerBundle.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { builtinModules, createRequire } from 'node:module';\nimport { join } from 'node:path';\nimport type { ESBuildPlugin } from '@intlayer/config';\nimport {\n bundleFile,\n configESMxCJSRequire,\n getProjectRequire,\n isESModule,\n} from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\n\n/**\n * Rewrites selected bare specifiers (and any of their subpaths) to absolute file paths,\n * using the provided localeRequire (either createRequire(import.meta.url) or require).\n *\n * Example:\n * rewritePathsPlugin([\"@intlayer/config\", \"@intlayer/core\"], localeRequire)\n * …will also rewrite \"@intlayer/core/file\" etc.\n */\nconst rewritePathsPlugin = (\n replaceModules: Record<string, string>,\n excludeModules?: string[]\n): ESBuildPlugin => {\n return {\n name: 'rewrite-paths',\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n const exact = replaceModules[args.path];\n\n if (excludeModules?.includes(args.path)) {\n return null;\n }\n\n if (exact) {\n return {\n path: exact,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n\n // Optional: support subpaths like \"@intlayer/core/xyz\"\n for (const key of Object.keys(replaceModules)) {\n if (args.path === key || args.path.startsWith(`${key}/`)) {\n const sub = args.path.slice(key.length); // '' or '/...'\n return {\n path: replaceModules[key] + sub,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n }\n });\n },\n };\n};\n\n/**\n * Get the intlayer bundle to embed @intlayer/core and be able to mock @intlayer/config/built to mock the configuration file.\n */\nexport const getIntlayerBundle = async (configuration: IntlayerConfig) => {\n const rootRequire = getProjectRequire(configuration.content.baseDir);\n const configPackageRequire = configESMxCJSRequire;\n const localRequire = isESModule ? createRequire(import.meta.url) : require;\n\n const configurationPath = join(\n configuration.content.configDir,\n `configuration.json`\n );\n\n const replaceModules = {\n defu: configPackageRequire.resolve('defu'),\n esbuild: configPackageRequire.resolve('esbuild'),\n '@intlayer/config/built': configurationPath,\n '@intlayer/config': localRequire.resolve('@intlayer/config'),\n '@intlayer/config/client': localRequire.resolve('@intlayer/config/client'),\n '@intlayer/core/file': localRequire.resolve('@intlayer/core/file'),\n };\n\n const filePath = rootRequire.resolve('intlayer');\n const code = await readFile(filePath, 'utf-8');\n\n const output = await bundleFile(code, filePath, {\n external: [\n ...builtinModules,\n ...builtinModules.map((mod) => `node:${mod}`),\n ],\n minify: true,\n plugins: [rewritePathsPlugin(replaceModules)],\n });\n\n return output ?? '';\n};\n"],"mappings":";;;;;;;;;;;;;;;AAoBA,MAAM,sBACJ,gBACA,mBACkB;AAClB,QAAO;EACL,MAAM;EACN,MAAM,OAAO;AACX,SAAM,UAAU,EAAE,QAAQ,MAAM,GAAG,SAAS;IAC1C,MAAM,QAAQ,eAAe,KAAK;AAElC,QAAI,gBAAgB,SAAS,KAAK,KAAK,CACrC,QAAO;AAGT,QAAI,MACF,QAAO;KACL,MAAM;KACN,WAAW;KACX,UAAU;KACX;AAIH,SAAK,MAAM,OAAO,OAAO,KAAK,eAAe,CAC3C,KAAI,KAAK,SAAS,OAAO,KAAK,KAAK,WAAW,GAAG,IAAI,GAAG,EAAE;KACxD,MAAM,MAAM,KAAK,KAAK,MAAM,IAAI,OAAO;AACvC,YAAO;MACL,MAAM,eAAe,OAAO;MAC5B,WAAW;MACX,UAAU;MACX;;KAGL;;EAEL;;;;;AAMH,MAAa,oBAAoB,OAAO,kBAAkC;CACxE,MAAM,uDAAgC,cAAc,QAAQ,QAAQ;CACpE,MAAM,uBAAuBA;CAC7B,MAAM,eAAeC,4GAA2C,GAAG;CAEnE,MAAM,wCACJ,cAAc,QAAQ,WACtB,qBACD;CAED,MAAM,iBAAiB;EACrB,MAAM,qBAAqB,QAAQ,OAAO;EAC1C,SAAS,qBAAqB,QAAQ,UAAU;EAChD,0BAA0B;EAC1B,oBAAoB,aAAa,QAAQ,mBAAmB;EAC5D,2BAA2B,aAAa,QAAQ,0BAA0B;EAC1E,uBAAuB,aAAa,QAAQ,sBAAsB;EACnE;CAED,MAAM,WAAW,YAAY,QAAQ,WAAW;AAYhD,QATe,wCAFF,qCAAe,UAAU,QAAQ,EAER,UAAU;EAC9C,UAAU,CACR,GAAGC,4BACH,GAAGA,2BAAe,KAAK,QAAQ,QAAQ,MAAM,CAC9C;EACD,QAAQ;EACR,SAAS,CAAC,mBAAmB,eAAe,CAAC;EAC9C,CAAC,IAEe"}
1
+ {"version":3,"file":"getIntlayerBundle.cjs","names":["configESMxCJSRequire","isESModule","builtinModules"],"sources":["../../../src/loadDictionaries/getIntlayerBundle.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { builtinModules, createRequire } from 'node:module';\nimport { join } from 'node:path';\nimport type { ESBuildPlugin } from '@intlayer/config';\nimport {\n bundleFile,\n configESMxCJSRequire,\n getProjectRequire,\n isESModule,\n} from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\n\n/**\n * Rewrites selected bare specifiers (and any of their subpaths) to absolute file paths,\n * using the provided localeRequire (either createRequire(import.meta.url) or require).\n *\n * Example:\n * rewritePathsPlugin([\"@intlayer/config\", \"@intlayer/core\"], localeRequire)\n * …will also rewrite \"@intlayer/core/file\" etc.\n */\nconst rewritePathsPlugin = (\n replaceModules: Record<string, string>,\n excludeModules?: string[]\n): ESBuildPlugin => {\n return {\n name: 'rewrite-paths',\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n const exact = replaceModules[args.path];\n\n if (excludeModules?.includes(args.path)) {\n return null;\n }\n\n if (exact) {\n return {\n path: exact,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n\n // Optional: support subpaths like \"@intlayer/core/xyz\"\n for (const key of Object.keys(replaceModules)) {\n if (args.path === key || args.path.startsWith(`${key}/`)) {\n const sub = args.path.slice(key.length); // '' or '/...'\n return {\n path: replaceModules[key] + sub,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n }\n });\n },\n };\n};\n\n/**\n * Get the intlayer bundle to embed @intlayer/core and be able to mock @intlayer/config/built to mock the configuration file.\n */\nexport const getIntlayerBundle = async (configuration: IntlayerConfig) => {\n const rootRequire = getProjectRequire(configuration.content.baseDir);\n const configPackageRequire = configESMxCJSRequire;\n const localRequire = isESModule ? createRequire(import.meta.url) : require;\n\n const configurationPath = join(\n configuration.content.configDir,\n `configuration.json`\n );\n\n const replaceModules = {\n defu: configPackageRequire.resolve('defu'),\n esbuild: configPackageRequire.resolve('esbuild'),\n '@intlayer/config/built': configurationPath,\n '@intlayer/config': localRequire.resolve('@intlayer/config'),\n '@intlayer/config/client': localRequire.resolve('@intlayer/config/client'),\n '@intlayer/core/file': localRequire.resolve('@intlayer/core/file'),\n };\n\n const filePath = rootRequire.resolve('intlayer');\n const code = await readFile(filePath, 'utf-8');\n\n const output = await bundleFile(code, filePath, {\n external: [\n ...builtinModules,\n ...builtinModules.map((mod) => `node:${mod}`),\n ],\n minify: true,\n plugins: [rewritePathsPlugin(replaceModules)],\n });\n\n return output ?? '';\n};\n"],"mappings":";;;;;;;;;;;;;;;AAoBA,MAAM,sBACJ,gBACA,mBACkB;AAClB,QAAO;EACL,MAAM;EACN,MAAM,OAAO;AACX,SAAM,UAAU,EAAE,QAAQ,MAAM,GAAG,SAAS;IAC1C,MAAM,QAAQ,eAAe,KAAK;AAElC,QAAI,gBAAgB,SAAS,KAAK,KAAK,CACrC,QAAO;AAGT,QAAI,MACF,QAAO;KACL,MAAM;KACN,WAAW;KACX,UAAU;KACX;AAIH,SAAK,MAAM,OAAO,OAAO,KAAK,eAAe,CAC3C,KAAI,KAAK,SAAS,OAAO,KAAK,KAAK,WAAW,GAAG,IAAI,GAAG,EAAE;KACxD,MAAM,MAAM,KAAK,KAAK,MAAM,IAAI,OAAO;AACvC,YAAO;MACL,MAAM,eAAe,OAAO;MAC5B,WAAW;MACX,UAAU;MACX;;KAGL;;EAEL;;;;;AAMH,MAAa,oBAAoB,OAAO,kBAAkC;CACxE,MAAM,sDAAgC,cAAc,QAAQ,QAAQ;CACpE,MAAM,uBAAuBA;CAC7B,MAAM,eAAeC,2GAA2C,GAAG;CAEnE,MAAM,wCACJ,cAAc,QAAQ,WACtB,qBACD;CAED,MAAM,iBAAiB;EACrB,MAAM,qBAAqB,QAAQ,OAAO;EAC1C,SAAS,qBAAqB,QAAQ,UAAU;EAChD,0BAA0B;EAC1B,oBAAoB,aAAa,QAAQ,mBAAmB;EAC5D,2BAA2B,aAAa,QAAQ,0BAA0B;EAC1E,uBAAuB,aAAa,QAAQ,sBAAsB;EACnE;CAED,MAAM,WAAW,YAAY,QAAQ,WAAW;AAYhD,QATe,uCAFF,qCAAe,UAAU,QAAQ,EAER,UAAU;EAC9C,UAAU,CACR,GAAGC,4BACH,GAAGA,2BAAe,KAAK,QAAQ,QAAQ,MAAM,CAC9C;EACD,QAAQ;EACR,SAAS,CAAC,mBAAmB,eAAe,CAAC;EAC9C,CAAC,IAEe"}