@intlayer/chokidar 6.0.0-canary.3 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/dist/cjs/chokidar/watcher.cjs +4 -4
  2. package/dist/cjs/chokidar/watcher.cjs.map +1 -1
  3. package/dist/cjs/fetchDistantDictionaries.cjs +3 -25
  4. package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
  5. package/dist/cjs/index.cjs +2 -5
  6. package/dist/cjs/index.cjs.map +1 -1
  7. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +1 -1
  8. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
  9. package/dist/cjs/loadDictionaries/loadDictionaries.cjs +19 -21
  10. package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
  11. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +13 -4
  12. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
  13. package/dist/cjs/loadDictionaries/log.cjs +47 -12
  14. package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
  15. package/dist/cjs/prepareIntlayer.cjs +52 -9
  16. package/dist/cjs/prepareIntlayer.cjs.map +1 -1
  17. package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs +5 -1
  18. package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs.map +1 -1
  19. package/dist/cjs/transpiler/dictionary_to_type/createModuleAugmentation.cjs +3 -1
  20. package/dist/cjs/transpiler/dictionary_to_type/createModuleAugmentation.cjs.map +1 -1
  21. package/dist/cjs/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/buildIntlayerDictionary.cjs +3 -3
  22. package/dist/cjs/transpiler/intlayer_dictionary/buildIntlayerDictionary.cjs.map +1 -0
  23. package/dist/cjs/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/index.cjs +3 -3
  24. package/dist/cjs/transpiler/intlayer_dictionary/index.cjs.map +1 -0
  25. package/dist/cjs/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/processContentDeclaration.cjs +1 -1
  26. package/dist/cjs/transpiler/intlayer_dictionary/processContentDeclaration.cjs.map +1 -0
  27. package/dist/cjs/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeDynamicDictionary.cjs +19 -10
  28. package/dist/cjs/transpiler/intlayer_dictionary/writeDynamicDictionary.cjs.map +1 -0
  29. package/dist/cjs/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeFetchDictionary.cjs +9 -3
  30. package/dist/cjs/transpiler/intlayer_dictionary/writeFetchDictionary.cjs.map +1 -0
  31. package/dist/cjs/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeMergedDictionary.cjs +12 -8
  32. package/dist/cjs/transpiler/intlayer_dictionary/writeMergedDictionary.cjs.map +1 -0
  33. package/dist/cjs/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeRemoteDictionary.cjs +9 -7
  34. package/dist/cjs/transpiler/intlayer_dictionary/writeRemoteDictionary.cjs.map +1 -0
  35. package/dist/cjs/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeUnmergedDictionary.cjs +12 -8
  36. package/dist/cjs/transpiler/intlayer_dictionary/writeUnmergedDictionary.cjs.map +1 -0
  37. package/dist/cjs/writeConfiguration/index.cjs +5 -6
  38. package/dist/cjs/writeConfiguration/index.cjs.map +1 -1
  39. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +1 -5
  40. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
  41. package/dist/cjs/writeFileIfChanged.cjs +46 -0
  42. package/dist/cjs/writeFileIfChanged.cjs.map +1 -0
  43. package/dist/cjs/{transpiler/declaration_file_to_dictionary/i18next_dictionary/convertPluralsValues.cjs → writeJsonIfChanged.cjs} +11 -14
  44. package/dist/cjs/writeJsonIfChanged.cjs.map +1 -0
  45. package/dist/esm/chokidar/watcher.mjs +1 -1
  46. package/dist/esm/chokidar/watcher.mjs.map +1 -1
  47. package/dist/esm/fetchDistantDictionaries.mjs +5 -32
  48. package/dist/esm/fetchDistantDictionaries.mjs.map +1 -1
  49. package/dist/esm/index.mjs +1 -3
  50. package/dist/esm/index.mjs.map +1 -1
  51. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +1 -1
  52. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -1
  53. package/dist/esm/loadDictionaries/loadDictionaries.mjs +19 -21
  54. package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
  55. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs +14 -5
  56. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -1
  57. package/dist/esm/loadDictionaries/log.mjs +50 -13
  58. package/dist/esm/loadDictionaries/log.mjs.map +1 -1
  59. package/dist/esm/prepareIntlayer.mjs +53 -8
  60. package/dist/esm/prepareIntlayer.mjs.map +1 -1
  61. package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs +6 -2
  62. package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs.map +1 -1
  63. package/dist/esm/transpiler/dictionary_to_type/createModuleAugmentation.mjs +4 -2
  64. package/dist/esm/transpiler/dictionary_to_type/createModuleAugmentation.mjs.map +1 -1
  65. package/dist/esm/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/buildIntlayerDictionary.mjs +2 -2
  66. package/dist/esm/transpiler/intlayer_dictionary/buildIntlayerDictionary.mjs.map +1 -0
  67. package/dist/esm/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/index.mjs +1 -1
  68. package/dist/esm/transpiler/intlayer_dictionary/index.mjs.map +1 -0
  69. package/dist/esm/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/processContentDeclaration.mjs +1 -1
  70. package/dist/esm/transpiler/intlayer_dictionary/processContentDeclaration.mjs.map +1 -0
  71. package/dist/esm/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeDynamicDictionary.mjs +25 -12
  72. package/dist/esm/transpiler/intlayer_dictionary/writeDynamicDictionary.mjs.map +1 -0
  73. package/dist/esm/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeFetchDictionary.mjs +15 -5
  74. package/dist/esm/transpiler/intlayer_dictionary/writeFetchDictionary.mjs.map +1 -0
  75. package/dist/esm/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeMergedDictionary.mjs +14 -10
  76. package/dist/esm/transpiler/intlayer_dictionary/writeMergedDictionary.mjs.map +1 -0
  77. package/dist/esm/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeRemoteDictionary.mjs +11 -9
  78. package/dist/esm/transpiler/intlayer_dictionary/writeRemoteDictionary.mjs.map +1 -0
  79. package/dist/esm/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeUnmergedDictionary.mjs +14 -10
  80. package/dist/esm/transpiler/intlayer_dictionary/writeUnmergedDictionary.mjs.map +1 -0
  81. package/dist/esm/writeConfiguration/index.mjs +5 -6
  82. package/dist/esm/writeConfiguration/index.mjs.map +1 -1
  83. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +1 -5
  84. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
  85. package/dist/esm/writeFileIfChanged.mjs +22 -0
  86. package/dist/esm/writeFileIfChanged.mjs.map +1 -0
  87. package/dist/esm/writeJsonIfChanged.mjs +10 -0
  88. package/dist/esm/writeJsonIfChanged.mjs.map +1 -0
  89. package/dist/types/fetchDistantDictionaries.d.ts.map +1 -1
  90. package/dist/types/index.d.ts +1 -2
  91. package/dist/types/index.d.ts.map +1 -1
  92. package/dist/types/loadDictionaries/loadDictionaries.d.ts +4 -0
  93. package/dist/types/loadDictionaries/loadDictionaries.d.ts.map +1 -1
  94. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +5 -1
  95. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -1
  96. package/dist/types/loadDictionaries/log.d.ts +7 -0
  97. package/dist/types/loadDictionaries/log.d.ts.map +1 -1
  98. package/dist/types/prepareIntlayer.d.ts.map +1 -1
  99. package/dist/types/transpiler/dictionary_to_main/createDictionaryEntryPoint.d.ts.map +1 -1
  100. package/dist/types/transpiler/dictionary_to_type/createModuleAugmentation.d.ts.map +1 -1
  101. package/dist/types/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/buildIntlayerDictionary.d.ts +1 -1
  102. package/dist/types/transpiler/intlayer_dictionary/buildIntlayerDictionary.d.ts.map +1 -0
  103. package/dist/types/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/index.d.ts +1 -1
  104. package/dist/types/transpiler/intlayer_dictionary/index.d.ts.map +1 -0
  105. package/dist/types/transpiler/intlayer_dictionary/processContentDeclaration.d.ts.map +1 -0
  106. package/dist/types/transpiler/intlayer_dictionary/writeDynamicDictionary.d.ts.map +1 -0
  107. package/dist/types/transpiler/intlayer_dictionary/writeFetchDictionary.d.ts.map +1 -0
  108. package/dist/types/transpiler/intlayer_dictionary/writeMergedDictionary.d.ts.map +1 -0
  109. package/dist/types/transpiler/intlayer_dictionary/writeRemoteDictionary.d.ts.map +1 -0
  110. package/dist/types/transpiler/intlayer_dictionary/writeUnmergedDictionary.d.ts.map +1 -0
  111. package/dist/types/writeConfiguration/index.d.ts +1 -1
  112. package/dist/types/writeConfiguration/index.d.ts.map +1 -1
  113. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -1
  114. package/dist/types/writeFileIfChanged.d.ts +4 -0
  115. package/dist/types/writeFileIfChanged.d.ts.map +1 -0
  116. package/dist/types/writeJsonIfChanged.d.ts +4 -0
  117. package/dist/types/writeJsonIfChanged.d.ts.map +1 -0
  118. package/package.json +15 -15
  119. package/dist/cjs/fetchDistantDictionaryKeysAndUpdateTimestamp.cjs +0 -45
  120. package/dist/cjs/fetchDistantDictionaryKeysAndUpdateTimestamp.cjs.map +0 -1
  121. package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/buildI18nextDictionary.cjs +0 -46
  122. package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/buildI18nextDictionary.cjs.map +0 -1
  123. package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertContentDeclarationInto18nDictionaries.cjs +0 -103
  124. package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertContentDeclarationInto18nDictionaries.cjs.map +0 -1
  125. package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertPluralsValues.cjs.map +0 -1
  126. package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.cjs +0 -23
  127. package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.cjs.map +0 -1
  128. package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.cjs +0 -51
  129. package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.cjs.map +0 -1
  130. package/dist/cjs/transpiler/declaration_file_to_dictionary/index.cjs +0 -40
  131. package/dist/cjs/transpiler/declaration_file_to_dictionary/index.cjs.map +0 -1
  132. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.cjs.map +0 -1
  133. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.cjs +0 -30
  134. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.cjs.map +0 -1
  135. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/index.cjs.map +0 -1
  136. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.cjs.map +0 -1
  137. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.cjs.map +0 -1
  138. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.cjs.map +0 -1
  139. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.cjs.map +0 -1
  140. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.cjs.map +0 -1
  141. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.cjs.map +0 -1
  142. package/dist/cjs/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.cjs +0 -52
  143. package/dist/cjs/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.cjs.map +0 -1
  144. package/dist/esm/fetchDistantDictionaryKeysAndUpdateTimestamp.mjs +0 -21
  145. package/dist/esm/fetchDistantDictionaryKeysAndUpdateTimestamp.mjs.map +0 -1
  146. package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/buildI18nextDictionary.mjs +0 -24
  147. package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/buildI18nextDictionary.mjs.map +0 -1
  148. package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertContentDeclarationInto18nDictionaries.mjs +0 -81
  149. package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertContentDeclarationInto18nDictionaries.mjs.map +0 -1
  150. package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertPluralsValues.mjs +0 -13
  151. package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertPluralsValues.mjs.map +0 -1
  152. package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.mjs +0 -2
  153. package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.mjs.map +0 -1
  154. package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.mjs +0 -27
  155. package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.mjs.map +0 -1
  156. package/dist/esm/transpiler/declaration_file_to_dictionary/index.mjs +0 -16
  157. package/dist/esm/transpiler/declaration_file_to_dictionary/index.mjs.map +0 -1
  158. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.mjs.map +0 -1
  159. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.mjs +0 -6
  160. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.mjs.map +0 -1
  161. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/index.mjs.map +0 -1
  162. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.mjs.map +0 -1
  163. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.mjs.map +0 -1
  164. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.mjs.map +0 -1
  165. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.mjs.map +0 -1
  166. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.mjs.map +0 -1
  167. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.mjs.map +0 -1
  168. package/dist/esm/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.mjs +0 -28
  169. package/dist/esm/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.mjs.map +0 -1
  170. package/dist/types/fetchDistantDictionaryKeysAndUpdateTimestamp.d.ts +0 -3
  171. package/dist/types/fetchDistantDictionaryKeysAndUpdateTimestamp.d.ts.map +0 -1
  172. package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/buildI18nextDictionary.d.ts +0 -6
  173. package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/buildI18nextDictionary.d.ts.map +0 -1
  174. package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertContentDeclarationInto18nDictionaries.d.ts +0 -7
  175. package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertContentDeclarationInto18nDictionaries.d.ts.map +0 -1
  176. package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertPluralsValues.d.ts +0 -2
  177. package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertPluralsValues.d.ts.map +0 -1
  178. package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.d.ts +0 -2
  179. package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.d.ts.map +0 -1
  180. package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.d.ts +0 -7
  181. package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.d.ts.map +0 -1
  182. package/dist/types/transpiler/declaration_file_to_dictionary/index.d.ts +0 -8
  183. package/dist/types/transpiler/declaration_file_to_dictionary/index.d.ts.map +0 -1
  184. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.d.ts.map +0 -1
  185. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.d.ts +0 -2
  186. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.d.ts.map +0 -1
  187. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/index.d.ts.map +0 -1
  188. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.d.ts.map +0 -1
  189. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.d.ts.map +0 -1
  190. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.d.ts.map +0 -1
  191. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.d.ts.map +0 -1
  192. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.d.ts.map +0 -1
  193. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.d.ts.map +0 -1
  194. package/dist/types/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.d.ts +0 -7
  195. package/dist/types/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.d.ts.map +0 -1
  196. /package/dist/types/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/processContentDeclaration.d.ts +0 -0
  197. /package/dist/types/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeDynamicDictionary.d.ts +0 -0
  198. /package/dist/types/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeFetchDictionary.d.ts +0 -0
  199. /package/dist/types/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeMergedDictionary.d.ts +0 -0
  200. /package/dist/types/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeRemoteDictionary.d.ts +0 -0
  201. /package/dist/types/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeUnmergedDictionary.d.ts +0 -0
