@intlayer/chokidar 5.4.2 → 5.5.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/dist/cjs/chokidar/watcher.cjs +3 -3
  2. package/dist/cjs/chokidar/watcher.cjs.map +1 -1
  3. package/dist/cjs/cleanOutputDir.cjs +7 -9
  4. package/dist/cjs/cleanOutputDir.cjs.map +1 -1
  5. package/dist/cjs/fetchDistantDictionaries.cjs +4 -3
  6. package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
  7. package/dist/cjs/filterDictionaryLocales.cjs +58 -0
  8. package/dist/cjs/filterDictionaryLocales.cjs.map +1 -0
  9. package/dist/cjs/getBuiltUnmergedDictionariesPath.cjs +51 -0
  10. package/dist/cjs/getBuiltUnmergedDictionariesPath.cjs.map +1 -0
  11. package/dist/cjs/getContentDeclarationFileTemplate/cjsTemplate.md +9 -0
  12. package/dist/cjs/getContentDeclarationFileTemplate/esmTemplate.md +9 -0
  13. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs +62 -0
  14. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map +1 -0
  15. package/dist/cjs/getContentDeclarationFileTemplate/tsTemplate.md +8 -0
  16. package/dist/cjs/index.cjs +21 -6
  17. package/dist/cjs/index.cjs.map +1 -1
  18. package/dist/cjs/listGitFiles.cjs +98 -0
  19. package/dist/cjs/listGitFiles.cjs.map +1 -0
  20. package/dist/cjs/loadDictionaries/loadDictionaries.cjs +1 -23
  21. package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
  22. package/dist/cjs/loadDictionaries/loadDistantDictionaries.cjs +7 -1
  23. package/dist/cjs/loadDictionaries/loadDistantDictionaries.cjs.map +1 -1
  24. package/dist/cjs/mergeDictionaries.cjs +43 -23
  25. package/dist/cjs/mergeDictionaries.cjs.map +1 -1
  26. package/dist/cjs/prepareIntlayer.cjs +1 -1
  27. package/dist/cjs/prepareIntlayer.cjs.map +1 -1
  28. package/dist/cjs/processPerLocaleDictionary.cjs +49 -0
  29. package/dist/cjs/processPerLocaleDictionary.cjs.map +1 -0
  30. package/dist/cjs/reduceDictionaryContent/applyMask.cjs +50 -0
  31. package/dist/cjs/reduceDictionaryContent/applyMask.cjs.map +1 -0
  32. package/dist/cjs/reduceDictionaryContent/buildMask.cjs +49 -0
  33. package/dist/cjs/reduceDictionaryContent/buildMask.cjs.map +1 -0
  34. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs +35 -0
  35. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs.map +1 -0
  36. package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.cjs +4 -4
  37. package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.cjs.map +1 -1
  38. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.cjs +56 -8
  39. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.cjs.map +1 -1
  40. package/dist/cjs/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.cjs +4 -4
  41. package/dist/cjs/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.cjs.map +1 -1
  42. package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs +21 -1
  43. package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs.map +1 -1
  44. package/dist/cjs/writeContentDeclaration/formatCode.cjs +61 -0
  45. package/dist/cjs/writeContentDeclaration/formatCode.cjs.map +1 -0
  46. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +36 -37
  47. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
  48. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +377 -0
  49. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -0
  50. package/dist/esm/chokidar/watcher.mjs +5 -5
  51. package/dist/esm/chokidar/watcher.mjs.map +1 -1
  52. package/dist/esm/cleanOutputDir.mjs +7 -9
  53. package/dist/esm/cleanOutputDir.mjs.map +1 -1
  54. package/dist/esm/fetchDistantDictionaries.mjs +5 -4
  55. package/dist/esm/fetchDistantDictionaries.mjs.map +1 -1
  56. package/dist/esm/filterDictionaryLocales.mjs +37 -0
  57. package/dist/esm/filterDictionaryLocales.mjs.map +1 -0
  58. package/dist/esm/getBuiltUnmergedDictionariesPath.mjs +17 -0
  59. package/dist/esm/getBuiltUnmergedDictionariesPath.mjs.map +1 -0
  60. package/dist/esm/getContentDeclarationFileTemplate/cjsTemplate.md +9 -0
  61. package/dist/esm/getContentDeclarationFileTemplate/esmTemplate.md +9 -0
  62. package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs +37 -0
  63. package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs.map +1 -0
  64. package/dist/esm/getContentDeclarationFileTemplate/tsTemplate.md +8 -0
  65. package/dist/esm/index.mjs +21 -9
  66. package/dist/esm/index.mjs.map +1 -1
  67. package/dist/esm/listGitFiles.mjs +64 -0
  68. package/dist/esm/listGitFiles.mjs.map +1 -0
  69. package/dist/esm/loadDictionaries/loadDictionaries.mjs +1 -13
  70. package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
  71. package/dist/esm/loadDictionaries/loadDistantDictionaries.mjs +7 -1
  72. package/dist/esm/loadDictionaries/loadDistantDictionaries.mjs.map +1 -1
  73. package/dist/esm/mergeDictionaries.mjs +42 -22
  74. package/dist/esm/mergeDictionaries.mjs.map +1 -1
  75. package/dist/esm/prepareIntlayer.mjs +3 -3
  76. package/dist/esm/prepareIntlayer.mjs.map +1 -1
  77. package/dist/esm/processPerLocaleDictionary.mjs +25 -0
  78. package/dist/esm/processPerLocaleDictionary.mjs.map +1 -0
  79. package/dist/esm/reduceDictionaryContent/applyMask.mjs +26 -0
  80. package/dist/esm/reduceDictionaryContent/applyMask.mjs.map +1 -0
  81. package/dist/esm/reduceDictionaryContent/buildMask.mjs +24 -0
  82. package/dist/esm/reduceDictionaryContent/buildMask.mjs.map +1 -0
  83. package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs +11 -0
  84. package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs.map +1 -0
  85. package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.mjs +4 -4
  86. package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.mjs.map +1 -1
  87. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.mjs +54 -8
  88. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.mjs.map +1 -1
  89. package/dist/esm/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.mjs +4 -4
  90. package/dist/esm/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.mjs.map +1 -1
  91. package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs +21 -1
  92. package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs.map +1 -1
  93. package/dist/esm/writeContentDeclaration/formatCode.mjs +37 -0
  94. package/dist/esm/writeContentDeclaration/formatCode.mjs.map +1 -0
  95. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +35 -36
  96. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
  97. package/dist/esm/writeContentDeclaration/writeJSFile.mjs +345 -0
  98. package/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -0
  99. package/dist/types/chokidar/watcher.d.ts.map +1 -1
  100. package/dist/types/cleanOutputDir.d.ts.map +1 -1
  101. package/dist/types/fetchDistantDictionaries.d.ts.map +1 -1
  102. package/dist/types/filterDictionaryLocales.d.ts +4 -0
  103. package/dist/types/filterDictionaryLocales.d.ts.map +1 -0
  104. package/dist/types/getBuiltUnmergedDictionariesPath.d.ts +5 -0
  105. package/dist/types/getBuiltUnmergedDictionariesPath.d.ts.map +1 -0
  106. package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts +2 -0
  107. package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts.map +1 -0
  108. package/dist/types/index.d.ts +12 -7
  109. package/dist/types/index.d.ts.map +1 -1
  110. package/dist/types/listGitFiles.d.ts +9 -0
  111. package/dist/types/listGitFiles.d.ts.map +1 -0
  112. package/dist/types/loadDictionaries/loadDictionaries.d.ts.map +1 -1
  113. package/dist/types/loadDictionaries/loadDistantDictionaries.d.ts.map +1 -1
  114. package/dist/types/mergeDictionaries.d.ts +2 -4
  115. package/dist/types/mergeDictionaries.d.ts.map +1 -1
  116. package/dist/types/processPerLocaleDictionary.d.ts +32 -0
  117. package/dist/types/processPerLocaleDictionary.d.ts.map +1 -0
  118. package/dist/types/reduceDictionaryContent/applyMask.d.ts +3 -0
  119. package/dist/types/reduceDictionaryContent/applyMask.d.ts.map +1 -0
  120. package/dist/types/reduceDictionaryContent/buildMask.d.ts +5 -0
  121. package/dist/types/reduceDictionaryContent/buildMask.d.ts.map +1 -0
  122. package/dist/types/reduceDictionaryContent/reduceDictionaryContent.d.ts +3 -0
  123. package/dist/types/reduceDictionaryContent/reduceDictionaryContent.d.ts.map +1 -0
  124. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.d.ts +38 -0
  125. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.d.ts.map +1 -1
  126. package/dist/types/transpiler/dictionary_to_main/createDictionaryEntryPoint.d.ts.map +1 -1
  127. package/dist/types/writeContentDeclaration/formatCode.d.ts +2 -0
  128. package/dist/types/writeContentDeclaration/formatCode.d.ts.map +1 -0
  129. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -1
  130. package/dist/types/writeContentDeclaration/writeJSFile.d.ts +9 -0
  131. package/dist/types/writeContentDeclaration/writeJSFile.d.ts.map +1 -0
  132. package/package.json +21 -13