@@ -1,46 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var buildI18nextDictionary_exports = {};
20
- __export(buildI18nextDictionary_exports, {
21
- buildI18nDictionary: () => buildI18nDictionary
22
- });
23
- module.exports = __toCommonJS(buildI18nextDictionary_exports);
24
- var import_config = require("@intlayer/config");
25
- var import_convertContentDeclarationInto18nDictionaries = require('./convertContentDeclarationInto18nDictionaries.cjs');
26
- var import_writeDictionary = require('./writeDictionary.cjs');
27
- const buildI18nDictionary = async (contentDeclarations, configuration = (0, import_config.getConfiguration)()) => {
28
- const dictionariesDeclaration = contentDeclarations.reduce((acc, dictionary) => {
29
- const { key, content } = dictionary;
30
- const i18Content = (0, import_convertContentDeclarationInto18nDictionaries.createI18nextDictionaries)(content, configuration);
31
- return {
32
- ...acc,
33
- [key]: i18Content
34
- };
35
- }, {});
36
- const dictionariesPaths = await (0, import_writeDictionary.writeDictionary)(
37
- dictionariesDeclaration,
38
- configuration
39
- );
40
- return dictionariesPaths;
41
- };
42
- // Annotate the CommonJS export names for ESM import in node:
43
- 0 && (module.exports = {
44
- buildI18nDictionary
45
- });
46
- //# sourceMappingURL=buildI18nextDictionary.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18next_dictionary/buildI18nextDictionary.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { createI18nextDictionaries } from './convertContentDeclarationInto18nDictionaries';\nimport {\n writeDictionary,\n type DictionariesDeclaration,\n} from './writeDictionary';\n\n/**\n * This function transpile content declaration to i18n dictionaries\n */\nexport const buildI18nDictionary = async (\n contentDeclarations: Dictionary[],\n configuration = getConfiguration()\n) => {\n // Create dictionaries for each nested content and format them\n const dictionariesDeclaration: DictionariesDeclaration =\n contentDeclarations.reduce((acc, dictionary) => {\n const { key, content } = dictionary;\n const i18Content = createI18nextDictionaries(content, configuration);\n\n return {\n ...acc,\n [key]: i18Content,\n };\n }, {});\n\n // Write the dictionaries to the file system\n const dictionariesPaths: string[] = await writeDictionary(\n dictionariesDeclaration,\n configuration\n );\n\n return dictionariesPaths;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiC;AAEjC,0DAA0C;AAC1C,6BAGO;AAKA,MAAM,sBAAsB,OACjC,qBACA,oBAAgB,gCAAiB,MAC9B;AAEH,QAAM,0BACJ,oBAAoB,OAAO,CAAC,KAAK,eAAe;AAC9C,UAAM,EAAE,KAAK,QAAQ,IAAI;AACzB,UAAM,iBAAa,+EAA0B,SAAS,aAAa;AAEnE,WAAO;AAAA,MACL,GAAG;AAAA,MACH,CAAC,GAAG,GAAG;AAAA,IACT;AAAA,EACF,GAAG,CAAC,CAAC;AAGP,QAAM,oBAA8B,UAAM;AAAA,IACxC;AAAA,IACA;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -1,103 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var convertContentDeclarationInto18nDictionaries_exports = {};
20
- __export(convertContentDeclarationInto18nDictionaries_exports, {
21
- createI18nextDictionaries: () => createI18nextDictionaries
22
- });
23
- module.exports = __toCommonJS(convertContentDeclarationInto18nDictionaries_exports);
24
- var import_config = require("@intlayer/config");
25
- var import_core = require("@intlayer/core");
26
- var import_convertPluralsValues = require('./convertPluralsValues.cjs');
27
- const isReactNode = (node) => typeof node?.key !== "undefined" && typeof node?.props !== "undefined" && typeof node?.type !== "undefined";
28
- const buildDictionary = (content, locale) => {
29
- if (
30
- // Translation node
31
- content && content.nodeType === import_core.NodeType.Translation
32
- ) {
33
- const contentState = content[import_core.NodeType.Translation];
34
- const result = contentState[locale];
35
- return buildDictionary(result, locale);
36
- } else if (
37
- // Translation node
38
- content && content.nodeType === import_core.NodeType.Enumeration
39
- ) {
40
- const plurals = {};
41
- Object.keys(
42
- content[import_core.NodeType.Enumeration]
43
- ).forEach((quantity) => {
44
- const letterNumber = (0, import_convertPluralsValues.convertPluralsValues)(quantity);
45
- const value = content[quantity];
46
- plurals[`${letterNumber}_${letterNumber}`] = buildDictionary(
47
- value,
48
- locale
49
- );
50
- });
51
- return plurals;
52
- } else if (
53
- // React element node
54
- isReactNode(content)
55
- ) {
56
- return JSON.stringify(content);
57
- } else if (
58
- // Nested object
59
- typeof content === "object" && Array.isArray(content)
60
- ) {
61
- const result = [];
62
- Object.keys(content).forEach((dictionaryValue) => {
63
- result.push(
64
- buildDictionary(
65
- content[dictionaryValue],
66
- locale
67
- )
68
- );
69
- });
70
- return result;
71
- } else if (
72
- // Nested object
73
- typeof content === "object"
74
- ) {
75
- const result = {};
76
- Object.keys(content).forEach(
77
- (dictionaryValue) => {
78
- result[dictionaryValue] = buildDictionary(
79
- content?.[dictionaryValue],
80
- locale
81
- );
82
- }
83
- );
84
- return result;
85
- }
86
- return content;
87
- };
88
- const createI18nextDictionaries = (content, configuration = (0, import_config.getConfiguration)()) => {
89
- const { locales } = configuration.internationalization;
90
- const result = locales.reduce(
91
- (acc, locale) => ({
92
- ...acc,
93
- [locale]: buildDictionary(content, locale)
94
- }),
95
- {}
96
- );
97
- return result;
98
- };
99
- // Annotate the CommonJS export names for ESM import in node:
100
- 0 && (module.exports = {
101
- createI18nextDictionaries
102
- });
103
- //# sourceMappingURL=convertContentDeclarationInto18nDictionaries.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertContentDeclarationInto18nDictionaries.ts"],"sourcesContent":["import { getConfiguration, type Locales } from '@intlayer/config';\nimport {\n NodeType,\n type TranslationContent,\n type EnumerationContent,\n type TypedNode,\n type ContentNode,\n} from '@intlayer/core';\nimport { convertPluralsValues } from './convertPluralsValues';\n\ntype Dictionary = Record<string, unknown>;\nexport type I18nextDictionariesOutput = Partial<Record<Locales, Dictionary>>;\n\nconst isReactNode = (node: Record<string, unknown>): boolean =>\n typeof node?.key !== 'undefined' &&\n typeof node?.props !== 'undefined' &&\n typeof node?.type !== 'undefined';\n\n// Build dictionary for a specific locale\nconst buildDictionary = (content: ContentNode, locale: Locales): unknown => {\n if (\n // Translation node\n content &&\n (content as TypedNode).nodeType === NodeType.Translation\n ) {\n const contentState = (content as TranslationContent)[NodeType.Translation];\n const result = contentState[locale as keyof typeof contentState];\n\n return buildDictionary(result as ContentNode, locale);\n } else if (\n // Translation node\n content &&\n (content as TypedNode).nodeType === NodeType.Enumeration\n ) {\n const plurals: Record<string, unknown> = {};\n\n Object.keys(\n (content as EnumerationContent<unknown>)[NodeType.Enumeration]\n ).forEach((quantity) => {\n const letterNumber = convertPluralsValues(quantity);\n\n const value = (content as EnumerationContent<unknown>)[\n quantity as keyof EnumerationContent<unknown>\n ];\n\n plurals[`${letterNumber}_${letterNumber}`] = buildDictionary(\n value as ContentNode,\n locale\n );\n });\n\n return plurals;\n } else if (\n // React element node\n isReactNode(content as Record<string, unknown>)\n ) {\n return JSON.stringify(content);\n } else if (\n // Nested object\n typeof content === 'object' &&\n Array.isArray(content)\n ) {\n const result: unknown[] = [];\n\n Object.keys(content).forEach((dictionaryValue) => {\n result.push(\n buildDictionary(\n content[dictionaryValue as keyof typeof content] as ContentNode,\n locale\n )\n );\n });\n\n return result;\n } else if (\n // Nested object\n typeof content === 'object'\n ) {\n const result: Record<string, unknown> = {};\n\n Object.keys(content as Record<string, unknown>).forEach(\n (dictionaryValue) => {\n result[dictionaryValue] = buildDictionary(\n content?.[\n dictionaryValue as keyof typeof content\n ] as unknown as ContentNode,\n locale\n );\n }\n );\n\n return result;\n }\n\n return content;\n};\n\nexport const createI18nextDictionaries = (\n content: ContentNode,\n configuration = getConfiguration()\n): I18nextDictionariesOutput => {\n const { locales } = configuration.internationalization;\n\n // Map dictionaries for each locale\n const result: I18nextDictionariesOutput = locales.reduce(\n (acc, locale) => ({\n ...acc,\n [locale]: buildDictionary(content, locale),\n }),\n {}\n );\n\n return result;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA+C;AAC/C,kBAMO;AACP,kCAAqC;AAKrC,MAAM,cAAc,CAAC,SACnB,OAAO,MAAM,QAAQ,eACrB,OAAO,MAAM,UAAU,eACvB,OAAO,MAAM,SAAS;AAGxB,MAAM,kBAAkB,CAAC,SAAsB,WAA6B;AAC1E;AAAA;AAAA,IAEE,WACC,QAAsB,aAAa,qBAAS;AAAA,IAC7C;AACA,UAAM,eAAgB,QAA+B,qBAAS,WAAW;AACzE,UAAM,SAAS,aAAa,MAAmC;AAE/D,WAAO,gBAAgB,QAAuB,MAAM;AAAA,EACtD;AAAA;AAAA,IAEE,WACC,QAAsB,aAAa,qBAAS;AAAA,IAC7C;AACA,UAAM,UAAmC,CAAC;AAE1C,WAAO;AAAA,MACJ,QAAwC,qBAAS,WAAW;AAAA,IAC/D,EAAE,QAAQ,CAAC,aAAa;AACtB,YAAM,mBAAe,kDAAqB,QAAQ;AAElD,YAAM,QAAS,QACb,QACF;AAEA,cAAQ,GAAG,YAAY,IAAI,YAAY,EAAE,IAAI;AAAA,QAC3C;AAAA,QACA;AAAA,MACF;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT;AAAA;AAAA,IAEE,YAAY,OAAkC;AAAA,IAC9C;AACA,WAAO,KAAK,UAAU,OAAO;AAAA,EAC/B;AAAA;AAAA,IAEE,OAAO,YAAY,YACnB,MAAM,QAAQ,OAAO;AAAA,IACrB;AACA,UAAM,SAAoB,CAAC;AAE3B,WAAO,KAAK,OAAO,EAAE,QAAQ,CAAC,oBAAoB;AAChD,aAAO;AAAA,QACL;AAAA,UACE,QAAQ,eAAuC;AAAA,UAC/C;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT;AAAA;AAAA,IAEE,OAAO,YAAY;AAAA,IACnB;AACA,UAAM,SAAkC,CAAC;AAEzC,WAAO,KAAK,OAAkC,EAAE;AAAA,MAC9C,CAAC,oBAAoB;AACnB,eAAO,eAAe,IAAI;AAAA,UACxB,UACE,eACF;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEO,MAAM,4BAA4B,CACvC,SACA,oBAAgB,gCAAiB,MACH;AAC9B,QAAM,EAAE,QAAQ,IAAI,cAAc;AAGlC,QAAM,SAAoC,QAAQ;AAAA,IAChD,CAAC,KAAK,YAAY;AAAA,MAChB,GAAG;AAAA,MACH,CAAC,MAAM,GAAG,gBAAgB,SAAS,MAAM;AAAA,IAC3C;AAAA,IACA,CAAC;AAAA,EACH;AAEA,SAAO;AACT;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertPluralsValues.ts"],"sourcesContent":["export const convertPluralsValues = (number: string | number): string => {\n const numberValue = Number(number);\n\n if (numberValue === 0) return 'zero';\n else if (numberValue === 1) return 'singular';\n else if (numberValue === 2) return 'two';\n else if (numberValue <= 7) return 'few';\n else if (numberValue <= 99) return 'many';\n else return 'other';\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,uBAAuB,CAAC,WAAoC;AACvE,QAAM,cAAc,OAAO,MAAM;AAEjC,MAAI,gBAAgB,EAAG,QAAO;AAAA,WACrB,gBAAgB,EAAG,QAAO;AAAA,WAC1B,gBAAgB,EAAG,QAAO;AAAA,WAC1B,eAAe,EAAG,QAAO;AAAA,WACzB,eAAe,GAAI,QAAO;AAAA,MAC9B,QAAO;AACd;","names":[]}
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
- var i18next_dictionary_exports = {};
17
- module.exports = __toCommonJS(i18next_dictionary_exports);
18
- __reExport(i18next_dictionary_exports, require('./buildI18nextDictionary.cjs'), module.exports);
19
- // Annotate the CommonJS export names for ESM import in node:
20
- 0 && (module.exports = {
21
- ...require('./buildI18nextDictionary.cjs')
22
- });
23
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.ts"],"sourcesContent":["export * from './buildI18nextDictionary';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,uCAAc,qCAAd;","names":[]}
@@ -1,51 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var writeDictionary_exports = {};
20
- __export(writeDictionary_exports, {
21
- writeDictionary: () => writeDictionary
22
- });
23
- module.exports = __toCommonJS(writeDictionary_exports);
24
- var import_config = require("@intlayer/config");
25
- var import_promises = require("fs/promises");
26
- var import_path = require("path");
27
- const writeDictionary = async (dictionariesDeclaration, configuration = (0, import_config.getConfiguration)()) => {
28
- const { i18nextResourcesDir } = configuration.content;
29
- const resultDictionariesPaths = [];
30
- for (const [nameSpace, localContent] of Object.entries(
31
- dictionariesDeclaration
32
- )) {
33
- for await (const [locale, content] of Object.entries(localContent)) {
34
- const contentString = JSON.stringify(content);
35
- const outputFileName = `${nameSpace}.json`;
36
- const dictionariesDirPath = (0, import_path.resolve)(i18nextResourcesDir, locale);
37
- const resultFilePath = (0, import_path.resolve)(dictionariesDirPath, outputFileName);
38
- await (0, import_promises.mkdir)(dictionariesDirPath, { recursive: true });
39
- await (0, import_promises.writeFile)(resultFilePath, contentString, "utf8").catch((err) => {
40
- console.error(`Error creating ${outputFileName}:`, err);
41
- });
42
- resultDictionariesPaths.push(resultFilePath);
43
- }
44
- }
45
- return resultDictionariesPaths;
46
- };
47
- // Annotate the CommonJS export names for ESM import in node:
48
- 0 && (module.exports = {
49
- writeDictionary
50
- });
51
- //# sourceMappingURL=writeDictionary.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport { mkdir, writeFile } from 'fs/promises';\nimport { resolve } from 'path';\nimport type { I18nextDictionariesOutput } from './convertContentDeclarationInto18nDictionaries';\n\nexport type DictionariesDeclaration = Record<string, I18nextDictionariesOutput>;\n\n/**\n * This function writes the dictionaries to the file system\n */\nexport const writeDictionary = async (\n dictionariesDeclaration: DictionariesDeclaration,\n configuration = getConfiguration()\n) => {\n const { i18nextResourcesDir } = configuration.content;\n\n const resultDictionariesPaths: string[] = [];\n\n for (const [nameSpace, localContent] of Object.entries(\n dictionariesDeclaration\n )) {\n for await (const [locale, content] of Object.entries(localContent)) {\n const contentString = JSON.stringify(content);\n\n const outputFileName = `${nameSpace}.json`;\n const dictionariesDirPath = resolve(i18nextResourcesDir, locale);\n const resultFilePath = resolve(dictionariesDirPath, outputFileName);\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(dictionariesDirPath, { recursive: true });\n\n // Create the json file\n await writeFile(resultFilePath, contentString, 'utf8').catch((err) => {\n console.error(`Error creating ${outputFileName}:`, err);\n });\n\n resultDictionariesPaths.push(resultFilePath);\n }\n }\n\n return resultDictionariesPaths;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiC;AACjC,sBAAiC;AACjC,kBAAwB;AAQjB,MAAM,kBAAkB,OAC7B,yBACA,oBAAgB,gCAAiB,MAC9B;AACH,QAAM,EAAE,oBAAoB,IAAI,cAAc;AAE9C,QAAM,0BAAoC,CAAC;AAE3C,aAAW,CAAC,WAAW,YAAY,KAAK,OAAO;AAAA,IAC7C;AAAA,EACF,GAAG;AACD,qBAAiB,CAAC,QAAQ,OAAO,KAAK,OAAO,QAAQ,YAAY,GAAG;AAClE,YAAM,gBAAgB,KAAK,UAAU,OAAO;AAE5C,YAAM,iBAAiB,GAAG,SAAS;AACnC,YAAM,0BAAsB,qBAAQ,qBAAqB,MAAM;AAC/D,YAAM,qBAAiB,qBAAQ,qBAAqB,cAAc;AAGlE,gBAAM,uBAAM,qBAAqB,EAAE,WAAW,KAAK,CAAC;AAGpD,gBAAM,2BAAU,gBAAgB,eAAe,MAAM,EAAE,MAAM,CAAC,QAAQ;AACpE,gBAAQ,MAAM,kBAAkB,cAAc,KAAK,GAAG;AAAA,MACxD,CAAC;AAED,8BAAwB,KAAK,cAAc;AAAA,IAC7C;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -1,40 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var declaration_file_to_dictionary_exports = {};
20
- __export(declaration_file_to_dictionary_exports, {
21
- buildDictionary: () => buildDictionary
22
- });
23
- module.exports = __toCommonJS(declaration_file_to_dictionary_exports);
24
- var import_config = require("@intlayer/config");
25
- var import_i18next_dictionary = require('./i18next_dictionary/index.cjs');
26
- var import_intlayer_dictionary = require('./intlayer_dictionary/index.cjs');
27
- const buildDictionary = async (dictionaries, configuration = (0, import_config.getConfiguration)()) => {
28
- const { dictionaryOutput } = configuration.content;
29
- if (dictionaryOutput.includes("i18next")) {
30
- await (0, import_i18next_dictionary.buildI18nDictionary)(dictionaries, configuration);
31
- }
32
- if (dictionaryOutput.includes("intlayer")) {
33
- return await (0, import_intlayer_dictionary.buildIntlayerDictionary)(dictionaries, configuration);
34
- }
35
- };
36
- // Annotate the CommonJS export names for ESM import in node:
37
- 0 && (module.exports = {
38
- buildDictionary
39
- });
40
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/transpiler/declaration_file_to_dictionary/index.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { buildI18nDictionary } from './i18next_dictionary/index';\nimport { buildIntlayerDictionary } from './intlayer_dictionary/index';\n\nexport const buildDictionary = async (\n dictionaries: Dictionary[],\n configuration = getConfiguration()\n) => {\n const { dictionaryOutput } = configuration.content;\n\n if (dictionaryOutput.includes('i18next')) {\n await buildI18nDictionary(dictionaries, configuration);\n }\n\n if (dictionaryOutput.includes('intlayer')) {\n return await buildIntlayerDictionary(dictionaries, configuration);\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiC;AAEjC,gCAAoC;AACpC,iCAAwC;AAEjC,MAAM,kBAAkB,OAC7B,cACA,oBAAgB,gCAAiB,MAC9B;AACH,QAAM,EAAE,iBAAiB,IAAI,cAAc;AAE3C,MAAI,iBAAiB,SAAS,SAAS,GAAG;AACxC,cAAM,+CAAoB,cAAc,aAAa;AAAA,EACvD;AAEA,MAAI,iBAAiB,SAAS,UAAU,GAAG;AACzC,WAAO,UAAM,oDAAwB,cAAc,aAAa;AAAA,EAClE;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.ts"],"sourcesContent":["// @ts-ignore: @intlayer/backend is not built yet\nimport { getConfiguration } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n LocalizedDictionaryOutput,\n writeDynamicDictionary,\n} from './writeDynamicDictionary';\nimport { writeFetchDictionary } from './writeFetchDictionary';\nimport { writeMergedDictionaries } from './writeMergedDictionary';\nimport { writeUnmergedDictionaries } from './writeUnmergedDictionary';\n\n/**\n * This function transpile the bundled code to to make dictionaries as JSON files\n */\nexport const buildIntlayerDictionary = async (\n localDictionariesEntries: Dictionary[],\n configuration = getConfiguration(),\n formats: ('cjs' | 'esm')[] = ['cjs', 'esm']\n) => {\n const { importMode } = configuration.build;\n\n const unmergedDictionaries = await writeUnmergedDictionaries(\n localDictionariesEntries,\n configuration\n );\n\n const mergedDictionaries = await writeMergedDictionaries(\n unmergedDictionaries,\n configuration\n );\n\n let dynamicDictionaries: LocalizedDictionaryOutput | null = null;\n\n if (importMode === 'dynamic' || importMode === 'live') {\n dynamicDictionaries = await writeDynamicDictionary(\n mergedDictionaries,\n configuration,\n formats\n );\n }\n\n let fetchDictionaries: LocalizedDictionaryOutput | null = null;\n\n if (importMode === 'live') {\n fetchDictionaries = await writeFetchDictionary(\n dynamicDictionaries!,\n configuration,\n formats\n );\n }\n\n return {\n unmergedDictionaries,\n mergedDictionaries,\n dynamicDictionaries,\n fetchDictionaries,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAiC;AAEjC,oCAGO;AACP,kCAAqC;AACrC,mCAAwC;AACxC,qCAA0C;AAKnC,MAAM,0BAA0B,OACrC,0BACA,oBAAgB,gCAAiB,GACjC,UAA6B,CAAC,OAAO,KAAK,MACvC;AACH,QAAM,EAAE,WAAW,IAAI,cAAc;AAErC,QAAM,uBAAuB,UAAM;AAAA,IACjC;AAAA,IACA;AAAA,EACF;AAEA,QAAM,qBAAqB,UAAM;AAAA,IAC/B;AAAA,IACA;AAAA,EACF;AAEA,MAAI,sBAAwD;AAE5D,MAAI,eAAe,aAAa,eAAe,QAAQ;AACrD,0BAAsB,UAAM;AAAA,MAC1B;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,MAAI,oBAAsD;AAE1D,MAAI,eAAe,QAAQ;AACzB,wBAAoB,UAAM;AAAA,MACxB;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var formatDictionaryText_exports = {};
20
- __export(formatDictionaryText_exports, {
21
- formatDictionaryText: () => formatDictionaryText
22
- });
23
- module.exports = __toCommonJS(formatDictionaryText_exports);
24
- const isDevelopment = process.env.NODE_ENV === "development";
25
- const formatDictionaryText = (dictionary) => isDevelopment ? JSON.stringify(dictionary, null, 2) : JSON.stringify(dictionary);
26
- // Annotate the CommonJS export names for ESM import in node:
27
- 0 && (module.exports = {
28
- formatDictionaryText
29
- });
30
- //# sourceMappingURL=formatDictionaryText.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.ts"],"sourcesContent":["const isDevelopment = process.env.NODE_ENV === 'development';\n\nexport const formatDictionaryText = (dictionary: object) =>\n isDevelopment\n ? JSON.stringify(dictionary, null, 2)\n : JSON.stringify(dictionary);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,gBAAgB,QAAQ,IAAI,aAAa;AAExC,MAAM,uBAAuB,CAAC,eACnC,gBACI,KAAK,UAAU,YAAY,MAAM,CAAC,IAClC,KAAK,UAAU,UAAU;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/index.ts"],"sourcesContent":["export * from './processContentDeclaration';\nexport * from './buildIntlayerDictionary';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wCAAc,wCAAd;AACA,wCAAc,sCADd;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.ts"],"sourcesContent":["import { logger } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport { resolveObjectPromises } from '../../../utils/resolveObjectPromises';\n\n/**\n * Function to load, process the module and return the Intlayer Dictionary from the module file\n */\nexport const processContentDeclaration = async (\n contentDeclaration: Dictionary\n): Promise<Dictionary | undefined> => {\n try {\n const content = (await resolveObjectPromises(\n contentDeclaration.content\n )) as Dictionary['content'];\n\n return {\n ...contentDeclaration,\n content,\n } as Dictionary;\n } catch (error) {\n logger(error, {\n level: 'error',\n });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AAEvB,mCAAsC;AAK/B,MAAM,4BAA4B,OACvC,uBACoC;AACpC,MAAI;AACF,UAAM,UAAW,UAAM;AAAA,MACrB,mBAAmB;AAAA,IACrB;AAEA,WAAO;AAAA,MACL,GAAG;AAAA,MACH;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,8BAAO,OAAO;AAAA,MACZ,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.ts"],"sourcesContent":["import { getConfiguration, Locales, normalizePath } from '@intlayer/config';\nimport { getLocalisedContent, type Dictionary } from '@intlayer/core';\nimport { mkdir, writeFile } from 'fs/promises';\nimport { relative, resolve } from 'path';\nimport { parallelize } from '../../../utils/parallelize';\nimport { formatDictionaryText } from './formatDictionaryText';\nimport { MergedDictionaryOutput } from './writeMergedDictionary';\n\nexport type DictionaryResult = {\n dictionaryPath: string;\n dictionary: Dictionary;\n};\n\nexport type LocalizedDictionaryResult = Partial<\n Record<Locales, DictionaryResult>\n>;\n\nexport type LocalizedDictionaryOutput = Record<\n string,\n LocalizedDictionaryResult\n>;\n\n/**\n * This function generates the content of the dictionary list file\n */\nexport const generateDictionaryEntryPoint = (\n localedDictionariesPathsRecord: LocalizedDictionaryResult,\n format: 'cjs' | 'esm' = 'esm',\n configuration = getConfiguration()\n): string => {\n const { dynamicDictionariesDir } = configuration.content;\n\n let content = '';\n\n // Format Dictionary Map - map locales to functions\n const formattedDictionaryMap: string = Object.entries(\n localedDictionariesPathsRecord\n )\n .map(([locale, dictionary]) => {\n const relativePath = normalizePath(\n relative(dynamicDictionariesDir, dictionary.dictionaryPath)\n );\n\n if (format === 'esm') {\n return ` '${locale}': () => import('./${relativePath}', { assert: { type: 'json' }}).then(mod => mod.default)`;\n }\n\n return ` '${locale}': () => Promise.resolve(require('./${relativePath}'))`;\n })\n .join(',\\n');\n\n content += `const content = {\\n${formattedDictionaryMap}\\n};\\n`;\n\n if (format === 'esm') content += `export default content;\\n`;\n if (format === 'cjs') content += `module.exports = content;\\n`;\n\n return content;\n};\n\n/**\n * Write the localized dictionaries to the dictionariesDir\n * @param mergedDictionaries - The merged dictionaries\n * @param configuration - The configuration\n * @returns The final dictionaries\n *\n * @example\n * ```ts\n * const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);\n * const finalDictionaries = await writeFinalDictionaries(unmergedDictionaries);\n * console.log(finalDictionaries);\n *\n * // .intlayer/dynamic_dictionaries/home.json\n * // { key: 'home', content: { ... } },\n * ```\n */\nexport const writeDynamicDictionary = async (\n mergedDictionaries: MergedDictionaryOutput,\n configuration = getConfiguration(),\n formats: ('cjs' | 'esm')[] = ['cjs', 'esm']\n): Promise<LocalizedDictionaryOutput> => {\n const { locales, defaultLocale } = configuration.internationalization;\n const { dynamicDictionariesDir } = configuration.content;\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resolve(dynamicDictionariesDir), { recursive: true });\n\n let resultDictionariesPaths: LocalizedDictionaryOutput = {};\n\n // Merge dictionaries with the same key and write to dictionariesDir\n await parallelize(\n Object.entries(mergedDictionaries),\n async ([key, dictionaryEntry]) => {\n if (key === 'undefined') return;\n\n let localedDictionariesPathsRecord: LocalizedDictionaryResult = {};\n\n await parallelize(locales, async (locale) => {\n const localizedDictionary = {\n ...dictionaryEntry.dictionary,\n locale,\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n content: getLocalisedContent(\n JSON.parse(JSON.stringify(dictionaryEntry.dictionary.content)),\n locale,\n { dictionaryKey: key, keyPath: [] },\n defaultLocale\n ) as any,\n };\n\n const contentString = formatDictionaryText(localizedDictionary);\n\n const outputFileName = `${key}.${locale}.json`;\n const resultFilePath = resolve(dynamicDictionariesDir, outputFileName);\n\n // Write the localized dictionary\n await writeFile(resultFilePath, contentString, 'utf8').catch((err) => {\n console.error(`Error creating localized ${outputFileName}:`, err);\n });\n\n localedDictionariesPathsRecord[locale] = {\n dictionaryPath: resultFilePath,\n dictionary: localizedDictionary,\n };\n });\n\n resultDictionariesPaths[key] = localedDictionariesPathsRecord;\n\n await parallelize(formats, async (format) => {\n const extension = format === 'cjs' ? 'cjs' : 'mjs';\n const content = generateDictionaryEntryPoint(\n localedDictionariesPathsRecord,\n format,\n configuration\n );\n\n await writeFile(\n resolve(dynamicDictionariesDir, `${key}.${extension}`),\n content\n );\n });\n }\n );\n\n return resultDictionariesPaths;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAyD;AACzD,kBAAqD;AACrD,sBAAiC;AACjC,kBAAkC;AAClC,yBAA4B;AAC5B,kCAAqC;AAoB9B,MAAM,+BAA+B,CAC1C,gCACA,SAAwB,OACxB,oBAAgB,gCAAiB,MACtB;AACX,QAAM,EAAE,uBAAuB,IAAI,cAAc;AAEjD,MAAI,UAAU;AAGd,QAAM,yBAAiC,OAAO;AAAA,IAC5C;AAAA,EACF,EACG,IAAI,CAAC,CAAC,QAAQ,UAAU,MAAM;AAC7B,UAAM,mBAAe;AAAA,UACnB,sBAAS,wBAAwB,WAAW,cAAc;AAAA,IAC5D;AAEA,QAAI,WAAW,OAAO;AACpB,aAAO,MAAM,MAAM,sBAAsB,YAAY;AAAA,IACvD;AAEA,WAAO,MAAM,MAAM,uCAAuC,YAAY;AAAA,EACxE,CAAC,EACA,KAAK,KAAK;AAEb,aAAW;AAAA,EAAsB,sBAAsB;AAAA;AAAA;AAEvD,MAAI,WAAW,MAAO,YAAW;AAAA;AACjC,MAAI,WAAW,MAAO,YAAW;AAAA;AAEjC,SAAO;AACT;AAkBO,MAAM,yBAAyB,OACpC,oBACA,oBAAgB,gCAAiB,GACjC,UAA6B,CAAC,OAAO,KAAK,MACH;AACvC,QAAM,EAAE,SAAS,cAAc,IAAI,cAAc;AACjD,QAAM,EAAE,uBAAuB,IAAI,cAAc;AAGjD,YAAM,2BAAM,qBAAQ,sBAAsB,GAAG,EAAE,WAAW,KAAK,CAAC;AAEhE,MAAI,0BAAqD,CAAC;AAG1D,YAAM;AAAA,IACJ,OAAO,QAAQ,kBAAkB;AAAA,IACjC,OAAO,CAAC,KAAK,eAAe,MAAM;AAChC,UAAI,QAAQ,YAAa;AAEzB,UAAI,iCAA4D,CAAC;AAEjE,gBAAM,gCAAY,SAAS,OAAO,WAAW;AAC3C,cAAM,sBAAsB;AAAA,UAC1B,GAAG,gBAAgB;AAAA,UACnB;AAAA;AAAA,UAEA,aAAS;AAAA,YACP,KAAK,MAAM,KAAK,UAAU,gBAAgB,WAAW,OAAO,CAAC;AAAA,YAC7D;AAAA,YACA,EAAE,eAAe,KAAK,SAAS,CAAC,EAAE;AAAA,YAClC;AAAA,UACF;AAAA,QACF;AAEA,cAAM,oBAAgB,kDAAqB,mBAAmB;AAE9D,cAAM,iBAAiB,GAAG,GAAG,IAAI,MAAM;AACvC,cAAM,qBAAiB,qBAAQ,wBAAwB,cAAc;AAGrE,kBAAM,2BAAU,gBAAgB,eAAe,MAAM,EAAE,MAAM,CAAC,QAAQ;AACpE,kBAAQ,MAAM,4BAA4B,cAAc,KAAK,GAAG;AAAA,QAClE,CAAC;AAED,uCAA+B,MAAM,IAAI;AAAA,UACvC,gBAAgB;AAAA,UAChB,YAAY;AAAA,QACd;AAAA,MACF,CAAC;AAED,8BAAwB,GAAG,IAAI;AAE/B,gBAAM,gCAAY,SAAS,OAAO,WAAW;AAC3C,cAAM,YAAY,WAAW,QAAQ,QAAQ;AAC7C,cAAM,UAAU;AAAA,UACd;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAEA,kBAAM;AAAA,cACJ,qBAAQ,wBAAwB,GAAG,GAAG,IAAI,SAAS,EAAE;AAAA,UACrD;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.ts"],"sourcesContent":["import { getConfiguration, normalizePath } from '@intlayer/config';\nimport { mkdir, writeFile } from 'fs/promises';\nimport { relative, resolve } from 'path';\nimport { parallelize } from '../../../utils/parallelize';\nimport type {\n LocalizedDictionaryOutput,\n LocalizedDictionaryResult,\n} from './writeDynamicDictionary';\n\n/**\n * This function generates the content of the dictionary list file\n */\nexport const generateDictionaryEntryPoint = (\n localedDictionariesPathsRecord: LocalizedDictionaryResult,\n format: 'cjs' | 'esm' = 'esm',\n configuration = getConfiguration()\n): string => {\n const { fetchDictionariesDir } = configuration.content;\n const { liveSyncURL } = configuration.editor;\n\n let content = '';\n\n const formattedDictionaryMap: string = Object.entries(\n localedDictionariesPathsRecord\n )\n .map(([locale, dictionary]) => {\n const relativePath = normalizePath(\n relative(fetchDictionariesDir, dictionary.dictionaryPath)\n );\n\n if (format === 'esm') {\n return ` '${locale}': () => (async () => { try {return await fetch('${liveSyncURL}/dictionaries/${dictionary.dictionary.key}/${locale}').then(res => res.json())} catch (_error) {return await import('./${relativePath}', { assert: { type: 'json' }}).then(mod => mod.default)}})()`;\n }\n\n return ` '${locale}': () => (async () => { try {return await fetch('${liveSyncURL}/dictionaries/${dictionary.dictionary.key}/${locale}').then(res => res.json())} catch (_error) {return Promise.resolve(require('./${relativePath}'))}})()`;\n })\n .join(',\\n');\n\n content += `const content = {\\n${formattedDictionaryMap}\\n};\\n`;\n\n if (format === 'esm') content += `export default content;\\n`;\n if (format === 'cjs') content += `module.exports = content;\\n`;\n\n return content;\n};\n\n/**\n * Write the localized dictionaries to the dictionariesDir\n * @param mergedDictionaries - The merged dictionaries\n * @param configuration - The configuration\n * @returns The final dictionaries\n *\n * @example\n * ```ts\n * const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);\n * const finalDictionaries = await writeFinalDictionaries(unmergedDictionaries);\n * console.log(finalDictionaries);\n *\n * // .intlayer/fetch_dictionaries/home.json\n * // { key: 'home', content: { ... } },\n * ```\n */\nexport const writeFetchDictionary = async (\n dynamicDictionaries: LocalizedDictionaryOutput,\n configuration = getConfiguration(),\n formats: ('cjs' | 'esm')[] = ['cjs', 'esm']\n): Promise<LocalizedDictionaryOutput> => {\n const { fetchDictionariesDir } = configuration.content;\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resolve(fetchDictionariesDir), { recursive: true });\n\n let resultDictionariesPaths: LocalizedDictionaryOutput = {};\n\n // Write entry points for each dictionary in parallel\n await parallelize(\n Object.entries(dynamicDictionaries),\n async ([key, localedDictionariesPathsRecord]) => {\n if (key === 'undefined') return;\n\n await parallelize(formats, async (format) => {\n const extension = format === 'cjs' ? 'cjs' : 'mjs';\n const content = generateDictionaryEntryPoint(\n localedDictionariesPathsRecord,\n format,\n configuration\n );\n\n await writeFile(\n resolve(fetchDictionariesDir, `${key}.${extension}`),\n content\n );\n });\n }\n );\n\n return resultDictionariesPaths;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAgD;AAChD,sBAAiC;AACjC,kBAAkC;AAClC,yBAA4B;AASrB,MAAM,+BAA+B,CAC1C,gCACA,SAAwB,OACxB,oBAAgB,gCAAiB,MACtB;AACX,QAAM,EAAE,qBAAqB,IAAI,cAAc;AAC/C,QAAM,EAAE,YAAY,IAAI,cAAc;AAEtC,MAAI,UAAU;AAEd,QAAM,yBAAiC,OAAO;AAAA,IAC5C;AAAA,EACF,EACG,IAAI,CAAC,CAAC,QAAQ,UAAU,MAAM;AAC7B,UAAM,mBAAe;AAAA,UACnB,sBAAS,sBAAsB,WAAW,cAAc;AAAA,IAC1D;AAEA,QAAI,WAAW,OAAO;AACpB,aAAO,MAAM,MAAM,oDAAoD,WAAW,iBAAiB,WAAW,WAAW,GAAG,IAAI,MAAM,sEAAsE,YAAY;AAAA,IAC1N;AAEA,WAAO,MAAM,MAAM,oDAAoD,WAAW,iBAAiB,WAAW,WAAW,GAAG,IAAI,MAAM,iFAAiF,YAAY;AAAA,EACrO,CAAC,EACA,KAAK,KAAK;AAEb,aAAW;AAAA,EAAsB,sBAAsB;AAAA;AAAA;AAEvD,MAAI,WAAW,MAAO,YAAW;AAAA;AACjC,MAAI,WAAW,MAAO,YAAW;AAAA;AAEjC,SAAO;AACT;AAkBO,MAAM,uBAAuB,OAClC,qBACA,oBAAgB,gCAAiB,GACjC,UAA6B,CAAC,OAAO,KAAK,MACH;AACvC,QAAM,EAAE,qBAAqB,IAAI,cAAc;AAG/C,YAAM,2BAAM,qBAAQ,oBAAoB,GAAG,EAAE,WAAW,KAAK,CAAC;AAE9D,MAAI,0BAAqD,CAAC;AAG1D,YAAM;AAAA,IACJ,OAAO,QAAQ,mBAAmB;AAAA,IAClC,OAAO,CAAC,KAAK,8BAA8B,MAAM;AAC/C,UAAI,QAAQ,YAAa;AAEzB,gBAAM,gCAAY,SAAS,OAAO,WAAW;AAC3C,cAAM,YAAY,WAAW,QAAQ,QAAQ;AAC7C,cAAM,UAAU;AAAA,UACd;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAEA,kBAAM;AAAA,cACJ,qBAAQ,sBAAsB,GAAG,GAAG,IAAI,SAAS,EAAE;AAAA,UACnD;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { mkdir, writeFile } from 'fs/promises';\nimport { resolve } from 'path';\nimport { mergeDictionaries } from '../../../mergeDictionaries';\nimport { processPerLocaleDictionary } from '../../../processPerLocaleDictionary';\nimport { parallelize } from '../../../utils/parallelize';\nimport { formatDictionaryText } from './formatDictionaryText';\nimport { UnmergedDictionaryOutput } from './writeUnmergedDictionary';\n\nexport type MergedDictionaryResult = {\n dictionaryPath: string;\n dictionary: Dictionary;\n};\n\nexport type MergedDictionaryOutput = Record<string, MergedDictionaryResult>;\n\n/**\n * Write the merged dictionaries to the dictionariesDir\n * @param groupedDictionaries - The grouped dictionaries\n * @param configuration - The configuration\n * @returns The merged dictionaries\n *\n * @example\n * ```ts\n * const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);\n * const finalDictionaries = await writeFinalDictionaries(unmergedDictionaries);\n * console.log(finalDictionaries);\n *\n * // .intlayer/dictionary/home.json\n * // { key: 'home', content: { ... } },\n * ```\n */\nexport const writeMergedDictionaries = async (\n groupedDictionaries: UnmergedDictionaryOutput,\n configuration = getConfiguration()\n): Promise<MergedDictionaryOutput> => {\n const { dictionariesDir } = configuration.content;\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resolve(dictionariesDir), { recursive: true });\n\n const results = await parallelize(\n Object.entries(groupedDictionaries),\n async ([key, dictionariesEntry]) => {\n if (key === 'undefined') {\n return undefined as unknown as readonly [\n string,\n MergedDictionaryResult,\n ];\n }\n\n const multiLocaleDictionaries = dictionariesEntry.dictionaries.map(\n (dictionary) => processPerLocaleDictionary(dictionary)\n );\n\n const mergedDictionary = mergeDictionaries(multiLocaleDictionaries);\n\n const contentString = formatDictionaryText(mergedDictionary);\n\n const outputFileName = `${key}.json`;\n const resultFilePath = resolve(dictionariesDir, outputFileName);\n\n // Write the merged dictionary\n await writeFile(resultFilePath, contentString, 'utf8').catch((err) => {\n console.error(`Error creating merged ${outputFileName}:`, err);\n });\n\n return [\n key,\n {\n dictionaryPath: resultFilePath,\n dictionary: mergedDictionary,\n } as MergedDictionaryResult,\n ] as const;\n }\n );\n\n return Object.fromEntries(\n results.filter(Boolean) as Array<readonly [string, MergedDictionaryResult]>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiC;AAEjC,sBAAiC;AACjC,kBAAwB;AACxB,+BAAkC;AAClC,wCAA2C;AAC3C,yBAA4B;AAC5B,kCAAqC;AA0B9B,MAAM,0BAA0B,OACrC,qBACA,oBAAgB,gCAAiB,MACG;AACpC,QAAM,EAAE,gBAAgB,IAAI,cAAc;AAG1C,YAAM,2BAAM,qBAAQ,eAAe,GAAG,EAAE,WAAW,KAAK,CAAC;AAEzD,QAAM,UAAU,UAAM;AAAA,IACpB,OAAO,QAAQ,mBAAmB;AAAA,IAClC,OAAO,CAAC,KAAK,iBAAiB,MAAM;AAClC,UAAI,QAAQ,aAAa;AACvB,eAAO;AAAA,MAIT;AAEA,YAAM,0BAA0B,kBAAkB,aAAa;AAAA,QAC7D,CAAC,mBAAe,8DAA2B,UAAU;AAAA,MACvD;AAEA,YAAM,uBAAmB,4CAAkB,uBAAuB;AAElE,YAAM,oBAAgB,kDAAqB,gBAAgB;AAE3D,YAAM,iBAAiB,GAAG,GAAG;AAC7B,YAAM,qBAAiB,qBAAQ,iBAAiB,cAAc;AAG9D,gBAAM,2BAAU,gBAAgB,eAAe,MAAM,EAAE,MAAM,CAAC,QAAQ;AACpE,gBAAQ,MAAM,yBAAyB,cAAc,KAAK,GAAG;AAAA,MAC/D,CAAC;AAED,aAAO;AAAA,QACL;AAAA,QACA;AAAA,UACE,gBAAgB;AAAA,UAChB,YAAY;AAAA,QACd;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO,OAAO;AAAA,IACZ,QAAQ,OAAO,OAAO;AAAA,EACxB;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport { Dictionary } from '@intlayer/core';\nimport { mkdir, writeFile } from 'fs/promises';\nimport { resolve } from 'path';\nimport { filterInvalidDictionaries } from '../../../filterInvalidDictionaries';\nimport { formatDistantDictionaries } from '../../../loadDictionaries';\nimport { parallelize } from '../../../utils/parallelize';\nimport { formatDictionaryText } from './formatDictionaryText';\n\n/**\n * Write the localized dictionaries to the dictionariesDir\n * @param mergedDictionaries - The merged dictionaries\n * @param configuration - The configuration\n * @returns The final dictionaries\n *\n * @example\n * ```ts\n * const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);\n * const finalDictionaries = await writeFinalDictionaries(unmergedDictionaries);\n * console.log(finalDictionaries);\n *\n * // .intlayer/fetch_dictionaries/home.json\n * // { key: 'home', content: { ... } },\n * ```\n */\nexport const writeRemoteDictionary = async (\n remoteDictionaries: Dictionary[],\n configuration = getConfiguration()\n): Promise<Dictionary[]> => {\n const { remoteDictionariesDir } = configuration.content;\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resolve(remoteDictionariesDir), { recursive: true });\n\n const filteredDictionaries = filterInvalidDictionaries(remoteDictionaries);\n\n // Merge dictionaries with the same key and write to dictionariesDir\n await parallelize(\n filteredDictionaries.filter((dictionary) => dictionary.key !== 'undefined'),\n async (dictionary) => {\n const outputFileName = `${dictionary.key}.json`;\n const resultFilePath = resolve(remoteDictionariesDir, outputFileName);\n\n const contentString = formatDictionaryText(dictionary);\n\n // Write the merged dictionary\n await writeFile(resultFilePath, contentString, 'utf8').catch((err) => {\n console.error(`Error creating merged ${outputFileName}:`, err);\n });\n }\n );\n\n return formatDistantDictionaries(remoteDictionaries);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiC;AAEjC,sBAAiC;AACjC,kBAAwB;AACxB,uCAA0C;AAC1C,8BAA0C;AAC1C,yBAA4B;AAC5B,kCAAqC;AAkB9B,MAAM,wBAAwB,OACnC,oBACA,oBAAgB,gCAAiB,MACP;AAC1B,QAAM,EAAE,sBAAsB,IAAI,cAAc;AAGhD,YAAM,2BAAM,qBAAQ,qBAAqB,GAAG,EAAE,WAAW,KAAK,CAAC;AAE/D,QAAM,2BAAuB,4DAA0B,kBAAkB;AAGzE,YAAM;AAAA,IACJ,qBAAqB,OAAO,CAAC,eAAe,WAAW,QAAQ,WAAW;AAAA,IAC1E,OAAO,eAAe;AACpB,YAAM,iBAAiB,GAAG,WAAW,GAAG;AACxC,YAAM,qBAAiB,qBAAQ,uBAAuB,cAAc;AAEpE,YAAM,oBAAgB,kDAAqB,UAAU;AAGrD,gBAAM,2BAAU,gBAAgB,eAAe,MAAM,EAAE,MAAM,CAAC,QAAQ;AACpE,gBAAQ,MAAM,yBAAyB,cAAc,KAAK,GAAG;AAAA,MAC/D,CAAC;AAAA,IACH;AAAA,EACF;AAEA,aAAO,mDAA0B,kBAAkB;AACrD;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.ts"],"sourcesContent":["import { getConfiguration, x } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { mkdir, writeFile } from 'fs/promises';\nimport { resolve } from 'path';\nimport { filterInvalidDictionaries } from '../../../filterInvalidDictionaries';\nimport { orderDictionaries } from '../../../orderDictionaries';\nimport { parallelize } from '../../../utils/parallelize';\nimport { formatDictionaryText } from './formatDictionaryText';\n\nconst groupDictionariesByKey = (\n dictionaries: Dictionary[]\n): Record<string, Dictionary[]> =>\n dictionaries.reduce(\n (acc, dictionary) => {\n const key = dictionary.key;\n if (!acc[key]) {\n acc[key] = [];\n }\n acc[key].push(dictionary);\n return acc;\n },\n {} as Record<string, Dictionary[]>\n );\n\nexport type UnmergedDictionaryResult = {\n dictionaryPath: string;\n dictionaries: Dictionary[];\n};\n\nexport type UnmergedDictionaryOutput = Record<string, UnmergedDictionaryResult>;\n\n/**\n * Write the unmerged dictionaries to the unmergedDictionariesDir\n * @param dictionaries - The dictionaries to write\n * @param configuration - The configuration\n * @returns The grouped dictionaries\n *\n * @example\n * ```ts\n * const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);\n * console.log(unmergedDictionaries);\n *\n * // .intlayer/unmerged_dictionaries/home.json\n * // {\n * // [\n * // { key: 'home', content: { ... } },\n * // { key: 'home', content: { ... } },\n * // ],\n * // }\n * ```\n */\nexport const writeUnmergedDictionaries = async (\n dictionaries: Dictionary[],\n configuration = getConfiguration()\n): Promise<UnmergedDictionaryOutput> => {\n const { unmergedDictionariesDir } = configuration.content;\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resolve(unmergedDictionariesDir), { recursive: true });\n\n const filteredDictionaries = filterInvalidDictionaries(dictionaries);\n\n // Group dictionaries by key and write to unmergedDictionariesDir\n const groupedDictionaries = groupDictionariesByKey(filteredDictionaries);\n\n const results = await parallelize(\n Object.entries(groupedDictionaries),\n async ([key, dictionaries]) => {\n if (key === 'undefined') {\n return undefined as unknown as readonly [\n string,\n UnmergedDictionaryResult,\n ];\n }\n\n const orderedDictionaries = orderDictionaries(\n dictionaries,\n configuration\n );\n const contentString = formatDictionaryText(orderedDictionaries);\n\n const outputFileName = `${key}.json`;\n const unmergedFilePath = resolve(unmergedDictionariesDir, outputFileName);\n\n // Write the grouped dictionaries\n await writeFile(unmergedFilePath, contentString, 'utf8').catch((err) => {\n console.error(`${x} Error creating unmerged ${outputFileName}:`, err);\n });\n\n return [\n key,\n {\n dictionaryPath: unmergedFilePath,\n dictionaries: dictionaries,\n } as UnmergedDictionaryResult,\n ] as const;\n }\n );\n\n return Object.fromEntries(\n results.filter(Boolean) as Array<\n readonly [string, UnmergedDictionaryResult]\n >\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAoC;AAEpC,sBAAiC;AACjC,kBAAwB;AACxB,uCAA0C;AAC1C,+BAAkC;AAClC,yBAA4B;AAC5B,kCAAqC;AAErC,MAAM,yBAAyB,CAC7B,iBAEA,aAAa;AAAA,EACX,CAAC,KAAK,eAAe;AACnB,UAAM,MAAM,WAAW;AACvB,QAAI,CAAC,IAAI,GAAG,GAAG;AACb,UAAI,GAAG,IAAI,CAAC;AAAA,IACd;AACA,QAAI,GAAG,EAAE,KAAK,UAAU;AACxB,WAAO;AAAA,EACT;AAAA,EACA,CAAC;AACH;AA6BK,MAAM,4BAA4B,OACvC,cACA,oBAAgB,gCAAiB,MACK;AACtC,QAAM,EAAE,wBAAwB,IAAI,cAAc;AAGlD,YAAM,2BAAM,qBAAQ,uBAAuB,GAAG,EAAE,WAAW,KAAK,CAAC;AAEjE,QAAM,2BAAuB,4DAA0B,YAAY;AAGnE,QAAM,sBAAsB,uBAAuB,oBAAoB;AAEvE,QAAM,UAAU,UAAM;AAAA,IACpB,OAAO,QAAQ,mBAAmB;AAAA,IAClC,OAAO,CAAC,KAAKA,aAAY,MAAM;AAC7B,UAAI,QAAQ,aAAa;AACvB,eAAO;AAAA,MAIT;AAEA,YAAM,0BAAsB;AAAA,QAC1BA;AAAA,QACA;AAAA,MACF;AACA,YAAM,oBAAgB,kDAAqB,mBAAmB;AAE9D,YAAM,iBAAiB,GAAG,GAAG;AAC7B,YAAM,uBAAmB,qBAAQ,yBAAyB,cAAc;AAGxE,gBAAM,2BAAU,kBAAkB,eAAe,MAAM,EAAE,MAAM,CAAC,QAAQ;AACtE,gBAAQ,MAAM,GAAG,eAAC,4BAA4B,cAAc,KAAK,GAAG;AAAA,MACtE,CAAC;AAED,aAAO;AAAA,QACL;AAAA,QACA;AAAA,UACE,gBAAgB;AAAA,UAChB,cAAcA;AAAA,QAChB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO,OAAO;AAAA,IACZ,QAAQ,OAAO,OAAO;AAAA,EAGxB;AACF;","names":["dictionaries"]}
@@ -1,52 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var writeDictionary_exports = {};
20
- __export(writeDictionary_exports, {
21
- writeDictionary: () => writeDictionary
22
- });
23
- module.exports = __toCommonJS(writeDictionary_exports);
24
- var import_config = require("@intlayer/config");
25
- var import_promises = require("fs/promises");
26
- var import_path = require("path");
27
- const { content } = (0, import_config.getConfiguration)();
28
- const { reactIntlMessagesDir } = content;
29
- const writeDictionary = async (dictionariesDeclaration) => {
30
- const resultDictionariesPaths = [];
31
- for (const [nameSpace, localContent] of Object.entries(
32
- dictionariesDeclaration
33
- )) {
34
- for await (const [locale, content2] of Object.entries(localContent)) {
35
- const contentString = JSON.stringify(content2);
36
- const outputFileName = `${nameSpace}.json`;
37
- const dictionariesDirPath = (0, import_path.resolve)(reactIntlMessagesDir, locale);
38
- const resultFilePath = (0, import_path.resolve)(dictionariesDirPath, outputFileName);
39
- await (0, import_promises.mkdir)(dictionariesDirPath, { recursive: true });
40
- await (0, import_promises.writeFile)(resultFilePath, contentString, "utf8").catch((err) => {
41
- console.error(`Error creating ${outputFileName}:`, err);
42
- });
43
- resultDictionariesPaths.push(resultFilePath);
44
- }
45
- }
46
- return resultDictionariesPaths;
47
- };
48
- // Annotate the CommonJS export names for ESM import in node:
49
- 0 && (module.exports = {
50
- writeDictionary
51
- });
52
- //# sourceMappingURL=writeDictionary.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport { mkdir, writeFile } from 'fs/promises';\nimport { resolve } from 'path';\nimport type { I18nextDictionariesOutput } from '../i18next_dictionary/convertContentDeclarationInto18nDictionaries';\n\nconst { content } = getConfiguration();\nconst { reactIntlMessagesDir } = content;\n\nexport type DictionariesDeclaration = Record<string, I18nextDictionariesOutput>;\n\n/**\n * This function writes the dictionaries to the file system\n */\nexport const writeDictionary = async (\n dictionariesDeclaration: DictionariesDeclaration\n) => {\n const resultDictionariesPaths: string[] = [];\n\n for (const [nameSpace, localContent] of Object.entries(\n dictionariesDeclaration\n )) {\n for await (const [locale, content] of Object.entries(localContent)) {\n const contentString = JSON.stringify(content);\n\n const outputFileName = `${nameSpace}.json`;\n const dictionariesDirPath = resolve(reactIntlMessagesDir, locale);\n const resultFilePath = resolve(dictionariesDirPath, outputFileName);\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(dictionariesDirPath, { recursive: true });\n\n // Create the json file\n await writeFile(resultFilePath, contentString, 'utf8').catch((err) => {\n console.error(`Error creating ${outputFileName}:`, err);\n });\n\n resultDictionariesPaths.push(resultFilePath);\n }\n }\n\n return resultDictionariesPaths;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiC;AACjC,sBAAiC;AACjC,kBAAwB;AAGxB,MAAM,EAAE,QAAQ,QAAI,gCAAiB;AACrC,MAAM,EAAE,qBAAqB,IAAI;AAO1B,MAAM,kBAAkB,OAC7B,4BACG;AACH,QAAM,0BAAoC,CAAC;AAE3C,aAAW,CAAC,WAAW,YAAY,KAAK,OAAO;AAAA,IAC7C;AAAA,EACF,GAAG;AACD,qBAAiB,CAAC,QAAQA,QAAO,KAAK,OAAO,QAAQ,YAAY,GAAG;AAClE,YAAM,gBAAgB,KAAK,UAAUA,QAAO;AAE5C,YAAM,iBAAiB,GAAG,SAAS;AACnC,YAAM,0BAAsB,qBAAQ,sBAAsB,MAAM;AAChE,YAAM,qBAAiB,qBAAQ,qBAAqB,cAAc;AAGlE,gBAAM,uBAAM,qBAAqB,EAAE,WAAW,KAAK,CAAC;AAGpD,gBAAM,2BAAU,gBAAgB,eAAe,MAAM,EAAE,MAAM,CAAC,QAAQ;AACpE,gBAAQ,MAAM,kBAAkB,cAAc,KAAK,GAAG;AAAA,MACxD,CAAC;AAED,8BAAwB,KAAK,cAAc;AAAA,IAC7C;AAAA,EACF;AAEA,SAAO;AACT;","names":["content"]}
@@ -1,21 +0,0 @@
1
- import { getIntlayerAPIProxy } from "@intlayer/api";
2
- import { getConfiguration } from "@intlayer/config";
3
- const fetchDistantDictionaryKeysAndUpdateTimestamp = async (configuration = getConfiguration()) => {
4
- const { clientId, clientSecret } = configuration.editor;
5
- if (!clientId || !clientSecret) {
6
- throw new Error(
7
- "Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project."
8
- );
9
- }
10
- const intlayerAPI = getIntlayerAPIProxy(void 0, configuration);
11
- const getDictionariesKeysResult = await intlayerAPI.dictionary.getDictionariesUpdateTimestamp();
12
- if (!getDictionariesKeysResult.data) {
13
- throw new Error("No distant dictionaries found");
14
- }
15
- const distantDictionariesUpdateTimeStamp = getDictionariesKeysResult.data;
16
- return distantDictionariesUpdateTimeStamp;
17
- };
18
- export {
19
- fetchDistantDictionaryKeysAndUpdateTimestamp
20
- };
21
- //# sourceMappingURL=fetchDistantDictionaryKeysAndUpdateTimestamp.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/fetchDistantDictionaryKeysAndUpdateTimestamp.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config';\n\nexport const fetchDistantDictionaryKeysAndUpdateTimestamp = async (\n configuration: IntlayerConfig = getConfiguration()\n): Promise<Record<string, number>> => {\n const { clientId, clientSecret } = configuration.editor;\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const intlayerAPI = getIntlayerAPIProxy(undefined, configuration);\n\n // Get the list of dictionary keys\n const getDictionariesKeysResult =\n await intlayerAPI.dictionary.getDictionariesUpdateTimestamp();\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('No distant dictionaries found');\n }\n\n const distantDictionariesUpdateTimeStamp: Record<string, number> =\n getDictionariesKeysResult.data;\n\n // Apply any filtering if needed\n return distantDictionariesUpdateTimeStamp;\n};\n"],"mappings":"AAAA,SAAS,2BAA2B;AACpC,SAAS,wBAA6C;AAE/C,MAAM,+CAA+C,OAC1D,gBAAgC,iBAAiB,MACb;AACpC,QAAM,EAAE,UAAU,aAAa,IAAI,cAAc;AAEjD,MAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,cAAc,oBAAoB,QAAW,aAAa;AAGhE,QAAM,4BACJ,MAAM,YAAY,WAAW,+BAA+B;AAE9D,MAAI,CAAC,0BAA0B,MAAM;AACnC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AAEA,QAAM,qCACJ,0BAA0B;AAG5B,SAAO;AACT;","names":[]}
@@ -1,24 +0,0 @@
1
- import { getConfiguration } from "@intlayer/config";
2
- import { createI18nextDictionaries } from "./convertContentDeclarationInto18nDictionaries.mjs";
3
- import {
4
- writeDictionary
5
- } from "./writeDictionary.mjs";
6
- const buildI18nDictionary = async (contentDeclarations, configuration = getConfiguration()) => {
7
- const dictionariesDeclaration = contentDeclarations.reduce((acc, dictionary) => {
8
- const { key, content } = dictionary;
9
- const i18Content = createI18nextDictionaries(content, configuration);
10
- return {
11
- ...acc,
12
- [key]: i18Content
13
- };
14
- }, {});
15
- const dictionariesPaths = await writeDictionary(
16
- dictionariesDeclaration,
17
- configuration
18
- );
19
- return dictionariesPaths;
20
- };
21
- export {
22
- buildI18nDictionary
23
- };
24
- //# sourceMappingURL=buildI18nextDictionary.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/i18next_dictionary/buildI18nextDictionary.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { createI18nextDictionaries } from './convertContentDeclarationInto18nDictionaries';\nimport {\n writeDictionary,\n type DictionariesDeclaration,\n} from './writeDictionary';\n\n/**\n * This function transpile content declaration to i18n dictionaries\n */\nexport const buildI18nDictionary = async (\n contentDeclarations: Dictionary[],\n configuration = getConfiguration()\n) => {\n // Create dictionaries for each nested content and format them\n const dictionariesDeclaration: DictionariesDeclaration =\n contentDeclarations.reduce((acc, dictionary) => {\n const { key, content } = dictionary;\n const i18Content = createI18nextDictionaries(content, configuration);\n\n return {\n ...acc,\n [key]: i18Content,\n };\n }, {});\n\n // Write the dictionaries to the file system\n const dictionariesPaths: string[] = await writeDictionary(\n dictionariesDeclaration,\n configuration\n );\n\n return dictionariesPaths;\n};\n"],"mappings":"AAAA,SAAS,wBAAwB;AAEjC,SAAS,iCAAiC;AAC1C;AAAA,EACE;AAAA,OAEK;AAKA,MAAM,sBAAsB,OACjC,qBACA,gBAAgB,iBAAiB,MAC9B;AAEH,QAAM,0BACJ,oBAAoB,OAAO,CAAC,KAAK,eAAe;AAC9C,UAAM,EAAE,KAAK,QAAQ,IAAI;AACzB,UAAM,aAAa,0BAA0B,SAAS,aAAa;AAEnE,WAAO;AAAA,MACL,GAAG;AAAA,MACH,CAAC,GAAG,GAAG;AAAA,IACT;AAAA,EACF,GAAG,CAAC,CAAC;AAGP,QAAM,oBAA8B,MAAM;AAAA,IACxC;AAAA,IACA;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}