@@ -1,23 +1,69 @@
1
- import { writeFile } from "fs/promises";
2
- import { resolve } from "path";
3
1
  import { getConfiguration } from "@intlayer/config";
4
- const writeDictionary = async (dictionaries, configuration = getConfiguration()) => {
2
+ import { mkdir, writeFile } from "fs/promises";
3
+ import { resolve } from "path";
4
+ import { mergeDictionaries } from "../../../mergeDictionaries.mjs";
5
+ import { processPerLocaleDictionary } from "../../../processPerLocaleDictionary.mjs";
6
+ const groupDictionariesByKey = (dictionaries) => {
7
+ return dictionaries.reduce(
8
+ (acc, dictionary) => {
9
+ const key = dictionary.key;
10
+ if (!acc[key]) {
11
+ acc[key] = [];
12
+ }
13
+ acc[key].push(dictionary);
14
+ return acc;
15
+ },
16
+ {}
17
+ );
18
+ };
19
+ const writeUnmergedDictionaries = async (dictionaries, configuration = getConfiguration()) => {
20
+ const { unmergedDictionariesDir } = configuration.content;
21
+ await mkdir(unmergedDictionariesDir, { recursive: true });
22
+ const groupedDictionaries = groupDictionariesByKey(dictionaries);
23
+ for (const [key, dictionaries2] of Object.entries(groupedDictionaries)) {
24
+ const isDevelopment = process.env.NODE_ENV === "development";
25
+ const contentString = isDevelopment ? JSON.stringify(dictionaries2, null, 2) : JSON.stringify(dictionaries2);
26
+ const outputFileName = `${key}.json`;
27
+ const unmergedFilePath = resolve(unmergedDictionariesDir, outputFileName);
28
+ await writeFile(unmergedFilePath, contentString, "utf8").catch((err) => {
29
+ console.error(`Error creating unmerged ${outputFileName}:`, err);
30
+ });
31
+ }
32
+ return groupedDictionaries;
33
+ };
34
+ const writeFinalDictionaries = async (groupedDictionaries, configuration = getConfiguration()) => {
5
35
  const { dictionariesDir } = configuration.content;
6
36
  const resultDictionariesPaths = [];
7
- for await (const dictionaryContent of dictionaries) {
37
+ for (const [key, dictionaries] of Object.entries(groupedDictionaries)) {
38
+ const multiLocaleDictionaries = dictionaries.map(
39
+ (dictionary) => processPerLocaleDictionary(dictionary)
40
+ );
41
+ const mergedDictionary = mergeDictionaries(multiLocaleDictionaries);
8
42
  const isDevelopment = process.env.NODE_ENV === "development";
9
- const contentString = isDevelopment ? JSON.stringify(dictionaryContent, null, 2) : JSON.stringify(dictionaryContent);
10
- const key = dictionaryContent.key;
43
+ const contentString = isDevelopment ? JSON.stringify(mergedDictionary, null, 2) : JSON.stringify(mergedDictionary);
11
44
  const outputFileName = `${key}.json`;
12
45
  const resultFilePath = resolve(dictionariesDir, outputFileName);
13
46
  await writeFile(resultFilePath, contentString, "utf8").catch((err) => {
14
- console.error(`Error creating ${outputFileName}:`, err);
47
+ console.error(`Error creating merged ${outputFileName}:`, err);
15
48
  });
16
49
  resultDictionariesPaths.push(resultFilePath);
17
50
  }
18
51
  return resultDictionariesPaths;
19
52
  };
53
+ const writeDictionary = async (dictionaries, configuration = getConfiguration()) => {
54
+ const unmergedDictionaries = await writeUnmergedDictionaries(
55
+ dictionaries,
56
+ configuration
57
+ );
58
+ const finalDictionaries = await writeFinalDictionaries(
59
+ unmergedDictionaries,
60
+ configuration
61
+ );
62
+ return finalDictionaries;
63
+ };
20
64
  export {
21
- writeDictionary
65
+ writeDictionary,
66
+ writeFinalDictionaries,
67
+ writeUnmergedDictionaries
22
68
  };
23
69
  //# sourceMappingURL=writeDictionary.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.ts"],"sourcesContent":["import { writeFile } from 'fs/promises';\nimport { resolve } from 'path';\nimport { getConfiguration } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\n\nexport const writeDictionary = async (\n dictionaries: Dictionary[],\n configuration = getConfiguration()\n) => {\n const { dictionariesDir } = configuration.content;\n const resultDictionariesPaths: string[] = [];\n\n for await (const dictionaryContent of dictionaries) {\n const isDevelopment = process.env.NODE_ENV === 'development';\n const contentString = isDevelopment\n ? JSON.stringify(dictionaryContent, null, 2)\n : JSON.stringify(dictionaryContent);\n\n const key = dictionaryContent.key;\n const outputFileName = `${key}.json`;\n const resultFilePath = resolve(dictionariesDir, outputFileName);\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 return resultDictionariesPaths;\n};\n"],"mappings":"AAAA,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,wBAAwB;AAG1B,MAAM,kBAAkB,OAC7B,cACA,gBAAgB,iBAAiB,MAC9B;AACH,QAAM,EAAE,gBAAgB,IAAI,cAAc;AAC1C,QAAM,0BAAoC,CAAC;AAE3C,mBAAiB,qBAAqB,cAAc;AAClD,UAAM,gBAAgB,QAAQ,IAAI,aAAa;AAC/C,UAAM,gBAAgB,gBAClB,KAAK,UAAU,mBAAmB,MAAM,CAAC,IACzC,KAAK,UAAU,iBAAiB;AAEpC,UAAM,MAAM,kBAAkB;AAC9B,UAAM,iBAAiB,GAAG,GAAG;AAC7B,UAAM,iBAAiB,QAAQ,iBAAiB,cAAc;AAG9D,UAAM,UAAU,gBAAgB,eAAe,MAAM,EAAE,MAAM,CAAC,QAAQ;AACpE,cAAQ,MAAM,kBAAkB,cAAc,KAAK,GAAG;AAAA,IACxD,CAAC;AAED,4BAAwB,KAAK,cAAc;AAAA,EAC7C;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.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';\n\nconst groupDictionariesByKey = (\n dictionaries: Dictionary[]\n): Record<string, Dictionary[]> => {\n return 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};\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<Record<string, Dictionary[]>> => {\n const { unmergedDictionariesDir } = configuration.content;\n\n // Create the merged dictionaries directory\n await mkdir(unmergedDictionariesDir, { recursive: true });\n\n // Group dictionaries by key and write to unmergedDictionariesDir\n const groupedDictionaries = groupDictionariesByKey(dictionaries);\n\n for (const [key, dictionaries] of Object.entries(groupedDictionaries)) {\n const isDevelopment = process.env.NODE_ENV === 'development';\n const contentString = isDevelopment\n ? JSON.stringify(dictionaries, null, 2)\n : JSON.stringify(dictionaries);\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(`Error creating unmerged ${outputFileName}:`, err);\n });\n }\n\n return groupedDictionaries;\n};\n\n/**\n * Write the final dictionaries to the dictionariesDir\n * @param groupedDictionaries - The grouped 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/dictionaries/home.json\n * // { key: 'home', content: { ... } },\n * ```\n */\nexport const writeFinalDictionaries = async (\n groupedDictionaries: Record<string, Dictionary[]>,\n configuration = getConfiguration()\n) => {\n const { dictionariesDir } = configuration.content;\n const resultDictionariesPaths: string[] = [];\n\n // Merge dictionaries with the same key and write to dictionariesDir\n for (const [key, dictionaries] of Object.entries(groupedDictionaries)) {\n const multiLocaleDictionaries = dictionaries.map((dictionary) =>\n processPerLocaleDictionary(dictionary)\n );\n const mergedDictionary = mergeDictionaries(multiLocaleDictionaries);\n\n const isDevelopment = process.env.NODE_ENV === 'development';\n const contentString = isDevelopment\n ? JSON.stringify(mergedDictionary, null, 2)\n : JSON.stringify(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 resultDictionariesPaths.push(resultFilePath);\n }\n\n return resultDictionariesPaths;\n};\n\nexport const writeDictionary = async (\n dictionaries: Dictionary[],\n configuration = getConfiguration()\n) => {\n const unmergedDictionaries = await writeUnmergedDictionaries(\n dictionaries,\n configuration\n );\n\n const finalDictionaries = await writeFinalDictionaries(\n unmergedDictionaries,\n configuration\n );\n\n return finalDictionaries;\n};\n"],"mappings":"AAAA,SAAS,wBAAwB;AAEjC,SAAS,OAAO,iBAAiB;AACjC,SAAS,eAAe;AACxB,SAAS,yBAAyB;AAClC,SAAS,kCAAkC;AAE3C,MAAM,yBAAyB,CAC7B,iBACiC;AACjC,SAAO,aAAa;AAAA,IAClB,CAAC,KAAK,eAAe;AACnB,YAAM,MAAM,WAAW;AACvB,UAAI,CAAC,IAAI,GAAG,GAAG;AACb,YAAI,GAAG,IAAI,CAAC;AAAA,MACd;AACA,UAAI,GAAG,EAAE,KAAK,UAAU;AACxB,aAAO;AAAA,IACT;AAAA,IACA,CAAC;AAAA,EACH;AACF;AAsBO,MAAM,4BAA4B,OACvC,cACA,gBAAgB,iBAAiB,MACS;AAC1C,QAAM,EAAE,wBAAwB,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kB,OAC7B,cACA,gBAAgB,iBAAiB,MAC9B;AACH,QAAM,uBAAuB,MAAM;AAAA,IACjC;AAAA,IACA;AAAA,EACF;AAEA,QAAM,oBAAoB,MAAM;AAAA,IAC9B;AAAA,IACA;AAAA,EACF;AAEA,SAAO;AACT;","names":["dictionaries"]}
@@ -1,6 +1,6 @@
1
+ import { getConfiguration } from "@intlayer/config";
1
2
  import { mkdir, writeFile } from "fs/promises";
2
3
  import { resolve } from "path";
3
- import { getConfiguration } from "@intlayer/config";
4
4
  const { content } = getConfiguration();
5
5
  const { reactIntlMessagesDir } = content;
6
6
  const writeDictionary = async (dictionariesDeclaration) => {
@@ -11,9 +11,9 @@ const writeDictionary = async (dictionariesDeclaration) => {
11
11
  for await (const [locale, content2] of Object.entries(localContent)) {
12
12
  const contentString = JSON.stringify(content2);
13
13
  const outputFileName = `${nameSpace}.json`;
14
- const resultDirPath = resolve(reactIntlMessagesDir, locale);
15
- const resultFilePath = resolve(resultDirPath, outputFileName);
16
- await mkdir(resultDirPath, { recursive: true });
14
+ const dictionariesDirPath = resolve(reactIntlMessagesDir, locale);
15
+ const resultFilePath = resolve(dictionariesDirPath, outputFileName);
16
+ await mkdir(dictionariesDirPath, { recursive: true });
17
17
  await writeFile(resultFilePath, contentString, "utf8").catch((err) => {
18
18
  console.error(`Error creating ${outputFileName}:`, err);
19
19
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.ts"],"sourcesContent":["import { mkdir, writeFile } from 'fs/promises';\nimport { resolve } from 'path';\nimport { getConfiguration } from '@intlayer/config';\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 resultDirPath = resolve(reactIntlMessagesDir, locale);\n const resultFilePath = resolve(resultDirPath, outputFileName);\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resultDirPath, { 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,SAAS,OAAO,iBAAiB;AACjC,SAAS,eAAe;AACxB,SAAS,wBAAwB;AAGjC,MAAM,EAAE,QAAQ,IAAI,iBAAiB;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,gBAAgB,QAAQ,sBAAsB,MAAM;AAC1D,YAAM,iBAAiB,QAAQ,eAAe,cAAc;AAG5D,YAAM,MAAM,eAAe,EAAE,WAAW,KAAK,CAAC;AAG9C,YAAM,UAAU,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
+ {"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,SAAS,wBAAwB;AACjC,SAAS,OAAO,iBAAiB;AACjC,SAAS,eAAe;AAGxB,MAAM,EAAE,QAAQ,IAAI,iBAAiB;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,sBAAsB,QAAQ,sBAAsB,MAAM;AAChE,YAAM,iBAAiB,QAAQ,qBAAqB,cAAc;AAGlE,YAAM,MAAM,qBAAqB,EAAE,WAAW,KAAK,CAAC;AAGpD,YAAM,UAAU,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,7 +1,8 @@
1
+ import { getConfiguration } from "@intlayer/config";
1
2
  import { existsSync, mkdirSync, writeFileSync } from "fs";
2
3
  import { basename, extname, relative, resolve } from "path";
3
- import { getConfiguration } from "@intlayer/config";
4
4
  import { getBuiltDictionariesPath } from "../../getBuiltDictionariesPath.mjs";
5
+ import { getBuiltUnmergedDictionariesPath } from "../../getBuiltUnmergedDictionariesPath.mjs";
5
6
  import { getFileHash } from "../../utils.mjs";
6
7
  const generateDictionaryListContent = (dictionaries, format = "esm", configuration = getConfiguration()) => {
7
8
  const { mainDir } = configuration.content;
@@ -53,6 +54,25 @@ const createDictionaryEntryPoint = (configuration = getConfiguration()) => {
53
54
  configuration
54
55
  );
55
56
  writeFileSync(resolve(mainDir, "dictionaries.mjs"), esmContent);
57
+ const unmergedDictionariesPath = getBuiltUnmergedDictionariesPath(configuration);
58
+ const unmergedCjsContent = generateDictionaryListContent(
59
+ unmergedDictionariesPath,
60
+ "cjs",
61
+ configuration
62
+ );
63
+ writeFileSync(
64
+ resolve(mainDir, "unmerged_dictionaries.cjs"),
65
+ unmergedCjsContent
66
+ );
67
+ const unmergedEsmContent = generateDictionaryListContent(
68
+ unmergedDictionariesPath,
69
+ "esm",
70
+ configuration
71
+ );
72
+ writeFileSync(
73
+ resolve(mainDir, "unmerged_dictionaries.mjs"),
74
+ unmergedEsmContent
75
+ );
56
76
  };
57
77
  export {
58
78
  createDictionaryEntryPoint
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/transpiler/dictionary_to_main/createDictionaryEntryPoint.ts"],"sourcesContent":["import { existsSync, mkdirSync, writeFileSync } from 'fs';\nimport { basename, extname, relative, resolve } from 'path';\nimport { getConfiguration } from '@intlayer/config';\nimport { getBuiltDictionariesPath } from '../../getBuiltDictionariesPath';\nimport { getFileHash } from '../../utils';\n\n/**\n * This function generates the content of the dictionary list file\n */\nconst generateDictionaryListContent = (\n dictionaries: string[],\n format: 'cjs' | 'esm' = 'esm',\n configuration = getConfiguration()\n): string => {\n const { mainDir } = configuration.content;\n\n let content = '';\n\n const dictionariesRef = dictionaries.map((dictionaryPath) => ({\n relativePath: relative(mainDir, dictionaryPath),\n id: basename(dictionaryPath, extname(dictionaryPath)), // Get the base name as the dictionary id\n hash: `_${getFileHash(dictionaryPath)}`, // Get the hash of the dictionary to avoid conflicts\n }));\n\n // Import all dictionaries\n dictionariesRef.forEach((dictionary) => {\n if (format === 'esm')\n content += `import ${dictionary.hash} from '${dictionary.relativePath}';\\n`;\n if (format === 'cjs')\n content += `const ${dictionary.hash} = require('${dictionary.relativePath}');\\n`;\n });\n\n content += '\\n';\n\n // Format Dictionary Map\n const formattedDictionaryMap: string = dictionariesRef\n .map((dictionary) => ` \"${dictionary.id}\": ${dictionary.hash}`)\n .join(',\\n');\n\n if (format === 'esm')\n content += `export default {\\n${formattedDictionaryMap}\\n};\\n`;\n if (format === 'cjs')\n content += `module.exports = {\\n${formattedDictionaryMap}\\n};\\n`;\n\n return content;\n};\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const createDictionaryEntryPoint = (\n configuration = getConfiguration()\n) => {\n const { 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[] = getBuiltDictionariesPath(configuration);\n\n // Create the dictionary list file\n const cjsContent = generateDictionaryListContent(\n dictionariesPath,\n 'cjs',\n configuration\n );\n writeFileSync(resolve(mainDir, 'dictionaries.cjs'), cjsContent);\n\n const esmContent = generateDictionaryListContent(\n dictionariesPath,\n 'esm',\n configuration\n );\n writeFileSync(resolve(mainDir, 'dictionaries.mjs'), esmContent);\n};\n"],"mappings":"AAAA,SAAS,YAAY,WAAW,qBAAqB;AACrD,SAAS,UAAU,SAAS,UAAU,eAAe;AACrD,SAAS,wBAAwB;AACjC,SAAS,gCAAgC;AACzC,SAAS,mBAAmB;AAK5B,MAAM,gCAAgC,CACpC,cACA,SAAwB,OACxB,gBAAgB,iBAAiB,MACtB;AACX,QAAM,EAAE,QAAQ,IAAI,cAAc;AAElC,MAAI,UAAU;AAEd,QAAM,kBAAkB,aAAa,IAAI,CAAC,oBAAoB;AAAA,IAC5D,cAAc,SAAS,SAAS,cAAc;AAAA,IAC9C,IAAI,SAAS,gBAAgB,QAAQ,cAAc,CAAC;AAAA;AAAA,IACpD,MAAM,IAAI,YAAY,cAAc,CAAC;AAAA;AAAA,EACvC,EAAE;AAGF,kBAAgB,QAAQ,CAAC,eAAe;AACtC,QAAI,WAAW;AACb,iBAAW,UAAU,WAAW,IAAI,UAAU,WAAW,YAAY;AAAA;AACvE,QAAI,WAAW;AACb,iBAAW,SAAS,WAAW,IAAI,eAAe,WAAW,YAAY;AAAA;AAAA,EAC7E,CAAC;AAED,aAAW;AAGX,QAAM,yBAAiC,gBACpC,IAAI,CAAC,eAAe,MAAM,WAAW,EAAE,MAAM,WAAW,IAAI,EAAE,EAC9D,KAAK,KAAK;AAEb,MAAI,WAAW;AACb,eAAW;AAAA,EAAqB,sBAAsB;AAAA;AAAA;AACxD,MAAI,WAAW;AACb,eAAW;AAAA,EAAuB,sBAAsB;AAAA;AAAA;AAE1D,SAAO;AACT;AAKO,MAAM,6BAA6B,CACxC,gBAAgB,iBAAiB,MAC9B;AACH,QAAM,EAAE,QAAQ,IAAI,cAAc;AAGlC,MAAI,CAAC,WAAW,OAAO,GAAG;AACxB,cAAU,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACxC;AAEA,QAAM,mBAA6B,yBAAyB,aAAa;AAGzE,QAAM,aAAa;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACA,gBAAc,QAAQ,SAAS,kBAAkB,GAAG,UAAU;AAE9D,QAAM,aAAa;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACA,gBAAc,QAAQ,SAAS,kBAAkB,GAAG,UAAU;AAChE;","names":[]}
1
+ {"version":3,"sources":["../../../../src/transpiler/dictionary_to_main/createDictionaryEntryPoint.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport { existsSync, mkdirSync, writeFileSync } from 'fs';\nimport { basename, extname, relative, resolve } from 'path';\nimport { getBuiltDictionariesPath } from '../../getBuiltDictionariesPath';\nimport { getBuiltUnmergedDictionariesPath } from '../../getBuiltUnmergedDictionariesPath';\nimport { getFileHash } from '../../utils';\n\n/**\n * This function generates the content of the dictionary list file\n */\nconst generateDictionaryListContent = (\n dictionaries: string[],\n format: 'cjs' | 'esm' = 'esm',\n configuration = getConfiguration()\n): string => {\n const { mainDir } = configuration.content;\n\n let content = '';\n\n const dictionariesRef = dictionaries.map((dictionaryPath) => ({\n relativePath: relative(mainDir, dictionaryPath),\n id: basename(dictionaryPath, extname(dictionaryPath)), // Get the base name as the dictionary id\n hash: `_${getFileHash(dictionaryPath)}`, // Get the hash of the dictionary to avoid conflicts\n }));\n\n // Import all dictionaries\n dictionariesRef.forEach((dictionary) => {\n if (format === 'esm')\n content += `import ${dictionary.hash} from '${dictionary.relativePath}';\\n`;\n if (format === 'cjs')\n content += `const ${dictionary.hash} = require('${dictionary.relativePath}');\\n`;\n });\n\n content += '\\n';\n\n // Format Dictionary Map\n const formattedDictionaryMap: string = dictionariesRef\n .map((dictionary) => ` \"${dictionary.id}\": ${dictionary.hash}`)\n .join(',\\n');\n\n if (format === 'esm')\n content += `export default {\\n${formattedDictionaryMap}\\n};\\n`;\n if (format === 'cjs')\n content += `module.exports = {\\n${formattedDictionaryMap}\\n};\\n`;\n\n return content;\n};\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const createDictionaryEntryPoint = (\n configuration = getConfiguration()\n) => {\n const { 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[] = getBuiltDictionariesPath(configuration);\n\n // Create the dictionary list file\n const cjsContent = generateDictionaryListContent(\n dictionariesPath,\n 'cjs',\n configuration\n );\n writeFileSync(resolve(mainDir, 'dictionaries.cjs'), cjsContent);\n\n const esmContent = generateDictionaryListContent(\n dictionariesPath,\n 'esm',\n configuration\n );\n writeFileSync(resolve(mainDir, 'dictionaries.mjs'), esmContent);\n\n const unmergedDictionariesPath: string[] =\n getBuiltUnmergedDictionariesPath(configuration);\n\n const unmergedCjsContent = generateDictionaryListContent(\n unmergedDictionariesPath,\n 'cjs',\n configuration\n );\n writeFileSync(\n resolve(mainDir, 'unmerged_dictionaries.cjs'),\n unmergedCjsContent\n );\n\n const unmergedEsmContent = generateDictionaryListContent(\n unmergedDictionariesPath,\n 'esm',\n configuration\n );\n writeFileSync(\n resolve(mainDir, 'unmerged_dictionaries.mjs'),\n unmergedEsmContent\n );\n};\n"],"mappings":"AAAA,SAAS,wBAAwB;AACjC,SAAS,YAAY,WAAW,qBAAqB;AACrD,SAAS,UAAU,SAAS,UAAU,eAAe;AACrD,SAAS,gCAAgC;AACzC,SAAS,wCAAwC;AACjD,SAAS,mBAAmB;AAK5B,MAAM,gCAAgC,CACpC,cACA,SAAwB,OACxB,gBAAgB,iBAAiB,MACtB;AACX,QAAM,EAAE,QAAQ,IAAI,cAAc;AAElC,MAAI,UAAU;AAEd,QAAM,kBAAkB,aAAa,IAAI,CAAC,oBAAoB;AAAA,IAC5D,cAAc,SAAS,SAAS,cAAc;AAAA,IAC9C,IAAI,SAAS,gBAAgB,QAAQ,cAAc,CAAC;AAAA;AAAA,IACpD,MAAM,IAAI,YAAY,cAAc,CAAC;AAAA;AAAA,EAC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ger } from "@intlayer/config";
2
+ const formatCode = async (filePath, code) => {
3
+ let prettier;
4
+ try {
5
+ prettier = require("prettier");
6
+ } catch (error) {
7
+ }
8
+ if (prettier) {
9
+ try {
10
+ const prettierConfig = await prettier.resolveConfig(filePath ?? "");
11
+ const formattedCode = await prettier.format(code, {
12
+ ...prettierConfig,
13
+ filepath: filePath
14
+ // Explicitly provide the filepath so Prettier can infer the parser
15
+ });
16
+ appLogger(`Applied Prettier formatting to ${filePath}`, {
17
+ level: "info",
18
+ isVerbose: true
19
+ });
20
+ return formattedCode;
21
+ } catch (error) {
22
+ const err = error;
23
+ appLogger(
24
+ `Failed to apply Prettier formatting to ${filePath}: ${err.message}`,
25
+ {
26
+ level: "warn",
27
+ isVerbose: true
28
+ }
29
+ );
30
+ }
31
+ }
32
+ return code;
33
+ };
34
+ export {
35
+ formatCode
36
+ };
37
+ //# sourceMappingURL=formatCode.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/writeContentDeclaration/formatCode.ts"],"sourcesContent":["import { appLogger } from '@intlayer/config';\n\nexport const formatCode = async (filePath: string, code: string) => {\n // Try to import prettier if it exists\n let prettier: any;\n try {\n prettier = require('prettier');\n } catch (error) {\n // Prettier is not installed, continue without it\n }\n\n // Apply Prettier formatting if it's available\n if (prettier) {\n try {\n // Try to find a prettier config file\n const prettierConfig = await prettier.resolveConfig(filePath ?? '');\n\n // Format the code with Prettier\n const formattedCode = await prettier.format(code, {\n ...prettierConfig,\n filepath: filePath, // Explicitly provide the filepath so Prettier can infer the parser\n });\n\n appLogger(`Applied Prettier formatting to ${filePath}`, {\n level: 'info',\n isVerbose: true,\n });\n\n return formattedCode;\n } catch (error) {\n const err = error as Error;\n appLogger(\n `Failed to apply Prettier formatting to ${filePath}: ${err.message}`,\n {\n level: 'warn',\n isVerbose: true,\n }\n );\n // Continue with unformatted code on prettier error\n }\n }\n\n return code;\n};\n"],"mappings":"AAAA,SAAS,iBAAiB;AAEnB,MAAM,aAAa,OAAO,UAAkB,SAAiB;AAElE,MAAI;AACJ,MAAI;AACF,eAAW,QAAQ,UAAU;AAAA,EAC/B,SAAS,OAAO;AAAA,EAEhB;AAGA,MAAI,UAAU;AACZ,QAAI;AAEF,YAAM,iBAAiB,MAAM,SAAS,cAAc,YAAY,EAAE;AAGlE,YAAM,gBAAgB,MAAM,SAAS,OAAO,MAAM;AAAA,QAChD,GAAG;AAAA,QACH,UAAU;AAAA;AAAA,MACZ,CAAC;AAED,gBAAU,kCAAkC,QAAQ,IAAI;AAAA,QACtD,OAAO;AAAA,QACP,WAAW;AAAA,MACb,CAAC;AAED,aAAO;AAAA,IACT,SAAS,OAAO;AACd,YAAM,MAAM;AACZ;AAAA,QACE,0CAA0C,QAAQ,KAAK,IAAI,OAAO;AAAA,QAClE;AAAA,UACE,OAAO;AAAA,UACP,WAAW;AAAA,QACb;AAAA,MACF;AAAA,IAEF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -1,23 +1,29 @@
1
- import { existsSync } from "fs";
2
- import * as fsPromises from "fs/promises";
3
- import { basename, dirname, extname } from "path";
4
- import { prepareContentDeclaration } from "@intlayer/chokidar";
5
1
  import configuration from "@intlayer/config/built";
6
- import dictionariesRecord from "@intlayer/dictionaries-entry";
2
+ import dictionariesRecord from "@intlayer/unmerged-dictionaries-entry";
7
3
  import deepEqual from "deep-equal";
4
+ import { existsSync } from "fs";
5
+ import { mkdir, writeFile } from "fs/promises";
6
+ import { dirname, extname } from "path";
7
+ import { prepareContentDeclaration } from "../prepareContentDeclaration.mjs";
8
+ import { writeJSFile } from "./writeJSFile.mjs";
8
9
  const DEFAULT_NEW_DICTIONARY_PATH = "intlayer-dictionaries";
9
- const writeContentDeclaration = async (dictionary, config = configuration, newDictionariesPath) => {
10
- const { content } = config;
11
- const { baseDir } = content;
12
- const newDictionaryRelativeLocationPath = newDictionariesPath ?? DEFAULT_NEW_DICTIONARY_PATH;
13
- const newDictionaryLocationPath = `${baseDir}/${newDictionaryRelativeLocationPath}`;
14
- const existingDictionary = dictionariesRecord[dictionary.key];
10
+ const formatContentDeclaration = async (dictionary) => {
15
11
  const preparedContentDeclaration = await prepareContentDeclaration(dictionary);
16
12
  const { filePath, $schema, ...dictionaryWithoutPath } = preparedContentDeclaration;
17
13
  const formattedContentDeclaration = {
18
14
  $schema: "https://intlayer.org/schema.json",
19
15
  ...dictionaryWithoutPath
20
16
  };
17
+ return formattedContentDeclaration;
18
+ };
19
+ const writeContentDeclaration = async (dictionary, config = configuration, newDictionariesPath) => {
20
+ const { content } = config;
21
+ const { baseDir } = content;
22
+ const newDictionaryRelativeLocationPath = newDictionariesPath ?? DEFAULT_NEW_DICTIONARY_PATH;
23
+ const newDictionaryLocationPath = `${baseDir}/${newDictionaryRelativeLocationPath}`;
24
+ const existingDictionary = dictionariesRecord[dictionary.key].filter((el) => el.filePath === dictionary.filePath);
25
+ const filePath = dictionary.filePath;
26
+ const formattedContentDeclaration = await formatContentDeclaration(dictionary);
21
27
  if (existingDictionary) {
22
28
  if (deepEqual(existingDictionary, dictionary)) {
23
29
  return {
@@ -26,28 +32,8 @@ const writeContentDeclaration = async (dictionary, config = configuration, newDi
26
32
  };
27
33
  } else {
28
34
  if (filePath) {
29
- const isDictionaryJSON = filePath.endsWith(".json");
30
- if (isDictionaryJSON) {
31
- const contentDeclarationPath = `${baseDir}/${filePath}`;
32
- await writeFileWithDirectories(
33
- contentDeclarationPath,
34
- formattedContentDeclaration
35
- );
36
- return { status: "updated", path: contentDeclarationPath };
37
- } else {
38
- await fsPromises.rm(filePath);
39
- const dictionariesDirPath = dirname(filePath);
40
- const dictionariesFileName = basename(filePath, extname(filePath));
41
- const newFilePath = `${dictionariesDirPath}/${dictionariesFileName}.json`;
42
- await writeFileWithDirectories(
43
- newFilePath,
44
- formattedContentDeclaration
45
- );
46
- return {
47
- status: "replaced",
48
- path: newFilePath
49
- };
50
- }
35
+ await writeFileWithDirectories(filePath, formattedContentDeclaration);
36
+ return { status: "updated", path: filePath };
51
37
  } else {
52
38
  const contentDeclarationPath = `${newDictionaryLocationPath}/${dictionary.key}.content.json`;
53
39
  await writeFileWithDirectories(
@@ -77,10 +63,23 @@ const writeFileWithDirectories = async (filePath, data) => {
77
63
  const dir = dirname(filePath);
78
64
  const directoryExists = existsSync(dir);
79
65
  if (!directoryExists) {
80
- await fsPromises.mkdir(dir, { recursive: true });
66
+ await mkdir(dir, { recursive: true });
67
+ }
68
+ const extention = extname(filePath);
69
+ const acceptedExtensions = configuration.content.fileExtensions.map(
70
+ (extention2) => extname(extention2)
71
+ );
72
+ if (!acceptedExtensions.includes(extention)) {
73
+ throw new Error(
74
+ `Invalid file extension: ${extention}, file: ${filePath}`
75
+ );
76
+ }
77
+ if (extention === ".json") {
78
+ const jsonDictionary = JSON.stringify(data, null, 2);
79
+ await writeFile(filePath, jsonDictionary);
80
+ } else {
81
+ await writeJSFile(filePath, data);
81
82
  }
82
- const jsonDictionary = JSON.stringify(data, null, 2);
83
- await fsPromises.writeFile(filePath, jsonDictionary);
84
83
  } catch (error) {
85
84
  throw new Error(`Error writing file to ${filePath}: ${error}`);
86
85
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport * as fsPromises from 'fs/promises';\nimport { basename, dirname, extname } from 'path';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { prepareContentDeclaration } from '@intlayer/chokidar';\nimport configuration from '@intlayer/config/built';\nimport type { Dictionary } from '@intlayer/core';\nimport dictionariesRecord from '@intlayer/dictionaries-entry';\nimport deepEqual from 'deep-equal';\nimport type { DictionaryStatus } from './dictionaryStatus';\n\nconst DEFAULT_NEW_DICTIONARY_PATH = 'intlayer-dictionaries';\n\nexport const writeContentDeclaration = async (\n dictionary: Dictionary,\n config: IntlayerConfig = configuration,\n newDictionariesPath?: string\n): Promise<{ status: DictionaryStatus; path: string }> => {\n const { content } = config;\n const { baseDir } = content;\n\n const newDictionaryRelativeLocationPath =\n newDictionariesPath ?? DEFAULT_NEW_DICTIONARY_PATH;\n const newDictionaryLocationPath = `${baseDir}/${newDictionaryRelativeLocationPath}`;\n\n const existingDictionary = dictionariesRecord[dictionary.key];\n\n const preparedContentDeclaration =\n await prepareContentDeclaration(dictionary);\n\n const { filePath, $schema, ...dictionaryWithoutPath } =\n preparedContentDeclaration;\n const formattedContentDeclaration = {\n $schema: 'https://intlayer.org/schema.json',\n ...dictionaryWithoutPath,\n };\n\n if (existingDictionary) {\n // Compare existing dictionary with distant dictionary\n if (deepEqual(existingDictionary, dictionary)) {\n // Up to date, nothing to do\n return {\n status: 'up-to-date',\n path: filePath!,\n };\n } else {\n if (filePath) {\n const isDictionaryJSON = filePath.endsWith('.json');\n\n if (isDictionaryJSON) {\n const contentDeclarationPath = `${baseDir}/${filePath}`;\n\n await writeFileWithDirectories(\n contentDeclarationPath,\n formattedContentDeclaration\n );\n return { status: 'updated', path: contentDeclarationPath };\n } else {\n // Remove the existing dictionary file\n await fsPromises.rm(filePath);\n\n // Write the dictionary to the intlayer-dictionaries directory\n const dictionariesDirPath = dirname(filePath);\n const dictionariesFileName = basename(filePath, extname(filePath));\n\n const newFilePath = `${dictionariesDirPath}/${dictionariesFileName}.json`;\n\n await writeFileWithDirectories(\n newFilePath,\n formattedContentDeclaration\n );\n\n return {\n status: 'replaced',\n path: newFilePath,\n };\n }\n } else {\n // Write the dictionary to the intlayer-dictionaries directory\n const contentDeclarationPath = `${newDictionaryLocationPath}/${dictionary.key}.content.json`;\n\n await writeFileWithDirectories(\n contentDeclarationPath,\n formattedContentDeclaration\n );\n\n return {\n status: 'reimported in new location',\n path: contentDeclarationPath,\n };\n }\n }\n } else {\n // No existing dictionary, write to new location\n const contentDeclarationPath = `${newDictionaryLocationPath}/${dictionary.key}.content.json`;\n\n await writeFileWithDirectories(\n contentDeclarationPath,\n formattedContentDeclaration\n );\n\n return {\n status: 'imported',\n path: contentDeclarationPath,\n };\n }\n};\n\nconst writeFileWithDirectories = async (\n filePath: string,\n data: string | Buffer\n): Promise<void> => {\n try {\n // Extract the directory from the file path\n const dir = dirname(filePath);\n\n // Check if the directory exists\n const directoryExists = existsSync(dir);\n\n if (!directoryExists) {\n // Create the directory recursively\n await fsPromises.mkdir(dir, { recursive: true });\n }\n\n const jsonDictionary = JSON.stringify(data, null, 2);\n\n // Write the file\n await fsPromises.writeFile(filePath, jsonDictionary);\n } catch (error) {\n throw new Error(`Error writing file to ${filePath}: ${error}`);\n }\n};\n"],"mappings":"AAAA,SAAS,kBAAkB;AAC3B,YAAY,gBAAgB;AAC5B,SAAS,UAAU,SAAS,eAAe;AAE3C,SAAS,iCAAiC;AAC1C,OAAO,mBAAmB;AAE1B,OAAO,wBAAwB;AAC/B,OAAO,eAAe;AAGtB,MAAM,8BAA8B;AAE7B,MAAM,0BAA0B,OACrC,YACA,SAAyB,eACzB,wBACwD;AACxD,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,EAAE,QAAQ,IAAI;AAEpB,QAAM,oCACJ,uBAAuB;AACzB,QAAM,4BAA4B,GAAG,OAAO,IAAI,iCAAiC;AAEjF,QAAM,qBAAqB,mBAAmB,WAAW,GAAG;AAE5D,QAAM,6BACJ,MAAM,0BAA0B,UAAU;AAE5C,QAAM,EAAE,UAAU,SAAS,GAAG,sBAAsB,IAClD;AACF,QAAM,8BAA8B;AAAA,IAClC,SAAS;AAAA,IACT,GAAG;AAAA,EACL;AAEA,MAAI,oBAAoB;AAEtB,QAAI,UAAU,oBAAoB,UAAU,GAAG;AAE7C,aAAO;AAAA,QACL,QAAQ;AAAA,QACR,MAAM;AAAA,MACR;AAAA,IACF,OAAO;AACL,UAAI,UAAU;AACZ,cAAM,mBAAmB,SAAS,SAAS,OAAO;AAElD,YAAI,kBAAkB;AACpB,gBAAM,yBAAyB,GAAG,OAAO,IAAI,QAAQ;AAErD,gBAAM;AAAA,YACJ;AAAA,YACA;AAAA,UACF;AACA,iBAAO,EAAE,QAAQ,WAAW,MAAM,uBAAuB;AAAA,QAC3D,OAAO;AAEL,gBAAM,WAAW,GAAG,QAAQ;AAG5B,gBAAM,sBAAsB,QAAQ,QAAQ;AAC5C,gBAAM,uBAAuB,SAAS,UAAU,QAAQ,QAAQ,CAAC;AAEjE,gBAAM,cAAc,GAAG,mBAAmB,IAAI,oBAAoB;AAElE,gBAAM;AAAA,YACJ;AAAA,YACA;AAAA,UACF;AAEA,iBAAO;AAAA,YACL,QAAQ;AAAA,YACR,MAAM;AAAA,UACR;AAAA,QACF;AAAA,MACF,OAAO;AAEL,cAAM,yBAAyB,GAAG,yBAAyB,IAAI,WAAW,GAAG;AAE7E,cAAM;AAAA,UACJ;AAAA,UACA;AAAA,QACF;AAEA,eAAO;AAAA,UACL,QAAQ;AAAA,UACR,MAAM;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF,OAAO;AAEL,UAAM,yBAAyB,GAAG,yBAAyB,IAAI,WAAW,GAAG;AAE7E,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,IACF;AAEA,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,MAAM;AAAA,IACR;AAAA,EACF;AACF;AAEA,MAAM,2BAA2B,OAC/B,UACA,SACkB;AAClB,MAAI;AAEF,UAAM,MAAM,QAAQ,QAAQ;AAG5B,UAAM,kBAAkB,WAAW,GAAG;AAEtC,QAAI,CAAC,iBAAiB;AAEpB,YAAM,WAAW,MAAM,KAAK,EAAE,WAAW,KAAK,CAAC;AAAA,IACjD;AAEA,UAAM,iBAAiB,KAAK,UAAU,MAAM,MAAM,CAAC;AAGnD,UAAM,WAAW,UAAU,UAAU,cAAc;AAAA,EACrD,SAAS,OAAO;AACd,UAAM,IAAI,MAAM,yBAAyB,QAAQ,KAAK,KAAK,EAAE;AAAA,EAC/D;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport dictionariesRecord from '@intlayer/unmerged-dictionaries-entry';\nimport deepEqual from 'deep-equal';\nimport { existsSync } from 'fs';\nimport { mkdir, writeFile } from 'fs/promises';\nimport { dirname, extname } from 'path';\nimport { prepareContentDeclaration } from '../prepareContentDeclaration';\nimport type { DictionaryStatus } from './dictionaryStatus';\nimport { writeJSFile } from './writeJSFile';\n\nconst DEFAULT_NEW_DICTIONARY_PATH = 'intlayer-dictionaries';\n\nconst formatContentDeclaration = async (dictionary: Dictionary) => {\n // Clean Markdown, Insertion, File, etc. node metadata\n const preparedContentDeclaration =\n await prepareContentDeclaration(dictionary);\n\n // Remove the filePath from the dictionary and set $schema\n const { filePath, $schema, ...dictionaryWithoutPath } =\n preparedContentDeclaration;\n\n const formattedContentDeclaration = {\n $schema: 'https://intlayer.org/schema.json',\n ...dictionaryWithoutPath,\n };\n\n return formattedContentDeclaration;\n};\n\nexport const writeContentDeclaration = async (\n dictionary: Dictionary,\n config: IntlayerConfig = configuration,\n newDictionariesPath?: string\n): Promise<{ status: DictionaryStatus; path: string }> => {\n const { content } = config;\n const { baseDir } = content;\n\n const newDictionaryRelativeLocationPath =\n newDictionariesPath ?? DEFAULT_NEW_DICTIONARY_PATH;\n const newDictionaryLocationPath = `${baseDir}/${newDictionaryRelativeLocationPath}`;\n\n const existingDictionary = (\n dictionariesRecord[dictionary.key] as Dictionary[]\n ).filter((el) => el.filePath === dictionary.filePath);\n\n const filePath = dictionary.filePath;\n const formattedContentDeclaration =\n await formatContentDeclaration(dictionary);\n\n if (existingDictionary) {\n // Compare existing dictionary with distant dictionary\n if (deepEqual(existingDictionary, dictionary)) {\n // Up to date, nothing to do\n return {\n status: 'up-to-date',\n path: filePath!,\n };\n } else {\n if (filePath) {\n await writeFileWithDirectories(filePath, formattedContentDeclaration);\n\n return { status: 'updated', path: filePath };\n } else {\n // Write the dictionary to the intlayer-dictionaries directory\n const contentDeclarationPath = `${newDictionaryLocationPath}/${dictionary.key}.content.json`;\n\n await writeFileWithDirectories(\n contentDeclarationPath,\n formattedContentDeclaration\n );\n\n return {\n status: 'reimported in new location',\n path: contentDeclarationPath,\n };\n }\n }\n } else {\n // No existing dictionary, write to new location\n const contentDeclarationPath = `${newDictionaryLocationPath}/${dictionary.key}.content.json`;\n\n await writeFileWithDirectories(\n contentDeclarationPath,\n formattedContentDeclaration\n );\n\n return {\n status: 'imported',\n path: contentDeclarationPath,\n };\n }\n};\n\nconst writeFileWithDirectories = async (\n filePath: string,\n data: string | Buffer\n): Promise<void> => {\n try {\n // Extract the directory from the file path\n const dir = dirname(filePath);\n\n // Check if the directory exists\n const directoryExists = existsSync(dir);\n\n if (!directoryExists) {\n // Create the directory recursively\n await mkdir(dir, { recursive: true });\n }\n\n const extention = extname(filePath);\n const acceptedExtensions = configuration.content.fileExtensions.map(\n (extention) => extname(extention)\n );\n\n if (!acceptedExtensions.includes(extention)) {\n throw new Error(\n `Invalid file extension: ${extention}, file: ${filePath}`\n );\n }\n\n if (extention === '.json') {\n const jsonDictionary = JSON.stringify(data, null, 2);\n\n // Write the file\n await writeFile(filePath, jsonDictionary);\n } else {\n await writeJSFile(filePath, data as unknown as Dictionary);\n }\n } catch (error) {\n throw new Error(`Error writing file to ${filePath}: ${error}`);\n }\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAG1B,OAAO,wBAAwB;AAC/B,OAAO,eAAe;AACtB,SAAS,kBAAkB;AAC3B,SAAS,OAAO,iBAAiB;AACjC,SAAS,SAAS,eAAe;AACjC,SAAS,iCAAiC;AAE1C,SAAS,mBAAmB;AAE5B,MAAM,8BAA8B;AAEpC,MAAM,2BAA2B,OAAO,eAA2B;AAEjE,QAAM,6BACJ,MAAM,0BAA0B,UAAU;AAG5C,QAAM,EAAE,UAAU,SAAS,GAAG,sBAAsB,IAClD;AAEF,QAAM,8BAA8B;AAAA,IAClC,SAAS;AAAA,IACT,GAAG;AAAA,EACL;AAEA,SAAO;AACT;AAEO,MAAM,0BAA0B,OACr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